diff --git a/src/main/java/com/glxp/api/config/HdSchemaExecutor.java b/src/main/java/com/glxp/api/config/HdSchemaExecutor.java index 020805ca..061da469 100644 --- a/src/main/java/com/glxp/api/config/HdSchemaExecutor.java +++ b/src/main/java/com/glxp/api/config/HdSchemaExecutor.java @@ -77,7 +77,7 @@ public class HdSchemaExecutor implements ApplicationRunner { // schema.add(new SchemaData("v2.1", "schema_v2.1.sql")); // schema.add(new SchemaData("v2.2", "schema_v2.2.sql")); schema.add(new SchemaData("v2.3", "schema_v2.3.sql")); -// schema.add(new SchemaData("v2.4", "schema_v2.4.sql")); + schema.add(new SchemaData("v2.4", "schema_v2.4.sql")); } } diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceCheckItemDictController.java b/src/main/java/com/glxp/api/controller/dev/DeviceCheckItemDictController.java new file mode 100644 index 00000000..16a499e3 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/dev/DeviceCheckItemDictController.java @@ -0,0 +1,98 @@ +package com.glxp.api.controller.dev; + +import cn.hutool.core.util.RandomUtil; +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.dev.DeviceCheckItemDictEntity; +import com.glxp.api.req.dev.DeviceCheckItemDictParam; +import com.glxp.api.req.dev.DeviceCheckItemDictQuery; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.dev.DeviceCheckItemDictService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +@Slf4j +@RequestMapping +@RestController +@RequiredArgsConstructor +public class DeviceCheckItemDictController extends BaseController { + + private final DeviceCheckItemDictService deviceCheckItemDictService; + + + /** + * 生成一个项目编码 + * + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/udi/device/checkItemDict/code/gen") + public BaseResponse genItemCode() { + String code = ""; + DeviceCheckItemDictEntity info = null; + do { + code = "XJ" + RandomUtil.randomNumbers(10); + info = deviceCheckItemDictService.getById(code); + } while (info != null); + return ResultVOUtils.success(code); + } + + /** + * 设备巡检项目字典分页查询 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/checkItemDict/page") + public BaseResponse page(@RequestBody DeviceCheckItemDictQuery query) { + List list = deviceCheckItemDictService.pageList(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + /** + * 添加巡检项目字典 + * + * @param param + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/checkItemDict/save") + public BaseResponse save(@RequestBody @Valid DeviceCheckItemDictParam param) { + DeviceCheckItemDictEntity entity = param.getEntity(super.getUser()); + int i = deviceCheckItemDictService.insertIgnore(entity); + if (i == 0) { + return ResultVOUtils.error("项目编码已存在"); + } + return ResultVOUtils.successMsg("添加成功"); + } + + /** + * 删除巡检项目字典 + * + * @param itemCode 项目编码 + * @return + */ + @AuthRuleAnnotation("") + @DeleteMapping("/udi/device/checkItemDict/del/{itemCode}") + public BaseResponse del(@PathVariable String itemCode) { + + boolean b = deviceCheckItemDictService.removeById(itemCode); + if (!b) { + return ResultVOUtils.error("删除失败,请稍后再试"); + } + return ResultVOUtils.successMsg("删除成功"); + } + +} diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java b/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java index 44e23efc..700909c8 100644 --- a/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java +++ b/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java @@ -17,9 +17,7 @@ import com.glxp.api.entity.dev.DeviceInfoEntity; import com.glxp.api.entity.system.SysPdfTemplateRelevanceLabelEntity; import com.glxp.api.entity.system.SystemPDFTemplateEntity; import com.glxp.api.exception.JsonException; -import com.glxp.api.req.dev.DeviceInfoDetailByDeptCodeQuery; -import com.glxp.api.req.dev.DeviceInfoDetailQuery; -import com.glxp.api.req.dev.DeviceInfoQuery; +import com.glxp.api.req.dev.*; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.dev.DeviceChangeLogService; import com.glxp.api.service.dev.DeviceInfoService; @@ -41,18 +39,19 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.awt.*; +import java.awt.font.LineMetrics; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; -import java.util.Base64; -import java.util.HashMap; +import java.util.*; import java.util.List; -import java.util.Map; @RestController @@ -76,13 +75,7 @@ public class DeviceInfoController extends BaseController { @AuthRuleAnnotation("") @GetMapping("/udi/device/code/gen") public BaseResponse genDeviceCode() { - String deviceCode = ""; - DeviceInfoEntity deviceInfo = null; - do { - deviceCode = "S" + RandomUtil.randomNumbers(10); - deviceInfo = deviceInfoService.getById(deviceCode); - } while (deviceInfo != null); - return ResultVOUtils.success(deviceCode); + return ResultVOUtils.success(deviceInfoService.genDeviceCode()); } /** @@ -151,6 +144,8 @@ public class DeviceInfoController extends BaseController { @AuthRuleAnnotation("") @PostMapping("/udi/device/info/detailByDeptCode/page") public BaseResponse detailByDeptCode(@RequestBody @Valid DeviceInfoDetailByDeptCodeQuery query) { + AuthAdmin user = super.getUser(); + query.setDeptCode(user.getLocDeptCode()); List list = deviceInfoService.detail(query); PageInfo pageInfo = new PageInfo<>(list); PageSimpleResponse page = new PageSimpleResponse(); @@ -168,8 +163,6 @@ public class DeviceInfoController extends BaseController { @AuthRuleAnnotation("") @PostMapping("/udi/device/detailInfo/page") public BaseResponse detailInfoPage(@RequestBody DeviceInfoDetailQuery query) { - AuthAdmin user = super.getUser(); - query.setDeptCode(user.getLocDeptCode()); List list = deviceInfoService.detail(query); PageInfo pageInfo = new PageInfo<>(list); PageSimpleResponse page = new PageSimpleResponse(); diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceMiniController.java b/src/main/java/com/glxp/api/controller/dev/DeviceMiniController.java new file mode 100644 index 00000000..43920510 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/dev/DeviceMiniController.java @@ -0,0 +1,69 @@ +package com.glxp.api.controller.dev; + + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.dev.DeviceCheckDetailEntity; +import com.glxp.api.req.dev.DeviceCheckDetailMiniQuery; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; +import com.glxp.api.service.dev.DeviceCheckDetailService; +import com.glxp.api.service.dev.DeviceRepairApplyDetailService; +import groovy.util.logging.Slf4j; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +@Slf4j +@RestController +@RequestMapping +@RequiredArgsConstructor +public class DeviceMiniController extends BaseController { + + private final DeviceRepairApplyDetailService deviceRepairApplyDetailService; + private final DeviceCheckDetailService deviceCheckDetailService; + + /** + * 获取明细报修单列表分页 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/repair/apply/detail/mini/page") + public BaseResponse miniPage(@RequestBody @Valid DeviceRepairApplyDetailMiniQuery query) { + List list = deviceRepairApplyDetailService.miniPage(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + + /** + * 巡检任务单明细列表 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/check/detail/mini/page") + public BaseResponse miniPage(@RequestBody @Valid DeviceCheckDetailMiniQuery query) { + List list = deviceCheckDetailService.miniPage(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } +} diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyController.java b/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyController.java index cbc018e5..f50702d3 100644 --- a/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyController.java +++ b/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyController.java @@ -9,21 +9,16 @@ import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.dev.DeviceRepairApplyEntity; import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; -import com.glxp.api.req.dev.DeviceRepairApplyAddParam; -import com.glxp.api.req.dev.DeviceRepairApplyConfirmParam; -import com.glxp.api.req.dev.DeviceRepairApplyHallQuery; -import com.glxp.api.req.dev.DeviceRepairApplyQuery; +import com.glxp.api.req.dev.*; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.dev.DeviceRepairApplyService; import com.glxp.api.vo.dev.DeviceRepairApplyVo; import groovy.util.logging.Slf4j; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; @Slf4j @@ -63,9 +58,15 @@ public class DeviceRepairApplyController extends BaseController { @PostMapping("/udi/device/repair/apply/hall/page") public BaseResponse adminPage(@RequestBody DeviceRepairApplyHallQuery query) { DeviceRepairApplyQuery applyQuery = new DeviceRepairApplyQuery(); - applyQuery.setStatus(DeviceRepairApplyStatusEnum.WAIT_PROCESS); - applyQuery.setApplyId(query.getApplyId()); - applyQuery.setApplyDeptCode(query.getApplyDeptCode()); + ArrayList statusEnums = new ArrayList<>(); + if (query.getIsFinish() == 1){ + statusEnums.add(DeviceRepairApplyStatusEnum.FINISH); + }else { + statusEnums.add(DeviceRepairApplyStatusEnum.WAIT_PROCESS); + statusEnums.add(DeviceRepairApplyStatusEnum.PROCESSING); + } + applyQuery.setStatuss(statusEnums); + BeanUtil.copyProperties(query,applyQuery); List list = deviceRepairApplyService.pageList(applyQuery); PageInfo pageInfo = new PageInfo<>(list); PageSimpleResponse page = new PageSimpleResponse(); diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyDetailController.java b/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyDetailController.java index 5cc3f6ae..0128fa63 100644 --- a/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyDetailController.java +++ b/src/main/java/com/glxp/api/controller/dev/DeviceRepairApplyDetailController.java @@ -8,11 +8,13 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.dev.DeviceRepairApplyDetailEntity; -import com.glxp.api.req.dev.DeviceRepairApplyDetailDiagnosisParam; -import com.glxp.api.req.dev.DeviceRepairApplyDetailQuery; +import com.glxp.api.entity.dev.DeviceRepairApplyEntity; +import com.glxp.api.req.dev.*; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.dev.DeviceRepairApplyDetailService; +import com.glxp.api.service.dev.DeviceRepairApplyService; import com.glxp.api.vo.dev.DeviceRepairApplyDetailVo; +import com.glxp.api.vo.dev.DeviceRepairApplyVo; import groovy.util.logging.Slf4j; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; @@ -65,4 +67,18 @@ public class DeviceRepairApplyDetailController extends BaseController { } + /** + * 查出单条的设备保修单 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/repair/apply/listByIdAndCode") + public BaseResponse listByIdAndCode(@RequestBody @Valid DeviceRepairApplyListByIdAndCodeQuery query) { + DeviceRepairApplyDetailEntity entity = deviceRepairApplyDetailService.listByIdAndCode(query); + return ResultVOUtils.success(entity); + } + + } diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceRepairController.java b/src/main/java/com/glxp/api/controller/dev/DeviceRepairController.java index fec31848..72a95e59 100644 --- a/src/main/java/com/glxp/api/controller/dev/DeviceRepairController.java +++ b/src/main/java/com/glxp/api/controller/dev/DeviceRepairController.java @@ -1,19 +1,25 @@ package com.glxp.api.controller.dev; +import cn.hutool.core.bean.BeanUtil; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceRepairApplyEntity; import com.glxp.api.entity.dev.DeviceRepairEntity; -import com.glxp.api.req.dev.DeviceRepairQuery; +import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; +import com.glxp.api.req.dev.*; import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.dev.DeviceRepairApplyService; import com.glxp.api.service.dev.DeviceRepairService; +import com.glxp.api.vo.dev.DeviceRepairApplyVo; import groovy.util.logging.Slf4j; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.List; @Slf4j @@ -46,14 +52,14 @@ public class DeviceRepairController extends BaseController { /** * 完成我的维修单 * - * @param repairId 维修单id + * @param deviceRepairEntity * @return */ @AuthRuleAnnotation("") - @GetMapping("/udi/device/repair/finishByUser/{repairId}") - public BaseResponse finishByUser(@PathVariable Long repairId) { + @PostMapping("/udi/device/repair/finishByUser/repairId") + public BaseResponse finishByUser(@RequestBody DeviceRepairEntity deviceRepairEntity) { AuthAdmin user = super.getUser(); - deviceRepairService.finishByUser(repairId, user); + deviceRepairService.finishByUser(deviceRepairEntity, user); return ResultVOUtils.successMsg("操作成功"); } diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepController.java b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepController.java new file mode 100644 index 00000000..a436bb3b --- /dev/null +++ b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepController.java @@ -0,0 +1,113 @@ +package com.glxp.api.controller.dev; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.req.dev.DeviceUpkeepQuery; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.dev.DeviceUpkeepService; +import com.glxp.api.vo.dev.DeviceUpkeepDetailVo; +import com.glxp.api.vo.dev.DeviceUpkeepPrintVo; +import com.glxp.api.vo.dev.DeviceUpkeepVo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequiredArgsConstructor +@Slf4j +@RequestMapping +public class DeviceUpkeepController extends BaseController { + + private final DeviceUpkeepService deviceUpkeepService; + + /** + * 保养任务单列表 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/page") + public BaseResponse page(@RequestBody DeviceUpkeepQuery query) { + List list = deviceUpkeepService.pageList(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + /** + * 本部门任务单列表 + * + * @param query + * @return +// */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/pageByDept") + public BaseResponse pageByDept(@RequestBody DeviceUpkeepQuery query) { + AuthAdmin user = super.getUser(); + query.setChargeDeptCode(user.getLocDeptCode()); + List list = deviceUpkeepService.pageList(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + /** + * 根据计划id生成巡检任务单 + * + * @param planId 计划id + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/udi/device/upkeep/gen/{planId}") + public BaseResponse genDeviceUpkeep(@PathVariable Long planId) { + AuthAdmin user = super.getUser(); + deviceUpkeepService.genByPlanId(planId, false, user); + return ResultVOUtils.successMsg("操作成功"); + } + + @AuthRuleAnnotation("") + @GetMapping("/udi/device/upkeep/info/print/{taskId}") + public BaseResponse checkInfoPrint(@PathVariable Long taskId) { + DeviceUpkeepPrintVo vo = deviceUpkeepService.checkInfoPrint(taskId, null); + return ResultVOUtils.success(vo); + } + + @AuthRuleAnnotation("") + @GetMapping("/udi/device/upkeep/info/print/{taskId}/{deviceCode}") + public BaseResponse checkInfoPrint(@PathVariable Long taskId, @PathVariable String deviceCode) { + DeviceUpkeepPrintVo vo = deviceUpkeepService.checkInfoPrint(taskId, deviceCode); + return ResultVOUtils.success(vo); + } + + + /** + * 我的维修单 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/byUser/page") + public BaseResponse pageByUser(@RequestBody DeviceUpkeepQuery query) { + AuthAdmin user = super.getUser(); + query.setChargeDeptCode(user.getLocDeptCode()); + List list = deviceUpkeepService.pageListDetail(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + +} diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailController.java b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailController.java new file mode 100644 index 00000000..af60c219 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailController.java @@ -0,0 +1,102 @@ +package com.glxp.api.controller.dev; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DevicePlanDetailEntity; +import com.glxp.api.entity.dev.DevicePlanEntity; +import com.glxp.api.entity.dev.DeviceUpkeepDetailEntity; +import com.glxp.api.req.dev.DevicePlanDetailParam; +import com.glxp.api.req.dev.DeviceUpkeepDetailParam; +import com.glxp.api.req.dev.DeviceUpkeepDetailQuery; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.dev.*; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +@RestController +@RequiredArgsConstructor +@Slf4j +@RequestMapping +public class DeviceUpkeepDetailController extends BaseController { + + + private final DeviceUpkeepDetailService deviceUpkeepDetailService; + + private final DevicePlanService devicePlanService; + + private final DeviceInfoService deviceInfoService; + private final DevicePlanDetailService devicePlanDetailService; + private final DeviceUpkeepDetailItemService deviceUpkeepDetailItemService; + /** + * 保养任务单明细列表 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/detail/page") + public BaseResponse page(@RequestBody @Valid DeviceUpkeepDetailQuery query) { + List list = deviceUpkeepDetailService.pageList(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + + /** + * 设备保养计划明细新增 + * + * @param param 参数 + * @return 计划id + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/detail/add") + public BaseResponse add(@RequestBody @Valid DevicePlanDetailParam param) { + + + DevicePlanEntity entity = null; + if (!param.valid(devicePlanService)) { + AuthAdmin user = super.getUser(); + entity = param.getDevicePlanParam().getEntity(user); + devicePlanService.save(entity); + param.getDevicePlanParam().setPlanId(entity.getPlanId()); + param.setPlanId(entity.getPlanId()); + } else { + entity = devicePlanService.getById(param.getPlanId()); + } + param.valid(devicePlanService); + List list = param.getEntity(deviceInfoService); + devicePlanDetailService.replaceBatch(list); + return ResultVOUtils.success(entity); + } + + /** + * 完成保养任务单明细项目 + * + * @param param + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/detail/finish") + public BaseResponse finish(@RequestBody @Valid DeviceUpkeepDetailParam param) { + AuthAdmin user = super.getUser(); + deviceUpkeepDetailItemService.finishAll(param, user); + return ResultVOUtils.successMsg("操作成功"); + } + + + +} diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailItemController.java b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailItemController.java new file mode 100644 index 00000000..01244368 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/dev/DeviceUpkeepDetailItemController.java @@ -0,0 +1,73 @@ +package com.glxp.api.controller.dev; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceUpkeepDetailItemEntity; +import com.glxp.api.req.dev.DeviceUpkeepDetailItemFinishParam; +import com.glxp.api.req.dev.DeviceUpkeepDetailItemQuery; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.dev.DeviceUpkeepDetailItemService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +/** + * 设备巡检单明细 + */ +@RestController +@RequiredArgsConstructor +@Slf4j +@RequestMapping +public class DeviceUpkeepDetailItemController extends BaseController { + + private final DeviceUpkeepDetailItemService deviceUpkeepDetailItemService; + + /** + * 巡检任务单明细项目列表 + * + * @param query + * @return + */ + /** + * 保养任务单明细项目列表 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/detail/item/page") + public BaseResponse page(@RequestBody @Valid DeviceUpkeepDetailItemQuery query) { + List list = deviceUpkeepDetailItemService.pageList(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + + /** + * 完成巡检任务单明细项目 + * + * @param param + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/upkeep/detail/item/finish") + public BaseResponse page(@RequestBody @Valid DeviceUpkeepDetailItemFinishParam param) { + AuthAdmin user = super.getUser(); + deviceUpkeepDetailItemService.finish(param, user); + return ResultVOUtils.successMsg("操作成功"); + } + + +} diff --git a/src/main/java/com/glxp/api/dao/dev/DeviceRepairApplyDetailMapper.java b/src/main/java/com/glxp/api/dao/dev/DeviceRepairApplyDetailMapper.java index ea5d89a7..47b4fc98 100644 --- a/src/main/java/com/glxp/api/dao/dev/DeviceRepairApplyDetailMapper.java +++ b/src/main/java/com/glxp/api/dao/dev/DeviceRepairApplyDetailMapper.java @@ -2,6 +2,12 @@ package com.glxp.api.dao.dev; import com.glxp.api.dao.BaseMapperPlus; import com.glxp.api.entity.dev.DeviceRepairApplyDetailEntity; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; +import com.glxp.api.req.dev.DeviceRepairApplyListByIdAndCodeQuery; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author Administrator @@ -11,6 +17,7 @@ import com.glxp.api.entity.dev.DeviceRepairApplyDetailEntity; */ public interface DeviceRepairApplyDetailMapper extends BaseMapperPlus { + List miniPage(@Param("param") DeviceRepairApplyDetailMiniQuery query); } diff --git a/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailItemMapper.java b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailItemMapper.java new file mode 100644 index 00000000..59cba6bc --- /dev/null +++ b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailItemMapper.java @@ -0,0 +1,15 @@ +package com.glxp.api.dao.dev; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.dev.DeviceUpkeepDetailItemEntity; + +/** +* 针对表【device_upkeep_detail_item(设备保养项目)】的数据库操作Mapper +*/ +public interface DeviceUpkeepDetailItemMapper extends BaseMapperPlus { + +} + + + + diff --git a/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailMapper.java b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailMapper.java new file mode 100644 index 00000000..00eda3c7 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepDetailMapper.java @@ -0,0 +1,15 @@ +package com.glxp.api.dao.dev; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.dev.DeviceUpkeepDetailEntity; + +/** +* 针对表【device_upkeep_detail(保养任务明细)】的数据库操作Mapper +*/ +public interface DeviceUpkeepDetailMapper extends BaseMapperPlus { + +} + + + + diff --git a/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepMapper.java b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepMapper.java new file mode 100644 index 00000000..f1e7732b --- /dev/null +++ b/src/main/java/com/glxp/api/dao/dev/DeviceUpkeepMapper.java @@ -0,0 +1,27 @@ +package com.glxp.api.dao.dev; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.dev.DeviceUpkeepEntity; +import com.glxp.api.req.dev.DeviceUpkeepQuery; +import com.glxp.api.vo.dev.DeviceUpkeepDetailVo; +import com.glxp.api.vo.dev.DeviceUpkeepVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* 针对表【device_upkeep(保养任务表)】的数据库操作Mapper +*/ +public interface DeviceUpkeepMapper extends BaseMapperPlus { + + List pageVo(DeviceUpkeepQuery query); + + + DeviceUpkeepVo getVoById(@Param("taskId") Long taskId); + + List pageListDetail(DeviceUpkeepQuery query); +} + + + + diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceCheckItemDictEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceCheckItemDictEntity.java index 06c8f0d0..e42f799a 100644 --- a/src/main/java/com/glxp/api/entity/dev/DeviceCheckItemDictEntity.java +++ b/src/main/java/com/glxp/api/entity/dev/DeviceCheckItemDictEntity.java @@ -43,7 +43,7 @@ public class DeviceCheckItemDictEntity { * 创建人id */ @TableField(value = "createUserId") - private Long createUserId; + private String createUserId; /** * 创建人名称 @@ -51,9 +51,18 @@ public class DeviceCheckItemDictEntity { @TableField(value = "createUserName") private String createUserName; + + /** + * 项目类型 1:巡检项目 2:保养项目 + */ + @TableField(value = "type") + private Integer type; + /** * 创建时间 */ @TableField(value = "createTime") private LocalDateTime createTime; -} \ No newline at end of file + + +} diff --git a/src/main/java/com/glxp/api/entity/dev/DevicePlanDetailItemEntity.java b/src/main/java/com/glxp/api/entity/dev/DevicePlanDetailItemEntity.java index f36668ac..ddfb199e 100644 --- a/src/main/java/com/glxp/api/entity/dev/DevicePlanDetailItemEntity.java +++ b/src/main/java/com/glxp/api/entity/dev/DevicePlanDetailItemEntity.java @@ -50,6 +50,12 @@ public class DevicePlanDetailItemEntity { @TableField(value = "name") private String name; + /** + * 项目类型 1巡检计划 2保养计划 + */ + @TableField(value = "type") + private String type; + /** * 项目内容 */ diff --git a/src/main/java/com/glxp/api/entity/dev/DevicePlanEntity.java b/src/main/java/com/glxp/api/entity/dev/DevicePlanEntity.java index 5fa03513..f9e906f1 100644 --- a/src/main/java/com/glxp/api/entity/dev/DevicePlanEntity.java +++ b/src/main/java/com/glxp/api/entity/dev/DevicePlanEntity.java @@ -91,6 +91,12 @@ public class DevicePlanEntity { @TableField(value = "status") private Integer status; + /** + * 计划类型 1:巡检计划 2:保养计划 + */ + @TableField(value = "type") + private Integer type; + /** * 创建时间 */ diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceRepairApplyDetailEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceRepairApplyDetailEntity.java index af0d7304..e3443315 100644 --- a/src/main/java/com/glxp/api/entity/dev/DeviceRepairApplyDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/dev/DeviceRepairApplyDetailEntity.java @@ -195,6 +195,20 @@ public class DeviceRepairApplyDetailEntity { @TableField(value = "confirmRemark") private String confirmRemark; + + /** + * 报修图片 + */ + @TableField(value = "livePath") + private String livePath; + + + /** + * 诊断图片 + */ + @TableField(value = "diagnosisLivePath") + private String diagnosisLivePath; + /** * 完成时间 */ @@ -207,4 +221,11 @@ public class DeviceRepairApplyDetailEntity { */ @TableField(value = "updateTime") private LocalDateTime updateTime; + + /** + * 报修人联系方式 + */ + @TableField(exist = false) + private String repairUserPhone; + } diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceRepairEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceRepairEntity.java index 45748147..3715c3d9 100644 --- a/src/main/java/com/glxp/api/entity/dev/DeviceRepairEntity.java +++ b/src/main/java/com/glxp/api/entity/dev/DeviceRepairEntity.java @@ -250,6 +250,39 @@ public class DeviceRepairEntity { @TableField(value = "confirmRemark") private String confirmRemark; + /** + * 维修内容 + */ + @TableField(value = "repairDescription") + private String repairDescription; + + + /** + * 报修图片 + */ + @TableField(value = "livePath") + private String livePath; + + + /** + * 维修后现场照片 + */ + @TableField(value = "serviceLivePath") + private String serviceLivePath; + + /** + * 诊断照片 + */ + @TableField(value = "diagnosisLivePath") + private String diagnosisLivePath; + + + /** + * 报修人id + */ + @TableField(value = "repairUserId") + private Long repairUserId; + /** * 确认时间 */ diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailEntity.java new file mode 100644 index 00000000..ed74cc01 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailEntity.java @@ -0,0 +1,192 @@ +package com.glxp.api.entity.dev; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * 巡检任务明细 + * + * @TableName device_upkeep_detail + */ +@TableName(value = "device_upkeep_detail") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) +public class DeviceUpkeepDetailEntity { + /** + * 任务id + */ + @TableField(value = "taskId") + private Long taskId; + + /** + * 设备编码 + */ + @TableField(value = "deviceCode") + private String deviceCode; + + /** + * 部门编码 + */ + @TableField(value = "deptCode") + private String deptCode; + + /** + * 部门名称 + */ + @TableField(value = "deptName") + private String deptName; + + /** + * 是否完成 + */ + @TableField(value = "finishFlag") + private Boolean finishFlag; + + /** + * 产品id + */ + @TableField(value = "productId") + private Long productId; + + /** + * UDI码 + */ + @TableField(value = "udi") + private String udi; + + /** + * DI码 + */ + @TableField(value = "nameCode") + private String nameCode; + + /** + * 产品名称 + */ + @TableField(value = "productName") + private String productName; + + /** + * 规格型号 + */ + @TableField(value = "ggxh") + private String ggxh; + + /** + * 批次号 + */ + @TableField(value = "batchNo") + private String batchNo; + + /** + * 序列号 + */ + @TableField(value = "serialNo") + private String serialNo; + + /** + * 生产日期 + */ + @TableField(value = "productionDate") + private String productionDate; + + /** + * 失效日期 + */ + @TableField(value = "expireDate") + private String expireDate; + + /** + * 生产厂家 + */ + @TableField(value = "manufactory") + private String manufactory; + + /** + * 计量单位 + */ + @TableField(value = "measname") + private String measname; + + /** + * 注册/备案凭证号 + */ + @TableField(value = "zczbhhzbapzbh") + private String zczbhhzbapzbh; + + /** + * 供应商ID + */ + @TableField(value = "supId") + private String supId; + + /** + * 供应商名称 + */ + @TableField(value = "supName") + private String supName; + + /** + * 巡检项目数量 + */ + @TableField(value = "itemCount") + private Integer itemCount; + + /** + * 完成项目数量 + */ + @TableField(value = "finishCount") + private Integer finishCount; + + /** + * 异常项目数量 + */ + @TableField(value = "exceptionCount") + private Integer exceptionCount; + + /** + * 完成时间 + */ + @TableField(value = "finishTime") + private LocalDateTime finishTime; + + /** + * 维修单id + */ +// @TableField(value = "repairId") +// private Long repairId; + + /** + * 巡检建议 + */ + @TableField(value = "suggestion") + private String suggestion; + /** + * 现场照片 + */ + @TableField(value = "livePath") + private String livePath; + /** + * 正常标识 + */ + @TableField(value = "normalFlag") + private Boolean normalFlag; + + + /** + * 更改时间 + */ + @TableField(value = "updateTime") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailItemEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailItemEntity.java new file mode 100644 index 00000000..f469673c --- /dev/null +++ b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepDetailItemEntity.java @@ -0,0 +1,110 @@ +package com.glxp.api.entity.dev; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * 设备保养项目 + * + * @TableName device_upkeep_detail_item + */ +@TableName(value = "device_upkeep_detail_item") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) +public class DeviceUpkeepDetailItemEntity { + /** + * 任务id + */ + @TableField(value = "taskId") + private Long taskId; + + /** + * 设备编码 + */ + @TableField(value = "deviceCode") + private String deviceCode; + + /** + * 项目编码 + */ + @TableField(value = "itemCode") + private String itemCode; + + /** + * 项目名称 + */ + @TableField(value = "itemName") + private String itemName; + + /** + * 项目内容 + */ + @TableField(value = "itemContent") + private String itemContent; + + /** + * 正常标识 + */ + @TableField(value = "normalFlag") + private Boolean normalFlag; + + + /** + * 项目完成标识 + */ + @TableField(value = "finishFlag") + private Boolean finishFlag; + + + /** + * 项目完成时间 + */ + @TableField(value = "finishTime") + private LocalDateTime finishTime; + + /** + * 保养建议 + */ + @TableField(value = "suggestion") + private String suggestion; + + /** + * 保养人id + */ + @TableField(value = "upkeepUserId") + private Long upkeepUserId; + + /** + * 保养人姓名 + */ + @TableField(value = "upkeepUserName") + private String upkeepUserName; + + /** + * 保养部门 + */ + @TableField(value = "upkeepDeptCode") + private String upkeepDeptCode; + + /** + * 保养部门名称 + */ + @TableField(value = "upkeepDeptName") + private String upkeepDeptName; + + /** + * 更改时间 + */ + @TableField(value = "updateTime") + private LocalDateTime updateTime; +} diff --git a/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepEntity.java b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepEntity.java new file mode 100644 index 00000000..e42f6d70 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/dev/DeviceUpkeepEntity.java @@ -0,0 +1,140 @@ +package com.glxp.api.entity.dev; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * 保养任务表 + * + * @TableName device_upkeep + */ +@TableName(value = "device_upkeep") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) +public class DeviceUpkeepEntity { + /** + * 保养任务id + */ + @TableId(value = "taskId") + private Long taskId; + + /** + * 计划id + */ + @TableField(value = "planId") + private Long planId; + + /** + * 计划名称 + */ + @TableField(value = "planName") + private String planName; + + /** + * 负责部门编码 + */ + @TableField(value = "chargeDeptCode") + private String chargeDeptCode; + + /** + * 保养人id + */ + @TableField(value = "upkeepUserId") + private Long upkeepUserId; + + /** + * 保养人姓名 + */ + @TableField(value = "upkeepUserName") + private String upkeepUserName; + + /** + * 保养人电话 + */ + @TableField(value = "upkeepUserPhone") + private String upkeepUserPhone; + + /** + * 设备数量 + */ + @TableField(value = "deviceCount") + private Integer deviceCount; + + /** + * 完成设备数量 + */ + @TableField(value = "finishCount") + private Integer finishCount; + + /** + * 异常设备数量 + */ + @TableField(value = "exceptionCount") + private Integer exceptionCount; + + /** + * 任务名称 + */ + @TableField(value = "name") + private String name; + + /** + * 任务备注 + */ + @TableField(value = "remark") + private String remark; + + /** + * 是否系统创建 1/true 是 0/false 否 + */ + @TableField(value = "sysFlag") + private Boolean sysFlag; + + /** + * 是否已完成 1/true 是 0/false 否 + */ + @TableField(value = "finishFlag") + private Boolean finishFlag; + + /** + * 完成时间 + */ + @TableField(value = "finishTime") + private LocalDateTime finishTime; + + /** + * 创建时间 updateTime + */ + @TableField(value = "createTime") + private LocalDateTime createTime; + + /** + * 创建人id + */ + @TableField(value = "createUserId") + private Long createUserId; + + /** + * 创建人姓名 + */ + @TableField(value = "createUserName") + private String createUserName; + + /** + * 更新时间 + */ + @TableField(value = "updateTime") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceCheckDetailMiniQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceCheckDetailMiniQuery.java new file mode 100644 index 00000000..7251813f --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceCheckDetailMiniQuery.java @@ -0,0 +1,28 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class DeviceCheckDetailMiniQuery extends ListPageRequest { + + /** + * 部门编码 + */ + @NotBlank(message = "缺少部门编码") + private String deptCode; + + /** + * 模糊设备码和UDI + */ + private String deviceCodeAndUdi; + + /** + * 是否完成 + */ + private Boolean finishFlag; + + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceCheckItemDictParam.java b/src/main/java/com/glxp/api/req/dev/DeviceCheckItemDictParam.java new file mode 100644 index 00000000..7c1bf2e0 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceCheckItemDictParam.java @@ -0,0 +1,56 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceCheckItemDictEntity; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.time.LocalDateTime; + +@Data +public class DeviceCheckItemDictParam { + + /** + * 项目编码 + */ + @NotBlank(message = "项目编码不能为空") + @Pattern(regexp = "^[A-Za-z0-9]{1,20}$", message = "项目编码应该在1~20字之间且只能包含字母和数字") + private String code; + + /** + * 项目名称 + */ + @NotBlank(message = "项目名称不能为空") + @Length(min = 1, max = 100, message = "项目名称应该在1~100字之间") + private String name; + + /** + * 项目内容 + */ + @NotBlank(message = "项目内容不能为空") + private String content; + + /** + * 项目类型 + * @param user + * @return + */ + private Integer type; + + public DeviceCheckItemDictEntity getEntity(AuthAdmin user) { + + DeviceCheckItemDictEntity build = DeviceCheckItemDictEntity.builder() + .code(code) + .name(name) + .content(content) + .type(type) + .createUserId(user.getCustomerId()) + .createUserName(user.getEmployeeName()) + .createTime(LocalDateTime.now()) + .build(); + return build; + } + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyDetailMiniQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyDetailMiniQuery.java new file mode 100644 index 00000000..9f376a83 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyDetailMiniQuery.java @@ -0,0 +1,28 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class DeviceRepairApplyDetailMiniQuery extends ListPageRequest { + + /** + * 部门编码 + */ + @NotBlank(message = "缺少部门编码") + private String deptCode; + + /** + * 模糊设备码和UDI + */ + private String deviceCodeAndUdi; + + /** + * 状态 待诊断、待维修、维修中、完成', + */ + private String status; + + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyHallQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyHallQuery.java index 498fde5f..a1acff24 100644 --- a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyHallQuery.java +++ b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyHallQuery.java @@ -13,4 +13,6 @@ public class DeviceRepairApplyHallQuery extends ListPageRequest { */ String applyDeptCode; + Integer isFinish; + } diff --git a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyListByIdAndCodeQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyListByIdAndCodeQuery.java new file mode 100644 index 00000000..ae28b9a3 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyListByIdAndCodeQuery.java @@ -0,0 +1,21 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class DeviceRepairApplyListByIdAndCodeQuery extends ListPageRequest { + + @NotNull(message = "报修单标识不能为空") + Long applyId; + + /** + * 报修人联系方式 + */ + @NotBlank(message = "设备标识不可以为空") + String deviceCode; + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyQuery.java index 9e3d81ae..fe06f5ac 100644 --- a/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyQuery.java +++ b/src/main/java/com/glxp/api/req/dev/DeviceRepairApplyQuery.java @@ -4,6 +4,8 @@ import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; import com.glxp.api.util.page.ListPageRequest; import lombok.Data; +import java.util.List; + @Data public class DeviceRepairApplyQuery extends ListPageRequest { @@ -33,4 +35,6 @@ public class DeviceRepairApplyQuery extends ListPageRequest { */ String repairInfo; + List statuss; + } diff --git a/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemFinishParam.java b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemFinishParam.java new file mode 100644 index 00000000..5d590697 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemFinishParam.java @@ -0,0 +1,33 @@ +package com.glxp.api.req.dev; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Builder +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DeviceUpkeepDetailItemFinishParam { + + @NotNull(message = "任务单标识不能为空") + private Long taskId; + + @NotBlank(message = "设备标识不能为空") + private String deviceCode; + + @NotNull(message = "项目标识不能为空") + private String itemCode; + + @NotNull(message = "请标记巡检状态") + private Boolean normalFlag; + + @NotBlank(message = "巡检意见不能为空") + private String suggestion; + + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemQuery.java new file mode 100644 index 00000000..a6c07716 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailItemQuery.java @@ -0,0 +1,21 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +@Data +public class DeviceUpkeepDetailItemQuery extends ListPageRequest { + + /** + * 任务单标识 + */ + private Long taskId; + + /** + * 设备标识 + */ +// @NotBlank(message = "设备标识不能为空") + private String deviceCode; + + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailParam.java b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailParam.java new file mode 100644 index 00000000..c338ebd8 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailParam.java @@ -0,0 +1,35 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.entity.dev.DeviceUpkeepDetailItemEntity; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +@Data +public class DeviceUpkeepDetailParam { + + @NotNull(message = "任务单标识不能为空") + private Long taskId; + + @NotBlank(message = "设备编码不能为空") + private String deviceCode; + + /** + * 保养建议 + */ + private String suggestion; + + /** + * 现场照片 + */ + private String livePath; + /** + * 正常标识 + */ + private Boolean normalFlag; + + private List detailItemEntities; + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailQuery.java new file mode 100644 index 00000000..8e8a5799 --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepDetailQuery.java @@ -0,0 +1,17 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class DeviceUpkeepDetailQuery extends ListPageRequest { + + @NotNull(message = "任务单标识不能为空") + private Long taskId; + + private String deviceCode; + + +} diff --git a/src/main/java/com/glxp/api/req/dev/DeviceUpkeepQuery.java b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepQuery.java new file mode 100644 index 00000000..eb609a6e --- /dev/null +++ b/src/main/java/com/glxp/api/req/dev/DeviceUpkeepQuery.java @@ -0,0 +1,14 @@ +package com.glxp.api.req.dev; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +@Data +public class DeviceUpkeepQuery extends ListPageRequest { + + String taskId; + String chargeDeptCode; + String deviceCode; + Boolean finishFlag; + +} diff --git a/src/main/java/com/glxp/api/res/dev/DeviceRepairApplyDetailMiniResponse.java b/src/main/java/com/glxp/api/res/dev/DeviceRepairApplyDetailMiniResponse.java new file mode 100644 index 00000000..f3567432 --- /dev/null +++ b/src/main/java/com/glxp/api/res/dev/DeviceRepairApplyDetailMiniResponse.java @@ -0,0 +1,201 @@ +package com.glxp.api.res.dev; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.glxp.api.enums.dev.DeviceRepairApplyDetailStatusEnum; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class DeviceRepairApplyDetailMiniResponse { + + /** + * 报修单id + */ + @TableField(value = "applyId") + private Long applyId; + + /** + * 设备编码 + */ + @TableField(value = "deviceCode") + private String deviceCode; + + /** + * 部门编码 + */ + @TableField(value = "deptCode") + private String deptCode; + + /** + * 部门名称 + */ + @TableField(value = "deptName") + private String deptName; + + /** + * 问题描述 + */ + @TableField(value = "description") + private String description; + + /** + * 诊断信息 + */ + @TableField(value = "diagnosisInfo") + private String diagnosisInfo; + + /** + * 状态 待诊断、待维修、维修中、完成 + */ + @TableField(value = "status") + private DeviceRepairApplyDetailStatusEnum status; + + /** + * 是否需要维修 true/false + */ + @TableField(value = "repairFlag") + private Boolean repairFlag; + + /** + * 维修单id + */ + @TableField(value = "repairId") + private Long repairId; + + /** + * 产品id + */ + @TableField(value = "productId") + private Long productId; + + /** + * UDI码 + */ + @TableField(value = "udi") + private String udi; + + /** + * DI码 + */ + @TableField(value = "nameCode") + private String nameCode; + + /** + * 产品名称 + */ + @TableField(value = "productName") + private String productName; + + /** + * 规格型号 + */ + @TableField(value = "ggxh") + private String ggxh; + + + + /** + * 报修单id + */ + @TableId(value = "id") + private Long id; + +// /** +// * 状态 待受理,受理中,维修中,完成 +// */ +// @TableField(value = "status") +// private DeviceRepairApplyStatusEnum status; + + /** + * 报修部门编码 + */ + @TableField(value = "applyDeptCode") + private String applyDeptCode; + + /** + * 报修部门 + */ + @TableField(value = "applyDeptName") + private String applyDeptName; + + /** + * 报修人id + */ + @TableField(value = "applyUserId") + private Long applyUserId; + + /** + * 报修人姓名 + */ + @TableField(value = "applyUserName") + private String applyUserName; + + /** + * 报修人联系方式 + */ + @TableField(value = "applyUserPhone") + private String applyUserPhone; + + /** + * 报修时间 + */ + @TableField(value = "applyTime") + private LocalDateTime applyTime; + + /** + * 设备数量 + */ + @TableField(value = "deviceCount") + private Integer deviceCount; + + /** + * 完成数量 + */ + @TableField(value = "finishCount") + private Integer finishCount; + + /** + * 确认部门 + */ + @TableField(value = "confirmDeptCode") + private String confirmDeptCode; + + /** + * 确认部门名称 + */ + @TableField(value = "confirmDeptName") + private String confirmDeptName; + + /** + * 确认人id + */ + @TableField(value = "confirmUserId") + private Long confirmUserId; + + /** + * 确认人姓名 + */ + @TableField(value = "confirmUserName") + private String confirmUserName; + + /** + * 确认人联系方式 + */ + @TableField(value = "confirmPhone") + private String confirmPhone; + + /** + * 确认时间 + */ + @TableField(value = "confirmTime") + private LocalDateTime confirmTime; + + /** + * 完成时间 + */ + @TableField(value = "finishTime") + private LocalDateTime finishTime; + +} diff --git a/src/main/java/com/glxp/api/service/dev/DeviceCheckDetailService.java b/src/main/java/com/glxp/api/service/dev/DeviceCheckDetailService.java index f3135e86..4073effe 100644 --- a/src/main/java/com/glxp/api/service/dev/DeviceCheckDetailService.java +++ b/src/main/java/com/glxp/api/service/dev/DeviceCheckDetailService.java @@ -3,6 +3,7 @@ package com.glxp.api.service.dev; import com.baomidou.mybatisplus.extension.service.IService; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.dev.DeviceCheckDetailEntity; +import com.glxp.api.req.dev.DeviceCheckDetailMiniQuery; import com.glxp.api.req.dev.DeviceCheckDetailParam; import com.glxp.api.req.dev.DeviceCheckDetailQuery; import com.glxp.api.req.dev.DeviceCheckDetailRepairParam; @@ -32,4 +33,5 @@ public interface DeviceCheckDetailService extends IService miniPage(DeviceCheckDetailMiniQuery query); } diff --git a/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyDetailService.java b/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyDetailService.java index da5a18d3..e5f834b8 100644 --- a/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyDetailService.java +++ b/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyDetailService.java @@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.dev.DeviceRepairApplyDetailEntity; import com.glxp.api.req.dev.DeviceRepairApplyDetailDiagnosisParam; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; import com.glxp.api.req.dev.DeviceRepairApplyDetailQuery; +import com.glxp.api.req.dev.DeviceRepairApplyListByIdAndCodeQuery; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; import java.util.List; @@ -30,4 +33,8 @@ public interface DeviceRepairApplyDetailService extends IService miniPage(DeviceRepairApplyDetailMiniQuery query); } diff --git a/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyService.java b/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyService.java index c9e05b48..a4b2a711 100644 --- a/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyService.java +++ b/src/main/java/com/glxp/api/service/dev/DeviceRepairApplyService.java @@ -6,7 +6,9 @@ import com.glxp.api.entity.dev.DeviceRepairApplyEntity; import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; import com.glxp.api.req.dev.DeviceRepairApplyAddParam; import com.glxp.api.req.dev.DeviceRepairApplyConfirmParam; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; import com.glxp.api.req.dev.DeviceRepairApplyQuery; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; import java.util.List; @@ -36,4 +38,5 @@ public interface DeviceRepairApplyService extends IService { * 完成维修 * 同时改变设备状态 * - * @param repairId 维修单id + * @param deviceRepairEntity 维修单id * @param user 用户信息 */ - void finishByUser(Long repairId, AuthAdmin user); + void finishByUser(DeviceRepairEntity deviceRepairEntity, AuthAdmin user); } diff --git a/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailItemService.java b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailItemService.java new file mode 100644 index 00000000..abd09311 --- /dev/null +++ b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailItemService.java @@ -0,0 +1,25 @@ +package com.glxp.api.service.dev; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceUpkeepDetailItemEntity; +import com.glxp.api.req.dev.DeviceUpkeepDetailItemFinishParam; +import com.glxp.api.req.dev.DeviceUpkeepDetailItemQuery; +import com.glxp.api.req.dev.DeviceUpkeepDetailParam; + +import java.util.List; + +/** + * 针对表【device_upkeep_detail_item(设备保养项目)】的数据库操作Service + */ +public interface DeviceUpkeepDetailItemService extends IService { + + + List listByTaskId(Long taskId, String deviceCode); + + List pageList(DeviceUpkeepDetailItemQuery query); + + void finish(DeviceUpkeepDetailItemFinishParam param, AuthAdmin user); + + void finishAll(DeviceUpkeepDetailParam param, AuthAdmin user); +} diff --git a/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailService.java b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailService.java new file mode 100644 index 00000000..38e121d4 --- /dev/null +++ b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepDetailService.java @@ -0,0 +1,26 @@ +package com.glxp.api.service.dev; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceUpkeepDetailEntity; +import com.glxp.api.req.dev.DeviceUpkeepDetailQuery; + +import java.util.List; + +/** + * 针对表【device_upkeep_detail(保养任务明细)】的数据库操作Service + */ +public interface DeviceUpkeepDetailService extends IService { + + + List pageList(DeviceUpkeepDetailQuery query); + + + + + List listByTaskId(Long taskId, String deviceCode); + DeviceUpkeepDetailEntity getOne(Long taskId, String deviceCode); + + + void finishItem(Long taskId, String deviceCode, String deptCode, Boolean normalFlag, AuthAdmin user); +} diff --git a/src/main/java/com/glxp/api/service/dev/DeviceUpkeepService.java b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepService.java new file mode 100644 index 00000000..1d935c05 --- /dev/null +++ b/src/main/java/com/glxp/api/service/dev/DeviceUpkeepService.java @@ -0,0 +1,46 @@ +package com.glxp.api.service.dev; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceUpkeepEntity; +import com.glxp.api.req.dev.DeviceUpkeepQuery; +import com.glxp.api.vo.dev.DeviceUpkeepDetailVo; +import com.glxp.api.vo.dev.DeviceUpkeepPrintVo; +import com.glxp.api.vo.dev.DeviceUpkeepVo; + +import java.util.List; + +/** + * @author : zhangsan + * @date : 2024/5/12 15:16 + * @modyified By : + */ + +/** + * 针对表【device_upkeep(保养任务表)】的数据库操作Service + */ +public interface DeviceUpkeepService extends IService { + + List pageList(DeviceUpkeepQuery query); + + void genByPlanId(Long planId, boolean b, AuthAdmin user); + + + + DeviceUpkeepPrintVo checkInfoPrint(Long taskId, String deviceCode); + + void finishUpkeep(Long taskId, String deviceCode); + + List pageListDetail(DeviceUpkeepQuery query); + + /** + * 完成一个保养设备 + * + * @param taskId 任务id + * @param deviceCode 设备编码 + * @return + */ +// void finishDevice(Long taskId, String deviceCode); + +// void finishUpkeep(String deviceCode, String deptCode, Long taskId, AuthAdmin user); +} diff --git a/src/main/java/com/glxp/api/service/dev/impl/DeviceCheckDetailServiceImpl.java b/src/main/java/com/glxp/api/service/dev/impl/DeviceCheckDetailServiceImpl.java index 512385a8..33277f07 100644 --- a/src/main/java/com/glxp/api/service/dev/impl/DeviceCheckDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/dev/impl/DeviceCheckDetailServiceImpl.java @@ -2,6 +2,7 @@ package com.glxp.api.service.dev.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; @@ -10,6 +11,7 @@ import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.dev.DeviceCheckDetailEntity; import com.glxp.api.entity.dev.DeviceRepairEntity; import com.glxp.api.exception.JsonException; +import com.glxp.api.req.dev.DeviceCheckDetailMiniQuery; import com.glxp.api.req.dev.DeviceCheckDetailParam; import com.glxp.api.req.dev.DeviceCheckDetailQuery; import com.glxp.api.req.dev.DeviceCheckDetailRepairParam; @@ -140,6 +142,26 @@ public class DeviceCheckDetailServiceImpl extends ServiceImpl miniPage(DeviceCheckDetailMiniQuery query) { + if (query.getPage() != null) { + PageHelper.startPage(query.getPage(), query.getLimit()); + } + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(DeviceCheckDetailEntity.class) + .eq(DeviceCheckDetailEntity::getDeptCode, query.getDeptCode()); + if (StrUtil.isNotBlank(query.getDeviceCodeAndUdi())) { + queryWrapper.and(qW -> { + qW.like(DeviceCheckDetailEntity::getDeviceCode, query.getDeviceCodeAndUdi()) + .or().like(DeviceCheckDetailEntity::getUdi, query.getDeviceCodeAndUdi()); + }); + } + if (query.getFinishFlag() != null) { + queryWrapper.eq(DeviceCheckDetailEntity::getFinishFlag, query.getFinishFlag()); + } + List list = super.list(queryWrapper); + return list; + } } diff --git a/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyDetailServiceImpl.java b/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyDetailServiceImpl.java index 117e8780..5ea8b347 100644 --- a/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyDetailServiceImpl.java @@ -13,7 +13,10 @@ import com.glxp.api.enums.dev.DeviceRepairApplyDetailStatusEnum; import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; import com.glxp.api.exception.JsonException; import com.glxp.api.req.dev.DeviceRepairApplyDetailDiagnosisParam; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; import com.glxp.api.req.dev.DeviceRepairApplyDetailQuery; +import com.glxp.api.req.dev.DeviceRepairApplyListByIdAndCodeQuery; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; import com.glxp.api.service.dev.DeviceInfoService; import com.glxp.api.service.dev.DeviceRepairApplyDetailService; import com.glxp.api.service.dev.DeviceRepairApplyService; @@ -134,6 +137,32 @@ public class DeviceRepairApplyDetailServiceImpl extends ServiceImpl miniPage(DeviceRepairApplyDetailMiniQuery query) { + if (query.getPage() != null) { + PageHelper.startPage(query.getPage(), query.getLimit()); + } + return super.baseMapper.miniPage(query); + } } diff --git a/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyServiceImpl.java b/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyServiceImpl.java index 410ab0b4..a2c3ae6e 100644 --- a/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/dev/impl/DeviceRepairApplyServiceImpl.java @@ -13,7 +13,9 @@ import com.glxp.api.entity.dev.DeviceRepairApplyEntity; import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum; import com.glxp.api.req.dev.DeviceRepairApplyAddParam; import com.glxp.api.req.dev.DeviceRepairApplyConfirmParam; +import com.glxp.api.req.dev.DeviceRepairApplyDetailMiniQuery; import com.glxp.api.req.dev.DeviceRepairApplyQuery; +import com.glxp.api.res.dev.DeviceRepairApplyDetailMiniResponse; import com.glxp.api.service.dev.DeviceInfoService; import com.glxp.api.service.dev.DeviceRepairApplyDetailService; import com.glxp.api.service.dev.DeviceRepairApplyService; @@ -147,6 +149,7 @@ public class DeviceRepairApplyServiceImpl extends ServiceImpl + implements DeviceUpkeepDetailItemService { + + @Resource + DeviceUpkeepService deviceUpkeepService; + @Resource + DeviceUpkeepDetailService deviceUpkeepDetailService; + @Resource + DeviceUpkeepDetailMapper deviceUpkeepDetailMapper; + + + @Override + public List listByTaskId(Long taskId, String deviceCode) { + List list = super.list(Wrappers.lambdaQuery(DeviceUpkeepDetailItemEntity.class) + .eq(DeviceUpkeepDetailItemEntity::getTaskId, taskId) + .eq(deviceCode != null, DeviceUpkeepDetailItemEntity::getDeviceCode, deviceCode) + .orderByAsc(DeviceUpkeepDetailItemEntity::getDeviceCode, DeviceUpkeepDetailItemEntity::getItemCode) + ); + return list; + } + + @Override + public List pageList(DeviceUpkeepDetailItemQuery query) { + List list = super.list(Wrappers.lambdaQuery(DeviceUpkeepDetailItemEntity.class) + .eq(DeviceUpkeepDetailItemEntity::getTaskId, query.getTaskId()) + .eq(query.getDeviceCode()!=null,DeviceUpkeepDetailItemEntity::getDeviceCode, query.getDeviceCode()) + .orderByAsc(DeviceUpkeepDetailItemEntity::getFinishFlag, DeviceUpkeepDetailItemEntity::getNormalFlag, DeviceUpkeepDetailItemEntity::getDeviceCode, DeviceUpkeepDetailItemEntity::getItemCode) + ); + + return list; + } + + @Override + public void finish(DeviceUpkeepDetailItemFinishParam param, AuthAdmin user) { + DeviceUpkeepEntity upkeepEntity = deviceUpkeepService.getById(param.getTaskId()); + if (upkeepEntity == null) { + return; + } +// DeviceUpkeepDetailEntity detailEntity = deviceUpkeepDetailService.getOne(param.getTaskId(), param.getDeviceCode()); +//// DeviceCheckDetailEntity detailEntity = deviceCheckDetailService.getOne(param.getTaskId(), param.getDeviceCode()); + + DeviceUpkeepDetailEntity detailEntity = deviceUpkeepDetailService.getOne(param.getTaskId(), param.getDeviceCode()); + if (detailEntity == null) { + return; + } + boolean updated = super.update(Wrappers.lambdaUpdate(DeviceUpkeepDetailItemEntity.class) + .set(DeviceUpkeepDetailItemEntity::getFinishFlag, true) + .set(DeviceUpkeepDetailItemEntity::getFinishTime, LocalDateTime.now()) + .set(DeviceUpkeepDetailItemEntity::getSuggestion, param.getSuggestion()) + .set(DeviceUpkeepDetailItemEntity::getNormalFlag, param.getNormalFlag()) + .set(DeviceUpkeepDetailItemEntity::getUpkeepUserId, user.getId()) + .set(DeviceUpkeepDetailItemEntity::getUpkeepUserName, user.getEmployeeName()) + .set(DeviceUpkeepDetailItemEntity::getUpkeepDeptCode, user.getLocDeptCode()) + .set(DeviceUpkeepDetailItemEntity::getUpkeepDeptName, user.getDeptName()) + .set(DeviceUpkeepDetailItemEntity::getUpdateTime,LocalDateTime.now()) + .eq(DeviceUpkeepDetailItemEntity::getTaskId, param.getTaskId()) + .eq(DeviceUpkeepDetailItemEntity::getDeviceCode, param.getDeviceCode()) + .eq(DeviceUpkeepDetailItemEntity::getItemCode, param.getItemCode()) + .eq(DeviceUpkeepDetailItemEntity::getFinishFlag, false) + ); + if (updated) { + deviceUpkeepDetailService.finishItem(param.getTaskId(), param.getDeviceCode(), detailEntity.getDeptCode(), param.getNormalFlag(), user); + } else { + throw new JsonException("操作失败,该项目可能已经被其他人完成,请刷新重试"); + } + } + + @Override + public void finishAll(DeviceUpkeepDetailParam param, AuthAdmin user) { + int finishCount = 0; + int exceptionCount = 0; + int itemCount = 0; + if (CollUtil.isNotEmpty(param.getDetailItemEntities())) { + for (DeviceUpkeepDetailItemEntity itemEntity : param.getDetailItemEntities()) { + if (!IntUtil.value(itemEntity.getNormalFlag())) { + exceptionCount++; + } + finishCount++; + itemCount++; + finish(DeviceUpkeepDetailItemFinishParam.builder() + .taskId(param.getTaskId()) + .deviceCode(param.getDeviceCode()) + .itemCode(itemEntity.getItemCode()) + .normalFlag(itemEntity.getNormalFlag()) + .suggestion("") + .build(), user); + } + } +// log.error("修改语句"); + int update = deviceUpkeepDetailMapper.update(DeviceUpkeepDetailEntity.builder() + .finishFlag(true) + .finishCount(finishCount) + .suggestion(param.getSuggestion()) + .livePath(param.getLivePath()) + .normalFlag(param.getNormalFlag()) + .finishTime(LocalDateTime.now()) + .updateTime(LocalDateTime.now()) + .exceptionCount(exceptionCount).itemCount(itemCount).build(), + Wrappers.lambdaUpdate(DeviceUpkeepDetailEntity.class) + .eq(DeviceUpkeepDetailEntity::getTaskId, param.getTaskId()) + .eq(DeviceUpkeepDetailEntity::getDeviceCode, param.getDeviceCode()) + ); + if (update<1){ + + throw new JsonException(ResultEnum.NOT_NETWORK,"修改失败"); + } + + } + +} + + + + diff --git a/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepDetailServiceImpl.java b/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepDetailServiceImpl.java new file mode 100644 index 00000000..b55f3dd4 --- /dev/null +++ b/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepDetailServiceImpl.java @@ -0,0 +1,101 @@ +package com.glxp.api.service.dev.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.dev.DeviceUpkeepDetailMapper; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.DeviceUpkeepDetailEntity; +import com.glxp.api.req.dev.DeviceUpkeepDetailQuery; +import com.glxp.api.service.dev.DeviceInfoService; +import com.glxp.api.service.dev.DeviceUpkeepDetailService; +import com.glxp.api.service.dev.DeviceUpkeepService; +import groovy.util.logging.Slf4j; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 针对表【device_upkeep_detail(保养任务明细)】的数据库操作Service实现 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class DeviceUpkeepDetailServiceImpl extends ServiceImpl + implements DeviceUpkeepDetailService { + + final DeviceUpkeepService deviceUpkeepService; + final DeviceInfoService deviceInfoService; + + @Override + public List pageList(DeviceUpkeepDetailQuery query) { + if (query.getPage() != null) { + PageHelper.startPage(query.getPage(), query.getLimit()); + } + List list = super.list(Wrappers.lambdaQuery(DeviceUpkeepDetailEntity.class) + .eq(DeviceUpkeepDetailEntity::getTaskId, query.getTaskId()) + .eq(StrUtil.isNotBlank(query.getDeviceCode()), DeviceUpkeepDetailEntity::getDeviceCode, query.getDeviceCode()) + .orderBy(true, true, DeviceUpkeepDetailEntity::getFinishFlag) + .orderBy(true, false, DeviceUpkeepDetailEntity::getExceptionCount) + .orderBy(true, true, DeviceUpkeepDetailEntity::getDeptCode) + .orderBy(true, true, DeviceUpkeepDetailEntity::getFinishTime) + .orderBy(true, true, DeviceUpkeepDetailEntity::getDeptCode) + ); + return list; + } + + @Override + public List listByTaskId(Long taskId, String deviceCode) { + List list = super.list(Wrappers.lambdaQuery(DeviceUpkeepDetailEntity.class) + .eq(DeviceUpkeepDetailEntity::getTaskId, taskId) + .eq(deviceCode != null, DeviceUpkeepDetailEntity::getDeviceCode, deviceCode) + .orderByAsc(DeviceUpkeepDetailEntity::getDeptCode, DeviceUpkeepDetailEntity::getDeviceCode) + ); + return list; + } + + @Override + public DeviceUpkeepDetailEntity getOne(Long taskId, String deviceCode) { + return super.getOne(Wrappers.lambdaQuery(DeviceUpkeepDetailEntity.class) + .eq(DeviceUpkeepDetailEntity::getTaskId, taskId) + .eq(DeviceUpkeepDetailEntity::getDeviceCode, deviceCode) + ); + } + + @Override + public void finishItem(Long taskId, String deviceCode, String deptCode, Boolean normalFlag, AuthAdmin user) { + boolean updated = super.update(Wrappers.lambdaUpdate(DeviceUpkeepDetailEntity.class) + .setSql("finishCount = finishCount + 1") + .setSql(!normalFlag, "exceptionCount = exceptionCount + 1") + .eq(DeviceUpkeepDetailEntity::getTaskId, taskId) + .eq(DeviceUpkeepDetailEntity::getDeviceCode, deviceCode) + .last("and finishCount+1<=itemCount") + ); + if (updated) { + updated = super.update(Wrappers.lambdaUpdate(DeviceUpkeepDetailEntity.class) + .set(DeviceUpkeepDetailEntity::getFinishFlag, true) + .set(DeviceUpkeepDetailEntity::getFinishTime, LocalDateTime.now()) + .set(DeviceUpkeepDetailEntity::getUpdateTime, LocalDateTime.now()) + .eq(DeviceUpkeepDetailEntity::getTaskId, taskId) + .eq(DeviceUpkeepDetailEntity::getDeviceCode, deviceCode) + .last("and finishCount = itemCount") + ); + if (updated) { + // 所有项目全部完成。。。修改任务单完成设备 and 关闭设备的巡检锁 + deviceUpkeepService.finishUpkeep(taskId, deviceCode); + deviceInfoService.finishCheck(deviceCode, deptCode, taskId, user); + + } + + } + } + + +} + + + + diff --git a/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepServiceImpl.java b/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepServiceImpl.java new file mode 100644 index 00000000..5919ff6a --- /dev/null +++ b/src/main/java/com/glxp/api/service/dev/impl/DeviceUpkeepServiceImpl.java @@ -0,0 +1,227 @@ +package com.glxp.api.service.dev.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.dev.DeviceUpkeepMapper; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.dev.*; +import com.glxp.api.enums.dev.DeviceStatusEnum; +import com.glxp.api.exception.JsonException; +import com.glxp.api.req.dev.DeviceUpkeepQuery; +import com.glxp.api.service.dev.*; +import com.glxp.api.util.SnowflakeUtil; +import com.glxp.api.vo.dev.DevicePlanDetailVo; +import com.glxp.api.vo.dev.DeviceUpkeepDetailVo; +import com.glxp.api.vo.dev.DeviceUpkeepPrintVo; +import com.glxp.api.vo.dev.DeviceUpkeepVo; +import lombok.RequiredArgsConstructor; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.stream.Collectors; + +/** + * @author : zhangsan + * @date : 2024/5/12 15:19 + * @modyified By : + */ + + +/** + * 针对表【device_upkeep(保养任务表)】的数据库操作Service + */ +@Service +@RequiredArgsConstructor +public class DeviceUpkeepServiceImpl extends ServiceImpl + implements DeviceUpkeepService { + + + @Resource + DevicePlanService devicePlanService; + @Resource + DeviceUpkeepDetailService deviceUpkeepDetailService; + @Resource + DevicePlanDetailItemService devicePlanDetailItemService; + @Resource + DeviceInfoService deviceInfoService; + @Resource + DeviceUpkeepDetailItemService deviceUpkeepDetailItemService; + @Resource + DevicePlanDetailService devicePlanDetailService; + + private final ThreadPoolTaskExecutor taskExecutor; + + @Override + public List pageList(DeviceUpkeepQuery query) { + if (query.getPage() != null){ + PageHelper.startPage(query.getPage(),query.getLimit()); + } + List list = super.baseMapper.pageVo(query); + return list; + } + + @Override + public void genByPlanId(Long planId, boolean b, AuthAdmin user) { + DevicePlanEntity plan = devicePlanService.getById(planId); + if (plan == null) { + throw new JsonException("保养计划不存在"); + } + List planDetailList = devicePlanDetailService.listByPlanId(planId); + if (CollectionUtil.isEmpty(planDetailList)) { + throw new JsonException("计划保养产品为空,不创建任务单"); + } + List itemList = devicePlanDetailItemService.listByPlanId(planId); + Map> itemMap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(itemList)) { + itemMap = itemList.stream().collect(Collectors.groupingBy(i -> i.getProductId() + "_" + i.getDeviceCode())); + } + + DeviceUpkeepEntity deviceUpkeepEntity = DeviceUpkeepEntity.builder() + .taskId(SnowflakeUtil.getId()) + .planId(plan.getPlanId()) + .planName(plan.getName()) + .chargeDeptCode(plan.getChargeDeptCode()) + .name(plan.getName()) + .finishCount(0) + .sysFlag(b) + .createTime(LocalDateTime.now()) + .updateTime(LocalDateTime.now()) + .createUserId(b ? null : user.getId()) + .createUserName(b ? null : user.getEmployeeName()) + .build(); + + List upkeepDetailList = new ArrayList<>(); + List upkeepDetailItemList = new ArrayList<>(); + Map> finalItemMap = itemMap; + planDetailList.forEach(d -> { + List items = finalItemMap.get(d.getProductId() + "_" + d.getDeviceCode()); + if (CollectionUtil.isEmpty(items)) { + items = new ArrayList<>(); + } + List productItems = finalItemMap.get(d.getProductId() + "_"); + if (CollectionUtil.isNotEmpty(productItems)) { + items.addAll(productItems); + } + if (CollectionUtil.isNotEmpty(items)) { + DeviceUpkeepDetailEntity detailEntity = DeviceUpkeepDetailEntity.builder() + .taskId(deviceUpkeepEntity.getTaskId()) + .updateTime(LocalDateTime.now()) + .finishFlag(false) + .build(); + BeanUtil.copyProperties(d, detailEntity); + boolean opened = deviceInfoService.openCheckLock(d.getDeviceCode(), d.getDeptCode()); + if (opened) { + items.forEach(item -> { + DeviceUpkeepDetailItemEntity deviceCheckDetailItem = DeviceUpkeepDetailItemEntity.builder() + .taskId(deviceUpkeepEntity.getTaskId()) + .deviceCode(d.getDeviceCode()) + .itemCode(item.getItemCode()) + .itemName(item.getName()) + .itemContent(item.getContent()) + .finishFlag(false) + .updateTime(LocalDateTime.now()) + .build(); +// deviceCheckDetailItem.setUpdateTime(LocalDateTime.now()); + upkeepDetailItemList.add(deviceCheckDetailItem); + }); + detailEntity.setItemCount(items.size()); + upkeepDetailList.add(detailEntity); + } + } + }); + + if (CollectionUtil.isNotEmpty(upkeepDetailList)) { + devicePlanService.addExecCount(planId); + deviceUpkeepEntity.setDeviceCount(upkeepDetailList.size()); + super.save(deviceUpkeepEntity); + deviceUpkeepDetailService.saveBatch(upkeepDetailList); + if (CollectionUtil.isNotEmpty(upkeepDetailItemList)) { + deviceUpkeepDetailItemService.saveBatch(upkeepDetailItemList); + }else { + throw new JsonException(String.format("没有配置巡检项目,无法生成巡检单")); + } + } else { + throw new JsonException(String.format("没有找到处于[%s]状态的设备,无法生成保养单", DeviceStatusEnum.NORMAL.getDesc())); + } + } + + @Override + public DeviceUpkeepPrintVo checkInfoPrint(Long taskId, String deviceCode) { + CompletableFuture infoFuture = CompletableFuture.supplyAsync(() -> { + return super.baseMapper.getVoById(taskId); + }, taskExecutor); + CompletableFuture> detailFuture = CompletableFuture.supplyAsync(() -> { + return deviceUpkeepDetailService.listByTaskId(taskId, deviceCode); + }, taskExecutor); + CompletableFuture> detailItemFuture = CompletableFuture.supplyAsync(() -> { + return deviceUpkeepDetailItemService.listByTaskId(taskId, deviceCode); + }, taskExecutor); + + try { + CompletableFuture.allOf(detailItemFuture).get(); + DeviceUpkeepVo upkeepVo = infoFuture.get(); + List details = detailFuture.get(); + List items = detailItemFuture.get(); + if (upkeepVo == null || details == null || items == null) { + throw new JsonException("任务单不存在"); + } + List detailVos = BeanUtil.copyToList(details, DeviceUpkeepPrintVo.DetailVo.class); + Map> itemsMap = items.stream().collect(Collectors.groupingBy(DeviceUpkeepDetailItemEntity::getDeviceCode)); + detailVos.forEach(i -> { + i.setDetailItems(itemsMap.get(i.getDeviceCode())); + }); + DeviceUpkeepPrintVo vo = DeviceUpkeepPrintVo.builder() + .printTime(LocalDateTime.now()) + .info(upkeepVo) + .details(detailVos) + .build(); + return vo; + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + } + + @Override + @Transactional + public void finishUpkeep(Long taskId, String deviceCode) { + boolean updated = super.update(Wrappers.lambdaUpdate(DeviceUpkeepEntity.class) + .setSql("finishCount = finishCount + 1") + .setSql(String.format("exceptionCount = exceptionCount + (select exceptionCount>0 from device_upkeep_detail where taskId = %s and deviceCode = '%s')", taskId, deviceCode)) + .eq(DeviceUpkeepEntity::getTaskId, taskId) + .last("and finishCount+1 <= deviceCount") + ); + if (updated) { + updated = super.update(Wrappers.lambdaUpdate(DeviceUpkeepEntity.class) + .set(DeviceUpkeepEntity::getFinishFlag, true) + .set(DeviceUpkeepEntity::getFinishTime, LocalDateTime.now()) + .set(DeviceUpkeepEntity::getUpdateTime,LocalDateTime.now()) + .eq(DeviceUpkeepEntity::getTaskId, taskId) + .eq(DeviceUpkeepEntity::getFinishFlag, false) + .last("and finishCount = deviceCount") + ); + } + } + + @Override + public List pageListDetail(DeviceUpkeepQuery query) { + if (query.getPage() != null){ + PageHelper.startPage(query.getPage(),query.getLimit()); + } + List list = super.baseMapper.pageListDetail(query); + return list; + } + + +} diff --git a/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepDetailVo.java b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepDetailVo.java new file mode 100644 index 00000000..4280e8ed --- /dev/null +++ b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepDetailVo.java @@ -0,0 +1,19 @@ +package com.glxp.api.vo.dev; + +import lombok.Data; + +@Data +public class DeviceUpkeepDetailVo { + + String deviceCode; + String deptName; + Boolean finishFlag; + String manufactory; + Integer itemCount; + Integer exceptionCount; + Integer finishCount; + Integer deviceCount; + String createUserName; + + +} diff --git a/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepPrintVo.java b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepPrintVo.java new file mode 100644 index 00000000..e6e9579a --- /dev/null +++ b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepPrintVo.java @@ -0,0 +1,33 @@ +package com.glxp.api.vo.dev; + +import com.glxp.api.entity.dev.DeviceCheckDetailEntity; +import com.glxp.api.entity.dev.DeviceUpkeepDetailItemEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class DeviceUpkeepPrintVo { + + LocalDateTime printTime; + + DeviceUpkeepVo info; + + List details; + + + @Data + @AllArgsConstructor + @NoArgsConstructor + public class DetailVo extends DeviceCheckDetailEntity { + public List detailItems; + } + +} diff --git a/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepVo.java b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepVo.java new file mode 100644 index 00000000..b7bf2802 --- /dev/null +++ b/src/main/java/com/glxp/api/vo/dev/DeviceUpkeepVo.java @@ -0,0 +1,11 @@ +package com.glxp.api.vo.dev; + +import com.glxp.api.entity.dev.DeviceUpkeepEntity; +import lombok.Data; + +@Data +public class DeviceUpkeepVo extends DeviceUpkeepEntity { + + String chargeDeptName; + +} diff --git a/src/main/resources/mybatis/mapper/dev/DeviceRepairApplyDetailMapper.xml b/src/main/resources/mybatis/mapper/dev/DeviceRepairApplyDetailMapper.xml index bd0cf536..d6ed4f93 100644 --- a/src/main/resources/mybatis/mapper/dev/DeviceRepairApplyDetailMapper.xml +++ b/src/main/resources/mybatis/mapper/dev/DeviceRepairApplyDetailMapper.xml @@ -45,4 +45,69 @@ supName,confirmUserId,confirmUserName, confirmTime,confirmRemark,updateTime + + + + diff --git a/src/main/resources/mybatis/mapper/dev/DeviceUpkeepMapper.xml b/src/main/resources/mybatis/mapper/dev/DeviceUpkeepMapper.xml new file mode 100644 index 00000000..2df51e8c --- /dev/null +++ b/src/main/resources/mybatis/mapper/dev/DeviceUpkeepMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + taskId,planId,planName, + upkeepUserId,upkeepUserName,upkeepUserPhone, + name,remark,sysFlag, + createTime,createUserId,createUserName + + + + + diff --git a/src/main/resources/schemas/schema_v2.3.sql b/src/main/resources/schemas/schema_v2.3.sql index d03b4164..1bc881af 100644 --- a/src/main/resources/schemas/schema_v2.3.sql +++ b/src/main/resources/schemas/schema_v2.3.sql @@ -817,3 +817,7 @@ CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'vailProductAttributes', 'tinyint NULL DEFAULT NULL COMMENT ''校验产品属性 :1:校验;2.无需校验''', 1); CALL Pro_Temp_ColumnWork('auth_user', 'lastUpdatePwdTime', 'datetime', 1); + + + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 72c3ec62..01753bd7 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -132,7 +132,7 @@ CREATE TABLE if not exists `device_check` ROW_FORMAT=Dynamic; - CREATE TABLE IF NOT EXISTS `device_check_detail` +CREATE TABLE IF NOT EXISTS `device_check_detail` ( `taskId` bigint NOT NULL COMMENT '任务id', `deviceCode` varbinary(255) NOT NULL COMMENT '设备编码', @@ -168,7 +168,7 @@ CREATE TABLE if not exists `device_check` COLLATE=utf8mb4_0900_ai_ci COMMENT='巡检任务明细' ROW_FORMAT=Dynamic; - CREATE TABLE IF NOT EXISTS `device_check_detail_item` +CREATE TABLE IF NOT EXISTS `device_check_detail_item` ( `taskId` bigint NOT NULL COMMENT '任务id', `deviceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备编码', @@ -389,7 +389,7 @@ DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='设备变更日志表' ROW_FORMAT=Dynamic; -CREATE TABLE `device_change_order` ( +CREATE TABLE IF NOT EXISTS `device_change_order` ( `orderId` bigint NOT NULL COMMENT '编码', `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'add:新增入库,change:变更归属', `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '1.待目标部门接收 ,2.完成(目标确认接收) ,3.目标部门拒收,4.取消', @@ -430,12 +430,23 @@ CALL Pro_Temp_ColumnWork('device_repair', 'repairDescription', ' varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''维修内容''', 1); -INSERT ignore INTO `device_info` (`deviceCode`, `deptCode`, `status`, `checkLock`, `udi`, `nameCode`, `productId`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `changeCount`, `repairApplyCount`, `repairCount`, `checkCount`, `lastChangeOrderId`, `lastRepairApplyId`, `lastRepairApplyTime`, `lastRepairId`, `lastRepairUserName`, `lastRepairUserPhone`, `lastRepairTime`, `lastCheckUserId`, `lastCheckUserName`, `lastCheckPhone`, `lastCheckTime`, `lastCheckTaskId`, `createTime`, `createUserId`, `createUserName`, `assetType`, `sasacType`, `assetMnemonicCode`, `number`, `acquisitionMethod`, `purpose`, `depreciationYear`, `depreciationMonth`, `invCode`, `estimatedTotalHour`, `dayHour`, `assetValue`, `ownFund`, `financialAppropriation`, `educationFund`, `otherFund`, `nonPeerFinancialAppropriation`, `ybbm`, `catalogname1`, `catalogname2`, `catalogname3`, `catalogCode`, `catalogCode1`, `catalogCode2`, `catalogCode3`, `managementCategory`, `endUser`, `estimatedResidualValue`, `currencyType`, `purType`, `purchaseDate`, `addDate`, `assetName`, `isImperative`, `isMaintain`, `imperativeCycle`, `maintainCycle`, `startImperativeDate`, `startMaintainDate`, `serviceType`, `maintainType`, `managerUser`, `approveUser`, `ledgerAccount`, `impairmentProvision`, `estimatedWorkload`, `completedWorkload`, `maintenanceType`, `maintenanceCycle`, `startMaintenancDate`, `endMaintenancDate`, `networkType`, `UserRole`, `isAddDomain`, `isUDisc`, `ascriptionType`, `assetReserveType`, `updateTime`) VALUES ('S0790586160', '1002', 'change', b'1', NULL, '06902139333834', 700205494, '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, 0, 0, 0, 0, 1788043097458315264, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-08 11:09:15', 1, '超级用户', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-09 10:48:43'); -INSERT ignore INTO `device_info` (`deviceCode`, `deptCode`, `status`, `checkLock`, `udi`, `nameCode`, `productId`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `changeCount`, `repairApplyCount`, `repairCount`, `checkCount`, `lastChangeOrderId`, `lastRepairApplyId`, `lastRepairApplyTime`, `lastRepairId`, `lastRepairUserName`, `lastRepairUserPhone`, `lastRepairTime`, `lastCheckUserId`, `lastCheckUserName`, `lastCheckPhone`, `lastCheckTime`, `lastCheckTaskId`, `createTime`, `createUserId`, `createUserName`, `assetType`, `sasacType`, `assetMnemonicCode`, `number`, `acquisitionMethod`, `purpose`, `depreciationYear`, `depreciationMonth`, `invCode`, `estimatedTotalHour`, `dayHour`, `assetValue`, `ownFund`, `financialAppropriation`, `educationFund`, `otherFund`, `nonPeerFinancialAppropriation`, `ybbm`, `catalogname1`, `catalogname2`, `catalogname3`, `catalogCode`, `catalogCode1`, `catalogCode2`, `catalogCode3`, `managementCategory`, `endUser`, `estimatedResidualValue`, `currencyType`, `purType`, `purchaseDate`, `addDate`, `assetName`, `isImperative`, `isMaintain`, `imperativeCycle`, `maintainCycle`, `startImperativeDate`, `startMaintainDate`, `serviceType`, `maintainType`, `managerUser`, `approveUser`, `ledgerAccount`, `impairmentProvision`, `estimatedWorkload`, `completedWorkload`, `maintenanceType`, `maintenanceCycle`, `startMaintenancDate`, `endMaintenancDate`, `networkType`, `UserRole`, `isAddDomain`, `isUDisc`, `ascriptionType`, `assetReserveType`, `updateTime`) VALUES ('S3054245435', '1002', 'repair_apply', b'0', NULL, '06902139333834', 700205494, '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, 0, 1, 0, 0, 1788042594527952896, '1788055560932900864', '2024-05-08 11:57:21', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-08 11:06:23', 1, '超级用户', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-09 10:48:36'); -INSERT ignore INTO `device_repair_apply` (`id`, `status`, `applyDeptCode`, `applyDeptName`, `applyUserId`, `applyUserName`, `applyUserPhone`, `applyTime`, `deviceCount`, `finishCount`, `confirmDeptCode`, `confirmDeptName`, `confirmUserId`, `confirmUserName`, `confirmPhone`, `confirmTime`, `finishTime`, `updateTime`) VALUES (1787801533814042624, 'processing', '1002', '手术室', 1, '超级用户', '18238132561', '2024-05-07 19:07:56', 1, 0, '1002', '手术室', 1, '超级用户', '15752121213', '2024-05-07 19:11:48', NULL, '2024-05-09 11:59:52'); -INSERT ignore INTO `device_repair_apply` (`id`, `status`, `applyDeptCode`, `applyDeptName`, `applyUserId`, `applyUserName`, `applyUserPhone`, `applyTime`, `deviceCount`, `finishCount`, `confirmDeptCode`, `confirmDeptName`, `confirmUserId`, `confirmUserName`, `confirmPhone`, `confirmTime`, `finishTime`, `updateTime`) VALUES (1787801935535218688, 'processing', '1002', '手术室', 1, '超级用户', '15866936214', '2024-05-07 19:09:32', 1, 0, '1002', '手术室', 1, '超级用户', '15752121213', '2024-05-07 19:10:46', NULL, '2024-05-09 14:29:19'); -INSERT ignore INTO `device_repair_apply_detail` (`applyId`, `deviceCode`, `deptCode`, `deptName`, `description`, `diagnosisInfo`, `status`, `repairFlag`, `repairId`, `productId`, `udi`, `nameCode`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `confirmUserId`, `confirmUserName`, `confirmTime`, `confirmRemark`, `confirmDeptCode`, `confirmDeptName`, `finishTime`, `updateTime`) VALUES (1787801533814042624, 'S0185624335', '1002', '手术室', 'SUCCESS!!!!!!!!!!', NULL, 'wait_diagnosis', NULL, NULL, 700205494, NULL, '06902139333834', '金属骨针', 'GZZH04YB φ2.0×200mm', 'zxzxz111', '11111111111111111', '2024-05-01', '2024-05-30', '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-07 19:07:56'); -INSERT ignore INTO `device_repair_apply_detail` (`applyId`, `deviceCode`, `deptCode`, `deptName`, `description`, `diagnosisInfo`, `status`, `repairFlag`, `repairId`, `productId`, `udi`, `nameCode`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `confirmUserId`, `confirmUserName`, `confirmTime`, `confirmRemark`, `confirmDeptCode`, `confirmDeptName`, `finishTime`, `updateTime`) VALUES (1787801935535218688, 'S1216934642', '1002', '手术室', 'ZZZZZZZZZZZZZZZZZZZZZZZ', NULL, 'wait_diagnosis', NULL, NULL, 700205494, NULL, '06902139333834', '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-07 19:09:32'); +INSERT ignore INTO `device_info` (`deviceCode`, `deptCode`, `status`, `checkLock`, `udi`, `nameCode`, `productId`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `changeCount`, `repairApplyCount`, `repairCount`, `checkCount`, `lastChangeOrderId`, `lastRepairApplyId`, `lastRepairApplyTime`, `lastRepairId`, `lastRepairUserName`, `lastRepairUserPhone`, `lastRepairTime`, `lastCheckUserId`, `lastCheckUserName`, `lastCheckPhone`, `lastCheckTime`, `lastCheckTaskId`, `createTime`, `createUserId`, `createUserName`, `assetType`, `sasacType`, `assetMnemonicCode`, `number`, `acquisitionMethod`, `purpose`, `depreciationYear`, `depreciationMonth`, `invCode`, `estimatedTotalHour`, `dayHour`, `assetValue`, `ownFund`, `financialAppropriation`, `educationFund`, `otherFund`, `nonPeerFinancialAppropriation`, `ybbm`, `catalogname1`, `catalogname2`, `catalogname3`, `catalogCode`, `catalogCode1`, `catalogCode2`, `catalogCode3`, `managementCategory`, `endUser`, `estimatedResidualValue`, `currencyType`, `purType`, `purchaseDate`, `addDate`, `assetName`, `isImperative`, `isMaintain`, `imperativeCycle`, `maintainCycle`, `startImperativeDate`, `startMaintainDate`, `serviceType`, `maintainType`, `managerUser`, `approveUser`, `ledgerAccount`, `impairmentProvision`, `estimatedWorkload`, `completedWorkload`, `maintenanceType`, `maintenanceCycle`, `startMaintenancDate`, `endMaintenancDate`, `networkType`, `UserRole`, `isAddDomain`, `isUDisc`, `ascriptionType`, `assetReserveType`, `updateTime`) +VALUES ('S0790586160', '1002', 'change', b'1', NULL, '06902139333834', 700205494, '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, 0, 0, 0, 0, 1788043097458315264, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-08 11:09:15', 1, '超级用户', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-09 10:48:43'); + +INSERT ignore INTO `device_info` (`deviceCode`, `deptCode`, `status`, `checkLock`, `udi`, `nameCode`, `productId`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `changeCount`, `repairApplyCount`, `repairCount`, `checkCount`, `lastChangeOrderId`, `lastRepairApplyId`, `lastRepairApplyTime`, `lastRepairId`, `lastRepairUserName`, `lastRepairUserPhone`, `lastRepairTime`, `lastCheckUserId`, `lastCheckUserName`, `lastCheckPhone`, `lastCheckTime`, `lastCheckTaskId`, `createTime`, `createUserId`, `createUserName`, `assetType`, `sasacType`, `assetMnemonicCode`, `number`, `acquisitionMethod`, `purpose`, `depreciationYear`, `depreciationMonth`, `invCode`, `estimatedTotalHour`, `dayHour`, `assetValue`, `ownFund`, `financialAppropriation`, `educationFund`, `otherFund`, `nonPeerFinancialAppropriation`, `ybbm`, `catalogname1`, `catalogname2`, `catalogname3`, `catalogCode`, `catalogCode1`, `catalogCode2`, `catalogCode3`, `managementCategory`, `endUser`, `estimatedResidualValue`, `currencyType`, `purType`, `purchaseDate`, `addDate`, `assetName`, `isImperative`, `isMaintain`, `imperativeCycle`, `maintainCycle`, `startImperativeDate`, `startMaintainDate`, `serviceType`, `maintainType`, `managerUser`, `approveUser`, `ledgerAccount`, `impairmentProvision`, `estimatedWorkload`, `completedWorkload`, `maintenanceType`, `maintenanceCycle`, `startMaintenancDate`, `endMaintenancDate`, `networkType`, `UserRole`, `isAddDomain`, `isUDisc`, `ascriptionType`, `assetReserveType`, `updateTime`) +VALUES ('S3054245435', '1002', 'repair_apply', b'0', NULL, '06902139333834', 700205494, '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, 0, 1, 0, 0, 1788042594527952896, '1788055560932900864', '2024-05-08 11:57:21', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-08 11:06:23', 1, '超级用户', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-09 10:48:36'); + +INSERT ignore INTO `device_repair_apply` (`id`, `status`, `applyDeptCode`, `applyDeptName`, `applyUserId`, `applyUserName`, `applyUserPhone`, `applyTime`, `deviceCount`, `finishCount`, `confirmDeptCode`, `confirmDeptName`, `confirmUserId`, `confirmUserName`, `confirmPhone`, `confirmTime`, `finishTime`, `updateTime`) +VALUES (1787801533814042624, 'processing', '1002', '手术室', 1, '超级用户', '18238132561', '2024-05-07 19:07:56', 1, 0, '1002', '手术室', 1, '超级用户', '15752121213', '2024-05-07 19:11:48', NULL, '2024-05-09 11:59:52'); + +INSERT ignore INTO `device_repair_apply` (`id`, `status`, `applyDeptCode`, `applyDeptName`, `applyUserId`, `applyUserName`, `applyUserPhone`, `applyTime`, `deviceCount`, `finishCount`, `confirmDeptCode`, `confirmDeptName`, `confirmUserId`, `confirmUserName`, `confirmPhone`, `confirmTime`, `finishTime`, `updateTime`) +VALUES (1787801935535218688, 'processing', '1002', '手术室', 1, '超级用户', '15866936214', '2024-05-07 19:09:32', 1, 0, '1002', '手术室', 1, '超级用户', '15752121213', '2024-05-07 19:10:46', NULL, '2024-05-09 14:29:19'); + +INSERT ignore INTO `device_repair_apply_detail` (`applyId`, `deviceCode`, `deptCode`, `deptName`, `description`, `diagnosisInfo`, `status`, `repairFlag`, `repairId`, `productId`, `udi`, `nameCode`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `confirmUserId`, `confirmUserName`, `confirmTime`, `confirmRemark`, `confirmDeptCode`, `confirmDeptName`, `finishTime`, `updateTime`) +VALUES (1787801533814042624, 'S0185624335', '1002', '手术室', 'SUCCESS!!!!!!!!!!', NULL, 'wait_diagnosis', NULL, NULL, 700205494, NULL, '06902139333834', '金属骨针', 'GZZH04YB φ2.0×200mm', 'zxzxz111', '11111111111111111', '2024-05-01', '2024-05-30', '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-07 19:07:56'); + +INSERT ignore INTO `device_repair_apply_detail` (`applyId`, `deviceCode`, `deptCode`, `deptName`, `description`, `diagnosisInfo`, `status`, `repairFlag`, `repairId`, `productId`, `udi`, `nameCode`, `productName`, `ggxh`, `batchNo`, `serialNo`, `productionDate`, `expireDate`, `manufactory`, `measname`, `zczbhhzbapzbh`, `supId`, `supName`, `confirmUserId`, `confirmUserName`, `confirmTime`, `confirmRemark`, `confirmDeptCode`, `confirmDeptName`, `finishTime`, `updateTime`) +VALUES (1787801935535218688, 'S1216934642', '1002', '手术室', 'ZZZZZZZZZZZZZZZZZZZZZZZ', NULL, 'wait_diagnosis', NULL, NULL, 700205494, NULL, '06902139333834', '金属骨针', 'GZZH04YB φ2.0×200mm', NULL, NULL, NULL, NULL, '大博医疗科技股份有限公司', '枚', '国械注准20173461003,国械注准20173131003', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-05-07 19:09:32'); CREATE TABLE IF NOT EXISTS `thr_manufacturer` @@ -463,6 +474,44 @@ COLLATE=utf8mb4_0900_ai_ci COMMENT='第三方往来单位类型' ROW_FORMAT=Dynamic; + + + +CALL Pro_Temp_ColumnWork('device_check_item_dict', 'type', + ' tinyint NULL DEFAULT NULL COMMENT ''项目字典类型 1:巡检项目;2:保养项目''', + 1); +CALL Pro_Temp_ColumnWork('device_plan', 'type', + ' tinyint NULL DEFAULT NULL COMMENT ''计划类型 1:巡检计划; 2:保养计划''', + 1); + +CALL Pro_Temp_ColumnWork('device_plan_detail_item', 'type', + ' tinyint NULL DEFAULT NULL COMMENT ''项目类型 1:巡检项目; 2:保养项目''', + 1); + CALL Pro_Temp_ColumnWork('sync_data_set', 'produceBusiness', ' tinyint NULL DEFAULT NULL COMMENT ''生产企业信息''', 1); +CALL Pro_Temp_ColumnWork('device_repair_apply_detail', 'livePath', + 'varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''维修现场照片''', + 1); +CALL Pro_Temp_ColumnWork('device_repair', 'livePath', + 'varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''报修现场照片''', + 1); +CALL Pro_Temp_ColumnWork('device_repair', 'serviceLivePath', + 'varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''维修后现场照片''', + 1); +CALL Pro_Temp_ColumnWork('device_repair', 'diagnosisLivePath', + 'varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''诊断照片''', + 1); +CALL Pro_Temp_ColumnWork('device_repair_apply_detail', 'diagnosisLivePath', + 'varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''诊断照片''', + 1); +CALL Pro_Temp_ColumnWork('device_repair', 'repairUserId', 'bigint DEFAULT NULL COMMENT''报修人id''', 1); +CALL Pro_Temp_ColumnWork('device_repair', 'repairDescription', + ' varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT''维修内容''', + 1); +ALTER TABLE device_repair + MODIFY COLUMN `diagnosisInfo` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '诊断信息' AFTER `description`; +ALTER TABLE device_plan_detail_item + DROP PRIMARY KEY, + ADD PRIMARY KEY (`planId`, `productId`, `itemCode`, `deviceCode`) USING BTREE;