Merge branch 'test' of https://git.will-way.cn/zgty/zt-qms into test

This commit is contained in:
2026-01-04 11:01:16 +08:00
22 changed files with 759 additions and 86 deletions

View File

@@ -814,8 +814,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
sigIds.add(Long.parseLong(signatureId));
});
if(sigIds.isEmpty())
return "";
return docSigJson.toJSONString();
List<ConfigUserSignatureDO> sigList = configUserSignatureService.getByIdList(sigIds);
docSigJson.forEach((key, value) -> {
JSONObject obj = docSigJson.getJSONObject( key);

View File

@@ -52,16 +52,17 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
@Resource
private DeviceApplyService deviceApplyService;
//todo 通过设备通用流程配置创建
@PostMapping("/create")
@Operation(summary = "创建设备通用流程,验收、降级、停用、报废、还原、启用")
@PreAuthorize("@ss.hasPermission('qms:device-apply:create')")
// @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')")
// @PreAuthorize("@ss.hasPermission('qms:device-apply:update')")
public CommonResult<Boolean> updateDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO updateReqVO) {
deviceApplyService.updateDeviceApply(updateReqVO);
return success(true);
@@ -70,7 +71,7 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
@DeleteMapping("/delete")
@Operation(summary = "删除设备通用流程,验收、降级、停用、报废、还原、启用")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:device-apply:delete')")
// @PreAuthorize("@ss.hasPermission('qms:device-apply:delete')")
public CommonResult<Boolean> deleteDeviceApply(@RequestParam("id") Long id) {
deviceApplyService.deleteDeviceApply(id);
return success(true);

View File

@@ -0,0 +1,116 @@
package com.zt.plat.module.qms.resource.device.controller.admin;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO;
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 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.DeviceConfigFlowDO;
import com.zt.plat.module.qms.resource.device.service.DeviceConfigFlowService;
@Tag(name = "管理后台 - 设备通用流程配置")
@RestController
@RequestMapping("/qms/resource/device-config-flow")
@Validated
public class DeviceConfigFlowController implements BusinessControllerMarker {
@Resource
private DeviceConfigFlowService deviceConfigFlowService;
@GetMapping("/getEnableList")
@Operation(summary = "获得设备通用流程配置")
public CommonResult<PageResult<DeviceConfigFlowRespVO>> getEnableList(@Valid DeviceConfigFlowPageReqVO pageReqVO) {
PageResult<DeviceConfigFlowDO> pageResult = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DeviceConfigFlowRespVO.class));
}
@PostMapping("/create")
@Operation(summary = "创建设备通用流程配置")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:create')")
public CommonResult<DeviceConfigFlowRespVO> createDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO createReqVO) {
return success(deviceConfigFlowService.createDeviceConfigFlow(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新设备通用流程配置")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:update')")
public CommonResult<Boolean> updateDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO updateReqVO) {
deviceConfigFlowService.updateDeviceConfigFlow(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除设备通用流程配置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
public CommonResult<Boolean> deleteDeviceConfigFlow(@RequestParam("id") Long id) {
deviceConfigFlowService.deleteDeviceConfigFlow(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除设备通用流程配置")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
public CommonResult<Boolean> deleteDeviceConfigFlowList(@RequestBody BatchDeleteReqVO req) {
deviceConfigFlowService.deleteDeviceConfigFlowListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得设备通用流程配置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')")
public CommonResult<DeviceConfigFlowRespVO> getDeviceConfigFlow(@RequestParam("id") Long id) {
DeviceConfigFlowDO deviceConfigFlow = deviceConfigFlowService.getDeviceConfigFlow(id);
return success(BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得设备通用流程配置分页")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')")
public CommonResult<PageResult<DeviceConfigFlowRespVO>> getDeviceConfigFlowPage(@Valid DeviceConfigFlowPageReqVO pageReqVO) {
PageResult<DeviceConfigFlowDO> pageResult = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DeviceConfigFlowRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出设备通用流程配置 Excel")
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDeviceConfigFlowExcel(@Valid DeviceConfigFlowPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DeviceConfigFlowDO> list = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "设备通用流程配置.xls", "数据", DeviceConfigFlowRespVO.class,
BeanUtils.toBean(list, DeviceConfigFlowRespVO.class));
}
}

View File

@@ -96,8 +96,11 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
@PutMapping("/update")
@Operation(summary = "更新设备-使用记录")
@PreAuthorize("@ss.hasPermission('qms:device-use-record:update')")
public CommonResult<Boolean> updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO updateReqVO) {
deviceUseRecordService.updateDeviceUseRecord(updateReqVO);
public CommonResult<Boolean> updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO reqVO) {
Long deviceId = reqVO.getDeviceId();
if(deviceId == null)
return CommonResult.error(DEVICE_USE_RECORD_NOT_EXISTS.getCode(), "设备ID不能为空");
deviceUseRecordService.updateDeviceUseRecord(reqVO);
return success(true);
}

View File

@@ -12,7 +12,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data
public class DeviceApplyPageReqVO extends PageParam {
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五")
private String businessName;
@Schema(description = "申请部门", example = "王五")
@@ -21,7 +21,7 @@ public class DeviceApplyPageReqVO extends PageParam {
@Schema(description = "申请部门ID")
private String applyDepartment;
@Schema(description = "申请人", example = "王五")
@Schema(description = "申请人", example = "ZT")
private String applyUserName;
@Schema(description = "申请人ID")
@@ -43,13 +43,13 @@ public class DeviceApplyPageReqVO extends PageParam {
@Schema(description = "借用人")
private String businessUser;
@Schema(description = "借用人id", example = "14524")
@Schema(description = "借用人id", example = "30865")
private Long businessUserId;
@Schema(description = "借用部门")
private String businessDepartment;
@Schema(description = "借用部门id", example = "894")
@Schema(description = "借用部门id", example = "3852")
private Long businessDepartmentId;
@Schema(description = "计划归还日期")
@@ -59,16 +59,22 @@ public class DeviceApplyPageReqVO extends PageParam {
@Schema(description = "归还接收人")
private String givebackReceiveUser;
@Schema(description = "归还接收人id", example = "1528")
@Schema(description = "归还接收人id", example = "1499")
private Long givebackReceiveUserId;
@Schema(description = "数据集配置ID", example = "12435")
@Schema(description = "表单模板ID", example = "23422")
private String templateId;
@Schema(description = "表单组件")
private String formComponent;
@Schema(description = "数据集配置ID", example = "17263")
private Long dataCollectionId;
@Schema(description = "表单数据")
private String formData;
@Schema(description = "流程实例id", example = "15634")
@Schema(description = "流程实例id", example = "289")
private String flowInstanceId;
@Schema(description = "所属部门")

View File

@@ -11,11 +11,11 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated
public class DeviceApplyRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295")
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23536")
@ExcelProperty("ID")
private Long id;
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五")
@ExcelProperty("业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等")
private String businessName;
@@ -27,7 +27,7 @@ public class DeviceApplyRespVO {
@ExcelProperty("申请部门ID")
private String applyDepartment;
@Schema(description = "申请人", example = "王五")
@Schema(description = "申请人", example = "ZT")
@ExcelProperty("申请人")
private String applyUserName;
@@ -55,7 +55,7 @@ public class DeviceApplyRespVO {
@ExcelProperty("借用人")
private String businessUser;
@Schema(description = "借用人id", example = "14524")
@Schema(description = "借用人id", example = "30865")
@ExcelProperty("借用人id")
private Long businessUserId;
@@ -63,7 +63,7 @@ public class DeviceApplyRespVO {
@ExcelProperty("借用部门")
private String businessDepartment;
@Schema(description = "借用部门id", example = "894")
@Schema(description = "借用部门id", example = "3852")
@ExcelProperty("借用部门id")
private Long businessDepartmentId;
@@ -75,11 +75,19 @@ public class DeviceApplyRespVO {
@ExcelProperty("归还接收人")
private String givebackReceiveUser;
@Schema(description = "归还接收人id", example = "1528")
@Schema(description = "归还接收人id", example = "1499")
@ExcelProperty("归还接收人id")
private Long givebackReceiveUserId;
@Schema(description = "数据集配置ID", example = "12435")
@Schema(description = "表单模板ID", example = "23422")
@ExcelProperty("表单模板ID")
private String templateId;
@Schema(description = "表单组件")
@ExcelProperty("表单组件")
private String formComponent;
@Schema(description = "数据集配置ID", example = "17263")
@ExcelProperty("数据集配置ID")
private Long dataCollectionId;
@@ -87,7 +95,7 @@ public class DeviceApplyRespVO {
@ExcelProperty("表单数据")
private String formData;
@Schema(description = "流程实例id", example = "15634")
@Schema(description = "流程实例id", example = "289")
@ExcelProperty("流程实例id")
private String flowInstanceId;

View File

@@ -9,10 +9,10 @@ import java.time.LocalDateTime;
@Data
public class DeviceApplySaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295")
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23536")
private Long id;
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT")
@Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五")
private String businessName;
@Schema(description = "申请部门", example = "王五")
@@ -21,7 +21,7 @@ public class DeviceApplySaveReqVO {
@Schema(description = "申请部门ID")
private String applyDepartment;
@Schema(description = "申请人", example = "王五")
@Schema(description = "申请人", example = "ZT")
private String applyUserName;
@Schema(description = "申请人ID")
@@ -42,13 +42,13 @@ public class DeviceApplySaveReqVO {
@Schema(description = "借用人")
private String businessUser;
@Schema(description = "借用人id", example = "14524")
@Schema(description = "借用人id", example = "30865")
private Long businessUserId;
@Schema(description = "借用部门")
private String businessDepartment;
@Schema(description = "借用部门id", example = "894")
@Schema(description = "借用部门id", example = "3852")
private Long businessDepartmentId;
@Schema(description = "计划归还日期")
@@ -57,16 +57,22 @@ public class DeviceApplySaveReqVO {
@Schema(description = "归还接收人")
private String givebackReceiveUser;
@Schema(description = "归还接收人id", example = "1528")
@Schema(description = "归还接收人id", example = "1499")
private Long givebackReceiveUserId;
@Schema(description = "数据集配置ID", example = "12435")
@Schema(description = "表单模板ID", example = "23422")
private String templateId;
@Schema(description = "表单组件")
private String formComponent;
@Schema(description = "数据集配置ID", example = "17263")
private Long dataCollectionId;
@Schema(description = "表单数据")
private String formData;
@Schema(description = "流程实例id", example = "15634")
@Schema(description = "流程实例id", example = "289")
private String flowInstanceId;
@Schema(description = "所属部门")

View File

@@ -0,0 +1,49 @@
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 DeviceConfigFlowPageReqVO extends PageParam {
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "业务类型名称", example = "王五")
private String businessName;
@Schema(description = "流程key")
private String flowKey;
@Schema(description = "数据集配置Key")
private String dataCollectionKey;
@Schema(description = "表单模板key")
private String templateKey;
@Schema(description = "表单组件")
private String formComponent;
@Schema(description = "其他配置")
private String customConfig;
@Schema(description = "排序号")
private Integer orderNo;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,60 @@
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 DeviceConfigFlowRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6744")
@ExcelProperty("主键")
private Long id;
@Schema(description = "业务类型", example = "2")
@ExcelProperty("业务类型")
private String businessType;
@Schema(description = "业务类型名称", example = "王五")
@ExcelProperty("业务类型名称")
private String businessName;
@Schema(description = "流程key")
@ExcelProperty("流程key")
private String flowKey;
@Schema(description = "数据集配置Key")
@ExcelProperty("数据集配置ID")
private String dataCollectionKey;
@Schema(description = "表单模板key")
@ExcelProperty("表单模板key")
private String templateKey;
@Schema(description = "表单组件")
@ExcelProperty("表单组件")
private String formComponent;
@Schema(description = "其他配置")
private String customConfig;;
@Schema(description = "排序号")
private Integer orderNo;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,43 @@
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 DeviceConfigFlowSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6744")
private Long id;
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "业务类型名称", example = "王五")
private String businessName;
@Schema(description = "流程key")
private String flowKey;
@Schema(description = "数据集配置Key")
private String dataCollectionKey;
@Schema(description = "表单模板key")
private String templateKey;
@Schema(description = "表单组件")
private String formComponent;
@Schema(description = "其他配置")
private String customConfig;;
@Schema(description = "排序号")
private Integer orderNo;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
}

View File

@@ -23,9 +23,11 @@ public class DeviceUseRecordPageReqVO extends PageParam {
private Long userId;
@Schema(description = "开始使用时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] useTimeStart;
@Schema(description = "结束使用时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] useTimeEnd;
@Schema(description = "使用记录")

View File

@@ -27,113 +27,123 @@ public class DeviceApplyDO extends BusinessBaseDO {
/**
* ID
*/
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等
*/
* 业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等
*/
@TableField("BSN_NAME")
private String businessName;
/**
* 申请部门
*/
* 申请部门
*/
@TableField("APL_DEPT_NAME")
private String applyDepartmentName;
/**
* 申请部门ID
*/
* 申请部门ID
*/
@TableField("APL_DEPT")
private String applyDepartment;
/**
* 申请人
*/
* 申请人
*/
@TableField("APL_USER_NAME")
private String applyUserName;
/**
* 申请人ID
*/
* 申请人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
*/
* 借用人id
*/
@TableField("BSN_USER_ID")
private Long businessUserId;
/**
* 借用部门
*/
* 借用部门
*/
@TableField("BSN_DEPT")
private String businessDepartment;
/**
* 借用部门id
*/
* 借用部门id
*/
@TableField("BSN_DEPT_ID")
private Long businessDepartmentId;
/**
* 计划归还日期
*/
* 计划归还日期
*/
@TableField("PLN_GIV_DT")
private LocalDateTime planGivebackDate;
/**
* 归还接收人
*/
* 归还接收人
*/
@TableField("GIV_RCV_USER")
private String givebackReceiveUser;
/**
* 归还接收人id
*/
* 归还接收人id
*/
@TableField("GIV_RCV_USER_ID")
private Long givebackReceiveUserId;
/**
* 数据集配置ID
*/
* 表单模板ID
*/
@TableField("TMPL_ID")
private String templateId;
/**
* 表单组件
*/
@TableField("FORM_CPNT")
private String formComponent;
/**
* 数据集配置ID
*/
@TableField("DAT_COLT_ID")
private Long dataCollectionId;
/**
* 表单数据
*/
* 表单数据
*/
@TableField("FORM_DAT")
private String formData;
/**
* 流程实例id
*/
* 流程实例id
*/
@TableField("FLW_INSC_ID")
private String flowInstanceId;
/**
* 所属部门
*/
* 所属部门
*/
@TableField("SYS_DEPT_CD")
private String systemDepartmentCode;
/**
* 备注
*/
* 备注
*/
@TableField("RMK")
private String remark;

View File

@@ -0,0 +1,82 @@
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_flw")
@KeySequence("t_dev_cfg_flw_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class DeviceConfigFlowDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 业务类型
*/
@TableField("BSN_TP")
private String businessType;
/**
* 业务类型名称
*/
@TableField("BSN_NAME")
private String businessName;
/**
* 流程key
*/
@TableField("FLW_KY")
private String flowKey;
/**
* 数据集配置Key
*/
@TableField("DAT_COLT_KY")
private String dataCollectionKey;
/**
* 表单模板key
*/
@TableField("TMPL_KY")
private String templateKey;
/**
* 表单组件
*/
@TableField("FORM_CPNT")
private String formComponent;
/**
* 其他配置
*/
@TableField("CST_CFG")
private String customConfig;
//排序号
@TableField("ORD_NO")
private Integer orderNo;
/**
* 所属部门
*/
@TableField("SYS_DEPT_CD")
private String systemDepartmentCode;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,49 @@
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.dal.dataobject.DeviceConfigFlowDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 设备通用流程配置 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface DeviceConfigFlowMapper extends BaseMapperX<DeviceConfigFlowDO> {
default PageResult<DeviceConfigFlowDO> selectPage(DeviceConfigFlowPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceConfigFlowDO>()
.eqIfPresent(DeviceConfigFlowDO::getBusinessType, reqVO.getBusinessType())
.likeIfPresent(DeviceConfigFlowDO::getBusinessName, reqVO.getBusinessName())
.eqIfPresent(DeviceConfigFlowDO::getFlowKey, reqVO.getFlowKey())
.eqIfPresent(DeviceConfigFlowDO::getDataCollectionKey, reqVO.getDataCollectionKey())
.eqIfPresent(DeviceConfigFlowDO::getTemplateKey, reqVO.getTemplateKey())
.eqIfPresent(DeviceConfigFlowDO::getFormComponent, reqVO.getFormComponent())
.eqIfPresent(DeviceConfigFlowDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(DeviceConfigFlowDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DeviceConfigFlowDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DeviceConfigFlowDO::getId));
}
default List<DeviceConfigFlowDO> selectList(DeviceConfigFlowPageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<DeviceConfigFlowDO>()
.eqIfPresent(DeviceConfigFlowDO::getBusinessType, reqVO.getBusinessType())
.likeIfPresent(DeviceConfigFlowDO::getBusinessName, reqVO.getBusinessName())
.eqIfPresent(DeviceConfigFlowDO::getFlowKey, reqVO.getFlowKey())
.eqIfPresent(DeviceConfigFlowDO::getDataCollectionKey, reqVO.getDataCollectionKey())
.eqIfPresent(DeviceConfigFlowDO::getTemplateKey, reqVO.getTemplateKey())
.eqIfPresent(DeviceConfigFlowDO::getFormComponent, reqVO.getFormComponent())
.eqIfPresent(DeviceConfigFlowDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(DeviceConfigFlowDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DeviceConfigFlowDO::getCreateTime, reqVO.getCreateTime())
.orderByAsc(DeviceConfigFlowDO::getOrderNo)
);
}
}

View File

@@ -4,8 +4,13 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 设备-设备信息 Mapper
@@ -56,4 +61,7 @@ public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO>
.orderByDesc(DeviceInfomationDO::getId));
}
//查询需要“某个业务类型”的设备列表
List<DeviceInfoWithBizConfigVO> getListNeedByRule(@Param("param") Map<String, Object> param);
}

View File

@@ -0,0 +1,66 @@
package com.zt.plat.module.qms.resource.device.service;
import java.util.*;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO;
import jakarta.validation.*;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigFlowDO;
import com.zt.plat.framework.common.pojo.PageResult;
/**
* 设备通用流程配置 Service 接口
*
* @author 后台管理-1
*/
public interface DeviceConfigFlowService {
List<DeviceConfigFlowDO> getEnableList(DeviceConfigFlowPageReqVO pageReqVO);
/**
* 创建设备通用流程配置
*
* @param createReqVO 创建信息
* @return 编号
*/
DeviceConfigFlowRespVO createDeviceConfigFlow(@Valid DeviceConfigFlowSaveReqVO createReqVO);
/**
* 更新设备通用流程配置
*
* @param updateReqVO 更新信息
*/
void updateDeviceConfigFlow(@Valid DeviceConfigFlowSaveReqVO updateReqVO);
/**
* 删除设备通用流程配置
*
* @param id 编号
*/
void deleteDeviceConfigFlow(Long id);
/**
* 批量删除设备通用流程配置
*
* @param ids 编号
*/
void deleteDeviceConfigFlowListByIds(List<Long> ids);
/**
* 获得设备通用流程配置
*
* @param id 编号
* @return 设备通用流程配置
*/
DeviceConfigFlowDO getDeviceConfigFlow(Long id);
/**
* 获得设备通用流程配置分页
*
* @param pageReqVO 分页查询
* @return 设备通用流程配置分页
*/
PageResult<DeviceConfigFlowDO> getDeviceConfigFlowPage(DeviceConfigFlowPageReqVO pageReqVO);
}

View File

@@ -0,0 +1,97 @@
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.DeviceConfigFlowPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO;
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.DeviceConfigFlowDO;
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.DeviceConfigFlowMapper;
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.*;
/**
* 设备通用流程配置 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class DeviceConfigFlowServiceImpl implements DeviceConfigFlowService {
@Resource
private DeviceConfigFlowMapper deviceConfigFlowMapper;
@Override
public List<DeviceConfigFlowDO> getEnableList(DeviceConfigFlowPageReqVO pageReqVO) {
return deviceConfigFlowMapper.selectList(pageReqVO);
}
@Override
public DeviceConfigFlowRespVO createDeviceConfigFlow(DeviceConfigFlowSaveReqVO createReqVO) {
// 插入
DeviceConfigFlowDO deviceConfigFlow = BeanUtils.toBean(createReqVO, DeviceConfigFlowDO.class);
deviceConfigFlowMapper.insert(deviceConfigFlow);
// 返回
return BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class);
}
@Override
public void updateDeviceConfigFlow(DeviceConfigFlowSaveReqVO updateReqVO) {
// 校验存在
validateDeviceConfigFlowExists(updateReqVO.getId());
// 更新
DeviceConfigFlowDO updateObj = BeanUtils.toBean(updateReqVO, DeviceConfigFlowDO.class);
deviceConfigFlowMapper.updateById(updateObj);
}
@Override
public void deleteDeviceConfigFlow(Long id) {
// 校验存在
validateDeviceConfigFlowExists(id);
// 删除
deviceConfigFlowMapper.deleteById(id);
}
@Override
public void deleteDeviceConfigFlowListByIds(List<Long> ids) {
// 校验存在
validateDeviceConfigFlowExists(ids);
// 删除
deviceConfigFlowMapper.deleteByIds(ids);
}
private void validateDeviceConfigFlowExists(List<Long> ids) {
List<DeviceConfigFlowDO> list = deviceConfigFlowMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(DEVICE_CONFIG_FLOW_NOT_EXISTS);
}
}
private void validateDeviceConfigFlowExists(Long id) {
if (deviceConfigFlowMapper.selectById(id) == null) {
throw exception(DEVICE_CONFIG_FLOW_NOT_EXISTS);
}
}
@Override
public DeviceConfigFlowDO getDeviceConfigFlow(Long id) {
return deviceConfigFlowMapper.selectById(id);
}
@Override
public PageResult<DeviceConfigFlowDO> getDeviceConfigFlowPage(DeviceConfigFlowPageReqVO pageReqVO) {
return deviceConfigFlowMapper.selectPage(pageReqVO);
}
}

View File

@@ -88,11 +88,10 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService {
return CommonResult.error( DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备在维修中");
return CommonResult.success( true);
}
/*todo 查询需要“某个业务类型”的设备列表*/
/*查询需要“某个业务类型”的设备列表*/
@Override
public List<DeviceInfoWithBizConfigVO> getListNeedByRule(JSONObject params) {
return null;
return deviceInfomationMapper.getListNeedByRule(params);
}
/*

View File

@@ -1,15 +1,15 @@
package com.zt.plat.module.qms.resource.device.service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordSaveReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordVO;
import com.zt.plat.module.qms.resource.device.controller.vo.*;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
@@ -36,14 +36,27 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_USE_RECORD_
public class DeviceUseRecordServiceImpl implements DeviceUseRecordService {
@Resource private DeviceInfomationService deviceInfomationService;
@Resource private DeviceProductService deviceProductService;
@Resource private DeviceUseRecordMapper deviceUseRecordMapper;
@Override
public PageResult<DeviceUseRecordVO> queryPageListWithCount(DeviceUseRecordPageReqVO reqVO) {
return null;
Long productId = reqVO.getProductId();
if(productId != null){
List<Long> productIds = deviceProductService.getIdListByIdPath(productId);
List<Long> deviceIds = deviceInfomationService.getIdListByProductIdList(productIds);
if(!deviceIds.isEmpty()){
reqVO.setProductId(null);
reqVO.setDeviceIdList(deviceIds);
}
}
Page<DeviceUseRecordVO> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
IPage<DeviceUseRecordVO> pageList = deviceUseRecordMapper.queryPageListWithCount(page, reqVO);
return new PageResult<>(pageList.getRecords(), pageList.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResult<DeviceUseRecordRespVO> createDeviceUseRecord(DeviceUseRecordSaveReqVO reqVO) {
Long deviceId = reqVO.getDeviceId();
if(ObjectUtils.isEmpty(reqVO.getUserName())){
@@ -66,11 +79,17 @@ public class DeviceUseRecordServiceImpl implements DeviceUseRecordService {
}
@Override
public void updateDeviceUseRecord(DeviceUseRecordSaveReqVO updateReqVO) {
@Transactional(rollbackFor = Exception.class)
public void updateDeviceUseRecord(DeviceUseRecordSaveReqVO reqVO) {
// 校验存在
validateDeviceUseRecordExists(updateReqVO.getId());
validateDeviceUseRecordExists(reqVO.getId());
Long deviceId = reqVO.getDeviceId();
if(reqVO.getUseTimeEnd() == null)
deviceInfomationService.updateDeviceInUseFlag(deviceId, 1);
else
deviceInfomationService.updateDeviceInUseFlag(deviceId, 0);
// 更新
DeviceUseRecordDO updateObj = BeanUtils.toBean(updateReqVO, DeviceUseRecordDO.class);
DeviceUseRecordDO updateObj = BeanUtils.toBean(reqVO, DeviceUseRecordDO.class);
deviceUseRecordMapper.updateById(updateObj);
}

View File

@@ -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.DeviceConfigFlowMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@@ -9,4 +9,42 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getListNeedByRule" resultType="com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO">
select
d.*,
r.id as rule_id,
r.business_domain,
r.need_flag,
r.sub_domain_type,
r.frequency_type,
r.frequency,
r.frequency_remark,
r.report_template_key,
r.form_component,
r.process_method,
r.process_user,
r.standard,
r.calibration_check_type
from T_DEV_INF d
left join T_DEV_PDT p on d.PDT_ID = p.ID
left join T_DEV_CFG_BSN_RUL r on p.ID = r.PDT_ID
<where>
and d.DELETED = 0
and p.DELETED = 0
and r.DELETED = 0
<if test="param.id != null and param.id != ''">
and d.ID = #{param.id}
</if>
<if test="param.deptCodeList!=null and param.deptCodeList.size>0">
and d.DEPT_ID in
<foreach collection="param.deptCodeList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and r.BSN_DMN = #{param.businessType}
and r.REQR_FLG = 1
</where>
</select>
</mapper>