|
@@ -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());
|