维修管理--修饰审核
This commit is contained in:
parent
0f7de5c916
commit
b3a578e91b
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.common.biz.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @Description: 基础Base VO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class BaseVO {
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "组织id")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ public enum RepairTaskStatusEnum {
|
|||
|
||||
TASK_STATUS_PROCESSING(0, "维修管理--进行中"),
|
||||
TASK_STATUS_COMPLETE(1, "维修管理--已完成"),
|
||||
TASK_STATUS_REJECT(2, "维修管理--被驳回"),
|
||||
TASK_STATUS_REJECT(2, "维修管理--驳回退料"),
|
||||
TASK_STATUS_TO_EXAM(3, "修饰审核--待审核"),
|
||||
TASK_STATUS_REVIEW(4, "修饰审核--审核通过"),
|
||||
TASK_STATUS_NO_REVIEW(5, "修饰审核--审核不通过"),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
|||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.service.RepairService;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
|
@ -23,6 +24,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -65,7 +67,7 @@ public class RepairController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 导出维修任务列表
|
||||
* 导出维修任务列表--外层--壹级列表
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@RequiresPermissions("repair:manage:export")
|
||||
|
|
@ -85,7 +87,7 @@ public class RepairController extends BaseController {
|
|||
@RequiresPermissions("repair:manage:preview")
|
||||
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
||||
startPage();
|
||||
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
||||
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +97,7 @@ public class RepairController extends BaseController {
|
|||
@ApiOperation(value = "获取维修物资设备列表---不分页")
|
||||
@GetMapping("/getAppRepairMaTypeList")
|
||||
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
||||
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
||||
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +144,15 @@ public class RepairController extends BaseController {
|
|||
return service.endRepairTask(taskList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回退料--批量
|
||||
*/
|
||||
@ApiOperation(value = "驳回退料")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult rejectRepair(@PathVariable Long[] ids) {
|
||||
return service.rejectRepair(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取维修员下拉选
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ public class RepairTaskDetails extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 规格类型id
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
|
|
@ -49,7 +56,7 @@ public class RepairTaskDetails extends BaseEntity {
|
|||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码")
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String code;
|
||||
/**
|
||||
* 维修总量
|
||||
|
|
@ -72,12 +79,6 @@ public class RepairTaskDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "待修状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 规格类型id
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号id")
|
||||
private String typeId;
|
||||
|
||||
@ApiModelProperty(value = "组织id")
|
||||
private Long companyId;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.common.biz.domain.BaseVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @CreateTime: 2024-11-15 13:26
|
||||
* @Description: 维修设备列表返回VO
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class RepairDeviceListVo extends BaseVO {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Integer 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 maId;
|
||||
|
||||
@ApiModelProperty(value = "维修人员")
|
||||
private String repairer;
|
||||
|
||||
@ApiModelProperty(value = "维修总量")
|
||||
private int repairNum;
|
||||
|
||||
@ApiModelProperty(value = "已修数量")
|
||||
private int repairedNum;
|
||||
|
||||
@ApiModelProperty(value = "维修报废数量")
|
||||
private int scrapNum;
|
||||
|
||||
@ApiModelProperty(value = "内层物资类型集合")
|
||||
private List<RepairDeviceVO> repairDeviceList = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.material.repair.domain.vo;
|
||||
|
||||
import com.bonus.material.repair.domain.RepairPart;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @CreateTime: 2024-11-15 14:35
|
||||
* @Description: 维修设备VO
|
||||
*/
|
||||
@Data
|
||||
public class RepairDeviceVO {
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "维修配件信息")
|
||||
private String partInfo;
|
||||
|
||||
@ApiModelProperty(value = "附件")
|
||||
private String fileUrl;
|
||||
|
||||
@ApiModelProperty(value = "维修配件集合")
|
||||
private List<RepairPart> repairPartList;
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
|||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -27,7 +28,7 @@ public interface RepairMapper {
|
|||
* 获取维修详细列表
|
||||
* @param bean 维修任务详情--查询条件
|
||||
*/
|
||||
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
|
||||
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
|
||||
|
||||
/**
|
||||
* 新增维修记录
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -27,7 +28,7 @@ public interface RepairService {
|
|||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
|
||||
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
|
||||
|
||||
/**
|
||||
* 新增维修记录
|
||||
|
|
@ -63,6 +64,8 @@ public interface RepairService {
|
|||
*/
|
||||
AjaxResult endRepairTask(List<RepairTask> taskList);
|
||||
|
||||
AjaxResult rejectRepair(List<Long> taskList);
|
||||
|
||||
|
||||
/**
|
||||
* 导出维修列表
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
|||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
|
||||
import com.bonus.material.repair.service.IRepairAuditDetailsService;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.material.repair.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
|
|
@ -7,17 +9,27 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
|
|||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import com.bonus.material.repair.domain.RepairTask;
|
||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
|
||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||
import com.bonus.material.repair.mapper.RepairMapper;
|
||||
import com.bonus.material.repair.service.RepairService;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author syruan
|
||||
|
|
@ -28,6 +40,8 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Resource
|
||||
private RepairMapper repairMapper;
|
||||
|
||||
private TmTaskMapper taskMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
||||
|
|
@ -40,10 +54,44 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||
//Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
public List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||
bean.setCompanyId(null);
|
||||
return repairMapper.getRepairMaTypeList(bean);
|
||||
List<RepairDeviceListVo> repairMaTypeList = repairMapper.getRepairMaTypeList(bean);
|
||||
|
||||
if (repairMaTypeList.isEmpty()) {
|
||||
return repairMaTypeList;
|
||||
}
|
||||
|
||||
// 创建Map集合,用于快速分组
|
||||
Map<Long, RepairDeviceListVo> resultMap = new ConcurrentHashMap<>();
|
||||
|
||||
// 遍历处理,把相同的父级对象,拆分到子集合中
|
||||
repairMaTypeList.forEach(item -> {
|
||||
// 创建对象,并复制字段value
|
||||
RepairDeviceVO repairDeviceVO = new RepairDeviceVO();
|
||||
try {
|
||||
BeanUtil.copyProperties(item, repairDeviceVO);
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志,并提供更详细的错误信息
|
||||
System.err.println("复制属性时发生错误: {}" + e.getMessage());
|
||||
throw new RuntimeException("复制属性时发生错误", e);
|
||||
}
|
||||
|
||||
if (item.getTypeNameId() == null) {
|
||||
// 处理 typeNameId 为空的情况
|
||||
System.err.println("typeNameId 为空,跳过当前项: " + item);
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 computeIfAbsent 方法,如果 key 不存在,则创建一个新对象,并添加到 resultMap 中
|
||||
resultMap.computeIfAbsent(item.getTypeNameId(), k -> {
|
||||
item.getRepairDeviceList().add(repairDeviceVO);
|
||||
return item;
|
||||
}).getRepairDeviceList().add(repairDeviceVO);
|
||||
|
||||
});
|
||||
|
||||
return new ArrayList<>(resultMap.values());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -69,7 +117,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
switch (bean.getRepairType()) {
|
||||
case "1": {
|
||||
int repairNum = (details.getRepairedNum() + bean.getRepairNum());
|
||||
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
||||
int num = repairNum + details.getScrapNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
|
|
@ -78,7 +126,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
break;
|
||||
}
|
||||
case "2": {
|
||||
int repairNum = (int) (details.getRepairedNum() + bean.getRepairNum());
|
||||
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
||||
int num = repairNum + details.getScrapNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
|
|
@ -87,7 +135,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
break;
|
||||
}
|
||||
case "3": {
|
||||
int scrapNum = (int) (details.getScrapNum() + bean.getScrapNum());
|
||||
int scrapNum = details.getScrapNum() + bean.getScrapNum();
|
||||
int num = scrapNum + details.getRepairedNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
|
|
@ -216,6 +264,17 @@ public class RepairServiceImpl implements RepairService {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult rejectRepair(@NotNull List<Long> taskList) {
|
||||
try {
|
||||
taskList.forEach(taskId -> taskMapper.updateTmTaskStatusByTaskId(taskId, RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus()));
|
||||
} catch (DataAccessException e) {
|
||||
System.err.println(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AjaxResult.success("执行完成");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int completeRepair(ArrayList<Long> ids) {
|
||||
|
|
|
|||
|
|
@ -197,12 +197,13 @@
|
|||
tt.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||
<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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue