Commit 748f767dabb9a9bbea50cc4c4a5b4f789eba0427

Authored by 房远帅
1 parent 12689630

楚江ERP:客户资信-修改、变更

@@ -31,16 +31,10 @@ public class GetCorePersonnelHistoryBo extends BaseBo<CorePersonnelHistory> { @@ -31,16 +31,10 @@ public class GetCorePersonnelHistoryBo extends BaseBo<CorePersonnelHistory> {
31 private String personnelId; 31 private String personnelId;
32 32
33 /** 33 /**
34 - * 第几次变更  
35 - */  
36 - @ApiModelProperty("第几次变更")  
37 - private String sort;  
38 -  
39 - /**  
40 * 客户资信 34 * 客户资信
41 */ 35 */
42 @ApiModelProperty("客户资信") 36 @ApiModelProperty("客户资信")
43 - private String creditId; 37 + private String creditHistoryId;
44 38
45 /** 39 /**
46 * 姓名 40 * 姓名
@@ -40,7 +40,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto { @@ -40,7 +40,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
40 /** 40 /**
41 * 客户资信 41 * 客户资信
42 */ 42 */
43 - private String creditId; 43 + private String creditHistoryId;
44 44
45 /** 45 /**
46 * 姓名 46 * 姓名
@@ -60,8 +60,7 @@ public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePerso @@ -60,8 +60,7 @@ public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePerso
60 CorePersonnelHistory data = new CorePersonnelHistory(); 60 CorePersonnelHistory data = new CorePersonnelHistory();
61 data.setId(IdUtil.getId()); 61 data.setId(IdUtil.getId());
62 data.setPersonnelId(vo.getPersonnelId()); 62 data.setPersonnelId(vo.getPersonnelId());
63 - data.setSort(vo.getSort());  
64 - data.setCreditId(vo.getCreditId()); 63 + data.setCreditHistoryId(vo.getCreditHistoryId());
65 data.setName(vo.getName()); 64 data.setName(vo.getName());
66 if (!StringUtil.isBlank(vo.getSex())) { 65 if (!StringUtil.isBlank(vo.getSex())) {
67 data.setSex(vo.getSex()); 66 data.setSex(vo.getSex());
@@ -134,6 +134,14 @@ public class CorePersonnelServiceImpl extends BaseMpServiceImpl<CorePersonnelMap @@ -134,6 +134,14 @@ public class CorePersonnelServiceImpl extends BaseMpServiceImpl<CorePersonnelMap
134 OpLogUtil.setExtra(vo); 134 OpLogUtil.setExtra(vo);
135 } 135 }
136 136
  137 + @OpLog(type = OtherOpLogType.class, name = "删除核心人员,ID:{}", params = {"#id"})
  138 + @Transactional(rollbackFor = Exception.class)
  139 + @Override
  140 + public void deleteById(String id) {
  141 +
  142 + getBaseMapper().deleteById(id);
  143 + }
  144 +
137 @CacheEvict(value = CorePersonnel.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") 145 @CacheEvict(value = CorePersonnel.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
138 @Override 146 @Override
139 public void cleanCacheByKey(Serializable key) { 147 public void cleanCacheByKey(Serializable key) {
@@ -8,6 +8,8 @@ import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo; @@ -8,6 +8,8 @@ import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo;
8 import com.lframework.starter.web.inner.entity.SysUser; 8 import com.lframework.starter.web.inner.entity.SysUser;
9 import com.lframework.starter.web.inner.service.system.SysUserService; 9 import com.lframework.starter.web.inner.service.system.SysUserService;
10 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo; 10 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
  11 +import com.lframework.xingyun.sc.entity.CorePersonnel;
  12 +import com.lframework.xingyun.sc.entity.CorePersonnelHistory;
11 import com.lframework.xingyun.sc.entity.CustomerCredit; 13 import com.lframework.xingyun.sc.entity.CustomerCredit;
12 import com.lframework.starter.web.core.impl.BaseMpServiceImpl; 14 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
13 import com.lframework.starter.web.core.utils.PageResultUtil; 15 import com.lframework.starter.web.core.utils.PageResultUtil;
@@ -22,24 +24,27 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; @@ -22,24 +24,27 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog;
22 import com.lframework.starter.web.core.utils.PageHelperUtil; 24 import com.lframework.starter.web.core.utils.PageHelperUtil;
23 import com.lframework.starter.common.utils.Assert; 25 import com.lframework.starter.common.utils.Assert;
24 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 26 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  27 +import com.lframework.xingyun.sc.entity.CustomerCreditHistory;
25 import com.lframework.xingyun.sc.mappers.CustomerCreditMapper; 28 import com.lframework.xingyun.sc.mappers.CustomerCreditMapper;
  29 +import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService;
26 import com.lframework.xingyun.sc.service.customer.CorePersonnelService; 30 import com.lframework.xingyun.sc.service.customer.CorePersonnelService;
  31 +import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
27 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 32 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
28 -import com.lframework.xingyun.sc.vo.customer.credit.CreateCorePersonnelVo;  
29 -import com.lframework.xingyun.sc.vo.customer.credit.CreateCustomerCreditVo;  
30 -import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;  
31 -import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo; 33 +import com.lframework.xingyun.sc.vo.customer.credit.*;
32 import org.apache.commons.collections.CollectionUtils; 34 import org.apache.commons.collections.CollectionUtils;
33 import org.springframework.cache.annotation.CacheEvict; 35 import org.springframework.cache.annotation.CacheEvict;
34 import org.springframework.cache.annotation.Cacheable; 36 import org.springframework.cache.annotation.Cacheable;
35 import org.springframework.stereotype.Service; 37 import org.springframework.stereotype.Service;
36 import org.springframework.transaction.annotation.Transactional; 38 import org.springframework.transaction.annotation.Transactional;
37 import net.sourceforge.pinyin4j.PinyinHelper; 39 import net.sourceforge.pinyin4j.PinyinHelper;
  40 +import picocli.CommandLine;
38 41
39 import javax.annotation.Resource; 42 import javax.annotation.Resource;
40 import java.util.HashSet; 43 import java.util.HashSet;
41 import java.util.List; 44 import java.util.List;
  45 +import java.util.Map;
42 import java.util.Set; 46 import java.util.Set;
  47 +import java.util.stream.Collectors;
43 import java.util.stream.IntStream; 48 import java.util.stream.IntStream;
44 49
45 @Service 50 @Service
@@ -51,6 +56,10 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -51,6 +56,10 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
51 private SysUserService sysUserService; 56 private SysUserService sysUserService;
52 @Resource 57 @Resource
53 private CustomerCreditMapper customerCreditMapper; 58 private CustomerCreditMapper customerCreditMapper;
  59 + @Resource
  60 + private CustomerCreditHistoryService customerCreditHistoryService;
  61 + @Resource
  62 + private CorePersonnelHistoryService corePersonnelHistoryService;
54 63
55 @Override 64 @Override
56 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) { 65 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
@@ -252,10 +261,220 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -252,10 +261,220 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
252 @Override 261 @Override
253 public void update(UpdateCustomerCreditVo vo) { 262 public void update(UpdateCustomerCreditVo vo) {
254 263
255 - CustomerCredit data = getBaseMapper().selectById(vo.getId()); 264 + CustomerCredit data = customerCreditMapper.findById(vo.getId());
256 if (ObjectUtil.isNull(data)) { 265 if (ObjectUtil.isNull(data)) {
257 throw new DefaultClientException("客户资信表不存在!"); 266 throw new DefaultClientException("客户资信表不存在!");
258 } 267 }
  268 + //变更记录
  269 + String type = vo.getType();
  270 + QueryCorePersonnelVo queryCorePersonnelVo = new QueryCorePersonnelVo();
  271 + queryCorePersonnelVo.setCreditId(data.getId());
  272 + List<CorePersonnel> corePersonnelList = corePersonnelService.query(queryCorePersonnelVo);
  273 + if ("CHANGE".equals(type)) {
  274 + CreateCustomerCreditHistoryVo historyVo = new CreateCustomerCreditHistoryVo();
  275 + historyVo.setCreditId(data.getId());
  276 + //第几次变更序号
  277 + QueryCustomerCreditHistoryVo queryCustomerCreditHistoryVo = new QueryCustomerCreditHistoryVo();
  278 + queryCustomerCreditHistoryVo.setCreditId(data.getId());
  279 + List<CustomerCreditHistory> query = customerCreditHistoryService.query(queryCustomerCreditHistoryVo);
  280 + if (CollectionUtils.isEmpty(query)) {
  281 + historyVo.setSort("1");
  282 + } else {
  283 + int i = query.size() + 1;
  284 + historyVo.setSort(String.valueOf(i));
  285 + }
  286 + historyVo.setSerialNumber(data.getSerialNumber());
  287 + if (!StringUtil.isBlank(data.getRegion())) {
  288 + historyVo.setRegion(data.getRegion());
  289 + }
  290 + if (data.getRegisterDate() != null) {
  291 + historyVo.setRegisterDate(data.getRegisterDate());
  292 + }
  293 + if (!StringUtil.isBlank(data.getCustomerShortName())) {
  294 + historyVo.setCustomerShortName(data.getCustomerShortName());
  295 + }
  296 + if (!StringUtil.isBlank(data.getEnterpriseType())) {
  297 + historyVo.setEnterpriseType(data.getEnterpriseType());
  298 + }
  299 + if (!StringUtil.isBlank(data.getCompanyId())) {
  300 + historyVo.setCompanyId(data.getCompanyId());
  301 + }
  302 + if (!StringUtil.isBlank(data.getCompanyNature())) {
  303 + historyVo.setCompanyNature(data.getCompanyNature());
  304 + }
  305 + if (!StringUtil.isBlank(data.getCompanyAddress())) {
  306 + historyVo.setCompanyAddress(data.getCompanyAddress());
  307 + }
  308 + if (data.getRegisteredCapital() != null) {
  309 + historyVo.setRegisteredCapital(data.getRegisteredCapital());
  310 + }
  311 + if (!StringUtil.isBlank(data.getBankAccount())) {
  312 + historyVo.setBankAccount(data.getBankAccount());
  313 + }
  314 + if (!StringUtil.isBlank(data.getBankName())) {
  315 + historyVo.setBankName(data.getBankName());
  316 + }
  317 + if (!StringUtil.isBlank(data.getTaxNumber())) {
  318 + historyVo.setTaxNumber(data.getTaxNumber());
  319 + }
  320 + if (data.getRegistrationTime() != null) {
  321 + historyVo.setRegistrationTime(data.getRegistrationTime());
  322 + }
  323 + if (!StringUtil.isBlank(data.getBusinessYears())) {
  324 + historyVo.setBusinessYears(data.getBusinessYears());
  325 + }
  326 + if (!StringUtil.isBlank(data.getBusinessScope())) {
  327 + historyVo.setBusinessScope(data.getBusinessScope());
  328 + }
  329 + if (!StringUtil.isBlank(data.getBusinessProperty())) {
  330 + historyVo.setBusinessProperty(data.getBusinessProperty());
  331 + }
  332 + if (!StringUtil.isBlank(data.getLandArea())) {
  333 + historyVo.setLandArea(data.getLandArea());
  334 + }
  335 + if (!StringUtil.isBlank(data.getStorageConditions())) {
  336 + historyVo.setStorageConditions(data.getStorageConditions());
  337 + }
  338 + if (data.getEmployeeCount() != null) {
  339 + historyVo.setEmployeeCount(data.getEmployeeCount());
  340 + }
  341 + if (!StringUtil.isBlank(data.getEquipmentAttributes())) {
  342 + historyVo.setEquipmentAttributes(data.getEquipmentAttributes());
  343 + }
  344 + if (!StringUtil.isBlank(data.getAssetEvaluation())) {
  345 + historyVo.setAssetEvaluation(data.getAssetEvaluation());
  346 + }
  347 + if (!StringUtil.isBlank(data.getLastYearSales())) {
  348 + historyVo.setLastYearSales(data.getLastYearSales());
  349 + }
  350 + if (!StringUtil.isBlank(data.getMonthlyAvgSales())) {
  351 + historyVo.setMonthlyAvgSales(data.getMonthlyAvgSales());
  352 + }
  353 + if (!StringUtil.isBlank(data.getInvoiceItemUnit())) {
  354 + historyVo.setInvoiceItemUnit(data.getInvoiceItemUnit());
  355 + }
  356 + if (!StringUtil.isBlank(data.getProductMatch())) {
  357 + historyVo.setProductMatch(data.getProductMatch());
  358 + }
  359 + if (!StringUtil.isBlank(data.getMajorCustomers())) {
  360 + historyVo.setMajorCustomers(data.getMajorCustomers());
  361 + }
  362 + if (!StringUtil.isBlank(data.getMainProjects())) {
  363 + historyVo.setMainProjects(data.getMainProjects());
  364 + }
  365 + if (!StringUtil.isBlank(data.getIndustryInvolved())) {
  366 + historyVo.setIndustryInvolved(data.getIndustryInvolved());
  367 + }
  368 + if (!StringUtil.isBlank(data.getIndustryExperience())) {
  369 + historyVo.setIndustryExperience(data.getIndustryExperience());
  370 + }
  371 + if (!StringUtil.isBlank(data.getHasDispute())) {
  372 + historyVo.setHasDispute(data.getHasDispute());
  373 + }
  374 + if (!StringUtil.isBlank(data.getCooperationStartDate())) {
  375 + historyVo.setCooperationStartDate(data.getCooperationStartDate());
  376 + }
  377 + if (!StringUtil.isBlank(data.getMonthlyAvgVolume())) {
  378 + historyVo.setMonthlyAvgVolume(data.getMonthlyAvgVolume());
  379 + }
  380 + if (!StringUtil.isBlank(data.getIsVerbalAgreement())) {
  381 + historyVo.setIsVerbalAgreement(data.getIsVerbalAgreement());
  382 + }
  383 + if (!StringUtil.isBlank(data.getOtherAgreements())) {
  384 + historyVo.setOtherAgreements(data.getOtherAgreements());
  385 + }
  386 + if (!StringUtil.isBlank(data.getHasLongTermContract())) {
  387 + historyVo.setHasLongTermContract(data.getHasLongTermContract());
  388 + }
  389 + if (!StringUtil.isBlank(data.getContractType())) {
  390 + historyVo.setContractType(data.getContractType());
  391 + }
  392 + if (!StringUtil.isBlank(data.getHasInterruption())) {
  393 + historyVo.setHasInterruption(data.getHasInterruption());
  394 + }
  395 + if (!StringUtil.isBlank(data.getSettlementPeriod())) {
  396 + historyVo.setSettlementPeriod(data.getSettlementPeriod());
  397 + }
  398 + if (!StringUtil.isBlank(data.getMaterialSupplyPlan())) {
  399 + historyVo.setMaterialSupplyPlan(data.getMaterialSupplyPlan());
  400 + }
  401 + if (!StringUtil.isBlank(data.getSuggestedCategory())) {
  402 + historyVo.setSuggestedCategory(data.getSuggestedCategory());
  403 + }
  404 + if (!StringUtil.isBlank(data.getCreditLimit())) {
  405 + historyVo.setCreditLimit(data.getCreditLimit());
  406 + }
  407 + if (!StringUtil.isBlank(data.getInvestigator())) {
  408 + historyVo.setInvestigator(data.getInvestigator());
  409 + }
  410 + if (!StringUtil.isBlank(data.getSupervisorReview())) {
  411 + historyVo.setSupervisorReview(data.getSupervisorReview());
  412 + }
  413 + if (!StringUtil.isBlank(data.getAnnualTotalSales())) {
  414 + historyVo.setAnnualTotalSales(data.getAnnualTotalSales());
  415 + }
  416 + if (!StringUtil.isBlank(data.getMainIndustry())) {
  417 + historyVo.setMainIndustry(data.getMainIndustry());
  418 + }
  419 + if (!StringUtil.isBlank(data.getAnnualMaterialOverview())) {
  420 + historyVo.setAnnualMaterialOverview(data.getAnnualMaterialOverview());
  421 + }
  422 + if (!StringUtil.isBlank(data.getCompanySettlementPeriod())) {
  423 + historyVo.setCompanySettlementPeriod(data.getCompanySettlementPeriod());
  424 + }
  425 + if (!StringUtil.isBlank(data.getCompanyCreditLimit())) {
  426 + historyVo.setCompanyCreditLimit(data.getCompanyCreditLimit());
  427 + }
  428 + if (!StringUtil.isBlank(data.getCompanyMaterialSupplyPlan())) {
  429 + historyVo.setCompanyMaterialSupplyPlan(data.getCompanyMaterialSupplyPlan());
  430 + }
  431 + if (!StringUtil.isBlank(data.getCompanySuggestedCategory())) {
  432 + historyVo.setCompanySuggestedCategory(data.getCompanySuggestedCategory());
  433 + }
  434 + if (!StringUtil.isBlank(data.getStatus())) {
  435 + historyVo.setStatus(data.getStatus());
  436 + }
  437 + if (!StringUtil.isBlank(data.getCertificationCertificate())) {
  438 + historyVo.setCertificationCertificate(data.getCertificationCertificate());
  439 + }
  440 + String historyId = customerCreditHistoryService.create(historyVo);
  441 + if (CollectionUtils.isNotEmpty(corePersonnelList)) {
  442 + for (CorePersonnel corePersonnel : corePersonnelList) {
  443 + CreateCorePersonnelHistoryVo personnelHistoryVo = new CreateCorePersonnelHistoryVo();
  444 + personnelHistoryVo.setPersonnelId(corePersonnel.getId());
  445 + personnelHistoryVo.setCreditHistoryId(historyId);
  446 + personnelHistoryVo.setName(corePersonnel.getName());
  447 + if (!StringUtil.isBlank(corePersonnel.getSex())) {
  448 + personnelHistoryVo.setSex(corePersonnel.getSex());
  449 + }
  450 + if (!StringUtil.isBlank(corePersonnel.getNativePlace())) {
  451 + personnelHistoryVo.setNativePlace(corePersonnel.getNativePlace());
  452 + }
  453 + if (!StringUtil.isBlank(corePersonnel.getAge())) {
  454 + personnelHistoryVo.setAge(corePersonnel.getAge());
  455 + }
  456 + if (!StringUtil.isBlank(corePersonnel.getPosition())) {
  457 + personnelHistoryVo.setPosition(corePersonnel.getPosition());
  458 + }
  459 + if (!StringUtil.isBlank(corePersonnel.getMobile())) {
  460 + personnelHistoryVo.setMobile(corePersonnel.getMobile());
  461 + }
  462 + if (!StringUtil.isBlank(corePersonnel.getPhone())) {
  463 + personnelHistoryVo.setPhone(corePersonnel.getPhone());
  464 + }
  465 + if (!StringUtil.isBlank(corePersonnel.getEmail())) {
  466 + personnelHistoryVo.setEmail(corePersonnel.getEmail());
  467 + }
  468 + if (!StringUtil.isBlank(corePersonnel.getAddress())) {
  469 + personnelHistoryVo.setAddress(corePersonnel.getAddress());
  470 + }
  471 + if (!StringUtil.isBlank(corePersonnel.getPersonId())) {
  472 + personnelHistoryVo.setPersonId(corePersonnel.getPersonId());
  473 + }
  474 + corePersonnelHistoryService.create(personnelHistoryVo);
  475 + }
  476 + }
  477 + }
259 478
260 LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class) 479 LambdaUpdateWrapper<CustomerCredit> updateWrapper = Wrappers.lambdaUpdate(CustomerCredit.class)
261 .set(CustomerCredit::getRegion, StringUtil.isBlank(vo.getRegion()) ? null : vo.getRegion()) 480 .set(CustomerCredit::getRegion, StringUtil.isBlank(vo.getRegion()) ? null : vo.getRegion())
@@ -314,11 +533,80 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -314,11 +533,80 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
314 getBaseMapper().update(updateWrapper); 533 getBaseMapper().update(updateWrapper);
315 //更新核心人员 534 //更新核心人员
316 //todo fys 考虑删除怎么做 535 //todo fys 考虑删除怎么做
317 - List<CreateCorePersonnelVo> corePersonnelList = vo.getCorePersonnelList();  
318 - if (CollectionUtils.isNotEmpty(corePersonnelList)) {  
319 - for (CreateCorePersonnelVo corePersonnelVo : corePersonnelList) {  
320 - corePersonnelVo.setCreditId(data.getId());  
321 - corePersonnelService.update(); 536 + List<UpdateCorePersonnelVo> corePersonnelListNew = vo.getCorePersonnelList();
  537 + if (CollectionUtils.isNotEmpty(corePersonnelListNew)) {
  538 + Set<String> oldIds = corePersonnelList.stream().map(CorePersonnel::getId).collect(Collectors.toSet());
  539 + Set<String> newIds = corePersonnelListNew.stream().map(UpdateCorePersonnelVo::getId).collect(Collectors.toSet());
  540 + // 计算差异
  541 + Set<String> addedIds = new HashSet<>(newIds);
  542 + addedIds.removeAll(oldIds); // 新增:new 有,old 没有
  543 +
  544 + Set<String> removedIds = new HashSet<>(oldIds);
  545 + removedIds.removeAll(newIds); // 删除:old 有,new 没有
  546 +
  547 + Set<String> unchangedIds = new HashSet<>(oldIds);
  548 + unchangedIds.retainAll(newIds); // 不变:交集
  549 +
  550 + // 如果需要获取对应的实体对象(注意:id 唯一)
  551 + Map<String, CorePersonnel> oldMap = corePersonnelList.stream().collect(Collectors.toMap(CorePersonnel::getId, e -> e));
  552 + Map<String, UpdateCorePersonnelVo> newMap = corePersonnelListNew.stream().collect(Collectors.toMap(UpdateCorePersonnelVo::getId, e -> e));
  553 +
  554 + List<UpdateCorePersonnelVo> added = addedIds.stream().map(newMap::get).collect(Collectors.toList());
  555 + List<CorePersonnel> removed = removedIds.stream().map(oldMap::get).collect(Collectors.toList());
  556 + List<UpdateCorePersonnelVo> updated = unchangedIds.stream().map(newMap::get).collect(Collectors.toList());
  557 + // 输出结果
  558 + System.out.println("新增: " + added);
  559 + System.out.println("删除: " + removed);
  560 + System.out.println("修改: " + updated);
  561 + //新增
  562 + for (UpdateCorePersonnelVo updateCorePersonnelVo : added) {
  563 + CreateCorePersonnelVo createCorePersonnelVo = new CreateCorePersonnelVo();
  564 + createCorePersonnelVo.setCreditId(vo.getId());
  565 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPersonId())) {
  566 + createCorePersonnelVo.setPersonId(updateCorePersonnelVo.getPersonId());
  567 + }
  568 + if (!StringUtil.isBlank(updateCorePersonnelVo.getName())) {
  569 + createCorePersonnelVo.setName(updateCorePersonnelVo.getName());
  570 + }
  571 + if (!StringUtil.isBlank(updateCorePersonnelVo.getSex())) {
  572 + createCorePersonnelVo.setSex(updateCorePersonnelVo.getSex());
  573 + }
  574 + if (!StringUtil.isBlank(updateCorePersonnelVo.getNativePlace())) {
  575 + createCorePersonnelVo.setNativePlace(updateCorePersonnelVo.getNativePlace());
  576 + }
  577 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAge())) {
  578 + createCorePersonnelVo.setAge(updateCorePersonnelVo.getAge());
  579 + }
  580 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPosition())) {
  581 + createCorePersonnelVo.setPosition(updateCorePersonnelVo.getPosition());
  582 + }
  583 + if (!StringUtil.isBlank(updateCorePersonnelVo.getMobile())) {
  584 + createCorePersonnelVo.setMobile(updateCorePersonnelVo.getMobile());
  585 + }
  586 + if (!StringUtil.isBlank(updateCorePersonnelVo.getPhone())) {
  587 + createCorePersonnelVo.setPhone(updateCorePersonnelVo.getPhone());
  588 + }
  589 + if (!StringUtil.isBlank(updateCorePersonnelVo.getEmail())) {
  590 + createCorePersonnelVo.setEmail(updateCorePersonnelVo.getEmail());
  591 + }
  592 + if (!StringUtil.isBlank(updateCorePersonnelVo.getAddress())) {
  593 + createCorePersonnelVo.setAddress(updateCorePersonnelVo.getAddress());
  594 + }
  595 + corePersonnelService.create(createCorePersonnelVo);
  596 + }
  597 + //删除
  598 + for (CorePersonnel corePersonnel : removed) {
  599 + corePersonnelService.deleteById(corePersonnel.getId());
  600 + }
  601 + //修改
  602 + for (UpdateCorePersonnelVo updateCorePersonnelVo : updated) {
  603 + corePersonnelService.update(updateCorePersonnelVo);
  604 + }
  605 + } else {
  606 + if (CollectionUtils.isNotEmpty(corePersonnelList)) {
  607 + for (CorePersonnel corePersonnel : corePersonnelList) {
  608 + corePersonnelService.deleteById(corePersonnel.getId());
  609 + }
322 } 610 }
323 } 611 }
324 OpLogUtil.setVariable("id", data.getId()); 612 OpLogUtil.setVariable("id", data.getId());
@@ -46,4 +46,11 @@ public interface CorePersonnelService extends BaseMpService<CorePersonnel> { @@ -46,4 +46,11 @@ public interface CorePersonnelService extends BaseMpService<CorePersonnel> {
46 */ 46 */
47 void update(UpdateCorePersonnelVo vo); 47 void update(UpdateCorePersonnelVo vo);
48 48
  49 + /**
  50 + * 根据ID删除
  51 + * @param id
  52 + * @return
  53 + */
  54 + void deleteById(String id);
  55 +
49 } 56 }
@@ -21,20 +21,12 @@ public class CreateCorePersonnelHistoryVo implements BaseVo, Serializable { @@ -21,20 +21,12 @@ public class CreateCorePersonnelHistoryVo implements BaseVo, Serializable {
21 private String personnelId; 21 private String personnelId;
22 22
23 /** 23 /**
24 - * 第几次变更  
25 - */  
26 - @ApiModelProperty(value = "第几次变更", required = true)  
27 - @NotBlank(message = "请输入第几次变更!")  
28 - @Length(message = "第几次变更最多允许20个字符!")  
29 - private String sort;  
30 -  
31 - /**  
32 * 客户资信 24 * 客户资信
33 */ 25 */
34 @ApiModelProperty(value = "客户资信", required = true) 26 @ApiModelProperty(value = "客户资信", required = true)
35 @NotBlank(message = "请输入客户资信!") 27 @NotBlank(message = "请输入客户资信!")
36 @Length(message = "客户资信最多允许32个字符!") 28 @Length(message = "客户资信最多允许32个字符!")
37 - private String creditId; 29 + private String creditHistoryId;
38 30
39 /** 31 /**
40 * 姓名 32 * 姓名
@@ -18,15 +18,9 @@ public class QueryCorePersonnelHistoryVo extends PageVo implements BaseVo, Seria @@ -18,15 +18,9 @@ public class QueryCorePersonnelHistoryVo extends PageVo implements BaseVo, Seria
18 private String personnelId; 18 private String personnelId;
19 19
20 /** 20 /**
21 - * 第几次变更  
22 - */  
23 - @ApiModelProperty("第几次变更")  
24 - private String sort;  
25 -  
26 - /**  
27 * 客户资信 21 * 客户资信
28 */ 22 */
29 @ApiModelProperty("客户资信") 23 @ApiModelProperty("客户资信")
30 - private String creditId; 24 + private String creditHistoryId;
31 25
32 } 26 }
@@ -18,8 +18,7 @@ public class UpdateCorePersonnelVo implements BaseVo, Serializable { @@ -18,8 +18,7 @@ public class UpdateCorePersonnelVo implements BaseVo, Serializable {
18 /** 18 /**
19 * ID 19 * ID
20 */ 20 */
21 - @ApiModelProperty(value = "ID", required = true)  
22 - @NotBlank(message = "id不能为空!") 21 + @ApiModelProperty(value = "ID")
23 private String id; 22 private String id;
24 23
25 /** 24 /**
@@ -47,7 +47,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -47,7 +47,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
47 /** 47 /**
48 * 企业类型:经销商(distributor)、终端(terminal) 48 * 企业类型:经销商(distributor)、终端(terminal)
49 */ 49 */
50 - @ApiModelProperty(value = "企业类型:经销商(distributor)、终端(terminal)", required = true) 50 + @ApiModelProperty(value = "企业类型:经销商(distributor)、终端(terminal)")
51 // @NotBlank(message = "请输入企业类型:经销商(distributor)、终端(terminal)!") 51 // @NotBlank(message = "请输入企业类型:经销商(distributor)、终端(terminal)!")
52 @Length(message = "企业类型:经销商(distributor)、终端(terminal)最多允许100个字符!") 52 @Length(message = "企业类型:经销商(distributor)、终端(terminal)最多允许100个字符!")
53 private String enterpriseType; 53 private String enterpriseType;
@@ -55,8 +55,8 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -55,8 +55,8 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
55 /** 55 /**
56 * 单位名称 56 * 单位名称
57 */ 57 */
58 - @ApiModelProperty(value = "单位名称", required = true)  
59 - @NotBlank(message = "请输入单位名称!") 58 + @ApiModelProperty(value = "单位名称")
  59 +// @NotBlank(message = "请输入单位名称!")
60 @Length(message = "单位名称最多允许32个字符!") 60 @Length(message = "单位名称最多允许32个字符!")
61 private String companyId; 61 private String companyId;
62 62
@@ -301,7 +301,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -301,7 +301,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
301 /** 301 /**
302 * 建议客户分类:AAA、AA、A、BBB、BB、B、C、D 302 * 建议客户分类:AAA、AA、A、BBB、BB、B、C、D
303 */ 303 */
304 - @ApiModelProperty(value = "建议客户分类:AAA、AA、A、BBB、BB、B、C、D", required = true) 304 + @ApiModelProperty(value = "建议客户分类:AAA、AA、A、BBB、BB、B、C、D")
305 // @NotBlank(message = "请输入建议客户分类:AAA、AA、A、BBB、BB、B、C、D!") 305 // @NotBlank(message = "请输入建议客户分类:AAA、AA、A、BBB、BB、B、C、D!")
306 @Length(message = "建议客户分类:AAA、AA、A、BBB、BB、B、C、D最多允许50个字符!") 306 @Length(message = "建议客户分类:AAA、AA、A、BBB、BB、B、C、D最多允许50个字符!")
307 private String suggestedCategory; 307 private String suggestedCategory;
@@ -372,7 +372,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -372,7 +372,7 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
372 /** 372 /**
373 * 客户分类:AAA、AA、A、BBB、BB、B、C、D 373 * 客户分类:AAA、AA、A、BBB、BB、B、C、D
374 */ 374 */
375 - @ApiModelProperty(value = "客户分类:AAA、AA、A、BBB、BB、B、C、D", required = true) 375 + @ApiModelProperty(value = "客户分类:AAA、AA、A、BBB、BB、B、C、D")
376 // @NotBlank(message = "请输入客户分类:AAA、AA、A、BBB、BB、B、C、D!") 376 // @NotBlank(message = "请输入客户分类:AAA、AA、A、BBB、BB、B、C、D!")
377 @Length(message = "客户分类:AAA、AA、A、BBB、BB、B、C、D最多允许50个字符!") 377 @Length(message = "客户分类:AAA、AA、A、BBB、BB、B、C、D最多允许50个字符!")
378 private String companySuggestedCategory; 378 private String companySuggestedCategory;
@@ -388,6 +388,12 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable { @@ -388,6 +388,12 @@ public class UpdateCustomerCreditVo implements BaseVo, Serializable {
388 * 核心人员 388 * 核心人员
389 */ 389 */
390 @ApiModelProperty("核心人员") 390 @ApiModelProperty("核心人员")
391 - private List<CreateCorePersonnelVo> corePersonnelList; 391 + private List<UpdateCorePersonnelVo> corePersonnelList;
  392 +
  393 + /**
  394 + * 操作类型:修改(UPDATE)、变更(CHANGE)
  395 + */
  396 + @ApiModelProperty(value = "操作类型")
  397 + private String type;
392 398
393 } 399 }
@@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
5 <resultMap id="CorePersonnelHistory" type="com.lframework.xingyun.sc.entity.CorePersonnelHistory"> 5 <resultMap id="CorePersonnelHistory" type="com.lframework.xingyun.sc.entity.CorePersonnelHistory">
6 <id column="id" property="id"/> 6 <id column="id" property="id"/>
7 <result column="personnel_id" property="personnelId"/> 7 <result column="personnel_id" property="personnelId"/>
8 - <result column="sort" property="sort"/>  
9 - <result column="credit_id" property="creditId"/> 8 + <result column="credit_history_id" property="creditHistoryId"/>
10 <result column="name" property="name"/> 9 <result column="name" property="name"/>
11 <result column="sex" property="sex"/> 10 <result column="sex" property="sex"/>
12 <result column="native_place" property="nativePlace"/> 11 <result column="native_place" property="nativePlace"/>
@@ -29,8 +28,7 @@ @@ -29,8 +28,7 @@
29 SELECT 28 SELECT
30 tb.id, 29 tb.id,
31 tb.personnel_id, 30 tb.personnel_id,
32 - tb.sort,  
33 - tb.credit_id, 31 + tb.credit_history_id,
34 tb.name, 32 tb.name,
35 tb.sex, 33 tb.sex,
36 tb.native_place, 34 tb.native_place,
@@ -56,11 +54,8 @@ @@ -56,11 +54,8 @@
56 <if test="vo.personnelId != null and vo.personnelId != ''"> 54 <if test="vo.personnelId != null and vo.personnelId != ''">
57 AND tb.personnel_id = #{vo.personnelId} 55 AND tb.personnel_id = #{vo.personnelId}
58 </if> 56 </if>
59 - <if test="vo.sort != null and vo.sort != ''">  
60 - AND tb.sort = #{vo.sort}  
61 - </if>  
62 - <if test="vo.creditId != null and vo.creditId != ''">  
63 - AND tb.credit_id = #{vo.creditId} 57 + <if test="vo.creditHistoryId != null and vo.creditHistoryId != ''">
  58 + AND tb.credit_history_id = #{vo.creditHistoryId}
64 </if> 59 </if>
65 </where> 60 </where>
66 </select> 61 </select>