Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
50057eb2d3
|
|
@ -72,5 +72,7 @@ public class RepairApplyDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "维修人")
|
@ApiModelProperty(value = "维修人")
|
||||||
private String repairer;
|
private String repairer;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送到下一个阶段")
|
||||||
|
private String sentToNextPhase;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,9 @@ public class RepairTaskDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "关键字")
|
@ApiModelProperty(value = "关键字")
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修任务编码")
|
||||||
|
private String taskCode;
|
||||||
|
|
||||||
public RepairTaskDetails(Long taskId) {
|
public RepairTaskDetails(Long taskId) {
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.repair.domain.vo;
|
package com.bonus.material.repair.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import com.bonus.material.basic.domain.BmFileInfo;
|
import com.bonus.material.basic.domain.BmFileInfo;
|
||||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
@ -49,6 +50,10 @@ public class RepairDeviceVO {
|
||||||
@ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/** 退料ID */
|
||||||
|
@ApiModelProperty(value = "退料ID")
|
||||||
|
private Long backId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "维修配件信息")
|
@ApiModelProperty(value = "维修配件信息")
|
||||||
private String partInfo;
|
private String partInfo;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.material.repair.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.material.repair.domain.RepairApplyDetails;
|
import com.bonus.material.repair.domain.RepairApplyDetails;
|
||||||
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修详细Mapper接口
|
* 维修详细Mapper接口
|
||||||
|
|
@ -42,6 +44,12 @@ public interface RepairApplyDetailsMapper {
|
||||||
*/
|
*/
|
||||||
public int updateRepairApplyDetails(RepairApplyDetails repairApplyDetails);
|
public int updateRepairApplyDetails(RepairApplyDetails repairApplyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务Id获取维修详细
|
||||||
|
* @param taskId 任务信息ID
|
||||||
|
*/
|
||||||
|
List<RepairTaskDetails> getRepairDetailsWhichNotSent(@Param("taskId") Long taskId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除维修详细
|
* 删除维修详细
|
||||||
*
|
*
|
||||||
|
|
@ -50,6 +58,8 @@ public interface RepairApplyDetailsMapper {
|
||||||
*/
|
*/
|
||||||
public int deleteRepairApplyDetailsById(Long id);
|
public int deleteRepairApplyDetailsById(Long id);
|
||||||
|
|
||||||
|
public int deleteRepairApplyDetailsByTaskIdAndStatus(@Param("taskId") Long taskId, @Param("status") String status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除维修详细
|
* 批量删除维修详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ public interface RepairAuditDetailsMapper {
|
||||||
|
|
||||||
int deleteRepairAuditDetailsByTaskId(Long taskId);
|
int deleteRepairAuditDetailsByTaskId(Long taskId);
|
||||||
|
|
||||||
|
int deleteRepairAuditDetailsByRepairId(@Param("repairId") Long repairId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除修试审核详细
|
* 批量删除修试审核详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
int updateRepairNum(@Param("id") Long id, @Param("repairNum") int repairNum, @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);
|
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,6 +106,8 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus);
|
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus);
|
||||||
|
|
||||||
|
int updateSingleTaskStatus(@Param("task") RepairTask task, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增任务
|
* 新增任务
|
||||||
* @param task 任务信息
|
* @param task 任务信息
|
||||||
|
|
@ -128,12 +132,6 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int getUnFinish(RepairTask task);
|
int getUnFinish(RepairTask task);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据任务Id获取维修详细
|
|
||||||
* @param task 任务信息
|
|
||||||
*/
|
|
||||||
List<RepairTaskDetails> getDetailsListByTaskId(RepairTask task);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增修饰审核审核数据
|
* 新增修饰审核审核数据
|
||||||
* @param details 数据详情
|
* @param details 数据详情
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.bonus.common.biz.enums.RepairTaskStatusEnum;
|
||||||
import com.bonus.common.biz.enums.RepairTypeEnum;
|
import com.bonus.common.biz.enums.RepairTypeEnum;
|
||||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.material.basic.domain.BmFileInfo;
|
import com.bonus.material.basic.domain.BmFileInfo;
|
||||||
|
|
@ -15,18 +16,20 @@ import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||||
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
||||||
import com.bonus.material.repair.domain.vo.RepairTicketVo;
|
import com.bonus.material.repair.domain.vo.RepairTicketVo;
|
||||||
|
import com.bonus.material.repair.mapper.RepairApplyDetailsMapper;
|
||||||
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
||||||
import com.bonus.material.repair.mapper.RepairMapper;
|
import com.bonus.material.repair.mapper.RepairMapper;
|
||||||
import com.bonus.material.repair.service.RepairService;
|
import com.bonus.material.repair.service.RepairService;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.bonus.system.api.model.LoginUser;
|
import com.bonus.system.api.model.LoginUser;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
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 org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -52,6 +55,9 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Resource
|
@Resource
|
||||||
private RepairAuditDetailsMapper repairAuditDetailsMapper;
|
private RepairAuditDetailsMapper repairAuditDetailsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RepairApplyDetailsMapper repairApplyDetailsMapper;
|
||||||
|
|
||||||
// 1:内部维修 2:外部返厂维修 3:报废
|
// 1:内部维修 2:外部返厂维修 3:报废
|
||||||
private final int INNER_REPAIR = 1; // 需要严格匹配枚举值 RepairTypeEnum.INNER_REPAIR.getTypeId();
|
private final int INNER_REPAIR = 1; // 需要严格匹配枚举值 RepairTypeEnum.INNER_REPAIR.getTypeId();
|
||||||
private final int RETURN_FACTORY = 2; // 需要严格匹配枚举值 RepairTypeEnum.RETURN_FACTORY.getTypeId();
|
private final int RETURN_FACTORY = 2; // 需要严格匹配枚举值 RepairTypeEnum.RETURN_FACTORY.getTypeId();
|
||||||
|
|
@ -74,16 +80,19 @@ public class RepairServiceImpl implements RepairService {
|
||||||
Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
|
Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
|
||||||
for (Long key : map.keySet()) {
|
for (Long key : map.keySet()) {
|
||||||
List<RepairDeviceVO> tempList = map.get(key);
|
List<RepairDeviceVO> tempList = map.get(key);
|
||||||
|
List<RepairDeviceVO> toRepairList = tempList.stream().filter(o -> !"1".equals(o.getStatus())).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(tempList)) {
|
if (CollectionUtil.isNotEmpty(tempList)) {
|
||||||
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
|
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
|
||||||
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
|
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
|
||||||
int repairNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairNum).sum();
|
int repairNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairNum).sum();
|
||||||
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
|
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
|
||||||
|
int scrapNumSum = tempList.stream().mapToInt(RepairDeviceVO::getScrapNum).sum();
|
||||||
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
vo.setRepairDeviceList(tempList);
|
vo.setRepairDeviceList(toRepairList);
|
||||||
vo.setIds(ids);
|
vo.setIds(ids);
|
||||||
vo.setTypeRepairNum(repairNumSum);
|
vo.setTypeRepairNum(repairNumSum);
|
||||||
vo.setTypeRepairedNum(repairedNumSum);
|
vo.setTypeRepairedNum(repairedNumSum);
|
||||||
|
vo.setTypeScrapNum(scrapNumSum);
|
||||||
//vo.setTypeCost(typeCostSum);
|
//vo.setTypeCost(typeCostSum);
|
||||||
vo.setTaskId(tempList.get(0).getTaskId());
|
vo.setTaskId(tempList.get(0).getTaskId());
|
||||||
vo.setCode(tempList.get(0).getCode());
|
vo.setCode(tempList.get(0).getCode());
|
||||||
|
|
@ -452,6 +461,10 @@ public class RepairServiceImpl implements RepairService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int innerRepairNum = 0;
|
||||||
|
int outerRepairNum = 0;
|
||||||
|
int scrapNum = 0;
|
||||||
|
|
||||||
// 处理配件--数量管理--内部维修
|
// 处理配件--数量管理--内部维修
|
||||||
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
|
||||||
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
// 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量
|
||||||
|
|
@ -463,17 +476,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
partList = bean.getNumberInRepairPartList();
|
partList = bean.getNumberInRepairPartList();
|
||||||
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) {
|
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) {
|
||||||
// ---------------校验维修数量-----------------
|
// 分拆维修单, 准备数据
|
||||||
// 统计已维修数量 + 本次维修数量
|
innerRepairNum = bean.getNumberInRepairPartList().get(0).getRepairNum();
|
||||||
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberInRepairPartList().get(0).getRepairNum();
|
|
||||||
// 统计报废数量 + 维修合计数量
|
|
||||||
int num = repairNum + details.getScrapNum();
|
|
||||||
if (num > details.getRepairNum()) {
|
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
|
||||||
}
|
|
||||||
// ---------------校验维修数量-----------------
|
|
||||||
// 更新维修数量、并修改维修人员
|
|
||||||
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
|
|
||||||
// 处理配件集合数据
|
// 处理配件集合数据
|
||||||
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
|
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
|
||||||
}
|
}
|
||||||
|
|
@ -496,16 +500,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
// 判断外部维修配件数量是否为空
|
// 判断外部维修配件数量是否为空
|
||||||
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) {
|
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) {
|
||||||
|
// 分拆维修单, 准备数据
|
||||||
// 统计已维修数量 + 本次维修数量
|
outerRepairNum = partList.get(0).getRepairNum();
|
||||||
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + partList.get(0).getRepairNum();
|
|
||||||
// 统计报废数量 + 维修合计数量
|
|
||||||
if ((repairNum + OptionalInt.of(details.getScrapNum()).orElse(0)) > details.getRepairNum()) {
|
|
||||||
throw new ServiceException("维修数量大于维修总量");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新维修数量、维修人员不变
|
|
||||||
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
|
||||||
|
|
||||||
if (partList.get(0).getSupplierId() == null) {
|
if (partList.get(0).getSupplierId() == null) {
|
||||||
throw new ServiceException("请选择返厂厂家");
|
throw new ServiceException("请选择返厂厂家");
|
||||||
|
|
@ -543,19 +539,10 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (Objects.isNull(details)) {
|
if (Objects.isNull(details)) {
|
||||||
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
throw new ServiceException("此维修记录不存在,请检查后提交!");
|
||||||
}
|
}
|
||||||
// -------------校验维修数量开始----------------
|
|
||||||
// 统计历史已报废数量 + 本次报废数量 = 报废总数
|
|
||||||
int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getScrapNum();
|
|
||||||
// 统计 报废总数 + 历史已维修数量,
|
|
||||||
int num = scrapNum + details.getRepairedNum();
|
|
||||||
// 不能大与总的待维修数量
|
|
||||||
if (num > details.getRepairNum()) {
|
|
||||||
throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum());
|
|
||||||
}
|
|
||||||
// -------------校验维修数量结束----------------
|
|
||||||
|
|
||||||
// 更新报废数量
|
// 分拆维修单, 准备数据
|
||||||
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
scrapNum = bean.getNumberScrapRepairPartList().get(0).getScrapNum();
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) {
|
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) {
|
||||||
for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) {
|
for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) {
|
||||||
|
|
@ -595,6 +582,11 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 拆分维修单
|
||||||
|
SplitRepairDetailsToMultiple(bean, innerRepairNum, outerRepairNum, scrapNum, loginUser);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("请选择正确的维修类型");
|
throw new ServiceException("请选择正确的维修类型");
|
||||||
}
|
}
|
||||||
|
|
@ -603,6 +595,26 @@ public class RepairServiceImpl implements RepairService {
|
||||||
return AjaxResult.success("维修完成");
|
return AjaxResult.success("维修完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SplitRepairDetailsToMultiple(RepairDeviceVO bean, int innerRepairNum, int outerRepairNum, int scrapNum, LoginUser loginUser) {
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配件列表价格合计
|
* 配件列表价格合计
|
||||||
* @param partList 配件列表
|
* @param partList 配件列表
|
||||||
|
|
@ -611,7 +623,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
*/
|
*/
|
||||||
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
|
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (partDetails.getPartPrice() != null) {
|
if (partDetails.getPartPrice() != null && partDetails.getPartNum() != null) {
|
||||||
BigDecimal partPrice = partDetails.getPartPrice();
|
BigDecimal partPrice = partDetails.getPartPrice();
|
||||||
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
||||||
sfCosts = sfCosts.add(partPrice.multiply(partNumber));
|
sfCosts = sfCosts.add(partPrice.multiply(partNumber));
|
||||||
|
|
@ -784,36 +796,38 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
// 1.查询选择任务是否还有未完成维修的数据
|
// 1.查询选择任务是否还有未完成维修的数据
|
||||||
for (RepairTask task : taskList) {
|
for (RepairTask task : taskList) {
|
||||||
if (repairMapper.getUnFinish(task) > 0) {
|
if (repairMapper.getUnFinish(task) == 0) {
|
||||||
return AjaxResult.error("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
|
repairMapper.updateSingleTaskStatus(task, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.更新tm_task任务状态
|
|
||||||
repairMapper.updateTaskStatus(taskList, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus());
|
|
||||||
|
|
||||||
// 3.业务逻辑处理
|
// 3.业务逻辑处理
|
||||||
for (RepairTask task : taskList) {
|
for (RepairTask task : taskList) {
|
||||||
task.setCreateBy(loginUser.getUserid());
|
|
||||||
// 查询任务的协议id
|
|
||||||
Long agreementId = repairMapper.getAgreementId(task);
|
|
||||||
// 查询维修任务的详情表
|
// 查询维修任务的详情表
|
||||||
List<RepairTaskDetails> detailsList = repairMapper.getDetailsListByTaskId(task);
|
Long oldWxTaskId = task.getTaskId();
|
||||||
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId);
|
||||||
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
if (!CollectionUtils.isEmpty(detailsList)) {
|
||||||
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
|
task.setCreateBy(loginUser.getUserid());
|
||||||
repairMapper.addTask(task);
|
Long agreementId = repairMapper.getAgreementId(task);
|
||||||
|
// 新增tm_task表数据、修饰审核任务、状态是待审核
|
||||||
// 循环插入【修饰审核明细表】
|
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT.getTaskTypeId());
|
||||||
repairAuditDetailsMapper.deleteRepairAuditDetailsByTaskId(task.getTaskId());
|
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
|
||||||
for (RepairTaskDetails details : detailsList) {
|
task.setRepairCode(detailsList.get(0).getTaskCode());
|
||||||
details.setCreateBy(String.valueOf(loginUser.getUserid()));
|
repairMapper.addTask(task); // 注意:此处将会生成新的 taskId (审核入库用的)
|
||||||
details.setTaskId(task.getTaskId());
|
// 新增协议任务表tm_task_agreement--关联修饰任务与协议
|
||||||
repairMapper.addAuditDetails(details);
|
task.setAgreementId(agreementId);
|
||||||
|
repairMapper.createAgreementTask(task);
|
||||||
|
// 新增审计记录
|
||||||
|
for (RepairTaskDetails details : detailsList) {
|
||||||
|
RepairApplyDetails repairApplyDetails = new RepairApplyDetails();
|
||||||
|
repairApplyDetails.setId(details.getId());
|
||||||
|
repairApplyDetails.setSentToNextPhase("1");
|
||||||
|
repairApplyDetailsMapper.updateRepairApplyDetails(repairApplyDetails);
|
||||||
|
details.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
details.setTaskId(task.getTaskId());
|
||||||
|
repairMapper.addAuditDetails(details);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 新增协议任务表--关联修饰任务与协议
|
|
||||||
task.setAgreementId(agreementId);
|
|
||||||
repairMapper.createAgreementTask(task);
|
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,14 +103,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="companyId != null">company_id = #{companyId},</if>
|
<if test="companyId != null">company_id = #{companyId},</if>
|
||||||
<if test="backId != null">back_id = #{backId},</if>
|
<if test="backId != null">back_id = #{backId},</if>
|
||||||
<if test="repairer != null">repairer = #{repairer},</if>
|
<if test="repairer != null">repairer = #{repairer},</if>
|
||||||
|
<if test="sentToNextPhase != null">sent_to_next_phase = #{sentToNextPhase},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</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.scrap_num as scrapNum,
|
||||||
|
rad.company_id as companyId,
|
||||||
|
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'
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteRepairApplyDetailsById" parameterType="Long">
|
<delete id="deleteRepairApplyDetailsById" parameterType="Long">
|
||||||
delete from repair_apply_details where id = #{id}
|
delete from repair_apply_details where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteRepairApplyDetailsByTaskIdAndStatus">
|
||||||
|
delete from repair_apply_details where task_id = #{taskId} and status = #{status}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteRepairApplyDetailsByIds" parameterType="String">
|
<delete id="deleteRepairApplyDetailsByIds" parameterType="String">
|
||||||
delete from repair_apply_details where id in
|
delete from repair_apply_details where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from repair_audit_details where task_id = #{taskId}
|
delete from repair_audit_details where task_id = #{taskId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteRepairAuditDetailsByRepairId" parameterType="Long">
|
||||||
|
delete from repair_audit_details where repair_id = #{repairId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteRepairAuditDetailsByIds" parameterType="String">
|
<delete id="deleteRepairAuditDetailsByIds" parameterType="String">
|
||||||
delete from repair_audit_details where id in
|
delete from repair_audit_details where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,13 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRepairNum">
|
||||||
|
update repair_apply_details
|
||||||
|
set repair_num = #{repairNum},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateRepairedNumAndStatus">
|
<update id="updateRepairedNumAndStatus">
|
||||||
update repair_apply_details
|
update repair_apply_details
|
||||||
set repaired_num = #{repairNum},
|
set repaired_num = #{repairNum},
|
||||||
|
|
@ -101,14 +108,22 @@
|
||||||
<update id="updateTaskStatus">
|
<update id="updateTaskStatus">
|
||||||
update tm_task
|
update tm_task
|
||||||
set task_status = #{taskStatus},
|
set task_status = #{taskStatus},
|
||||||
update_by = #{userId},
|
update_by = #{userId},
|
||||||
update_time = now()
|
update_time = now()
|
||||||
where task_id in
|
where task_id in
|
||||||
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||||
#{task.taskId}
|
#{task.taskId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateSingleTaskStatus">
|
||||||
|
update tm_task
|
||||||
|
set task_status = #{taskStatus},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where task_id = #{task.taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="getRepairTaskInfoByTaskId" resultType="com.bonus.material.repair.domain.RepairTask">
|
<select id="getRepairTaskInfoByTaskId" resultType="com.bonus.material.repair.domain.RepairTask">
|
||||||
SELECT
|
SELECT
|
||||||
rd.task_id as taskId,
|
rd.task_id as taskId,
|
||||||
|
|
@ -275,6 +290,7 @@
|
||||||
su.nick_name as repairer,
|
su.nick_name as repairer,
|
||||||
rad.update_time as updateTime,
|
rad.update_time as updateTime,
|
||||||
rad.type_id as typeId,
|
rad.type_id as typeId,
|
||||||
|
rad.back_id as backId,
|
||||||
rad.create_time,
|
rad.create_time,
|
||||||
count(rc.id) AS totalCostRecords,
|
count(rc.id) AS totalCostRecords,
|
||||||
sum(rc.costs) AS totalCost
|
sum(rc.costs) AS totalCost
|
||||||
|
|
@ -383,18 +399,6 @@
|
||||||
where task_id = #{taskId} and status = '0'
|
where task_id = #{taskId} and status = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDetailsListByTaskId" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
|
||||||
select id,
|
|
||||||
ma_id as maId,
|
|
||||||
type_id as typeId,
|
|
||||||
repair_num as repairNum,
|
|
||||||
repaired_num as repairedNum,
|
|
||||||
scrap_num as scrapNum,
|
|
||||||
company_id as companyId
|
|
||||||
from repair_apply_details
|
|
||||||
where task_id = #{taskId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectPartPrice" resultType="java.math.BigDecimal">
|
<select id="selectPartPrice" resultType="java.math.BigDecimal">
|
||||||
select ifnull(buy_price,0) from ma_part_type where pa_id = #{partId}
|
select ifnull(buy_price,0) from ma_part_type where pa_id = #{partId}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue