Merge branch 'hhk' into main
commit
4d73fe32e1
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DeviceLedgerStatusEnum {
|
||||||
|
NORMAL(0, "正常"),
|
||||||
|
DISABLED(1, "停用"),
|
||||||
|
MAINTENANCE(2, "维修"),
|
||||||
|
SCRAP(3, "报废");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
public static DeviceLedgerStatusEnum getByCode(Integer code) {
|
||||||
|
for (DeviceLedgerStatusEnum status : values()) {
|
||||||
|
if (status.getCode().equals(code)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,123 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.DeviceLedgerRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.ticketmanagement.TicketManagementService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 工单管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/ticket-management")
|
||||||
|
@Validated
|
||||||
|
public class TicketManagementController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TicketManagementService ticketManagementService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建工单管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:create')")
|
||||||
|
public CommonResult<Long> createTicketManagement(@Valid @RequestBody TicketManagementSaveReqVO createReqVO) {
|
||||||
|
return success(ticketManagementService.createTicketManagement(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新工单管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:update')")
|
||||||
|
public CommonResult<Boolean> updateTicketManagement(@Valid @RequestBody TicketManagementSaveReqVO updateReqVO) {
|
||||||
|
ticketManagementService.updateTicketManagement(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除工单管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTicketManagement(@RequestParam("id") Long id) {
|
||||||
|
ticketManagementService.deleteTicketManagement(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得工单管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:query')")
|
||||||
|
public CommonResult<TicketManagementRespVO> getTicketManagement(@RequestParam("id") Long id) {
|
||||||
|
TicketManagementDO ticketManagement = ticketManagementService.getTicketManagement(id);
|
||||||
|
return success(BeanUtils.toBean(ticketManagement, TicketManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得工单管理分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:query')")
|
||||||
|
public CommonResult<PageResult<TicketManagementRespVO>> getTicketManagementPage(@Valid TicketManagementPageReqVO pageReqVO) {
|
||||||
|
PageResult<TicketManagementDO> pageResult = ticketManagementService.getTicketManagementPage(pageReqVO);
|
||||||
|
return success(buildPageCreatorName(BeanUtils.toBean(pageResult, TicketManagementRespVO.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出工单管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTicketManagementExcel(@Valid TicketManagementPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TicketManagementDO> list = ticketManagementService.getTicketManagementPage(pageReqVO).getList();
|
||||||
|
List<TicketManagementRespVO> ticketManagementRespVOList = BeanUtils.toBean(list, TicketManagementRespVO.class);
|
||||||
|
for (TicketManagementRespVO ticketManagementRespVO : ticketManagementRespVOList) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(ticketManagementRespVO.getCreator()));
|
||||||
|
ticketManagementRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "工单管理.xls", "数据", TicketManagementRespVO.class,
|
||||||
|
ticketManagementRespVOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/batchUpdateStatus")
|
||||||
|
@Operation(summary = "批量取消工单")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-management:update')")
|
||||||
|
public CommonResult<Boolean> batchUpdateTicketStatus(@Valid @RequestBody TicketManagementBatchUpdateReqVO reqVO) {
|
||||||
|
ticketManagementService.batchUpdateJobStatus(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageResult<TicketManagementRespVO> buildPageCreatorName(PageResult<TicketManagementRespVO> ticketManagementRespVOPageResult) {
|
||||||
|
for (TicketManagementRespVO ticketManagementRespVO : ticketManagementRespVOPageResult.getList()) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(ticketManagementRespVO.getCreator()));
|
||||||
|
ticketManagementRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
return ticketManagementRespVOPageResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 项目方案关联分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class TicketManagementPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", example = "21368")
|
||||||
|
private String subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", example = "20459")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "单号")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称", example = "张三")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private String planType;
|
||||||
|
|
||||||
|
@Schema(description = "计划配置名称", example = "赵六")
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
@Schema(description = "作业状态", example = "1")
|
||||||
|
private Integer jobStatus;
|
||||||
|
|
||||||
|
@Schema(description = "作业结果")
|
||||||
|
private String jobResult;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "id集合导出用")
|
||||||
|
private String ids;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业开始时间
|
||||||
|
*/
|
||||||
|
private String taskTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业结束时间
|
||||||
|
*/
|
||||||
|
private String taskEndTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.Ignore;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 项目方案关联 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TicketManagementRespVO extends BaseDO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6566")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21368")
|
||||||
|
// @ExcelProperty("项目ID")
|
||||||
|
private Long subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20459")
|
||||||
|
// @ExcelProperty("方案ID")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "单号")
|
||||||
|
@ExcelProperty("单号")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称", example = "张三")
|
||||||
|
@ExcelProperty("设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
@ExcelProperty("类型")
|
||||||
|
private String planType;
|
||||||
|
|
||||||
|
@Schema(description = "计划配置名称", example = "赵六")
|
||||||
|
@ExcelProperty("计划配置名称")
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
@Schema(description = "作业状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("作业状态")
|
||||||
|
private Integer jobStatus;
|
||||||
|
|
||||||
|
@Schema(description = "作业结果")
|
||||||
|
@ExcelProperty("作业结果")
|
||||||
|
private Integer jobResult;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业开始时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime taskTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业结束时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime taskEndTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "创建人名字")
|
||||||
|
@ExcelProperty("创建人名字")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 项目方案关联新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TicketManagementSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6566")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21368")
|
||||||
|
@NotNull(message = "项目ID不能为空")
|
||||||
|
private Long subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20459")
|
||||||
|
@NotNull(message = "方案ID不能为空")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "单号")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称", example = "张三")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private String planType;
|
||||||
|
|
||||||
|
@Schema(description = "计划配置名称", example = "赵六")
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
@Schema(description = "作业状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "作业状态不能为空")
|
||||||
|
private Integer jobStatus;
|
||||||
|
|
||||||
|
@Schema(description = "作业结果")
|
||||||
|
private Integer jobResult;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketresults;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.ticketresults.TicketResultsService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 工单检验结果")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/ticket-results")
|
||||||
|
@Validated
|
||||||
|
public class TicketResultsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TicketResultsService ticketResultsService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:create')")
|
||||||
|
public CommonResult<Long> createTicketResults(@Valid @RequestBody TicketResultsSaveReqVO createReqVO) {
|
||||||
|
return success(ticketResultsService.createTicketResults(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:update')")
|
||||||
|
public CommonResult<Boolean> updateTicketResults(@Valid @RequestBody TicketResultsSaveReqVO updateReqVO) {
|
||||||
|
ticketResultsService.updateTicketResults(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除工单检验结果")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTicketResults(@RequestParam("id") Long id) {
|
||||||
|
ticketResultsService.deleteTicketResults(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得工单检验结果")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:query')")
|
||||||
|
public CommonResult<TicketResultsRespVO> getTicketResults(@RequestParam("id") Long id) {
|
||||||
|
TicketResultsDO ticketResults = ticketResultsService.getTicketResults(id);
|
||||||
|
return success(BeanUtils.toBean(ticketResults, TicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得工单检验结果分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:query')")
|
||||||
|
public CommonResult<PageResult<TicketResultsRespVO>> getTicketResultsPage(@Valid TicketResultsPageReqVO pageReqVO) {
|
||||||
|
PageResult<TicketResultsDO> pageResult = ticketResultsService.getTicketResultsPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出工单检验结果 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTicketResultsExcel(@Valid TicketResultsPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TicketResultsDO> list = ticketResultsService.getTicketResultsPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "工单检验结果.xls", "数据", TicketResultsRespVO.class,
|
||||||
|
BeanUtils.toBean(list, TicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/batchUpdate")
|
||||||
|
@Operation(summary = "批量更新工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:ticket-results:update')")
|
||||||
|
public CommonResult<Boolean> batchUpdateTicketResults(
|
||||||
|
@Valid @RequestBody List<TicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
ticketResultsService.batchUpdateTicketResults(updateReqVOList);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 工单检验结果分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class TicketResultsPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "检验项名称", example = "赵六")
|
||||||
|
private String inspectionItemName;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
@Schema(description = "检验结果 0-待检测 1-检测通过 2-检测不通过")
|
||||||
|
private Integer inspectionResult;
|
||||||
|
|
||||||
|
@Schema(description = "图片路径")
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "检验时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] inspectionTime;
|
||||||
|
|
||||||
|
@Schema(description = "工单管理Id")
|
||||||
|
private Long managementId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 工单检验结果 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TicketResultsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30557")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "检验项名称", example = "赵六")
|
||||||
|
@ExcelProperty("检验项名称")
|
||||||
|
private String inspectionItemName;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式")
|
||||||
|
@ExcelProperty("检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准")
|
||||||
|
@ExcelProperty("判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
@Schema(description = "检验结果 0-待检测 1-检测通过 2-检测不通过")
|
||||||
|
@ExcelProperty("检验结果 0-待检测 1-检测通过 2-检测不通过")
|
||||||
|
private Integer inspectionResult;
|
||||||
|
|
||||||
|
@Schema(description = "图片路径")
|
||||||
|
@ExcelProperty("图片路径")
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "检验时间")
|
||||||
|
@ExcelProperty("检验时间")
|
||||||
|
private LocalDateTime inspectionTime;
|
||||||
|
|
||||||
|
@Schema(description = "工单管理Id")
|
||||||
|
private Long managementId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 工单检验结果新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TicketResultsSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30557")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "检验项名称", example = "赵六")
|
||||||
|
private String inspectionItemName;
|
||||||
|
|
||||||
|
@Schema(description = "工单管理Id")
|
||||||
|
private Long managementId;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
@Schema(description = "检验结果 0-待检测 1-检测通过 2-检测不通过")
|
||||||
|
private Integer inspectionResult;
|
||||||
|
|
||||||
|
@Schema(description = "图片路径")
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "检验时间")
|
||||||
|
private LocalDateTime inspectionTime;
|
||||||
|
|
||||||
|
@Schema(description = "检验人")
|
||||||
|
private String inspector;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单管理 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_ticket_management")
|
||||||
|
@KeySequence("mes_ticket_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TicketManagementDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
private Long subjectId;
|
||||||
|
/**
|
||||||
|
* 方案ID
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
/**
|
||||||
|
* 单号
|
||||||
|
*/
|
||||||
|
private String planNo;
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private int planType;
|
||||||
|
/**
|
||||||
|
* 计划配置名称
|
||||||
|
*/
|
||||||
|
private String configName;
|
||||||
|
/**
|
||||||
|
* 作业状态 0-待完成 1-已完成 2-已取消
|
||||||
|
*/
|
||||||
|
private Integer jobStatus;
|
||||||
|
/**
|
||||||
|
* 作业结果 0-待完成 1-通过 2-不通过
|
||||||
|
*/
|
||||||
|
private int jobResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业开始时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime taskTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业结束时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime taskEndTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_ticket_results")
|
||||||
|
@KeySequence("mes_ticket_results_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TicketResultsDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 检验项名称
|
||||||
|
*/
|
||||||
|
private String inspectionItemName;
|
||||||
|
/**
|
||||||
|
* 检验方式
|
||||||
|
*/
|
||||||
|
private String inspectionMethod;
|
||||||
|
/**
|
||||||
|
* 判定基准
|
||||||
|
*/
|
||||||
|
private String judgmentCriteria;
|
||||||
|
/**
|
||||||
|
* 检验结果 0-待检测 1-检测通过 2-检测不通过
|
||||||
|
*/
|
||||||
|
private Integer inspectionResult;
|
||||||
|
/**
|
||||||
|
* 图片路径
|
||||||
|
*/
|
||||||
|
private String images;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 检验时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime inspectionTime;
|
||||||
|
/**
|
||||||
|
* 检验人
|
||||||
|
*/
|
||||||
|
private Long managementId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement.TaskManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TicketManagementMapper extends BaseMapperX<TicketManagementDO> {
|
||||||
|
|
||||||
|
default PageResult<TicketManagementDO> selectPage(TicketManagementPageReqVO reqVO) {
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<TicketManagementDO> ticketManagementDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
ticketManagementDOLambdaQueryWrapperX
|
||||||
|
.eqIfPresent(TicketManagementDO::getSubjectId, reqVO.getSubjectId())
|
||||||
|
.eqIfPresent(TicketManagementDO::getPlanId, reqVO.getPlanId())
|
||||||
|
.eqIfPresent(TicketManagementDO::getPlanNo, reqVO.getPlanNo())
|
||||||
|
.likeIfPresent(TicketManagementDO::getDeviceName, reqVO.getDeviceName())
|
||||||
|
.eqIfPresent(TicketManagementDO::getPlanType, reqVO.getPlanType())
|
||||||
|
.likeIfPresent(TicketManagementDO::getConfigName, reqVO.getConfigName())
|
||||||
|
.eqIfPresent(TicketManagementDO::getJobStatus, reqVO.getJobStatus())
|
||||||
|
.eqIfPresent(TicketManagementDO::getJobResult, reqVO.getJobResult())
|
||||||
|
.orderByDesc(TicketManagementDO::getCreateTime);
|
||||||
|
|
||||||
|
|
||||||
|
// 单独处理 ids 条件
|
||||||
|
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||||
|
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
ticketManagementDOLambdaQueryWrapperX.in(TicketManagementDO::getId, idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return selectPage(reqVO,ticketManagementDOLambdaQueryWrapperX);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新作业状态
|
||||||
|
*
|
||||||
|
* @param idList 工单ID列表
|
||||||
|
* @param jobStatus 作业状态
|
||||||
|
* @return 更新记录数
|
||||||
|
*/
|
||||||
|
int batchUpdateJobStatus(@Param("idList") List<Long> idList,
|
||||||
|
@Param("jobStatus") Integer jobStatus);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.ticketresults;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TicketResultsMapper extends BaseMapperX<TicketResultsDO> {
|
||||||
|
|
||||||
|
default PageResult<TicketResultsDO> selectPage(TicketResultsPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TicketResultsDO>()
|
||||||
|
.likeIfPresent(TicketResultsDO::getInspectionItemName, reqVO.getInspectionItemName())
|
||||||
|
.eqIfPresent(TicketResultsDO::getInspectionMethod, reqVO.getInspectionMethod())
|
||||||
|
.eqIfPresent(TicketResultsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
|
||||||
|
.eqIfPresent(TicketResultsDO::getInspectionResult, reqVO.getInspectionResult())
|
||||||
|
.eqIfPresent(TicketResultsDO::getImages, reqVO.getImages())
|
||||||
|
.eqIfPresent(TicketResultsDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(TicketResultsDO::getInspectionTime, reqVO.getInspectionTime())
|
||||||
|
.eqIfPresent(TicketResultsDO::getManagementId, reqVO.getManagementId())
|
||||||
|
.betweenIfPresent(TicketResultsDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(TicketResultsDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.ticketmanagement;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface TicketManagementService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目方案关联
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTicketManagement(@Valid TicketManagementSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新项目方案关联
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTicketManagement(@Valid TicketManagementSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTicketManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 项目方案关联
|
||||||
|
*/
|
||||||
|
TicketManagementDO getTicketManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 项目方案关联分页
|
||||||
|
*/
|
||||||
|
PageResult<TicketManagementDO> getTicketManagementPage(TicketManagementPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
void batchUpdateJobStatus(@Valid TicketManagementBatchUpdateReqVO reqVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.ticketmanagement;
|
||||||
|
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement.TicketManagementMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TicketManagementServiceImpl implements TicketManagementService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TicketManagementMapper ticketManagementMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTicketManagement(TicketManagementSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
TicketManagementDO ticketManagement = BeanUtils.toBean(createReqVO, TicketManagementDO.class);
|
||||||
|
ticketManagementMapper.insert(ticketManagement);
|
||||||
|
// 返回
|
||||||
|
return ticketManagement.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTicketManagement(TicketManagementSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTicketManagementExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
TicketManagementDO updateObj = BeanUtils.toBean(updateReqVO, TicketManagementDO.class);
|
||||||
|
ticketManagementMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTicketManagement(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTicketManagementExists(id);
|
||||||
|
// 删除
|
||||||
|
ticketManagementMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTicketManagementExists(Long id) {
|
||||||
|
if (ticketManagementMapper.selectById(id) == null) {
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TicketManagementDO getTicketManagement(Long id) {
|
||||||
|
return ticketManagementMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TicketManagementDO> getTicketManagementPage(TicketManagementPageReqVO pageReqVO) {
|
||||||
|
return ticketManagementMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void batchUpdateJobStatus(TicketManagementBatchUpdateReqVO reqVO) {
|
||||||
|
// 1. 解析ID列表
|
||||||
|
List<Long> idList = parseIds(reqVO.getIds());
|
||||||
|
if (idList.isEmpty()) {
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 批量更新
|
||||||
|
ticketManagementMapper.batchUpdateJobStatus(idList, reqVO.getJobStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析逗号分隔的ID字符串
|
||||||
|
*/
|
||||||
|
private List<Long> parseIds(String ids) {
|
||||||
|
if (StringUtils.isBlank(ids)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.ticketresults;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface TicketResultsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建工单检验结果
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTicketResults(@Valid TicketResultsSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新工单检验结果
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTicketResults(@Valid TicketResultsSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除工单检验结果
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTicketResults(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得工单检验结果
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 工单检验结果
|
||||||
|
*/
|
||||||
|
TicketResultsDO getTicketResults(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得工单检验结果分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 工单检验结果分页
|
||||||
|
*/
|
||||||
|
PageResult<TicketResultsDO> getTicketResultsPage(TicketResultsPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果批量更新
|
||||||
|
*
|
||||||
|
* @param updateReqVOList 批量更新
|
||||||
|
* @return 工单检验结果批量更新
|
||||||
|
*/
|
||||||
|
void batchUpdateTicketResults(@Valid List<TicketResultsSaveReqVO> updateReqVOList);
|
||||||
|
}
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.ticketresults;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.enums.JobResultEnum;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement.TicketManagementMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketresults.TicketResultsMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TicketResultsServiceImpl implements TicketResultsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TicketResultsMapper ticketResultsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private TicketManagementMapper ticketManagementMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTicketResults(TicketResultsSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
TicketResultsDO ticketResults = BeanUtils.toBean(createReqVO, TicketResultsDO.class);
|
||||||
|
ticketResultsMapper.insert(ticketResults);
|
||||||
|
// 返回
|
||||||
|
return ticketResults.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTicketResults(TicketResultsSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTicketResultsExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
TicketResultsDO updateObj = BeanUtils.toBean(updateReqVO, TicketResultsDO.class);
|
||||||
|
ticketResultsMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTicketResults(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTicketResultsExists(id);
|
||||||
|
// 删除
|
||||||
|
ticketResultsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTicketResultsExists(Long id) {
|
||||||
|
if (ticketResultsMapper.selectById(id) == null) {
|
||||||
|
throw exception(TICKET_RESULTS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TicketResultsDO getTicketResults(Long id) {
|
||||||
|
return ticketResultsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TicketResultsDO> getTicketResultsPage(TicketResultsPageReqVO pageReqVO) {
|
||||||
|
return ticketResultsMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void batchUpdateTicketResults(List<TicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 数据验证
|
||||||
|
validateBatchUpdateData(updateReqVOList);
|
||||||
|
|
||||||
|
// 2. 批量更新
|
||||||
|
List<TicketResultsDO> updateList = new ArrayList<>();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
for (TicketResultsSaveReqVO vo : updateReqVOList) {
|
||||||
|
// 转换为DO
|
||||||
|
TicketResultsDO updateDO = BeanUtils.toBean(vo, TicketResultsDO.class);
|
||||||
|
updateDO.setUpdateTime(now);
|
||||||
|
updateList.add(updateDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 执行批量更新
|
||||||
|
ticketResultsMapper.updateBatch(updateList);
|
||||||
|
|
||||||
|
//4. 判断是否全部已检验
|
||||||
|
handleInspectionResult(updateReqVOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证批量更新数据
|
||||||
|
*/
|
||||||
|
private void validateBatchUpdateData(List<TicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Long> idSet = new HashSet<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < updateReqVOList.size(); i++) {
|
||||||
|
TicketResultsSaveReqVO vo = updateReqVOList.get(i);
|
||||||
|
|
||||||
|
// 验证ID不能为空
|
||||||
|
if (vo.getId() == null) {
|
||||||
|
throw exception(TICKET_RESULTS_ID_NOT_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
idSet.add(vo.getId());
|
||||||
|
|
||||||
|
// 调用单个验证逻辑
|
||||||
|
validateTicketResultsExists(vo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理检验结果
|
||||||
|
*/
|
||||||
|
private void handleInspectionResult(List<TicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有未填写的
|
||||||
|
boolean hasPending = updateReqVOList.stream()
|
||||||
|
.anyMatch(vo -> vo.getInspectionResult() == null || vo.getInspectionResult().equals(JobResultEnum.PENDING.getCode()));
|
||||||
|
|
||||||
|
if (hasPending) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TicketManagementDO ticketManagementDO = ticketManagementMapper.selectById(updateReqVOList.get(0).getManagementId());
|
||||||
|
if (ticketManagementDO == null ){
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
// 检查是否有不通过的
|
||||||
|
boolean hasFail = updateReqVOList.stream()
|
||||||
|
.anyMatch(vo -> vo.getInspectionResult() != null && vo.getInspectionResult().equals(JobResultEnum.FAIL.getCode()));
|
||||||
|
if (hasFail) {
|
||||||
|
ticketManagementDO.setJobResult(JobResultEnum.FAIL.getCode());
|
||||||
|
} else {
|
||||||
|
ticketManagementDO.setJobResult(JobResultEnum.PASS.getCode());
|
||||||
|
}
|
||||||
|
ticketManagementMapper.updateById(ticketManagementDO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue