feat:1、新增设备分类接口 2、新增设备台账接口 3、修改项目维护接口 4、新增方案维护接口
parent
f4b2c3cb0d
commit
a22e9c8052
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger;
|
||||
|
||||
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.deviceledger.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
||||
import cn.iocoder.yudao.module.mes.service.deviceledger.DeviceLedgerService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备台账")
|
||||
@RestController
|
||||
@RequestMapping("/mes/device-ledger")
|
||||
@Validated
|
||||
public class DeviceLedgerController {
|
||||
|
||||
@Resource
|
||||
private DeviceLedgerService deviceLedgerService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备台账")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:create')")
|
||||
public CommonResult<Long> createDeviceLedger(@Valid @RequestBody DeviceLedgerSaveReqVO createReqVO) {
|
||||
return success(deviceLedgerService.createDeviceLedger(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备台账")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:update')")
|
||||
public CommonResult<Boolean> updateDeviceLedger(@Valid @RequestBody DeviceLedgerSaveReqVO updateReqVO) {
|
||||
deviceLedgerService.updateDeviceLedger(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备台账")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceLedger(@RequestParam("ids") String ids) {
|
||||
|
||||
// 将逗号分隔的字符串转换为Long类型的List
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
.map(String::trim) // 去除可能存在的空格
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
deviceLedgerService.deleteDeviceLedger(idList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备台账")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
|
||||
public CommonResult<DeviceLedgerRespVO> getDeviceLedger(@RequestParam("id") Long id) {
|
||||
DeviceLedgerDO deviceLedger = deviceLedgerService.getDeviceLedger(id);
|
||||
return success(BeanUtils.toBean(deviceLedger, DeviceLedgerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备台账分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
|
||||
public CommonResult<PageResult<DeviceLedgerRespVO>> getDeviceLedgerPage(@Valid DeviceLedgerPageReqVO pageReqVO) {
|
||||
PageResult<DeviceLedgerDO> pageResult = deviceLedgerService.getDeviceLedgerPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceLedgerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备台账 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-ledger:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDeviceLedgerExcel(@Valid DeviceLedgerPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DeviceLedgerDO> list = deviceLedgerService.getDeviceLedgerPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备台账.xls", "数据", DeviceLedgerRespVO.class,
|
||||
BeanUtils.toBean(list, DeviceLedgerRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger.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 DeviceLedgerPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "设备编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "设备状态 (0-正常, 1-停用, 2-维修, 3-报废)", example = "2")
|
||||
private Integer deviceStatus;
|
||||
|
||||
@Schema(description = "设备品牌")
|
||||
private String deviceBrand;
|
||||
|
||||
@Schema(description = "设备型号")
|
||||
private String deviceModel;
|
||||
|
||||
@Schema(description = "设备规格")
|
||||
private String deviceSpec;
|
||||
|
||||
@Schema(description = "设备类型", example = "1")
|
||||
private Long deviceType;
|
||||
|
||||
@Schema(description = "供应商")
|
||||
private String supplier;
|
||||
|
||||
@Schema(description = "所属车间")
|
||||
private String workshop;
|
||||
|
||||
@Schema(description = "所属系统组织")
|
||||
private String systemOrg;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "设备负责人")
|
||||
private String deviceManager;
|
||||
|
||||
@Schema(description = "设备生产日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] productionDate;
|
||||
|
||||
@Schema(description = "设备入厂日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] factoryEntryDate;
|
||||
|
||||
@Schema(description = "设备备注", example = "随便")
|
||||
private String deviceRemark;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "id集合导出用")
|
||||
private String ids;
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger.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 DeviceLedgerRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24467")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编号")
|
||||
@ExcelProperty("设备编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
@ExcelProperty("设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "设备状态 (0-正常, 1-停用, 2-维修, 3-报废)", example = "2")
|
||||
@ExcelProperty("设备状态 (0-正常, 1-停用, 2-维修, 3-报废)")
|
||||
private Integer deviceStatus;
|
||||
|
||||
@Schema(description = "设备品牌")
|
||||
@ExcelProperty("设备品牌")
|
||||
private String deviceBrand;
|
||||
|
||||
@Schema(description = "设备型号")
|
||||
@ExcelProperty("设备型号")
|
||||
private String deviceModel;
|
||||
|
||||
@Schema(description = "设备规格")
|
||||
@ExcelProperty("设备规格")
|
||||
private String deviceSpec;
|
||||
|
||||
@Schema(description = "设备类型", example = "1")
|
||||
@ExcelProperty("设备类型")
|
||||
private String deviceType;
|
||||
|
||||
@Schema(description = "供应商")
|
||||
@ExcelProperty("供应商")
|
||||
private String supplier;
|
||||
|
||||
@Schema(description = "所属车间")
|
||||
@ExcelProperty("所属车间")
|
||||
private String workshop;
|
||||
|
||||
@Schema(description = "所属系统组织")
|
||||
@ExcelProperty("所属系统组织")
|
||||
private String systemOrg;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
@ExcelProperty("设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "设备负责人")
|
||||
@ExcelProperty("设备负责人")
|
||||
private String deviceManager;
|
||||
|
||||
@Schema(description = "设备生产日期")
|
||||
@ExcelProperty("设备生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Schema(description = "设备入厂日期")
|
||||
@ExcelProperty("设备入厂日期")
|
||||
private LocalDateTime factoryEntryDate;
|
||||
|
||||
@Schema(description = "设备备注", example = "随便")
|
||||
@ExcelProperty("设备备注")
|
||||
private String deviceRemark;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.deviceledger.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 DeviceLedgerSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24467")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "设备编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Schema(description = "设备名称", example = "赵六")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "设备状态 (0-正常, 1-停用, 2-维修, 3-报废)", example = "2")
|
||||
private Integer deviceStatus;
|
||||
|
||||
@Schema(description = "设备品牌")
|
||||
private String deviceBrand;
|
||||
|
||||
@Schema(description = "设备型号")
|
||||
private String deviceModel;
|
||||
|
||||
@Schema(description = "设备规格")
|
||||
private String deviceSpec;
|
||||
|
||||
@Schema(description = "设备类型", example = "1")
|
||||
private String deviceType;
|
||||
|
||||
@Schema(description = "供应商")
|
||||
private String supplier;
|
||||
|
||||
@Schema(description = "所属车间")
|
||||
private String workshop;
|
||||
|
||||
@Schema(description = "所属系统组织")
|
||||
private String systemOrg;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "设备负责人")
|
||||
private String deviceManager;
|
||||
|
||||
@Schema(description = "设备生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Schema(description = "设备入厂日期")
|
||||
private LocalDateTime factoryEntryDate;
|
||||
|
||||
@Schema(description = "设备备注", example = "随便")
|
||||
private String deviceRemark;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.DeviceTypeTreeRespVO;
|
||||
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.devicetype.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
|
||||
import cn.iocoder.yudao.module.mes.service.devicetype.DeviceTypeService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备类型")
|
||||
@RestController
|
||||
@RequestMapping("/mes/device-type")
|
||||
@Validated
|
||||
public class DeviceTypeController {
|
||||
|
||||
@Resource
|
||||
private DeviceTypeService deviceTypeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备类型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:create')")
|
||||
public CommonResult<Long> createDeviceType(@Valid @RequestBody DeviceTypeSaveReqVO createReqVO) {
|
||||
return success(deviceTypeService.createDeviceType(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备类型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:update')")
|
||||
public CommonResult<Boolean> updateDeviceType(@Valid @RequestBody DeviceTypeSaveReqVO updateReqVO) {
|
||||
deviceTypeService.updateDeviceType(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备类型")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceType(@RequestParam("id") Long id) {
|
||||
deviceTypeService.deleteDeviceType(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-batch")
|
||||
@Operation(summary = "批量删除设备类型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceTypeBatch(@RequestParam("ids") List<Long> ids) {
|
||||
deviceTypeService.deleteDeviceTypeBatch(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备类型")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<DeviceTypeRespVO> getDeviceType(@RequestParam("id") Long id) {
|
||||
DeviceTypeDO deviceType = deviceTypeService.getDeviceType(id);
|
||||
return success(BeanUtils.toBean(deviceType, DeviceTypeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备类型分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<PageResult<DeviceTypeRespVO>> getDeviceTypePage(@Valid DeviceTypePageReqVO pageReqVO) {
|
||||
PageResult<DeviceTypeDO> pageResult = deviceTypeService.getDeviceTypePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceTypeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得设备类型列表")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<List<DeviceTypeRespVO>> getDeviceTypeList(@Valid DeviceTypeListReqVO listReqVO) {
|
||||
List<DeviceTypeDO> list = deviceTypeService.getDeviceTypeList(listReqVO);
|
||||
return success(BeanUtils.toBean(list, DeviceTypeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "获得设备类型树")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<List<DeviceTypeTreeRespVO>> getDeviceTypeTree(@Valid DeviceTypeListReqVO pageReqVO) {
|
||||
List<DeviceTypeTreeRespVO> tree = deviceTypeService.getDeviceTypeTree(pageReqVO);
|
||||
return success(tree);
|
||||
}
|
||||
|
||||
@GetMapping("/children")
|
||||
@Operation(summary = "获得子设备类型列表")
|
||||
@Parameter(name = "parentId", description = "父级ID", required = true, example = "0")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<List<DeviceTypeRespVO>> getChildrenDeviceTypes(@RequestParam("parentId") Long parentId) {
|
||||
List<DeviceTypeDO> list = deviceTypeService.getChildrenDeviceTypes(parentId);
|
||||
return success(BeanUtils.toBean(list, DeviceTypeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/ancestors")
|
||||
@Operation(summary = "获得祖先设备类型列表")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:query')")
|
||||
public CommonResult<List<DeviceTypeRespVO>> getAncestorDeviceTypes(@RequestParam("id") Long id) {
|
||||
List<DeviceTypeDO> list = deviceTypeService.getAncestorDeviceTypes(id);
|
||||
return success(BeanUtils.toBean(list, DeviceTypeRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备类型 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:device-type:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDeviceTypeExcel(@Valid DeviceTypePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DeviceTypeDO> list = deviceTypeService.getDeviceTypePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备类型.xls", "数据", DeviceTypeRespVO.class,
|
||||
BeanUtils.toBean(list, DeviceTypeRespVO.class));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
// DeviceTypeListReqVO.java
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype.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;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Schema(description = "管理后台 - 设备类型列表 Request VO")
|
||||
public class DeviceTypeListReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "父级ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "父级链")
|
||||
private String parentChain;
|
||||
|
||||
@Schema(description = "编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开始创建时间")
|
||||
private String createStartTime;
|
||||
@Schema(description = "结束创建时间")
|
||||
private String createEndTime;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype.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 DeviceTypePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private String parentChain;
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
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 DeviceTypeRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3230")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
/** */
|
||||
private String parentChain;
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备类型新增/修改 Request VO")
|
||||
@Data
|
||||
public class DeviceTypeSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3230")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "编码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@NotNull(message = "parentId参数不存在")
|
||||
private Long parentId;
|
||||
|
||||
private String parentChain;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "管理后台 - 设备类型树形结构 Response VO")
|
||||
public class DeviceTypeTreeRespVO extends DeviceTypeRespVO {
|
||||
|
||||
@Schema(description = "子设备类型列表")
|
||||
private List<DeviceTypeTreeRespVO> children;
|
||||
|
||||
@Schema(description = "是否叶子节点", example = "true")
|
||||
private Boolean leaf = true;
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.planmaintenance;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
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.planmaintenance.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.planmaintenance.PlanMaintenanceDO;
|
||||
import cn.iocoder.yudao.module.mes.service.planmaintenance.PlanMaintenanceService;
|
||||
|
||||
@Tag(name = "管理后台 - 方案维护")
|
||||
@RestController
|
||||
@RequestMapping("/mes/plan-maintenance")
|
||||
@Validated
|
||||
public class PlanMaintenanceController {
|
||||
|
||||
@Resource
|
||||
private PlanMaintenanceService planMaintenanceService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建方案维护")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:create')")
|
||||
public CommonResult<Long> createPlanMaintenance(@Valid @RequestBody PlanMaintenanceSaveReqVO createReqVO) {
|
||||
return success(planMaintenanceService.createPlanMaintenance(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新方案维护")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:update')")
|
||||
public CommonResult<Boolean> updatePlanMaintenance(@Valid @RequestBody PlanMaintenanceSaveReqVO updateReqVO) {
|
||||
planMaintenanceService.updatePlanMaintenance(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除方案维护")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:delete')")
|
||||
public CommonResult<Boolean> deletePlanMaintenance(@RequestParam("ids") String ids) {
|
||||
// 将逗号分隔的字符串转换为Long类型的List
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
.map(String::trim) // 去除可能存在的空格
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
planMaintenanceService.deletePlanMaintenance(idList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得方案维护")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:query')")
|
||||
public CommonResult<PlanMaintenanceRespVO> getPlanMaintenance(@RequestParam("id") Long id) {
|
||||
PlanMaintenanceDO planMaintenance = planMaintenanceService.getPlanMaintenance(id);
|
||||
return success(BeanUtils.toBean(planMaintenance, PlanMaintenanceRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得方案维护分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:query')")
|
||||
public CommonResult<PageResult<PlanMaintenanceRespVO>> getPlanMaintenancePage(@Valid PlanMaintenancePageReqVO pageReqVO) {
|
||||
PageResult<PlanMaintenanceDO> pageResult = planMaintenanceService.getPlanMaintenancePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PlanMaintenanceRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出方案维护 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPlanMaintenanceExcel(@Valid PlanMaintenancePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanMaintenanceDO> list = planMaintenanceService.getPlanMaintenancePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "方案维护.xls", "数据", PlanMaintenanceRespVO.class,
|
||||
BeanUtils.toBean(list, PlanMaintenanceRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getSubjectList")
|
||||
@Operation(summary = "查询项目集合列表")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:plan-maintenance:query')")
|
||||
public CommonResult<List<SubjectPlanDO>> getSubjectList(@RequestParam("id") Long id) {
|
||||
List<SubjectPlanDO> subjectPlanDOList = planMaintenanceService.getSubjectList(id);
|
||||
return success(subjectPlanDOList);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.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 PlanMaintenancePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "王五")
|
||||
private String planName;
|
||||
|
||||
@Schema(description = "名称", example = "1")
|
||||
private String 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,35 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.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 PlanMaintenanceRespVO {
|
||||
|
||||
@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 String planType;
|
||||
|
||||
@Schema(description = "描述", example = "你猜")
|
||||
@ExcelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.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 PlanMaintenanceSaveReqVO {
|
||||
|
||||
@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,95 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.subjectplan;
|
||||
|
||||
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.subjectplan.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
import cn.iocoder.yudao.module.mes.service.subjectplan.SubjectPlanService;
|
||||
|
||||
@Tag(name = "管理后台 - 项目方案关联")
|
||||
@RestController
|
||||
@RequestMapping("/mes/subject-plan")
|
||||
@Validated
|
||||
public class SubjectPlanController {
|
||||
|
||||
@Resource
|
||||
private SubjectPlanService subjectPlanService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建项目方案关联")
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:create')")
|
||||
public CommonResult<Long> createSubjectPlan(@Valid @RequestBody SubjectPlanSaveReqVO createReqVO) {
|
||||
return success(subjectPlanService.createSubjectPlan(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新项目方案关联")
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:update')")
|
||||
public CommonResult<Boolean> updateSubjectPlan(@Valid @RequestBody SubjectPlanSaveReqVO updateReqVO) {
|
||||
subjectPlanService.updateSubjectPlan(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除项目方案关联")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:delete')")
|
||||
public CommonResult<Boolean> deleteSubjectPlan(@RequestParam("id") Long id) {
|
||||
subjectPlanService.deleteSubjectPlan(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得项目方案关联")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:query')")
|
||||
public CommonResult<SubjectPlanRespVO> getSubjectPlan(@RequestParam("id") Long id) {
|
||||
SubjectPlanDO subjectPlan = subjectPlanService.getSubjectPlan(id);
|
||||
return success(BeanUtils.toBean(subjectPlan, SubjectPlanRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得项目方案关联分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:query')")
|
||||
public CommonResult<PageResult<SubjectPlanRespVO>> getSubjectPlanPage(@Valid SubjectPlanPageReqVO pageReqVO) {
|
||||
PageResult<SubjectPlanDO> pageResult = subjectPlanService.getSubjectPlanPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SubjectPlanRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出项目方案关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:subject-plan:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSubjectPlanExcel(@Valid SubjectPlanPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<SubjectPlanDO> list = subjectPlanService.getSubjectPlanPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "项目方案关联.xls", "数据", SubjectPlanRespVO.class,
|
||||
BeanUtils.toBean(list, SubjectPlanRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.subjectplan.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 SubjectPlanPageReqVO 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.subjectplan.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 SubjectPlanRespVO {
|
||||
|
||||
@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.subjectplan.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 SubjectPlanSaveReqVO {
|
||||
|
||||
@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,101 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement;
|
||||
|
||||
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.taskmanagement.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement.TaskManagementDO;
|
||||
import cn.iocoder.yudao.module.mes.service.taskmanagement.TaskManagementService;
|
||||
|
||||
@Tag(name = "管理后台 - 任务管理")
|
||||
@RestController
|
||||
@RequestMapping("/mes/task-management")
|
||||
@Validated
|
||||
public class TaskManagementController {
|
||||
|
||||
@Resource
|
||||
private TaskManagementService taskManagementService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建任务管理")
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:create')")
|
||||
public CommonResult<Long> createTaskManagement(@Valid @RequestBody TaskManagementSaveReqVO createReqVO) {
|
||||
return success(taskManagementService.createTaskManagement(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新任务管理")
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:update')")
|
||||
public CommonResult<Boolean> updateTaskManagement(@Valid @RequestBody TaskManagementSaveReqVO updateReqVO) {
|
||||
taskManagementService.updateTaskManagement(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除任务管理")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:delete')")
|
||||
public CommonResult<Boolean> deleteTaskManagement(@RequestParam("ids") String ids) {
|
||||
// 将逗号分隔的字符串转换为Long类型的List
|
||||
List<Long> idList = Arrays.stream(ids.split(","))
|
||||
.map(String::trim) // 去除可能存在的空格
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
taskManagementService.deleteTaskManagement(idList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得任务管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:query')")
|
||||
public CommonResult<TaskManagementRespVO> getTaskManagement(@RequestParam("id") Long id) {
|
||||
TaskManagementDO taskManagement = taskManagementService.getTaskManagement(id);
|
||||
return success(BeanUtils.toBean(taskManagement, TaskManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得任务管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:query')")
|
||||
public CommonResult<PageResult<TaskManagementRespVO>> getTaskManagementPage(@Valid TaskManagementPageReqVO pageReqVO) {
|
||||
PageResult<TaskManagementDO> pageResult = taskManagementService.getTaskManagementPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TaskManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出任务管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('mes:task-management:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTaskManagementExcel(@Valid TaskManagementPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TaskManagementDO> list = taskManagementService.getTaskManagementPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备类型.xls", "数据", TaskManagementRespVO.class,
|
||||
BeanUtils.toBean(list, TaskManagementRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.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 TaskManagementPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型(1-点检 2-保养)", example = "2")
|
||||
private Integer taskType;
|
||||
|
||||
@Schema(description = "设备列表")
|
||||
private String deviceList;
|
||||
|
||||
@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,59 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.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 TaskManagementRespVO {
|
||||
|
||||
@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 deviceList;
|
||||
|
||||
@Schema(description = "项目表单")
|
||||
@ExcelProperty("项目表单")
|
||||
private Long projectForm;
|
||||
|
||||
@Schema(description = "起止开始日期")
|
||||
@ExcelProperty("起止开始日期")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description = "起止结束日期")
|
||||
@ExcelProperty("起止结束日期")
|
||||
private LocalDateTime 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;
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.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 TaskManagementSaveReqVO {
|
||||
|
||||
@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 deviceList;
|
||||
|
||||
@Schema(description = "项目表单")
|
||||
private Long projectForm;
|
||||
|
||||
@Schema(description = "起止开始日期")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description = "起止结束日期")
|
||||
private LocalDateTime 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,101 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
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_device_ledger")
|
||||
@KeySequence("mes_device_ledger_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeviceLedgerDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String deviceCode;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
/**
|
||||
* 设备状态 (0-正常, 1-停用, 2-维修, 3-报废)
|
||||
*/
|
||||
private Integer deviceStatus;
|
||||
/**
|
||||
* 设备品牌
|
||||
*/
|
||||
private String deviceBrand;
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String deviceModel;
|
||||
/**
|
||||
* 设备规格
|
||||
*/
|
||||
private String deviceSpec;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private Long deviceType;
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String supplier;
|
||||
/**
|
||||
* 所属车间
|
||||
*/
|
||||
private String workshop;
|
||||
/**
|
||||
* 所属系统组织
|
||||
*/
|
||||
private String systemOrg;
|
||||
/**
|
||||
* 设备位置
|
||||
*/
|
||||
private String deviceLocation;
|
||||
/**
|
||||
* 设备负责人
|
||||
*/
|
||||
private String deviceManager;
|
||||
/**
|
||||
* 设备生产日期
|
||||
*/
|
||||
private LocalDateTime productionDate;
|
||||
/**
|
||||
* 设备入厂日期
|
||||
*/
|
||||
private LocalDateTime factoryEntryDate;
|
||||
/**
|
||||
* 设备备注
|
||||
*/
|
||||
private String deviceRemark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.devicetype;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
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_device_type")
|
||||
@KeySequence("mes_device_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeviceTypeDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/** */
|
||||
@JsonProperty("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/** */
|
||||
@JsonProperty("parent_chain")
|
||||
private String parentChain;
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.planmaintenance;
|
||||
|
||||
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_plan_maintenance")
|
||||
@KeySequence("mes_plan_maintenance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanMaintenanceDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String planName;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String planType;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan;
|
||||
|
||||
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_plan")
|
||||
@KeySequence("mes_subject_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SubjectPlanDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long subjectId;
|
||||
/**
|
||||
* 方案ID
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
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_task_management")
|
||||
@KeySequence("mes_task_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskManagementDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 类型(1-点检 2-保养)
|
||||
*/
|
||||
private Integer taskType;
|
||||
/**
|
||||
* 设备列表
|
||||
*/
|
||||
private String deviceList;
|
||||
/**
|
||||
* 项目表单
|
||||
*/
|
||||
private Long projectForm;
|
||||
/**
|
||||
* 起止开始日期
|
||||
*/
|
||||
private LocalDateTime startDate;
|
||||
/**
|
||||
* 起止结束日期
|
||||
*/
|
||||
private LocalDateTime endDate;
|
||||
/**
|
||||
* cron表达式
|
||||
*/
|
||||
private String cronExpression;
|
||||
/**
|
||||
* 可操作人
|
||||
*/
|
||||
private String operableUsers;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.deviceledger;
|
||||
|
||||
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.iot.dal.dataobject.device.DeviceDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.*;
|
||||
|
||||
/**
|
||||
* 设备类型 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceLedgerMapper extends BaseMapperX<DeviceLedgerDO> {
|
||||
|
||||
default PageResult<DeviceLedgerDO> selectPage(DeviceLedgerPageReqVO reqVO) {
|
||||
|
||||
LambdaQueryWrapperX<DeviceLedgerDO> deviceLedgerDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||
deviceLedgerDOLambdaQueryWrapperX
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceCode, reqVO.getDeviceCode())
|
||||
.likeIfPresent(DeviceLedgerDO::getDeviceName, reqVO.getDeviceName())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceStatus, reqVO.getDeviceStatus())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceBrand, reqVO.getDeviceBrand())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceModel, reqVO.getDeviceModel())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceSpec, reqVO.getDeviceSpec())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceType, reqVO.getDeviceType())
|
||||
.eqIfPresent(DeviceLedgerDO::getSupplier, reqVO.getSupplier())
|
||||
.eqIfPresent(DeviceLedgerDO::getWorkshop, reqVO.getWorkshop())
|
||||
.eqIfPresent(DeviceLedgerDO::getSystemOrg, reqVO.getSystemOrg())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceLocation, reqVO.getDeviceLocation())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceManager, reqVO.getDeviceManager())
|
||||
.betweenIfPresent(DeviceLedgerDO::getProductionDate, reqVO.getProductionDate())
|
||||
.betweenIfPresent(DeviceLedgerDO::getFactoryEntryDate, reqVO.getFactoryEntryDate())
|
||||
.eqIfPresent(DeviceLedgerDO::getDeviceRemark, reqVO.getDeviceRemark())
|
||||
.eqIfPresent(DeviceLedgerDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(DeviceLedgerDO::getSort, reqVO.getSort())
|
||||
.betweenIfPresent(DeviceLedgerDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DeviceLedgerDO::getId);
|
||||
|
||||
// 单独处理 ids 条件
|
||||
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
deviceLedgerDOLambdaQueryWrapperX.in(DeviceLedgerDO::getId, idList);
|
||||
}
|
||||
|
||||
return selectPage(reqVO, deviceLedgerDOLambdaQueryWrapperX);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.devicetype;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
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.devicetype.DeviceTypeDO;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备类型 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceTypeMapper extends BaseMapperX<DeviceTypeDO> {
|
||||
|
||||
default PageResult<DeviceTypeDO> selectPage(DeviceTypePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceTypeDO>()
|
||||
.eqIfPresent(DeviceTypeDO::getParentId, reqVO.getParentId())
|
||||
.likeIfPresent(DeviceTypeDO::getParentChain, reqVO.getParentChain())
|
||||
.eqIfPresent(DeviceTypeDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(DeviceTypeDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeviceTypeDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(DeviceTypeDO::getSort, reqVO.getSort())
|
||||
.betweenIfPresent(DeviceTypeDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(DeviceTypeDO::getSort)
|
||||
.orderByDesc(DeviceTypeDO::getId));
|
||||
}
|
||||
|
||||
default List<DeviceTypeDO> selectList(DeviceTypeListReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DeviceTypeDO>()
|
||||
.eqIfPresent(DeviceTypeDO::getParentId, reqVO.getParentId())
|
||||
.likeIfPresent(DeviceTypeDO::getParentChain, reqVO.getParentChain())
|
||||
.likeIfPresent(DeviceTypeDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(DeviceTypeDO::getName, reqVO.getName())
|
||||
.betweenIfPresent(DeviceTypeDO::getCreateTime, reqVO.getCreateStartTime(), reqVO.getCreateEndTime())
|
||||
.orderByAsc(DeviceTypeDO::getSort)
|
||||
.orderByDesc(DeviceTypeDO::getId));
|
||||
}
|
||||
|
||||
default List<DeviceTypeDO> selectList() {
|
||||
return selectList(new LambdaQueryWrapper<DeviceTypeDO>()
|
||||
.orderByAsc(DeviceTypeDO::getSort)
|
||||
.orderByDesc(DeviceTypeDO::getId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.planmaintenance;
|
||||
|
||||
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.planmaintenance.PlanMaintenanceDO;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.vo.*;
|
||||
|
||||
/**
|
||||
* 方案维护 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlanMaintenanceMapper extends BaseMapperX<PlanMaintenanceDO> {
|
||||
|
||||
default PageResult<PlanMaintenanceDO> selectPage(PlanMaintenancePageReqVO reqVO) {
|
||||
|
||||
LambdaQueryWrapperX<PlanMaintenanceDO> planMaintenanceDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||
planMaintenanceDOLambdaQueryWrapperX
|
||||
.likeIfPresent(PlanMaintenanceDO::getPlanName, reqVO.getPlanName())
|
||||
.eqIfPresent(PlanMaintenanceDO::getPlanType, reqVO.getPlanType())
|
||||
.eqIfPresent(PlanMaintenanceDO::getDescription, reqVO.getDescription())
|
||||
.betweenIfPresent(PlanMaintenanceDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PlanMaintenanceDO::getId);
|
||||
|
||||
// 单独处理 ids 条件
|
||||
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
planMaintenanceDOLambdaQueryWrapperX.in(PlanMaintenanceDO::getId, idList);
|
||||
}
|
||||
|
||||
return selectPage(reqVO, planMaintenanceDOLambdaQueryWrapperX);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.subjectplan;
|
||||
|
||||
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.subjectplan.SubjectPlanDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.subjectplan.vo.*;
|
||||
|
||||
/**
|
||||
* 项目方案关联 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface SubjectPlanMapper extends BaseMapperX<SubjectPlanDO> {
|
||||
|
||||
default PageResult<SubjectPlanDO> selectPage(SubjectPlanPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SubjectPlanDO>()
|
||||
.eqIfPresent(SubjectPlanDO::getSubjectId, reqVO.getSubjectId())
|
||||
.eqIfPresent(SubjectPlanDO::getPlanId, reqVO.getPlanId())
|
||||
.betweenIfPresent(SubjectPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SubjectPlanDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除指定计划的关联
|
||||
*
|
||||
* @param planId 计划ID
|
||||
*/
|
||||
@Delete("DELETE FROM besure.mes_subject_plan WHERE plan_id = #{planId}")
|
||||
void deleteByPlanId(Long planId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.taskmanagement;
|
||||
|
||||
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.planmaintenance.PlanMaintenanceDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement.TaskManagementDO;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.vo.*;
|
||||
|
||||
/**
|
||||
* 设备类型 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface TaskManagementMapper extends BaseMapperX<TaskManagementDO> {
|
||||
|
||||
default PageResult<TaskManagementDO> selectPage(TaskManagementPageReqVO reqVO) {
|
||||
|
||||
|
||||
LambdaQueryWrapperX<TaskManagementDO> taskManagementDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
|
||||
taskManagementDOLambdaQueryWrapperX
|
||||
.likeIfPresent(TaskManagementDO::getName, reqVO.getName())
|
||||
.eqIfPresent(TaskManagementDO::getTaskType, reqVO.getTaskType())
|
||||
.eqIfPresent(TaskManagementDO::getDeviceList, reqVO.getDeviceList())
|
||||
.eqIfPresent(TaskManagementDO::getProjectForm, reqVO.getProjectForm())
|
||||
.betweenIfPresent(TaskManagementDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(TaskManagementDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(TaskManagementDO::getCronExpression, reqVO.getCronExpression())
|
||||
.eqIfPresent(TaskManagementDO::getOperableUsers, reqVO.getOperableUsers())
|
||||
.eqIfPresent(TaskManagementDO::getEnabled, reqVO.getEnabled())
|
||||
.betweenIfPresent(TaskManagementDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(TaskManagementDO::getId);
|
||||
|
||||
// 单独处理 ids 条件
|
||||
if (StringUtils.isNotBlank(reqVO.getIds())) {
|
||||
List<Long> idList = Arrays.stream(reqVO.getIds().split(","))
|
||||
.map(String::trim)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
taskManagementDOLambdaQueryWrapperX.in(TaskManagementDO::getId, idList);
|
||||
}
|
||||
|
||||
|
||||
return selectPage(reqVO, taskManagementDOLambdaQueryWrapperX);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.mes.service.deviceledger;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 设备类型 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface DeviceLedgerService {
|
||||
|
||||
/**
|
||||
* 创建设备类型
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDeviceLedger(@Valid DeviceLedgerSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备类型
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDeviceLedger(@Valid DeviceLedgerSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备类型
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDeviceLedger( List<Long> idList );
|
||||
|
||||
/**
|
||||
* 获得设备类型
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备类型
|
||||
*/
|
||||
DeviceLedgerDO getDeviceLedger(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备类型分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备类型分页
|
||||
*/
|
||||
PageResult<DeviceLedgerDO> getDeviceLedgerPage(DeviceLedgerPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package cn.iocoder.yudao.module.mes.service.deviceledger;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
|
||||
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 cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
||||
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.deviceledger.DeviceLedgerMapper;
|
||||
|
||||
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 DeviceLedgerServiceImpl implements DeviceLedgerService {
|
||||
|
||||
@Resource
|
||||
private DeviceLedgerMapper deviceLedgerMapper;
|
||||
|
||||
@Override
|
||||
public Long createDeviceLedger(DeviceLedgerSaveReqVO createReqVO) {
|
||||
|
||||
//验证是否唯一编码
|
||||
validateCodeOnly(createReqVO.getDeviceCode());
|
||||
// 插入
|
||||
DeviceLedgerDO deviceLedger = BeanUtils.toBean(createReqVO, DeviceLedgerDO.class);
|
||||
deviceLedgerMapper.insert(deviceLedger);
|
||||
// 返回
|
||||
return deviceLedger.getId();
|
||||
}
|
||||
|
||||
private void validateCodeOnly( String code) {
|
||||
if (deviceLedgerMapper.exists(Wrappers.<DeviceLedgerDO>lambdaQuery()
|
||||
.eq(DeviceLedgerDO::getDeviceCode, code))) {
|
||||
throw exception(DEVICE_LEDGER_EXISTS);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateDeviceLedger(DeviceLedgerSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeviceLedgerExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DeviceLedgerDO updateObj = BeanUtils.toBean(updateReqVO, DeviceLedgerDO.class);
|
||||
deviceLedgerMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceLedger(List<Long> idList ) {
|
||||
|
||||
for (Long id : idList) {
|
||||
// 校验存在
|
||||
validateDeviceLedgerExists(id);
|
||||
}
|
||||
|
||||
// 删除
|
||||
deviceLedgerMapper.deleteByIds(idList);
|
||||
}
|
||||
|
||||
private void validateDeviceLedgerExists(Long id) {
|
||||
if (deviceLedgerMapper.selectById(id) == null) {
|
||||
throw exception(DEVICE_LEDGER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceLedgerDO getDeviceLedger(Long id) {
|
||||
return deviceLedgerMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DeviceLedgerDO> getDeviceLedgerPage(DeviceLedgerPageReqVO pageReqVO) {
|
||||
return deviceLedgerMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.mes.service.devicetype;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.devicetype.vo.DeviceTypeTreeRespVO;
|
||||
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.devicetype.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.devicetype.DeviceTypeDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 设备类型 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface DeviceTypeService {
|
||||
|
||||
Long createDeviceType(DeviceTypeSaveReqVO createReqVO);
|
||||
|
||||
void updateDeviceType(DeviceTypeSaveReqVO updateReqVO);
|
||||
|
||||
void deleteDeviceType(Long id);
|
||||
|
||||
void deleteDeviceTypeBatch(List<Long> ids);
|
||||
|
||||
DeviceTypeDO getDeviceType(Long id);
|
||||
|
||||
PageResult<DeviceTypeDO> getDeviceTypePage(DeviceTypePageReqVO pageReqVO);
|
||||
|
||||
List<DeviceTypeDO> getDeviceTypeList(DeviceTypeListReqVO listReqVO);
|
||||
|
||||
List<DeviceTypeTreeRespVO> getDeviceTypeTree(DeviceTypeListReqVO pageReqVO);
|
||||
|
||||
List<DeviceTypeDO> getChildrenDeviceTypes(Long parentId);
|
||||
|
||||
List<DeviceTypeDO> getAncestorDeviceTypes(Long id);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.mes.service.planmaintenance;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.planmaintenance.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.planmaintenance.PlanMaintenanceDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
|
||||
/**
|
||||
* 方案维护 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface PlanMaintenanceService {
|
||||
|
||||
/**
|
||||
* 创建方案维护
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPlanMaintenance(@Valid PlanMaintenanceSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新方案维护
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlanMaintenance(@Valid PlanMaintenanceSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除方案维护
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlanMaintenance( List<Long> idList);
|
||||
|
||||
/**
|
||||
* 获得方案维护
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 方案维护
|
||||
*/
|
||||
PlanMaintenanceDO getPlanMaintenance(Long id);
|
||||
|
||||
/**
|
||||
* 获得方案维护分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 方案维护分页
|
||||
*/
|
||||
PageResult<PlanMaintenanceDO> getPlanMaintenancePage(PlanMaintenancePageReqVO pageReqVO);
|
||||
|
||||
List<SubjectPlanDO> getSubjectList(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
package cn.iocoder.yudao.module.mes.service.planmaintenance;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.mysql.subjectplan.SubjectPlanMapper;
|
||||
import cn.iocoder.yudao.module.mes.service.subjectplan.SubjectPlanService;
|
||||
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.planmaintenance.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.planmaintenance.PlanMaintenanceDO;
|
||||
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.planmaintenance.PlanMaintenanceMapper;
|
||||
|
||||
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 PlanMaintenanceServiceImpl implements PlanMaintenanceService {
|
||||
|
||||
@Resource
|
||||
private PlanMaintenanceMapper planMaintenanceMapper;
|
||||
@Resource
|
||||
private SubjectPlanMapper subjectPlanMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPlanMaintenance(PlanMaintenanceSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlanMaintenanceDO planMaintenance = BeanUtils.toBean(createReqVO, PlanMaintenanceDO.class);
|
||||
planMaintenanceMapper.insert(planMaintenance);
|
||||
|
||||
if (StringUtils.isNotBlank(createReqVO.getSubjectIdS())){
|
||||
|
||||
// 将逗号分隔的字符串转换为Long类型的List
|
||||
List<Long> idList = Arrays.stream( createReqVO.getSubjectIdS().split(","))
|
||||
.map(String::trim) // 去除可能存在的空格
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
//插入关联表
|
||||
insertSubjectPlan(planMaintenance.getId(),idList);
|
||||
}
|
||||
// 返回
|
||||
return planMaintenance.getId();
|
||||
}
|
||||
|
||||
private void insertSubjectPlan(Long id, List<Long> idList) {
|
||||
|
||||
List<SubjectPlanDO> subjectPlanDOArrayList = new ArrayList<>();
|
||||
for (Long subjectId : idList) {
|
||||
SubjectPlanDO subjectPlanDO = new SubjectPlanDO();
|
||||
subjectPlanDO.setPlanId(id);
|
||||
subjectPlanDO.setSubjectId(subjectId);
|
||||
subjectPlanDOArrayList.add(subjectPlanDO);
|
||||
}
|
||||
subjectPlanMapper.insertBatch(subjectPlanDOArrayList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePlanMaintenance(PlanMaintenanceSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlanMaintenanceExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanMaintenanceDO updateObj = BeanUtils.toBean(updateReqVO, PlanMaintenanceDO.class);
|
||||
planMaintenanceMapper.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());
|
||||
//更新关联表
|
||||
updateSubjectPlan(updateObj.getId(),idList);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSubjectPlan(Long id, List<Long> idList) {
|
||||
|
||||
subjectPlanMapper.deleteByPlanId(id);
|
||||
List<SubjectPlanDO> subjectPlanDOArrayList = new ArrayList<>();
|
||||
for (Long subjectId : idList) {
|
||||
SubjectPlanDO subjectPlanDO = new SubjectPlanDO();
|
||||
subjectPlanDO.setPlanId(id);
|
||||
subjectPlanDO.setSubjectId(subjectId);
|
||||
subjectPlanDOArrayList.add(subjectPlanDO);
|
||||
}
|
||||
subjectPlanMapper.insertBatch(subjectPlanDOArrayList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePlanMaintenance( List<Long> idList) {
|
||||
for (Long id : idList) {
|
||||
// 校验存在
|
||||
validatePlanMaintenanceExists(id);
|
||||
|
||||
}
|
||||
// 删除
|
||||
planMaintenanceMapper.deleteByIds(idList);
|
||||
//删除关联表数据
|
||||
deleteSubjectPlan(idList);
|
||||
|
||||
}
|
||||
|
||||
private void deleteSubjectPlan(List<Long> idList) {
|
||||
for (Long id : idList) {
|
||||
if (id != null ){
|
||||
subjectPlanMapper.delete(Wrappers.<SubjectPlanDO>lambdaQuery()
|
||||
.eq(SubjectPlanDO::getPlanId, id));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void validatePlanMaintenanceExists(Long id) {
|
||||
if (planMaintenanceMapper.selectById(id) == null) {
|
||||
throw exception(PLAN_MAINTENANCE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanMaintenanceDO getPlanMaintenance(Long id) {
|
||||
return planMaintenanceMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlanMaintenanceDO> getPlanMaintenancePage(PlanMaintenancePageReqVO pageReqVO) {
|
||||
return planMaintenanceMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubjectPlanDO> getSubjectList(Long id) {
|
||||
if (id == null ){
|
||||
throw exception(SUBJECT_ID_NOT_EXISTS);
|
||||
}
|
||||
return subjectPlanMapper.selectList(Wrappers.<SubjectPlanDO>lambdaQuery()
|
||||
.eq(SubjectPlanDO::getSubjectId, id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.mes.service.subjectplan;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.subjectplan.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 项目方案关联 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface SubjectPlanService {
|
||||
|
||||
/**
|
||||
* 创建项目方案关联
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSubjectPlan(@Valid SubjectPlanSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新项目方案关联
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSubjectPlan(@Valid SubjectPlanSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除项目方案关联
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSubjectPlan(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目方案关联
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 项目方案关联
|
||||
*/
|
||||
SubjectPlanDO getSubjectPlan(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目方案关联分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 项目方案关联分页
|
||||
*/
|
||||
PageResult<SubjectPlanDO> getSubjectPlanPage(SubjectPlanPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.mes.service.subjectplan;
|
||||
|
||||
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.subjectplan.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.subjectplan.SubjectPlanDO;
|
||||
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.subjectplan.SubjectPlanMapper;
|
||||
|
||||
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 SubjectPlanServiceImpl implements SubjectPlanService {
|
||||
|
||||
@Resource
|
||||
private SubjectPlanMapper subjectPlanMapper;
|
||||
|
||||
@Override
|
||||
public Long createSubjectPlan(SubjectPlanSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
SubjectPlanDO subjectPlan = BeanUtils.toBean(createReqVO, SubjectPlanDO.class);
|
||||
subjectPlanMapper.insert(subjectPlan);
|
||||
// 返回
|
||||
return subjectPlan.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSubjectPlan(SubjectPlanSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSubjectPlanExists(updateReqVO.getId());
|
||||
// 更新
|
||||
SubjectPlanDO updateObj = BeanUtils.toBean(updateReqVO, SubjectPlanDO.class);
|
||||
subjectPlanMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSubjectPlan(Long id) {
|
||||
// 校验存在
|
||||
validateSubjectPlanExists(id);
|
||||
// 删除
|
||||
subjectPlanMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSubjectPlanExists(Long id) {
|
||||
if (subjectPlanMapper.selectById(id) == null) {
|
||||
throw exception(SUBJECT_PLAN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubjectPlanDO getSubjectPlan(Long id) {
|
||||
return subjectPlanMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SubjectPlanDO> getSubjectPlanPage(SubjectPlanPageReqVO pageReqVO) {
|
||||
return subjectPlanMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.mes.service.taskmanagement;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.taskmanagement.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement.TaskManagementDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 设备类型 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface TaskManagementService {
|
||||
|
||||
/**
|
||||
* 创建设备类型
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createTaskManagement(@Valid TaskManagementSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备类型
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTaskManagement(@Valid TaskManagementSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备类型
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTaskManagement(List<Long> idList );
|
||||
|
||||
/**
|
||||
* 获得设备类型
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备类型
|
||||
*/
|
||||
TaskManagementDO getTaskManagement(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备类型分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备类型分页
|
||||
*/
|
||||
PageResult<TaskManagementDO> getTaskManagementPage(TaskManagementPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.mes.service.taskmanagement;
|
||||
|
||||
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.taskmanagement.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.taskmanagement.TaskManagementDO;
|
||||
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.taskmanagement.TaskManagementMapper;
|
||||
|
||||
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 TaskManagementServiceImpl implements TaskManagementService {
|
||||
|
||||
@Resource
|
||||
private TaskManagementMapper taskManagementMapper;
|
||||
|
||||
@Override
|
||||
public Long createTaskManagement(TaskManagementSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
TaskManagementDO taskManagement = BeanUtils.toBean(createReqVO, TaskManagementDO.class);
|
||||
taskManagementMapper.insert(taskManagement);
|
||||
// 返回
|
||||
return taskManagement.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTaskManagement(TaskManagementSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTaskManagementExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TaskManagementDO updateObj = BeanUtils.toBean(updateReqVO, TaskManagementDO.class);
|
||||
taskManagementMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTaskManagement(List<Long> idList ) {
|
||||
for (Long id : idList) {
|
||||
// 校验存在
|
||||
validateTaskManagementExists(id);
|
||||
}
|
||||
// 删除
|
||||
taskManagementMapper.deleteByIds(idList);
|
||||
}
|
||||
|
||||
private void validateTaskManagementExists(Long id) {
|
||||
if (taskManagementMapper.selectById(id) == null) {
|
||||
throw exception(TASK_MANAGEMENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskManagementDO getTaskManagement(Long id) {
|
||||
return taskManagementMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TaskManagementDO> getTaskManagementPage(TaskManagementPageReqVO pageReqVO) {
|
||||
return taskManagementMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue