Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

chenjun 1 éve
szülő
commit
f552c405e8

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/contractinvoice/constants/ContractInvoiceConstants.java

@@ -26,4 +26,6 @@ public class ContractInvoiceConstants {
 
     // 部分回款
     public static final int RETURN_PART = 104;
+
+    public static final int INVOICE_ACTIVITY = 105;
 }

+ 35 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/contractinvoice/event/ContractInvoiceEvent.java

@@ -80,6 +80,41 @@ public class ContractInvoiceEvent extends BaseController {
         }
     }
 
+    @PostMapping("/flow-status-invoice-back")
+    public String sendDingMessage(@ParamModel Map flowInstance, @ParamModel Map activityInstance) {
+        try {
+            if (!Objects.isNull(activityInstance) && activityInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                ContractInvoice entity = contractInvoiceService.selectByInstanceId(flowInstanceId);
+                entity.setFlowStatus(ContractInvoiceConstants.FLOW_PROCESS);
+                entity.setFlowFinishtime(LocalDateTime.now());
+                flowContractInvoiceService.updateById(entity);
+            }
+            return ok("true");
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+    @PostMapping("/flow-status-invoice")
+    public String invoiceStatus(@ParamModel Map flowInstance, @ParamModel Map activityInstance) {
+        try {
+            if (!Objects.isNull(activityInstance) && activityInstance.containsKey("id")) {
+                String flowInstanceId = flowInstance.get("id").toString();
+                ContractInvoice entity = contractInvoiceService.selectByInstanceId(flowInstanceId);
+                entity.setFlowStatus(ContractInvoiceConstants.INVOICE_ACTIVITY);
+                entity.setFlowFinishtime(LocalDateTime.now());
+                flowContractInvoiceService.updateById(entity);
+            }
+            return ok("true");
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
 
     /**
      * 流程归档事件

+ 59 - 1
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractMessageServiceImpl.java

@@ -5,21 +5,30 @@ import com.zjugis.business.bean.dto.ContractMessageDto;
 import com.zjugis.business.bean.entity.Contract;
 import com.zjugis.business.bean.entity.ContractMessage;
 import com.zjugis.business.bean.entity.ContractReturnMoney;
+import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.bean.response.ContractMessageResponse;
 import com.zjugis.business.constants.ContractMessageContants;
 import com.zjugis.business.mapper.ContractMessageMapper;
+import com.zjugis.business.mapper.ProjectMapper;
 import com.zjugis.business.service.ContractMessageService;
 import com.zjugis.business.service.ContractService;
+import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.module.infra.api.ding.DingApi;
 import com.zjugis.module.infra.api.ding.dto.DingMessageDto;
+import com.zjugis.module.system.api.dept.DeptApi;
+import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
+import com.zjugis.module.system.api.user.AdminUserApi;
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -36,9 +45,21 @@ public class ContractMessageServiceImpl implements ContractMessageService {
     @Autowired
     private ContractService contractService;
 
+    @Autowired
+    private ProjectMapper projectMapper;
+
     @Autowired
     private DingApi dingApi;
 
+    @Autowired
+    private DeptApi deptApi;
+
+    @Autowired
+    private AdminUserApi adminUserApi;
+
+    @Value("managerDeptId")
+    private String managerDeptId;
+
 
     @Override
     public Page<ContractMessageResponse> page(ContractMessageDto contractMessageDto) {
@@ -113,8 +134,45 @@ public class ContractMessageServiceImpl implements ContractMessageService {
         message.setMessageContent(content);
         int insert = contractMessageMapper.insert(message);
         if(insert> 0){
-            dingApi.sendMessage(new DingMessageDto(contract.getAreaManagerId(),content));
+            sendMsg(contract,content);
         }
     }
+
+    private void sendMsg(Contract contract,String content) {
+        Project project = projectMapper.selectById(contract.getProjectId());
+        if(StringUtils.isNotBlank(project.getXmjlId())) {
+            dingApi.sendMessage(new DingMessageDto(project.getXmjlId(), content));
+        }
+        if(StringUtils.isNotBlank(project.getZrbmId())) {
+            CommonResult<DeptRespDTO> result = deptApi.getDept(project.getZrbmId());
+            DeptRespDTO dept = result.getCheckedData();
+            if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
+                dingApi.sendMessage(new DingMessageDto(dept.getLeaderUserId(), content));
+                CommonResult<AdminUserRespDTO> userRes = adminUserApi.getUserLeader(dept.getLeaderUserId());
+                AdminUserRespDTO userLeader = userRes.getCheckedData();
+                if(userLeader != null){
+
+                }
+            }
+            DeptRespDTO deptRespDTO = deptApi.getSecondDeptByDeptId(project.getZrbmId()).getCheckedData();
+            if (deptRespDTO != null && StringUtils.isNotBlank(deptRespDTO.getLeaderUserId())) {
+                dingApi.sendMessage(new DingMessageDto(deptRespDTO.getLeaderUserId(), content));
+            }
+        }
+        if(StringUtils.isNotBlank(project.getXsryId())) {
+            dingApi.sendMessage(new DingMessageDto(project.getXsryId(), content));
+            CommonResult<DeptRespDTO> xsDeptRes = deptApi.getDept(project.getXsryId());
+            DeptRespDTO xsDept = xsDeptRes.getCheckedData();
+            if (xsDept != null && StringUtils.isNotBlank(xsDept.getLeaderUserId())) {
+                dingApi.sendMessage(new DingMessageDto(xsDept.getLeaderUserId(), content));
+            }
+        }
+        CommonResult<List<AdminUserRespDTO>> userListRes = adminUserApi.getUserListByDeptIds(Collections.singletonList(managerDeptId));
+        List<AdminUserRespDTO> list = userListRes.getCheckedData();
+        for (AdminUserRespDTO user : list) {
+            dingApi.sendMessage(new DingMessageDto(user.getId(), content));
+        }
+
+    }
 }
 

+ 3 - 0
zjugis-business/src/main/resources/application-dev.yaml

@@ -27,3 +27,6 @@ xxl:
       appname: ${spring.application.name} # 执行器 AppName
       logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
     accessToken: default_token # 执行器通讯TOKEN
+
+managerDeptId: ac4cc8f0-ad52-4ae9-9f88-c9a76f95e7fb
+

+ 6 - 2
zjugis-business/src/main/resources/templates/FlowContract/js/apply.js

@@ -141,6 +141,10 @@
         for (let key of Object.keys(postData)) {
             let mealName = postData[key];
             if (key.startsWith("ContractMilestone")) {
+                if(parseFloat(mealName.actualReturnAmount) && parseFloat(mealName.actualReturnAmount) > 0 ){
+                    all({success: false, errorMsg: "里程碑回款金额不能大于0!"});
+                    return;
+                }
                 mealName.contractId = contractId;
                 milestoneList.push(z.ui.form.childStringify(mealName));
                 milestoneFlag  =true;
@@ -276,7 +280,7 @@
         var dataObj = {
             name: "",
             returnAmount: "",
-            actualReturnAmount: "",
+            actualReturnAmount: 0,
             planReturnTime: "",
             description: "",
             id: "",
@@ -512,7 +516,7 @@
             + '<div class="form-flex">'
             + '<div class="form-item" style="width: 100%;margin-right: 5px;">'
             + '<div class="z-comp-input" name="ContractMilestone[' + index + ']$actualReturnAmount">'
-            + '<input type="text" value="">'
+            + '<input type="text" value="'+lists[index].actualReturnAmount+'">'
             + '</div>'
             + '</div>'
             + '</div>'