Bladeren bron

报价配置-协议调度 添加动作后,动作无法删除bug修复(h后台代码)

lipf 4 maanden geleden
bovenliggende
commit
a1622466bb

+ 12 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementDispatchController.java

@@ -88,4 +88,16 @@ public class PtlAgreementDispatchController {
     public HttpResult updateDispatchName(String dispatchId,String name){
         return ptlAgreementDispatchService.updateDispatchName(dispatchId, name) ? HttpResult.ok("修改调度名称成功") : HttpResult.error("修改调度名称失败");
     }
+
+    /**
+     * 删除后置处理动作
+     *
+     * @param afterActionId ptl_agreement_dispatch_after_action表的序号
+     * @author lipf
+     * @date 2026/5/26 15:22
+     */
+    @DeleteMapping("/deleteAfterActionById/{afterActionId}")
+    public HttpResult<String> deleteAfterActionById(@PathVariable("afterActionId") String afterActionId){
+        return ptlAgreementDispatchService.deleteAfterActionById(afterActionId);
+    }
 }

+ 2 - 2
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -192,8 +192,8 @@ public class ReceivableController {
     @PostMapping("/calBeforeInvoice")
     public HttpResult<InsPlyIncomeInvoice> calBeforeInvoice(@RequestBody InvoicingVo invoicingVo){
         InsPlyIncomeInvoiceVO insPlyIncomeInvoice = receivableService.calBeforeInvoice(invoicingVo);
-        if(insPlyIncomeInvoice == null || !insPlyIncomeInvoice.isCanInvoice()){
-            return HttpResult.error(insPlyIncomeInvoice);
+        if(!insPlyIncomeInvoice.isCanInvoice()){
+            return HttpResult.error(500,insPlyIncomeInvoice,insPlyIncomeInvoice.getErrMsg());
         }
         return HttpResult.ok(insPlyIncomeInvoice);
     }

+ 10 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementDispatchService.java

@@ -1,6 +1,7 @@
 package com.jzg.organization.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatch;
 import com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchAfterAction;
 import com.jzg.commons.entity.agreement.dispatch.vo.PtlAgreementDispatchQuery;
@@ -62,4 +63,13 @@ public interface PtlAgreementDispatchService extends IService<PtlAgreementDispat
      * @return
      */
     public boolean updateDispatchName(String dispatchId,String name);
+
+    /**
+     * 删除后置处理动作
+     *
+     * @param afterActionId ptl_agreement_dispatch_after_action表的序号
+     * @author lipf
+     * @date 2026/5/26 15:22
+     */
+    HttpResult<String> deleteAfterActionById(String afterActionId);
 }

+ 25 - 7
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementDispatchServiceImpl.java

@@ -121,8 +121,8 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
         PtlAgreementDispatchVo dispatchVos = new PtlAgreementDispatchVo();
         List<String> dispatchIds = ptlAgreementDispatches.stream().map(PtlAgreementDispatch::getId).collect(Collectors.toList());
         if (!dispatchIds.isEmpty()) {
-            List<SysDict> dispatchBeforeActionDict = sysDictService.getByTypeCode("dispatch_before_action");
-            //List<SysDict> dispatchAfterActionDict = sysDictService.getByTypeCode("dispatch_after_action");
+            List<SysDict> beforeActionDicts = sysDictService.getByTypeCode("dispatch_before_action");
+            List<SysDict> afterActionsDicts = sysDictService.getByTypeCode("dispatch_after_action");
 
             // 查询保司所有的规则属性 然后进行分组
             List<PtlAgreementDispatchRulesAttrLink> ptlAgreementDispatchRulesAttrLinks = rulesAttrLinkMapper.selectList(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
@@ -136,7 +136,7 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
             // 获取所有保司的动作
             List<PtlAgreementDispatchAction> ptlAgreementDispatchActions = actionMapper.getActions(dispatchIds);
             // 获取保司的报价失败之后的动作
-            List<PtlAgreementDispatchAfterAction> ptlAgreementDispatchAfterActions = afterActionMapper.getAfterActions(ptlAgreementDispatchQuery.getCompanyId());
+            List<PtlAgreementDispatchAfterAction> afterActions = afterActionMapper.getAfterActions(ptlAgreementDispatchQuery.getCompanyId());
             int index = 1;
             // add by lipf, 对协议配置中的字典序号进行转义 2026年5月20日16:43:34
             List<PtlAgreementUndwrtRulesDictLabal> ptlAgreementUndwrtRulesDictLabals = baseMapper.queryAllDictLabal();
@@ -189,7 +189,7 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
                 }
 
                 for(PtlAgreementDispatchAction action : actions){
-                    SysDict sysDict = dispatchBeforeActionDict.stream().filter(x -> x.getValue().equals(action.getActionCode())).findFirst().orElse(null);
+                    SysDict sysDict = beforeActionDicts.stream().filter(x -> x.getValue().equals(action.getActionCode())).findFirst().orElse(null);
                     if(sysDict == null){
                         action.setActionName("未知动作");
                     }else{
@@ -220,8 +220,8 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
                 dispatchVos.getDispatchVos().add(vo);
             }
 
-            for(PtlAgreementDispatchAfterAction afterAction : ptlAgreementDispatchAfterActions){
-                SysDict sysDict = dispatchBeforeActionDict.stream().filter(x -> x.getValue().equals(afterAction.getActionCode())).findFirst().orElse(null);
+            for(PtlAgreementDispatchAfterAction afterAction : afterActions){
+                SysDict sysDict = afterActionsDicts.stream().filter(x -> x.getValue().equals(afterAction.getActionCode())).findFirst().orElse(null);
                 if(sysDict == null){
                     afterAction.setActionName("未知动作");
                 }else{
@@ -245,7 +245,7 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
                     }
                 }
             }
-            dispatchVos.setAfterActions(ptlAgreementDispatchAfterActions);
+            dispatchVos.setAfterActions(afterActions);
         }
 
 
@@ -287,6 +287,24 @@ public class PtlAgreementDispatchServiceImpl extends ServiceImpl<PtlAgreementDis
         return false;
     }
 
+    /**
+     * 删除后置处理动作
+     *
+     * @param afterActionId ptl_agreement_dispatch_after_action表的序号
+     * @author lipf
+     * @date 2026/5/26 15:22
+     */
+    @Override
+    public HttpResult<String> deleteAfterActionById(String afterActionId) {
+        log.info("删除后置处理操作:afterActionId=[{}]",afterActionId);
+        PtlAgreementDispatchAfterAction ptlAgreementDispatchAfterAction = afterActionMapper.selectById(afterActionId);
+        if(ptlAgreementDispatchAfterAction != null) {
+            log.info("要删除的后置操作不存在. afterActionId=[{}]",afterActionId);
+            return HttpResult.error("要删除的后置操作不存在");
+        }
+        afterActionMapper.deleteById(afterActionId);
+        return HttpResult.ok("删除成功");
+    }
 }