diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/ScrapApplyDetailsMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/ScrapApplyDetailsMapper.java index 29923bee..2fb8cf1d 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/ScrapApplyDetailsMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/ScrapApplyDetailsMapper.java @@ -157,4 +157,6 @@ public interface ScrapApplyDetailsMapper List getRepairRecord(RepairAuditDetails bean); String getFileUrl(String s); + + List getGyoupRepairRecord(RepairAuditDetails byRepairId); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairAuditDetailsServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairAuditDetailsServiceImpl.java index 8a9e36c4..03e969be 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairAuditDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairAuditDetailsServiceImpl.java @@ -247,23 +247,28 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService taskType = 57; long scrapTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId); for (RepairAuditDetails scrapDetails : scrapNumList) { + RepairAuditDetails byRepairId = scrapApplyDetailsMapper.getByRepairId(String.valueOf(scrapDetails.getRepairId())); + List repairRecord = scrapApplyDetailsMapper.getGyoupRepairRecord(byRepairId); Long typeId = scrapDetails.getTypeId(); Long maId = scrapDetails.getMaId(); // 创建报废任务 BigDecimal scrapNum = scrapDetails.getScrapNum(); if (scrapNum.compareTo(b) > 0) { - ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails(); - scrapApplyDetails.setTaskId(scrapTaskId); - scrapApplyDetails.setTypeId(typeId); - scrapApplyDetails.setMaId(maId); - scrapApplyDetails.setScrapNum(scrapNum); - scrapApplyDetails.setScrapSource("2"); - scrapApplyDetails.setStatus("0"); - scrapApplyDetails.setParentId(scrapDetails.getId()); - scrapApplyDetails.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); - scrapApplyDetails.setCreateTime(new Date()); - scrapApplyDetails.setCompanyId((long) companyId); - scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails); + for (RepairRecord bean : repairRecord){ + ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails(); + scrapApplyDetails.setTaskId(scrapTaskId); + scrapApplyDetails.setTypeId(typeId); + scrapApplyDetails.setMaId(maId); + scrapApplyDetails.setScrapNum(BigDecimal.valueOf(bean.getScrapNum())); + scrapApplyDetails.setScrapType(bean.getScrapType()); + scrapApplyDetails.setScrapSource("2"); + scrapApplyDetails.setStatus("0"); + scrapApplyDetails.setParentId(scrapDetails.getId()); + scrapApplyDetails.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); + scrapApplyDetails.setCreateTime(new Date()); + scrapApplyDetails.setCompanyId((long) companyId); + scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails); + } } } diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml index 575415e1..65456940 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/ScrapApplyDetailsMapper.xml @@ -383,5 +383,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_file_info where id = #{s} + \ No newline at end of file