Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
aa6f441f21
|
|
@ -204,8 +204,7 @@ public class RepairAuditDetailsController extends BaseController {
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("repair:details:edit")
|
||||
@SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细")
|
||||
//@PutMapping("innerAudit")
|
||||
@PutMapping
|
||||
@PutMapping("innerAudit")
|
||||
public AjaxResult edit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
|
||||
return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,23 @@ public class RepairApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "维修合格数量")
|
||||
private Long repairedNum;
|
||||
|
||||
/**
|
||||
* 本次维修合格数量
|
||||
*/
|
||||
@ApiModelProperty(value = "本次维修合格数量")
|
||||
private int thisRepairedNum;
|
||||
|
||||
/** 维修报废数量 */
|
||||
@Excel(name = "维修报废数量")
|
||||
@ApiModelProperty(value = "维修报废数量")
|
||||
private Long scrapNum;
|
||||
|
||||
/**
|
||||
* 本次维修报废数量
|
||||
*/
|
||||
@ApiModelProperty(value = "本次维修报废数量")
|
||||
private int thisScrapNum;
|
||||
|
||||
/** 0未完成,1已完成 */
|
||||
@Excel(name = "0未完成,1已完成")
|
||||
@ApiModelProperty(value = "0未完成,1已完成")
|
||||
|
|
@ -71,8 +83,4 @@ public class RepairApplyDetails extends BaseEntity {
|
|||
@Excel(name = "维修人")
|
||||
@ApiModelProperty(value = "维修人")
|
||||
private String repairer;
|
||||
|
||||
@ApiModelProperty(value = "发送到下一个阶段")
|
||||
private String sentToNextPhase;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,11 +75,22 @@ public class RepairTaskDetails extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "维修合格数量")
|
||||
private int repairedNum;
|
||||
|
||||
/**
|
||||
* 本次维修合格数量
|
||||
*/
|
||||
@ApiModelProperty(value = "本次维修合格数量")
|
||||
private int thisRepairedNum;
|
||||
/**
|
||||
* 维修报废数量
|
||||
*/
|
||||
@ApiModelProperty(value = "维修报废数量")
|
||||
private int scrapNum;
|
||||
/**
|
||||
* 本次维修报废数量
|
||||
*/
|
||||
@ApiModelProperty(value = "本次维修报废数量")
|
||||
private int thisScrapNum;
|
||||
/**
|
||||
* 待修状态
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -11,6 +13,23 @@ public class RepairInputDetailsVo {
|
|||
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "物资ID")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Long typeId;
|
||||
|
||||
/** 设备类型*/
|
||||
@Excel(name = "工机具类型")
|
||||
private String typeName2;
|
||||
|
||||
/** 规格型号*/
|
||||
@Excel(name = "规格型号")
|
||||
private String typeName;
|
||||
|
||||
/** 维修单号*/
|
||||
private String repairCode;
|
||||
|
||||
|
|
@ -38,4 +57,31 @@ public class RepairInputDetailsVo {
|
|||
/** 设备类型*/
|
||||
private String deviceTypeId;
|
||||
|
||||
/** 管理方式(0编号 1计数)*/
|
||||
private String manageType;
|
||||
|
||||
/** 数量*/
|
||||
@Excel(name = "数量")
|
||||
private Integer repairNum;
|
||||
|
||||
/** 编号*/
|
||||
@Excel(name = "编号")
|
||||
private String maCode;
|
||||
|
||||
/** 提交入库人员*/
|
||||
@Excel(name = "提交入库人员")
|
||||
private String updateBy;
|
||||
|
||||
/** 提交入库时间*/
|
||||
@Excel(name = "提交入库时间")
|
||||
private String updateTime;
|
||||
|
||||
/** 不通过原因*/
|
||||
@Excel(name = "不通过原因")
|
||||
private String remark;
|
||||
|
||||
/** 状态*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ public interface RepairApplyDetailsMapper {
|
|||
*/
|
||||
public int updateRepairApplyDetails(RepairApplyDetails repairApplyDetails);
|
||||
|
||||
public int updateRepairApplyDetailsAfterReject(@Param("rejectRepairedNum") Long rejectRepairedNum, @Param("rejectScrapNum") Long rejectScrapNum, @Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据任务Id获取维修详细
|
||||
* @param taskId 任务信息ID
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public interface RepairMapper {
|
|||
|
||||
int updateRepairNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") int repairNum, @Param("thisScrapNum") int thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.bonus.material.repair.domain.*;
|
|||
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
|
||||
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
|
||||
import com.bonus.material.repair.domain.vo.ScrapAudit;
|
||||
import com.bonus.material.repair.mapper.RepairApplyDetailsMapper;
|
||||
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
||||
import com.bonus.material.repair.mapper.RepairInputDetailsMapper;
|
||||
import com.bonus.material.repair.service.IRepairAuditDetailsService;
|
||||
|
|
@ -23,6 +24,7 @@ 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.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -56,6 +58,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
@Resource
|
||||
private ScrapApplyDetailsMapper scrapApplyDetailsMapper;
|
||||
|
||||
@Resource
|
||||
private RepairApplyDetailsMapper repairApplyDetailsMapper;
|
||||
|
||||
@Resource
|
||||
private RepairInputDetailsMapper repairInputDetailsMapper;
|
||||
|
||||
|
|
@ -468,15 +473,27 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
if (CollectionUtils.isEmpty(repairAuditDetailsByQuery)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String status = repairAuditDetails.get(0).getStatus(); // 1通过 2驳回
|
||||
if ("1".equals(status)) {
|
||||
repairInputDetailsMapper.deleteRepairInputDetailsByTaskId(repairAuditDetails.get(0).getTaskId());
|
||||
batchInsertRepairInputDetails(repairAuditDetailsByQuery, repairAuditDetails.get(0).getStatus());
|
||||
batchInsertRepairInputDetails(repairAuditDetailsByQuery, status);
|
||||
} else if ("2".equals(status)) {
|
||||
for (RepairAuditDetails auditDetails : repairAuditDetails) {
|
||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
|
||||
ObjectUtils.defaultIfNull(auditDetails.getRepairedNum(),0).longValue(),
|
||||
ObjectUtils.defaultIfNull(auditDetails.getScrapNum(),0).longValue(), auditDetails.getRepairId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()));
|
||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(status));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
|
|
@ -498,15 +515,30 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
if (ids.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
//repairInputDetailsMapper.deleteRepairInputDetailsByIds((Long[]) ids.toArray());
|
||||
batchInsertRepairInputDetails(repairAuditDetails, repairAuditDetails.get(0).getStatus());
|
||||
String status = repairAuditDetails.get(0).getStatus(); // 1通过 2驳回
|
||||
if ("1".equals(status)) {
|
||||
batchInsertRepairInputDetails(repairAuditDetails, status);
|
||||
} else if ("2".equals(status)) {
|
||||
for (RepairAuditDetails auditDetails : repairAuditDetails) {
|
||||
repairApplyDetailsMapper.updateRepairApplyDetailsAfterReject(
|
||||
ObjectUtils.defaultIfNull(auditDetails.getRepairedNum(),0).longValue(),
|
||||
ObjectUtils.defaultIfNull(auditDetails.getScrapNum(),0).longValue(), auditDetails.getRepairId());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
|
||||
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, status);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// Integer a = null;
|
||||
// Long b = ObjectUtils.defaultIfNull(a, 0).longValue();
|
||||
// System.out.println(b);
|
||||
// }
|
||||
|
||||
private void batchInsertRepairInputDetails(List<RepairAuditDetails> repairAuditDetailsByQuery, String status) {
|
||||
List<RepairInputDetails> inputList = new ArrayList<>();
|
||||
for (RepairAuditDetails details : repairAuditDetailsByQuery) {
|
||||
|
|
|
|||
|
|
@ -596,21 +596,14 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
|
||||
private void SplitRepairDetailsToMultiple(RepairDeviceVO bean, int innerRepairNum, int outerRepairNum, int scrapNum, LoginUser loginUser) {
|
||||
if (bean.getRepairNum() < innerRepairNum + outerRepairNum + scrapNum) {
|
||||
throw new ServiceException("本次维修提交总数过大");
|
||||
}
|
||||
if ((bean.getRepairNum() - innerRepairNum - outerRepairNum - scrapNum) == 0) { //本次修完了
|
||||
repairMapper.updateRepairedNum(bean.getId(), innerRepairNum + outerRepairNum, loginUser.getUserid(), loginUser.getUserid());
|
||||
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||
} else {
|
||||
RepairApplyDetails newDetail = new RepairApplyDetails();
|
||||
BeanUtils.copyProperties(bean, newDetail);
|
||||
newDetail.setRepairNum((long) (innerRepairNum + outerRepairNum + scrapNum));
|
||||
newDetail.setRepairedNum((long) innerRepairNum + outerRepairNum);
|
||||
newDetail.setScrapNum((long) scrapNum);
|
||||
newDetail.setCreateBy(SecurityUtils.getUsername());
|
||||
newDetail.setCreateTime(DateUtils.getNowDate());
|
||||
newDetail.setRepairer(SecurityUtils.getUsername());
|
||||
newDetail.setStatus("1");
|
||||
repairApplyDetailsMapper.insertRepairApplyDetails(newDetail);
|
||||
repairMapper.updateRepairNum(bean.getId(), bean.getRepairNum() - innerRepairNum - outerRepairNum - scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
||||
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum + outerRepairNum, scrapNum, loginUser.getUserid(), loginUser.getUserid());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -806,7 +799,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
// 查询维修任务的详情表
|
||||
Long oldWxTaskId = task.getTaskId();
|
||||
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId);
|
||||
if (!CollectionUtils.isEmpty(detailsList)) {
|
||||
int thisRepairedNum = detailsList.stream().mapToInt(RepairTaskDetails::getThisRepairedNum).sum();
|
||||
int thisScrapNum = detailsList.stream().mapToInt(RepairTaskDetails::getThisScrapNum).sum();
|
||||
if (!CollectionUtils.isEmpty(detailsList) && (thisRepairedNum + thisScrapNum) > 0) {
|
||||
task.setCreateBy(loginUser.getUserid());
|
||||
Long agreementId = repairMapper.getAgreementId(task);
|
||||
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
||||
|
|
@ -817,14 +812,21 @@ public class RepairServiceImpl implements RepairService {
|
|||
// 新增协议任务表tm_task_agreement--关联修饰任务与协议
|
||||
task.setAgreementId(agreementId);
|
||||
repairMapper.createAgreementTask(task);
|
||||
|
||||
// 新增审计记录
|
||||
for (RepairTaskDetails details : detailsList) {
|
||||
RepairApplyDetails repairApplyDetails = new RepairApplyDetails();
|
||||
repairApplyDetails.setId(details.getId());
|
||||
repairApplyDetails.setSentToNextPhase("1");
|
||||
repairApplyDetails.setRepairedNum((long) (details.getRepairedNum() + details.getThisRepairedNum()));
|
||||
repairApplyDetails.setThisRepairedNum(0);
|
||||
repairApplyDetails.setScrapNum((long) (details.getScrapNum() + details.getThisScrapNum()));
|
||||
repairApplyDetails.setThisScrapNum(0);
|
||||
repairApplyDetailsMapper.updateRepairApplyDetails(repairApplyDetails);
|
||||
details.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||
details.setTaskId(task.getTaskId());
|
||||
details.setRepairNum(details.getThisRepairedNum() + details.getThisScrapNum());
|
||||
details.setRepairedNum(details.getThisRepairedNum());
|
||||
details.setScrapNum(details.getThisScrapNum());
|
||||
repairMapper.addAuditDetails(details);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,23 +103,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="backId != null">back_id = #{backId},</if>
|
||||
<if test="repairer != null">repairer = #{repairer},</if>
|
||||
<if test="sentToNextPhase != null">sent_to_next_phase = #{sentToNextPhase},</if>
|
||||
<if test="thisRepairedNum != null">this_repaired_num = #{thisRepairedNum},</if>
|
||||
<if test="thisScrapNum != null">this_scrap_num = #{thisScrapNum},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateRepairApplyDetailsAfterReject">
|
||||
update repair_apply_details
|
||||
set repaired_num = repaired_num - #{rejectRepairedNum},
|
||||
scrap_num = scrap_num - #{rejectScrapNum},
|
||||
update_time = NOW()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getRepairDetailsWhichNotSent" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||
select rad.id,
|
||||
rad.ma_id as maId,
|
||||
rad.type_id as typeId,
|
||||
rad.repair_num as repairNum,
|
||||
rad.repaired_num as repairedNum,
|
||||
rad.this_repaired_num as thisRepairedNum,
|
||||
rad.scrap_num as scrapNum,
|
||||
rad.this_scrap_num as thisScrapNum,
|
||||
rad.company_id as companyId,
|
||||
tt.task_id as taskId,
|
||||
tt.code as taskCode
|
||||
from repair_apply_details rad
|
||||
left join tm_task tt on rad.task_id = tt.task_id
|
||||
where rad.task_id = #{taskId} and rad.status = '1' and rad.sent_to_next_phase = '0'
|
||||
where rad.task_id = #{taskId} and rad.status = '0'
|
||||
</select>
|
||||
|
||||
<delete id="deleteRepairApplyDetailsById" parameterType="Long">
|
||||
|
|
|
|||
|
|
@ -49,6 +49,14 @@
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateThisRepairedAndScrapNum">
|
||||
update repair_apply_details
|
||||
set this_repaired_num = this_repaired_num + #{thisRepairedNum},
|
||||
this_scrap_num = this_scrap_num + #{thisScrapNum},
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateRepairedNumAndStatus">
|
||||
update repair_apply_details
|
||||
set repaired_num = #{repairNum},
|
||||
|
|
@ -284,8 +292,8 @@
|
|||
mt.manage_type as manageType,
|
||||
mm.ma_code as code,
|
||||
rad.repair_num as repairNum,
|
||||
rad.repaired_num as repairedNum,
|
||||
rad.scrap_num as scrapNum,
|
||||
rad.repaired_num + rad.this_repaired_num as repairedNum,
|
||||
rad.scrap_num + rad.this_scrap_num as scrapNum,
|
||||
rad.status as status,
|
||||
su.nick_name as repairer,
|
||||
rad.update_time as updateTime,
|
||||
|
|
|
|||
Loading…
Reference in New Issue