diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index 5c47da5d..e6ac1e9a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject; import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.biz.config.PoiOutPage; import com.bonus.common.biz.constant.GlobalConstants; + import com.bonus.common.biz.utils.RequestContext; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.ServletUtils; @@ -112,20 +113,20 @@ public class SltAgreementInfoController extends BaseController { public AjaxResult getSltAgreementInfo4Project(SltAgreementInfo bean) { Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); - int loginUserHasSettlementPermission = sltAgreementInfoService.checkLoginUserHasSettlementPermission(); - if (bean != null) { - bean.setSettlementType(loginUserHasSettlementPermission); - } else { - bean = new SltAgreementInfo(); - bean.setSettlementType(loginUserHasSettlementPermission); - } +// int loginUserHasSettlementPermission = sltAgreementInfoService.checkLoginUserHasSettlementPermission(); +// if (bean != null) { +// bean.setSettlementType(loginUserHasSettlementPermission); +// } else { +// bean = new SltAgreementInfo(); +// bean.setSettlementType(loginUserHasSettlementPermission); +// } List list = sltAgreementInfoService.getSltAgreementInfo4Project(bean); ListPagingUtil paginated = ListPagingUtil.paging(pageIndex, pageSize, list); // 新增外层计算-- 计算当前分页数据的各条目费用 if (CollectionUtils.isNotEmpty(paginated.getRows())) { for (Object row : paginated.getRows()) { if (row instanceof SltAgreementInfo) { - ((SltAgreementInfo) row).setSettlementType(loginUserHasSettlementPermission); + ((SltAgreementInfo) row).setSettlementType(bean.getSettlementType()); } SltInfoVo sltInfoVo = null; if (row instanceof SltAgreementInfo) { @@ -166,13 +167,13 @@ public class SltAgreementInfoController extends BaseController { if (CollectionUtil.isEmpty(list)) { return AjaxResult.error("请选择协议"); } - if (list.get(0).getSettlementType() == null || list.get(0).getSettlementType() < 1) { - int settlementType = sltAgreementInfoService.checkLoginUserHasSettlementPermission(); - // 设置结算权限 - list.forEach(info -> info.setSettlementType(settlementType)); - } else { - list.forEach(info -> info.setSettlementType(list.get(0).getSettlementType())); - } +// if (list.get(0).getSettlementType() == null || list.get(0).getSettlementType() < 1) { +// int settlementType = sltAgreementInfoService.checkLoginUserHasSettlementPermission(); +// // 设置结算权限 +// list.forEach(info -> info.setSettlementType(settlementType)); +// } else { +// list.forEach(info -> info.setSettlementType(list.get(0).getSettlementType())); +// } List unitNames = new ArrayList<>(); List projectNames = new ArrayList<>(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java index d80cf113..16e58c0f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/vo/SltInfoVo.java @@ -162,6 +162,11 @@ public class SltInfoVo { @ApiModelProperty(value = "承租负责人签字") private String managerSignUrl; + + /** 结算批次 */ + @ApiModelProperty(value = "结算批次") + private String settlementTask; + /** 签字类型 */ @ApiModelProperty(value = "签字类型") private long signType; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index 811e433b..2d866d80 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -343,4 +343,8 @@ public interface SltAgreementInfoMapper { List selectAgreementInfoList(SltAgreementInfo bean); List getSltLoseList(SltAgreementInfo info); + + List getSltRepairDetailsList(SltAgreementInfo info); + + List getSltScrapDetailsList(SltAgreementInfo info); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index fe4bf0f4..5843ea6b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -2,13 +2,9 @@ package com.bonus.material.settlement.service.impl; import java.math.BigDecimal; import java.math.RoundingMode; -import java.time.LocalDate; -import java.time.ZoneId; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; -import cn.hutool.core.date.DateUtil; import com.bonus.common.biz.constant.GlobalConstants; import com.bonus.common.biz.domain.ProjectTreeBuild; import com.bonus.common.biz.domain.ProjectTreeNode; @@ -35,7 +31,6 @@ import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; @@ -501,19 +496,26 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { public List getRepairList(SltAgreementInfo info) { List repairList = new ArrayList<>(); - List taskList = taskMapper.getTaskIdList(info); + if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) { + repairList = sltAgreementInfoMapper.getSltRepairDetailsList(info); + } else { + List taskList = taskMapper.getTaskIdList(info); - List taskList2 = new ArrayList<>(); - taskList2 = checkTeamAgreementInfo(info); + List taskList2 = new ArrayList<>(); + taskList2 = checkTeamAgreementInfo(info); - if (null != taskList && !taskList.isEmpty()) { - if (null != taskList2 && !taskList2.isEmpty()) { - taskList.addAll(taskList2); + if (null != taskList && !taskList.isEmpty()) { + if (null != taskList2 && !taskList2.isEmpty()) { + taskList.addAll(taskList2); + } + + List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList); + repairList.addAll(repairDetailsList); } - - List repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList); - repairList.addAll(repairDetailsList); } + + + return repairList; } @@ -543,19 +545,26 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { public List getScrapList(SltAgreementInfo info) { List scrapList = new ArrayList<>(); - List taskList = taskMapper.getTaskIdList(info); - List taskList2 = new ArrayList<>(); - taskList2 = checkTeamAgreementInfo(info); + if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) { + scrapList = sltAgreementInfoMapper.getSltScrapDetailsList(info); + } else { + List taskList = taskMapper.getTaskIdList(info); - if (null != taskList && !taskList.isEmpty()) { + List taskList2 = new ArrayList<>(); + taskList2 = checkTeamAgreementInfo(info); - if (null != taskList2 && !taskList2.isEmpty()) { - taskList.addAll(taskList2); + if (null != taskList && !taskList.isEmpty()) { + + if (null != taskList2 && !taskList2.isEmpty()) { + taskList.addAll(taskList2); + } + List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList); + scrapList.addAll(scrapDetailsList); } - List scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList); - scrapList.addAll(scrapDetailsList); } + + return scrapList; } @@ -700,146 +709,167 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { @Transactional(rollbackFor = Exception.class) public int submitCosts(@NotNull(message = "结算信息不能为空") SltInfoVo sltInfoVo) { // 检查登录用户是否有结算权限 - int loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission(); - sltInfoVo.setSettlementType(loginUserSettlementTypePermission); - if (sltInfoVo.getSettlementType() == null) { - throw new ServiceException("结算类型错误,结算权限码为空"); - } - if (sltInfoVo.getSettlementType()!=EQUIPMENT_SETTLEMENT_TYPE && sltInfoVo.getSettlementType()!=SAFETY_EQUIPMENT_SETTLEMENT_TYPE) { - throw new ServiceException("结算类型错误,结算权限码不合法!"); - } +// int loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission(); +// sltInfoVo.setSettlementType(loginUserSettlementTypePermission); +// if (sltInfoVo.getSettlementType() == null) { +// throw new ServiceException("结算类型错误,结算权限码为空"); +// } +// if (sltInfoVo.getSettlementType()!=EQUIPMENT_SETTLEMENT_TYPE && sltInfoVo.getSettlementType()!=SAFETY_EQUIPMENT_SETTLEMENT_TYPE) { +// throw new ServiceException("结算类型错误,结算权限码不合法!"); +// } + + //如果结算类型为空,则生成2次提交任务,分别为工器具和安全工器具 try { - if (sltInfoVo.getAgreementIds() != null) { - for (Long agreementId : sltInfoVo.getAgreementIds()) { - if (agreementId == null || agreementId <= 0) { - throw new ServiceException("协议id错误"); - } - - // 查询【待审核】+【审核通过】的结算单数量 - int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId); - if (sltInfoVo.getAgreementIds().length <= 1) { - // 如果不是批量提交,已结算的费用类型就直接提示已结算 - if (theSettledCount > 0) { - String costType = Objects.equals(sltInfoVo.getSettlementType(), EQUIPMENT_SETTLEMENT_TYPE) ? "工器具" : "安全工器具"; - throw new ServiceException("协议:" + agreementId + "的" + costType + "费用已结算"); - } - } else { - // 如果是批量提交,一次性提交多个,那么已结算的就忽略跳过 - if (theSettledCount > 0) { - continue; - } - } - Long id; - sltInfoVo.setAgreementId(agreementId); - // 计算总成本 - BigDecimal totalCost = BigDecimal.ZERO; - SltAgreementInfo info = new SltAgreementInfo(); - info.setAgreementId(agreementId); - - //获取该协议下的所有维修任务 - List repairList = taskMapper.getTaskIdByAgreementId(info); - if(CollectionUtils.isNotEmpty(repairList)){ - throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!"); - } - - // 获取各项成本并累加 - totalCost = totalCost.add(getLeaseList(info).stream() - .map(SltAgreementInfo::getCosts) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - - totalCost = totalCost.add(getRepairList(info).stream() - .map(SltAgreementInfo::getCosts) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - - totalCost = totalCost.add(getScrapList(info).stream() - .map(SltAgreementInfo::getCosts) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - - totalCost = totalCost.add(getLoseList(info).stream() - .map(SltAgreementInfo::getCosts) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - - totalCost = totalCost.subtract(getReductionList(info).stream() - .map(SltAgreementReduce::getLeaseMoney) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - - // 设置总成本 - sltInfoVo.setTotalCostAll(totalCost); - //查找是否驳回 - int countReject = sltAgreementInfoMapper.getRejectCount(sltInfoVo); - // 判断已经结算的有几个 - int beforeCount = sltAgreementInfoMapper.getBeforeSettlementCount(sltInfoVo); - // 更新结算协议状态,0未结算,1全部结算 2部分结算 - int updateAgreementCount = bmAgreementInfoMapper.updateBmAgreementInfo(new BmAgreementInfo().setAgreementId(agreementId).setIsSlt(beforeCount == 0 ? 2L : 1L)); - if (updateAgreementCount == 0) { - throw new ServiceException("bm_agreement_info修改失败"); - } - if (countReject > 0) { - id = sltAgreementInfoMapper.getRejectId(sltInfoVo); - //修改 - int countAgain = sltAgreementInfoMapper.updateRejectCount(sltInfoVo); - if (countAgain == 0) { - throw new ServiceException("slt_agreement_apply修改失败"); - } - sltInfoVo.setUpdateTime(DateUtils.getNowDate()); - sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); - } else { - sltInfoVo.setCreateTime(DateUtils.getNowDate()); - sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); - //新增 - int countOne = sltAgreementInfoMapper.insertSltAgreementApply(sltInfoVo); - if (countOne != 1) { - throw new ServiceException("slt_agreement_apply新增失败"); - } - // 插入成功后,sltInfoVo 的 id 属性将被自动设置为新生成的主键值 - id = sltInfoVo.getId(); - sltInfoVo.setUpdateTime(DateUtils.getNowDate()); - } - if (!sltInfoVo.getLeaseList().isEmpty()) { - List filteredLeaseList = sltInfoVo.getLeaseList().stream() - .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) - .collect(Collectors.toList()); - if (!filteredLeaseList.isEmpty()) { - sltAgreementInfoMapper.insertSltAgreementDetailLease(filteredLeaseList, id); - } - } - if (!sltInfoVo.getRepairList().isEmpty()) { - List filteredRepairList = sltInfoVo.getRepairList().stream() - .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) - .collect(Collectors.toList()); - if (!filteredRepairList.isEmpty()) { - sltAgreementInfoMapper.insertSltAgreementDetailRepair(filteredRepairList, id); - } - } - if (!sltInfoVo.getScrapList().isEmpty()) { - List filteredScrapList = sltInfoVo.getScrapList().stream() - .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) - .collect(Collectors.toList()); - if (!filteredScrapList.isEmpty()) { - sltAgreementInfoMapper.insertSltAgreementDetailScrap(filteredScrapList, id); - } - } - if (!sltInfoVo.getLoseList().isEmpty()) { - List filteredLoseList = sltInfoVo.getLoseList().stream() - .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) - .collect(Collectors.toList()); - if (!filteredLoseList.isEmpty()) { - sltAgreementInfoMapper.insertSltAgreementDetailLose(filteredLoseList, id); - } - } + UUID uuid = UUID.randomUUID(); + String sltTask = uuid.toString(); + if (sltInfoVo.getSettlementType() == null) { + for (int i = 0; i < 2; i++) { + int sltType = i + 1; // 第一次循环为1,第二次循环为2 + sltInfoVo.setSettlementType(sltType); + sltFun(sltInfoVo,sltTask); } + }else{ + sltFun(sltInfoVo,sltTask); } + + return GlobalConstants.INT_1; } catch (Exception e) { throw new ServiceException("错误:" + e.getMessage()); } } + private void sltFun(@NotNull(message = "结算信息不能为空") SltInfoVo sltInfoVo,String sltTask) { + + if (sltInfoVo.getAgreementIds() != null) { + for (Long agreementId : sltInfoVo.getAgreementIds()) { + if (agreementId == null || agreementId <= 0) { + throw new ServiceException("协议id错误"); + } + + // 查询【待审核】+【审核通过】的结算单数量 + int theSettledCount = sltAgreementInfoMapper.selectTheSettledCountByAgreementIdType(sltInfoVo.getSettlementType(), agreementId); + if (sltInfoVo.getAgreementIds().length <= 1) { + // 如果不是批量提交,已结算的费用类型就直接提示已结算 + if (theSettledCount > 0) { + String costType = Objects.equals(sltInfoVo.getSettlementType(), EQUIPMENT_SETTLEMENT_TYPE) ? "工器具" : "安全工器具"; + throw new ServiceException("协议:" + agreementId + "的" + costType + "费用已结算"); + } + } else { + // 如果是批量提交,一次性提交多个,那么已结算的就忽略跳过 + if (theSettledCount > 0) { + continue; + } + } + Long id; + sltInfoVo.setAgreementId(agreementId); + // 计算总成本 + BigDecimal totalCost = BigDecimal.ZERO; + SltAgreementInfo info = new SltAgreementInfo(); + info.setAgreementId(agreementId); + info.setSettlementType(sltInfoVo.getSettlementType()); + //获取该协议下的所有维修任务 + List repairList = taskMapper.getTaskIdByAgreementId(info); + if(CollectionUtils.isNotEmpty(repairList)){ + throw new ServiceException("结算中存在维修和报废未完成的任务,无法结算!"); + } + + // 获取各项成本并累加 + totalCost = totalCost.add(getLeaseList(info).stream() + .map(SltAgreementInfo::getCosts) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add)); + + totalCost = totalCost.add(getRepairList(info).stream() + .map(SltAgreementInfo::getCosts) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add)); + + totalCost = totalCost.add(getScrapList(info).stream() + .map(SltAgreementInfo::getCosts) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add)); + + totalCost = totalCost.add(getLoseList(info).stream() + .map(SltAgreementInfo::getCosts) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add)); + + totalCost = totalCost.subtract(getReductionList(info).stream() + .map(SltAgreementReduce::getLeaseMoney) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add)); + + // 设置总成本 + sltInfoVo.setTotalCostAll(totalCost); + //查找是否驳回 + int countReject = sltAgreementInfoMapper.getRejectCount(sltInfoVo); + // 判断已经结算的有几个 + int beforeCount = sltAgreementInfoMapper.getBeforeSettlementCount(sltInfoVo); + // 更新结算协议状态,0未结算,1全部结算 2部分结算 + int updateAgreementCount = bmAgreementInfoMapper.updateBmAgreementInfo(new BmAgreementInfo().setAgreementId(agreementId).setIsSlt(beforeCount == 0 ? 2L : 1L)); + if (updateAgreementCount == 0) { + throw new ServiceException("bm_agreement_info修改失败"); + } + if (countReject > 0) { + id = sltAgreementInfoMapper.getRejectId(sltInfoVo); + //修改 + int countAgain = sltAgreementInfoMapper.updateRejectCount(sltInfoVo); + if (countAgain == 0) { + throw new ServiceException("slt_agreement_apply修改失败"); + } + sltInfoVo.setUpdateTime(DateUtils.getNowDate()); + sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); + } else { + sltInfoVo.setCreateTime(DateUtils.getNowDate()); + sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); + //新增 + sltInfoVo.setSettlementTask(sltTask); + int countOne = sltAgreementInfoMapper.insertSltAgreementApply(sltInfoVo); + if (countOne != 1) { + throw new ServiceException("slt_agreement_apply新增失败"); + } + // 插入成功后,sltInfoVo 的 id 属性将被自动设置为新生成的主键值 + id = sltInfoVo.getId(); + sltInfoVo.setUpdateTime(DateUtils.getNowDate()); + } + if (!sltInfoVo.getLeaseList().isEmpty()) { + List filteredLeaseList = getLeaseList(info).stream() + .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) + .collect(Collectors.toList()); + if (!filteredLeaseList.isEmpty()) { + sltAgreementInfoMapper.insertSltAgreementDetailLease(filteredLeaseList, id); + } + } + if (!sltInfoVo.getRepairList().isEmpty()) { + List filteredRepairList = getRepairList(info).stream() + .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) + .collect(Collectors.toList()); + if (!filteredRepairList.isEmpty()) { + sltAgreementInfoMapper.insertSltAgreementDetailRepair(filteredRepairList, id); + } + } + if (!sltInfoVo.getScrapList().isEmpty()) { + List filteredScrapList = getScrapList(info).stream() + .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) + .collect(Collectors.toList()); + if (!filteredScrapList.isEmpty()) { + sltAgreementInfoMapper.insertSltAgreementDetailScrap(filteredScrapList, id); + } + } + if (!sltInfoVo.getLoseList().isEmpty()) { + List filteredLoseList = getLoseList(info).stream() + .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) + .collect(Collectors.toList()); + if (!filteredLoseList.isEmpty()) { + sltAgreementInfoMapper.insertSltAgreementDetailLose(filteredLoseList, id); + } + } + } + } + + } + /** * 判断当前登陆用户是否有结算权限,如果有则进行赋值 * @return 结算类型值 diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 3037a60a..24d8b307 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -237,7 +237,17 @@ LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id - LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id and saa.settlement_type = #{settlementType} + LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id + + and saa.settlement_type = #{settlementType} + + + + and saa.settlement_type in(1,2) + + + + WHERE bai.status = '1' AND bui.type_id != '1731' and bui.unit_id in @@ -555,6 +565,7 @@ insert into slt_agreement_apply agreement_id, + settlement_task, `code`, settlement_type, creator, @@ -564,6 +575,7 @@ #{agreementId}, + #{settlementTask}, #{agreementCode}, #{settlementType,jdbcType=TINYINT}, #{createBy}, @@ -672,6 +684,7 @@ id from slt_agreement_apply saa where saa.agreement_id = #{agreementId} + and settlement_type = #{settlementType} @@ -1974,6 +1987,69 @@ ) res + + + insert into slt_history_report (agreement_id,agreement_code,unit_name,project_name, settlement_type,lease_cost,repair_cost,lose_cost,scrap_cost,reduction_cost,`year_month`,create_time diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index 1b46861b..88aa8e1b 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -192,6 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and saa.settlement_type = #{settlementType} + limit 1