diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java index 94139ed..18f48a0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java @@ -4,14 +4,16 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.logs.annotation.OperationAnnotation; -import com.hnac.hzims.common.logs.enums.BusinessType; -import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.ai.dto.robot.RobotInstanceDTO; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotAiReturnData; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotRealDataVO; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotServerTaskParam; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; +import com.hnac.hzinfo.log.annotation.Business; +import com.hnac.hzinfo.log.annotation.Operate; +import com.hnac.hzinfo.log.contants.BusinessType; +import com.hnac.hzinfo.log.contants.Risk; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.vo.VirtualDeviceDTO; import io.swagger.annotations.*; @@ -47,6 +49,7 @@ import java.util.Map; @AllArgsConstructor @RequestMapping("/st_robot") @Api(value = "巡检机器人信息", tags = "巡检机器人信息") +@Business(module = Constants.APP_NAME,value = "机器人信息管理",ignore = false) public class RobotController extends BladeController { private final IRobotService st_robotService; @@ -59,6 +62,7 @@ public class RobotController extends BladeController { @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入st_robot") + @Operate(label = "查看机器人详情",type = BusinessType.QUERY,ignore = false) public R detail(RobotEntity st_robot) { RobotEntity detail = st_robotService.getOne(Condition.getQueryWrapper(st_robot)); return R.data(detail); @@ -72,10 +76,7 @@ public class RobotController extends BladeController { @ApiOperation(value = "分页", notes = "传入st_robot") @ApiImplicitParams({ }) - @OperationAnnotation(moduleName = "巡检管理", title = "机器人管理", - operatorType = OperatorType.MOBILE, - businessType = BusinessType.GENCODE, - action = "分页查询机器人管理列表") + @Operate(label = "查看机器人分页列表",type = BusinessType.QUERY,ignore = false) public R> list(@ApiIgnore @RequestParam Map st_robot, Query query) { QueryWrapper queryWrapper = Condition.getQueryWrapper( st_robot, RobotEntity.class); IPage pages = st_robotService.page(Condition.getPage(query), queryWrapper); @@ -88,6 +89,7 @@ public class RobotController extends BladeController { @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入st_robot") + @Operate(label = "新增机器人信息",type = BusinessType.INSERT,risk = Risk.LOW,ignore = false) public R save(@Valid @RequestBody RobotEntity st_robot) { st_robot.setCode("robot"+CodeUtils.randomCode()); return R.status(st_robotService.save(st_robot)); @@ -99,6 +101,7 @@ public class RobotController extends BladeController { @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入st_robot") + @Operate(label = "修改机器人信息",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) public R update(@Valid @RequestBody RobotEntity st_robot) { return R.status(st_robotService.updateById(st_robot)); } @@ -120,6 +123,7 @@ public class RobotController extends BladeController { @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") + @Operate(label = "删除机器人信息",type = BusinessType.DELETE,risk = Risk.MEDIUM,ignore = false) public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(st_robotService.removeByIds(Func.toLongList(ids))); } @@ -144,6 +148,7 @@ public class RobotController extends BladeController { @PostMapping("/generateDeviceInstance") @ApiOperationSupport(order = 10) @ApiOperation(value = "生成机器人设备实例", notes = "生成机器人设备实例") + @Operate(label = "生成机器人设备实例",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) public R generateDeviceInstance(@RequestBody @Validated RobotInstanceDTO device) { return R.status(st_robotService.generateDeviceInstance(device)); } @@ -151,6 +156,7 @@ public class RobotController extends BladeController { @GetMapping("/getRealDataByRobotCode") @ApiOperationSupport(order = 11) @ApiOperation(value = "获取机器人各项属性实时数据", notes = "获取机器人各项属性实时数据") + @Operate(label = "获取机器人实时数据",type = BusinessType.QUERY,ignore = false) public R> getRealDataByRobotCode(@RequestParam @ApiParam(value = "机器人编号", required = true) String robotCode) { return R.data(st_robotService.getRealDataByRobotCode(robotCode)); } @@ -158,6 +164,7 @@ public class RobotController extends BladeController { @GetMapping("/getRobotSoeData") @ApiOperationSupport(order = 12) @ApiOperation(value = "获取机器人告警", notes = "获取机器人告警") + @Operate(label = "获取机器人告警信息",type = BusinessType.QUERY,ignore = false) public R getRobotSoeData(@RequestParam @ApiParam("机器人编号") String robotCode, @RequestParam @ApiParam("开始时间") String startTime, @RequestParam @ApiParam("结束时间") String endTime, Query query) { diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java index 647c8de..141abef 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java @@ -10,11 +10,15 @@ import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.device.IDeviceClient; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; +import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.ai.dto.robot.RobotInstanceDTO; import com.hnac.hzinfo.inspect.ai.vo.RobotVO; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotRealDataVO; import com.hnac.hzinfo.inspect.ai.wrapper.RobotWrapper; import com.hnac.hzinfo.inspect.constants.ParamConstants; +import com.hnac.hzinfo.log.annotation.Business; +import com.hnac.hzinfo.log.annotation.Operate; +import com.hnac.hzinfo.log.contants.BusinessType; import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; @@ -102,6 +106,12 @@ public class RobotServiceImpl extends BaseServiceImpl @Override public List getRealDataByRobotCode(String robotCode) { + R> paramDeviceAttrR = deviceClient.getOnlineAttr(robotCode); + Assert.isTrue(paramDeviceAttrR.isSuccess(), () -> { + throw new ServiceException("获取设备实例属性失败!"); + }); + + DeviceRealDataPO po = new DeviceRealDataPO(); po.setDeviceCode(robotCode); Result>>> realDataResult = deviceDataClient.getDeviceRealDataByCodes(Lists.newArrayList(po)); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java index 00ca26a..ed47022 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/plan/controller/PlanController.java @@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; -import com.hnac.hzims.common.logs.enums.BusinessType; -import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; import com.hnac.hzinfo.inspect.plan.service.IPlanObjectTemplateService; @@ -13,6 +12,10 @@ import com.hnac.hzinfo.inspect.plan.service.IPlanService; import com.hnac.hzinfo.inspect.plan.vo.PlanListQueryVO; import com.hnac.hzinfo.inspect.plan.vo.PlanVO; import com.hnac.hzinfo.inspect.utils.Condition; +import com.hnac.hzinfo.log.annotation.Business; +import com.hnac.hzinfo.log.annotation.Operate; +import com.hnac.hzinfo.log.contants.BusinessType; +import com.hnac.hzinfo.log.contants.Risk; import io.swagger.annotations.*; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; @@ -40,6 +43,7 @@ import java.util.List; @RequestMapping("/plan") @Validated @Api(value = "巡检计划", tags = "巡检计划") +@Business(module = Constants.APP_NAME,value = "巡检计划管理",ignore = false) public class PlanController extends BladeController { private final IPlanService planService; @@ -51,6 +55,7 @@ public class PlanController extends BladeController { @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "查看", notes = "传入planId") + @Operate(label = "查看巡检计划详情",type = BusinessType.QUERY,ignore = false) public R detail(Long id) { PlanVO detail = planService.detail(id); return R.data(detail); @@ -62,9 +67,7 @@ public class PlanController extends BladeController { @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页显示计划列表", notes = "传入plan") - @OperationAnnotation(moduleName = "巡检管理",title = "巡检计划",operatorType = OperatorType.MOBILE,businessType = - BusinessType.GENCODE, - action = "分页显示显示计划列表") + @Operate(label = "巡检计划列表分页查询",type = BusinessType.QUERY,ignore = false) public R> list(PlanListQueryVO plan, Query query, BladeUser bladeUser) { LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new PlanEntity(),plan); if(plan.getStartTime()!=null){ @@ -90,6 +93,7 @@ public class PlanController extends BladeController { @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入plan") + @Operate(label = "新增/修改巡检计划",type = BusinessType.INSERT, risk = Risk.LOW,ignore = false) public R submit(@Valid @RequestBody PlanVO plan) { return R.status(planService.submit(plan)); } @@ -100,6 +104,7 @@ public class PlanController extends BladeController { @PostMapping("/addAndChecked") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入plan") + @Operate(label = "审核巡检计划",type = BusinessType.UPDATE, risk = Risk.LOW,ignore = false) public R> addAndChecked(@Valid @RequestBody PlanVO plan) { return R.data(planService.addAndChecked(plan)); } @@ -109,6 +114,7 @@ public class PlanController extends BladeController { @GetMapping("/revoke") @ApiOperationSupport(order = 6) @ApiOperation(value = "撤销", notes = "传入plan") + @Operate(label = "撤销巡检计划",type = BusinessType.UPDATE, risk = Risk.LOW,ignore = false) public R revoke(@RequestParam Long planId) { return R.data(planService.revoke(planId)); } @@ -119,6 +125,7 @@ public class PlanController extends BladeController { @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除,不删除关联信息", notes = "传入ids") + @Operate(label = "删除巡检计划",type = BusinessType.DELETE, risk = Risk.MEDIUM,ignore = false) public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(planService.deleteLogic(Func.toLongList(ids))); } @@ -143,6 +150,7 @@ public class PlanController extends BladeController { @ApiImplicitParam(name="id",value="计划id"), @ApiImplicitParam(name="status",value="0:待审核-->1:已审核-->2:派发中-->3:暂停-->4:结束-->5审核不通过-->6待提交") }) + @Operate(label = "变更巡检计划状态",type = BusinessType.UPDATE, risk = Risk.LOW) public R modifyPlanStatus(@RequestParam(value = "id") @ApiParam(value = "主键ID",required = true) Long id, @RequestParam Integer status) { return R.status(planService.modifyPlanStatus(id, status)); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java index 29e00ea..816cfee 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/aspect/TaskGenerateAspect.java @@ -119,6 +119,7 @@ public class TaskGenerateAspect { .setPlanTime(taskEntity.getPlanStartTime()) .setContent("您在"+ DateUtil.format(taskEntity.getPlanStartTime(),DateUtil.PATTERN_DATETIME) +"时间有一条巡检任务——【"+taskEntity.getPlanName()+"】待执行,请及时处理!"); // 任务开始提醒 - 集中提送 + log.info("开始消息推送,推送内容为:{}",JSON.toJSONString(recordDto)); messageClient.planSendMessage(recordDto); // 任务结束提醒 - 提醒存入redis 定时任务调用即时推送完成消息推送 redisTemplate.opsForZSet().add(redisKeyConfig.getTaskEndRemind(),taskEntity,taskEntity.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); diff --git a/pom.xml b/pom.xml index a7e275d..182b612 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade BladeX - 5.0.0.RELEASE + 5.1.1.RELEASE.fix.1 com.hnac.hzims @@ -43,7 +43,8 @@ org.springblade blade-common - ${bladex.project.version} + + 5.1.1.RELEASE.fix.1 org.springblade