|
@@ -44,7 +44,9 @@ import java.io.Serializable; |
|
@@ -44,7 +44,9 @@ import java.io.Serializable; |
|
44
|
import java.time.LocalDateTime;
|
44
|
import java.time.LocalDateTime;
|
|
45
|
import java.util.ArrayList;
|
45
|
import java.util.ArrayList;
|
|
46
|
import java.util.List;
|
46
|
import java.util.List;
|
|
|
|
47
|
+import java.util.Map;
|
|
47
|
import java.util.Set;
|
48
|
import java.util.Set;
|
|
|
|
49
|
+import java.util.function.Function;
|
|
48
|
import java.util.stream.Collectors;
|
50
|
import java.util.stream.Collectors;
|
|
49
|
|
51
|
|
|
50
|
@Service
|
52
|
@Service
|
|
@@ -285,6 +287,15 @@ public class ContractDistributorStandardServiceImpl extends |
|
@@ -285,6 +287,15 @@ public class ContractDistributorStandardServiceImpl extends |
|
285
|
|
287
|
|
|
286
|
getBaseMapper().update(updateWrapper);
|
288
|
getBaseMapper().update(updateWrapper);
|
|
287
|
|
289
|
|
|
|
|
290
|
+ LambdaUpdateWrapper<ContractDistributorStandard> childWrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
|
|
|
|
291
|
+ .set(ContractDistributorStandard::getFormalFileId, vo.getFormalFileId())
|
|
|
|
292
|
+ .set(ContractDistributorStandard::getFormalFileName, vo.getFormalFileName())
|
|
|
|
293
|
+ .set(ContractDistributorStandard::getFormalStandardized, vo.getFormalStandardized())
|
|
|
|
294
|
+ .set(ContractDistributorStandard::getFormalApproved, CustomerDevelopStatus.AUDIT.name())
|
|
|
|
295
|
+ .eq(ContractDistributorStandard::getParentId, vo.getId());
|
|
|
|
296
|
+
|
|
|
|
297
|
+ getBaseMapper().update(childWrapper);
|
|
|
|
298
|
+
|
|
288
|
OpLogUtil.setVariable("id", data.getId());
|
299
|
OpLogUtil.setVariable("id", data.getId());
|
|
289
|
OpLogUtil.setExtra(vo);
|
300
|
OpLogUtil.setExtra(vo);
|
|
290
|
|
301
|
|
|
@@ -343,7 +354,9 @@ public class ContractDistributorStandardServiceImpl extends |
|
@@ -343,7 +354,9 @@ public class ContractDistributorStandardServiceImpl extends |
|
343
|
.set(ContractDistributorStandard::getFormalApproved, formalApproved)
|
354
|
.set(ContractDistributorStandard::getFormalApproved, formalApproved)
|
|
344
|
.set(ContractDistributorStandard::getFormalApproverId, SecurityUtil.getCurrentUser().getId())
|
355
|
.set(ContractDistributorStandard::getFormalApproverId, SecurityUtil.getCurrentUser().getId())
|
|
345
|
.set(ContractDistributorStandard::getFormalTime, LocalDateTime.now())
|
356
|
.set(ContractDistributorStandard::getFormalTime, LocalDateTime.now())
|
|
346
|
- .eq(ContractDistributorStandard::getId, id);
|
357
|
+ .eq(ContractDistributorStandard::getId, id)
|
|
|
|
358
|
+ .or()
|
|
|
|
359
|
+ .eq(ContractDistributorStandard::getParentId, id);
|
|
347
|
|
360
|
|
|
348
|
getBaseMapper().update(wrapper);
|
361
|
getBaseMapper().update(wrapper);
|
|
349
|
|
362
|
|
|
@@ -476,29 +489,65 @@ public class ContractDistributorStandardServiceImpl extends |
|
@@ -476,29 +489,65 @@ public class ContractDistributorStandardServiceImpl extends |
|
476
|
throw new DefaultClientException("合同行数据为空!");
|
489
|
throw new DefaultClientException("合同行数据为空!");
|
|
477
|
}
|
490
|
}
|
|
478
|
|
491
|
|
|
479
|
- Wrapper<ContractDistributorStandard> wrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
|
|
|
|
480
|
- .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity())
|
|
|
|
481
|
- .set(ContractDistributorStandard::getTotalAmountExcludingTax, vo.getTotalAmountExcludingTax())
|
|
|
|
482
|
- .set(ContractDistributorStandard::getTotalAmountIncludingTax, vo.getTotalAmountIncludingTax())
|
|
|
|
483
|
- .set(ContractDistributorStandard::getTotalAmountCapital, vo.getTotalAmountCapital())
|
|
|
|
484
|
- .set(ContractDistributorStandard::getStatus, "STANDARD")
|
|
|
|
485
|
- .eq(ContractDistributorStandard::getId, vo.getId());
|
492
|
+ data.setId(IdUtil.getUUID());
|
|
|
|
493
|
+ data.setTotalQuantity(vo.getTotalQuantity());
|
|
|
|
494
|
+ data.setTotalAmountCapital(vo.getTotalAmountCapital());
|
|
|
|
495
|
+ data.setTotalAmountExcludingTax(vo.getTotalAmountExcludingTax());
|
|
|
|
496
|
+ data.setTotalAmountIncludingTax(vo.getTotalAmountIncludingTax());
|
|
|
|
497
|
+ data.setStatus("STANDARD");
|
|
|
|
498
|
+ data.setParentId(vo.getId());
|
|
|
|
499
|
+ getBaseMapper().insert(data);
|
|
486
|
|
500
|
|
|
487
|
- getBaseMapper().update(wrapper);
|
501
|
+ Wrapper<ContractDistributorLine> lineWrapper = Wrappers.lambdaQuery(ContractDistributorLine.class)
|
|
|
|
502
|
+ .eq(ContractDistributorLine::getContractId, vo.getId())
|
|
|
|
503
|
+ .orderByAsc(ContractDistributorLine::getShowOrder);
|
|
|
|
504
|
+ List<ContractDistributorLine> oldContractDistributorLineList = contractDistributorLineService.list(lineWrapper);
|
|
|
|
505
|
+ Map<String, ContractDistributorLine> contractDistributorLineMap = CollectionUtils.emptyIfNull(oldContractDistributorLineList)
|
|
|
|
506
|
+ .stream().collect(Collectors.toMap(ContractDistributorLine::getId, Function.identity()));
|
|
488
|
|
507
|
|
|
489
|
- lineVoList.forEach(lineVo -> {
|
|
|
|
490
|
- Wrapper<ContractDistributorLine> contractDistributorLineWrapper = Wrappers.lambdaUpdate(ContractDistributorLine.class)
|
|
|
|
491
|
- .set(ContractDistributorLine::getQuantity, lineVo.getQuantity())
|
|
|
|
492
|
- .set(ContractDistributorLine::getUnitPrice, lineVo.getUnitPrice())
|
|
|
|
493
|
- .set(ContractDistributorLine::getAmountExcludingTax, lineVo.getAmountExcludingTax())
|
|
|
|
494
|
- .set(ContractDistributorLine::getTotalAmount, lineVo.getTotalAmount())
|
|
|
|
495
|
- .eq(ContractDistributorLine::getId, lineVo.getId());
|
508
|
+ for (UpdateContractDistributorLineVo lineVo : lineVoList) {
|
|
|
|
509
|
+ ContractDistributorLine contractDistributorLine = contractDistributorLineMap.remove(lineVo.getId());
|
|
|
|
510
|
+ if (contractDistributorLine == null) {
|
|
|
|
511
|
+ throw new DefaultClientException("合同行数据不存在!");
|
|
|
|
512
|
+ }
|
|
496
|
|
513
|
|
|
497
|
- contractDistributorLineService.update(contractDistributorLineWrapper);
|
|
|
|
498
|
- contractDistributorLineService.cleanCacheByKey(lineVo.getId());
|
|
|
|
499
|
- });
|
514
|
+ contractDistributorLine.setId(IdUtil.getUUID());
|
|
|
|
515
|
+ contractDistributorLine.setContractId(data.getId());
|
|
|
|
516
|
+ contractDistributorLine.setQuantity(lineVo.getQuantity());
|
|
|
|
517
|
+ contractDistributorLine.setUnitPrice(lineVo.getUnitPrice());
|
|
|
|
518
|
+ contractDistributorLine.setAmountExcludingTax(lineVo.getAmountExcludingTax());
|
|
|
|
519
|
+ contractDistributorLine.setTotalAmount(lineVo.getTotalAmount());
|
|
|
|
520
|
+ contractDistributorLineService.getBaseMapper().insert(contractDistributorLine);
|
|
|
|
521
|
+ }
|
|
500
|
|
522
|
|
|
501
|
- OpLogUtil.setVariable("id", data.getId());
|
523
|
+ Wrapper<ContractDistributorStandard> changeLocked = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
|
|
|
|
524
|
+ .set(ContractDistributorStandard::isPriceSpecLocked, true)
|
|
|
|
525
|
+ .eq(ContractDistributorStandard::getId, vo.getId());
|
|
|
|
526
|
+ getBaseMapper().update(changeLocked);
|
|
|
|
527
|
+
|
|
|
|
528
|
+// Wrapper<ContractDistributorStandard> wrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
|
|
|
|
529
|
+// .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity())
|
|
|
|
530
|
+// .set(ContractDistributorStandard::getTotalAmountExcludingTax, vo.getTotalAmountExcludingTax())
|
|
|
|
531
|
+// .set(ContractDistributorStandard::getTotalAmountIncludingTax, vo.getTotalAmountIncludingTax())
|
|
|
|
532
|
+// .set(ContractDistributorStandard::getTotalAmountCapital, vo.getTotalAmountCapital())
|
|
|
|
533
|
+// .set(ContractDistributorStandard::getStatus, "STANDARD")
|
|
|
|
534
|
+// .eq(ContractDistributorStandard::getId, vo.getId());
|
|
|
|
535
|
+//
|
|
|
|
536
|
+// getBaseMapper().update(wrapper);
|
|
|
|
537
|
+//
|
|
|
|
538
|
+// lineVoList.forEach(lineVo -> {
|
|
|
|
539
|
+// Wrapper<ContractDistributorLine> contractDistributorLineWrapper = Wrappers.lambdaUpdate(ContractDistributorLine.class)
|
|
|
|
540
|
+// .set(ContractDistributorLine::getQuantity, lineVo.getQuantity())
|
|
|
|
541
|
+// .set(ContractDistributorLine::getUnitPrice, lineVo.getUnitPrice())
|
|
|
|
542
|
+// .set(ContractDistributorLine::getAmountExcludingTax, lineVo.getAmountExcludingTax())
|
|
|
|
543
|
+// .set(ContractDistributorLine::getTotalAmount, lineVo.getTotalAmount())
|
|
|
|
544
|
+// .eq(ContractDistributorLine::getId, lineVo.getId());
|
|
|
|
545
|
+//
|
|
|
|
546
|
+// contractDistributorLineService.update(contractDistributorLineWrapper);
|
|
|
|
547
|
+// contractDistributorLineService.cleanCacheByKey(lineVo.getId());
|
|
|
|
548
|
+// });
|
|
|
|
549
|
+
|
|
|
|
550
|
+ OpLogUtil.setVariable("id", vo.getId());
|
|
502
|
OpLogUtil.setExtra(vo);
|
551
|
OpLogUtil.setExtra(vo);
|
|
503
|
}
|
552
|
}
|
|
504
|
|
553
|
|