cs 2 anni fa
parent
commit
e39527bbb8

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ContractService.java

@@ -29,7 +29,7 @@ public interface ContractService extends IService<Contract> {
 
     HttpRespMsg importContract(HttpServletRequest request, MultipartFile file);
 
-    HttpRespMsg processContract(HttpServletRequest request, Integer id, Integer status);
+    HttpRespMsg processContract(HttpServletRequest request, Integer id, Integer status ,String msg);
 
     HttpRespMsg contractFile(HttpServletRequest request, Integer id);
 

+ 61 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -61,6 +61,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
     private ContractDocumentMapper contractDocumentMapper;
     @Resource
     private SysFunctionMapper sysFunctionMapper;
+    @Resource
+    private ContractLogMapper contractLogMapper;
     @Value(value = "${upload.path}")
     private String path;
 
@@ -306,6 +308,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         contract.setCreatorId(user.getId());
         contract.setCompanyId(user.getCompanyId());
         contractMapper.insert(contract);
+        ContractLog contractLog = new ContractLog();
+        contractLog.setCompanyId(user.getCompanyId());
+        contractLog.setCreatorId(user.getId());
+        contractLog.setContractId(contract.getId());
+        contractLog.setOperateDate(LocalDateTime.now());
+        contractLog.setOperatorId(user.getId());
+        contractLog.setType(0);
+        contractLog.setMsg("创建了合同。");
+        contractLogMapper.insert(contractLog);
         httpRespMsg.msg = MessageUtils.message("contract.addSuc");
         httpRespMsg.data = contract.getId();
         return httpRespMsg;
@@ -348,6 +359,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             contract.setStatus(1);
             contract.setIndate(null);
             contractMapper.updateById(contract);
+            ContractLog contractLog = new ContractLog();
+            contractLog.setCompanyId(user.getCompanyId());
+            contractLog.setCreatorId(contract.getCreatorId());
+            contractLog.setContractId(contract.getId());
+            contractLog.setOperateDate(LocalDateTime.now());
+            contractLog.setOperatorId(user.getId());
+            contractLog.setType(1);
+            contractLog.setMsg("编辑了合同。");
+            contractLogMapper.insert(contractLog);
             httpRespMsg.msg = MessageUtils.message("contract.editSuc");
             return httpRespMsg;
         }catch (NullPointerException e) {
@@ -506,6 +526,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                     contractMapper.insert(contract);
                     i++;
                 }
+                ContractLog contractLog = new ContractLog();
+                contractLog.setCompanyId(user.getCompanyId());
+                contractLog.setCreatorId(user.getId());
+                contractLog.setContractId(null);
+                contractLog.setOperateDate(LocalDateTime.now());
+                contractLog.setOperatorId(user.getId());
+                contractLog.setType(4);
+                contractLog.setMsg("批量导入了合同。");
+                contractLogMapper.insert(contractLog);
                 msg.data = i;
                 String originName = fileName;
                 //定义一个独立的文件夹
@@ -569,21 +598,38 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
      * @return
      */
     @Override
-    public HttpRespMsg processContract(HttpServletRequest request, Integer id, Integer status) {
-        HttpRespMsg msg = new HttpRespMsg();
+    public HttpRespMsg processContract(HttpServletRequest request, Integer id, Integer status ,String msg) {
+        HttpRespMsg HttpRespMsg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
         List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "审核合同");
         if(functionContractList.size() <= 0){
-            msg.setError(MessageUtils.message("access.operationError"));
-            return msg;
+            HttpRespMsg.setError(MessageUtils.message("access.operationError"));
+            return HttpRespMsg;
         }
         Contract contract = new Contract();
         contract.setId(id);
         contract.setCheckerId(user.getId());
         contract.setStatus(status);
         contractMapper.updateById(contract);
-        return msg;
+        ContractLog contractLog = new ContractLog();
+        contractLog.setCompanyId(user.getCompanyId());
+        contractLog.setCreatorId(contract.getCreatorId());
+        contractLog.setContractId(contract.getId());
+        contractLog.setOperateDate(LocalDateTime.now());
+        contractLog.setOperatorId(user.getId());
+        if (status.equals(0)){
+            contractLog.setType(2);
+            contractLog.setMsg("审核通过了合同。");
+        }else if (status.equals(2)){
+            contractLog.setType(3);
+            if (StringUtils.isBlank(msg)){
+                msg = "";
+            }
+            contractLog.setMsg("驳回了合同。原因:" + msg);
+        }
+        contractLogMapper.insert(contractLog);
+        return HttpRespMsg;
     }
 
     /**
@@ -643,6 +689,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         for (ContractDocument contractDocument : contractFile) {
             contractDocumentMapper.updateById(contractDocument);
         }
+        Contract contract = contractMapper.selectById(id);
+        ContractLog contractLog = new ContractLog();
+        contractLog.setCompanyId(user.getCompanyId());
+        contractLog.setCreatorId(contract.getCreatorId());
+        contractLog.setContractId(contract.getId());
+        contractLog.setOperateDate(LocalDateTime.now());
+        contractLog.setOperatorId(user.getId());
+        contractLog.setType(5);
+        contractLog.setMsg("删除了合同。");
+        contractLogMapper.insert(contractLog);
         msg.msg = MessageUtils.message("other.deleteScu");
         return msg;
     }