Commit a0dab040baddf347ef6c5878d88446d51eca35e8

Authored by 杨鸣坤
2 parents f1c05f92 7b7722f8

Merge branch 'test_ymk_from_0102' into test_hhl_0102

# Conflicts:
#	application/src/main/data/sql/qg.sql
Showing 29 changed files with 1339 additions and 11 deletions
... ... @@ -103,6 +103,7 @@ CREATE TABLE "public"."qg_inspection_plan"
103 103 "status" varchar(50) NOT NULL,
104 104 "start_time" timestamp(6),
105 105 "end_time" timestamp(6),
  106 + "tenant_id" varchar(36),
106 107 "create_time" timestamp(6),
107 108 "creator" varchar(36),
108 109 "updater" varchar(36),
... ... @@ -117,6 +118,7 @@ COMMENT ON COLUMN "public"."qg_inspection_plan"."name" IS '计划名称';
117 118 COMMENT ON COLUMN "public"."qg_inspection_plan"."status" IS '计划状态';
118 119 COMMENT ON COLUMN "public"."qg_inspection_plan"."start_time" IS '开始日期';
119 120 COMMENT ON COLUMN "public"."qg_inspection_plan"."end_time" IS '结束日期';
  121 +COMMENT ON COLUMN "public"."qg_inspection_plan"."tenant_id" IS '租户ID';
120 122 COMMENT ON COLUMN "public"."qg_inspection_plan"."remark" IS '计划备注';
121 123
122 124 CREATE TABLE "public"."qg_check_plan"
... ... @@ -127,6 +129,7 @@ CREATE TABLE "public"."qg_check_plan"
127 129 "type" varchar(50),
128 130 "status" varchar(50),
129 131 "plan_details" varchar(255),
  132 + "tenant_id" varchar(36),
130 133 "create_time" timestamp(6),
131 134 "creator" varchar(36),
132 135 "updater" varchar(36),
... ... @@ -140,6 +143,7 @@ COMMENT ON COLUMN "public"."qg_check_plan"."name" IS '方案名称';
140 143 COMMENT ON COLUMN "public"."qg_check_plan"."type" IS '方案类型';
141 144 COMMENT ON COLUMN "public"."qg_check_plan"."status" IS '状态';
142 145 COMMENT ON COLUMN "public"."qg_check_plan"."plan_details" IS '方案明细';
  146 +COMMENT ON COLUMN "public"."qg_check_plan"."tenant_id" IS '租户ID';
143 147
144 148 CREATE TABLE "public"."qg_check_details"
145 149 (
... ... @@ -149,6 +153,8 @@ CREATE TABLE "public"."qg_check_details"
149 153 "check_plan_id" varchar(36),
150 154 "inspection_plan_id" varchar(36),
151 155 "plan_details" varchar(255),
  156 + "show_order" int4,
  157 + "tenant_id" varchar(36),
152 158 "create_time" timestamp(6),
153 159 "creator" varchar(36),
154 160 "updater" varchar(36),
... ... @@ -162,15 +168,18 @@ COMMENT ON COLUMN "public"."qg_check_details"."check_device_id" IS '巡检设备
162 168 COMMENT ON COLUMN "public"."qg_check_details"."check_plan_id" IS '巡检方案';
163 169 COMMENT ON COLUMN "public"."qg_check_details"."inspection_plan_id" IS '巡检计划';
164 170 COMMENT ON COLUMN "public"."qg_check_details"."plan_details" IS '方案明细';
  171 +COMMENT ON COLUMN "public"."qg_check_details"."show_order" IS '排序';
  172 +COMMENT ON COLUMN "public"."qg_check_details"."tenant_id" IS '租户ID';
165 173
166 174 CREATE TABLE "public"."qg_inspection_record"
167 175 (
168 176 "id" varchar(36) PRIMARY KEY,
169 177 "code" varchar(50) NOT NULL,
170 178 "inspection_plan_id" varchar(36),
171   - "tenant_id" varchar(36),
  179 + "inspector_id" varchar(36),
172 180 "check_date" timestamp(6),
173 181 "record_result" bool,
  182 + "tenant_id" varchar(36),
174 183 "create_time" timestamp(6),
175 184 "creator" varchar(36),
176 185 "updater" varchar(36),
... ... @@ -181,20 +190,24 @@ COMMENT ON TABLE "public"."qg_inspection_record" IS '巡检记录';
181 190 COMMENT ON COLUMN "public"."qg_inspection_record"."id" IS '主键ID';
182 191 COMMENT ON COLUMN "public"."qg_inspection_record"."code" IS '记录编号';
183 192 COMMENT ON COLUMN "public"."qg_inspection_record"."inspection_plan_id" IS '巡检计划';
184   -COMMENT ON COLUMN "public"."qg_inspection_record"."tenant_id" IS '巡检人';
185   -COMMENT ON COLUMN "public"."qg_inspection_record"."check_date" IS '巡检结果';
  193 +COMMENT ON COLUMN "public"."qg_inspection_record"."inspector_id" IS '巡检人';
  194 +COMMENT ON COLUMN "public"."qg_inspection_record"."check_date" IS '巡检日期';
186 195 COMMENT ON COLUMN "public"."qg_inspection_record"."record_result" IS '巡检结果';
  196 +COMMENT ON COLUMN "public"."qg_inspection_record"."tenant_id" IS '租户ID';
187 197
188 198 CREATE TABLE "public"."qg_inspection_details"
189 199 (
190   - "id" varchar(36) PRIMARY KEY,
191   - "check_device_id" varchar(36),
192   - "plan_details" varchar(255),
193   - "record_result" bool,
194   - "create_time" timestamp(6),
195   - "creator" varchar(36),
196   - "updater" varchar(36),
197   - "update_time" timestamp(6)
  200 + "id" varchar(36) PRIMARY KEY,
  201 + "check_device_id" varchar(36),
  202 + "plan_details" varchar(255),
  203 + "record_result" bool,
  204 + "show_order" int4,
  205 + "inspection_record_id" varchar(36),
  206 + "tenant_id" varchar(36),
  207 + "create_time" timestamp(6),
  208 + "creator" varchar(36),
  209 + "updater" varchar(36),
  210 + "update_time" timestamp(6)
198 211 );
199 212
200 213 COMMENT ON TABLE "public"."qg_inspection_details" IS '巡检记录明细';
... ... @@ -202,6 +215,9 @@ COMMENT ON COLUMN "public"."qg_inspection_details"."id" IS '主键ID';
202 215 COMMENT ON COLUMN "public"."qg_inspection_details"."check_device_id" IS '巡检设备';
203 216 COMMENT ON COLUMN "public"."qg_inspection_details"."plan_details" IS '巡检内容';
204 217 COMMENT ON COLUMN "public"."qg_inspection_details"."record_result" IS '巡检结果';
  218 +COMMENT ON COLUMN "public"."qg_inspection_details"."show_order" IS '排序';
  219 +COMMENT ON COLUMN "public"."qg_inspection_details"."inspection_record_id" IS '巡检记录';
  220 +COMMENT ON COLUMN "public"."qg_inspection_details"."tenant_id" IS '租户ID';
205 221
206 222 CREATE TABLE "public"."qg_preserve_detail" (
207 223 "id" varchar(36) NOT NULL,
... ...
  1 +package org.thingsboard.server.controller.yunteng;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import io.swagger.annotations.ApiOperation;
  5 +import lombok.RequiredArgsConstructor;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.lang3.StringUtils;
  8 +import org.springframework.http.ResponseEntity;
  9 +import org.springframework.security.access.prepost.PreAuthorize;
  10 +import org.springframework.web.bind.annotation.*;
  11 +import org.thingsboard.server.common.data.exception.ThingsboardException;
  12 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckPlanDTO;
  13 +import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanStatusEnum;
  14 +import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanTypeEnum;
  15 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  16 +import org.thingsboard.server.controller.BaseController;
  17 +import org.thingsboard.server.dao.yunteng.service.TkCheckPlanService;
  18 +import org.thingsboard.server.queue.util.TbCoreComponent;
  19 +
  20 +import java.util.HashMap;
  21 +import java.util.Map;
  22 +
  23 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE;
  24 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE_SIZE;
  25 +
  26 +@RestController
  27 +@TbCoreComponent
  28 +@RequiredArgsConstructor
  29 +@RequestMapping("api/yt/checkPlan")
  30 +@Api(tags = {"巡检/保养方案"})
  31 +@Slf4j
  32 +public class TkCheckPlanController extends BaseController {
  33 + private final TkCheckPlanService tkCheckPlanService;
  34 +
  35 + @GetMapping(params = {PAGE_SIZE, PAGE})
  36 + @ApiOperation("分页查询")
  37 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  38 + public TkPageData<TkCheckPlanDTO> page(
  39 + @RequestParam(PAGE_SIZE) int pageSize,
  40 + @RequestParam(PAGE) int page,
  41 + @RequestParam(value = "name", required = false) String name,
  42 + @RequestParam(value = "type", required = false) TkCheckPlanTypeEnum type,
  43 + @RequestParam(value = "status", required = false) TkCheckPlanStatusEnum status
  44 + ) throws ThingsboardException {
  45 + Map<String, Object> queryMap = new HashMap<>();
  46 + queryMap.put(PAGE_SIZE, pageSize);
  47 + queryMap.put(PAGE, page);
  48 + if (StringUtils.isNotBlank(name)) {
  49 + queryMap.put("name", name);
  50 + }
  51 +
  52 + if (type != null) {
  53 + queryMap.put("type", type);
  54 + }
  55 +
  56 + if (status != null) {
  57 + queryMap.put("status", status);
  58 + }
  59 +
  60 + return tkCheckPlanService.page(queryMap, getCurrentUser().isTenantAdmin());
  61 + }
  62 +
  63 + @PostMapping("/save")
  64 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  65 + public ResponseEntity<TkCheckPlanDTO> save(@RequestBody TkCheckPlanDTO tkCheckPlanDTO) throws ThingsboardException {
  66 + tkCheckPlanDTO.setTenantId(getCurrentUser().getCurrentTenantId());
  67 + if (tkCheckPlanDTO.getStatus() == null) {
  68 + tkCheckPlanDTO.setStatus(TkCheckPlanStatusEnum.ENABLE);
  69 + }
  70 +
  71 + TkCheckPlanDTO dto = tkCheckPlanService.save(tkCheckPlanDTO);
  72 + return ResponseEntity.ok(dto);
  73 + }
  74 +
  75 + @GetMapping("/delete")
  76 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  77 + public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException {
  78 + return ResponseEntity.ok(tkCheckPlanService.delete(id));
  79 + }
  80 +
  81 + @GetMapping("/get")
  82 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  83 + public ResponseEntity<TkCheckPlanDTO> get(@RequestParam("id") String id) throws ThingsboardException {
  84 + return ResponseEntity.ok(tkCheckPlanService.get(id));
  85 + }
  86 +}
... ...
  1 +package org.thingsboard.server.controller.yunteng;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import io.swagger.annotations.ApiOperation;
  5 +import lombok.RequiredArgsConstructor;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.http.ResponseEntity;
  10 +import org.springframework.security.access.prepost.PreAuthorize;
  11 +import org.springframework.web.bind.annotation.*;
  12 +import org.thingsboard.server.common.data.exception.ThingsboardException;
  13 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO;
  14 +import org.thingsboard.server.common.data.yunteng.enums.TkInspectionPlanStatusEnum;
  15 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  16 +import org.thingsboard.server.controller.BaseController;
  17 +import org.thingsboard.server.dao.yunteng.service.TkInspectionPlanService;
  18 +import org.thingsboard.server.queue.util.TbCoreComponent;
  19 +
  20 +import java.util.HashMap;
  21 +import java.util.Map;
  22 +
  23 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE;
  24 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE_SIZE;
  25 +
  26 +@RestController
  27 +@TbCoreComponent
  28 +@RequiredArgsConstructor
  29 +@RequestMapping("api/yt/inspectionPlan")
  30 +@Api(tags = {"巡检计划"})
  31 +@Slf4j
  32 +public class TkInspectionPlanController extends BaseController {
  33 + private final TkInspectionPlanService tkInspectionPlanService;
  34 +
  35 + @GetMapping(params = {PAGE_SIZE, PAGE})
  36 + @ApiOperation("分页查询")
  37 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  38 + public TkPageData<TkInspectionPlanDTO> page(
  39 + @RequestParam(PAGE_SIZE) int pageSize,
  40 + @RequestParam(PAGE) int page,
  41 + @RequestParam(value = "name", required = false) String name,
  42 + @RequestParam(value = "type", required = false) TkInspectionPlanStatusEnum status,
  43 + @RequestParam(value = "startTime", required = false) Long startTime,
  44 + @RequestParam(value = "endTime", required = false) Long endTime
  45 + ) throws ThingsboardException {
  46 + Map<String, Object> queryMap = new HashMap<>();
  47 + queryMap.put(PAGE_SIZE, pageSize);
  48 + queryMap.put(PAGE, page);
  49 + if (StringUtils.isNotBlank(name)) {
  50 + queryMap.put("name", name);
  51 + }
  52 +
  53 + if (status != null) {
  54 + queryMap.put("status", status);
  55 + }
  56 +
  57 + checkTimeAndPut(queryMap, startTime, endTime);
  58 + return tkInspectionPlanService.page(queryMap, getCurrentUser().isTenantAdmin());
  59 + }
  60 +
  61 + @PostMapping("/save")
  62 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  63 + public ResponseEntity<TkInspectionPlanDTO> save(@RequestBody TkInspectionPlanDTO tkInspectionPlanDTO) throws ThingsboardException {
  64 + tkInspectionPlanDTO.setTenantId(getCurrentUser().getCurrentTenantId());
  65 + if (tkInspectionPlanDTO.getStatus() == null) {
  66 + tkInspectionPlanDTO.setStatus(TkInspectionPlanStatusEnum.NOT_START);
  67 + }
  68 +
  69 + if (CollectionUtils.isNotEmpty(tkInspectionPlanDTO.getTkCheckDetailsDTOList())) {
  70 + tkInspectionPlanDTO.getTkCheckDetailsDTOList()
  71 + .forEach(tkCheckDetailsDTO -> tkCheckDetailsDTO.setTenantId(tkCheckDetailsDTO.getTenantId()));
  72 + }
  73 +
  74 + TkInspectionPlanDTO dto = tkInspectionPlanService.save(tkInspectionPlanDTO);
  75 + return ResponseEntity.ok(dto);
  76 + }
  77 +
  78 + @GetMapping("/detail")
  79 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  80 + public ResponseEntity<TkInspectionPlanDTO> detail(@RequestParam("id") String id) throws ThingsboardException {
  81 + return ResponseEntity.ok(tkInspectionPlanService.get(id));
  82 + }
  83 +
  84 + @GetMapping("/delete")
  85 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  86 + public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException {
  87 + return ResponseEntity.ok(tkInspectionPlanService.delete(id));
  88 + }
  89 +}
... ...
  1 +package org.thingsboard.server.controller.yunteng;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import io.swagger.annotations.ApiOperation;
  5 +import lombok.RequiredArgsConstructor;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.http.ResponseEntity;
  10 +import org.springframework.security.access.prepost.PreAuthorize;
  11 +import org.springframework.web.bind.annotation.*;
  12 +import org.thingsboard.server.common.data.exception.ThingsboardException;
  13 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionRecordDTO;
  14 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  15 +import org.thingsboard.server.controller.BaseController;
  16 +import org.thingsboard.server.dao.yunteng.service.TkInspectionRecordService;
  17 +import org.thingsboard.server.queue.util.TbCoreComponent;
  18 +
  19 +import java.util.HashMap;
  20 +import java.util.Map;
  21 +
  22 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE;
  23 +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE_SIZE;
  24 +
  25 +@RestController
  26 +@TbCoreComponent
  27 +@RequiredArgsConstructor
  28 +@RequestMapping("api/yt/inspectionRecord")
  29 +@Api(tags = {"巡检记录"})
  30 +@Slf4j
  31 +public class TkInspectionRecordController extends BaseController {
  32 + private final TkInspectionRecordService tkInspectionRecordService;
  33 +
  34 + @GetMapping(params = {PAGE_SIZE, PAGE})
  35 + @ApiOperation("分页查询")
  36 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  37 + public TkPageData<TkInspectionRecordDTO> page(
  38 + @RequestParam(PAGE_SIZE) int pageSize,
  39 + @RequestParam(PAGE) int page,
  40 + @RequestParam(value = "inspectionPlanId", required = false) String inspectionPlanId,
  41 + @RequestParam(value = "inspectorId", required = false) String inspectorId,
  42 + @RequestParam(value = "startTime", required = false) Long startTime,
  43 + @RequestParam(value = "endTime", required = false) Long endTime,
  44 + @RequestParam(value = "recordResult", required = false) Boolean recordResult
  45 + ) throws ThingsboardException {
  46 + Map<String, Object> queryMap = new HashMap<>();
  47 + queryMap.put(PAGE_SIZE, pageSize);
  48 + queryMap.put(PAGE, page);
  49 + if (StringUtils.isNotBlank(inspectionPlanId)) {
  50 + queryMap.put("inspectionPlanId", inspectionPlanId);
  51 + }
  52 +
  53 + if (StringUtils.isNotBlank(inspectorId)) {
  54 + queryMap.put("inspectorId", inspectorId);
  55 + }
  56 +
  57 + if (recordResult != null) {
  58 + queryMap.put("recordResult", recordResult);
  59 + }
  60 +
  61 + checkTimeAndPut(queryMap, startTime, endTime);
  62 + return tkInspectionRecordService.page(queryMap, getCurrentUser().isTenantAdmin());
  63 + }
  64 +
  65 + @PostMapping("/save")
  66 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  67 + public ResponseEntity<TkInspectionRecordDTO> save(@RequestBody TkInspectionRecordDTO tkInspectionRecordDTO) throws ThingsboardException {
  68 + tkInspectionRecordDTO.setTenantId(getCurrentUser().getCurrentTenantId());
  69 + if (CollectionUtils.isNotEmpty(tkInspectionRecordDTO.getTkInspectionDetailsDTOList())) {
  70 + tkInspectionRecordDTO.getTkInspectionDetailsDTOList()
  71 + .forEach(tkInspectionDetailsDTO -> tkInspectionDetailsDTO.setTenantId(tkInspectionRecordDTO.getTenantId()));
  72 + }
  73 +
  74 + TkInspectionRecordDTO dto = tkInspectionRecordService.save(tkInspectionRecordDTO);
  75 + return ResponseEntity.ok(dto);
  76 + }
  77 +
  78 + @GetMapping("/detail")
  79 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  80 + public ResponseEntity<TkInspectionRecordDTO> detail(@RequestParam("id") String id) throws ThingsboardException {
  81 + return ResponseEntity.ok(tkInspectionRecordService.get(id));
  82 + }
  83 +
  84 + @GetMapping("/delete")
  85 + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')")
  86 + public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException {
  87 + return ResponseEntity.ok(tkInspectionRecordService.delete(id));
  88 + }
  89 +
  90 +}
... ...
  1 +package org.thingsboard.server.common.data.yunteng.dto;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +
  7 +/**
  8 + * 巡检明细
  9 + */
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@Data
  12 +public class TkCheckDetailsDTO extends TenantDTO {
  13 +
  14 + @ApiModelProperty("明细编号")
  15 + private String code;
  16 +
  17 + @ApiModelProperty("巡检设备")
  18 + private String checkDeviceId;
  19 +
  20 + @ApiModelProperty("巡检方案")
  21 + private String checkPlanId;
  22 +
  23 + @ApiModelProperty("巡检计划")
  24 + private String inspectionPlanId;
  25 +
  26 + @ApiModelProperty("方案明细")
  27 + private String planDetails;
  28 +
  29 + @ApiModelProperty("排序")
  30 + private int showOrder;
  31 +}
... ...
  1 +package org.thingsboard.server.common.data.yunteng.dto;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanStatusEnum;
  7 +import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanTypeEnum;
  8 +
  9 +/**
  10 + * 巡检/保养方案
  11 + */
  12 +@EqualsAndHashCode(callSuper = true)
  13 +@Data
  14 +public class TkCheckPlanDTO extends TenantDTO {
  15 +
  16 + @ApiModelProperty("方案编号")
  17 + private String code;
  18 +
  19 + @ApiModelProperty("方案名称")
  20 + private String name;
  21 +
  22 + @ApiModelProperty("方案类型")
  23 + private TkCheckPlanTypeEnum type;
  24 +
  25 + @ApiModelProperty("状态")
  26 + private TkCheckPlanStatusEnum status;
  27 +
  28 + @ApiModelProperty("方案明细")
  29 + private String planDetails;
  30 +}
... ...
  1 +package org.thingsboard.server.common.data.yunteng.dto;
  2 +
  3 +import io.swagger.annotations.ApiModelProperty;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +
  7 +/**
  8 + * 巡检记录明细
  9 + */
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@Data
  12 +public class TkInspectionDetailsDTO extends TenantDTO {
  13 +
  14 + @ApiModelProperty("巡检设备")
  15 + private String checkDeviceId;
  16 +
  17 + @ApiModelProperty("巡检内容")
  18 + private String planDetails;
  19 +
  20 + @ApiModelProperty("巡检结果")
  21 + private boolean recordResult;
  22 +
  23 + @ApiModelProperty("巡检记录")
  24 + private String inspectionRecordId;
  25 +
  26 + @ApiModelProperty("排序")
  27 + private int showOrder;
  28 +}
... ...
  1 +package org.thingsboard.server.common.data.yunteng.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  5 +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +import lombok.EqualsAndHashCode;
  9 +import org.thingsboard.server.common.data.yunteng.enums.TkInspectionPlanStatusEnum;
  10 +
  11 +import java.time.LocalDateTime;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 巡检计划
  16 + */
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@Data
  19 +public class TkInspectionPlanDTO extends TenantDTO {
  20 +
  21 + @ApiModelProperty("计划编号")
  22 + private String code;
  23 +
  24 + @ApiModelProperty("计划名称")
  25 + private String name;
  26 +
  27 + @ApiModelProperty("计划状态")
  28 + private TkInspectionPlanStatusEnum status;
  29 +
  30 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  31 + @ApiModelProperty("开始日期")
  32 + @JsonSerialize(using = LocalDateTimeSerializer.class)
  33 + private LocalDateTime startTime;
  34 +
  35 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  36 + @ApiModelProperty("结束日期")
  37 + @JsonSerialize(using = LocalDateTimeSerializer.class)
  38 + private LocalDateTime endTime;
  39 +
  40 + @ApiModelProperty("计划备注")
  41 + private String remark;
  42 +
  43 + @ApiModelProperty("巡检明细")
  44 + private List<TkCheckDetailsDTO> tkCheckDetailsDTOList;
  45 +}
... ...
  1 +package org.thingsboard.server.common.data.yunteng.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  5 +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +import lombok.EqualsAndHashCode;
  9 +
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * 巡检记录
  15 + */
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@Data
  18 +public class TkInspectionRecordDTO extends TenantDTO {
  19 +
  20 + @ApiModelProperty("记录编号")
  21 + private String code;
  22 +
  23 + @ApiModelProperty("巡检计划")
  24 + private String inspectionPlanId;
  25 +
  26 + @ApiModelProperty("巡检人")
  27 + private String inspectorId;
  28 +
  29 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  30 + @ApiModelProperty(value = "巡检日期")
  31 + @JsonSerialize(using = LocalDateTimeSerializer.class)
  32 + private LocalDateTime checkDate;
  33 +
  34 + @ApiModelProperty("巡检结果")
  35 + private boolean recordResult;
  36 +
  37 + @ApiModelProperty("巡检记录明细")
  38 + private List<TkInspectionDetailsDTO> tkInspectionDetailsDTOList;
  39 +
  40 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  41 + @ApiModelProperty(value = "巡检日期-筛选开始日期")
  42 + @JsonSerialize(using = LocalDateTimeSerializer.class)
  43 + private LocalDateTime startTime;
  44 +
  45 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  46 + @ApiModelProperty(value = "巡检日期-筛选结束日期")
  47 + @JsonSerialize(using = LocalDateTimeSerializer.class)
  48 + private LocalDateTime endTime;
  49 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.entities;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import org.thingsboard.server.dao.model.ModelConstants;
  7 +
  8 +/**
  9 + * 巡检明细
  10 + */
  11 +@Data
  12 +@EqualsAndHashCode(callSuper = true)
  13 +@TableName(value = ModelConstants.TKCHECKDETAILS_TABLE_NAME, autoResultMap = true)
  14 +public class TkCheckDetailsEntity extends TenantBaseEntity {
  15 +
  16 + /**
  17 + * 明细编号
  18 + */
  19 + private String code;
  20 +
  21 + /**
  22 + * 巡检设备
  23 + */
  24 + private String checkDeviceId;
  25 +
  26 + /**
  27 + * 巡检方案
  28 + */
  29 + private String checkPlanId;
  30 +
  31 + /**
  32 + * 巡检计划
  33 + */
  34 + private String inspectionPlanId;
  35 +
  36 + /**
  37 + * 方案明细
  38 + */
  39 + private String planDetails;
  40 +
  41 + /**
  42 + * 排序
  43 + */
  44 + private int showOrder;
  45 +}
... ...
1 1 package org.thingsboard.server.dao.yunteng.entities;
2 2
  3 +import com.baomidou.mybatisplus.annotation.TableField;
3 4 import com.baomidou.mybatisplus.annotation.TableName;
4 5 import lombok.Data;
5 6 import lombok.EqualsAndHashCode;
  7 +import org.apache.ibatis.type.EnumTypeHandler;
6 8 import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanStatusEnum;
7 9 import org.thingsboard.server.common.data.yunteng.enums.TkCheckPlanTypeEnum;
8 10 import org.thingsboard.server.dao.model.ModelConstants;
... ... @@ -14,9 +16,31 @@ import org.thingsboard.server.dao.model.ModelConstants;
14 16 @EqualsAndHashCode(callSuper = true)
15 17 @TableName(value = ModelConstants.TKCHECKPLAN_TABLE_NAME, autoResultMap = true)
16 18 public class TkCheckPlanEntity extends TenantBaseEntity {
  19 +
  20 + /**
  21 + * 方案编号
  22 + */
17 23 private String code;
  24 +
  25 + /**
  26 + * 方案名称
  27 + */
18 28 private String name;
  29 +
  30 + /**
  31 + * 方案类型
  32 + */
  33 + @TableField(typeHandler = EnumTypeHandler.class)
19 34 private TkCheckPlanTypeEnum type;
  35 +
  36 + /**
  37 + * 状态
  38 + */
  39 + @TableField(typeHandler = EnumTypeHandler.class)
20 40 private TkCheckPlanStatusEnum status;
  41 +
  42 + /**
  43 + * 方案明细
  44 + */
21 45 private String planDetails;
22 46 }
... ...
  1 +package org.thingsboard.server.dao.yunteng.entities;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import org.thingsboard.server.dao.model.ModelConstants;
  7 +
  8 +/**
  9 + * 巡检记录明细
  10 + */
  11 +@Data
  12 +@EqualsAndHashCode(callSuper = true)
  13 +@TableName(value = ModelConstants.TKINSPECTIONDETAILS_TABLE_NAME, autoResultMap = true)
  14 +public class TkInspectionDetailsEntity extends TenantBaseEntity {
  15 +
  16 + /**
  17 + * 巡检设备
  18 + */
  19 + private String checkDeviceId;
  20 +
  21 + /**
  22 + * 巡检内容
  23 + */
  24 + private String planDetails;
  25 +
  26 + /**
  27 + * 巡检结果
  28 + */
  29 + private boolean recordResult;
  30 +
  31 + /**
  32 + * 巡检记录
  33 + */
  34 + private String inspectionRecordId;
  35 +
  36 + /**
  37 + * 排序
  38 + */
  39 + private int showOrder;
  40 +}
... ...
1 1 package org.thingsboard.server.dao.yunteng.entities;
2 2
  3 +import com.baomidou.mybatisplus.annotation.TableField;
3 4 import com.baomidou.mybatisplus.annotation.TableName;
4 5 import lombok.Data;
5 6 import lombok.EqualsAndHashCode;
  7 +import org.apache.ibatis.type.EnumTypeHandler;
6 8 import org.thingsboard.server.common.data.yunteng.enums.TkInspectionPlanStatusEnum;
7 9 import org.thingsboard.server.dao.model.ModelConstants;
8 10
... ... @@ -15,9 +17,35 @@ import java.time.LocalDateTime;
15 17 @EqualsAndHashCode(callSuper = true)
16 18 @TableName(value = ModelConstants.TKINSPECTIONPLAN_TABLE_NAME, autoResultMap = true)
17 19 public class TkInspectionPlanEntity extends TenantBaseEntity {
  20 +
  21 + /**
  22 + * 计划编号
  23 + */
18 24 private String code;
  25 +
  26 + /**
  27 + * 计划名称
  28 + */
19 29 private String name;
  30 +
  31 + /**
  32 + * 计划状态
  33 + */
  34 + @TableField(typeHandler = EnumTypeHandler.class)
20 35 private TkInspectionPlanStatusEnum status;
  36 +
  37 + /**
  38 + * 开始日期
  39 + */
21 40 private LocalDateTime startTime;
  41 +
  42 + /**
  43 + * 结束日期
  44 + */
22 45 private LocalDateTime endTime;
  46 +
  47 + /**
  48 + * 计划备注
  49 + */
  50 + private String remark;
23 51 }
... ...
  1 +package org.thingsboard.server.dao.yunteng.entities;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import org.thingsboard.server.dao.model.ModelConstants;
  7 +
  8 +import java.time.LocalDateTime;
  9 +
  10 +/**
  11 + * 巡检记录
  12 + */
  13 +@Data
  14 +@EqualsAndHashCode(callSuper = true)
  15 +@TableName(value = ModelConstants.TKINSPECTIONRECORD_TABLE_NAME, autoResultMap = true)
  16 +public class TkInspectionRecordEntity extends TenantBaseEntity {
  17 +
  18 + /**
  19 + * 记录编号
  20 + */
  21 + private String code;
  22 +
  23 + /**
  24 + * 巡检计划
  25 + */
  26 + private String inspectionPlanId;
  27 +
  28 + /**
  29 + * 巡检人
  30 + */
  31 + private String inspectorId;
  32 +
  33 + /**
  34 + * 巡检日期
  35 + */
  36 + private LocalDateTime checkDate;
  37 +
  38 + /**
  39 + * 巡检结果
  40 + */
  41 + private boolean recordResult;
  42 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.impl;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import lombok.RequiredArgsConstructor;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.stereotype.Service;
  10 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO;
  11 +import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity;
  12 +import org.thingsboard.server.dao.yunteng.mapper.TkCheckDetailsMapper;
  13 +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
  14 +import org.thingsboard.server.dao.yunteng.service.TkCheckDetailsService;
  15 +
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +import java.util.stream.Collectors;
  19 +
  20 +@Service
  21 +@RequiredArgsConstructor
  22 +@Slf4j
  23 +public class TkCheckDetailsServiceImpl extends AbstractBaseService<TkCheckDetailsMapper, TkCheckDetailsEntity>
  24 + implements TkCheckDetailsService {
  25 + @Override
  26 + public List<TkCheckDetailsDTO> batchSave(List<TkCheckDetailsDTO> checkDetailsDTOList, String inspectionPlanId) {
  27 + List<TkCheckDetailsDTO> oldTkCheckDetailsDTOList = listByInspectionPlanId(inspectionPlanId);
  28 + if (CollectionUtils.isEmpty(checkDetailsDTOList) && CollectionUtils.isNotEmpty(oldTkCheckDetailsDTOList)) {
  29 + List<String> checkDetailsIdList = oldTkCheckDetailsDTOList.stream()
  30 + .map(TkCheckDetailsDTO::getId)
  31 + .collect(Collectors.toList());
  32 + baseMapper.deleteBatchIds(checkDetailsIdList);
  33 + return new ArrayList<>(0);
  34 + }
  35 +
  36 + if (CollectionUtils.isEmpty(oldTkCheckDetailsDTOList) && CollectionUtils.isNotEmpty(checkDetailsDTOList)) {
  37 + List<TkCheckDetailsEntity> tkCheckDetailsEntityList = checkDetailsDTOList.stream().map(checkDetailsDTO -> {
  38 + TkCheckDetailsEntity entity = new TkCheckDetailsEntity();
  39 + checkDetailsDTO.copyToEntity(entity);
  40 + return entity;
  41 + }).collect(Collectors.toList());
  42 +
  43 + insertBatch(tkCheckDetailsEntityList, TkCheckDetailsEntity.class);
  44 + return listByInspectionPlanId(inspectionPlanId);
  45 + }
  46 +
  47 + List<TkCheckDetailsEntity> addEntityList = new ArrayList<>(checkDetailsDTOList.size());
  48 + List<TkCheckDetailsEntity> updateEntityList = new ArrayList<>(checkDetailsDTOList.size());
  49 + List<String> needDeleteIdList = new ArrayList<>(checkDetailsDTOList.size());
  50 + List<String> checkDetailsIdList = CollectionUtils.emptyIfNull(oldTkCheckDetailsDTOList).stream()
  51 + .map(TkCheckDetailsDTO::getId)
  52 + .collect(Collectors.toList());
  53 + for (TkCheckDetailsDTO tkCheckDetailsDTO : checkDetailsDTOList) {
  54 + TkCheckDetailsEntity entity = new TkCheckDetailsEntity();
  55 + tkCheckDetailsDTO.copyToEntity(entity);
  56 + if (StringUtils.isBlank(entity.getId())) {
  57 + addEntityList.add(entity);
  58 + continue;
  59 + }
  60 +
  61 + if (checkDetailsIdList.contains(entity.getId())) {
  62 + updateEntityList.add(entity);
  63 + }
  64 + }
  65 +
  66 +
  67 + if (CollectionUtils.isNotEmpty(addEntityList)) {
  68 + insertBatch(addEntityList, TkCheckDetailsEntity.class);
  69 + }
  70 +
  71 + if (CollectionUtils.isNotEmpty(updateEntityList)) {
  72 + updateEntityList.forEach(tkCheckDetailsEntity -> baseMapper.updateById(tkCheckDetailsEntity));
  73 + List<String> updateIdList = updateEntityList.stream().map(TkCheckDetailsEntity::getId).collect(Collectors.toList());
  74 + checkDetailsIdList.removeAll(updateIdList);
  75 + needDeleteIdList.addAll(checkDetailsIdList);
  76 + } else {
  77 + needDeleteIdList = checkDetailsIdList;
  78 + }
  79 +
  80 + if (CollectionUtils.isNotEmpty(needDeleteIdList)) {
  81 + baseMapper.deleteBatchIds(needDeleteIdList);
  82 + }
  83 +
  84 + return listByInspectionPlanId(inspectionPlanId);
  85 + }
  86 +
  87 + @Override
  88 + public List<TkCheckDetailsDTO> listByInspectionPlanId(String inspectionPlanId) {
  89 + if (StringUtils.isBlank(inspectionPlanId)) {
  90 + return new ArrayList<>(0);
  91 + }
  92 +
  93 + QueryWrapper<TkCheckDetailsEntity> wrapper = new QueryWrapper<>();
  94 + LambdaQueryWrapper<TkCheckDetailsEntity> lambda = wrapper.lambda();
  95 + lambda.eq(TkCheckDetailsEntity::getInspectionPlanId, inspectionPlanId);
  96 + lambda.orderByAsc(TkCheckDetailsEntity::getShowOrder);
  97 + List<TkCheckDetailsEntity> tkCheckDetailsEntitieList = baseMapper.selectList(wrapper);
  98 + return CollectionUtils.emptyIfNull(tkCheckDetailsEntitieList).stream().map(entity -> {
  99 + TkCheckDetailsDTO tkCheckDetailsDTO = new TkCheckDetailsDTO();
  100 + entity.copyToDTO(tkCheckDetailsDTO);
  101 + return tkCheckDetailsDTO;
  102 + }).collect(Collectors.toList());
  103 + }
  104 +
  105 + @Override
  106 + public void deleteByInspectionPlanId(String inspectionPlanId) {
  107 + if (StringUtils.isBlank(inspectionPlanId)) {
  108 + return;
  109 + }
  110 +
  111 + QueryWrapper<TkCheckDetailsEntity> wrapper = new QueryWrapper<>();
  112 + LambdaQueryWrapper<TkCheckDetailsEntity> lambda = wrapper.lambda();
  113 + lambda.eq(TkCheckDetailsEntity::getInspectionPlanId, inspectionPlanId);
  114 + baseMapper.delete(wrapper);
  115 + }
  116 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.impl;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.baomidou.mybatisplus.core.metadata.IPage;
  6 +import lombok.RequiredArgsConstructor;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.stereotype.Service;
  10 +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException;
  11 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckPlanDTO;
  12 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  13 +import org.thingsboard.server.dao.yunteng.entities.TkCheckPlanEntity;
  14 +import org.thingsboard.server.dao.yunteng.mapper.TkCheckPlanMapper;
  15 +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
  16 +import org.thingsboard.server.dao.yunteng.service.TkCheckPlanService;
  17 +
  18 +import java.util.Map;
  19 +
  20 +@Service
  21 +@RequiredArgsConstructor
  22 +@Slf4j
  23 +public class TkCheckPlanServiceImpl extends AbstractBaseService<TkCheckPlanMapper, TkCheckPlanEntity>
  24 + implements TkCheckPlanService {
  25 + @Override
  26 + public TkPageData<TkCheckPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin) {
  27 + QueryWrapper<TkCheckPlanEntity> wrapper = new QueryWrapper<>();
  28 + LambdaQueryWrapper<TkCheckPlanEntity> lambda = wrapper.lambda();
  29 + if (queryMap != null && queryMap.get("name") != null) {
  30 + lambda.eq(TkCheckPlanEntity::getName, queryMap.get("name").toString());
  31 + }
  32 +
  33 + if (queryMap != null && queryMap.get("type") != null) {
  34 + lambda.eq(TkCheckPlanEntity::getType, queryMap.get("type").toString());
  35 + }
  36 +
  37 + if (queryMap != null && queryMap.get("status") != null) {
  38 + lambda.eq(TkCheckPlanEntity::getStatus, queryMap.get("status").toString());
  39 + }
  40 +
  41 + IPage<TkCheckPlanEntity> page = baseMapper.selectPage(getPage(queryMap, "create_time", false),
  42 + wrapper);
  43 +
  44 + return getPageData(page, TkCheckPlanDTO.class);
  45 + }
  46 +
  47 + @Override
  48 + public TkCheckPlanDTO save(TkCheckPlanDTO tkCheckPlanDTO) {
  49 + checkDto(tkCheckPlanDTO);
  50 + TkCheckPlanEntity entity = new TkCheckPlanEntity();
  51 + if (StringUtils.isBlank(tkCheckPlanDTO.getId())) {
  52 + tkCheckPlanDTO.copyToEntity(entity);
  53 + baseMapper.insert(entity);
  54 + } else {
  55 + LambdaQueryWrapper<TkCheckPlanEntity> filter = new QueryWrapper<TkCheckPlanEntity>().lambda()
  56 + .eq(TkCheckPlanEntity::getId, tkCheckPlanDTO.getId());
  57 + entity = tkCheckPlanDTO.getEntity(TkCheckPlanEntity.class);
  58 + baseMapper.update(entity, filter);
  59 + }
  60 +
  61 + entity.copyToDTO(tkCheckPlanDTO);
  62 + return tkCheckPlanDTO;
  63 + }
  64 +
  65 + private void checkDto(TkCheckPlanDTO dto) {
  66 + if (StringUtils.isBlank(dto.getTenantId())) {
  67 + throw new TkDataValidationException("租户id为空!");
  68 + }
  69 + }
  70 +
  71 + @Override
  72 + public boolean delete(String id) {
  73 + int count = baseMapper.deleteById(id);
  74 + return count > 0;
  75 + }
  76 +
  77 + @Override
  78 + public TkCheckPlanDTO get(String id) {
  79 + if (StringUtils.isBlank(id)) {
  80 + return new TkCheckPlanDTO();
  81 + }
  82 +
  83 + TkCheckPlanEntity entity = baseMapper.selectById(id);
  84 + TkCheckPlanDTO tkCheckPlanDTO = new TkCheckPlanDTO();
  85 + entity.copyToDTO(tkCheckPlanDTO);
  86 + return tkCheckPlanDTO;
  87 + }
  88 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.impl;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import lombok.RequiredArgsConstructor;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.springframework.stereotype.Service;
  10 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionDetailsDTO;
  11 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionDetailsEntity;
  12 +import org.thingsboard.server.dao.yunteng.mapper.TkInspectionDetailsMapper;
  13 +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
  14 +import org.thingsboard.server.dao.yunteng.service.TkInspectionDetailsService;
  15 +
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +import java.util.stream.Collectors;
  19 +
  20 +@Service
  21 +@RequiredArgsConstructor
  22 +@Slf4j
  23 +public class TkInspectionDetailsServiceImpl extends AbstractBaseService<TkInspectionDetailsMapper, TkInspectionDetailsEntity>
  24 + implements TkInspectionDetailsService {
  25 + @Override
  26 + public List<TkInspectionDetailsDTO> batchSave(List<TkInspectionDetailsDTO> tkInspectionDetailsDTOList, String inspectionRecordId) {
  27 + List<TkInspectionDetailsDTO> oldTkInspectionDetailsDTOList = listByInspectionRecordId(inspectionRecordId);
  28 + if (CollectionUtils.isEmpty(tkInspectionDetailsDTOList) && CollectionUtils.isNotEmpty(oldTkInspectionDetailsDTOList)) {
  29 + List<String> inspectionDetailsIdList = oldTkInspectionDetailsDTOList.stream()
  30 + .map(TkInspectionDetailsDTO::getId)
  31 + .collect(Collectors.toList());
  32 + baseMapper.deleteBatchIds(inspectionDetailsIdList);
  33 + return new ArrayList<>(0);
  34 + }
  35 +
  36 + if (CollectionUtils.isEmpty(oldTkInspectionDetailsDTOList) && CollectionUtils.isNotEmpty(tkInspectionDetailsDTOList)) {
  37 + List<TkInspectionDetailsEntity> tkInspectionDetailsEntityList = tkInspectionDetailsDTOList.stream().map(tkInspectionDetailsDTO -> {
  38 + TkInspectionDetailsEntity entity = new TkInspectionDetailsEntity();
  39 + tkInspectionDetailsDTO.copyToEntity(entity);
  40 + return entity;
  41 + }).collect(Collectors.toList());
  42 +
  43 + insertBatch(tkInspectionDetailsEntityList, TkInspectionDetailsEntity.class);
  44 + return listByInspectionRecordId(inspectionRecordId);
  45 + }
  46 +
  47 + List<TkInspectionDetailsEntity> addEntityList = new ArrayList<>(tkInspectionDetailsDTOList.size());
  48 + List<TkInspectionDetailsEntity> updateEntityList = new ArrayList<>(tkInspectionDetailsDTOList.size());
  49 + List<String> needDeleteIdList = new ArrayList<>(tkInspectionDetailsDTOList.size());
  50 + List<String> inspectionDetailsIdList = CollectionUtils.emptyIfNull(oldTkInspectionDetailsDTOList).stream()
  51 + .map(TkInspectionDetailsDTO::getId)
  52 + .collect(Collectors.toList());
  53 + for (TkInspectionDetailsDTO tkInspectionDetailsDTO : tkInspectionDetailsDTOList) {
  54 + TkInspectionDetailsEntity entity = new TkInspectionDetailsEntity();
  55 + tkInspectionDetailsDTO.copyToEntity(entity);
  56 + if (StringUtils.isBlank(entity.getId())) {
  57 + addEntityList.add(entity);
  58 + continue;
  59 + }
  60 +
  61 + if (inspectionDetailsIdList.contains(entity.getId())) {
  62 + updateEntityList.add(entity);
  63 + }
  64 + }
  65 +
  66 + if (CollectionUtils.isNotEmpty(addEntityList)) {
  67 + insertBatch(addEntityList, TkInspectionDetailsEntity.class);
  68 + }
  69 +
  70 + if (CollectionUtils.isNotEmpty(updateEntityList)) {
  71 + updateEntityList.forEach(tkInspectionDetailsEntity -> baseMapper.updateById(tkInspectionDetailsEntity));
  72 + List<String> updateIdList = updateEntityList.stream().map(TkInspectionDetailsEntity::getId).collect(Collectors.toList());
  73 + inspectionDetailsIdList.retainAll(updateIdList);
  74 + needDeleteIdList.addAll(inspectionDetailsIdList);
  75 + } else {
  76 + needDeleteIdList = inspectionDetailsIdList;
  77 + }
  78 +
  79 + if (CollectionUtils.isNotEmpty(needDeleteIdList)) {
  80 + baseMapper.deleteBatchIds(needDeleteIdList);
  81 + }
  82 +
  83 + return listByInspectionRecordId(inspectionRecordId);
  84 + }
  85 +
  86 + @Override
  87 + public List<TkInspectionDetailsDTO> listByInspectionRecordId(String inspectionRecordId) {
  88 + if (StringUtils.isBlank(inspectionRecordId)) {
  89 + return new ArrayList<>(0);
  90 + }
  91 +
  92 + QueryWrapper<TkInspectionDetailsEntity> wrapper = new QueryWrapper<>();
  93 + LambdaQueryWrapper<TkInspectionDetailsEntity> lambda = wrapper.lambda();
  94 + lambda.eq(TkInspectionDetailsEntity::getInspectionRecordId, inspectionRecordId);
  95 + lambda.orderByAsc(TkInspectionDetailsEntity::getShowOrder);
  96 + List<TkInspectionDetailsEntity> tkInspectionDetailsEntityList = baseMapper.selectList(wrapper);
  97 + return CollectionUtils.emptyIfNull(tkInspectionDetailsEntityList).stream().map(entity -> {
  98 + TkInspectionDetailsDTO tkInspectionDetailsDTO = new TkInspectionDetailsDTO();
  99 + entity.copyToDTO(tkInspectionDetailsDTO);
  100 + return tkInspectionDetailsDTO;
  101 + }).collect(Collectors.toList());
  102 + }
  103 +
  104 + @Override
  105 + public void deleteByInspectionRecordId(String inspectionRecordId) {
  106 + if (StringUtils.isBlank(inspectionRecordId)) {
  107 + return;
  108 + }
  109 +
  110 + QueryWrapper<TkInspectionDetailsEntity> wrapper = new QueryWrapper<>();
  111 + LambdaQueryWrapper<TkInspectionDetailsEntity> lambda = wrapper.lambda();
  112 + lambda.eq(TkInspectionDetailsEntity::getInspectionRecordId, inspectionRecordId);
  113 + baseMapper.delete(wrapper);
  114 + }
  115 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.impl;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.baomidou.mybatisplus.core.metadata.IPage;
  6 +import lombok.RequiredArgsConstructor;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.collections4.CollectionUtils;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.springframework.stereotype.Service;
  11 +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException;
  12 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO;
  13 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO;
  14 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  15 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionPlanEntity;
  16 +import org.thingsboard.server.dao.yunteng.mapper.TkInspectionPlanMapper;
  17 +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
  18 +import org.thingsboard.server.dao.yunteng.service.TkCheckDetailsService;
  19 +import org.thingsboard.server.dao.yunteng.service.TkInspectionPlanService;
  20 +import org.thingsboard.server.dao.yunteng.service.TkInspectionRecordService;
  21 +
  22 +import java.time.LocalDateTime;
  23 +import java.util.ArrayList;
  24 +import java.util.List;
  25 +import java.util.Map;
  26 +
  27 +@Service
  28 +@RequiredArgsConstructor
  29 +@Slf4j
  30 +public class TkInspectionPlanServiceImpl extends AbstractBaseService<TkInspectionPlanMapper, TkInspectionPlanEntity>
  31 + implements TkInspectionPlanService {
  32 + private final TkCheckDetailsService tkCheckDetailsService;
  33 + private final TkInspectionRecordService tkInspectionRecordService;
  34 +
  35 + @Override
  36 + public TkPageData<TkInspectionPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin) {
  37 + QueryWrapper<TkInspectionPlanEntity> wrapper = new QueryWrapper<>();
  38 + LambdaQueryWrapper<TkInspectionPlanEntity> lambda = wrapper.lambda();
  39 + if (queryMap != null && queryMap.get("name") != null) {
  40 + lambda.eq(TkInspectionPlanEntity::getName, queryMap.get("name").toString());
  41 + }
  42 +
  43 + if (queryMap != null && queryMap.get("status") != null) {
  44 + lambda.eq(TkInspectionPlanEntity::getStatus, queryMap.get("status").toString());
  45 + }
  46 +
  47 + if (queryMap != null && queryMap.get("startTime") != null && queryMap.get("endTime") != null) {
  48 + LocalDateTime startTime = (LocalDateTime) queryMap.get("startTime");
  49 + LocalDateTime endTime = (LocalDateTime) queryMap.get("endTime");
  50 + lambda.ge(TkInspectionPlanEntity::getStartTime, startTime);
  51 + lambda.le(TkInspectionPlanEntity::getEndTime, endTime);
  52 + }
  53 +
  54 + IPage<TkInspectionPlanEntity> page = baseMapper.selectPage(getPage(queryMap, "create_time", false),
  55 + wrapper);
  56 +
  57 + return getPageData(page, TkInspectionPlanDTO.class);
  58 + }
  59 +
  60 + @Override
  61 + public TkInspectionPlanDTO save(TkInspectionPlanDTO tkInspectionPlanDTO) {
  62 + List<TkCheckDetailsDTO> checkDetailsDTOList = new ArrayList<>(tkInspectionPlanDTO.getTkCheckDetailsDTOList());
  63 + checkDto(tkInspectionPlanDTO);
  64 + TkInspectionPlanEntity entity = new TkInspectionPlanEntity();
  65 + if (StringUtils.isBlank(tkInspectionPlanDTO.getId())) {
  66 + tkInspectionPlanDTO.copyToEntity(entity);
  67 + baseMapper.insert(entity);
  68 + } else {
  69 + LambdaQueryWrapper<TkInspectionPlanEntity> filter = new QueryWrapper<TkInspectionPlanEntity>().lambda()
  70 + .eq(TkInspectionPlanEntity::getId, tkInspectionPlanDTO.getId());
  71 + entity = tkInspectionPlanDTO.getEntity(TkInspectionPlanEntity.class);
  72 + baseMapper.update(entity, filter);
  73 + }
  74 +
  75 + entity.copyToDTO(tkInspectionPlanDTO);
  76 + String id = tkInspectionPlanDTO.getId();
  77 + for (int index = 0; index < checkDetailsDTOList.size(); index++) {
  78 + if (CollectionUtils.isEmpty(checkDetailsDTOList)) {
  79 + continue;
  80 + }
  81 +
  82 + TkCheckDetailsDTO checkDetailsDTO = checkDetailsDTOList.get(index);
  83 + checkDetailsDTO.setInspectionPlanId(id);
  84 + checkDetailsDTO.setShowOrder(index);
  85 + }
  86 +
  87 + List<TkCheckDetailsDTO> tkCheckDetailsDTOList = tkCheckDetailsService.batchSave(checkDetailsDTOList, id);
  88 + tkInspectionPlanDTO.setTkCheckDetailsDTOList(tkCheckDetailsDTOList);
  89 + return tkInspectionPlanDTO;
  90 + }
  91 +
  92 + @Override
  93 + public TkInspectionPlanDTO get(String id) {
  94 + if (StringUtils.isBlank(id)) {
  95 + return new TkInspectionPlanDTO();
  96 + }
  97 +
  98 + TkInspectionPlanEntity entity = baseMapper.selectById(id);
  99 + TkInspectionPlanDTO tkInspectionPlanDTO = new TkInspectionPlanDTO();
  100 + entity.copyToDTO(tkInspectionPlanDTO);
  101 + List<TkCheckDetailsDTO> checkDetailsDTOList = tkCheckDetailsService.listByInspectionPlanId(id);
  102 + tkInspectionPlanDTO.setTkCheckDetailsDTOList(checkDetailsDTOList);
  103 + return tkInspectionPlanDTO;
  104 + }
  105 +
  106 + @Override
  107 + public boolean delete(String id) {
  108 + tkCheckDetailsService.deleteByInspectionPlanId(id);
  109 + int count = baseMapper.deleteById(id);
  110 + return count > 0;
  111 + }
  112 +
  113 + private void checkDto(TkInspectionPlanDTO dto) {
  114 + if (StringUtils.isBlank(dto.getTenantId())) {
  115 + throw new TkDataValidationException("租户id为空!");
  116 + }
  117 + }
  118 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.impl;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.baomidou.mybatisplus.core.metadata.IPage;
  6 +import lombok.RequiredArgsConstructor;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.commons.collections4.CollectionUtils;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.springframework.stereotype.Service;
  11 +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException;
  12 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionDetailsDTO;
  13 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionRecordDTO;
  14 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  15 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionRecordEntity;
  16 +import org.thingsboard.server.dao.yunteng.mapper.TkInspectionRecordMapper;
  17 +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
  18 +import org.thingsboard.server.dao.yunteng.service.TkInspectionDetailsService;
  19 +import org.thingsboard.server.dao.yunteng.service.TkInspectionRecordService;
  20 +
  21 +import java.time.LocalDateTime;
  22 +import java.util.ArrayList;
  23 +import java.util.List;
  24 +import java.util.Map;
  25 +
  26 +@Service
  27 +@RequiredArgsConstructor
  28 +@Slf4j
  29 +public class TkInspectionRecordServiceImpl extends AbstractBaseService<TkInspectionRecordMapper, TkInspectionRecordEntity>
  30 + implements TkInspectionRecordService {
  31 + private final TkInspectionDetailsService tkInspectionDetailsService;
  32 +
  33 + @Override
  34 + public TkPageData<TkInspectionRecordDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin) {
  35 + QueryWrapper<TkInspectionRecordEntity> wrapper = new QueryWrapper<>();
  36 + LambdaQueryWrapper<TkInspectionRecordEntity> lambda = wrapper.lambda();
  37 + if (queryMap != null && queryMap.get("inspectionPlanId") != null) {
  38 + lambda.eq(TkInspectionRecordEntity::getInspectionPlanId, queryMap.get("inspectionPlanId").toString());
  39 + }
  40 +
  41 + if (queryMap != null && queryMap.get("inspectorId") != null) {
  42 + lambda.eq(TkInspectionRecordEntity::getInspectorId, queryMap.get("inspectorId").toString());
  43 + }
  44 +
  45 + if (queryMap != null && queryMap.get("recordResult") != null) {
  46 + lambda.eq(TkInspectionRecordEntity::isRecordResult, queryMap.get("recordResult").toString());
  47 + }
  48 +
  49 + if (queryMap != null && queryMap.get("startTime") != null && queryMap.get("endTime") != null) {
  50 + LocalDateTime startTime = (LocalDateTime) queryMap.get("startTime");
  51 + LocalDateTime endTime = (LocalDateTime) queryMap.get("endTime");
  52 + lambda.ge(TkInspectionRecordEntity::getCheckDate, startTime);
  53 + lambda.le(TkInspectionRecordEntity::getCheckDate, endTime);
  54 + }
  55 +
  56 + IPage<TkInspectionRecordEntity> page = baseMapper.selectPage(getPage(queryMap, "create_time", false),
  57 + wrapper);
  58 +
  59 + return getPageData(page, TkInspectionRecordDTO.class);
  60 + }
  61 +
  62 + @Override
  63 + public TkInspectionRecordDTO save(TkInspectionRecordDTO tkInspectionRecordDTO) {
  64 + List<TkInspectionDetailsDTO> tkInspectionDetailsDTOList = new ArrayList<>(tkInspectionRecordDTO.getTkInspectionDetailsDTOList());
  65 + checkDto(tkInspectionRecordDTO);
  66 + TkInspectionRecordEntity entity = new TkInspectionRecordEntity();
  67 + if (StringUtils.isBlank(tkInspectionRecordDTO.getId())) {
  68 + tkInspectionRecordDTO.copyToEntity(entity);
  69 + baseMapper.insert(entity);
  70 + } else {
  71 + LambdaQueryWrapper<TkInspectionRecordEntity> filter = new QueryWrapper<TkInspectionRecordEntity>().lambda()
  72 + .eq(TkInspectionRecordEntity::getId, tkInspectionRecordDTO.getId());
  73 + entity = tkInspectionRecordDTO.getEntity(TkInspectionRecordEntity.class);
  74 + baseMapper.update(entity, filter);
  75 + }
  76 +
  77 + entity.copyToDTO(tkInspectionRecordDTO);
  78 + String id = tkInspectionRecordDTO.getId();
  79 + for (int index = 0; index < tkInspectionDetailsDTOList.size(); index++) {
  80 + if (CollectionUtils.isEmpty(tkInspectionDetailsDTOList)) {
  81 + continue;
  82 + }
  83 +
  84 + TkInspectionDetailsDTO tkInspectionDetailsDTO = tkInspectionDetailsDTOList.get(index);
  85 + tkInspectionDetailsDTO.setInspectionRecordId(id);
  86 + tkInspectionDetailsDTO.setShowOrder(index);
  87 + }
  88 +
  89 + List<TkInspectionDetailsDTO> detailsDTOList = tkInspectionDetailsService.batchSave(tkInspectionDetailsDTOList, id);
  90 + tkInspectionRecordDTO.setTkInspectionDetailsDTOList(detailsDTOList);
  91 + return tkInspectionRecordDTO;
  92 + }
  93 +
  94 + @Override
  95 + public TkInspectionRecordDTO get(String id) {
  96 + if (StringUtils.isBlank(id)) {
  97 + return new TkInspectionRecordDTO();
  98 + }
  99 +
  100 + TkInspectionRecordEntity entity = baseMapper.selectById(id);
  101 + TkInspectionRecordDTO tkInspectionRecordDTO = new TkInspectionRecordDTO();
  102 + entity.copyToDTO(tkInspectionRecordDTO);
  103 + List<TkInspectionDetailsDTO> tkInspectionDetailsDTOList = tkInspectionDetailsService.listByInspectionRecordId(id);
  104 + tkInspectionRecordDTO.setTkInspectionDetailsDTOList(tkInspectionDetailsDTOList);
  105 + return tkInspectionRecordDTO;
  106 + }
  107 +
  108 + @Override
  109 + public boolean delete(String id) {
  110 + tkInspectionDetailsService.deleteByInspectionRecordId(id);
  111 + int count = baseMapper.deleteById(id);
  112 + return count > 0;
  113 + }
  114 +
  115 + private void checkDto(TkInspectionRecordDTO dto) {
  116 + if (StringUtils.isBlank(dto.getTenantId())) {
  117 + throw new TkDataValidationException("租户id为空!");
  118 + }
  119 + }
  120 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity;
  6 +
  7 +@Mapper
  8 +public interface TkCheckDetailsMapper extends BaseMapper<TkCheckDetailsEntity> {
  9 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkCheckPlanEntity;
  6 +
  7 +@Mapper
  8 +public interface TkCheckPlanMapper extends BaseMapper<TkCheckPlanEntity> {
  9 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionDetailsEntity;
  6 +
  7 +@Mapper
  8 +public interface TkInspectionDetailsMapper extends BaseMapper<TkInspectionDetailsEntity> {
  9 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionPlanEntity;
  6 +
  7 +@Mapper
  8 +public interface TkInspectionPlanMapper extends BaseMapper<TkInspectionPlanEntity> {
  9 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionRecordEntity;
  6 +
  7 +@Mapper
  8 +public interface TkInspectionRecordMapper extends BaseMapper<TkInspectionRecordEntity> {
  9 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.service;
  2 +
  3 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO;
  4 +import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface TkCheckDetailsService extends BaseService<TkCheckDetailsEntity> {
  9 +
  10 + List<TkCheckDetailsDTO> batchSave(List<TkCheckDetailsDTO> checkDetailsDTOList, String inspectionPlanId);
  11 +
  12 + List<TkCheckDetailsDTO> listByInspectionPlanId(String inspectionPlanId);
  13 +
  14 + void deleteByInspectionPlanId(String inspectionPlanId);
  15 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.service;
  2 +
  3 +import org.thingsboard.server.common.data.yunteng.dto.TkCheckPlanDTO;
  4 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkCheckPlanEntity;
  6 +
  7 +import java.util.Map;
  8 +
  9 +public interface TkCheckPlanService extends BaseService<TkCheckPlanEntity> {
  10 + TkPageData<TkCheckPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin);
  11 +
  12 + TkCheckPlanDTO save(TkCheckPlanDTO tkCheckPlanDTO);
  13 +
  14 + boolean delete(String id);
  15 +
  16 + TkCheckPlanDTO get(String id);
  17 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.service;
  2 +
  3 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionDetailsDTO;
  4 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionDetailsEntity;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface TkInspectionDetailsService extends BaseService<TkInspectionDetailsEntity> {
  9 +
  10 + List<TkInspectionDetailsDTO> batchSave(List<TkInspectionDetailsDTO> tkInspectionDetailsDTOList, String inspectionRecordId);
  11 +
  12 + List<TkInspectionDetailsDTO> listByInspectionRecordId(String inspectionRecordId);
  13 +
  14 + void deleteByInspectionRecordId(String inspectionRecordId);
  15 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.service;
  2 +
  3 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO;
  4 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionPlanEntity;
  6 +
  7 +import java.util.Map;
  8 +
  9 +public interface TkInspectionPlanService extends BaseService<TkInspectionPlanEntity> {
  10 +
  11 + TkPageData<TkInspectionPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin);
  12 +
  13 + TkInspectionPlanDTO save(TkInspectionPlanDTO tkInspectionPlanDTO);
  14 +
  15 + TkInspectionPlanDTO get(String id);
  16 +
  17 + boolean delete(String id);
  18 +}
... ...
  1 +package org.thingsboard.server.dao.yunteng.service;
  2 +
  3 +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionRecordDTO;
  4 +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData;
  5 +import org.thingsboard.server.dao.yunteng.entities.TkInspectionRecordEntity;
  6 +
  7 +import java.util.Map;
  8 +
  9 +public interface TkInspectionRecordService extends BaseService<TkInspectionRecordEntity> {
  10 +
  11 + TkPageData<TkInspectionRecordDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin);
  12 +
  13 + TkInspectionRecordDTO save(TkInspectionRecordDTO tkInspectionRecordDTO);
  14 +
  15 + TkInspectionRecordDTO get(String id);
  16 +
  17 + boolean delete(String id);
  18 +}
... ...