|
@@ -1,6 +1,7 @@
|
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -198,6 +199,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
contractPageVO.setRemarks(contract.getRemarks());
|
|
|
contractPageVO.setAmounts(contract.getAmounts());
|
|
|
contractPageVO.setProjectId(contract.getProjectId());
|
|
|
+ contractPageVO.setStampDutyStatus(contract.getStampDutyStatus());
|
|
|
+ contractPageVO.setStampDutyTime(contract.getStampDutyTime());
|
|
|
+ contractPageVO.setProcurementWay(contract.getProcurementWay());
|
|
|
if (contract.getProjectId() != null) {
|
|
|
projectList.stream().filter(project -> project.getId().equals(contract.getProjectId())).findFirst().ifPresent(project -> contractPageVO.setProjectName(project.getProjectName()));
|
|
|
}
|
|
@@ -258,7 +262,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
*/
|
|
|
@Override
|
|
|
public HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status,
|
|
|
- String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus) {
|
|
|
+ String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus,Integer stampDutyStatus) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "导出合同");
|
|
@@ -268,7 +272,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
|
|
|
- HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
|
|
|
+ HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus,stampDutyStatus);
|
|
|
HashMap<String, Object> resultDate = (HashMap<String, Object>) contractPage.data;
|
|
|
List<ContractPageVO> data = (List<ContractPageVO>)resultDate.get("data");
|
|
|
List<String> headList = new ArrayList<String>();
|
|
@@ -384,6 +388,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
if (StringUtils.isNotBlank(paymentListStr)){
|
|
|
if (user.getCompanyId()==4215){
|
|
|
List<ContractPayCustomized> payCustomizedList = JSON.parseArray(paymentListStr, ContractPayCustomized.class);
|
|
|
+ // 2. 检查 billNumber 是否重复
|
|
|
+ Map<String, Long> billNumberCountMap = payCustomizedList.stream().filter(c->StringUtils.isNotEmpty(c.getBillNumber()))
|
|
|
+ .collect(Collectors.groupingBy(ContractPayCustomized::getBillNumber, Collectors.counting()));
|
|
|
+ List<String> duplicateBillNumbers = billNumberCountMap.entrySet().stream()
|
|
|
+ .filter(entry -> entry.getValue() > 1)
|
|
|
+ .map(Map.Entry::getKey)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!duplicateBillNumbers.isEmpty()){
|
|
|
+ httpRespMsg.setError("[" + contract.getNumber() + "]" + MessageUtils.message("凭证号重复"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
BigDecimal bg = new BigDecimal("0");
|
|
|
for (ContractPayCustomized payCustomized:payCustomizedList) {
|
|
|
payCustomized.setContractId(contract.getId());
|
|
@@ -438,7 +453,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "管理全部合同");
|
|
|
- boolean isAddPayRecord=false;
|
|
|
if(functionContractList.size() <= 0){
|
|
|
httpRespMsg.setError(MessageUtils.message("access.operationError"));
|
|
|
return httpRespMsg;
|
|
@@ -472,7 +486,19 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
//更新回款计划
|
|
|
if (StringUtils.isNotBlank(paymentListStr)){
|
|
|
if (user.getCompanyId()==4215){
|
|
|
+ System.out.println("===>"+paymentListStr);
|
|
|
List<ContractPayCustomized> payCustomizedList = JSON.parseArray(paymentListStr, ContractPayCustomized.class);
|
|
|
+ // 2. 检查 billNumber 是否重复
|
|
|
+ Map<String, Long> billNumberCountMap = payCustomizedList.stream().filter(c->StringUtils.isNotEmpty(c.getBillNumber()))
|
|
|
+ .collect(Collectors.groupingBy(ContractPayCustomized::getBillNumber, Collectors.counting()));
|
|
|
+ List<String> duplicateBillNumbers = billNumberCountMap.entrySet().stream()
|
|
|
+ .filter(entry -> entry.getValue() > 1)
|
|
|
+ .map(Map.Entry::getKey)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!duplicateBillNumbers.isEmpty()){
|
|
|
+ httpRespMsg.setError("[" + contract.getNumber() + "]" + MessageUtils.message("凭证号重复"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
payCustomizedMapper.delete(new QueryWrapper<ContractPayCustomized>().eq("contract_id",contract.getId()));
|
|
|
BigDecimal bg = new BigDecimal("0");
|
|
|
for (ContractPayCustomized payCustomized:payCustomizedList) {
|
|
@@ -481,9 +507,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
if (payCustomized.getIsPayed()) {
|
|
|
bg = bg.add(payCustomized.getPayedAmount());
|
|
|
}
|
|
|
- if (payCustomized.getReservedAmounts()==null){
|
|
|
- isAddPayRecord=true;
|
|
|
- }
|
|
|
}
|
|
|
contract.setPayment(bg);
|
|
|
}else {
|
|
@@ -529,10 +552,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
contractLogMapper.insert(contractLog);
|
|
|
if (user.getCompanyId() == 4215) {
|
|
|
custom.setContractId(contract.getId());
|
|
|
- ContractCustom customSelect = contractCustomMapper.selectOne(new QueryWrapper<ContractCustom>().eq("contract_id", contract.getId()));
|
|
|
- if (!customSelect.getIsAmountFixed()&&customSelect.getStampDutyStatus()==2&&isAddPayRecord){
|
|
|
- custom.setStampDutyStatus(3);
|
|
|
- }
|
|
|
contractCustomMapper.updateById(custom);
|
|
|
}
|
|
|
httpRespMsg.msg = MessageUtils.message("contract.editSuc");
|
|
@@ -1201,7 +1220,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus) {
|
|
|
+ public HttpRespMsg exportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId,String customerOrg,Integer finishStatus,Integer stampDutyStatus) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "导出合同");
|
|
@@ -1211,7 +1230,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
|
}
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
|
|
|
- HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
|
|
|
+ HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus,stampDutyStatus);
|
|
|
HashMap<String, Object> resultDate = (HashMap<String, Object>) contractPage.data;
|
|
|
List<ContractPageVO> data = (List<ContractPageVO>)resultDate.get("data");
|
|
|
List<String> headList = new ArrayList<String>();
|