Browse Source

合同项目名称验证重复

yewc 1 month ago
parent
commit
61338a0e61

+ 6 - 6
client/src/views/OaSystem/financialManagement/kpglPage/deptIndex.vue

@@ -278,12 +278,12 @@ const initQueryParams = () => {
 /** 列表导出 */
 const getExportContractInvoiceListExcel = async () => {
   initQueryParams()
-  const sendData = {}
-  if (idList.value.length > 0) {
-    sendData['idList'] = idList.value
-  } else {
-    sendData.value = queryParams
-  }
+  // const sendData = {}
+  // if (idList.value.length > 0) {
+  //   sendData['idList'] = idList.value
+  // } else {
+  //   sendData.value = queryParams
+  // }
   const data = await kpglApi.exportContractInvoiceListExcel(queryParams)
   download.excel(data, '开票台账导出记录.xls')
 }

+ 19 - 6
zjugis-business/src/main/java/com/zjugis/business/flow/contract/service/FlowContractService.java

@@ -1,6 +1,7 @@
 package com.zjugis.business.flow.contract.service;
 
 import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zjugis.business.bean.entity.Contract;
 import com.zjugis.business.bean.entity.ContractMilestone;
 import com.zjugis.business.bean.entity.Project;
@@ -155,13 +156,25 @@ public class FlowContractService {
     }
 
     @Transactional
-    public int updateById(Contract contract) {
-        int res = contractMapper.updateById(contract);
-        Contract db = contractMapper.selectById(contract.getId());
-        String flowDesc = StringUtils.join(Arrays.asList(db.getName(), db.getApplicantName()), "/");
-        workflowClient.saveFlowDescribe(contract.getInstanceId(),flowDesc);
+    public Map updateById(Contract contract) {
+        Map map=new HashMap();
+        QueryWrapper<Contract> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("name", contract.getName()).ne("id",contract.getId()).eq("FLOW_STATUS","90");
+        Contract entity = contractMapper.selectOne(queryWrapper);
+        if(entity!=null){
+            map.put("code",999);
+            map.put("msg","合同名称已存在,请重新输入!");
+        }else{
+            int res = contractMapper.updateById(contract);
+            Contract db = contractMapper.selectById(contract.getId());
+            String flowDesc = StringUtils.join(Arrays.asList(db.getName(), db.getApplicantName()), "/");
+            workflowClient.saveFlowDescribe(contract.getInstanceId(),flowDesc);
 //        contractService.updateAreaManager(contract);
-        return res;
+            map.put("code",200);
+            map.put("msg","保存成功!");
+        }
+
+        return map;
     }
 
     public ContractVO flowAdd(String flowInstanceId, String userId) {

+ 18 - 5
zjugis-business/src/main/java/com/zjugis/business/flow/project/service/FlowProjectService.java

@@ -2,6 +2,7 @@ package com.zjugis.business.flow.project.service;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zjugis.business.bean.entity.Contract;
 import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.bean.entity.ProjectMilestone;
@@ -11,6 +12,7 @@ import com.zjugis.business.constants.FlowStatusConstants;
 import com.zjugis.business.constants.XmztConstants;
 import com.zjugis.business.converter.ProjectStatus.ProjectStatusConvert;
 import com.zjugis.business.converter.common.SelectConvert;
+import com.zjugis.business.flow.contractRenew.entity.ContractRenewDO;
 import com.zjugis.business.flow.project.controller.vo.ProjectVO;
 import com.zjugis.business.mapper.ProjectMapper;
 import com.zjugis.business.service.ContractService;
@@ -160,11 +162,22 @@ public class FlowProjectService {
         return map;
     }
 
-    public int updateById(Project project) {
-        int res = projectMapper.updateById(project);
-        String flowDesc = StringUtils.join(Arrays.asList(project.getXmmc(), project.getLxsj(), project.getXmjl()), "/");
-        workflowClient.saveFlowDescribe(project.getInstanceId(), flowDesc);
-        return res;
+    public Map updateById(Project project) {
+        Map map=new HashMap();
+        QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("xmmc", project.getXmmc()).ne("id",project.getId()).eq("FLOW_STATUS","90");
+        Project entity = projectMapper.selectOne(queryWrapper);
+        if(entity!=null){
+            map.put("code",999);
+            map.put("msg","项目名称已存在,请重新输入!");
+        }else{
+            int res = projectMapper.updateById(project);
+            String flowDesc = StringUtils.join(Arrays.asList(project.getXmmc(), project.getLxsj(), project.getXmjl()), "/");
+            workflowClient.saveFlowDescribe(project.getInstanceId(), flowDesc);
+            map.put("code",200);
+            map.put("msg","保存成功!");
+        }
+        return map;
     }
 
     public ProjectVO flowAdd(String flowInstanceId, String userId) {

+ 2 - 1
zjugis-business/src/main/java/com/zjugis/business/service/impl/ContractServiceImpl.java

@@ -255,7 +255,8 @@ public class ContractServiceImpl implements ContractService{
         }
         ContractMessageCountResp resp = contractMapper.newAmount(messageDto);
         ContractMessageCountResp signAmount = contractMapper.signAmount(messageDto);
-        BigDecimal returnAmount = contractMapper.messageCountReturn(messageDto);
+        //BigDecimal returnAmount = contractMapper.messageCountReturn(messageDto);
+        BigDecimal returnAmount = contractMapper.messageCompanyCountReturn(messageDto);
         resp.setReturnAmount(returnAmount);
         resp.setSignAmount(signAmount.getSignAmount());
         return resp;

+ 2 - 1
zjugis-business/src/main/resources/mapper/oracle/ContractInvoiceMapper.xml

@@ -201,7 +201,7 @@
             T.PAY_COMPANY,
             T.INVOICE_CONTENT,
             CR.INVOICE_AMOUNT,
-            ( COALESCE( CR.INVOICE_AMOUNT, 0 ) - COALESCE( CR.RETURN_AMOUNT, 0 ) ) AS unreturnAmount,
+            ( COALESCE( t.INVOICE_AMOUNT, 0 ) - COALESCE( T4.returnAmount, 0 ) ) AS unreturnAmount,
             T.APPLY_WORKER_NAME,
             T.PAY_TAX_NUMBER,
             T.INVOICE_BZ,
@@ -219,6 +219,7 @@
             LEFT JOIN ZJUGIS_OA.SYSTEM_COMPANY C ON C.ID = T.INVOICE_COMPANY_ID
             LEFT JOIN ZJUGIS_OA.SYSTEM_DEPT D ON D.ID = T2.ZRBM_ID
             LEFT JOIN ZJUGIS_OA.SYSTEM_USERS U ON U.ID = T2.XSRY_ID
+            LEFT JOIN (SELECT count(1) as rc,max(RETURN_DATE) as maxd, min(RETURN_DATE) as mind,CONTRACT_INVOICE_ID,COALESCE(SUM(COALESCE(RETURN_AMOUNT,0)),0) as returnAmount FROM CONTRACT_RETURN_MONEY WHERE ISVALID = 1 GROUP BY CONTRACT_INVOICE_ID) T4 ON T4.CONTRACT_INVOICE_ID=T.ID
         <where>
             T.ISVALID = 1
             <if test="params != null and params.deptIds != null and params.deptIds.size > 0">

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

@@ -222,8 +222,12 @@
         z.ui.ajax({
             url: z.ui.comm.getEntranceUrl("/flow/contract/update"),
             data: z.ui.form.childStringify(postData),
-            success: function () {
-                all({success: true});
+            success: function (res) {
+                if(res.data.code==999){
+                    all({success: false, errorMsg: res.data.msg});
+                }else{
+                    all({ success: true });
+                }
             },
             error: function () {
                 all({success: false});

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

@@ -106,8 +106,12 @@
         z.ui.ajax({
             url: z.ui.comm.getEntranceUrl("/flow/project/update"),
             data: z.ui.form.childStringify(postData),
-            success: function () {
-                all({ success: true });
+            success: function (res) {
+                if(res.data.code==999){
+                    all({success: false, errorMsg: res.data.msg});
+                }else{
+                    all({ success: true });
+                }
             },
             error: function () {
                 all({ success: false });