维修优化
This commit is contained in:
parent
753f63dc38
commit
cd056ed34d
|
|
@ -188,13 +188,23 @@ public class RepairAuditDetailsController extends BaseController {
|
|||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 批量修改修试审核详细
|
||||
*/
|
||||
@ApiOperation(value = "批量修改修试审核详细")
|
||||
@ApiOperation(value = "(外层)批量修改修试审核详细")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("repair:details:edit")
|
||||
@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
|
||||
public AjaxResult edit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||
return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails));
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public interface RepairAuditDetailsMapper {
|
|||
*/
|
||||
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 com.bonus.material.repair.domain.RepairInputDetails;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 修试后入库Mapper接口
|
||||
|
|
@ -26,6 +27,9 @@ public interface RepairInputDetailsMapper {
|
|||
*/
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* 批量修改修试审核详细
|
||||
* (外层)批量修改修试审核详细
|
||||
*
|
||||
* @param repairAuditDetails 修试审核详细集合
|
||||
* @param repairAuditDetails (外层)修试审核详细集合
|
||||
* @return 结果
|
||||
*/
|
||||
int outerAudit(List<RepairAuditDetails> repairAuditDetails);
|
||||
|
||||
/**
|
||||
* (内层)批量修改修试审核详细
|
||||
*
|
||||
* @param repairAuditDetails (内层)修试审核详细集合
|
||||
* @return 结果
|
||||
*/
|
||||
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.TmTaskMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
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;
|
||||
}
|
||||
|
||||
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||
for (RepairAuditDetails details : repairAuditDetails) {
|
||||
RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputList.add(inputVo);
|
||||
}
|
||||
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||
|
||||
try {
|
||||
// 调用 Mapper 方法进行批量更新
|
||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
||||
|
|
|
|||
|
|
@ -56,6 +56,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by rad.create_time desc
|
||||
</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">
|
||||
<include refid="selectRepairAuditDetailsVo"/>
|
||||
where id = #{id}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</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 into repair_input_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -56,9 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="repairNum != null">repair_num,</if>
|
||||
<if test="inputNum != null">input_num,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
create_time,
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null">remark,</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="inputNum != null">#{inputNum},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
NOW(),
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue