禅道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

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

View File

@ -92,14 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and type_id = #{typeId}
</update>
<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,
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
FROM bm_agreement_info bai
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 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'
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}