feat: 设备模块部分代码生成;报告接口;
This commit is contained in:
@@ -154,7 +154,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEVICE_PRODUCT_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备_设备大类不存在");
|
||||
ErrorCode DEVICE_MAINTAIN_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备维护数据不存在");
|
||||
ErrorCode DEVICE_MAINTAIN_ITEM_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备维护项不存在");
|
||||
|
||||
ErrorCode DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备业务配置不存在");
|
||||
ErrorCode DEVICE_CONFIG_BUSINESS_ITEM_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备业务配置项不存在");
|
||||
ErrorCode DEVICE_PERIOD_CHECK_NOT_EXISTS = new ErrorCode(1_032_150_000, "期间核查数据不存在");
|
||||
|
||||
@@ -166,7 +166,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEVICE_CALIBRATION_NOT_EXISTS = new ErrorCode(1_032_150_000, "检定校准数据不存在");
|
||||
ErrorCode DEVICE_USE_RECORD_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备使用记录不存在");
|
||||
ErrorCode DEVICE_AFFILIATION_RELATIVITY_NOT_EXISTS = new ErrorCode(1_032_150_000, "附属设备关系不存在");
|
||||
ErrorCode DEVICE_APPLY_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备申请数据不存在");
|
||||
ErrorCode DEVICE_APPLY_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备申请明细数据不存在");
|
||||
ErrorCode DEVICE_APPLY_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备申请数据不存在");
|
||||
|
||||
|
||||
// -------------物料试剂-------------
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.zt.plat.module.qms.business.reportdoc.controller.admin;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -49,8 +51,8 @@ public class ReportDocumentFileController extends AbstractFileUploadController i
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private ReportDocumentFileService reportDocumentFileService;
|
||||
@Resource private ReportDocumentFileService reportDocumentFileService;
|
||||
@Resource private ReportDocumentMainService reportDocumentMainService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检测报告附件")
|
||||
@@ -94,6 +96,23 @@ public class ReportDocumentFileController extends AbstractFileUploadController i
|
||||
return success(BeanUtils.toBean(reportDocumentFile, ReportDocumentFileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getPdfFileObjByMainId")
|
||||
@Operation(summary = "获得检测报告附件")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<ReportDocumentFileRespVO> getPdfFileObjByMainId(ReportDocumentFileSaveReqVO vo) {
|
||||
Long mainId = vo.getMainId();
|
||||
Integer version = vo.getVersion();
|
||||
if(version == null){
|
||||
ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId);
|
||||
version = mainDO.getDocumentVersion();
|
||||
}
|
||||
ReportDocumentFileDO entity = reportDocumentFileService.getByMainIdAndVersion(mainId, version);
|
||||
if(entity == null){
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
return success(BeanUtils.toBean(entity, ReportDocumentFileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检测报告附件分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:report-document-file:query')")
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFil
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentFileDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检测报告附件 Mapper
|
||||
*
|
||||
@@ -30,4 +32,19 @@ public interface ReportDocumentFileMapper extends BaseMapperX<ReportDocumentFile
|
||||
.orderByDesc(ReportDocumentFileDO::getId));
|
||||
}
|
||||
|
||||
default List<ReportDocumentFileDO> selectList(ReportDocumentFileDO reqVO) {
|
||||
LambdaQueryWrapperX<ReportDocumentFileDO> query = new LambdaQueryWrapperX<>();
|
||||
query.eqIfPresent(ReportDocumentFileDO::getMainId, reqVO.getMainId())
|
||||
.eqIfPresent(ReportDocumentFileDO::getFileId, reqVO.getFileId())
|
||||
.likeIfPresent(ReportDocumentFileDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ReportDocumentFileDO::getPath, reqVO.getPath())
|
||||
.eqIfPresent(ReportDocumentFileDO::getUrl, reqVO.getUrl())
|
||||
.eqIfPresent(ReportDocumentFileDO::getType, reqVO.getType())
|
||||
.eqIfPresent(ReportDocumentFileDO::getVersion, reqVO.getVersion())
|
||||
.eqIfPresent(ReportDocumentFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(ReportDocumentFileDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(ReportDocumentFileDO::getId);
|
||||
return selectList(query);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.business.annotation.FileUploadController;
|
||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||
import com.zt.plat.module.qms.resource.device.service.DeviceApplyService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@RestController
|
||||
@RequestMapping("/qms/device-apply")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.deviceapply")
|
||||
public class DeviceApplyController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
|
||||
static {
|
||||
FileUploadController annotation = DeviceApplyController.class.getAnnotation(FileUploadController.class);
|
||||
if (annotation != null) {
|
||||
setFileUploadInfo(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private DeviceApplyService deviceApplyService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:create')")
|
||||
public CommonResult<DeviceApplyRespVO> createDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO createReqVO) {
|
||||
return success(deviceApplyService.createDeviceApply(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:update')")
|
||||
public CommonResult<Boolean> updateDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO updateReqVO) {
|
||||
deviceApplyService.updateDeviceApply(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceApply(@RequestParam("id") Long id) {
|
||||
deviceApplyService.deleteDeviceApply(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceApplyList(@RequestBody BatchDeleteReqVO req) {
|
||||
deviceApplyService.deleteDeviceApplyListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:query')")
|
||||
public CommonResult<DeviceApplyRespVO> getDeviceApply(@RequestParam("id") Long id) {
|
||||
DeviceApplyDO deviceApply = deviceApplyService.getDeviceApply(id);
|
||||
return success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备通用流程,验收、降级、停用、报废、还原、启用分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:query')")
|
||||
public CommonResult<PageResult<DeviceApplyRespVO>> getDeviceApplyPage(@Valid DeviceApplyPageReqVO pageReqVO) {
|
||||
PageResult<DeviceApplyDO> pageResult = deviceApplyService.getDeviceApplyPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceApplyRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备通用流程,验收、降级、停用、报废、还原、启用 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-apply:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDeviceApplyExcel(@Valid DeviceApplyPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DeviceApplyDO> list = deviceApplyService.getDeviceApplyPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备通用流程,验收、降级、停用、报废、还原、启用.xls", "数据", DeviceApplyRespVO.class,
|
||||
BeanUtils.toBean(list, DeviceApplyRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.business.annotation.FileUploadController;
|
||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||
import com.zt.plat.module.qms.resource.device.service.DeviceConfigBusinessRuleService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备-业务配置")
|
||||
@RestController
|
||||
@RequestMapping("/qms/device-config-business-rule")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.deviceconfigbusinessrule")
|
||||
public class DeviceConfigBusinessRuleController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
|
||||
static {
|
||||
FileUploadController annotation = DeviceConfigBusinessRuleController.class.getAnnotation(FileUploadController.class);
|
||||
if (annotation != null) {
|
||||
setFileUploadInfo(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private DeviceConfigBusinessRuleService deviceConfigBusinessRuleService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备-业务配置")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:create')")
|
||||
public CommonResult<DeviceConfigBusinessRuleRespVO> createDeviceConfigBusinessRule(@Valid @RequestBody DeviceConfigBusinessRuleSaveReqVO createReqVO) {
|
||||
return success(deviceConfigBusinessRuleService.createDeviceConfigBusinessRule(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备-业务配置")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:update')")
|
||||
public CommonResult<Boolean> updateDeviceConfigBusinessRule(@Valid @RequestBody DeviceConfigBusinessRuleSaveReqVO updateReqVO) {
|
||||
deviceConfigBusinessRuleService.updateDeviceConfigBusinessRule(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备-业务配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceConfigBusinessRule(@RequestParam("id") Long id) {
|
||||
deviceConfigBusinessRuleService.deleteDeviceConfigBusinessRule(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除设备-业务配置")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceConfigBusinessRuleList(@RequestBody BatchDeleteReqVO req) {
|
||||
deviceConfigBusinessRuleService.deleteDeviceConfigBusinessRuleListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备-业务配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:query')")
|
||||
public CommonResult<DeviceConfigBusinessRuleRespVO> getDeviceConfigBusinessRule(@RequestParam("id") Long id) {
|
||||
DeviceConfigBusinessRuleDO deviceConfigBusinessRule = deviceConfigBusinessRuleService.getDeviceConfigBusinessRule(id);
|
||||
return success(BeanUtils.toBean(deviceConfigBusinessRule, DeviceConfigBusinessRuleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备-业务配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:query')")
|
||||
public CommonResult<PageResult<DeviceConfigBusinessRuleRespVO>> getDeviceConfigBusinessRulePage(@Valid DeviceConfigBusinessRulePageReqVO pageReqVO) {
|
||||
PageResult<DeviceConfigBusinessRuleDO> pageResult = deviceConfigBusinessRuleService.getDeviceConfigBusinessRulePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceConfigBusinessRuleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备-业务配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDeviceConfigBusinessRuleExcel(@Valid DeviceConfigBusinessRulePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DeviceConfigBusinessRuleDO> list = deviceConfigBusinessRuleService.getDeviceConfigBusinessRulePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备-业务配置.xls", "数据", DeviceConfigBusinessRuleRespVO.class,
|
||||
BeanUtils.toBean(list, DeviceConfigBusinessRuleRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceRepairAtPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceRepairAtRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceRepairAtSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.business.annotation.FileUploadController;
|
||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceRepairAtDO;
|
||||
import com.zt.plat.module.qms.resource.device.service.DeviceRepairAtService;
|
||||
|
||||
@Tag(name = "管理后台 - 故障与处理关系")
|
||||
@RestController
|
||||
@RequestMapping("/qms/device-repair-at")
|
||||
@Validated
|
||||
@FileUploadController(source = "qms.devicerepairat")
|
||||
public class DeviceRepairAtController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||
|
||||
static {
|
||||
FileUploadController annotation = DeviceRepairAtController.class.getAnnotation(FileUploadController.class);
|
||||
if (annotation != null) {
|
||||
setFileUploadInfo(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private DeviceRepairAtService deviceRepairAtService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建故障与处理关系")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:create')")
|
||||
public CommonResult<DeviceRepairAtRespVO> createDeviceRepairAt(@Valid @RequestBody DeviceRepairAtSaveReqVO createReqVO) {
|
||||
return success(deviceRepairAtService.createDeviceRepairAt(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新故障与处理关系")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:update')")
|
||||
public CommonResult<Boolean> updateDeviceRepairAt(@Valid @RequestBody DeviceRepairAtSaveReqVO updateReqVO) {
|
||||
deviceRepairAtService.updateDeviceRepairAt(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除故障与处理关系")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceRepairAt(@RequestParam("id") Long id) {
|
||||
deviceRepairAtService.deleteDeviceRepairAt(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除故障与处理关系")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:delete')")
|
||||
public CommonResult<Boolean> deleteDeviceRepairAtList(@RequestBody BatchDeleteReqVO req) {
|
||||
deviceRepairAtService.deleteDeviceRepairAtListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得故障与处理关系")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:query')")
|
||||
public CommonResult<DeviceRepairAtRespVO> getDeviceRepairAt(@RequestParam("id") Long id) {
|
||||
DeviceRepairAtDO deviceRepairAt = deviceRepairAtService.getDeviceRepairAt(id);
|
||||
return success(BeanUtils.toBean(deviceRepairAt, DeviceRepairAtRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得故障与处理关系分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:query')")
|
||||
public CommonResult<PageResult<DeviceRepairAtRespVO>> getDeviceRepairAtPage(@Valid DeviceRepairAtPageReqVO pageReqVO) {
|
||||
PageResult<DeviceRepairAtDO> pageResult = deviceRepairAtService.getDeviceRepairAtPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceRepairAtRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出故障与处理关系 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-repair-at:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportDeviceRepairAtExcel(@Valid DeviceRepairAtPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<DeviceRepairAtDO> list = deviceRepairAtService.getDeviceRepairAtPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "故障与处理关系.xls", "数据", DeviceRepairAtRespVO.class,
|
||||
BeanUtils.toBean(list, DeviceRepairAtRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 设备通用流程,验收、降级、停用、报废、还原、启用分页 Request VO")
|
||||
@Data
|
||||
public class DeviceApplyPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
|
||||
private String businessName;
|
||||
|
||||
@Schema(description = "申请部门", example = "王五")
|
||||
private String applyDepartmentName;
|
||||
|
||||
@Schema(description = "申请部门ID")
|
||||
private String applyDepartment;
|
||||
|
||||
@Schema(description = "申请人", example = "王五")
|
||||
private String applyUserName;
|
||||
|
||||
@Schema(description = "申请人ID")
|
||||
private String applyUser;
|
||||
|
||||
@Schema(description = "业务编码")
|
||||
private String businessCode;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] businessDate;
|
||||
|
||||
@Schema(description = "业务原因")
|
||||
private String businessReason;
|
||||
|
||||
@Schema(description = "业务状态", example = "1")
|
||||
private String businessStatus;
|
||||
|
||||
@Schema(description = "借用人")
|
||||
private String businessUser;
|
||||
|
||||
@Schema(description = "借用人id", example = "14524")
|
||||
private Long businessUserId;
|
||||
|
||||
@Schema(description = "借用部门")
|
||||
private String businessDepartment;
|
||||
|
||||
@Schema(description = "借用部门id", example = "894")
|
||||
private Long businessDepartmentId;
|
||||
|
||||
@Schema(description = "计划归还日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] planGivebackDate;
|
||||
|
||||
@Schema(description = "归还接收人")
|
||||
private String givebackReceiveUser;
|
||||
|
||||
@Schema(description = "归还接收人id", example = "1528")
|
||||
private Long givebackReceiveUserId;
|
||||
|
||||
@Schema(description = "数据集配置ID", example = "12435")
|
||||
private Long dataCollectionId;
|
||||
|
||||
@Schema(description = "表单数据")
|
||||
private String formData;
|
||||
|
||||
@Schema(description = "流程实例id", example = "15634")
|
||||
private String flowInstanceId;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备通用流程,验收、降级、停用、报废、还原、启用 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DeviceApplyRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
|
||||
@ExcelProperty("业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等")
|
||||
private String businessName;
|
||||
|
||||
@Schema(description = "申请部门", example = "王五")
|
||||
@ExcelProperty("申请部门")
|
||||
private String applyDepartmentName;
|
||||
|
||||
@Schema(description = "申请部门ID")
|
||||
@ExcelProperty("申请部门ID")
|
||||
private String applyDepartment;
|
||||
|
||||
@Schema(description = "申请人", example = "王五")
|
||||
@ExcelProperty("申请人")
|
||||
private String applyUserName;
|
||||
|
||||
@Schema(description = "申请人ID")
|
||||
@ExcelProperty("申请人ID")
|
||||
private String applyUser;
|
||||
|
||||
@Schema(description = "业务编码")
|
||||
@ExcelProperty("业务编码")
|
||||
private String businessCode;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
@ExcelProperty("业务日期")
|
||||
private LocalDateTime businessDate;
|
||||
|
||||
@Schema(description = "业务原因")
|
||||
@ExcelProperty("业务原因")
|
||||
private String businessReason;
|
||||
|
||||
@Schema(description = "业务状态", example = "1")
|
||||
@ExcelProperty("业务状态")
|
||||
private String businessStatus;
|
||||
|
||||
@Schema(description = "借用人")
|
||||
@ExcelProperty("借用人")
|
||||
private String businessUser;
|
||||
|
||||
@Schema(description = "借用人id", example = "14524")
|
||||
@ExcelProperty("借用人id")
|
||||
private Long businessUserId;
|
||||
|
||||
@Schema(description = "借用部门")
|
||||
@ExcelProperty("借用部门")
|
||||
private String businessDepartment;
|
||||
|
||||
@Schema(description = "借用部门id", example = "894")
|
||||
@ExcelProperty("借用部门id")
|
||||
private Long businessDepartmentId;
|
||||
|
||||
@Schema(description = "计划归还日期")
|
||||
@ExcelProperty("计划归还日期")
|
||||
private LocalDateTime planGivebackDate;
|
||||
|
||||
@Schema(description = "归还接收人")
|
||||
@ExcelProperty("归还接收人")
|
||||
private String givebackReceiveUser;
|
||||
|
||||
@Schema(description = "归还接收人id", example = "1528")
|
||||
@ExcelProperty("归还接收人id")
|
||||
private Long givebackReceiveUserId;
|
||||
|
||||
@Schema(description = "数据集配置ID", example = "12435")
|
||||
@ExcelProperty("数据集配置ID")
|
||||
private Long dataCollectionId;
|
||||
|
||||
@Schema(description = "表单数据")
|
||||
@ExcelProperty("表单数据")
|
||||
private String formData;
|
||||
|
||||
@Schema(description = "流程实例id", example = "15634")
|
||||
@ExcelProperty("流程实例id")
|
||||
private String flowInstanceId;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 设备通用流程,验收、降级、停用、报废、还原、启用新增/修改 Request VO")
|
||||
@Data
|
||||
public class DeviceApplySaveReqVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
|
||||
private String businessName;
|
||||
|
||||
@Schema(description = "申请部门", example = "王五")
|
||||
private String applyDepartmentName;
|
||||
|
||||
@Schema(description = "申请部门ID")
|
||||
private String applyDepartment;
|
||||
|
||||
@Schema(description = "申请人", example = "王五")
|
||||
private String applyUserName;
|
||||
|
||||
@Schema(description = "申请人ID")
|
||||
private String applyUser;
|
||||
|
||||
@Schema(description = "业务编码")
|
||||
private String businessCode;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
private LocalDateTime businessDate;
|
||||
|
||||
@Schema(description = "业务原因")
|
||||
private String businessReason;
|
||||
|
||||
@Schema(description = "业务状态", example = "1")
|
||||
private String businessStatus;
|
||||
|
||||
@Schema(description = "借用人")
|
||||
private String businessUser;
|
||||
|
||||
@Schema(description = "借用人id", example = "14524")
|
||||
private Long businessUserId;
|
||||
|
||||
@Schema(description = "借用部门")
|
||||
private String businessDepartment;
|
||||
|
||||
@Schema(description = "借用部门id", example = "894")
|
||||
private Long businessDepartmentId;
|
||||
|
||||
@Schema(description = "计划归还日期")
|
||||
private LocalDateTime planGivebackDate;
|
||||
|
||||
@Schema(description = "归还接收人")
|
||||
private String givebackReceiveUser;
|
||||
|
||||
@Schema(description = "归还接收人id", example = "1528")
|
||||
private Long givebackReceiveUserId;
|
||||
|
||||
@Schema(description = "数据集配置ID", example = "12435")
|
||||
private Long dataCollectionId;
|
||||
|
||||
@Schema(description = "表单数据")
|
||||
private String formData;
|
||||
|
||||
@Schema(description = "流程实例id", example = "15634")
|
||||
private String flowInstanceId;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 设备-业务配置分页 Request VO")
|
||||
@Data
|
||||
public class DeviceConfigBusinessRulePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "产品id", example = "28944")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "业务领域")
|
||||
private String businessDomain;
|
||||
|
||||
@Schema(description = "是否需要")
|
||||
private String requireFlag;
|
||||
|
||||
@Schema(description = "子业务类型", example = "2")
|
||||
private String subitemDomainType;
|
||||
|
||||
@Schema(description = "频次类型", example = "2")
|
||||
private String frequencyType;
|
||||
|
||||
@Schema(description = "频次")
|
||||
private String frequency;
|
||||
|
||||
@Schema(description = "频次说明")
|
||||
private String frequencyRemark;
|
||||
|
||||
@Schema(description = "报表模板")
|
||||
private String reportTemplateKey;
|
||||
|
||||
@Schema(description = "表单组件")
|
||||
private String formComponent;
|
||||
|
||||
@Schema(description = "处理方法")
|
||||
private String treatmentMethod;
|
||||
|
||||
@Schema(description = "处理人")
|
||||
private String treatmentUser;
|
||||
|
||||
@Schema(description = "检定/校准类型", example = "1")
|
||||
private String calibrationCheckType;
|
||||
|
||||
@Schema(description = "标准/规范")
|
||||
private String standard;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备-业务配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DeviceConfigBusinessRuleRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2207")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品id", example = "28944")
|
||||
@ExcelProperty("产品id")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "业务领域")
|
||||
@ExcelProperty("业务领域")
|
||||
private String businessDomain;
|
||||
|
||||
@Schema(description = "是否需要")
|
||||
@ExcelProperty("是否需要")
|
||||
private String requireFlag;
|
||||
|
||||
@Schema(description = "子业务类型", example = "2")
|
||||
@ExcelProperty("子业务类型")
|
||||
private String subitemDomainType;
|
||||
|
||||
@Schema(description = "频次类型", example = "2")
|
||||
@ExcelProperty("频次类型")
|
||||
private String frequencyType;
|
||||
|
||||
@Schema(description = "频次")
|
||||
@ExcelProperty("频次")
|
||||
private String frequency;
|
||||
|
||||
@Schema(description = "频次说明")
|
||||
@ExcelProperty("频次说明")
|
||||
private String frequencyRemark;
|
||||
|
||||
@Schema(description = "报表模板")
|
||||
@ExcelProperty("报表模板")
|
||||
private String reportTemplateKey;
|
||||
|
||||
@Schema(description = "表单组件")
|
||||
@ExcelProperty("表单组件")
|
||||
private String formComponent;
|
||||
|
||||
@Schema(description = "处理方法")
|
||||
@ExcelProperty("处理方法")
|
||||
private String treatmentMethod;
|
||||
|
||||
@Schema(description = "处理人")
|
||||
@ExcelProperty("处理人")
|
||||
private String treatmentUser;
|
||||
|
||||
@Schema(description = "检定/校准类型", example = "1")
|
||||
@ExcelProperty("检定/校准类型")
|
||||
private String calibrationCheckType;
|
||||
|
||||
@Schema(description = "标准/规范")
|
||||
@ExcelProperty("标准/规范")
|
||||
private String standard;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备-业务配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class DeviceConfigBusinessRuleSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2207")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品id", example = "28944")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "业务领域")
|
||||
private String businessDomain;
|
||||
|
||||
@Schema(description = "是否需要")
|
||||
private String requireFlag;
|
||||
|
||||
@Schema(description = "子业务类型", example = "2")
|
||||
private String subitemDomainType;
|
||||
|
||||
@Schema(description = "频次类型", example = "2")
|
||||
private String frequencyType;
|
||||
|
||||
@Schema(description = "频次")
|
||||
private String frequency;
|
||||
|
||||
@Schema(description = "频次说明")
|
||||
private String frequencyRemark;
|
||||
|
||||
@Schema(description = "报表模板")
|
||||
private String reportTemplateKey;
|
||||
|
||||
@Schema(description = "表单组件")
|
||||
private String formComponent;
|
||||
|
||||
@Schema(description = "处理方法")
|
||||
private String treatmentMethod;
|
||||
|
||||
@Schema(description = "处理人")
|
||||
private String treatmentUser;
|
||||
|
||||
@Schema(description = "检定/校准类型", example = "1")
|
||||
private String calibrationCheckType;
|
||||
|
||||
@Schema(description = "标准/规范")
|
||||
private String standard;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
/**
|
||||
* 设备通用流程,验收、降级、停用、报废、还原、启用 DO
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@TableName("t_dev_apl")
|
||||
@KeySequence("t_dev_apl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class DeviceApplyDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等
|
||||
*/
|
||||
@TableField("BSN_NAME")
|
||||
private String businessName;
|
||||
/**
|
||||
* 申请部门
|
||||
*/
|
||||
@TableField("APL_DEPT_NAME")
|
||||
private String applyDepartmentName;
|
||||
/**
|
||||
* 申请部门ID
|
||||
*/
|
||||
@TableField("APL_DEPT")
|
||||
private String applyDepartment;
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
@TableField("APL_USER_NAME")
|
||||
private String applyUserName;
|
||||
/**
|
||||
* 申请人ID
|
||||
*/
|
||||
@TableField("APL_USER")
|
||||
private String applyUser;
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
@TableField("BSN_CD")
|
||||
private String businessCode;
|
||||
/**
|
||||
* 业务日期
|
||||
*/
|
||||
@TableField("BSN_DT")
|
||||
private LocalDateTime businessDate;
|
||||
/**
|
||||
* 业务原因
|
||||
*/
|
||||
@TableField("BSN_RSN")
|
||||
private String businessReason;
|
||||
/**
|
||||
* 业务状态
|
||||
*/
|
||||
@TableField("BSN_STS")
|
||||
private String businessStatus;
|
||||
/**
|
||||
* 借用人
|
||||
*/
|
||||
@TableField("BSN_USER")
|
||||
private String businessUser;
|
||||
/**
|
||||
* 借用人id
|
||||
*/
|
||||
@TableField("BSN_USER_ID")
|
||||
private Long businessUserId;
|
||||
/**
|
||||
* 借用部门
|
||||
*/
|
||||
@TableField("BSN_DEPT")
|
||||
private String businessDepartment;
|
||||
/**
|
||||
* 借用部门id
|
||||
*/
|
||||
@TableField("BSN_DEPT_ID")
|
||||
private Long businessDepartmentId;
|
||||
/**
|
||||
* 计划归还日期
|
||||
*/
|
||||
@TableField("PLN_GIV_DT")
|
||||
private LocalDateTime planGivebackDate;
|
||||
/**
|
||||
* 归还接收人
|
||||
*/
|
||||
@TableField("GIV_RCV_USER")
|
||||
private String givebackReceiveUser;
|
||||
/**
|
||||
* 归还接收人id
|
||||
*/
|
||||
@TableField("GIV_RCV_USER_ID")
|
||||
private Long givebackReceiveUserId;
|
||||
/**
|
||||
* 数据集配置ID
|
||||
*/
|
||||
@TableField("DAT_COLT_ID")
|
||||
private Long dataCollectionId;
|
||||
/**
|
||||
* 表单数据
|
||||
*/
|
||||
@TableField("FORM_DAT")
|
||||
private String formData;
|
||||
/**
|
||||
* 流程实例id
|
||||
*/
|
||||
@TableField("FLW_INSC_ID")
|
||||
private String flowInstanceId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
private String systemDepartmentCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
/**
|
||||
* 设备-业务配置 DO
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@TableName("t_dev_cfg_bsn_rul")
|
||||
@KeySequence("t_dev_cfg_bsn_rul_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class DeviceConfigBusinessRuleDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 产品id
|
||||
*/
|
||||
@TableField("PDT_ID")
|
||||
private Long productId;
|
||||
/**
|
||||
* 业务领域
|
||||
*/
|
||||
@TableField("BSN_DMN")
|
||||
private String businessDomain;
|
||||
/**
|
||||
* 是否需要
|
||||
*/
|
||||
@TableField("REQR_FLG")
|
||||
private String requireFlag;
|
||||
/**
|
||||
* 子业务类型
|
||||
*/
|
||||
@TableField("SUB_DMN_TP")
|
||||
private String subitemDomainType;
|
||||
/**
|
||||
* 频次类型
|
||||
*/
|
||||
@TableField("FREQ_TP")
|
||||
private String frequencyType;
|
||||
/**
|
||||
* 频次
|
||||
*/
|
||||
@TableField("FREQ")
|
||||
private String frequency;
|
||||
/**
|
||||
* 频次说明
|
||||
*/
|
||||
@TableField("FREQ_RMK")
|
||||
private String frequencyRemark;
|
||||
/**
|
||||
* 报表模板
|
||||
*/
|
||||
@TableField("RPT_TMPL_KY")
|
||||
private String reportTemplateKey;
|
||||
/**
|
||||
* 表单组件
|
||||
*/
|
||||
@TableField("FORM_CPNT")
|
||||
private String formComponent;
|
||||
/**
|
||||
* 处理方法
|
||||
*/
|
||||
@TableField("TMT_MTHD")
|
||||
private String treatmentMethod;
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
@TableField("TMT_USER")
|
||||
private String treatmentUser;
|
||||
/**
|
||||
* 检定/校准类型
|
||||
*/
|
||||
@TableField("CLB_CHK_TP")
|
||||
private String calibrationCheckType;
|
||||
/**
|
||||
* 标准/规范
|
||||
*/
|
||||
@TableField("STD")
|
||||
private String standard;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
private String systemDepartmentCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("RMK")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.mapper;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 设备通用流程,验收、降级、停用、报废、还原、启用 Mapper
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceApplyMapper extends BaseMapperX<DeviceApplyDO> {
|
||||
|
||||
default PageResult<DeviceApplyDO> selectPage(DeviceApplyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceApplyDO>()
|
||||
.likeIfPresent(DeviceApplyDO::getBusinessName, reqVO.getBusinessName())
|
||||
.likeIfPresent(DeviceApplyDO::getApplyDepartmentName, reqVO.getApplyDepartmentName())
|
||||
.eqIfPresent(DeviceApplyDO::getApplyDepartment, reqVO.getApplyDepartment())
|
||||
.likeIfPresent(DeviceApplyDO::getApplyUserName, reqVO.getApplyUserName())
|
||||
.eqIfPresent(DeviceApplyDO::getApplyUser, reqVO.getApplyUser())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessCode, reqVO.getBusinessCode())
|
||||
.betweenIfPresent(DeviceApplyDO::getBusinessDate, reqVO.getBusinessDate())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessReason, reqVO.getBusinessReason())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessStatus, reqVO.getBusinessStatus())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessUser, reqVO.getBusinessUser())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessUserId, reqVO.getBusinessUserId())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessDepartment, reqVO.getBusinessDepartment())
|
||||
.eqIfPresent(DeviceApplyDO::getBusinessDepartmentId, reqVO.getBusinessDepartmentId())
|
||||
.betweenIfPresent(DeviceApplyDO::getPlanGivebackDate, reqVO.getPlanGivebackDate())
|
||||
.eqIfPresent(DeviceApplyDO::getGivebackReceiveUser, reqVO.getGivebackReceiveUser())
|
||||
.eqIfPresent(DeviceApplyDO::getGivebackReceiveUserId, reqVO.getGivebackReceiveUserId())
|
||||
.eqIfPresent(DeviceApplyDO::getDataCollectionId, reqVO.getDataCollectionId())
|
||||
.eqIfPresent(DeviceApplyDO::getFormData, reqVO.getFormData())
|
||||
.eqIfPresent(DeviceApplyDO::getFlowInstanceId, reqVO.getFlowInstanceId())
|
||||
.eqIfPresent(DeviceApplyDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(DeviceApplyDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(DeviceApplyDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DeviceApplyDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.mapper;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 设备-业务配置 Mapper
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceConfigBusinessRuleMapper extends BaseMapperX<DeviceConfigBusinessRuleDO> {
|
||||
|
||||
default PageResult<DeviceConfigBusinessRuleDO> selectPage(DeviceConfigBusinessRulePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceConfigBusinessRuleDO>()
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getProductId, reqVO.getProductId())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getBusinessDomain, reqVO.getBusinessDomain())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getRequireFlag, reqVO.getRequireFlag())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getSubitemDomainType, reqVO.getSubitemDomainType())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getFrequencyType, reqVO.getFrequencyType())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getFrequency, reqVO.getFrequency())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getFrequencyRemark, reqVO.getFrequencyRemark())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getReportTemplateKey, reqVO.getReportTemplateKey())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getFormComponent, reqVO.getFormComponent())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getTreatmentMethod, reqVO.getTreatmentMethod())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getTreatmentUser, reqVO.getTreatmentUser())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getCalibrationCheckType, reqVO.getCalibrationCheckType())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getStandard, reqVO.getStandard())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(DeviceConfigBusinessRuleDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(DeviceConfigBusinessRuleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DeviceConfigBusinessRuleDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zt.plat.module.qms.resource.device.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 设备通用流程,验收、降级、停用、报废、还原、启用 Service 接口
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
public interface DeviceApplyService {
|
||||
|
||||
/**
|
||||
* 创建设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
DeviceApplyRespVO createDeviceApply(@Valid DeviceApplySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDeviceApply(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDeviceApplyListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备通用流程,验收、降级、停用、报废、还原、启用
|
||||
*/
|
||||
DeviceApplyDO getDeviceApply(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备通用流程,验收、降级、停用、报废、还原、启用分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备通用流程,验收、降级、停用、报废、还原、启用分页
|
||||
*/
|
||||
PageResult<DeviceApplyDO> getDeviceApplyPage(DeviceApplyPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.zt.plat.module.qms.resource.device.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceApplyMapper;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_APPLY_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 设备通用流程,验收、降级、停用、报废、还原、启用 Service 实现类
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DeviceApplyServiceImpl implements DeviceApplyService {
|
||||
|
||||
@Resource
|
||||
private DeviceApplyMapper deviceApplyMapper;
|
||||
|
||||
@Override
|
||||
public DeviceApplyRespVO createDeviceApply(DeviceApplySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DeviceApplyDO deviceApply = BeanUtils.toBean(createReqVO, DeviceApplyDO.class);
|
||||
deviceApplyMapper.insert(deviceApply);
|
||||
// 返回
|
||||
return BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceApply(DeviceApplySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeviceApplyExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DeviceApplyDO updateObj = BeanUtils.toBean(updateReqVO, DeviceApplyDO.class);
|
||||
deviceApplyMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceApply(Long id) {
|
||||
// 校验存在
|
||||
validateDeviceApplyExists(id);
|
||||
// 删除
|
||||
deviceApplyMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceApplyListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDeviceApplyExists(ids);
|
||||
// 删除
|
||||
deviceApplyMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateDeviceApplyExists(List<Long> ids) {
|
||||
List<DeviceApplyDO> list = deviceApplyMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(DEVICE_APPLY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDeviceApplyExists(Long id) {
|
||||
if (deviceApplyMapper.selectById(id) == null) {
|
||||
throw exception(DEVICE_APPLY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceApplyDO getDeviceApply(Long id) {
|
||||
return deviceApplyMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DeviceApplyDO> getDeviceApplyPage(DeviceApplyPageReqVO pageReqVO) {
|
||||
return deviceApplyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zt.plat.module.qms.resource.device.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 设备-业务配置 Service 接口
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
public interface DeviceConfigBusinessRuleService {
|
||||
|
||||
/**
|
||||
* 创建设备-业务配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
DeviceConfigBusinessRuleRespVO createDeviceConfigBusinessRule(@Valid DeviceConfigBusinessRuleSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备-业务配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDeviceConfigBusinessRule(@Valid DeviceConfigBusinessRuleSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备-业务配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDeviceConfigBusinessRule(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除设备-业务配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteDeviceConfigBusinessRuleListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得设备-业务配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备-业务配置
|
||||
*/
|
||||
DeviceConfigBusinessRuleDO getDeviceConfigBusinessRule(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备-业务配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备-业务配置分页
|
||||
*/
|
||||
PageResult<DeviceConfigBusinessRuleDO> getDeviceConfigBusinessRulePage(DeviceConfigBusinessRulePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.zt.plat.module.qms.resource.device.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceConfigBusinessRuleMapper;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 设备-业务配置 Service 实现类
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DeviceConfigBusinessRuleServiceImpl implements DeviceConfigBusinessRuleService {
|
||||
|
||||
@Resource
|
||||
private DeviceConfigBusinessRuleMapper deviceConfigBusinessRuleMapper;
|
||||
|
||||
@Override
|
||||
public DeviceConfigBusinessRuleRespVO createDeviceConfigBusinessRule(DeviceConfigBusinessRuleSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
DeviceConfigBusinessRuleDO deviceConfigBusinessRule = BeanUtils.toBean(createReqVO, DeviceConfigBusinessRuleDO.class);
|
||||
deviceConfigBusinessRuleMapper.insert(deviceConfigBusinessRule);
|
||||
// 返回
|
||||
return BeanUtils.toBean(deviceConfigBusinessRule, DeviceConfigBusinessRuleRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceConfigBusinessRule(DeviceConfigBusinessRuleSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeviceConfigBusinessRuleExists(updateReqVO.getId());
|
||||
// 更新
|
||||
DeviceConfigBusinessRuleDO updateObj = BeanUtils.toBean(updateReqVO, DeviceConfigBusinessRuleDO.class);
|
||||
deviceConfigBusinessRuleMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceConfigBusinessRule(Long id) {
|
||||
// 校验存在
|
||||
validateDeviceConfigBusinessRuleExists(id);
|
||||
// 删除
|
||||
deviceConfigBusinessRuleMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceConfigBusinessRuleListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateDeviceConfigBusinessRuleExists(ids);
|
||||
// 删除
|
||||
deviceConfigBusinessRuleMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateDeviceConfigBusinessRuleExists(List<Long> ids) {
|
||||
List<DeviceConfigBusinessRuleDO> list = deviceConfigBusinessRuleMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDeviceConfigBusinessRuleExists(Long id) {
|
||||
if (deviceConfigBusinessRuleMapper.selectById(id) == null) {
|
||||
throw exception(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceConfigBusinessRuleDO getDeviceConfigBusinessRule(Long id) {
|
||||
return deviceConfigBusinessRuleMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DeviceConfigBusinessRuleDO> getDeviceConfigBusinessRulePage(DeviceConfigBusinessRulePageReqVO pageReqVO) {
|
||||
return deviceConfigBusinessRuleMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.resource.device.dal.mapper.DeviceApplyMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -1,216 +0,0 @@
|
||||
package com.zt.plat.module.qms;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 通用的签名、加解密工具类
|
||||
*/
|
||||
public final class CryptoSignatureUtils {
|
||||
|
||||
public static final String ENCRYPT_TYPE_AES = "AES";
|
||||
public static final String ENCRYPT_TYPE_DES = "DES";
|
||||
public static final String SIGNATURE_TYPE_MD5 = "MD5";
|
||||
public static final String SIGNATURE_TYPE_SHA256 = "SHA256";
|
||||
|
||||
private static final String AES_TRANSFORMATION = "AES/ECB/PKCS5Padding";
|
||||
public static final String SIGNATURE_FIELD = "signature";
|
||||
|
||||
private CryptoSignatureUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 AES 密钥(SecretKeySpec)
|
||||
*
|
||||
* @param password 密钥字符串
|
||||
* @return SecretKeySpec
|
||||
*/
|
||||
public static SecretKeySpec getSecretKey(String password) {
|
||||
try {
|
||||
KeyGenerator kg = KeyGenerator.getInstance("AES");
|
||||
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
|
||||
random.setSeed(password.getBytes(StandardCharsets.UTF_8));
|
||||
kg.init(128, random);
|
||||
SecretKey secretKey = kg.generateKey();
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getEncoded(), "AES");
|
||||
String keyStr = new String(secretKeySpec.getEncoded(), StandardCharsets.UTF_8);
|
||||
return secretKeySpec;
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new IllegalStateException("Failed to generate AES secret key", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称加密(Base64 格式输出)
|
||||
*
|
||||
* @param plaintext 明文内容
|
||||
* @param key 密钥
|
||||
* @param type 加密类型,支持 AES、DES
|
||||
* @return 密文(Base64 格式)
|
||||
*/
|
||||
public static String encrypt(String plaintext, String key, String type) {
|
||||
if (ENCRYPT_TYPE_AES.equalsIgnoreCase(type)) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key));
|
||||
byte[] result = cipher.doFinal(plaintext.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(result);
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException("Failed to encrypt using AES", ex);
|
||||
}
|
||||
} else if (ENCRYPT_TYPE_DES.equalsIgnoreCase(type)) {
|
||||
byte[] keyBytes = key.getBytes(StandardCharsets.UTF_8);
|
||||
byte[] desKey = new byte[8];
|
||||
System.arraycopy(keyBytes, 0, desKey, 0, Math.min(keyBytes.length, desKey.length));
|
||||
byte[] encrypted = SecureUtil.des(desKey).encrypt(plaintext.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(encrypted);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported encryption type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称解密(输入为 Base64 格式密文)
|
||||
*
|
||||
* @param ciphertext 密文内容(Base64 格式)
|
||||
* @param key 密钥
|
||||
* @param type 加密类型,支持 AES、DES
|
||||
* @return 明文内容
|
||||
*/
|
||||
public static String decrypt(String ciphertext, String key, String type) {
|
||||
if (ciphertext == null) {
|
||||
return null;
|
||||
}
|
||||
if (ENCRYPT_TYPE_AES.equalsIgnoreCase(type)) {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION);
|
||||
cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key));
|
||||
byte[] decoded = decodeBase64Ciphertext(ciphertext);
|
||||
byte[] result = cipher.doFinal(decoded);
|
||||
return new String(result, StandardCharsets.UTF_8);
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException("Failed to decrypt using AES", ex);
|
||||
}
|
||||
} else if (ENCRYPT_TYPE_DES.equalsIgnoreCase(type)) {
|
||||
byte[] keyBytes = key.getBytes(StandardCharsets.UTF_8);
|
||||
String keyStr = new String(keyBytes, StandardCharsets.UTF_8);
|
||||
byte[] desKey = new byte[8];
|
||||
System.arraycopy(keyBytes, 0, desKey, 0, Math.min(keyBytes.length, desKey.length));
|
||||
byte[] decoded = decodeBase64Ciphertext(ciphertext);
|
||||
byte[] decrypted = SecureUtil.des(desKey).decrypt(decoded);
|
||||
return new String(decrypted, StandardCharsets.UTF_8);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported encryption type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证请求签名
|
||||
*
|
||||
* @param reqMap 请求参数 Map
|
||||
* @param type 签名算法类型,支持 MD5、SHA256
|
||||
* @return 签名是否有效
|
||||
*/
|
||||
public static boolean verifySignature(Map<String, Object> reqMap, String type) {
|
||||
Map<String, Object> sortedMap = new TreeMap<>(reqMap);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String, Object> entry : sortedMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (SIGNATURE_FIELD.equals(key) || value == null) {
|
||||
continue;
|
||||
}
|
||||
sb.append(key).append('=');
|
||||
sb.append(value);
|
||||
sb.append('&');
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
String provided = (String) reqMap.get(SIGNATURE_FIELD);
|
||||
if (provided == null) {
|
||||
return false;
|
||||
}
|
||||
String computed;
|
||||
if (SIGNATURE_TYPE_MD5.equalsIgnoreCase(type)) {
|
||||
computed = SecureUtil.md5(sb.toString());
|
||||
} else if (SIGNATURE_TYPE_SHA256.equalsIgnoreCase(type)) {
|
||||
computed = SecureUtil.sha256(sb.toString());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported signature type: " + type);
|
||||
}
|
||||
return provided.equalsIgnoreCase(computed);
|
||||
}
|
||||
|
||||
private static byte[] decodeBase64Ciphertext(String ciphertext) {
|
||||
IllegalArgumentException last = null;
|
||||
for (String candidate : buildBase64Candidates(ciphertext)) {
|
||||
if (candidate == null || candidate.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
return Base64.getDecoder().decode(candidate);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
last = ex;
|
||||
}
|
||||
}
|
||||
throw last != null ? last : new IllegalArgumentException("Invalid Base64 content");
|
||||
}
|
||||
|
||||
private static Set<String> buildBase64Candidates(String ciphertext) {
|
||||
Set<String> candidates = new LinkedHashSet<>();
|
||||
if (ciphertext == null) {
|
||||
return candidates;
|
||||
}
|
||||
String trimmed = ciphertext.trim();
|
||||
candidates.add(trimmed);
|
||||
|
||||
String withoutWhitespace = stripWhitespace(trimmed);
|
||||
candidates.add(withoutWhitespace);
|
||||
|
||||
if (trimmed.indexOf(' ') >= 0) {
|
||||
String restoredPlus = trimmed.replace(' ', '+');
|
||||
candidates.add(restoredPlus);
|
||||
candidates.add(stripWhitespace(restoredPlus));
|
||||
}
|
||||
|
||||
String urlNormalised = withoutWhitespace
|
||||
.replace('-', '+')
|
||||
.replace('_', '/');
|
||||
candidates.add(urlNormalised);
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
private static String stripWhitespace(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
boolean hasWhitespace = false;
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
if (Character.isWhitespace(value.charAt(i))) {
|
||||
hasWhitespace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasWhitespace) {
|
||||
return value;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(value.length());
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char ch = value.charAt(i);
|
||||
if (!Character.isWhitespace(ch)) {
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.zt.plat.framework.common.util.security.CryptoSignatureUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URI;
|
||||
@@ -39,25 +41,25 @@ public class DatabusApiInvocationExample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// OUT.println("=== GET 请求示例 ===");
|
||||
// executeGetExample();
|
||||
executeGetExample();
|
||||
// OUT.println();
|
||||
// OUT.println("=== POST 请求示例 ===");
|
||||
// executePostExample();
|
||||
String encodeStr = "SFqGUDidGgWMWvcU6Qy8SNvyhESvZV9uViIz6lisYB9A1qvKrhotX0JXLrcgcL057d+ZVMDJxngw+UvQ5F6UnYXeDGtyAr/ZXKqSXApygdPYZQPwbj1hzUAZhTw/oHUc7ucU59jT5N1TYW/4jJPzmnMU28D0gXrRVDUmX/SNfPlpN9YvPIobzMeoXZlNkFdURZzIX9aQbhgRNXZHruGQGcqDLePkSh01oq9D+i65DNWQGAYDTGfdVTXuGJw6UY4fQJsn7/5HxZoVWKXgKwAmWo/+KwUG5AVD1BcfK7avYLXAcmnJJftFwZvB08eoe7/ySp4ytv1iSHYxUGZ8YNbUS/wIA3pVhfJHWz1Ko0t3nBbxBtLAOmj2jNzjxU/TI/g1n5dtX8B2OoiMZUHHJaHNEMqmULfLILZE7oMGNbRAh1T0gZcU+rkFfm/995ZnTUmaCCKrKZAs5p0FPqhXRf/ZchN0G6opd9hBE+hJY7v92uDqK5RkgomRIAFcf73d7pnIXTgKHMtLLn7r298+A1kKgyH28wGS6pqGfvdZ1yHqbb5zFNvA9IF60VQ1Jl/0jXz5CJBXy+d+QqX/s06uXDzZ2UWcyF/WkG4YETV2R67hkBnKgy3j5EodNaKvQ/ouuQzVkBgGA0xn3VU17hicOlGOH0CbJ+/+R8WaFVil4CsAJlqjj0mF1g5XV34ddfgOcGFYdcKvMDA+YRf1zK8oGRwGekqeMrb9Ykh2MVBmfGDW1EueSNggsyxhSQWEnThMCB2stDi4frs5kanGFhC7er/L9fTD1leamk8i04Wy5eC0PALKplC3yyC2RO6DBjW0QIdU9IGXFPq5BX5v/feWZ01JmggiqymQLOadBT6oV0X/2XIimcN9BgTUX2en4UohmG1NAjFVyWRqx4KmhX10IRwB47CxOMt1NRhwz7UCTqb7fn60/OcolT4ljcD7SuLCj5zwNCt3cQ4eX+mpPecoUtsPdA==";
|
||||
// String encodeStr = "SFqGUDidGgWMWvcU6Qy8SNvyhESvZV9uViIz6lisYB9A1qvKrhotX0JXLrcgcL057d+ZVMDJxngw+UvQ5F6UnYXeDGtyAr/ZXKqSXApygdPYZQPwbj1hzUAZhTw/oHUc7ucU59jT5N1TYW/4jJPzmnMU28D0gXrRVDUmX/SNfPlpN9YvPIobzMeoXZlNkFdURZzIX9aQbhgRNXZHruGQGcqDLePkSh01oq9D+i65DNWQGAYDTGfdVTXuGJw6UY4fQJsn7/5HxZoVWKXgKwAmWo/+KwUG5AVD1BcfK7avYLXAcmnJJftFwZvB08eoe7/ySp4ytv1iSHYxUGZ8YNbUS/wIA3pVhfJHWz1Ko0t3nBbxBtLAOmj2jNzjxU/TI/g1n5dtX8B2OoiMZUHHJaHNEMqmULfLILZE7oMGNbRAh1T0gZcU+rkFfm/995ZnTUmaCCKrKZAs5p0FPqhXRf/ZchN0G6opd9hBE+hJY7v92uDqK5RkgomRIAFcf73d7pnIXTgKHMtLLn7r298+A1kKgyH28wGS6pqGfvdZ1yHqbb5zFNvA9IF60VQ1Jl/0jXz5CJBXy+d+QqX/s06uXDzZ2UWcyF/WkG4YETV2R67hkBnKgy3j5EodNaKvQ/ouuQzVkBgGA0xn3VU17hicOlGOH0CbJ+/+R8WaFVil4CsAJlqjj0mF1g5XV34ddfgOcGFYdcKvMDA+YRf1zK8oGRwGekqeMrb9Ykh2MVBmfGDW1EueSNggsyxhSQWEnThMCB2stDi4frs5kanGFhC7er/L9fTD1leamk8i04Wy5eC0PALKplC3yyC2RO6DBjW0QIdU9IGXFPq5BX5v/feWZ01JmggiqymQLOadBT6oV0X/2XIimcN9BgTUX2en4UohmG1NAjFVyWRqx4KmhX10IRwB47CxOMt1NRhwz7UCTqb7fn60/OcolT4ljcD7SuLCj5zwNCt3cQ4eX+mpPecoUtsPdA==";
|
||||
|
||||
String decrypt = tryDecrypt(encodeStr);
|
||||
String aa = normalizePotentialMojibake(decrypt);
|
||||
OUT.println(decrypt);
|
||||
// String decrypt = tryDecrypt(encodeStr);
|
||||
// String aa = normalizePotentialMojibake(decrypt);
|
||||
// OUT.println(decrypt);
|
||||
}
|
||||
|
||||
private static void executeGetExample() throws Exception {
|
||||
Map<String, Object> queryParams = new LinkedHashMap<>();
|
||||
queryParams.put("taskTimeStart", "2025-11-27 09:00:00");
|
||||
queryParams.put("taskTimeEnd", "2025-11-28 23:00:00");
|
||||
// queryParams.put("id", "1994323064365080578");
|
||||
// queryParams.put("taskTimeStart", "2025-11-01 09:00:00");
|
||||
// queryParams.put("taskTimeEnd", "2025-12-2823:00:00");
|
||||
queryParams.put("id", "1994326604806447106");
|
||||
String signature = generateSignature(queryParams, Map.of());
|
||||
String url = TARGET_API + "/qms.ytjc.auto-ingredients.task-list/v1"; //获取检验批列表
|
||||
// String url = TARGET_API + "/qms.ytjc.auto-ingredients.task-detail-list/v1"; //获取检验批中的检测任务
|
||||
// String url = TARGET_API + "/qms.ytjc.auto-ingredients.task-list/v1"; //获取检验批列表
|
||||
String url = TARGET_API + "/qms.ytjc.auto-ingredients.task-detail-list/v1"; //获取检验批中的检测任务
|
||||
URI requestUri = buildUri(url, queryParams);
|
||||
String nonce = randomNonce();
|
||||
HttpRequest request = HttpRequest.newBuilder(requestUri)
|
||||
|
||||
Reference in New Issue
Block a user