维修单分拆

This commit is contained in:
sxu 2024-11-28 18:16:02 +08:00
parent 5f4725250d
commit ee9155b386
4 changed files with 25 additions and 22 deletions

View File

@ -83,6 +83,8 @@ public interface RepairAuditDetailsMapper {
int deleteRepairAuditDetailsByTaskId(Long taskId); int deleteRepairAuditDetailsByTaskId(Long taskId);
int deleteRepairAuditDetailsByRepairId(@Param("repairId") Long repairId);
/** /**
* 批量删除修试审核详细 * 批量删除修试审核详细
* *

View File

@ -27,6 +27,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -849,30 +850,26 @@ public class RepairServiceImpl implements RepairService {
// 3.业务逻辑处理 // 3.业务逻辑处理
for (RepairTask task : taskList) { for (RepairTask task : taskList) {
Long wxTaskId = task.getTaskId();
task.setCreateBy(loginUser.getUserid());
// 查询任务的协议id
Long agreementId = repairMapper.getAgreementId(task);
// 新增tm_task表数据修饰审核任务状态是待审核
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
repairMapper.addTask(task);
// 循环插入修饰审核明细表
//repairAuditDetailsMapper.deleteRepairAuditDetailsByTaskId(task.getTaskId());
// 查询维修任务的详情表 // 查询维修任务的详情表
Long wxTaskId = task.getTaskId();
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getDetailsListByTaskIdAndStatus(wxTaskId, "1"); List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getDetailsListByTaskIdAndStatus(wxTaskId, "1");
for (RepairTaskDetails details : detailsList) { if (!CollectionUtils.isEmpty(detailsList)) {
details.setCreateBy(String.valueOf(loginUser.getUserid())); task.setCreateBy(loginUser.getUserid());
details.setTaskId(task.getTaskId()); Long agreementId = repairMapper.getAgreementId(task);
repairMapper.addAuditDetails(details); // 新增tm_task表数据修饰审核任务状态是待审核
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
repairMapper.addTask(task);
// 新增协议任务表tm_task_agreement--关联修饰任务与协议
task.setAgreementId(agreementId);
repairMapper.createAgreementTask(task);
// 新增审计记录
for (RepairTaskDetails details : detailsList) {
details.setCreateBy(String.valueOf(loginUser.getUserid()));
details.setTaskId(task.getTaskId());
repairMapper.addAuditDetails(details);
}
} }
repairApplyDetailsMapper.deleteRepairApplyDetailsByTaskIdAndStatus(wxTaskId, "1");
// 新增协议任务表--关联修饰任务与协议
task.setAgreementId(agreementId);
repairMapper.createAgreementTask(task);
} }
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
scrap_num as scrapNum, scrap_num as scrapNum,
company_id as companyId company_id as companyId
from repair_apply_details from repair_apply_details
where task_id = #{taskId} and status = #{status} where task_id = #{taskId} and status = #{status} and sent_to_next_phase = '0'
</select> </select>
<delete id="deleteRepairApplyDetailsById" parameterType="Long"> <delete id="deleteRepairApplyDetailsById" parameterType="Long">

View File

@ -281,6 +281,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from repair_audit_details where task_id = #{taskId} delete from repair_audit_details where task_id = #{taskId}
</delete> </delete>
<delete id="deleteRepairAuditDetailsByRepairId" parameterType="Long">
delete from repair_audit_details where repair_id = #{repairId}
</delete>
<delete id="deleteRepairAuditDetailsByIds" parameterType="String"> <delete id="deleteRepairAuditDetailsByIds" parameterType="String">
delete from repair_audit_details where id in delete from repair_audit_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">