wanghao 1 месяц назад
Родитель
Сommit
544be30231

+ 5 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java

@@ -61,5 +61,10 @@ public class PtlAgreementCostParam extends PageRequest {
     private String agreementId;
     @Schema(description = "承包规则id")
     private String coverRuleId;
+    /**
+     * 这个参数是批量复制之后需要在费用管理页面展示最新复制的集合
+     */
+    @Schema(description = "复制的新的ids")
+    private List<String> newCostIds;
 
 }

+ 6 - 1
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostController.java

@@ -119,6 +119,11 @@ public class PtlAgreementCostController {
     @Operation(summary = "复制费用")
     @PostMapping("copyCost")
     public HttpResult copyCost(@RequestBody PtlAgreementCostCopyParam costCopyParam){
-        return ptlAgreementCostService.costCopy(costCopyParam) ? HttpResult.ok("复制费用成功") : HttpResult.error("复制费用失败");
+        try{
+            List<String> newCostIds = ptlAgreementCostService.costCopy(costCopyParam);
+            return HttpResult.ok(newCostIds);
+        }catch (Exception e){
+            return HttpResult.error("复制费用异常:"+e.getMessage());
+        }
     }
 }

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostService.java

@@ -62,7 +62,7 @@ public interface PtlAgreementCostService extends IService<PtlAgreementCost> {
     /**
      * 复制费用
      */
-    Boolean costCopy(PtlAgreementCostCopyParam costCopyParam);
+    List<String> costCopy(PtlAgreementCostCopyParam costCopyParam);
 
     /**
      * 批量修改协议费用有效期

+ 5 - 3
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -393,7 +393,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @GlobalTransactional
     @Override
-    public Boolean costCopy(PtlAgreementCostCopyParam costCopyParam) {
+    public List<String> costCopy(PtlAgreementCostCopyParam costCopyParam) {
+        List<String> newCostId = new ArrayList<>();
         List<String> costIds = costCopyParam.getCostIds();
         costIds.forEach(oldCostId-> {
             PtlAgreementCost ptlAgreementCost = ptlAgreementCostMapper.selectById(oldCostId);
@@ -409,6 +410,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             ptlAgreementCost.setPtlAgreementId(costCopyParam.getAgreementId());
             ptlAgreementCost.setCostDescribe("复制的费用:" + ptlAgreementCost.getCostDescribe());
             ptlAgreementCost.setCreateTime(LocalDateTime.now());
+            ptlAgreementCost.setUpdateTime(LocalDateTime.now());
             ptlAgreementCost.setProductId(costCopyParam.getProductId());
             ptlAgreementCost.setProductName(costCopyParam.getProductName());
             // 复制的费用为待审核
@@ -447,10 +449,10 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             ptlAgreementCostMapper.insert(ptlAgreementCost);
             ptlAgreementCostTypeMapper.insert(newPtlAgreementCostTypes);
             ptlAgreementCostRuleMapper.insert(ptlAgreementCostRules);
+            newCostId.add(ptlAgreementCost.getId());
 
         });
-
-        return true;
+        return newCostId;
     }
 
     @Override

+ 5 - 0
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -474,6 +474,11 @@
             <if test="costParam.updateTimeArr != null and costParam.updateTimeArr.size() > 0">
                 AND pc.update_time BETWEEN #{costParam.updateTimeArr[0]} AND #{costParam.updateTimeArr[1]}
             </if>
+
+            <if test="costParam.newCostIds != null and costParam.newCostIds.size() &gt; 0">
+                AND pc.id IN
+                <foreach collection="costParam.newCostIds" item="v" open="(" separator="," close=")">#{v}</foreach>
+            </if>
         </where>
         order by pc.create_time desc
     </select>