Merge branch 'main' of https://git.ngsk.tech/linweidong/besure_server
commit
bb709e000c
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.energydevice.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 能耗设备运算规则 VO")
|
||||||
|
@Data
|
||||||
|
public class OperationRulesVO {
|
||||||
|
|
||||||
|
@Schema(description = "设备Id")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Schema(description = "点位Id")
|
||||||
|
private Long pointId;
|
||||||
|
|
||||||
|
@Schema(description = "运算符号")
|
||||||
|
private String operator;
|
||||||
|
|
||||||
|
@Schema(description = "点位参数值")
|
||||||
|
private String pointValue;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.energyrecord;
|
||||||
|
|
||||||
|
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.energyrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.energyrecord.EnergyRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.energyrecord.EnergyRecordService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 能源设备历史记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/energy-record")
|
||||||
|
@Validated
|
||||||
|
public class EnergyRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnergyRecordService energyRecordService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建能源设备历史记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:create')")
|
||||||
|
public CommonResult<Long> createEnergyRecord(@Valid @RequestBody EnergyRecordSaveReqVO createReqVO) {
|
||||||
|
return success(energyRecordService.createEnergyRecord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新能源设备历史记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:update')")
|
||||||
|
public CommonResult<Boolean> updateEnergyRecord(@Valid @RequestBody EnergyRecordSaveReqVO updateReqVO) {
|
||||||
|
energyRecordService.updateEnergyRecord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除能源设备历史记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:delete')")
|
||||||
|
public CommonResult<Boolean> deleteEnergyRecord(@RequestParam("id") Long id) {
|
||||||
|
energyRecordService.deleteEnergyRecord(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得能源设备历史记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:query')")
|
||||||
|
public CommonResult<EnergyRecordRespVO> getEnergyRecord(@RequestParam("id") Long id) {
|
||||||
|
EnergyRecordDO energyRecord = energyRecordService.getEnergyRecord(id);
|
||||||
|
return success(BeanUtils.toBean(energyRecord, EnergyRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得能源设备历史记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:query')")
|
||||||
|
public CommonResult<PageResult<EnergyRecordRespVO>> getEnergyRecordPage(@Valid EnergyRecordPageReqVO pageReqVO) {
|
||||||
|
PageResult<EnergyRecordDO> pageResult = energyRecordService.getEnergyRecordPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, EnergyRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出能源设备历史记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:energy-record:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportEnergyRecordExcel(@Valid EnergyRecordPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<EnergyRecordDO> list = energyRecordService.getEnergyRecordPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "能源设备历史记录.xls", "数据", EnergyRecordRespVO.class,
|
||||||
|
BeanUtils.toBean(list, EnergyRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.energyrecord.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 EnergyRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "能源设备id", example = "25594")
|
||||||
|
private Long energyDeviceId;
|
||||||
|
|
||||||
|
@Schema(description = "能耗历史数据")
|
||||||
|
private String recordData;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用")
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.energyrecord.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 EnergyRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14404")
|
||||||
|
@ExcelProperty("ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "能源设备id", example = "25594")
|
||||||
|
@ExcelProperty("能源设备id")
|
||||||
|
private Long energyDeviceId;
|
||||||
|
|
||||||
|
@Schema(description = "能耗历史数据")
|
||||||
|
@ExcelProperty("能耗历史数据")
|
||||||
|
private String recordData;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("是否启用")
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.energyrecord.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 EnergyRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14404")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "能源设备id", example = "25594")
|
||||||
|
private Long energyDeviceId;
|
||||||
|
|
||||||
|
@Schema(description = "能耗历史数据")
|
||||||
|
private String recordData;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "是否启用不能为空")
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.vo.TicketManagementRespVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.subjectmoldplan.SubjectMoldPlanService;
|
||||||
|
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 java.util.stream.Collectors;
|
||||||
|
|
||||||
|
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.moldplanmaintenance.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldplanmaintenance.MoldPlanMaintenanceService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 方案维护")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/mold-plan-maintenance")
|
||||||
|
@Validated
|
||||||
|
public class MoldPlanMaintenanceController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldPlanMaintenanceService moldplanMaintenanceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubjectMoldPlanService subjectMoldPlanService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建方案维护")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:create')")
|
||||||
|
public CommonResult<Long> createMoldPlanMaintenance(@Valid @RequestBody MoldPlanMaintenanceSaveReqVO createReqVO) {
|
||||||
|
return success(moldplanMaintenanceService.createMoldPlanMaintenance(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新方案维护")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:update')")
|
||||||
|
public CommonResult<Boolean> updateMoldPlanMaintenance(@Valid @RequestBody MoldPlanMaintenanceSaveReqVO updateReqVO) {
|
||||||
|
moldplanMaintenanceService.updateMoldPlanMaintenance(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除方案维护")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMoldPlanMaintenance(@RequestParam("ids") String ids) {
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldplanMaintenanceService.deleteMoldPlanMaintenance(idList);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得方案维护")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:query')")
|
||||||
|
public CommonResult<MoldPlanMaintenanceRespVO> getMoldPlanMaintenance(@RequestParam("id") Long id) {
|
||||||
|
MoldPlanMaintenanceDO moldplanMaintenance = moldplanMaintenanceService.getMoldPlanMaintenance(id);
|
||||||
|
return success(BeanUtils.toBean(moldplanMaintenance, MoldPlanMaintenanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得方案维护分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:query')")
|
||||||
|
public CommonResult<PageResult<MoldPlanMaintenanceRespVO>> getMoldPlanMaintenancePage(@Valid MoldPlanMaintenancePageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldPlanMaintenanceDO> pageResult = moldplanMaintenanceService.getMoldPlanMaintenancePage(pageReqVO);
|
||||||
|
PageResult<MoldPlanMaintenanceRespVO> moldplanMaintenanceRespVOPageResult = BeanUtils.toBean(pageResult, MoldPlanMaintenanceRespVO.class);
|
||||||
|
|
||||||
|
return success(buildPageCreatorName(moldplanMaintenanceRespVOPageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出方案维护 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMoldPlanMaintenanceExcel(@Valid MoldPlanMaintenancePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MoldPlanMaintenanceDO> list = moldplanMaintenanceService.getMoldPlanMaintenancePage(pageReqVO).getList();
|
||||||
|
|
||||||
|
List<MoldPlanMaintenanceRespVO> moldplanMaintenanceRespVOS = BeanUtils.toBean(list, MoldPlanMaintenanceRespVO.class);
|
||||||
|
for (MoldPlanMaintenanceRespVO moldplanMaintenanceRespVO : moldplanMaintenanceRespVOS) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldplanMaintenanceRespVO.getCreator()));
|
||||||
|
moldplanMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "方案维护.xls", "数据", MoldPlanMaintenanceRespVO.class,moldplanMaintenanceRespVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getSubjectList")
|
||||||
|
@Operation(summary = "查询项目集合列表")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-plan-maintenance:query')")
|
||||||
|
public CommonResult<List<MoldSubjectDO>> getSubjectList(@RequestParam("id") Long id) {
|
||||||
|
List<MoldSubjectDO> subjectMoldPlanDOList = moldplanMaintenanceService.getSubjectList(id);
|
||||||
|
return success(subjectMoldPlanDOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private PageResult<MoldPlanMaintenanceRespVO> buildPageCreatorName(PageResult<MoldPlanMaintenanceRespVO> moldplanMaintenanceRespVOPageResult) {
|
||||||
|
for (MoldPlanMaintenanceRespVO moldplanMaintenanceRespVO : moldplanMaintenanceRespVOPageResult.getList()) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldplanMaintenanceRespVO.getCreator()));
|
||||||
|
moldplanMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
return moldplanMaintenanceRespVOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance.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 MoldPlanMaintenancePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "王五")
|
||||||
|
private String planName;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "1")
|
||||||
|
private Integer planType;
|
||||||
|
|
||||||
|
@Schema(description = "描述", example = "你猜")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "id集合导出用")
|
||||||
|
private String ids;
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
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 MoldPlanMaintenanceRespVO extends BaseDO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19033")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String planName;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private int planType;
|
||||||
|
|
||||||
|
@Schema(description = "描述", example = "你猜")
|
||||||
|
@ExcelProperty("描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "项目集合ids")
|
||||||
|
private List<Long> subjectIds;
|
||||||
|
|
||||||
|
@Schema(description = "创建人名字")
|
||||||
|
@ExcelProperty("创建人名字")
|
||||||
|
private String creatorName;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance.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 MoldPlanMaintenanceSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19033")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@NotEmpty(message = "名称不能为空")
|
||||||
|
private String planName;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "名称不能为空")
|
||||||
|
private String planType;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "项目id集合", example = "1")
|
||||||
|
private String subjectIdS;
|
||||||
|
}
|
||||||
@ -0,0 +1,187 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldsubject;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.DeviceLedgerRespVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectRespVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldsubject.MoldSubjectService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 维保项目")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/mold-subject")
|
||||||
|
@Validated
|
||||||
|
public class MoldSubjectController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldSubjectService moldSubjectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DictDataApi dictDataApi;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建维保项目")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:create')")
|
||||||
|
public CommonResult<Long> createMoldSubject(@Valid @RequestBody MoldSubjectSaveReqVO createReqVO) {
|
||||||
|
return success(moldSubjectService.createMoldSubject(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新维保项目")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:update')")
|
||||||
|
public CommonResult<Boolean> updateMoldSubject(@Valid @RequestBody MoldSubjectSaveReqVO updateReqVO) {
|
||||||
|
moldSubjectService.updateMoldSubject(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除维保项目")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMoldSubject(@RequestParam("ids") String ids) {
|
||||||
|
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldSubjectService.deleteMoldSubject(idList);
|
||||||
|
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得维保项目")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:query')")
|
||||||
|
public CommonResult<MoldSubjectRespVO> getMoldSubject(@RequestParam("id") Long id) {
|
||||||
|
MoldSubjectDO moldSubject = moldSubjectService.getMoldSubject(id);
|
||||||
|
return success(BeanUtils.toBean(moldSubject, MoldSubjectRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得维保项目分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:query')")
|
||||||
|
public CommonResult<PageResult<MoldSubjectRespVO>> getMoldSubjectPage(@Valid MoldSubjectPageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldSubjectDO> pageResult = moldSubjectService.getMoldSubjectPage(pageReqVO);
|
||||||
|
PageResult<MoldSubjectRespVO> moldSubjectRespVOPageResult = BeanUtils.toBean(pageResult, MoldSubjectRespVO.class);
|
||||||
|
return success(buildCreatorName(moldSubjectRespVOPageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出维保项目 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-subject:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMoldSubjectExcel(@Valid MoldSubjectPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MoldSubjectDO> list = moldSubjectService.getMoldSubjectPage(pageReqVO).getList();
|
||||||
|
|
||||||
|
List<MoldSubjectRespVO> moldSubjectRespVOList = BeanUtils.toBean(list, MoldSubjectRespVO.class);
|
||||||
|
// 1. 获取字典数据
|
||||||
|
Map<String, Map<String, String>> dictData = getDictData();
|
||||||
|
|
||||||
|
for (MoldSubjectRespVO moldSubjectRespVO : moldSubjectRespVOList) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldSubjectRespVO.getCreator()));
|
||||||
|
moldSubjectRespVO.setCreatorName("(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
|
||||||
|
// 转换检验方式字典值
|
||||||
|
if (StringUtils.isNotBlank(moldSubjectRespVO.getInspectionMethod())) {
|
||||||
|
String inspectionMethodLabel = dictData.get("Inspection_method")
|
||||||
|
.get(moldSubjectRespVO.getInspectionMethod());
|
||||||
|
if (StringUtils.isNotBlank(inspectionMethodLabel)) {
|
||||||
|
// 可以创建一个临时字段存储,或者直接替换原字段
|
||||||
|
moldSubjectRespVO.setInspectionMethod(inspectionMethodLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换值类型字典值
|
||||||
|
if (StringUtils.isNotBlank(moldSubjectRespVO.getValueType())) {
|
||||||
|
String valueTypeLabel = dictData.get("value_types")
|
||||||
|
.get(moldSubjectRespVO.getValueType());
|
||||||
|
if (StringUtils.isNotBlank(valueTypeLabel)) {
|
||||||
|
moldSubjectRespVO.setValueType(valueTypeLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "维保项目.xls", "数据", MoldSubjectRespVO.class,
|
||||||
|
moldSubjectRespVOList );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private PageResult<MoldSubjectRespVO> buildCreatorName(PageResult<MoldSubjectRespVO> moldSubjectRespVOPageResult) {
|
||||||
|
for (MoldSubjectRespVO moldSubjectRespVO : moldSubjectRespVOPageResult.getList()) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldSubjectRespVO.getCreator()));
|
||||||
|
moldSubjectRespVO.setCreatorName("(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
|
||||||
|
return moldSubjectRespVOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典数据
|
||||||
|
*/
|
||||||
|
private Map<String, Map<String, String>> getDictData() {
|
||||||
|
Map<String, Map<String, String>> dictData = new HashMap<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取检验方式字典
|
||||||
|
Map<String, String> inspectionMethodDict = new HashMap<>();
|
||||||
|
List<DictDataRespDTO> inspectionMethods = dictDataApi.getDictDataList("Inspection_method");
|
||||||
|
for (DictDataRespDTO dict : inspectionMethods) {
|
||||||
|
inspectionMethodDict.put(dict.getValue(), dict.getLabel());
|
||||||
|
}
|
||||||
|
dictData.put("Inspection_method", inspectionMethodDict);
|
||||||
|
|
||||||
|
// 获取值类型字典
|
||||||
|
Map<String, String> valueTypeDict = new HashMap<>();
|
||||||
|
List<DictDataRespDTO> valueTypes = dictDataApi.getDictDataList("value_types");
|
||||||
|
for (DictDataRespDTO dict : valueTypes) {
|
||||||
|
valueTypeDict.put(dict.getValue(), dict.getLabel());
|
||||||
|
}
|
||||||
|
dictData.put("value_types", valueTypeDict);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("获取字典数据异常:" + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dictData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
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 MoldSubjectPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "项目编码")
|
||||||
|
private String subjectCode;
|
||||||
|
|
||||||
|
@Schema(description = "项目名称", example = "李四")
|
||||||
|
private String subjectName;
|
||||||
|
|
||||||
|
@Schema(description = "项目类型", example = "2")
|
||||||
|
private String subjectType;
|
||||||
|
|
||||||
|
@Schema(description = "项目内容")
|
||||||
|
private String subjectContent;
|
||||||
|
|
||||||
|
@Schema(description = "标准")
|
||||||
|
private String subjectStandard;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用")
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "值类型")
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
@Schema(description = "id集合导出用")
|
||||||
|
private String ids;
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 维保项目 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class MoldSubjectRespVO extends BaseDO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24679")
|
||||||
|
// @ExcelProperty("ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("项目编码")
|
||||||
|
private String subjectCode;
|
||||||
|
|
||||||
|
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@ExcelProperty("项目名称")
|
||||||
|
private String subjectName;
|
||||||
|
|
||||||
|
@Schema(description = "项目类型", example = "2")
|
||||||
|
// @ExcelProperty("项目类型")
|
||||||
|
private String subjectType;
|
||||||
|
|
||||||
|
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
// @ExcelProperty("项目内容")
|
||||||
|
private String subjectContent;
|
||||||
|
|
||||||
|
@Schema(description = "标准")
|
||||||
|
// @ExcelProperty("标准")
|
||||||
|
private String subjectStandard;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty(value = "是否启用", converter = DictConvert.class)
|
||||||
|
@DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式")
|
||||||
|
@ExcelProperty("检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "值类型")
|
||||||
|
@ExcelProperty("值类型")
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准")
|
||||||
|
@ExcelProperty("判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
@Schema(description = "创建人名字")
|
||||||
|
@ExcelProperty("创建人名字")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 维保项目新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class MoldSubjectSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24679")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "项目编码不能为空")
|
||||||
|
private String subjectCode;
|
||||||
|
|
||||||
|
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@NotEmpty(message = "项目名称不能为空")
|
||||||
|
private String subjectName;
|
||||||
|
|
||||||
|
@Schema(description = "项目类型", example = "2")
|
||||||
|
private String subjectType;
|
||||||
|
|
||||||
|
@Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
// @NotEmpty(message = "项目内容不能为空")
|
||||||
|
private String subjectContent;
|
||||||
|
|
||||||
|
@Schema(description = "标准")
|
||||||
|
private String subjectStandard;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "是否启用不能为空")
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
@Schema(description = "检验方式", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "检验方式")
|
||||||
|
private String inspectionMethod;
|
||||||
|
|
||||||
|
@Schema(description = "值类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "值类型")
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
|
@Schema(description = "判定基准", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "判定基准")
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.vo.PlanMaintenanceRespVO;
|
||||||
|
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 java.util.stream.Collectors;
|
||||||
|
|
||||||
|
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.moldtaskmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldtaskmanagement.MoldTaskManagementService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 任务管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/mold-task-management")
|
||||||
|
@Validated
|
||||||
|
public class MoldTaskManagementController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTaskManagementService moldtaskManagementService;
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建任务管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:create')")
|
||||||
|
public CommonResult<Long> createMoldTaskManagement(@Valid @RequestBody MoldTaskManagementSaveReqVO createReqVO) {
|
||||||
|
return success(moldtaskManagementService.createMoldTaskManagement(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新任务管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:update')")
|
||||||
|
public CommonResult<Boolean> updateMoldTaskManagement(@Valid @RequestBody MoldTaskManagementSaveReqVO updateReqVO) {
|
||||||
|
moldtaskManagementService.updateMoldTaskManagement(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除任务管理")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMoldTaskManagement(@RequestParam("ids") String ids) {
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldtaskManagementService.deleteMoldTaskManagement(idList);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得任务管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:query')")
|
||||||
|
public CommonResult<MoldTaskManagementRespVO> getMoldTaskManagement(@RequestParam("id") Long id) {
|
||||||
|
MoldTaskManagementDO moldtaskManagement = moldtaskManagementService.getMoldTaskManagement(id);
|
||||||
|
return success(BeanUtils.toBean(moldtaskManagement, MoldTaskManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得任务管理分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:query')")
|
||||||
|
public CommonResult<PageResult<MoldTaskManagementRespVO>> getMoldTaskManagementPage(@Valid MoldTaskManagementPageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldTaskManagementDO> pageResult = moldtaskManagementService.getMoldTaskManagementPage(pageReqVO);
|
||||||
|
|
||||||
|
PageResult<MoldTaskManagementRespVO> moldtaskManagementRespVOPageResult = BeanUtils.toBean(pageResult, MoldTaskManagementRespVO.class);
|
||||||
|
buildPageCreatorName(moldtaskManagementRespVOPageResult);
|
||||||
|
return success(moldtaskManagementRespVOPageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出任务管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMoldTaskManagementExcel(@Valid MoldTaskManagementPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MoldTaskManagementDO> list = moldtaskManagementService.getMoldTaskManagementPage(pageReqVO).getList();
|
||||||
|
List<MoldTaskManagementRespVO> moldtaskManagementRespVOList = BeanUtils.toBean(list, MoldTaskManagementRespVO.class);
|
||||||
|
|
||||||
|
for (MoldTaskManagementRespVO planMaintenanceRespVO : moldtaskManagementRespVOList) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(planMaintenanceRespVO.getCreator()));
|
||||||
|
planMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "模具类型.xls", "数据", MoldTaskManagementRespVO.class,moldtaskManagementRespVOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/createMoldTicket")
|
||||||
|
@Operation(summary = "创建工单管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-task-management:create')")
|
||||||
|
public CommonResult<Boolean> createTicket(@RequestParam("id") Long id) {
|
||||||
|
moldtaskManagementService.createMoldTicket(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private PageResult<MoldTaskManagementRespVO> buildPageCreatorName(PageResult<MoldTaskManagementRespVO> planMaintenanceRespVOPageResult) {
|
||||||
|
for (MoldTaskManagementRespVO planMaintenanceRespVO : planMaintenanceRespVOPageResult.getList()) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(planMaintenanceRespVO.getCreator()));
|
||||||
|
planMaintenanceRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return planMaintenanceRespVOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.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 MoldTaskManagementPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "李四")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型(1-点检 2-保养)", example = "2")
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
@Schema(description = "模具列表")
|
||||||
|
private String moldList;
|
||||||
|
|
||||||
|
@Schema(description = "项目表单")
|
||||||
|
private Long projectForm;
|
||||||
|
|
||||||
|
@Schema(description = "起止开始日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] startDate;
|
||||||
|
|
||||||
|
@Schema(description = "起止结束日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] endDate;
|
||||||
|
|
||||||
|
@Schema(description = "cron表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "可操作人")
|
||||||
|
private String operableUsers;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用")
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "id集合导出用")
|
||||||
|
private String ids;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
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 MoldTaskManagementRespVO extends BaseDO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26348")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型(1-点检 2-保养)", example = "2")
|
||||||
|
@ExcelProperty("类型(1-点检 2-保养)")
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
@Schema(description = "模具列表")
|
||||||
|
@ExcelProperty("模具列表")
|
||||||
|
private String moldList;
|
||||||
|
|
||||||
|
@Schema(description = "项目表单")
|
||||||
|
@ExcelProperty("项目表单")
|
||||||
|
private Long projectForm;
|
||||||
|
|
||||||
|
@Schema(description = "起止开始日期")
|
||||||
|
@ExcelProperty("起止开始日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate startDate;
|
||||||
|
|
||||||
|
@Schema(description = "起止结束日期")
|
||||||
|
@ExcelProperty("起止结束日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate endDate;
|
||||||
|
|
||||||
|
@Schema(description = "cron表达式")
|
||||||
|
@ExcelProperty("cron表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "可操作人")
|
||||||
|
@ExcelProperty("可操作人")
|
||||||
|
private String operableUsers;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("是否启用")
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建人名字")
|
||||||
|
@ExcelProperty("创建人名字")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
|
@Schema(description = "项目表单名称")
|
||||||
|
@ExcelProperty("项目表单名称")
|
||||||
|
private String projectFormName;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.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 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 MoldTaskManagementSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26348")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@NotEmpty(message = "名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型(1-点检 2-保养)", example = "2")
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
@Schema(description = "模具列表")
|
||||||
|
private String moldList;
|
||||||
|
|
||||||
|
@Schema(description = "项目表单")
|
||||||
|
private Long projectForm;
|
||||||
|
|
||||||
|
@Schema(description = "起止开始日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private String startDate;
|
||||||
|
|
||||||
|
@Schema(description = "起止结束日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private String endDate;
|
||||||
|
|
||||||
|
@Schema(description = "cron表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "可操作人")
|
||||||
|
private String operableUsers;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "是否启用不能为空")
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,127 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.erp.controller.admin.mold.vo.MoldRespVO;
|
||||||
|
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.moldticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldticketmanagement.MoldTicketManagementService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 工单管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/mold-ticket-management")
|
||||||
|
@Validated
|
||||||
|
public class MoldTicketManagementController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketManagementService moldticketManagementService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建工单管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:create')")
|
||||||
|
public CommonResult<Long> createMoldTicketManagement(@Valid @RequestBody MoldTicketManagementSaveReqVO createReqVO) {
|
||||||
|
return success(moldticketManagementService.createMoldTicketManagement(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新工单管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:update')")
|
||||||
|
public CommonResult<Boolean> updateMoldTicketManagement(@Valid @RequestBody MoldTicketManagementSaveReqVO updateReqVO) {
|
||||||
|
moldticketManagementService.updateMoldTicketManagement(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除工单管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMoldTicketManagement(@RequestParam("id") Long id) {
|
||||||
|
moldticketManagementService.deleteMoldTicketManagement(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得工单管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:query')")
|
||||||
|
public CommonResult<MoldTicketManagementRespVO> getMoldTicketManagement(@RequestParam("id") Long id) {
|
||||||
|
MoldTicketManagementDO moldticketManagement = moldticketManagementService.getMoldTicketManagement(id);
|
||||||
|
return success(BeanUtils.toBean(moldticketManagement, MoldTicketManagementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得工单管理分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:query')")
|
||||||
|
public CommonResult<PageResult<MoldTicketManagementRespVO>> getMoldTicketManagementPage(@Valid MoldTicketManagementPageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldTicketManagementDO> pageResult = moldticketManagementService.getMoldTicketManagementPage(pageReqVO);
|
||||||
|
return success(buildPageCreatorName(BeanUtils.toBean(pageResult, MoldTicketManagementRespVO.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出工单管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMoldTicketManagementExcel(@Valid MoldTicketManagementPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MoldTicketManagementDO> list = moldticketManagementService.getMoldTicketManagementPage(pageReqVO).getList();
|
||||||
|
List<MoldTicketManagementRespVO> moldticketManagementRespVOList = BeanUtils.toBean(list, MoldTicketManagementRespVO.class);
|
||||||
|
for (MoldTicketManagementRespVO moldticketManagementRespVO : moldticketManagementRespVOList) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldticketManagementRespVO.getCreator()));
|
||||||
|
moldticketManagementRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "工单管理.xls", "数据", MoldTicketManagementRespVO.class,
|
||||||
|
moldticketManagementRespVOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/batchUpdateStatus")
|
||||||
|
@Operation(summary = "批量取消工单")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-management:update')")
|
||||||
|
public CommonResult<Boolean> batchUpdateMoldTicketStatus(@Valid @RequestBody MoldTicketManagementBatchUpdateReqVO reqVO) {
|
||||||
|
moldticketManagementService.batchUpdateJobStatus(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageResult<MoldTicketManagementRespVO> buildPageCreatorName(PageResult<MoldTicketManagementRespVO> moldticketManagementRespVOPageResult) {
|
||||||
|
for (MoldTicketManagementRespVO moldticketManagementRespVO : moldticketManagementRespVOPageResult.getList()) {
|
||||||
|
AdminUserRespDTO user = adminUserApi.getUser(Long.valueOf(moldticketManagementRespVO.getCreator()));
|
||||||
|
moldticketManagementRespVO.setCreatorName( "(" + user.getUsername()+ ")" + user.getNickname());
|
||||||
|
if (moldticketManagementRespVO.getOperator()!=null){
|
||||||
|
AdminUserRespDTO operator = adminUserApi.getUser(Long.valueOf(moldticketManagementRespVO.getOperator()));
|
||||||
|
moldticketManagementRespVO.setOperatorName("(" + operator.getUsername()+ ")" + operator.getNickname());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return moldticketManagementRespVOPageResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划类型枚举
|
||||||
|
* 1-点检 2-保养
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum MoldPlanTypeEnum {
|
||||||
|
|
||||||
|
INSPECTION(1, "点检"),
|
||||||
|
MAINTENANCE(2, "保养");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
MoldPlanTypeEnum(Integer code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取枚举
|
||||||
|
*/
|
||||||
|
public static MoldPlanTypeEnum getByCode(Integer code) {
|
||||||
|
if (code == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (MoldPlanTypeEnum type : values()) {
|
||||||
|
if (type.getCode().equals(code)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取描述
|
||||||
|
*/
|
||||||
|
public static String getDescriptionByCode(Integer code) {
|
||||||
|
MoldPlanTypeEnum type = getByCode(code);
|
||||||
|
return type != null ? type.getDescription() : "未知";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查code是否有效
|
||||||
|
*/
|
||||||
|
public static boolean isValidCode(Integer code) {
|
||||||
|
return getByCode(code) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有code列表
|
||||||
|
*/
|
||||||
|
public static List<Integer> getAllCodes() {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(MoldPlanTypeEnum::getCode)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有描述列表
|
||||||
|
*/
|
||||||
|
public static List<String> getAllDescriptions() {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(MoldPlanTypeEnum::getDescription)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取code和描述的映射
|
||||||
|
*/
|
||||||
|
public static Map<Integer, String> getCodeDescriptionMap() {
|
||||||
|
Map<Integer, String> map = new LinkedHashMap<>();
|
||||||
|
for (MoldPlanTypeEnum type : values()) {
|
||||||
|
map.put(type.getCode(), type.getDescription());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.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 MoldTicketManagementPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", example = "21368")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", example = "20459")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "单号")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称", example = "张三")
|
||||||
|
private String moldName;
|
||||||
|
|
||||||
|
@Schema(description = "类型(1-点检 2-保养)", 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,92 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.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 MoldTicketManagementRespVO extends BaseDO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6566")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "任务Id", example = "21368")
|
||||||
|
// @ExcelProperty("项目ID")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", example = "20459")
|
||||||
|
// @ExcelProperty("方案ID")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "单号")
|
||||||
|
@ExcelProperty("单号")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称", example = "张三")
|
||||||
|
@ExcelProperty("设备名称")
|
||||||
|
private String moldName;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
@Schema(description = "作业人")
|
||||||
|
private String operator;
|
||||||
|
@Schema(description = "作业人名称")
|
||||||
|
@ExcelProperty("作业人名称")
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.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 MoldTicketManagementSaveReqVO {
|
||||||
|
|
||||||
|
@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 moldName;
|
||||||
|
|
||||||
|
@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.moldticketresults;
|
||||||
|
|
||||||
|
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.moldticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults.MoldTicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldticketresults.MoldTicketResultsService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 工单检验结果")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/mold-ticket-results")
|
||||||
|
@Validated
|
||||||
|
public class MoldTicketResultsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketResultsService moldticketResultsService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:create')")
|
||||||
|
public CommonResult<Long> createMoldTicketResults(@Valid @RequestBody MoldTicketResultsSaveReqVO createReqVO) {
|
||||||
|
return success(moldticketResultsService.createMoldTicketResults(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:update')")
|
||||||
|
public CommonResult<Boolean> updateMoldTicketResults(@Valid @RequestBody MoldTicketResultsSaveReqVO updateReqVO) {
|
||||||
|
moldticketResultsService.updateMoldTicketResults(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除工单检验结果")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMoldTicketResults(@RequestParam("id") Long id) {
|
||||||
|
moldticketResultsService.deleteMoldTicketResults(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得工单检验结果")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:query')")
|
||||||
|
public CommonResult<MoldTicketResultsRespVO> getMoldTicketResults(@RequestParam("id") Long id) {
|
||||||
|
MoldTicketResultsDO moldticketResults = moldticketResultsService.getMoldTicketResults(id);
|
||||||
|
return success(BeanUtils.toBean(moldticketResults, MoldTicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得工单检验结果分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:query')")
|
||||||
|
public CommonResult<PageResult<MoldTicketResultsRespVO>> getMoldTicketResultsPage(@Valid MoldTicketResultsPageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldTicketResultsDO> pageResult = moldticketResultsService.getMoldTicketResultsPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, MoldTicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出工单检验结果 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMoldTicketResultsExcel(@Valid MoldTicketResultsPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MoldTicketResultsDO> list = moldticketResultsService.getMoldTicketResultsPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "工单检验结果.xls", "数据", MoldTicketResultsRespVO.class,
|
||||||
|
BeanUtils.toBean(list, MoldTicketResultsRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/batchUpdate")
|
||||||
|
@Operation(summary = "批量更新工单检验结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:mold-ticket-results:update')")
|
||||||
|
public CommonResult<Boolean> batchUpdateMoldTicketResults(
|
||||||
|
@Valid @RequestBody List<MoldTicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
moldticketResultsService.batchUpdateMoldTicketResults(updateReqVOList);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.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 MoldTicketResultsPageReqVO 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,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.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 MoldTicketResultsRespVO {
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
@Schema(description = "模具Id")
|
||||||
|
private Long moldId;
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.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 MoldTicketResultsSaveReqVO {
|
||||||
|
|
||||||
|
@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,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan;
|
||||||
|
|
||||||
|
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.subjectmoldplan.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.subjectmoldplan.SubjectMoldPlanService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 项目方案关联")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/subject-mold-plan")
|
||||||
|
@Validated
|
||||||
|
public class SubjectMoldPlanController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubjectMoldPlanService subjectPlanService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建项目方案关联")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:create')")
|
||||||
|
public CommonResult<Long> createSubjectMoldPlan(@Valid @RequestBody SubjectMoldPlanSaveReqVO createReqVO) {
|
||||||
|
return success(subjectPlanService.createSubjectMoldPlan(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新项目方案关联")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:update')")
|
||||||
|
public CommonResult<Boolean> updateSubjectMoldPlan(@Valid @RequestBody SubjectMoldPlanSaveReqVO updateReqVO) {
|
||||||
|
subjectPlanService.updateSubjectMoldPlan(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除项目方案关联")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSubjectMoldPlan(@RequestParam("id") Long id) {
|
||||||
|
subjectPlanService.deleteSubjectMoldPlan(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得项目方案关联")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:query')")
|
||||||
|
public CommonResult<SubjectMoldPlanRespVO> getSubjectMoldPlan(@RequestParam("id") Long id) {
|
||||||
|
SubjectMoldPlanDO subjectPlan = subjectPlanService.getSubjectMoldPlan(id);
|
||||||
|
return success(BeanUtils.toBean(subjectPlan, SubjectMoldPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得项目方案关联分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:query')")
|
||||||
|
public CommonResult<PageResult<SubjectMoldPlanRespVO>> getSubjectMoldPlanPage(@Valid SubjectMoldPlanPageReqVO pageReqVO) {
|
||||||
|
PageResult<SubjectMoldPlanDO> pageResult = subjectPlanService.getSubjectMoldPlanPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, SubjectMoldPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出项目方案关联 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:subject-mold-plan:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportSubjectMoldPlanExcel(@Valid SubjectMoldPlanPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<SubjectMoldPlanDO> list = subjectPlanService.getSubjectMoldPlanPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "项目方案关联.xls", "数据", SubjectMoldPlanRespVO.class,
|
||||||
|
BeanUtils.toBean(list, SubjectMoldPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.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 SubjectMoldPlanPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", example = "21197")
|
||||||
|
private String subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", example = "19398")
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.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 SubjectMoldPlanRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29831")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21197")
|
||||||
|
@ExcelProperty("项目ID")
|
||||||
|
private String subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19398")
|
||||||
|
@ExcelProperty("方案ID")
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.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 SubjectMoldPlanSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29831")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21197")
|
||||||
|
@NotEmpty(message = "项目ID不能为空")
|
||||||
|
private String subjectId;
|
||||||
|
|
||||||
|
@Schema(description = "方案ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19398")
|
||||||
|
@NotEmpty(message = "方案ID不能为空")
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.energyrecord;
|
||||||
|
|
||||||
|
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_energy_record")
|
||||||
|
@KeySequence("mes_energy_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnergyRecordDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 能源设备id
|
||||||
|
*/
|
||||||
|
private Long energyDeviceId;
|
||||||
|
/**
|
||||||
|
* 能耗历史数据
|
||||||
|
*/
|
||||||
|
private String recordData;
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance;
|
||||||
|
|
||||||
|
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_mold_plan_maintenance")
|
||||||
|
@KeySequence("mes_mold_plan_maintenance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MoldPlanMaintenanceDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String planName;
|
||||||
|
/**
|
||||||
|
* 类型 1-保养 2-维护
|
||||||
|
*/
|
||||||
|
private int planType;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id集合
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<Long> subjectIds;
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject;
|
||||||
|
|
||||||
|
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_mold_subject")
|
||||||
|
@KeySequence("mes_mold_subject_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MoldSubjectDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 项目编码
|
||||||
|
*/
|
||||||
|
private String subjectCode;
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String subjectName;
|
||||||
|
/**
|
||||||
|
* 项目类型
|
||||||
|
*/
|
||||||
|
private String subjectType;
|
||||||
|
/**
|
||||||
|
* 项目内容
|
||||||
|
*/
|
||||||
|
private String subjectContent;
|
||||||
|
/**
|
||||||
|
* 标准
|
||||||
|
*/
|
||||||
|
private String subjectStandard;
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO infra_boolean_string 对应的类}
|
||||||
|
*/
|
||||||
|
private Boolean isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验方式
|
||||||
|
*/
|
||||||
|
private String inspectionMethod;
|
||||||
|
/**
|
||||||
|
* 值类型
|
||||||
|
*/
|
||||||
|
private String valueType;
|
||||||
|
/**
|
||||||
|
* 判定基准
|
||||||
|
*/
|
||||||
|
private String judgmentCriteria;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement;
|
||||||
|
|
||||||
|
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.time.*;
|
||||||
|
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_mold_task_management")
|
||||||
|
@KeySequence("mes_mold_task_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MoldTaskManagementDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 类型(1-点检 2-保养)
|
||||||
|
*/
|
||||||
|
private Integer taskType;
|
||||||
|
/**
|
||||||
|
* 模具列表
|
||||||
|
*/
|
||||||
|
private String moldList;
|
||||||
|
/**
|
||||||
|
* 项目表单
|
||||||
|
*/
|
||||||
|
private Long projectForm;
|
||||||
|
/**
|
||||||
|
* 起止开始日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDate startDate;
|
||||||
|
/**
|
||||||
|
* 起止结束日期
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDate endDate;
|
||||||
|
/**
|
||||||
|
* cron表达式
|
||||||
|
*/
|
||||||
|
private String cronExpression;
|
||||||
|
/**
|
||||||
|
* 可操作人
|
||||||
|
*/
|
||||||
|
private String operableUsers;
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String projectFormName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement;
|
||||||
|
|
||||||
|
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_mold_ticket_management")
|
||||||
|
@KeySequence("mes_mold_ticket_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MoldTicketManagementDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 任务ID
|
||||||
|
*/
|
||||||
|
private Long taskId;
|
||||||
|
/**
|
||||||
|
* 方案ID
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
/**
|
||||||
|
* 单号
|
||||||
|
*/
|
||||||
|
private String planNo;
|
||||||
|
/**
|
||||||
|
* 模具名称
|
||||||
|
*/
|
||||||
|
private String moldName;
|
||||||
|
/**
|
||||||
|
* 类型(1-点检 2-保养)
|
||||||
|
*/
|
||||||
|
private int planType;
|
||||||
|
/**
|
||||||
|
* 计划配置名称
|
||||||
|
*/
|
||||||
|
private String configName;
|
||||||
|
/**
|
||||||
|
* 作业状态 0-待完成 1-已完成 2-已取消
|
||||||
|
*/
|
||||||
|
private Integer jobStatus;
|
||||||
|
/**
|
||||||
|
* 作业结果 0-待完成 1-通过 2-不通过
|
||||||
|
*/
|
||||||
|
private int jobResult;
|
||||||
|
/**
|
||||||
|
* 作业人
|
||||||
|
*/
|
||||||
|
private String operator;
|
||||||
|
/**
|
||||||
|
* 作业开始时间
|
||||||
|
*/
|
||||||
|
@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,68 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults;
|
||||||
|
|
||||||
|
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_mold_ticket_results")
|
||||||
|
@KeySequence("mes_mold_ticket_results_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MoldTicketResultsDO 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;
|
||||||
|
/**
|
||||||
|
* 模具id
|
||||||
|
*/
|
||||||
|
private Long moldId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan;
|
||||||
|
|
||||||
|
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_subject_mold_plan")
|
||||||
|
@KeySequence("mes_subject_mold_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SubjectMoldPlanDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
private Long subjectId;
|
||||||
|
/**
|
||||||
|
* 方案ID
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.energyrecord;
|
||||||
|
|
||||||
|
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.energyrecord.EnergyRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.energyrecord.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 能源设备历史记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface EnergyRecordMapper extends BaseMapperX<EnergyRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<EnergyRecordDO> selectPage(EnergyRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<EnergyRecordDO>()
|
||||||
|
.eqIfPresent(EnergyRecordDO::getEnergyDeviceId, reqVO.getEnergyDeviceId())
|
||||||
|
.eqIfPresent(EnergyRecordDO::getRecordData, reqVO.getRecordData())
|
||||||
|
.eqIfPresent(EnergyRecordDO::getIsEnable, reqVO.getIsEnable())
|
||||||
|
.betweenIfPresent(EnergyRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(EnergyRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.moldplanmaintenance;
|
||||||
|
|
||||||
|
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.dvsubject.DvSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方案维护 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MoldPlanMaintenanceMapper extends BaseMapperX<MoldPlanMaintenanceDO> {
|
||||||
|
|
||||||
|
default PageResult<MoldPlanMaintenanceDO> selectPage(MoldPlanMaintenancePageReqVO reqVO) {
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<MoldPlanMaintenanceDO> moldplanMaintenanceDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
moldplanMaintenanceDOLambdaQueryWrapperX
|
||||||
|
.likeIfPresent(MoldPlanMaintenanceDO::getPlanName, reqVO.getPlanName())
|
||||||
|
.eqIfPresent(MoldPlanMaintenanceDO::getPlanType, reqVO.getPlanType())
|
||||||
|
.eqIfPresent(MoldPlanMaintenanceDO::getDescription, reqVO.getDescription())
|
||||||
|
.betweenIfPresent(MoldPlanMaintenanceDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MoldPlanMaintenanceDO::getCreateTime);
|
||||||
|
|
||||||
|
// 单独处理 ids 条件
|
||||||
|
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||||
|
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldplanMaintenanceDOLambdaQueryWrapperX.in(MoldPlanMaintenanceDO::getId, idList);
|
||||||
|
}
|
||||||
|
PageResult<MoldPlanMaintenanceDO> moldplanMaintenanceDOPageResult = selectPage(reqVO, moldplanMaintenanceDOLambdaQueryWrapperX);
|
||||||
|
|
||||||
|
|
||||||
|
return moldplanMaintenanceDOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.moldsubject;
|
||||||
|
|
||||||
|
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.deviceledger.DeviceLedgerDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维保项目 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MoldSubjectMapper extends BaseMapperX<MoldSubjectDO> {
|
||||||
|
|
||||||
|
default PageResult<MoldSubjectDO> selectPage(MoldSubjectPageReqVO reqVO) {
|
||||||
|
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<MoldSubjectDO> moldSubjectDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
moldSubjectDOLambdaQueryWrapperX
|
||||||
|
.likeIfPresent(MoldSubjectDO::getInspectionMethod, reqVO.getInspectionMethod())
|
||||||
|
.likeIfPresent(MoldSubjectDO::getValueType, reqVO.getValueType())
|
||||||
|
.likeIfPresent(MoldSubjectDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
|
||||||
|
.likeIfPresent(MoldSubjectDO::getSubjectCode, reqVO.getSubjectCode())
|
||||||
|
.likeIfPresent(MoldSubjectDO::getSubjectName, reqVO.getSubjectName())
|
||||||
|
.eqIfPresent(MoldSubjectDO::getSubjectType, reqVO.getSubjectType())
|
||||||
|
.eqIfPresent(MoldSubjectDO::getSubjectContent, reqVO.getSubjectContent())
|
||||||
|
.eqIfPresent(MoldSubjectDO::getSubjectStandard, reqVO.getSubjectStandard())
|
||||||
|
.eqIfPresent(MoldSubjectDO::getIsEnable, reqVO.getIsEnable())
|
||||||
|
.betweenIfPresent(MoldSubjectDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MoldSubjectDO::getCreateTime);
|
||||||
|
|
||||||
|
// 单独处理 ids 条件
|
||||||
|
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||||
|
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldSubjectDOLambdaQueryWrapperX.in(MoldSubjectDO::getId, idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selectPage(reqVO, moldSubjectDOLambdaQueryWrapperX);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.moldtaskmanagement;
|
||||||
|
|
||||||
|
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.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模具类型 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MoldTaskManagementMapper extends BaseMapperX<MoldTaskManagementDO> {
|
||||||
|
|
||||||
|
default PageResult<MoldTaskManagementDO> selectPage(MoldTaskManagementPageReqVO reqVO) {
|
||||||
|
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<MoldTaskManagementDO> moldtaskManagementDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
moldtaskManagementDOLambdaQueryWrapperX
|
||||||
|
.likeIfPresent(MoldTaskManagementDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getTaskType, reqVO.getTaskType())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getMoldList, reqVO.getMoldList())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getProjectForm, reqVO.getProjectForm())
|
||||||
|
.betweenIfPresent(MoldTaskManagementDO::getStartDate, reqVO.getStartDate())
|
||||||
|
.betweenIfPresent(MoldTaskManagementDO::getEndDate, reqVO.getEndDate())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getCronExpression, reqVO.getCronExpression())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getOperableUsers, reqVO.getOperableUsers())
|
||||||
|
.eqIfPresent(MoldTaskManagementDO::getEnabled, reqVO.getEnabled())
|
||||||
|
.betweenIfPresent(MoldTaskManagementDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MoldTaskManagementDO::getId);
|
||||||
|
|
||||||
|
// 单独处理 ids 条件
|
||||||
|
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||||
|
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
moldtaskManagementDOLambdaQueryWrapperX.in(MoldTaskManagementDO::getId, idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return selectPage(reqVO, moldtaskManagementDOLambdaQueryWrapperX);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.moldticketmanagement;
|
||||||
|
|
||||||
|
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.moldtaskmanagement.MoldTaskManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MoldTicketManagementMapper extends BaseMapperX<MoldTicketManagementDO> {
|
||||||
|
|
||||||
|
default PageResult<MoldTicketManagementDO> selectPage(MoldTicketManagementPageReqVO reqVO) {
|
||||||
|
|
||||||
|
LambdaQueryWrapperX<MoldTicketManagementDO> ticketManagementDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
ticketManagementDOLambdaQueryWrapperX
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getTaskId, reqVO.getTaskId())
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getPlanId, reqVO.getPlanId())
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getPlanNo, reqVO.getPlanNo())
|
||||||
|
.likeIfPresent(MoldTicketManagementDO::getMoldName, reqVO.getMoldName())
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getPlanType, reqVO.getPlanType())
|
||||||
|
.likeIfPresent(MoldTicketManagementDO::getConfigName, reqVO.getConfigName())
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getJobStatus, reqVO.getJobStatus())
|
||||||
|
.eqIfPresent(MoldTicketManagementDO::getJobResult, reqVO.getJobResult())
|
||||||
|
.orderByDesc(MoldTicketManagementDO::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(MoldTicketManagementDO::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,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.moldticketresults;
|
||||||
|
|
||||||
|
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.moldticketresults.MoldTicketResultsDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MoldTicketResultsMapper extends BaseMapperX<MoldTicketResultsDO> {
|
||||||
|
|
||||||
|
default PageResult<MoldTicketResultsDO> selectPage(MoldTicketResultsPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<MoldTicketResultsDO>()
|
||||||
|
.likeIfPresent(MoldTicketResultsDO::getInspectionItemName, reqVO.getInspectionItemName())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getInspectionMethod, reqVO.getInspectionMethod())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getInspectionResult, reqVO.getInspectionResult())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getImages, reqVO.getImages())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(MoldTicketResultsDO::getInspectionTime, reqVO.getInspectionTime())
|
||||||
|
.eqIfPresent(MoldTicketResultsDO::getManagementId, reqVO.getManagementId())
|
||||||
|
.betweenIfPresent(MoldTicketResultsDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MoldTicketResultsDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MoldTicketResultsDO> findByDeviceIdAndPlanType(@Param("deviceId") Long deviceId,@Param("planType") Integer planType);
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.subjectmoldplan;
|
||||||
|
|
||||||
|
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.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SubjectMoldPlanMapper extends BaseMapperX<SubjectMoldPlanDO> {
|
||||||
|
|
||||||
|
default PageResult<SubjectMoldPlanDO> selectPage(SubjectMoldPlanPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<SubjectMoldPlanDO>()
|
||||||
|
.eqIfPresent(SubjectMoldPlanDO::getSubjectId, reqVO.getSubjectId())
|
||||||
|
.eqIfPresent(SubjectMoldPlanDO::getPlanId, reqVO.getPlanId())
|
||||||
|
.betweenIfPresent(SubjectMoldPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(SubjectMoldPlanDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除指定计划的关联
|
||||||
|
*
|
||||||
|
* @param planId 计划ID
|
||||||
|
*/
|
||||||
|
@Delete("DELETE FROM besure.mes_subject_mold_plan WHERE plan_id = #{planId}")
|
||||||
|
void deleteByPlanId(Long planId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.energyrecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.energyrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.energyrecord.EnergyRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 能源设备历史记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface EnergyRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建能源设备历史记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createEnergyRecord(@Valid EnergyRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新能源设备历史记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateEnergyRecord(@Valid EnergyRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除能源设备历史记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteEnergyRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得能源设备历史记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 能源设备历史记录
|
||||||
|
*/
|
||||||
|
EnergyRecordDO getEnergyRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得能源设备历史记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 能源设备历史记录分页
|
||||||
|
*/
|
||||||
|
PageResult<EnergyRecordDO> getEnergyRecordPage(EnergyRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.energyrecord;
|
||||||
|
|
||||||
|
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 cn.iocoder.yudao.module.mes.controller.admin.energyrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.energyrecord.EnergyRecordDO;
|
||||||
|
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.energyrecord.EnergyRecordMapper;
|
||||||
|
|
||||||
|
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 EnergyRecordServiceImpl implements EnergyRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnergyRecordMapper energyRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createEnergyRecord(EnergyRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
EnergyRecordDO energyRecord = BeanUtils.toBean(createReqVO, EnergyRecordDO.class);
|
||||||
|
energyRecordMapper.insert(energyRecord);
|
||||||
|
// 返回
|
||||||
|
return energyRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEnergyRecord(EnergyRecordSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateEnergyRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
EnergyRecordDO updateObj = BeanUtils.toBean(updateReqVO, EnergyRecordDO.class);
|
||||||
|
energyRecordMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteEnergyRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateEnergyRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
energyRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateEnergyRecordExists(Long id) {
|
||||||
|
if (energyRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(ENERGY_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnergyRecordDO getEnergyRecord(Long id) {
|
||||||
|
return energyRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<EnergyRecordDO> getEnergyRecordPage(EnergyRecordPageReqVO pageReqVO) {
|
||||||
|
return energyRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldplanmaintenance;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldplanmaintenance.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方案维护 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface MoldPlanMaintenanceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建方案维护
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMoldPlanMaintenance(@Valid MoldPlanMaintenanceSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新方案维护
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMoldPlanMaintenance(@Valid MoldPlanMaintenanceSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除方案维护
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMoldPlanMaintenance( List<Long> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得方案维护
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 方案维护
|
||||||
|
*/
|
||||||
|
MoldPlanMaintenanceDO getMoldPlanMaintenance(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得方案维护分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 方案维护分页
|
||||||
|
*/
|
||||||
|
PageResult<MoldPlanMaintenanceDO> getMoldPlanMaintenancePage(MoldPlanMaintenancePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
List<MoldSubjectDO> getSubjectList(Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldplanmaintenance;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldsubject.MoldSubjectMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.subjectmoldplan.SubjectMoldPlanMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldplanmaintenance.MoldPlanMaintenanceService;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.subjectmoldplan.SubjectMoldPlanService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
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.moldplanmaintenance.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
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.moldplanmaintenance.MoldPlanMaintenanceMapper;
|
||||||
|
|
||||||
|
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 MoldPlanMaintenanceServiceImpl implements MoldPlanMaintenanceService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldPlanMaintenanceMapper moldplanMaintenanceMapper;
|
||||||
|
@Resource
|
||||||
|
private SubjectMoldPlanMapper subjectMoldPlanMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldSubjectMapper moldSubjectMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Long createMoldPlanMaintenance(MoldPlanMaintenanceSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MoldPlanMaintenanceDO moldplanMaintenance = BeanUtils.toBean(createReqVO, MoldPlanMaintenanceDO.class);
|
||||||
|
moldplanMaintenanceMapper.insert(moldplanMaintenance);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(createReqVO.getSubjectIdS())){
|
||||||
|
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream( createReqVO.getSubjectIdS().split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
//插入关联表
|
||||||
|
insertSubjectMoldPlan(moldplanMaintenance.getId(),idList);
|
||||||
|
}
|
||||||
|
// 返回
|
||||||
|
return moldplanMaintenance.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertSubjectMoldPlan(Long id, List<Long> idList) {
|
||||||
|
|
||||||
|
List<SubjectMoldPlanDO> subjectMoldPlanDOArrayList = new ArrayList<>();
|
||||||
|
for (Long subjectId : idList) {
|
||||||
|
SubjectMoldPlanDO subjectMoldPlanDO = new SubjectMoldPlanDO();
|
||||||
|
subjectMoldPlanDO.setPlanId(id);
|
||||||
|
subjectMoldPlanDO.setSubjectId(subjectId);
|
||||||
|
subjectMoldPlanDOArrayList.add(subjectMoldPlanDO);
|
||||||
|
}
|
||||||
|
subjectMoldPlanMapper.insertBatch(subjectMoldPlanDOArrayList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateMoldPlanMaintenance(MoldPlanMaintenanceSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldPlanMaintenanceExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MoldPlanMaintenanceDO updateObj = BeanUtils.toBean(updateReqVO, MoldPlanMaintenanceDO.class);
|
||||||
|
moldplanMaintenanceMapper.updateById(updateObj);
|
||||||
|
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(updateReqVO.getSubjectIdS())) {
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream( updateReqVO.getSubjectIdS().split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
//更新关联表
|
||||||
|
updateSubjectMoldPlan(updateObj.getId(),idList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSubjectMoldPlan(Long id, List<Long> idList) {
|
||||||
|
|
||||||
|
subjectMoldPlanMapper.deleteByPlanId(id);
|
||||||
|
List<SubjectMoldPlanDO> subjectMoldPlanDOArrayList = new ArrayList<>();
|
||||||
|
for (Long subjectId : idList) {
|
||||||
|
SubjectMoldPlanDO subjectMoldPlanDO = new SubjectMoldPlanDO();
|
||||||
|
subjectMoldPlanDO.setPlanId(id);
|
||||||
|
subjectMoldPlanDO.setSubjectId(subjectId);
|
||||||
|
subjectMoldPlanDOArrayList.add(subjectMoldPlanDO);
|
||||||
|
}
|
||||||
|
subjectMoldPlanMapper.insertBatch(subjectMoldPlanDOArrayList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteMoldPlanMaintenance( List<Long> idList) {
|
||||||
|
for (Long id : idList) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldPlanMaintenanceExists(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
moldplanMaintenanceMapper.deleteByIds(idList);
|
||||||
|
//删除关联表数据
|
||||||
|
deleteSubjectMoldPlan(idList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteSubjectMoldPlan(List<Long> idList) {
|
||||||
|
for (Long id : idList) {
|
||||||
|
if (id != null ){
|
||||||
|
subjectMoldPlanMapper.delete(Wrappers.<SubjectMoldPlanDO>lambdaQuery()
|
||||||
|
.eq(SubjectMoldPlanDO::getPlanId, id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMoldPlanMaintenanceExists(Long id) {
|
||||||
|
if (moldplanMaintenanceMapper.selectById(id) == null) {
|
||||||
|
throw exception(PLAN_MAINTENANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoldPlanMaintenanceDO getMoldPlanMaintenance(Long id) {
|
||||||
|
return moldplanMaintenanceMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MoldPlanMaintenanceDO> getMoldPlanMaintenancePage(MoldPlanMaintenancePageReqVO pageReqVO) {
|
||||||
|
PageResult<MoldPlanMaintenanceDO> moldplanMaintenanceDOPageResult = moldplanMaintenanceMapper.selectPage(pageReqVO);
|
||||||
|
for (MoldPlanMaintenanceDO moldplanMaintenanceDO : moldplanMaintenanceDOPageResult.getList()) {
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
List<SubjectMoldPlanDO> subjectMoldPlanDOList = subjectMoldPlanMapper.selectList(Wrappers.<SubjectMoldPlanDO>lambdaQuery()
|
||||||
|
.eq(SubjectMoldPlanDO::getPlanId, moldplanMaintenanceDO.getId()));
|
||||||
|
for (SubjectMoldPlanDO subjectMoldPlanDO : subjectMoldPlanDOList) {
|
||||||
|
ids.add(subjectMoldPlanDO.getSubjectId());
|
||||||
|
}
|
||||||
|
moldplanMaintenanceDO.setSubjectIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return moldplanMaintenanceDOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MoldSubjectDO> getSubjectList(Long id) {
|
||||||
|
if (id == null ){
|
||||||
|
throw exception(SUBJECT_ID_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
//查询对应的设备列表
|
||||||
|
List<MoldSubjectDO> moldSubjectDOList = new ArrayList<>();
|
||||||
|
List<SubjectMoldPlanDO> subjectMoldPlanDOList = subjectMoldPlanMapper.selectList(Wrappers.<SubjectMoldPlanDO>lambdaQuery()
|
||||||
|
.eq(SubjectMoldPlanDO::getPlanId, id));
|
||||||
|
for (SubjectMoldPlanDO subjectMoldPlanDO : subjectMoldPlanDOList) {
|
||||||
|
MoldSubjectDO moldSubjectDO = moldSubjectMapper.selectById(subjectMoldPlanDO.getSubjectId());
|
||||||
|
if (moldSubjectDO!=null){
|
||||||
|
moldSubjectDOList.add(moldSubjectDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return moldSubjectDOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldsubject;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维保项目 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface MoldSubjectService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建维保项目
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMoldSubject(@Valid MoldSubjectSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新维保项目
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMoldSubject(@Valid MoldSubjectSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除维保项目
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMoldSubject(List<Long> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得维保项目
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 维保项目
|
||||||
|
*/
|
||||||
|
MoldSubjectDO getMoldSubject(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得维保项目分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 维保项目分页
|
||||||
|
*/
|
||||||
|
PageResult<MoldSubjectDO> getMoldSubjectPage(MoldSubjectPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldsubject;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldsubject.vo.MoldSubjectSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldsubject.MoldSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldsubject.MoldSubjectMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldsubject.MoldSubjectService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维保项目 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MoldSubjectServiceImpl implements MoldSubjectService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldSubjectMapper moldSubjectMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMoldSubject(MoldSubjectSaveReqVO createReqVO) {
|
||||||
|
|
||||||
|
validateCodeOnly(createReqVO.getSubjectCode());
|
||||||
|
// 插入
|
||||||
|
MoldSubjectDO moldSubject = BeanUtils.toBean(createReqVO, MoldSubjectDO.class);
|
||||||
|
moldSubjectMapper.insert(moldSubject);
|
||||||
|
// 返回
|
||||||
|
return moldSubject.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateCodeOnly( String code) {
|
||||||
|
if (moldSubjectMapper.exists(Wrappers.<MoldSubjectDO>lambdaQuery()
|
||||||
|
.eq(MoldSubjectDO::getSubjectCode, code))) {
|
||||||
|
throw exception(SUBJECT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMoldSubject(MoldSubjectSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldSubjectExists(updateReqVO.getId());
|
||||||
|
|
||||||
|
//编码重复判断
|
||||||
|
Long count = moldSubjectMapper.selectCount(new LambdaQueryWrapper<MoldSubjectDO>()
|
||||||
|
.eq(MoldSubjectDO::getSubjectCode, updateReqVO.getSubjectCode())
|
||||||
|
.ne(MoldSubjectDO::getId, updateReqVO.getId())
|
||||||
|
);
|
||||||
|
if (count > 0) {
|
||||||
|
throw exception(SUBJECT_EXISTS);
|
||||||
|
}
|
||||||
|
// 更新
|
||||||
|
MoldSubjectDO updateObj = BeanUtils.toBean(updateReqVO, MoldSubjectDO.class);
|
||||||
|
moldSubjectMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMoldSubject(List<Long> idList) {
|
||||||
|
|
||||||
|
for (Long id : idList) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldSubjectExists(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
moldSubjectMapper.deleteByIds(idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMoldSubjectExists(Long id) {
|
||||||
|
if (moldSubjectMapper.selectById(id) == null) {
|
||||||
|
throw exception(DV_SUBJECT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoldSubjectDO getMoldSubject(Long id) {
|
||||||
|
return moldSubjectMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MoldSubjectDO> getMoldSubjectPage(MoldSubjectPageReqVO pageReqVO) {
|
||||||
|
return moldSubjectMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldtaskmanagement;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface MoldTaskManagementService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建设备类型
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMoldTaskManagement(@Valid MoldTaskManagementSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备类型
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMoldTaskManagement(@Valid MoldTaskManagementSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备类型
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMoldTaskManagement(List<Long> idList );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备类型
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 设备类型
|
||||||
|
*/
|
||||||
|
MoldTaskManagementDO getMoldTaskManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备类型分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 设备类型分页
|
||||||
|
*/
|
||||||
|
PageResult<MoldTaskManagementDO> getMoldTaskManagementPage(MoldTaskManagementPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
void createMoldTicket(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldtaskmanagement;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvsubject.DvSubjectDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldplanmaintenance.MoldPlanMaintenanceDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults.MoldTicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvsubject.DvSubjectMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldplanmaintenance.MoldPlanMaintenanceMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.subjectplan.SubjectPlanMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldticketmanagement.MoldTicketManagementMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldticketresults.MoldTicketResultsMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldtaskmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldtaskmanagement.MoldTaskManagementDO;
|
||||||
|
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.moldtaskmanagement.MoldTaskManagementMapper;
|
||||||
|
|
||||||
|
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 MoldTaskManagementServiceImpl implements MoldTaskManagementService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTaskManagementMapper moldtaskManagementMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketManagementMapper moldticketManagementMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketResultsMapper moldticketResultsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldMapper moldMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldPlanMaintenanceMapper moldplanMaintenanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubjectPlanMapper subjectPlanMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DvSubjectMapper dvSubjectMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMoldTaskManagement(MoldTaskManagementSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MoldTaskManagementDO moldtaskManagement = BeanUtils.toBean(createReqVO, MoldTaskManagementDO.class);
|
||||||
|
moldtaskManagementMapper.insert(moldtaskManagement);
|
||||||
|
// 返回
|
||||||
|
return moldtaskManagement.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMoldTaskManagement(MoldTaskManagementSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTaskManagementExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MoldTaskManagementDO updateObj = BeanUtils.toBean(updateReqVO, MoldTaskManagementDO.class);
|
||||||
|
moldtaskManagementMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMoldTaskManagement(List<Long> idList ) {
|
||||||
|
for (Long id : idList) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTaskManagementExists(id);
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
moldtaskManagementMapper.deleteByIds(idList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMoldTaskManagementExists(Long id) {
|
||||||
|
if (moldtaskManagementMapper.selectById(id) == null) {
|
||||||
|
throw exception(TASK_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoldTaskManagementDO getMoldTaskManagement(Long id) {
|
||||||
|
return moldtaskManagementMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MoldTaskManagementDO> getMoldTaskManagementPage(MoldTaskManagementPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
PageResult<MoldTaskManagementDO> moldtaskManagementDOPageResult = moldtaskManagementMapper.selectPage(pageReqVO);
|
||||||
|
for (MoldTaskManagementDO moldtaskManagementDO : moldtaskManagementDOPageResult.getList()) {
|
||||||
|
MoldPlanMaintenanceDO moldplanMaintenanceDO = moldplanMaintenanceMapper.selectById(moldtaskManagementDO.getProjectForm());
|
||||||
|
moldtaskManagementDO.setProjectFormName(moldplanMaintenanceDO.getPlanName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return moldtaskManagementDOPageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMoldTicket(Long id) {
|
||||||
|
|
||||||
|
List<MoldTicketManagementDO> moldticketManagementDOS = new ArrayList<>();
|
||||||
|
|
||||||
|
//检验数据是否存在
|
||||||
|
validateMoldTaskManagementExists(id);
|
||||||
|
MoldTaskManagementDO moldtaskManagementDO = moldtaskManagementMapper.selectById(id);
|
||||||
|
if (moldtaskManagementDO == null){
|
||||||
|
throw exception(TASK_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将逗号分隔的字符串转换为Long类型的List
|
||||||
|
List<Long> idList = Arrays.stream(moldtaskManagementDO.getMoldList().split(","))
|
||||||
|
.map(String::trim) // 去除可能存在的空格
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
for (Long moldId : idList) {
|
||||||
|
MoldTicketManagementDO moldticketManagementDO = new MoldTicketManagementDO();
|
||||||
|
MoldDO moldDO = moldMapper.selectById(moldId);
|
||||||
|
moldticketManagementDO.setTaskId(moldtaskManagementDO.getId());
|
||||||
|
moldticketManagementDO.setPlanNo(generatePrefixedOrderNo());
|
||||||
|
moldticketManagementDO.setPlanId(moldtaskManagementDO.getProjectForm());
|
||||||
|
moldticketManagementDO.setMoldName(moldDO.getName());
|
||||||
|
moldticketManagementDO.setPlanType(moldtaskManagementDO.getTaskType());
|
||||||
|
moldticketManagementDO.setConfigName(moldtaskManagementDO.getName());
|
||||||
|
moldticketManagementDO.setTaskEndTime(moldtaskManagementDO.getEndDate().atStartOfDay());
|
||||||
|
moldticketManagementMapper.insert(moldticketManagementDO);
|
||||||
|
|
||||||
|
List<DvSubjectDO> dvSubjectDOList = new ArrayList<>();
|
||||||
|
List<SubjectPlanDO> subjectPlanDOList = subjectPlanMapper.selectList(Wrappers.<SubjectPlanDO>lambdaQuery().eq(SubjectPlanDO::getPlanId, moldticketManagementDO.getPlanId()));
|
||||||
|
for (SubjectPlanDO subjectPlanDO : subjectPlanDOList) {
|
||||||
|
DvSubjectDO dvSubjectDO = dvSubjectMapper.selectById(subjectPlanDO.getSubjectId());
|
||||||
|
|
||||||
|
MoldTicketResultsDO moldticketResultsDO = new MoldTicketResultsDO();
|
||||||
|
moldticketResultsDO.setInspectionItemName(dvSubjectDO.getSubjectName());
|
||||||
|
moldticketResultsDO.setInspectionMethod(dvSubjectDO.getInspectionMethod());
|
||||||
|
moldticketResultsDO.setJudgmentCriteria(dvSubjectDO.getJudgmentCriteria());
|
||||||
|
moldticketResultsDO.setManagementId(moldticketManagementDO.getId());
|
||||||
|
moldticketResultsDO.setMoldId(moldId);
|
||||||
|
moldticketResultsMapper.insert(moldticketResultsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带前缀的时间戳单号
|
||||||
|
*/
|
||||||
|
public static String generatePrefixedOrderNo() {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
String date = sdf.format(new Date());
|
||||||
|
String randomNum = String.format("%06d", new Random().nextInt(1000000));
|
||||||
|
return "E" + date + randomNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldticketmanagement;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface MoldTicketManagementService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目方案关联
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMoldTicketManagement(@Valid MoldTicketManagementSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新项目方案关联
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMoldTicketManagement(@Valid MoldTicketManagementSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMoldTicketManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 项目方案关联
|
||||||
|
*/
|
||||||
|
MoldTicketManagementDO getMoldTicketManagement(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 项目方案关联分页
|
||||||
|
*/
|
||||||
|
PageResult<MoldTicketManagementDO> getMoldTicketManagementPage(MoldTicketManagementPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
void batchUpdateJobStatus(@Valid MoldTicketManagementBatchUpdateReqVO reqVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldticketmanagement;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldticketmanagement.MoldTicketManagementService;
|
||||||
|
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.moldticketmanagement.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
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.moldticketmanagement.MoldTicketManagementMapper;
|
||||||
|
|
||||||
|
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 MoldTicketManagementServiceImpl implements MoldTicketManagementService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketManagementMapper moldticketManagementMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMoldTicketManagement(MoldTicketManagementSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MoldTicketManagementDO moldticketManagement = BeanUtils.toBean(createReqVO, MoldTicketManagementDO.class);
|
||||||
|
moldticketManagementMapper.insert(moldticketManagement);
|
||||||
|
// 返回
|
||||||
|
return moldticketManagement.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMoldTicketManagement(MoldTicketManagementSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTicketManagementExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MoldTicketManagementDO updateObj = BeanUtils.toBean(updateReqVO, MoldTicketManagementDO.class);
|
||||||
|
moldticketManagementMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMoldTicketManagement(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTicketManagementExists(id);
|
||||||
|
// 删除
|
||||||
|
moldticketManagementMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMoldTicketManagementExists(Long id) {
|
||||||
|
if (moldticketManagementMapper.selectById(id) == null) {
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoldTicketManagementDO getMoldTicketManagement(Long id) {
|
||||||
|
return moldticketManagementMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MoldTicketManagementDO> getMoldTicketManagementPage(MoldTicketManagementPageReqVO pageReqVO) {
|
||||||
|
return moldticketManagementMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void batchUpdateJobStatus(MoldTicketManagementBatchUpdateReqVO reqVO) {
|
||||||
|
// 1. 解析ID列表
|
||||||
|
List<Long> idList = parseIds(reqVO.getIds());
|
||||||
|
if (idList.isEmpty()) {
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 批量更新
|
||||||
|
moldticketManagementMapper.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.moldticketresults;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults.MoldTicketResultsDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface MoldTicketResultsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建工单检验结果
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMoldTicketResults(@Valid MoldTicketResultsSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新工单检验结果
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMoldTicketResults(@Valid MoldTicketResultsSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除工单检验结果
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMoldTicketResults(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得工单检验结果
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 工单检验结果
|
||||||
|
*/
|
||||||
|
MoldTicketResultsDO getMoldTicketResults(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得工单检验结果分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 工单检验结果分页
|
||||||
|
*/
|
||||||
|
PageResult<MoldTicketResultsDO> getMoldTicketResultsPage(MoldTicketResultsPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单检验结果批量更新
|
||||||
|
*
|
||||||
|
* @param updateReqVOList 批量更新
|
||||||
|
* @return 工单检验结果批量更新
|
||||||
|
*/
|
||||||
|
void batchUpdateMoldTicketResults(@Valid List<MoldTicketResultsSaveReqVO> updateReqVOList);
|
||||||
|
}
|
||||||
@ -0,0 +1,182 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.moldticketresults;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.moldticketresults.enums.MoldJobResultEnum;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.moldticketmanagement.MoldTicketManagementMapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.moldticketresults.MoldTicketResultsService;
|
||||||
|
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.moldticketresults.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketresults.MoldTicketResultsDO;
|
||||||
|
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.moldticketresults.MoldTicketResultsMapper;
|
||||||
|
|
||||||
|
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 MoldTicketResultsServiceImpl implements MoldTicketResultsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MoldTicketResultsMapper moldticketResultsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private MoldTicketManagementMapper moldticketManagementMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMoldTicketResults(MoldTicketResultsSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MoldTicketResultsDO moldticketResults = BeanUtils.toBean(createReqVO, MoldTicketResultsDO.class);
|
||||||
|
moldticketResultsMapper.insert(moldticketResults);
|
||||||
|
// 返回
|
||||||
|
return moldticketResults.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMoldTicketResults(MoldTicketResultsSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTicketResultsExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MoldTicketResultsDO updateObj = BeanUtils.toBean(updateReqVO, MoldTicketResultsDO.class);
|
||||||
|
moldticketResultsMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMoldTicketResults(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateMoldTicketResultsExists(id);
|
||||||
|
// 删除
|
||||||
|
moldticketResultsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMoldTicketResultsExists(Long id) {
|
||||||
|
if (moldticketResultsMapper.selectById(id) == null) {
|
||||||
|
throw exception(TICKET_RESULTS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoldTicketResultsDO getMoldTicketResults(Long id) {
|
||||||
|
return moldticketResultsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MoldTicketResultsDO> getMoldTicketResultsPage(MoldTicketResultsPageReqVO pageReqVO) {
|
||||||
|
return moldticketResultsMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void batchUpdateMoldTicketResults(List<MoldTicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 数据验证
|
||||||
|
validateBatchUpdateData(updateReqVOList);
|
||||||
|
|
||||||
|
// 2. 批量更新
|
||||||
|
List<MoldTicketResultsDO> updateList = new ArrayList<>();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
for (MoldTicketResultsSaveReqVO vo : updateReqVOList) {
|
||||||
|
// 转换为DO
|
||||||
|
MoldTicketResultsDO updateDO = BeanUtils.toBean(vo, MoldTicketResultsDO.class);
|
||||||
|
updateDO.setUpdateTime(now);
|
||||||
|
updateList.add(updateDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 执行批量更新
|
||||||
|
moldticketResultsMapper.updateBatch(updateList);
|
||||||
|
|
||||||
|
//4. 判断是否全部已检验
|
||||||
|
handleInspectionResult(updateReqVOList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证批量更新数据
|
||||||
|
*/
|
||||||
|
private void validateBatchUpdateData(List<MoldTicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Long> idSet = new HashSet<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < updateReqVOList.size(); i++) {
|
||||||
|
MoldTicketResultsSaveReqVO vo = updateReqVOList.get(i);
|
||||||
|
|
||||||
|
// 验证ID不能为空
|
||||||
|
if (vo.getId() == null) {
|
||||||
|
throw exception(TICKET_RESULTS_ID_NOT_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
idSet.add(vo.getId());
|
||||||
|
|
||||||
|
// 调用单个验证逻辑
|
||||||
|
validateMoldTicketResultsExists(vo.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理检验结果
|
||||||
|
*/
|
||||||
|
private void handleInspectionResult(List<MoldTicketResultsSaveReqVO> updateReqVOList) {
|
||||||
|
if (CollectionUtils.isEmpty(updateReqVOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有未填写的
|
||||||
|
boolean hasPending = updateReqVOList.stream()
|
||||||
|
.anyMatch(vo -> vo.getInspectionResult() == null || vo.getInspectionResult().equals(MoldJobResultEnum.PENDING.getCode()));
|
||||||
|
|
||||||
|
if (hasPending) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoldTicketManagementDO moldticketManagementDO = moldticketManagementMapper.selectById(updateReqVOList.get(0).getManagementId());
|
||||||
|
if (moldticketManagementDO == null ){
|
||||||
|
throw exception(TICKET_MANAGEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
moldticketManagementDO.setTaskTime(LocalDateTime.now());
|
||||||
|
//设置为已完成
|
||||||
|
moldticketManagementDO.setJobStatus(1);
|
||||||
|
// 检查是否有不通过的
|
||||||
|
boolean hasFail = updateReqVOList.stream()
|
||||||
|
.anyMatch(vo -> vo.getInspectionResult() != null && vo.getInspectionResult().equals(MoldJobResultEnum.FAIL.getCode()));
|
||||||
|
if (hasFail) {
|
||||||
|
moldticketManagementDO.setJobResult(MoldJobResultEnum.FAIL.getCode());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
moldticketManagementDO.setJobResult(MoldJobResultEnum.PASS.getCode());
|
||||||
|
}
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
moldticketManagementDO.setOperator(String.valueOf(loginUser.getId()));
|
||||||
|
|
||||||
|
moldticketManagementMapper.updateById(moldticketManagementDO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.subjectmoldplan;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目方案关联 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface SubjectMoldPlanService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目方案关联
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createSubjectMoldPlan(@Valid SubjectMoldPlanSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新项目方案关联
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateSubjectMoldPlan(@Valid SubjectMoldPlanSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteSubjectMoldPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 项目方案关联
|
||||||
|
*/
|
||||||
|
SubjectMoldPlanDO getSubjectMoldPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得项目方案关联分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 项目方案关联分页
|
||||||
|
*/
|
||||||
|
PageResult<SubjectMoldPlanDO> getSubjectMoldPlanPage(SubjectMoldPlanPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.subjectmoldplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.service.subjectmoldplan.SubjectMoldPlanService;
|
||||||
|
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 cn.iocoder.yudao.module.mes.controller.admin.subjectmoldplan.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectmoldplan.SubjectMoldPlanDO;
|
||||||
|
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.subjectmoldplan.SubjectMoldPlanMapper;
|
||||||
|
|
||||||
|
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 SubjectMoldPlanServiceImpl implements SubjectMoldPlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubjectMoldPlanMapper subjectMoldPlanMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createSubjectMoldPlan(SubjectMoldPlanSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
SubjectMoldPlanDO subjectMoldPlan = BeanUtils.toBean(createReqVO, SubjectMoldPlanDO.class);
|
||||||
|
subjectMoldPlanMapper.insert(subjectMoldPlan);
|
||||||
|
// 返回
|
||||||
|
return subjectMoldPlan.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSubjectMoldPlan(SubjectMoldPlanSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateSubjectMoldPlanExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
SubjectMoldPlanDO updateObj = BeanUtils.toBean(updateReqVO, SubjectMoldPlanDO.class);
|
||||||
|
subjectMoldPlanMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteSubjectMoldPlan(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateSubjectMoldPlanExists(id);
|
||||||
|
// 删除
|
||||||
|
subjectMoldPlanMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateSubjectMoldPlanExists(Long id) {
|
||||||
|
if (subjectMoldPlanMapper.selectById(id) == null) {
|
||||||
|
throw exception(SUBJECT_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubjectMoldPlanDO getSubjectMoldPlan(Long id) {
|
||||||
|
return subjectMoldPlanMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<SubjectMoldPlanDO> getSubjectMoldPlanPage(SubjectMoldPlanPageReqVO pageReqVO) {
|
||||||
|
return subjectMoldPlanMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue