维修优化
This commit is contained in:
parent
753f63dc38
commit
cd056ed34d
|
|
@ -188,13 +188,23 @@ public class RepairAuditDetailsController extends BaseController {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
@ApiOperation(value = "(外层)批量修改修试审核详细")
|
||||||
* 批量修改修试审核详细
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "批量修改修试审核详细")
|
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("repair:details:edit")
|
@RequiresPermissions("repair:details:edit")
|
||||||
@SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细")
|
@SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细")
|
||||||
|
@PutMapping("outerAudit")
|
||||||
|
public AjaxResult outerAudit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||||
|
return toAjax(repairAuditDetailsService.outerAudit(repairAuditDetails));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改修试审核详细
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "(内层)批量修改修试审核详细")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("repair:details:edit")
|
||||||
|
@SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细")
|
||||||
|
//@PutMapping("innerAudit")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
|
public AjaxResult edit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||||
return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails));
|
return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails));
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public interface RepairAuditDetailsMapper {
|
||||||
*/
|
*/
|
||||||
List<RepairAuditDetails> selectRepairAuditDetailsList(RepairAuditDetails repairAuditDetails);
|
List<RepairAuditDetails> selectRepairAuditDetailsList(RepairAuditDetails repairAuditDetails);
|
||||||
|
|
||||||
|
List<RepairAuditDetails> selectRepairAuditDetailsByTaskIds(@Param("taskIds") List<Long> taskIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增修试审核详细
|
* 新增修试审核详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.repair.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.material.repair.domain.RepairInputDetails;
|
import com.bonus.material.repair.domain.RepairInputDetails;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修试后入库Mapper接口
|
* 修试后入库Mapper接口
|
||||||
|
|
@ -26,6 +27,9 @@ public interface RepairInputDetailsMapper {
|
||||||
*/
|
*/
|
||||||
public List<RepairInputDetails> selectRepairInputDetailsList(RepairInputDetails repairInputDetails);
|
public List<RepairInputDetails> selectRepairInputDetailsList(RepairInputDetails repairInputDetails);
|
||||||
|
|
||||||
|
|
||||||
|
public int batchInsertRepairInputDetails(@Param("list") List<RepairInputDetails> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增修试后入库
|
* 新增修试后入库
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -80,10 +80,19 @@ public interface IRepairAuditDetailsService {
|
||||||
*/
|
*/
|
||||||
int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails);
|
int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量修改修试审核详细
|
* (外层)批量修改修试审核详细
|
||||||
*
|
*
|
||||||
* @param repairAuditDetails 修试审核详细集合
|
* @param repairAuditDetails (外层)修试审核详细集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int outerAudit(List<RepairAuditDetails> repairAuditDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (内层)批量修改修试审核详细
|
||||||
|
*
|
||||||
|
* @param repairAuditDetails (内层)修试审核详细集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateRepairAuditDetailsBatch(List<RepairAuditDetails> repairAuditDetails);
|
int updateRepairAuditDetailsBatch(List<RepairAuditDetails> repairAuditDetails);
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ import com.bonus.material.task.domain.TmTaskAgreement;
|
||||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
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 javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
@ -446,6 +448,51 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (外层)批量修改修试审核详细
|
||||||
|
*
|
||||||
|
* @param repairAuditDetails (外层)修试审核详细集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int outerAudit(@NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||||
|
// 提取所有需要更新的 ID
|
||||||
|
List<Long> taskIds = repairAuditDetails.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(RepairAuditDetails::getTaskId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (taskIds.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RepairAuditDetails> repairAuditDetailsByQuery = repairAuditDetailsMapper.selectRepairAuditDetailsByTaskIds(taskIds);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(repairAuditDetailsByQuery)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||||
|
for (RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||||
|
RepairInputDetails inputVo = new RepairInputDetails();
|
||||||
|
BeanUtils.copyProperties(details, inputVo);
|
||||||
|
inputList.add(inputVo);
|
||||||
|
}
|
||||||
|
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Long> ids = repairAuditDetailsByQuery.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(RepairAuditDetails::getId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("错误信息描述");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量修改修试审核详细
|
* 批量修改修试审核详细
|
||||||
*
|
*
|
||||||
|
|
@ -465,6 +512,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||||
|
for (RepairAuditDetails details : repairAuditDetails) {
|
||||||
|
RepairInputDetails inputVo = new RepairInputDetails();
|
||||||
|
BeanUtils.copyProperties(details, inputVo);
|
||||||
|
inputList.add(inputVo);
|
||||||
|
}
|
||||||
|
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 调用 Mapper 方法进行批量更新
|
// 调用 Mapper 方法进行批量更新
|
||||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
order by rad.create_time desc
|
order by rad.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRepairAuditDetailsByTaskIds" resultMap="RepairAuditDetailsResult">
|
||||||
|
select
|
||||||
|
rad.* ,mt.type_name as specification_type, mt1.type_name as machine_type_name, mma.ma_code as ma_id
|
||||||
|
from
|
||||||
|
repair_audit_details rad
|
||||||
|
left join ma_type mt on rad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
left join ma_machine mma on rad.ma_id= mma.ma_id
|
||||||
|
where
|
||||||
|
rad.task_id in
|
||||||
|
<foreach item="taskId" collection="taskIds" open="(" separator="," close=")">
|
||||||
|
#{taskId}
|
||||||
|
</foreach>
|
||||||
|
order by rad.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectRepairAuditDetailsById" parameterType="Long" resultMap="RepairAuditDetailsResult">
|
<select id="selectRepairAuditDetailsById" parameterType="Long" resultMap="RepairAuditDetailsResult">
|
||||||
<include refid="selectRepairAuditDetailsVo"/>
|
<include refid="selectRepairAuditDetailsVo"/>
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectRepairInputDetailsVo"/>
|
<include refid="selectRepairInputDetailsVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="batchInsertRepairInputDetails" parameterType="com.bonus.material.repair.domain.RepairInputDetails">
|
||||||
|
insert into repair_input_details
|
||||||
|
(task_id, audit_id, repair_id, ma_id, type_id, repair_num, input_num, create_by, create_time,
|
||||||
|
status, remark, company_id)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{item.taskId,jdbcType=INTEGER}, #{item.auditId,jdbcType=INTEGER}, #{item.repairId,jdbcType=INTEGER},
|
||||||
|
#{item.maId,jdbcType=INTEGER}, #{item.typeId,jdbcType=INTEGER}, #{item.repairNum,jdbcType=INTEGER},
|
||||||
|
#{item.inputNum,jdbcType=INTEGER},
|
||||||
|
#{item.createBy,jdbcType=VARCHAR}, NOW(), #{item.status,jdbcType=VARCHAR},
|
||||||
|
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<insert id="insertRepairInputDetails" parameterType="com.bonus.material.repair.domain.RepairInputDetails" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertRepairInputDetails" parameterType="com.bonus.material.repair.domain.RepairInputDetails" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into repair_input_details
|
insert into repair_input_details
|
||||||
|
|
@ -56,9 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="repairNum != null">repair_num,</if>
|
<if test="repairNum != null">repair_num,</if>
|
||||||
<if test="inputNum != null">input_num,</if>
|
<if test="inputNum != null">input_num,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
create_time,
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="companyId != null">company_id,</if>
|
<if test="companyId != null">company_id,</if>
|
||||||
|
|
@ -72,9 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="repairNum != null">#{repairNum},</if>
|
<if test="repairNum != null">#{repairNum},</if>
|
||||||
<if test="inputNum != null">#{inputNum},</if>
|
<if test="inputNum != null">#{inputNum},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
NOW(),
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="companyId != null">#{companyId},</if>
|
<if test="companyId != null">#{companyId},</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue