修饰审核速度优化
This commit is contained in:
parent
5e5ae0d5a6
commit
4dc88291ee
|
|
@ -72,6 +72,11 @@ public interface RepairApplyDetailsMapper {
|
||||||
*/
|
*/
|
||||||
public int deleteRepairApplyDetailsByIds(Long[] ids);
|
public int deleteRepairApplyDetailsByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量根据维修ID数组查询维修任务单号
|
||||||
|
*/
|
||||||
|
List<RepairAuditDetails> selectRepairCodeByIds(@Param("list") List<Long> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据维修ID查询维修任务单号
|
* 根据维修ID查询维修任务单号
|
||||||
* @param repairId
|
* @param repairId
|
||||||
|
|
@ -102,6 +107,11 @@ public interface RepairApplyDetailsMapper {
|
||||||
*/
|
*/
|
||||||
int updateRepairApplyDetailsAfterAudit(RepairAuditDetails dto);
|
int updateRepairApplyDetailsAfterAudit(RepairAuditDetails dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改repair_apply_record维修任务详情状态
|
||||||
|
*/
|
||||||
|
int updateRepairApplyDetailsAfterAuditBatch(@Param("list") List<RepairAuditDetails> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据back_id获取最大level
|
* 根据back_id获取最大level
|
||||||
* @param backId
|
* @param backId
|
||||||
|
|
|
||||||
|
|
@ -603,21 +603,10 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
level = details.getLevel();
|
level = details.getLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (Objects.nonNull(preTmTaskInfo) && Objects.nonNull(preTmTaskInfo.getPreTaskId())) {
|
|
||||||
taskMapper.updateTaskStatus(String.valueOf(preTmTaskInfo.getPreTaskId()), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus());
|
|
||||||
}*/
|
|
||||||
// 根据taskId查询维修审核明细
|
// 根据taskId查询维修审核明细
|
||||||
final List<RepairAuditDetails> repairAuditDetailsByTaskId = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskId(auditDetails.getTaskId());
|
final List<RepairAuditDetails> repairAuditDetailsByTaskId = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskId(auditDetails.getTaskId());
|
||||||
if (!CollectionUtils.isEmpty(repairAuditDetailsByTaskId)) {
|
if (!CollectionUtils.isEmpty(repairAuditDetailsByTaskId)) {
|
||||||
for (RepairAuditDetails repairAuditDetail : repairAuditDetailsByTaskId) {
|
for (RepairAuditDetails repairAuditDetail : repairAuditDetailsByTaskId) {
|
||||||
/*if ("1".equals(repairAuditDetail.getStatus()) || "2".equals(repairAuditDetail.getStatus())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 根据查询详情获取的维修ID,更新scrap_apply_details维修数量
|
|
||||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
|
|
||||||
ObjectUtils.defaultIfNull(repairAuditDetail.getRepairedNum(),0).longValue(),
|
|
||||||
ObjectUtils.defaultIfNull(repairAuditDetail.getScrapNum(),0).longValue(), repairAuditDetail.getRepairId());
|
|
||||||
repairApplyDetailsMapper.updateStatus(repairAuditDetail.getRepairId(), RepairTaskStatusEnum.TASK_STATUS_PROCESSING.getStatus());*/
|
|
||||||
RepairTaskDetails repairTaskDetails = new RepairTaskDetails();
|
RepairTaskDetails repairTaskDetails = new RepairTaskDetails();
|
||||||
repairTaskDetails.setNewTaskId(newTaskId);
|
repairTaskDetails.setNewTaskId(newTaskId);
|
||||||
repairTaskDetails.setMaId(repairAuditDetail.getMaId() == null ? null : repairAuditDetail.getMaId().toString());
|
repairTaskDetails.setMaId(repairAuditDetail.getMaId() == null ? null : repairAuditDetail.getMaId().toString());
|
||||||
|
|
@ -785,6 +774,12 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入维修明细
|
||||||
|
* @param scrapApplyDetailList 报废明细
|
||||||
|
* @param repairAuditDetailsByQuery 维修明细by查询
|
||||||
|
* @param agreementId 协议ID
|
||||||
|
*/
|
||||||
private void batchInsertRepairInputDetails(List<ScrapApplyDetails> scrapApplyDetailList, List<RepairAuditDetails> repairAuditDetailsByQuery, Long agreementId) {
|
private void batchInsertRepairInputDetails(List<ScrapApplyDetails> scrapApplyDetailList, List<RepairAuditDetails> repairAuditDetailsByQuery, Long agreementId) {
|
||||||
boolean inputFlag = false;
|
boolean inputFlag = false;
|
||||||
boolean scrapFlag = false;
|
boolean scrapFlag = false;
|
||||||
|
|
@ -803,7 +798,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
//插入修饰审核入库任务表
|
//插入修饰审核入库任务表
|
||||||
Long newTaskId = null;
|
Long newTaskId = null;
|
||||||
if (inputFlag) {
|
if (inputFlag) {
|
||||||
|
// 插入任务表
|
||||||
newTaskId = insertTt();
|
newTaskId = insertTt();
|
||||||
|
// 插入任务协议关联表
|
||||||
insertTta(newTaskId, agreementId);
|
insertTta(newTaskId, agreementId);
|
||||||
}
|
}
|
||||||
//插入报废任务表
|
//插入报废任务表
|
||||||
|
|
@ -813,11 +810,37 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
insertScrapTta(newScrapTaskId, agreementId);
|
insertScrapTta(newScrapTaskId, agreementId);
|
||||||
}
|
}
|
||||||
final List<RepairInputDetails> inputList = new ArrayList<>();
|
final List<RepairInputDetails> inputList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<RepairAuditDetails> dtoArray = new ArrayList<>();
|
||||||
|
List<ScrapApplyDetails> listAll = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(repairAuditDetailsByQuery)) {
|
||||||
|
dtoArray = repairApplyDetailsMapper.selectRepairCodeByIds(repairAuditDetailsByQuery.stream().map(RepairAuditDetails::getRepairId).collect(Collectors.toList()));
|
||||||
|
repairApplyDetailsMapper.updateRepairApplyDetailsAfterAuditBatch(repairAuditDetailsByQuery);
|
||||||
|
listAll = scrapApplyDetailsMapper.selectScrapByTaskIdList(repairAuditDetailsByQuery);
|
||||||
|
}
|
||||||
|
|
||||||
for (final RepairAuditDetails details : repairAuditDetailsByQuery) {
|
for (final RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||||
RepairAuditDetails dto = repairApplyDetailsMapper.selectById(details.getRepairId());
|
RepairAuditDetails dto;
|
||||||
|
if (CollectionUtil.isEmpty(dtoArray)) {
|
||||||
|
dto = repairApplyDetailsMapper.selectById(details.getRepairId());
|
||||||
// 根据taskId修改repair_apply_record的status状态为已审核1
|
// 根据taskId修改repair_apply_record的status状态为已审核1
|
||||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterAudit(dto);
|
repairApplyDetailsMapper.updateRepairApplyDetailsAfterAudit(dto);
|
||||||
List<ScrapApplyDetails> list = scrapApplyDetailsMapper.selectScrapByTaskId(dto);
|
} else {
|
||||||
|
dto = dtoArray.stream().filter(dto1 -> dto1.getRepairId().equals(details.getRepairId())).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ScrapApplyDetails> list;
|
||||||
|
if (CollectionUtil.isNotEmpty(listAll)) {
|
||||||
|
list = listAll.stream().filter(item -> {
|
||||||
|
if (dto != null) {
|
||||||
|
return item.getTaskId().equals(dto.getTaskId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
list = scrapApplyDetailsMapper.selectScrapByTaskId(dto);
|
||||||
|
}
|
||||||
|
|
||||||
if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) {
|
if (details.getRepairedNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
//修改机具状态为修试后待入库
|
//修改机具状态为修试后待入库
|
||||||
if (null != details.getMaId()) {
|
if (null != details.getMaId()) {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,11 @@ public interface ScrapApplyDetailsMapper {
|
||||||
*/
|
*/
|
||||||
List<ScrapApplyDetails> selectScrapByTaskId(RepairAuditDetails dto);
|
List<ScrapApplyDetails> selectScrapByTaskId(RepairAuditDetails dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量根据任务id数组查询报废详情
|
||||||
|
*/
|
||||||
|
List<ScrapApplyDetails> selectScrapByTaskIdList(@Param("list") List<RepairAuditDetails> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台账审核
|
* 台账审核
|
||||||
* @param scrapApplyDetails
|
* @param scrapApplyDetails
|
||||||
|
|
|
||||||
|
|
@ -260,4 +260,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectRepairCodeByIds" resultType="com.bonus.material.repair.domain.RepairAuditDetails">
|
||||||
|
select
|
||||||
|
id as repairId,
|
||||||
|
task_id as taskId,
|
||||||
|
type_id as typeId,
|
||||||
|
ma_id as maId,
|
||||||
|
level as level
|
||||||
|
from repair_apply_details
|
||||||
|
where id in
|
||||||
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateRepairApplyDetailsAfterAuditBatch">
|
||||||
|
update repair_apply_record
|
||||||
|
set status = 1,
|
||||||
|
update_time = NOW()
|
||||||
|
where task_id in
|
||||||
|
<foreach item="obj" collection="list" open="(" separator="," close=")">
|
||||||
|
#{obj.taskId}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -579,4 +579,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND m.type_id = #{typeId}
|
AND m.type_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectScrapByTaskIdList" resultType="com.bonus.material.scrap.domain.ScrapApplyDetails">
|
||||||
|
SELECT
|
||||||
|
task_id AS taskId,
|
||||||
|
ma_id AS maId,
|
||||||
|
type_id AS typeId,
|
||||||
|
GROUP_CONCAT(DISTINCT scrap_reason) AS scrapReason,
|
||||||
|
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType,
|
||||||
|
GROUP_CONCAT(DISTINCT create_by) AS createBy
|
||||||
|
FROM repair_apply_record rc
|
||||||
|
WHERE rc.repair_type = '3'
|
||||||
|
<if test="list != null and list.size > 0">
|
||||||
|
AND (
|
||||||
|
<foreach collection="list" item="t" separator=" OR ">
|
||||||
|
(
|
||||||
|
rc.task_id = #{t.taskId}
|
||||||
|
AND rc.type_id = #{t.typeId}
|
||||||
|
<if test="t.maId != null">
|
||||||
|
AND rc.ma_id = #{t.maId}
|
||||||
|
</if>
|
||||||
|
<if test="t.maId == null">
|
||||||
|
AND rc.ma_id IS NULL
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
GROUP BY rc.task_id, rc.ma_id, rc.type_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue