Переглянути джерело

fix(swc): 修正定调薪申请单生成逻辑
- 增强日志记录,包括生成定调薪申请单的参数和结果
- 优化错误处理流程,明确提示未生成定调薪申请单的情况
- 在操作失败时增加界面错误提示显示
- 增加对操作结果成功的判断,确保只有成功时才打开表单
- 操作完成后刷新当前视图以反映最新状态

turborao 1 тиждень тому
батько
коміт
3792b6bae1

+ 14 - 10
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/init/plugin/form/PendingSalaryAdjListPlugin.java

@@ -99,17 +99,21 @@ public class PendingSalaryAdjListPlugin extends AbstractListPlugin implements Pl
         switch (key) {
             case "apply_adj":
                 OperationResult ore =  args.getOperationResult();
-                Map<String, String> params = ore.getCustomData();
-                if(params != null && params.containsKey("applyID")){
-                    Long billid = Long.parseLong(params.get("applyID")) ;
-                    BillShowParameter billShowParameter = new BillShowParameter();
-                    billShowParameter.setFormId("hcdm_applybill");
-                    billShowParameter.setPkId(billid);//单据内码
-                    billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
-                    billShowParameter.setStatus(OperationStatus.EDIT);
-                    this.getView().showForm(billShowParameter);
+                if(ore.isSuccess()) {
+                    Map<String, String> params = ore.getCustomData();
+                    if (params != null && params.containsKey("applyID")) {
+                        Long billid = Long.parseLong(params.get("applyID"));
+                        BillShowParameter billShowParameter = new BillShowParameter();
+                        billShowParameter.setFormId("hcdm_applybill");
+                        billShowParameter.setPkId(billid);//单据内码
+                        billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
+                        billShowParameter.setStatus(OperationStatus.EDIT);
+                        this.getView().showForm(billShowParameter);
+                    }
+                    this.getView().invokeOperation("refresh");
+                }else{
+                    this.getView().showErrorNotification(ore.getMessage());
                 }
-                this.getView().updateView();
                 break;
             case "flag_adj":
                 break;

+ 15 - 7
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/init/plugin/operate/BuildApplyBillOpPlugin.java

@@ -184,15 +184,15 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
         applyBillData.add(applyBill);
         papams.put("data", applyBillData);
 
-        Map<String, String> params = new HashMap<>();
+        logger.info("生成定调薪申请单参数:"+papams.toString());
         Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(papams);
-        System.out.println("BuildApplyBillOpPlugin:"+result.toString());
-        logger.info("BuildApplyBillOpPlugin:"+result.toString());
+        System.out.println("生成定调薪申请单:"+result.toString());
+        logger.info("生成定调薪申请单:"+result.toString());
         // 判断整体操作是否成功
         Boolean overallSuccess = (Boolean) result.get("success");
         String errorCode = (String) result.get("errorCode");
         String errorMessage = (String) result.get("message");
-
+        Map<String, String> params = new HashMap<>();
         if (overallSuccess != null && overallSuccess && "success".equals(errorCode)) {
             // 提取数据部分
             List<Map<String, Object>> dataList = (List<Map<String, Object>>) result.get("data");
@@ -216,18 +216,26 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
                 ///返回界面的数据
                 this.operationResult.setCustomData(params);
                 // TODO: 可以在这里使用提取到的 idValue 进行后续操作
+            } else {
+                //区别:绿色提示语显示时间较短。红色一直存在。
+                this.operationResult.setSuccess(false);
+                //异常提示语
+                this.operationResult.setMessage("操作失败,没有生成定调薪申请单," + errorMessage);
+                logger.info("员工待定调薪清单 操作失败,没有生成定调薪申请单," + errorMessage);
+                //显示结果
+                this.operationResult.setShowMessage(true);
+                System.out.println("操作失败或返回错误码不为success");
             }
         } else {
             //区别:绿色提示语显示时间较短。红色一直存在。
             this.operationResult.setSuccess(false);
             //异常提示语
-            this.operationResult.setMessage("操作失败," + errorMessage);
-            logger.info("员工待定调薪清单 操作失败," + errorMessage);
+            this.operationResult.setMessage("操作失败,没有生成定调薪申请单," + errorMessage);
+            logger.info("员工待定调薪清单 操作失败,没有生成定调薪申请单," + errorMessage);
             //显示结果
             this.operationResult.setShowMessage(true);
             System.out.println("操作失败或返回错误码不为success");
         }
-        //OperationResult updatepersonOp = OperationServiceHelper.executeOperate("updatepersoninfo_and_match", "", new DynamicObject[]{change}, OperateOption.create());
 
     }