Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
842c064c41
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.bonus.common.biz.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : xsheng
|
||||||
|
* @time : 2024-11-23 12:50
|
||||||
|
* @Description: 维修类型
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum RepairTypeEnum {
|
||||||
|
PASS(0, "合格"),
|
||||||
|
INNER_REPAIR(1, "内部维修"),
|
||||||
|
RETURN_FACTORY(2, "返厂维修"),
|
||||||
|
TO_SCRAP(3, "待报废");
|
||||||
|
|
||||||
|
private final Integer typeId;
|
||||||
|
private final String typeName;
|
||||||
|
|
||||||
|
RepairTypeEnum(Integer typeId, String typeName) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
import com.bonus.material.repair.domain.RepairTask;
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
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.service.RepairService;
|
import com.bonus.material.repair.service.RepairService;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
|
@ -73,14 +73,14 @@ public class RepairController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取维修任务物资设备列表--不分页
|
* 获取维修任务物资设备列表--不分页
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取维修物资设备列表---分页")
|
// @ApiOperation(value = "获取维修物资设备列表---分页")
|
||||||
@GetMapping("/getRepairMaTypeList")
|
// @GetMapping("/getRepairMaTypeList")
|
||||||
// @RequiresPermissions("repair:manage:preview")
|
//// @RequiresPermissions("repair:manage:preview")
|
||||||
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
// public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
startPage();
|
// startPage();
|
||||||
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
// List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
||||||
return getDataTable(list);
|
// return getDataTable(list);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取维修任务机具列表--Ⅱ级页面详情列表
|
* 获取维修任务机具列表--Ⅱ级页面详情列表
|
||||||
|
|
@ -88,7 +88,7 @@ public class RepairController extends BaseController {
|
||||||
@ApiOperation(value = "获取维修物资设备列表---不分页")
|
@ApiOperation(value = "获取维修物资设备列表---不分页")
|
||||||
@GetMapping("/getAppRepairMaTypeList")
|
@GetMapping("/getAppRepairMaTypeList")
|
||||||
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
List<RepairDeviceSummaryVo> list = service.getRepairDeviceSummary(bean);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,9 +96,9 @@ public class RepairController extends BaseController {
|
||||||
* 查询维修单
|
* 查询维修单
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取维修单详情")
|
@ApiOperation(value = "获取维修单详情")
|
||||||
@GetMapping("/getRepairTicketInfo")
|
@GetMapping("/getRepairDocumentInfo")
|
||||||
public AjaxResult getRepairTicketInfo(@NotBlank(message = "TaskId参数不能为空") String taskId) {
|
public AjaxResult getRepairDocumentInfo(@NotBlank(message = "TaskId参数不能为空") String taskId) {
|
||||||
return service.getRepairTicketInfo(taskId);
|
return service.getRepairDocumentInfo(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.bonus.material.repair.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.BaseVO;
|
||||||
|
import com.bonus.material.basic.domain.BmFileInfo;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Data
|
||||||
|
public class RepairDeviceSummaryVo extends BaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Long[] ids;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务ID")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型id")
|
||||||
|
private Long typeNameId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号id")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "管理模式")
|
||||||
|
private Integer manageType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备表主键id")
|
||||||
|
private Long[] maIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修人员")
|
||||||
|
private String[] repairers;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修总量")
|
||||||
|
private int typeRepairNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "已修数量")
|
||||||
|
private int typeRepairedNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修报废数量")
|
||||||
|
private int typeScrapNum;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "维修费用记录条数")
|
||||||
|
// private Integer typeCostRecords;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修费用合计")
|
||||||
|
private BigDecimal typeCost;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内层物资类型集合")
|
||||||
|
private List<RepairDeviceVO> repairDeviceList = new ArrayList<>();
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "报废附件")
|
||||||
|
private List<BmFileInfo> fileList;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.bonus.material.repair.domain.vo;
|
package com.bonus.material.repair.domain.vo;
|
||||||
|
|
||||||
import com.bonus.material.repair.domain.RepairPart;
|
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;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -40,6 +40,12 @@ public class RepairDeviceVO {
|
||||||
@ApiModelProperty(value = "设备编码")
|
@ApiModelProperty(value = "设备编码")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "管理模式")
|
||||||
|
private Integer manageType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
@ -52,9 +58,6 @@ public class RepairDeviceVO {
|
||||||
@ApiModelProperty(value = "维修人员")
|
@ApiModelProperty(value = "维修人员")
|
||||||
private String repairer;
|
private String repairer;
|
||||||
|
|
||||||
@ApiModelProperty(value = "管理模式")
|
|
||||||
private Integer manageType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "附件")
|
@ApiModelProperty(value = "附件")
|
||||||
private String fileUrl;
|
private String fileUrl;
|
||||||
|
|
||||||
|
|
@ -67,6 +70,12 @@ public class RepairDeviceVO {
|
||||||
@ApiModelProperty(value = "维修报废数量")
|
@ApiModelProperty(value = "维修报废数量")
|
||||||
private int scrapNum;
|
private int scrapNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修费用记录条数")
|
||||||
|
private Integer totalCostRecords;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修费用小计计")
|
||||||
|
private BigDecimal totalCost;
|
||||||
|
|
||||||
@ApiModelProperty(value = "编码--内部维修配件集合")
|
@ApiModelProperty(value = "编码--内部维修配件集合")
|
||||||
private List<RepairPartDetails> codeInRepairPartList;
|
private List<RepairPartDetails> codeInRepairPartList;
|
||||||
|
|
||||||
|
|
@ -85,6 +94,9 @@ public class RepairDeviceVO {
|
||||||
@ApiModelProperty(value = "数量--报废维修配件集合")
|
@ApiModelProperty(value = "数量--报废维修配件集合")
|
||||||
private List<RepairPartDetails> numberScrapRepairPartList;
|
private List<RepairPartDetails> numberScrapRepairPartList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "报废附件")
|
||||||
|
private List<BmFileInfo> fileList;
|
||||||
|
|
||||||
// 手动覆盖 getter 方法,确保 List 始终被初始化
|
// 手动覆盖 getter 方法,确保 List 始终被初始化
|
||||||
public List<RepairPartDetails> getCodeInRepairPartList() {
|
public List<RepairPartDetails> getCodeInRepairPartList() {
|
||||||
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
|
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,15 @@ public class RepairTicketVo {
|
||||||
private RepairTask repairTaskInfo;
|
private RepairTask repairTaskInfo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "维修物资列表")
|
@ApiModelProperty(value = "维修物资列表")
|
||||||
private List<RepairDeviceListVo> repairDeviceArray;
|
private List<RepairDeviceSummaryVo> repairDeviceSummaryList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "维修内容集合")
|
@ApiModelProperty(value = "维修内容集合")
|
||||||
private List<RepairPart> repairPartArray;
|
private List<RepairPart> repairPartArray;
|
||||||
|
|
||||||
// 覆盖默认get方法,防止空指针异常
|
// 覆盖默认get方法,防止空指针异常
|
||||||
public List<RepairDeviceListVo> getRepairDeviceList() {
|
public List<RepairDeviceSummaryVo> getRepairDeviceSummaryList() {
|
||||||
if (this.repairDeviceArray == null) {return new ArrayList<>();}
|
if (this.repairDeviceSummaryList == null) {return new ArrayList<>();}
|
||||||
return this.repairDeviceArray;
|
return this.repairDeviceSummaryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
import com.bonus.material.repair.domain.RepairTask;
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||||
|
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -30,11 +31,13 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
RepairTask getRepairTaskInfoByTaskId(Long taskId);
|
RepairTask getRepairTaskInfoByTaskId(Long taskId);
|
||||||
|
|
||||||
|
List<RepairDeviceVO> getRepairDeviceList(RepairTaskDetails bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取维修详细列表
|
* 获取维修详细列表
|
||||||
* @param bean 维修任务详情--查询条件
|
* @param bean 维修任务详情--查询条件
|
||||||
*/
|
*/
|
||||||
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
|
// List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增维修记录
|
* 新增维修记录
|
||||||
|
|
@ -57,6 +60,18 @@ 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 updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改维修数量
|
||||||
|
* @param id 主键 key
|
||||||
|
* @param repairNum 维修数量
|
||||||
|
* @param userid 用户id
|
||||||
|
*/
|
||||||
|
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
|
||||||
|
|
||||||
|
int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("userId") Long userid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改报废数量
|
* 修改报废数量
|
||||||
* @param id 主键key
|
* @param id 主键key
|
||||||
|
|
@ -65,6 +80,8 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int updateScrapNum(@Param("id") Long id, @Param("scrapNum") int scrapNum, @Param("userId") Long userId);
|
int updateScrapNum(@Param("id") Long id, @Param("scrapNum") int scrapNum, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
int updateScrapNumAndStatus(@Param("id") Long id, @Param("scrapNum") int scrapNum, @Param("status") int status, @Param("userId") Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增配件维修记录
|
* 新增配件维修记录
|
||||||
* @param partDetails 配件详情
|
* @param partDetails 配件详情
|
||||||
|
|
@ -108,14 +125,6 @@ public interface RepairMapper {
|
||||||
*/
|
*/
|
||||||
int createAgreementTask(RepairTask task);
|
int createAgreementTask(RepairTask task);
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改维修数量
|
|
||||||
* @param id 主键 key
|
|
||||||
* @param repairNum 维修数量
|
|
||||||
* @param userid 用户id
|
|
||||||
*/
|
|
||||||
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询是否存在未完成维修的
|
* 查询是否存在未完成维修的
|
||||||
* @param task 任务信息
|
* @param task 任务信息
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
import com.bonus.material.repair.domain.RepairTask;
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||||
|
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.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -30,16 +29,20 @@ public interface RepairService {
|
||||||
/**
|
/**
|
||||||
* 获取维修详细列表
|
* 获取维修详细列表
|
||||||
*/
|
*/
|
||||||
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup);
|
// List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup);
|
||||||
|
|
||||||
default List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean) {
|
|
||||||
return getRepairMaTypeList(bean, true);
|
List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean);
|
||||||
}
|
|
||||||
|
|
||||||
|
// default List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
|
// return getRepairMaTypeList(bean, true);
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询维修单
|
* 查询维修单
|
||||||
*/
|
*/
|
||||||
AjaxResult getRepairTicketInfo(@NotBlank(message = "TaskId参数不能为空") String taskId);
|
AjaxResult getRepairDocumentInfo(@NotBlank(message = "TaskId参数不能为空") String taskId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交维修记录
|
* 提交维修记录
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ package com.bonus.material.repair.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||||
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
|
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
|
||||||
|
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.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -11,7 +13,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.material.basic.domain.BmFileInfo;
|
import com.bonus.material.basic.domain.BmFileInfo;
|
||||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||||
import com.bonus.material.repair.domain.*;
|
import com.bonus.material.repair.domain.*;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
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.RepairTicketVo;
|
import com.bonus.material.repair.domain.vo.RepairTicketVo;
|
||||||
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
||||||
|
|
@ -24,9 +26,7 @@ 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.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -54,10 +54,9 @@ public class RepairServiceImpl implements RepairService {
|
||||||
private RepairAuditDetailsMapper repairAuditDetailsMapper;
|
private RepairAuditDetailsMapper repairAuditDetailsMapper;
|
||||||
|
|
||||||
// 1:内部维修 2:外部返厂维修 3:报废
|
// 1:内部维修 2:外部返厂维修 3:报废
|
||||||
private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3;
|
private final int INNER_REPAIR = 1; // 需要严格匹配枚举值 RepairTypeEnum.INNER_REPAIR.getTypeId();
|
||||||
|
private final int RETURN_FACTORY = 2; // 需要严格匹配枚举值 RepairTypeEnum.RETURN_FACTORY.getTypeId();
|
||||||
// 维修管理方式--0:编码管理 1:数量管理
|
private final int TO_SCRAP = 3; // 需要严格匹配枚举值 RepairTypeEnum.TO_SCRAP.getTypeId();
|
||||||
private final int manageTypeByCode = 0, manageTypeByNumber = 1;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
||||||
|
|
@ -70,53 +69,92 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup) {
|
public List<RepairDeviceSummaryVo> getRepairDeviceSummary(RepairTaskDetails bean) {
|
||||||
if (Objects.isNull(bean)) {
|
List<RepairDeviceSummaryVo> repairDeviceSummaryVoList = new ArrayList<>();
|
||||||
return new ArrayList<>();
|
List<RepairDeviceVO> repairDeviceList = repairMapper.getRepairDeviceList(bean);
|
||||||
|
Map<Long, List<RepairDeviceVO>> map = repairDeviceList.stream().collect(Collectors.groupingBy(RepairDeviceVO::getTypeId));
|
||||||
|
for (Long key : map.keySet()) {
|
||||||
|
List<RepairDeviceVO> tempList = map.get(key);
|
||||||
|
if (CollectionUtil.isNotEmpty(tempList)) {
|
||||||
|
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
|
||||||
|
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
|
||||||
|
int repairNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairNum).sum();
|
||||||
|
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
|
||||||
|
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setRepairDeviceList(tempList);
|
||||||
|
vo.setIds(ids);
|
||||||
|
vo.setTypeRepairNum(repairNumSum);
|
||||||
|
vo.setTypeRepairedNum(repairedNumSum);
|
||||||
|
//vo.setTypeCost(typeCostSum);
|
||||||
|
vo.setTaskId(tempList.get(0).getTaskId());
|
||||||
|
vo.setCode(tempList.get(0).getCode());
|
||||||
|
vo.setTypeName(tempList.get(0).getTypeName());
|
||||||
|
vo.setTypeId(tempList.get(0).getTypeId());
|
||||||
|
vo.setType(tempList.get(0).getType());
|
||||||
|
vo.setUnitName(tempList.get(0).getUnitName());
|
||||||
|
vo.setManageType(tempList.get(0).getManageType());
|
||||||
|
repairDeviceSummaryVoList.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return repairDeviceSummaryVoList;
|
||||||
}
|
}
|
||||||
bean.setCompanyId(null);
|
|
||||||
List<RepairDeviceListVo> repairMaTypeList = repairMapper.getRepairMaTypeList(bean);
|
|
||||||
|
|
||||||
if (repairMaTypeList.isEmpty() || !isGroup) {
|
// @Override
|
||||||
return repairMaTypeList;
|
// public List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean, boolean isGroup) {
|
||||||
}
|
// if (Objects.isNull(bean)) {
|
||||||
repairMaTypeList.removeIf(Objects::isNull);
|
// return new ArrayList<>();
|
||||||
// 创建Map集合,用于快速分组,使用 ConcurrentHashMap 保证线程安全
|
// }
|
||||||
Map<Long, RepairDeviceListVo> resultMap = new ConcurrentHashMap<>();
|
// bean.setCompanyId(null);
|
||||||
|
// List<RepairDeviceListVo> repairMaTypeList = repairMapper.getRepairMaTypeList(bean);
|
||||||
// 遍历处理,把相同的父级对象,拆分到子集合中
|
//
|
||||||
repairMaTypeList.forEach(item -> {
|
// if (repairMaTypeList.isEmpty() || !isGroup) {
|
||||||
// 创建对象,并复制字段value
|
// return repairMaTypeList;
|
||||||
RepairDeviceVO repairDeviceVO = new RepairDeviceVO();
|
// }
|
||||||
try {
|
// repairMaTypeList.removeIf(Objects::isNull);
|
||||||
BeanUtil.copyProperties(item, repairDeviceVO);
|
// // 创建Map集合,用于快速分组,使用 ConcurrentHashMap 保证线程安全
|
||||||
} catch (Exception e) {
|
// Map<Long, RepairDeviceListVo> resultMap = new ConcurrentHashMap<>();
|
||||||
System.err.println("复制属性时发生错误: {}" + e.getMessage());
|
//
|
||||||
throw new RuntimeException("复制属性时发生错误", e);
|
// // 遍历处理,把相同的父级对象,拆分到子集合中
|
||||||
}
|
// repairMaTypeList.forEach(item -> {
|
||||||
if (item.getTypeNameId() == null) {
|
// // 创建对象,并复制字段value
|
||||||
System.err.println("typeNameId 为空,跳过当前项: " + item);
|
// RepairDeviceVO repairDeviceVO = new RepairDeviceVO();
|
||||||
return;
|
// try {
|
||||||
}
|
// BeanUtil.copyProperties(item, repairDeviceVO);
|
||||||
resultMap.computeIfAbsent(item.getTypeNameId(), origin -> item).getRepairDeviceList().add(repairDeviceVO);
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("复制属性时发生错误: {}" + e.getMessage());
|
||||||
resultMap.computeIfPresent(item.getTypeNameId(), (origin, novel) -> {
|
// throw new RuntimeException("复制属性时发生错误", e);
|
||||||
novel.setTotalCost(Optional.ofNullable(novel.getTotalCost()).orElse(BigDecimal.ZERO)
|
// }
|
||||||
.add(Optional.ofNullable(item.getTotalCost()).orElse(BigDecimal.ZERO))
|
// if (item.getTypeNameId() == null) {
|
||||||
);
|
// System.err.println("typeNameId 为空,跳过当前项: " + item);
|
||||||
return novel;
|
// return;
|
||||||
});
|
// }
|
||||||
});
|
// resultMap.computeIfAbsent(item.getTypeNameId(), origin -> item).getRepairDeviceList().add(repairDeviceVO);
|
||||||
|
//
|
||||||
return new ArrayList<>(resultMap.values());
|
// resultMap.computeIfPresent(item.getTypeNameId(), (origin, novel) -> {
|
||||||
}
|
// novel.setTotalCost(Optional.ofNullable(novel.getTotalCost()).orElse(BigDecimal.ZERO)
|
||||||
|
// .add(Optional.ofNullable(item.getTotalCost()).orElse(BigDecimal.ZERO))
|
||||||
|
// );
|
||||||
|
// return novel;
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// for (Long key : resultMap.keySet()) {
|
||||||
|
// RepairDeviceListVo vo = resultMap.get(key);
|
||||||
|
// if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(vo.getManageType())) {
|
||||||
|
// vo.setRepairNum((int) vo.getRepairDeviceList().stream().filter(o -> o.getRepairNum() > 0).count());
|
||||||
|
// vo.setRepairedNum((int) vo.getRepairDeviceList().stream().filter(o -> o.getRepairedNum() > 0).count());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return new ArrayList<>(resultMap.values());
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询维修单
|
* 查询维修单
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getRepairTicketInfo(@NotBlank(message = "TaskId参数不能为空") String taskId) {
|
public AjaxResult getRepairDocumentInfo(@NotBlank(message = "TaskId参数不能为空") String taskId) {
|
||||||
if (!NumberUtil.isNumber(taskId)) {
|
if (!NumberUtil.isNumber(taskId)) {
|
||||||
return AjaxResult.error("TaskId参数非数字类型,参数类型错误");
|
return AjaxResult.error("TaskId参数非数字类型,参数类型错误");
|
||||||
}
|
}
|
||||||
|
|
@ -128,12 +166,23 @@ public class RepairServiceImpl implements RepairService {
|
||||||
return AjaxResult.error("未查询到维修任务信息");
|
return AjaxResult.error("未查询到维修任务信息");
|
||||||
}
|
}
|
||||||
// 查询维修任务详情
|
// 查询维修任务详情
|
||||||
List<RepairDeviceListVo> repairMaTypeGroupList = getRepairMaTypeList(new RepairTaskDetails(taskId), true);
|
// List<RepairDeviceListVo> repairMaTypeGroupList = getRepairMaTypeList(new RepairTaskDetails(taskId), true);
|
||||||
repairMaTypeGroupList.removeIf(Objects::isNull);
|
// repairMaTypeGroupList.removeIf(Objects::isNull);
|
||||||
repairMaTypeGroupList.forEach(repairDevice -> {
|
// repairMaTypeGroupList.forEach(repairDevice -> {
|
||||||
|
// List<BmFileInfo> fileInfos = bmFileInfoMapper.selectBmFileInfoList(new BmFileInfo()
|
||||||
|
// .setTaskId(OptionalLong.of(thisTaskId).orElse(0L))
|
||||||
|
// .setModelId(Optional.ofNullable(repairDevice.getId()).orElse(0L))
|
||||||
|
// .setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
||||||
|
// );
|
||||||
|
// repairDevice.setFileList(fileInfos);
|
||||||
|
// });
|
||||||
|
|
||||||
|
List<RepairDeviceSummaryVo> repairDeviceSummaryList = getRepairDeviceSummary(new RepairTaskDetails(taskId));
|
||||||
|
repairDeviceSummaryList.removeIf(Objects::isNull);
|
||||||
|
repairDeviceSummaryList.forEach(repairDevice -> {
|
||||||
List<BmFileInfo> fileInfos = bmFileInfoMapper.selectBmFileInfoList(new BmFileInfo()
|
List<BmFileInfo> fileInfos = bmFileInfoMapper.selectBmFileInfoList(new BmFileInfo()
|
||||||
.setTaskId(OptionalLong.of(thisTaskId).orElse(0L))
|
.setTaskId(OptionalLong.of(thisTaskId).orElse(0L))
|
||||||
.setModelId(Optional.ofNullable(repairDevice.getId()).orElse(0L))
|
.setModelId(Optional.ofNullable(repairDevice.getIds()[0]).orElse(0L))
|
||||||
.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
||||||
);
|
);
|
||||||
repairDevice.setFileList(fileInfos);
|
repairDevice.setFileList(fileInfos);
|
||||||
|
|
@ -143,7 +192,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
repairPartList = mergePartsNum(repairPartList);
|
repairPartList = mergePartsNum(repairPartList);
|
||||||
RepairTicketVo result = new RepairTicketVo()
|
RepairTicketVo result = new RepairTicketVo()
|
||||||
.setRepairTaskInfo(repairTaskInfo)
|
.setRepairTaskInfo(repairTaskInfo)
|
||||||
.setRepairDeviceArray(repairMaTypeGroupList)
|
.setRepairDeviceSummaryList(repairDeviceSummaryList)
|
||||||
.setRepairPartArray(Optional.of(repairPartList).orElse(new ArrayList<>()));
|
.setRepairPartArray(Optional.of(repairPartList).orElse(new ArrayList<>()));
|
||||||
|
|
||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
|
|
@ -205,19 +254,19 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
// 根据维修类型,更新维修数量、报废数量
|
// 根据维修类型,更新维修数量、报废数量
|
||||||
switch (bean.getRepairType()) {
|
switch (bean.getRepairType()) {
|
||||||
case inRepairType: {
|
case INNER_REPAIR: {
|
||||||
int repairNum = verifyRepairNum(bean, details);
|
int repairNum = verifyRepairNum(bean, details);
|
||||||
// 更新维修数量、并修改维修人员
|
// 更新维修数量、并修改维修人员
|
||||||
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
|
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case outRepairType: {
|
case RETURN_FACTORY: {
|
||||||
int repairNum = verifyRepairNum(bean, details);
|
int repairNum = verifyRepairNum(bean, details);
|
||||||
// 更新维修数量、维修人员不变
|
// 更新维修数量、维修人员不变
|
||||||
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case scrapRepairType: {
|
case TO_SCRAP: {
|
||||||
int scrapNum = details.getScrapNum() + bean.getScrapNum();
|
int scrapNum = details.getScrapNum() + bean.getScrapNum();
|
||||||
int num = scrapNum + details.getRepairedNum();
|
int num = scrapNum + details.getRepairedNum();
|
||||||
if (num > details.getRepairNum()) {
|
if (num > details.getRepairNum()) {
|
||||||
|
|
@ -234,7 +283,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 判断配件列表是否为空
|
// 判断配件列表是否为空
|
||||||
if (CollectionUtil.isNotEmpty(partList)) {
|
if (CollectionUtil.isNotEmpty(partList)) {
|
||||||
// 内部维修
|
// 内部维修
|
||||||
if (Objects.equals(inRepairType, bean.getRepairType())) {
|
if (Objects.equals(RepairTypeEnum.INNER_REPAIR.getTypeId(), bean.getRepairType())) {
|
||||||
// 遍历配件列表,判断配件类型,收费还是不收费
|
// 遍历配件列表,判断配件类型,收费还是不收费
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
if (partDetails.getPartId() != null) {
|
if (partDetails.getPartId() != null) {
|
||||||
|
|
@ -270,7 +319,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返厂维修
|
// 返厂维修
|
||||||
if (outRepairType == bean.getRepairType()) {
|
if (RepairTypeEnum.RETURN_FACTORY.getTypeId().equals(bean.getRepairType())) {
|
||||||
bean.setPartName(partList.get(0).getPartName());
|
bean.setPartName(partList.get(0).getPartName());
|
||||||
bean.setPartType(partList.get(0).getPartType());
|
bean.setPartType(partList.get(0).getPartType());
|
||||||
bean.setRepairContent(partList.get(0).getRepairContent());
|
bean.setRepairContent(partList.get(0).getRepairContent());
|
||||||
|
|
@ -340,7 +389,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
repairRecord.setTypeId(Long.valueOf(bean.getTypeId()));
|
repairRecord.setTypeId(Long.valueOf(bean.getTypeId()));
|
||||||
repairRecord.setRepairNum(repairedNum);
|
repairRecord.setRepairNum(repairedNum);
|
||||||
// 快捷维修,设置为内部维修
|
// 快捷维修,设置为内部维修
|
||||||
repairRecord.setRepairType(inRepairType);
|
repairRecord.setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
|
||||||
repairRecord.setCreateBy(String.valueOf(loginUser.getUserid()));
|
repairRecord.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
repairRecord.setCompanyId(bean.getCompanyId());
|
repairRecord.setCompanyId(bean.getCompanyId());
|
||||||
repairMapper.addRecord(repairRecord);
|
repairMapper.addRecord(repairRecord);
|
||||||
|
|
@ -366,30 +415,30 @@ public class RepairServiceImpl implements RepairService {
|
||||||
if (bean.getManageType() == null) {
|
if (bean.getManageType() == null) {
|
||||||
throw new ServiceException("请选择物资管理方式");
|
throw new ServiceException("请选择物资管理方式");
|
||||||
}
|
}
|
||||||
if (Objects.equals(manageTypeByCode, bean.getManageType())) {
|
if (Objects.equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId(), bean.getManageType())) {
|
||||||
// 物资管理方式--编码管理
|
// 物资管理方式--编码管理
|
||||||
if (bean.getRepairType() == null) {
|
if (bean.getRepairType() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 根据维修方式,更新维修数量、报废数量
|
// 根据维修方式,更新维修数量、报废数量
|
||||||
switch (bean.getRepairType()) {
|
switch (bean.getRepairType()) {
|
||||||
case inRepairType: {
|
case INNER_REPAIR: {
|
||||||
partList = bean.getCodeInRepairPartList();
|
partList = bean.getCodeInRepairPartList();
|
||||||
// 更新维修数量、并修改维修人员
|
// 更新维修数量、并修改维修人员
|
||||||
repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid());
|
repairMapper.updateRepairedNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid(), loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case outRepairType: {
|
case RETURN_FACTORY: {
|
||||||
partList = bean.getCodeOutRepairPartList();
|
partList = bean.getCodeOutRepairPartList();
|
||||||
// 更新维修数量、维修人员不变
|
// 更新维修数量、维修人员不变
|
||||||
repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid());
|
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case scrapRepairType: {
|
case TO_SCRAP: {
|
||||||
// 报废无需上传配件、直接初始化空集合
|
// 报废无需上传配件、直接初始化空集合
|
||||||
partList = bean.getCodeScrapRepairPartList();
|
partList = bean.getCodeScrapRepairPartList();
|
||||||
// 更新报废数量
|
// 更新报废数量
|
||||||
repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid());
|
repairMapper.updateScrapNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -399,7 +448,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 统一处理配件集合数据
|
// 统一处理配件集合数据
|
||||||
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
|
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
|
||||||
|
|
||||||
} else if (Objects.equals(manageTypeByNumber, bean.getManageType())) {
|
} else if (Objects.equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId(), bean.getManageType())) {
|
||||||
// 物资管理方式--数量管理
|
// 物资管理方式--数量管理
|
||||||
if (bean.getId() == null) {
|
if (bean.getId() == null) {
|
||||||
throw new ServiceException("请完善参数,维修详情ID为空!");
|
throw new ServiceException("请完善参数,维修详情ID为空!");
|
||||||
|
|
@ -471,7 +520,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
for (RepairPartDetails repairPartDetails : partList) {
|
for (RepairPartDetails repairPartDetails : partList) {
|
||||||
repairApplyRecord.setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(outRepairType).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0)
|
.setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId()).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0)
|
||||||
.setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType())
|
.setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType())
|
||||||
.setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
|
.setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
|
||||||
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
|
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
|
||||||
|
|
@ -524,7 +573,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 维修记录表信息
|
// 维修记录表信息
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0)
|
.setRepairType(RepairTypeEnum.TO_SCRAP.getTypeId()).setStatus(0L).setIsSlt(0L).setPartNum(0)
|
||||||
.setFileIds(fileInfo.getId() == null ? "" : String.valueOf(fileInfo.getId()))
|
.setFileIds(fileInfo.getId() == null ? "" : String.valueOf(fileInfo.getId()))
|
||||||
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
|
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
|
||||||
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
|
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
|
||||||
|
|
@ -539,7 +588,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
// 维修记录表信息
|
// 维修记录表信息
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0)
|
.setRepairType(RepairTypeEnum.TO_SCRAP.getTypeId()).setStatus(0L).setIsSlt(0L).setPartNum(0)
|
||||||
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
|
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
|
||||||
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
|
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
|
||||||
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
|
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
|
||||||
|
|
@ -589,8 +638,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
throw new ServiceException("请选择物资管理方式");
|
throw new ServiceException("请选择物资管理方式");
|
||||||
}
|
}
|
||||||
// 如果是数量管理,那么默认为内部维修
|
// 如果是数量管理,那么默认为内部维修
|
||||||
if (bean.getRepairType() == null && manageType == manageTypeByNumber) {
|
if (bean.getRepairType() == null && MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
|
||||||
bean.setRepairType(inRepairType);
|
bean.setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
|
||||||
}
|
}
|
||||||
// 再检查还是null的话直接结束任务
|
// 再检查还是null的话直接结束任务
|
||||||
if (bean.getRepairType() == null) {
|
if (bean.getRepairType() == null) {
|
||||||
|
|
@ -598,17 +647,17 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 内部维修
|
// 内部维修
|
||||||
if (bean.getRepairType() == inRepairType) {
|
if (RepairTypeEnum.INNER_REPAIR.getTypeId().equals(bean.getRepairType())) {
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
// 遍历配件列表,判断配件类型,收费还是不收费
|
// 遍历配件列表,判断配件类型,收费还是不收费
|
||||||
for (RepairPartDetails partDetails : partList) {
|
for (RepairPartDetails partDetails : partList) {
|
||||||
// 维修记录表信息
|
// 维修记录表信息
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType);
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
|
||||||
if (manageType == manageTypeByCode) {
|
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(manageType)) {
|
||||||
repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0);
|
repairApplyRecord.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0);
|
||||||
repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0);
|
repairApplyRecord.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0);
|
||||||
}
|
}
|
||||||
if (manageType == manageTypeByNumber) {
|
if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
|
||||||
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
|
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
|
||||||
}
|
}
|
||||||
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
repairApplyRecord.setCreateBy(loginUser.getUsername());
|
||||||
|
|
@ -650,7 +699,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 外部维修
|
// 外部维修
|
||||||
if (bean.getRepairType() == outRepairType) {
|
if (RepairTypeEnum.RETURN_FACTORY.getTypeId().equals(bean.getRepairType())) {
|
||||||
// ---------------校验维修数量-----------------
|
// ---------------校验维修数量-----------------
|
||||||
// 统计已维修数量 + 本次维修数量
|
// 统计已维修数量 + 本次维修数量
|
||||||
int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum();
|
int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum();
|
||||||
|
|
@ -664,7 +713,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
// 编码管理--外部返厂维修
|
// 编码管理--外部返厂维修
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
|
||||||
.setTypeId(bean.getTypeId()).setRepairType(outRepairType)
|
.setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId())
|
||||||
.setPartName(partList.get(0).getPartName())
|
.setPartName(partList.get(0).getPartName())
|
||||||
.setPartType(partList.get(0).getPartType())
|
.setPartType(partList.get(0).getPartType())
|
||||||
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
|
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
|
||||||
|
|
@ -686,7 +735,7 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是报废类型,进行上传附件相关处理
|
// 如果是报废类型,进行上传附件相关处理
|
||||||
if (scrapRepairType == bean.getRepairType()) {
|
if (RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType())) {
|
||||||
if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) {
|
if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) {
|
||||||
for (BmFileInfo fileInfo : partList.get(0).getFileList()) {
|
for (BmFileInfo fileInfo : partList.get(0).getFileList()) {
|
||||||
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
|
||||||
|
|
@ -698,8 +747,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(bean.getRepairType()).setStatus(0L).setFileIds(String.valueOf(fileInfo.getId()))
|
.setRepairType(bean.getRepairType()).setStatus(0L).setFileIds(String.valueOf(fileInfo.getId()))
|
||||||
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
|
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
|
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setCreateBy(loginUser.getUsername());
|
.setCreateBy(loginUser.getUsername());
|
||||||
|
|
||||||
// 不选维修配件时, 只添加【维修记录表】
|
// 不选维修配件时, 只添加【维修记录表】
|
||||||
|
|
@ -710,8 +759,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(bean.getRepairType()).setStatus(0L)
|
.setRepairType(bean.getRepairType()).setStatus(0L)
|
||||||
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
|
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
|
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setCreateBy(loginUser.getUsername());
|
.setCreateBy(loginUser.getUsername());
|
||||||
|
|
||||||
// 不选维修配件时, 只添加【维修记录表】
|
// 不选维修配件时, 只添加【维修记录表】
|
||||||
|
|
@ -724,8 +773,8 @@ public class RepairServiceImpl implements RepairService {
|
||||||
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
|
||||||
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
|
||||||
.setRepairType(bean.getRepairType()).setStatus(0L)
|
.setRepairType(bean.getRepairType()).setStatus(0L)
|
||||||
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
|
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
|
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
|
||||||
.setCreateBy(loginUser.getUsername());
|
.setCreateBy(loginUser.getUsername());
|
||||||
|
|
||||||
// 不选维修配件时, 只添加【维修记录表】
|
// 不选维修配件时, 只添加【维修记录表】
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,33 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRepairedNumAndStatus">
|
||||||
|
update repair_apply_details
|
||||||
|
set repaired_num = #{repairNum},
|
||||||
|
status = #{status},
|
||||||
|
repairer = #{repairer},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRepairedNumTwo">
|
||||||
|
update repair_apply_details
|
||||||
|
set repaired_num = #{repairNum},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRepairedNumTwoAndStatus">
|
||||||
|
update repair_apply_details
|
||||||
|
set repaired_num = #{repairNum},
|
||||||
|
status = #{status},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateScrapNum">
|
<update id="updateScrapNum">
|
||||||
update repair_apply_details
|
update repair_apply_details
|
||||||
set scrap_num = #{scrapNum},
|
set scrap_num = #{scrapNum},
|
||||||
|
|
@ -50,6 +77,15 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateScrapNumAndStatus">
|
||||||
|
update repair_apply_details
|
||||||
|
set scrap_num = #{scrapNum},
|
||||||
|
status = #{status},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="completeRepair">
|
<update id="completeRepair">
|
||||||
update repair_apply_details
|
update repair_apply_details
|
||||||
set status = '1',
|
set status = '1',
|
||||||
|
|
@ -72,14 +108,6 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateRepairedNumTwo">
|
|
||||||
update repair_apply_details
|
|
||||||
set repaired_num = #{repairNum},
|
|
||||||
update_by = #{userId},
|
|
||||||
update_time = now()
|
|
||||||
where id = #{id}
|
|
||||||
</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,
|
||||||
|
|
@ -228,7 +256,7 @@
|
||||||
tt.create_time DESC
|
tt.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceListVo">
|
<select id="getRepairDeviceList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceVO">
|
||||||
select
|
select
|
||||||
rad.id as id,
|
rad.id as id,
|
||||||
rad.task_id as taskId,
|
rad.task_id as taskId,
|
||||||
|
|
@ -275,6 +303,53 @@
|
||||||
order by rad.create_time desc
|
order by rad.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- <select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceListVo">-->
|
||||||
|
<!-- select-->
|
||||||
|
<!-- rad.id as id,-->
|
||||||
|
<!-- rad.task_id as taskId,-->
|
||||||
|
<!-- rad.ma_id as maId,-->
|
||||||
|
<!-- mt2.type_name as typeName,-->
|
||||||
|
<!-- mt2.type_id as typeNameId,-->
|
||||||
|
<!-- mt.type_name as type,-->
|
||||||
|
<!-- mt.unit_name as unitName,-->
|
||||||
|
<!-- 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.status as status,-->
|
||||||
|
<!-- su.nick_name as repairer,-->
|
||||||
|
<!-- rad.update_time as updateTime,-->
|
||||||
|
<!-- rad.type_id as typeId,-->
|
||||||
|
<!-- rad.create_time,-->
|
||||||
|
<!-- count(rc.id) AS totalCostRecords,-->
|
||||||
|
<!-- sum(rc.costs) AS totalCost-->
|
||||||
|
<!-- from repair_apply_details rad-->
|
||||||
|
<!-- left join ma_type mt on rad.type_id = mt.type_id-->
|
||||||
|
<!-- left join ma_machine mm on mm.ma_id = rad.ma_id-->
|
||||||
|
<!-- left join sys_user su on rad.repairer = su.user_id-->
|
||||||
|
<!-- left join ma_type mt2 on mt.parent_id = mt2.type_id-->
|
||||||
|
<!-- left join repair_cost rc ON rad.id = rc.repair_id-->
|
||||||
|
<!-- where rad.task_id = #{taskId}-->
|
||||||
|
<!-- <if test="companyId != null and companyId != ''">-->
|
||||||
|
<!-- and rad.company_id = #{companyId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="keyword != null and keyword != ''">-->
|
||||||
|
<!-- AND (locate(#{keyword}, mm.ma_code) > 0-->
|
||||||
|
<!-- or locate(#{keyword}, su.nick_name) > 0-->
|
||||||
|
<!-- or locate(#{keyword}, mt2.type_name) > 0-->
|
||||||
|
<!-- or locate(#{keyword}, mt.type_name) > 0)-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="type != null and type != ''">-->
|
||||||
|
<!-- AND mt.type_id = #{type}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="typeName != null and typeName != ''">-->
|
||||||
|
<!-- AND mt2.type_id = #{typeName}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- GROUP BY rad.id-->
|
||||||
|
<!-- order by rad.create_time desc-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
<select id="getById" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
<select id="getById" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||||
select rad.id as id,
|
select rad.id as id,
|
||||||
rad.repair_num as repairNum,
|
rad.repair_num as repairNum,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue