Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
674e7a650b
|
|
@ -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,39 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (外层)批量修改修试审核详细
|
||||
*
|
||||
* @param repairAuditDetails (外层)修试审核详细集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int outerAudit(@NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||
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;
|
||||
}
|
||||
batchInsertRepairInputDetails(repairAuditDetailsByQuery);
|
||||
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("错误信息描述");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改修试审核详细
|
||||
*
|
||||
|
|
@ -454,25 +489,33 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
*/
|
||||
@Override
|
||||
public int updateRepairAuditDetailsBatch(@NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||
// 提取所有需要更新的 ID
|
||||
List<Long> ids = repairAuditDetails.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(RepairAuditDetails::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
batchInsertRepairInputDetails(repairAuditDetails);
|
||||
try {
|
||||
// 调用 Mapper 方法进行批量更新
|
||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
}
|
||||
|
||||
private void batchInsertRepairInputDetails(List<RepairAuditDetails> repairAuditDetailsByQuery) {
|
||||
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||
for (RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||
RepairInputDetails inputVo = new RepairInputDetails();
|
||||
BeanUtils.copyProperties(details, inputVo);
|
||||
inputVo.setAuditId(details.getId());
|
||||
inputList.add(inputVo);
|
||||
}
|
||||
repairInputDetailsMapper.batchInsertRepairInputDetails(inputList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除修试审核详细
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
@ -282,8 +298,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.nick_name createBy,
|
||||
tk.create_time createTime,
|
||||
tk.remark,
|
||||
tk.CODE repairNum,
|
||||
su1.user_name as teamName
|
||||
tk.CODE repairNum
|
||||
-- su1.user_name as teamName
|
||||
FROM
|
||||
tm_task tk
|
||||
LEFT JOIN tm_task_agreement tta ON tk.task_id = tta.task_id
|
||||
|
|
@ -295,7 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN sys_user su ON su.user_id = tk.create_by
|
||||
LEFT JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id
|
||||
LEFT JOIN sys_user su1 ON su1.user_id = mtr.user_id
|
||||
-- LEFT JOIN sys_user su1 ON su1.user_id = mtr.user_id
|
||||
WHERE
|
||||
tk.task_type = #{taskType}
|
||||
<if test="keyword != null and keyword != ''">
|
||||
|
|
|
|||
|
|
@ -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