|
|
@@ -406,33 +406,37 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
|
|
|
@GlobalTransactional
|
|
|
@Override
|
|
|
public Boolean costCopy(PtlAgreementCostCopyParam costCopyParam) {
|
|
|
- PtlAgreementCost ptlAgreementCost = ptlAgreementCostMapper.selectById(costCopyParam.getCostId());
|
|
|
- List<PtlAgreementCostType> ptlAgreementCostTypes = ptlAgreementCostTypeMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostType>()
|
|
|
- .eq(PtlAgreementCostType::getPtlAgreementCostId, ptlAgreementCost.getId()));
|
|
|
- List<PtlAgreementCostRule> ptlAgreementCostRules = ptlAgreementCostRuleMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostRule>()
|
|
|
- .eq(PtlAgreementCostRule::getPtlAgreementCostId, ptlAgreementCost.getId()));
|
|
|
-
|
|
|
- // 调整数据 进行copy
|
|
|
- String costId = IdGenerate.nextId();
|
|
|
- ptlAgreementCost.setId(costId);
|
|
|
- ptlAgreementCost.setCoverRuleId(costCopyParam.getCoverRuleId());
|
|
|
- ptlAgreementCost.setPtlAgreementId(costCopyParam.getAgreementId());
|
|
|
- ptlAgreementCost.setCostDescribe("复制的费用:" + ptlAgreementCost.getCostDescribe());
|
|
|
- ptlAgreementCost.setCreateTime(LocalDateTime.now());
|
|
|
-
|
|
|
- ptlAgreementCostTypes.forEach(item->{
|
|
|
- item.setId(IdGenerate.nextId());
|
|
|
- item.setPtlAgreementCostId(costId);
|
|
|
- });
|
|
|
+ List<String> costIds = costCopyParam.getCostIds();
|
|
|
+ costIds.forEach(oldCostId-> {
|
|
|
+ PtlAgreementCost ptlAgreementCost = ptlAgreementCostMapper.selectById(oldCostId);
|
|
|
+ List<PtlAgreementCostType> ptlAgreementCostTypes = ptlAgreementCostTypeMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostType>()
|
|
|
+ .eq(PtlAgreementCostType::getPtlAgreementCostId, ptlAgreementCost.getId()));
|
|
|
+ List<PtlAgreementCostRule> ptlAgreementCostRules = ptlAgreementCostRuleMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostRule>()
|
|
|
+ .eq(PtlAgreementCostRule::getPtlAgreementCostId, ptlAgreementCost.getId()));
|
|
|
+
|
|
|
+ // 调整数据 进行copy
|
|
|
+ String costId = IdGenerate.nextId();
|
|
|
+ ptlAgreementCost.setId(costId);
|
|
|
+ ptlAgreementCost.setCoverRuleId(costCopyParam.getCoverRuleId());
|
|
|
+ ptlAgreementCost.setPtlAgreementId(costCopyParam.getAgreementId());
|
|
|
+ ptlAgreementCost.setCostDescribe("复制的费用:" + ptlAgreementCost.getCostDescribe());
|
|
|
+ ptlAgreementCost.setCreateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ ptlAgreementCostTypes.forEach(item->{
|
|
|
+ item.setId(IdGenerate.nextId());
|
|
|
+ item.setPtlAgreementCostId(costId);
|
|
|
+ });
|
|
|
|
|
|
- ptlAgreementCostRules.forEach(item->{
|
|
|
- item.setId(IdGenerate.nextId());
|
|
|
- item.setPtlAgreementCostId(costId);
|
|
|
- });
|
|
|
+ ptlAgreementCostRules.forEach(item->{
|
|
|
+ item.setId(IdGenerate.nextId());
|
|
|
+ item.setPtlAgreementCostId(costId);
|
|
|
+ });
|
|
|
+
|
|
|
+ ptlAgreementCostMapper.insert(ptlAgreementCost);
|
|
|
+ ptlAgreementCostTypeMapper.insert(ptlAgreementCostTypes);
|
|
|
+ ptlAgreementCostRuleMapper.insert(ptlAgreementCostRules);
|
|
|
|
|
|
- ptlAgreementCostMapper.insert(ptlAgreementCost);
|
|
|
- ptlAgreementCostTypeMapper.insert(ptlAgreementCostTypes);
|
|
|
- ptlAgreementCostRuleMapper.insert(ptlAgreementCostRules);
|
|
|
+ });
|
|
|
|
|
|
return true;
|
|
|
}
|