禅道bug解决

This commit is contained in:
liang.chao 2024-08-07 18:10:58 +08:00
parent 11f213ea1f
commit fc73e6bbfa
2 changed files with 54 additions and 51 deletions

View File

@ -35,7 +35,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
private SltAgreementInfoMapper sltAgreementInfoMapper; private SltAgreementInfoMapper sltAgreementInfoMapper;
@Override @Override
public List<AgreementInfo> getSltAgreementInfo(AgreementInfo bean) { public List<AgreementInfo> getSltAgreementInfo(AgreementInfo bean) {
return sltAgreementInfoMapper.getSltAgreementInfo(bean); return sltAgreementInfoMapper.getSltAgreementInfo(bean);
} }
@ -54,7 +54,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
sltInfoVo.setRepairList(repairList); sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList); sltInfoVo.setScrapList(scrapList);
sltInfoVo.setLoseList(loseList); sltInfoVo.setLoseList(loseList);
List<SltAgreementRelation> relations = getRelations(leaseList,repairList,scrapList,loseList,list); List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, list);
sltInfoVo.setRelations(relations); sltInfoVo.setRelations(relations);
return sltInfoVo; return sltInfoVo;
} }
@ -66,7 +66,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
String cost = sltAgreementInfoMapper.getCost(apply); String cost = sltAgreementInfoMapper.getCost(apply);
List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply); List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
sltInfoVo.setRelations(relations); sltInfoVo.setRelations(relations);
for (SltAgreementRelation relation : relations){ for (SltAgreementRelation relation : relations) {
AgreementInfo info = new AgreementInfo(); AgreementInfo info = new AgreementInfo();
info.setAgreementId(Long.valueOf(relation.getAgreementId())); info.setAgreementId(Long.valueOf(relation.getAgreementId()));
list.add(info); list.add(info);
@ -90,23 +90,23 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
apply.setAuditor(String.valueOf(userid)); apply.setAuditor(String.valueOf(userid));
int i = sltAgreementInfoMapper.updateRelation(apply); int i = sltAgreementInfoMapper.updateRelation(apply);
int j = 0; int j = 0;
if (i > 0){ if (i > 0) {
List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply); List<SltAgreementRelation> relations = sltAgreementInfoMapper.getRelations(apply);
List<AgreementInfo> infos = new ArrayList<>(); List<AgreementInfo> infos = new ArrayList<>();
for (SltAgreementRelation bean : relations){ for (SltAgreementRelation bean : relations) {
AgreementInfo info = new AgreementInfo(); AgreementInfo info = new AgreementInfo();
info.setAgreementId(Long.valueOf(bean.getAgreementId())); info.setAgreementId(Long.valueOf(bean.getAgreementId()));
infos.add(info); infos.add(info);
} }
List<SltAgreementInfo> loseList = getLoseList(infos); List<SltAgreementInfo> loseList = getLoseList(infos);
for (SltAgreementInfo agreementInfo : loseList){ for (SltAgreementInfo agreementInfo : loseList) {
if (agreementInfo.getMaId() != null && agreementInfo.getMaId().isEmpty()){ if (agreementInfo.getMaId() != null && agreementInfo.getMaId().isEmpty()) {
agreementInfo.setStatus("103"); agreementInfo.setStatus("103");
sltAgreementInfoMapper.updateMaStatus(agreementInfo); sltAgreementInfoMapper.updateMaStatus(agreementInfo);
} }
} }
j = sltAgreementInfoMapper.updateApply(apply); j = sltAgreementInfoMapper.updateApply(apply);
}else { } else {
throw new ServiceException("结算审核失败"); throw new ServiceException("结算审核失败");
//throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR); //throw new ServiceException(ExceptionDict.SETTLEMENT_REVIEW_ERROR_MSG,ExceptionDict.SETTLEMENT_REVIEW_ERROR);
} }
@ -115,14 +115,14 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) { private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) {
List<SltAgreementRelation> relations = new ArrayList<>(); List<SltAgreementRelation> relations = new ArrayList<>();
for (AgreementInfo info : list){ for (AgreementInfo info : list) {
SltAgreementRelation relation = new SltAgreementRelation(); SltAgreementRelation relation = new SltAgreementRelation();
BigDecimal loseCost = BigDecimal.ZERO; BigDecimal loseCost = BigDecimal.ZERO;
BigDecimal leaseCost = BigDecimal.ZERO; BigDecimal leaseCost = BigDecimal.ZERO;
BigDecimal scrapCost = BigDecimal.ZERO; BigDecimal scrapCost = BigDecimal.ZERO;
BigDecimal repairCost = BigDecimal.ZERO; BigDecimal repairCost = BigDecimal.ZERO;
for (SltAgreementInfo lease : leaseList){ for (SltAgreementInfo lease : leaseList) {
if (lease.getAgreementId().equals(info.getAgreementId().toString())){ if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
relation.setAgreementId(lease.getAgreementId()); relation.setAgreementId(lease.getAgreementId());
relation.setProjectName(lease.getProjectName()); relation.setProjectName(lease.getProjectName());
relation.setUnitName(lease.getUnitName()); relation.setUnitName(lease.getUnitName());
@ -131,20 +131,20 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
leaseCost = leaseCost.add(cost); leaseCost = leaseCost.add(cost);
} }
} }
for (SltAgreementInfo repair : repairList){ for (SltAgreementInfo repair : repairList) {
if (repair.getAgreementId().equals(info.getAgreementId().toString())){ if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
BigDecimal cost = new BigDecimal(repair.getCosts()); BigDecimal cost = new BigDecimal(repair.getCosts());
repairCost = repairCost.add(cost); repairCost = repairCost.add(cost);
} }
} }
for (SltAgreementInfo scrap : scrapList){ for (SltAgreementInfo scrap : scrapList) {
if (scrap.getAgreementId().equals(info.getAgreementId().toString())){ if (scrap.getAgreementId().equals(info.getAgreementId().toString())) {
BigDecimal cost = new BigDecimal(scrap.getCosts()); BigDecimal cost = new BigDecimal(scrap.getCosts());
scrapCost = scrapCost.add(cost); scrapCost = scrapCost.add(cost);
} }
} }
for (SltAgreementInfo lose : loseList){ for (SltAgreementInfo lose : loseList) {
if (lose.getAgreementId().equals(info.getAgreementId().toString())){ if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
//TODO 上面已经set过值这里为什么还要set值 //TODO 上面已经set过值这里为什么还要set值
relation.setAgreementId(lose.getAgreementId()); relation.setAgreementId(lose.getAgreementId());
relation.setProjectName(lose.getProjectName()); relation.setProjectName(lose.getProjectName());
@ -174,15 +174,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
apply.setCode(code); apply.setCode(code);
apply.setCompanyId(relations.get(0).getCompanyId()); apply.setCompanyId(relations.get(0).getCompanyId());
int i = sltAgreementInfoMapper.insApply(apply); int i = sltAgreementInfoMapper.insApply(apply);
if (i > 0){ if (i > 0) {
for (SltAgreementRelation relation : relations){ for (SltAgreementRelation relation : relations) {
AgreementInfo info = new AgreementInfo(); AgreementInfo info = new AgreementInfo();
info.setAgreementId(Long.valueOf(relation.getAgreementId())); info.setAgreementId(Long.valueOf(relation.getAgreementId()));
list.add(info); list.add(info);
relation.setApplyId(String.valueOf(apply.getId())); relation.setApplyId(String.valueOf(apply.getId()));
sltAgreementInfoMapper.updateInfoStatus(relation.getAgreementId()); sltAgreementInfoMapper.updateInfoStatus(relation.getAgreementId());
int j = sltAgreementInfoMapper.insRelation(relation); int j = sltAgreementInfoMapper.insRelation(relation);
if (j < 0){ if (j < 0) {
throw new ServiceException("新增协议结算记录失败"); throw new ServiceException("新增协议结算记录失败");
//throw new ServiceException(ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR_MSG,ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR); //throw new ServiceException(ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR_MSG,ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR);
} }
@ -191,7 +191,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> repairList = getRepairList(list); List<SltAgreementInfo> repairList = getRepairList(list);
List<SltAgreementInfo> scrapList = getScrapList(list); List<SltAgreementInfo> scrapList = getScrapList(list);
List<SltAgreementInfo> loseList = getLoseList(list); List<SltAgreementInfo> loseList = getLoseList(list);
for (SltAgreementInfo info : leaseList){ for (SltAgreementInfo info : leaseList) {
info.setSltType("1"); info.setSltType("1");
//info.setSltType(CostTypeEnum.LEASE_COST.getCode()); //info.setSltType(CostTypeEnum.LEASE_COST.getCode());
info.setApplyId(String.valueOf(apply.getId())); info.setApplyId(String.valueOf(apply.getId()));
@ -199,34 +199,34 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
//info.setPartType(PartTypeEnum.CHARGE.getCode()); //info.setPartType(PartTypeEnum.CHARGE.getCode());
sltAgreementInfoMapper.insDetails(info); sltAgreementInfoMapper.insDetails(info);
} }
for (SltAgreementInfo info : repairList){ for (SltAgreementInfo info : repairList) {
info.setSltType("3"); info.setSltType("3");
//info.setSltType(CostTypeEnum.MAINTENANCE_COST.getCode()); //info.setSltType(CostTypeEnum.MAINTENANCE_COST.getCode());
info.setApplyId(String.valueOf(apply.getId())); info.setApplyId(String.valueOf(apply.getId()));
//对是否收费进行转换 //对是否收费进行转换
//info.setPartType(PartTypeEnum.getCodeByInfo(info.getPartType())); //info.setPartType(PartTypeEnum.getCodeByInfo(info.getPartType()));
info.setPartType(info.getPartType()=="不收费" ? "0" : "1"); info.setPartType(info.getPartType() == "不收费" ? "0" : "1");
sltAgreementInfoMapper.insDetails(info); sltAgreementInfoMapper.insDetails(info);
} }
for (SltAgreementInfo info : scrapList){ for (SltAgreementInfo info : scrapList) {
info.setSltType("4"); info.setSltType("4");
//info.setSltType(CostTypeEnum.SCRAP_COST.getCode()); //info.setSltType(CostTypeEnum.SCRAP_COST.getCode());
info.setApplyId(String.valueOf(apply.getId())); info.setApplyId(String.valueOf(apply.getId()));
//info.setPartType(info.getScrapType()); //info.setPartType(info.getScrapType());
//info.setPartType(ScrapTypeEnum.getCodeByInfo(info.getScrapType())); //info.setPartType(ScrapTypeEnum.getCodeByInfo(info.getScrapType()));
info.setPartType(info.getScrapType()=="自然" ? "0" : "1"); info.setPartType(info.getScrapType() == "自然" ? "0" : "1");
sltAgreementInfoMapper.insDetails(info); sltAgreementInfoMapper.insDetails(info);
} }
for (SltAgreementInfo info : loseList){ for (SltAgreementInfo info : loseList) {
info.setSltType("2"); info.setSltType("2");
//info.setSltType(CostTypeEnum.LOSE_COST.getCode()); //info.setSltType(CostTypeEnum.LOSE_COST.getCode());
info.setApplyId(String.valueOf(apply.getId())); info.setApplyId(String.valueOf(apply.getId()));
info.setPartType("1"); info.setPartType("1");
//info.setPartType(PartTypeEnum.CHARGE.getCode()); //info.setPartType(PartTypeEnum.CHARGE.getCode());
sltAgreementInfoMapper.insDetails(info); sltAgreementInfoMapper.insDetails(info);
} }
}else { } else {
throw new ServiceException("新增结算单号失败"); throw new ServiceException("新增结算单号失败");
//throw new ServiceException(ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR_MSG,ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR); //throw new ServiceException(ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR_MSG,ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR);
} }
@ -241,15 +241,15 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
public List<SltAgreementInfo> getLoseList(List<AgreementInfo> list) { public List<SltAgreementInfo> getLoseList(List<AgreementInfo> list) {
List<SltAgreementInfo> loseList = new ArrayList<>(); List<SltAgreementInfo> loseList = new ArrayList<>();
for (AgreementInfo bean : list){ for (AgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(bean); List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(bean);
loseList.addAll(oneOfList); loseList.addAll(oneOfList);
} }
for (SltAgreementInfo bean : loseList){ for (SltAgreementInfo bean : loseList) {
if (bean.getBuyPrice() == null){ if (bean.getBuyPrice() == null) {
bean.setBuyPrice("0"); bean.setBuyPrice("0");
} }
if (bean.getNum() == null){ if (bean.getNum() == null) {
bean.setNum("0"); bean.setNum("0");
} }
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice()); BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
@ -272,20 +272,20 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> scrapList = new ArrayList<>(); List<SltAgreementInfo> scrapList = new ArrayList<>();
String taskType = "57"; String taskType = "57";
//String taskType = TaskTypeEnum.SCRAP_TASK.getCode(); //String taskType = TaskTypeEnum.SCRAP_TASK.getCode();
for (AgreementInfo bean : list){ for (AgreementInfo bean : list) {
List<TmTask> taskList = sltAgreementInfoMapper.getTaskList(bean,taskType); List<TmTask> taskList = sltAgreementInfoMapper.getTaskList(bean, taskType);
if (taskList != null && taskList.size() > 0){ if (taskList != null && taskList.size() > 0) {
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList); List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
scrapList.addAll(scrapDetailsList); scrapList.addAll(scrapDetailsList);
} }
} }
if (scrapList != null && scrapList.size() > 0){ if (scrapList != null && scrapList.size() > 0) {
for (SltAgreementInfo bean : scrapList){ for (SltAgreementInfo bean : scrapList) {
if (bean.getBuyPrice() == null){ if (bean.getBuyPrice() == null) {
bean.setBuyPrice("0"); bean.setBuyPrice("0");
} }
if (bean.getNum() == null){ if (bean.getNum() == null) {
bean.setNum("0"); bean.setNum("0");
} }
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice()); BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
@ -309,9 +309,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
List<SltAgreementInfo> repairList = new ArrayList<>(); List<SltAgreementInfo> repairList = new ArrayList<>();
String taskType = "41"; String taskType = "41";
//String taskType = TaskTypeEnum.MAINTENANCE_TASK.getCode(); //String taskType = TaskTypeEnum.MAINTENANCE_TASK.getCode();
for (AgreementInfo bean : list){ for (AgreementInfo bean : list) {
List<TmTask> taskList = sltAgreementInfoMapper.getTaskList(bean,taskType); List<TmTask> taskList = sltAgreementInfoMapper.getTaskList(bean, taskType);
if (taskList != null && taskList.size() > 0){ if (taskList != null && taskList.size() > 0) {
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList); List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
repairList.addAll(repairDetailsList); repairList.addAll(repairDetailsList);
} }
@ -321,18 +321,18 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
public List<SltAgreementInfo> getLeaseList(List<AgreementInfo> list) { public List<SltAgreementInfo> getLeaseList(List<AgreementInfo> list) {
List<SltAgreementInfo> leaseList = new ArrayList<>(); List<SltAgreementInfo> leaseList = new ArrayList<>();
for (AgreementInfo bean : list){ for (AgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(bean); List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(bean);
leaseList.addAll(oneOfList); leaseList.addAll(oneOfList);
} }
for (SltAgreementInfo bean : leaseList){ for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null){ if (bean.getLeasePrice() == null) {
bean.setLeasePrice("0"); bean.setLeasePrice("0");
} }
if (bean.getNum() == null){ if (bean.getNum() == null) {
bean.setNum("0"); bean.setNum("0");
} }
if (bean.getLeaseDays() == null){ if (bean.getLeaseDays() == null) {
bean.setLeaseDays("0"); bean.setLeaseDays("0");
} }
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice()); BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
@ -344,7 +344,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return leaseList; return leaseList;
} }
/**结算单号编码生成规则*/ /**
* 结算单号编码生成规则
*/
private String sltCodeRule(String code) { private String sltCodeRule(String code) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate(); Date nowDate = DateUtils.getNowDate();

View File

@ -92,14 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and type_id = #{typeId} and type_id = #{typeId}
</update> </update>
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo"> <select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time, SELECT bai.agreement_id, bai.agreement_code, contract_code,file_url ,file_name,sign_time,
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName, bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,sar.cost as cost, plan_start_time,lease_day,auth_person,phone,saa.remark,bai.protocol,sar.cost as cost,
case when sar.id is null then '1' when sar.status = '0' then '2' when sar.status = '1' then '3' end as sltStatus case when sar.id is null then '1' when sar.status = '0' then '2' when sar.status = '1' then '3' end as sltStatus
FROM bm_agreement_info bai FROM bm_agreement_info bai
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
left join slt_agreement_relation sar on bai.agreement_id = sar.agreement_id LEFT JOIN slt_agreement_relation sar on bai.agreement_id = sar.agreement_id
LEFT JOIN slt_agreement_apply saa on saa.id = sar.apply_id
where bai.status = '1' where bai.status = '1'
<if test="unitId != null and unitId != ''"> <if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId} and bui.unit_id = #{unitId}