|
@@ -1,6 +1,8 @@
|
|
package com.management.platform.service.impl;
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.vo.ContractPageVO;
|
|
import com.management.platform.entity.vo.ContractPageVO;
|
|
import com.management.platform.entity.vo.SysRichFunction;
|
|
import com.management.platform.entity.vo.SysRichFunction;
|
|
@@ -12,6 +14,7 @@ import com.management.platform.service.ExcelExportService;
|
|
import com.management.platform.util.*;
|
|
import com.management.platform.util.*;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
import org.apache.poi.EncryptedDocumentException;
|
|
import org.apache.poi.EncryptedDocumentException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
@@ -63,6 +66,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
@Resource
|
|
@Resource
|
|
private ContractLogMapper contractLogMapper;
|
|
private ContractLogMapper contractLogMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private InformationMapper informationMapper;
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
private String path;
|
|
private String path;
|
|
|
|
|
|
@@ -139,6 +144,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ArrayList<ContractPageVO> contractPageVOS = new ArrayList<>();
|
|
ArrayList<ContractPageVO> contractPageVOS = new ArrayList<>();
|
|
|
|
+ List<Map<String, Object>> contractLogs = contractLogMapper.selectMsg(user.getCompanyId());
|
|
for (Contract contract : contracts) {
|
|
for (Contract contract : contracts) {
|
|
ContractPageVO contractPageVO = new ContractPageVO();
|
|
ContractPageVO contractPageVO = new ContractPageVO();
|
|
List<ContractDocument> files = new ArrayList<>();
|
|
List<ContractDocument> files = new ArrayList<>();
|
|
@@ -158,6 +164,19 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
contractPageVO.setCheckerId(contract.getCheckerId());
|
|
contractPageVO.setCheckerId(contract.getCheckerId());
|
|
contractPageVO.setRemarks(contract.getRemarks());
|
|
contractPageVO.setRemarks(contract.getRemarks());
|
|
contractPageVO.setAmounts(contract.getAmounts());
|
|
contractPageVO.setAmounts(contract.getAmounts());
|
|
|
|
+ if (contract.getStatus().equals(2)){
|
|
|
|
+ for (Map<String, Object> contractLog : contractLogs) {
|
|
|
|
+ if (contractLog.get("contractId").toString().equals(contract.getId().toString())){
|
|
|
|
+ String msg = "";
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ msg = "$userName=" + contractLog.get("operateCorpWxId") + "$" + contractLog.get("msg");
|
|
|
|
+ }else {
|
|
|
|
+ msg = contractLog.get("operateName") + "" + contractLog.get("msg");
|
|
|
|
+ }
|
|
|
|
+ contractPageVO.setMsg(msg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
for (ContractDocument contractDocument : fileList) {
|
|
for (ContractDocument contractDocument : fileList) {
|
|
if (contract.getId().equals(contractDocument.getContractId())){
|
|
if (contract.getId().equals(contractDocument.getContractId())){
|
|
files.add(contractDocument);
|
|
files.add(contractDocument);
|
|
@@ -238,7 +257,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
contract.setCreatorName(contract.getCreatorName());
|
|
contract.setCreatorName(contract.getCreatorName());
|
|
}
|
|
}
|
|
item.add(contract.getCreatorName());
|
|
item.add(contract.getCreatorName());
|
|
- item.add(contract.getAmounts()==null?"":contract.getAmounts().toString() + "元");
|
|
|
|
|
|
+ BigDecimal bigDecimal = null;
|
|
|
|
+ if (contract.getAmounts() != null){
|
|
|
|
+ bigDecimal = new BigDecimal(contract.getAmounts().toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ }
|
|
|
|
+ item.add(contract.getAmounts()==null?"":bigDecimal + "");
|
|
item.add(contract.getTypeName());
|
|
item.add(contract.getTypeName());
|
|
switch (contract.getStatus()){
|
|
switch (contract.getStatus()){
|
|
case 0 :
|
|
case 0 :
|
|
@@ -359,6 +382,23 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
contract.setStatus(1);
|
|
contract.setStatus(1);
|
|
contract.setIndate(null);
|
|
contract.setIndate(null);
|
|
contractMapper.updateById(contract);
|
|
contractMapper.updateById(contract);
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ UpdateWrapper<Contract> contractUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
+ if (contract.getAmounts() == null){
|
|
|
|
+ contractUpdateWrapper.set("amounts",null);
|
|
|
|
+ flag = true;
|
|
|
|
+ }
|
|
|
|
+ if (contract.getStartDate() == null){
|
|
|
|
+ contractUpdateWrapper.set("start_date",null);
|
|
|
|
+ flag = true;
|
|
|
|
+ }
|
|
|
|
+ if (contract.getEndDate() == null){
|
|
|
|
+ contractUpdateWrapper.set("end_date",null);
|
|
|
|
+ flag = true;
|
|
|
|
+ }
|
|
|
|
+ if (flag){
|
|
|
|
+ contractMapper.update(null,contractUpdateWrapper.eq("id",contract.getId()));
|
|
|
|
+ }
|
|
ContractLog contractLog = new ContractLog();
|
|
ContractLog contractLog = new ContractLog();
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
contractLog.setCreatorId(contract.getCreatorId());
|
|
contractLog.setCreatorId(contract.getCreatorId());
|
|
@@ -607,6 +647,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
HttpRespMsg.setError(MessageUtils.message("access.operationError"));
|
|
HttpRespMsg.setError(MessageUtils.message("access.operationError"));
|
|
return HttpRespMsg;
|
|
return HttpRespMsg;
|
|
}
|
|
}
|
|
|
|
+ Contract target = contractMapper.selectById(id);
|
|
Contract contract = new Contract();
|
|
Contract contract = new Contract();
|
|
contract.setId(id);
|
|
contract.setId(id);
|
|
contract.setCheckerId(user.getId());
|
|
contract.setCheckerId(user.getId());
|
|
@@ -614,19 +655,32 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
contractMapper.updateById(contract);
|
|
contractMapper.updateById(contract);
|
|
ContractLog contractLog = new ContractLog();
|
|
ContractLog contractLog = new ContractLog();
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
- contractLog.setCreatorId(contract.getCreatorId());
|
|
|
|
|
|
+ contractLog.setCreatorId(target.getCreatorId());
|
|
contractLog.setContractId(contract.getId());
|
|
contractLog.setContractId(contract.getId());
|
|
contractLog.setOperateDate(LocalDateTime.now());
|
|
contractLog.setOperateDate(LocalDateTime.now());
|
|
contractLog.setOperatorId(user.getId());
|
|
contractLog.setOperatorId(user.getId());
|
|
if (status.equals(0)){
|
|
if (status.equals(0)){
|
|
contractLog.setType(2);
|
|
contractLog.setType(2);
|
|
contractLog.setMsg("审核通过了合同。");
|
|
contractLog.setMsg("审核通过了合同。");
|
|
|
|
+ Information information = new Information();
|
|
|
|
+ information.setUserId(target.getCreatorId());
|
|
|
|
+ information.setType(6);
|
|
|
|
+ information.setMsg("您提交的合同[" + target.getName() + "]由[" + user.getName() + "]审核通过。");
|
|
|
|
+ informationMapper.insert(information);
|
|
}else if (status.equals(2)){
|
|
}else if (status.equals(2)){
|
|
contractLog.setType(3);
|
|
contractLog.setType(3);
|
|
if (StringUtils.isBlank(msg)){
|
|
if (StringUtils.isBlank(msg)){
|
|
msg = "";
|
|
msg = "";
|
|
}
|
|
}
|
|
contractLog.setMsg("驳回了合同。原因:" + msg);
|
|
contractLog.setMsg("驳回了合同。原因:" + msg);
|
|
|
|
+ Information information = new Information();
|
|
|
|
+ information.setUserId(target.getCreatorId());
|
|
|
|
+ information.setType(7);
|
|
|
|
+ String item = contractLog.getMsg();
|
|
|
|
+ int i = item.indexOf("原因:");
|
|
|
|
+ String substring = item.substring(i, item.length());
|
|
|
|
+ information.setMsg("您提交的合同[" + target.getName() + "]被[" + user.getName() + "]驳回," + substring + "。");
|
|
|
|
+ informationMapper.insert(information);
|
|
}
|
|
}
|
|
contractLogMapper.insert(contractLog);
|
|
contractLogMapper.insert(contractLog);
|
|
return HttpRespMsg;
|
|
return HttpRespMsg;
|
|
@@ -680,15 +734,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
msg.setError(MessageUtils.message("access.deleteError"));
|
|
msg.setError(MessageUtils.message("access.deleteError"));
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
- contractMapper.deleteById(id);
|
|
|
|
- //删除附件
|
|
|
|
- List<ContractDocument> contractFile = contractDocumentMapper.selectList(new QueryWrapper<ContractDocument>().eq("contract_id", id));
|
|
|
|
- for (ContractDocument contractDocument : contractFile) {
|
|
|
|
- contractDocument.setIsDeleted(1);
|
|
|
|
- }
|
|
|
|
- for (ContractDocument contractDocument : contractFile) {
|
|
|
|
- contractDocumentMapper.updateById(contractDocument);
|
|
|
|
- }
|
|
|
|
Contract contract = contractMapper.selectById(id);
|
|
Contract contract = contractMapper.selectById(id);
|
|
ContractLog contractLog = new ContractLog();
|
|
ContractLog contractLog = new ContractLog();
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
contractLog.setCompanyId(user.getCompanyId());
|
|
@@ -699,8 +744,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
contractLog.setType(5);
|
|
contractLog.setType(5);
|
|
contractLog.setMsg("删除了合同。");
|
|
contractLog.setMsg("删除了合同。");
|
|
contractLogMapper.insert(contractLog);
|
|
contractLogMapper.insert(contractLog);
|
|
|
|
+ contractMapper.deleteById(id);
|
|
|
|
+ //删除附件
|
|
|
|
+ List<ContractDocument> contractFile = contractDocumentMapper.selectList(new QueryWrapper<ContractDocument>().eq("contract_id", id));
|
|
|
|
+ for (ContractDocument contractDocument : contractFile) {
|
|
|
|
+ contractDocument.setIsDeleted(1);
|
|
|
|
+ }
|
|
|
|
+ for (ContractDocument contractDocument : contractFile) {
|
|
|
|
+ contractDocumentMapper.updateById(contractDocument);
|
|
|
|
+ }
|
|
msg.msg = MessageUtils.message("other.deleteScu");
|
|
msg.msg = MessageUtils.message("other.deleteScu");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|