merge
commit
41ab78fa36
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.device.scheduled.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class SchedulerConfig {
|
||||
|
||||
@Bean
|
||||
public TaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setPoolSize(20); // 设置线程池大小
|
||||
scheduler.setThreadNamePrefix("scheduled-task-"); // 线程名前缀
|
||||
scheduler.setAwaitTerminationSeconds(60); // 等待任务完成的秒数
|
||||
scheduler.setWaitForTasksToCompleteOnShutdown(true); // 关闭时等待任务完成
|
||||
scheduler.initialize(); // 初始化
|
||||
return scheduler;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.energydevice.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 能耗管理-能耗报表导出 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EnergyDeviceRecordRespVO {
|
||||
|
||||
@Schema(description = "名称", example = "芋艿")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "能耗类型名称", example = "水")
|
||||
@ExcelProperty("能耗类型名称")
|
||||
private String deviceTypeName;
|
||||
|
||||
@Schema(description = "所属区域名称", example = "车间1")
|
||||
@ExcelProperty("所属区域名称")
|
||||
private String orgName;
|
||||
|
||||
@Schema(description = "能耗总用量")
|
||||
@ExcelProperty("能耗总用量")
|
||||
private String energyConsumption;
|
||||
|
||||
@Schema(description = "最新数据时间")
|
||||
@ExcelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private String latestDataTime;
|
||||
|
||||
@Schema(description = "最早数据时间")
|
||||
@ExcelProperty("结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private String earliestDataTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.energydevice.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointDetailVO {
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
private String pointName;
|
||||
|
||||
/**
|
||||
* 点位ID
|
||||
*/
|
||||
private Long pointId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 最早值
|
||||
*/
|
||||
private String earliestValue;
|
||||
|
||||
/**
|
||||
* 最早时间
|
||||
*/
|
||||
private String earliestTime;
|
||||
|
||||
/**
|
||||
* 最晚值
|
||||
*/
|
||||
private String latestValue;
|
||||
|
||||
/**
|
||||
* 最晚时间
|
||||
*/
|
||||
private String latestTime;
|
||||
|
||||
/**
|
||||
* 差值
|
||||
*/
|
||||
private String difference;
|
||||
|
||||
/**
|
||||
* 运算符
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
|
||||
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.moldrepairtems.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
|
||||
import cn.iocoder.yudao.module.mes.service.moldrepairtems.MoldRepairTemsService;
|
||||
|
||||
@Tag(name = "管理后台 - 维修项目")
|
||||
@RestController
|
||||
@RequestMapping("/mes/mold-repair-tems")
|
||||
@Validated
|
||||
public class MoldRepairTemsController {
|
||||
|
||||
@Resource
|
||||
private MoldRepairTemsService moldrepairTemsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建维修项目")
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:create')")
|
||||
public CommonResult<Long> createMoldRepairTems(@Valid @RequestBody MoldRepairTemsSaveReqVO createReqVO) {
|
||||
return success(moldrepairTemsService.createMoldRepairTems(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新维修项目")
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:update')")
|
||||
public CommonResult<Boolean> updateMoldRepairTems(@Valid @RequestBody MoldRepairTemsSaveReqVO updateReqVO) {
|
||||
moldrepairTemsService.updateMoldRepairTems(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除维修项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:delete')")
|
||||
public CommonResult<Boolean> deleteMoldRepairTems(@RequestParam("ids") String ids) {
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
.map(String::trim) // 去除可能存在的空格
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
moldrepairTemsService.deleteMoldRepairTems(idList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得维修项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
|
||||
public CommonResult<MoldRepairTemsRespVO> getMoldRepairTems(@RequestParam("id") Long id) {
|
||||
MoldRepairTemsDO moldrepairTems = moldrepairTemsService.getMoldRepairTems(id);
|
||||
return success(BeanUtils.toBean(moldrepairTems, MoldRepairTemsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得维修项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
|
||||
public CommonResult<PageResult<MoldRepairTemsRespVO>> getMoldRepairTemsPage(@Valid MoldRepairTemsPageReqVO pageReqVO) {
|
||||
PageResult<MoldRepairTemsRespVO> pageResult = moldrepairTemsService.getMoldRepairTemsPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出维修项目 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMoldRepairTemsExcel(@Valid MoldRepairTemsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MoldRepairTemsRespVO> list = moldrepairTemsService.getMoldRepairTemsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "维修项目.xls", "数据", MoldRepairTemsRespVO.class,list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @GetMapping("/getMoldOrComponent")
|
||||
// @Operation(summary = "获得设备/关键件")
|
||||
// @Parameter(name = "moldType", description = "moldType 1-设备 2-关键件", required = true, example = "1024")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
|
||||
// public CommonResult<List<MoldRepairTemsRespVO>> getMoldOrComponent(@RequestParam("moldType") Integer moldType) {
|
||||
// return success( moldrepairTemsService.getMoldOrComponent(moldType));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/getMoldOrComponentList")
|
||||
// @Operation(summary = "获得设备/关键件列表")
|
||||
//// @Parameter(name = "moldType", description = "moldType 1-设备 2-关键件", required = true, example = "1024")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
|
||||
// public CommonResult<List<MoldRepairTemsRespVO>> getMoldOrComponentList(
|
||||
// @Parameter(name = "moldId", description = "设备Id", required = true, example = "123")
|
||||
// @RequestParam("moldId") Long moldId,
|
||||
// @Parameter(name = "componentId", description = "关键件Id", required = false, example = "123")
|
||||
// @RequestParam(value = "componentId",required = false) Long componentId) {
|
||||
// return success(moldrepairTemsService.getMoldOrComponentList(moldId,componentId));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @GetMapping("/getComponentList")
|
||||
// @Operation(summary = "获得设备关键件")
|
||||
// @Parameter(name = "moldId", description = "moldId设备Id", required = true, example = "1024")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
|
||||
// public CommonResult<List<CriticalComponentDO>> getComponentList(@RequestParam("moldId") Long moldId) {
|
||||
// return success( moldrepairTemsService.getComponentList(moldId));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
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 MoldRepairTemsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目编码")
|
||||
private String subjectCode;
|
||||
|
||||
@Schema(description = "项目名称", example = "芋艿")
|
||||
private String subjectName;
|
||||
|
||||
@Schema(description = "模具类型", example = "1")
|
||||
private Integer moldBrand;
|
||||
|
||||
@Schema(description = "模具id", example = "11632")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "关键件id", example = "29557")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "检验方式")
|
||||
private String inspectionMethod;
|
||||
|
||||
@Schema(description = "值类型", example = "1")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "判定基准")
|
||||
private String judgmentCriteria;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean isEnable;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "项目内容")
|
||||
private String projectContent;
|
||||
|
||||
@Schema(description = "id集合导出用")
|
||||
private String ids;
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
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 MoldRepairTemsRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
|
||||
// @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 = "模具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer moldBrand;
|
||||
|
||||
@Schema(description = "模具类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
// @ExcelProperty("模具类型名称")
|
||||
private String moldBrandName;
|
||||
|
||||
@Schema(description = "模具id", example = "11632")
|
||||
// @ExcelProperty("模具id")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "关键件id", example = "29557")
|
||||
// @ExcelProperty("关键件id")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "检验方式")
|
||||
// @ExcelProperty("检验方式")
|
||||
private String inspectionMethod;
|
||||
|
||||
@Schema(description = "值类型", example = "1")
|
||||
// @ExcelProperty("值类型")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "判定基准")
|
||||
// @ExcelProperty("判定基准")
|
||||
private String judgmentCriteria;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否启用")
|
||||
private Boolean isEnable;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
@ColumnWidth(20)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "模具名称")
|
||||
@ExcelProperty("模具名称")
|
||||
private String moldName;
|
||||
|
||||
@Schema(description = "关键件名称")
|
||||
// @ExcelProperty("关键件名称")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "创建人名称")
|
||||
@ExcelProperty("创建人名称")
|
||||
private String creatorName;
|
||||
|
||||
@Schema(description = "项目内容")
|
||||
@ExcelProperty("维修内容")
|
||||
private String projectContent;
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 维修项目新增/修改 Request VO")
|
||||
@Data
|
||||
public class MoldRepairTemsSaveReqVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
|
||||
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 = "模具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
// @NotNull(message = "模具类型不能为空")
|
||||
private Integer moldBrand;
|
||||
|
||||
@Schema(description = "模具id", example = "11632")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "关键件id", example = "29557")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "检验方式")
|
||||
private String inspectionMethod;
|
||||
|
||||
@Schema(description = "值类型", example = "1")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "判定基准")
|
||||
private String judgmentCriteria;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否启用不能为空")
|
||||
private Boolean isEnable;
|
||||
|
||||
@Schema(description = "模具名称")
|
||||
@ExcelProperty("模具名称")
|
||||
private String moldName;
|
||||
|
||||
@Schema(description = "关键件名称")
|
||||
@ExcelProperty("关键件名称")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "创建人名称")
|
||||
@ExcelProperty("创建人名称")
|
||||
private String creatorName;
|
||||
|
||||
@Schema(description = "项目内容")
|
||||
@ExcelProperty("项目内容")
|
||||
private String projectContent;
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems;
|
||||
|
||||
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_repair_tems")
|
||||
@KeySequence("mes_mold_repair_tems_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MoldRepairTemsDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 项目编码
|
||||
*/
|
||||
private String subjectCode;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String subjectName;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private Integer moldBrand;
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long moldId;
|
||||
/**
|
||||
* 关键件id
|
||||
*/
|
||||
private Long componentId;
|
||||
/**
|
||||
* 检验方式
|
||||
*/
|
||||
private String inspectionMethod;
|
||||
/**
|
||||
* 值类型
|
||||
*/
|
||||
private String valueType;
|
||||
/**
|
||||
* 判定基准
|
||||
*/
|
||||
private String judgmentCriteria;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean isEnable;
|
||||
/**
|
||||
* 项目内容
|
||||
*/
|
||||
private String projectContent;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.moldrepairtems;
|
||||
|
||||
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.moldrepairtems.MoldRepairTemsDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 维修项目 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface MoldRepairTemsMapper extends BaseMapperX<MoldRepairTemsDO> {
|
||||
|
||||
default PageResult<MoldRepairTemsDO> selectPage(MoldRepairTemsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MoldRepairTemsDO>()
|
||||
.eqIfPresent(MoldRepairTemsDO::getSubjectCode, reqVO.getSubjectCode())
|
||||
.likeIfPresent(MoldRepairTemsDO::getSubjectName, reqVO.getSubjectName())
|
||||
.eqIfPresent(MoldRepairTemsDO::getMoldBrand, reqVO.getMoldBrand())
|
||||
.eqIfPresent(MoldRepairTemsDO::getMoldId, reqVO.getMoldId())
|
||||
.eqIfPresent(MoldRepairTemsDO::getComponentId, reqVO.getComponentId())
|
||||
.eqIfPresent(MoldRepairTemsDO::getInspectionMethod, reqVO.getInspectionMethod())
|
||||
.eqIfPresent(MoldRepairTemsDO::getValueType, reqVO.getValueType())
|
||||
.eqIfPresent(MoldRepairTemsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
|
||||
.eqIfPresent(MoldRepairTemsDO::getIsEnable, reqVO.getIsEnable())
|
||||
.betweenIfPresent(MoldRepairTemsDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MoldRepairTemsDO::getId));
|
||||
}
|
||||
|
||||
IPage<MoldRepairTemsRespVO> getMoldRepairTemsPage(Page<MoldRepairTemsRespVO> page, @Param("pageReqVO") MoldRepairTemsPageReqVO pageReqVO);
|
||||
|
||||
List<MoldRepairTemsRespVO> getMoldRepairTemsList( @Param("pageReqVO") MoldRepairTemsPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.mes.service.moldrepairtems;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 维修项目 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface MoldRepairTemsService {
|
||||
|
||||
/**
|
||||
* 创建维修项目
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMoldRepairTems(@Valid MoldRepairTemsSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新维修项目
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMoldRepairTems(@Valid MoldRepairTemsSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除维修项目
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMoldRepairTems( List<Long> idList);
|
||||
|
||||
/**
|
||||
* 获得维修项目
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 维修项目
|
||||
*/
|
||||
MoldRepairTemsDO getMoldRepairTems(Long id);
|
||||
|
||||
/**
|
||||
* 获得维修项目分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 维修项目分页
|
||||
*/
|
||||
PageResult<MoldRepairTemsRespVO> getMoldRepairTemsPage(MoldRepairTemsPageReqVO pageReqVO);
|
||||
|
||||
// List<MoldRepairTemsRespVO> getMoldOrComponent(Integer moldBrand);
|
||||
|
||||
// List<MoldRepairTemsRespVO> getMoldOrComponentList(Long moldId, Long componentId);
|
||||
|
||||
// List<CriticalComponentDO> getComponentList(Long moldId);
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
package cn.iocoder.yudao.module.mes.service.moldrepairtems;
|
||||
|
||||
//import cn.iocoder.yudao.module.iot.controller.admin.mold.vo.LineMoldRespVO;
|
||||
//import cn.iocoder.yudao.module.iot.dal.dataobject.moldmodel.MoldModelDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent.CriticalComponentMapper;
|
||||
import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldMapper;
|
||||
import cn.iocoder.yudao.module.mes.service.moldrepairtems.MoldRepairTemsService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.moldrepairtems.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
|
||||
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.moldrepairtems.MoldRepairTemsMapper;
|
||||
|
||||
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 MoldRepairTemsServiceImpl implements MoldRepairTemsService {
|
||||
|
||||
@Resource
|
||||
private MoldRepairTemsMapper moldrepairTemsMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private MoldMapper moldMapper;
|
||||
@Resource
|
||||
private CriticalComponentMapper criticalComponentMapper;
|
||||
|
||||
@Override
|
||||
public Long createMoldRepairTems(MoldRepairTemsSaveReqVO createReqVO) {
|
||||
//编码重复判断
|
||||
Long count = moldrepairTemsMapper.selectCount(new LambdaQueryWrapper<MoldRepairTemsDO>()
|
||||
.eq(MoldRepairTemsDO::getSubjectCode, createReqVO.getSubjectCode())
|
||||
);
|
||||
|
||||
if (count > 0) {
|
||||
throw exception(REPAIR_TEMS_CODE_EXISTS);
|
||||
}
|
||||
|
||||
// 插入
|
||||
MoldRepairTemsDO moldrepairTems = BeanUtils.toBean(createReqVO, MoldRepairTemsDO.class);
|
||||
moldrepairTemsMapper.insert(moldrepairTems);
|
||||
// 返回
|
||||
return moldrepairTems.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMoldRepairTems(MoldRepairTemsSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMoldRepairTemsExists(updateReqVO.getId());
|
||||
|
||||
//编码重复判断
|
||||
Long count = moldrepairTemsMapper.selectCount(new LambdaQueryWrapper<MoldRepairTemsDO>()
|
||||
.eq(MoldRepairTemsDO::getSubjectCode, updateReqVO.getSubjectCode())
|
||||
.ne(MoldRepairTemsDO::getId, updateReqVO.getId())
|
||||
|
||||
);
|
||||
|
||||
if (count > 0) {
|
||||
throw exception(REPAIR_TEMS_CODE_EXISTS);
|
||||
}
|
||||
|
||||
// 更新
|
||||
MoldRepairTemsDO updateObj = BeanUtils.toBean(updateReqVO, MoldRepairTemsDO.class);
|
||||
moldrepairTemsMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMoldRepairTems( List<Long> idList) {
|
||||
for (Long id : idList) {
|
||||
// 校验存在
|
||||
validateMoldRepairTemsExists(id);
|
||||
}
|
||||
|
||||
// 删除
|
||||
moldrepairTemsMapper.deleteByIds(idList);
|
||||
}
|
||||
|
||||
private void validateMoldRepairTemsExists(Long id) {
|
||||
if (moldrepairTemsMapper.selectById(id) == null) {
|
||||
throw exception(REPAIR_TEMS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoldRepairTemsDO getMoldRepairTems(Long id) {
|
||||
return moldrepairTemsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MoldRepairTemsRespVO> getMoldRepairTemsPage(MoldRepairTemsPageReqVO pageReqVO) {
|
||||
Page<MoldRepairTemsRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<MoldRepairTemsRespVO> moldrepairTemsDOIPage = moldrepairTemsMapper.getMoldRepairTemsPage(page,pageReqVO);
|
||||
PageResult<MoldRepairTemsRespVO> moldrepairTemsDOPageResult = new PageResult<>(moldrepairTemsDOIPage.getRecords(), moldrepairTemsDOIPage.getTotal());
|
||||
return moldrepairTemsDOPageResult;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<MoldRepairTemsRespVO> getMoldOrComponent(Integer moldBrand) {
|
||||
// return moldrepairTemsMapper.getMoldRepairTemsList(new MoldRepairTemsPageReqVO().setMoldBrand(moldBrand));
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public List<MoldRepairTemsRespVO> getMoldOrComponentList(Long moldId, Long componentId) {
|
||||
// return moldrepairTemsMapper.getMoldRepairTemsList(new MoldRepairTemsPageReqVO().setMoldId(moldId).setComponentId(componentId));
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public List<CriticalComponentDO> getComponentList(Long moldId) {
|
||||
//
|
||||
// MoldDO moldDO = moldMapper.selectById(moldId);
|
||||
// if(moldDO == null ){
|
||||
// throw exception(DEVICE_LEDGER_NOT_EXISTS);
|
||||
// }
|
||||
//
|
||||
// if (StringUtils.isBlank(moldDO.getComponentId())){
|
||||
// return new ArrayList<>();
|
||||
// }
|
||||
//
|
||||
// List<CriticalComponentDO> criticalComponentDOS= new ArrayList<>();
|
||||
// List<Long> idList = Arrays.stream(moldDO.getComponentId().split(","))
|
||||
// .map(String::trim) // 去除可能存在的空格
|
||||
// .map(Long::valueOf)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (Long id : idList) {
|
||||
// CriticalComponentDO criticalComponentDO = criticalComponentMapper.selectById(id);
|
||||
// if (criticalComponentDO !=null){
|
||||
// criticalComponentDOS.add(criticalComponentDO);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return criticalComponentDOS;
|
||||
// }
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue