dataBack(String faultId) {
//根据故障ID查询监测点列表
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
index f678c01..71bedcb 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
@@ -10,7 +10,7 @@ import org.springframework.context.annotation.ComponentScan;
@EnableBladeFeign
@SpringCloudApplication
-@MapperScan("com.hnac.hzims.*.**.mapper.**")
+@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.*"})
public class MiddleApplication {
static {
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
index d36294b..e06411e 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
@@ -95,11 +95,11 @@ public class SysLogController {
* 根据Id获取日志数据
* @return
*/
+ @ApiOperation("根据Id获取日志数据")
+ @GetMapping("/get/{id}")
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = SysLog.class),
})
- @ApiOperation("根据Id获取日志数据")
- @GetMapping("/get/{id}")
public R getById(@PathVariable Long id) {
SysLog sysLog = sysLogService.getById(id);
return R.data(sysLog);
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
index 7a8a7e9..6dbcae6 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
@@ -1,5 +1,6 @@
package com.hnac.hzims.middle.systemlog.entity;
+import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -33,7 +34,7 @@ public class Statistics implements Serializable {
* 编号
*/
@ApiModelProperty("编号")
- @TableField("id")
+ @TableId("id")
private Long id;
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
index 5bb4897..d9e5131 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
@@ -1,5 +1,7 @@
package com.hnac.hzims.middle.systemlog.entity;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
@@ -36,7 +38,7 @@ public class SysLog implements Serializable {
/**
* 操作日志编号
*/
- @TableField("id")
+ @TableId(value = "id",type = IdType.ASSIGN_ID)
private Long id;
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
index f314b73..66c3c85 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
@@ -6,7 +6,9 @@ import com.hnac.hzims.middle.systemlog.entity.Statistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.middle.systemlog.vo.StatisticsResponseVo;
import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
+import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
/**
*
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
index a8c53e1..f8e11c7 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
@@ -5,6 +5,14 @@
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
index 98df167..9bce1df 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.middle.systemlog.vo.StatisticsTitleResponseVo;
import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
+import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
import java.util.List;
@@ -37,4 +39,12 @@ public interface SysLogMapper extends BaseMapper {
* @return
*/
IPage statisticsTitleByModuleName(Page moduleName, @Param("statisticsVo") StatisticsVo statisticsVo);
+
+
+ /**
+ * 根据Id获取日志数据
+ * @param id
+ * @return
+ */
+ SysLog getSysLogById(@Param("id") Long id);
}
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
index af48743..2ad6ef4 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
@@ -35,4 +35,38 @@
group by title;
+
+
+
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
index f61b2d8..1a02aa6 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
@@ -46,4 +46,7 @@ public interface SysLogService extends IService {
*/
IPage statisticsTitleByModuleName(Page statisticsTitleResponseVoPage,
StatisticsVo statisticsVo);
+
+
+
}
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
index 0df0a4c..e6c9baa 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
@@ -33,10 +33,6 @@ public class StatisticsServiceImpl extends ServiceImpl impleme
}
+
+
/**
* 日志查询接口
* @param sysLog
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java
new file mode 100644
index 0000000..af5b22a
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java
@@ -0,0 +1,10 @@
+package com.hnac.hzinfo.inspect.obj.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ContentDefinitionMapper extends BaseMapper {
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java
index d4cea63..4a7efdb 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java
@@ -101,4 +101,8 @@ public class ObjectEntity extends TenantEntity {
@TableField(exist = false)
@ApiModelProperty(value = "对象危险点详情list")
private List dangerSources;
+
+ @ApiModelProperty(value = "设备编号,按逗号分隔")
+ @QueryField(condition = SqlCondition.LIKE)
+ private String emCodes;
}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java
new file mode 100644
index 0000000..31e287e
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java
@@ -0,0 +1,36 @@
+package com.hnac.hzinfo.inspect.obj.feign;
+
+import com.hnac.hzinfo.inspect.obj.entity.ContentEntity;
+import com.hnac.hzinfo.inspect.obj.services.ContentService;
+import com.hnac.hzinfo.inspect.obj.vo.ContentVO;
+import com.hnac.hzinfo.inspect.obj.wrapper.ContentWrapper;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Optional;
+
+/**
+ * @ClassName ContentClient
+ * @description: 设备巡检内容 feign 接口实现类
+ * @author: hx
+ * @create: 2023-06-26 19:49
+ * @Version 4.0
+ **/
+@AllArgsConstructor
+@Slf4j
+@RestController
+public class ContentClient extends BladeController implements IContentClient {
+
+ private final ContentService contentService;
+
+ @Override
+ public R detail(Long id) {
+ ContentEntity entity = contentService.getById(id);
+ return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null));
+ }
+
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java
new file mode 100644
index 0000000..add8955
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java
@@ -0,0 +1,61 @@
+package com.hnac.hzinfo.inspect.obj.feign;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService;
+import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO;
+import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import oracle.jdbc.proxy.annotation.Post;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @ClassName ContentDefinitionClient
+ * @description: 巡检内容定义feign接口
+ * @author: hx
+ * @create: 2023-06-26 14:20
+ * @Version 4.0
+ **/
+@RestController
+@AllArgsConstructor
+@Slf4j
+public class ContentDefinitionClient implements IContentDefinitionClient {
+
+ private final IContentDefinitionService contentDefinitionService;
+
+ @Override
+ @GetMapping(DETAIL)
+ public R detail(@RequestParam Long id) {
+ ContentDefinitionEntity entity = contentDefinitionService.getById(id);
+ return R.data(Optional.ofNullable(entity).map(content -> ContentDefinitionWrapper.build().entityVO(content)).orElse(null));
+ }
+
+ @Override
+ @PostMapping(SAVE_BATCH)
+ public R saveBatch(@RequestBody List request) {
+ List list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class);
+ return R.data(contentDefinitionService.saveBatch(list));
+ }
+
+ @Override
+ @GetMapping(LIST)
+ public R> list(ContentDefinitionDTO request) {
+ return R.data(contentDefinitionService.list(request));
+ }
+
+ @Override
+ @PostMapping(SAVE_OR_UPDATE_BATCH)
+ public R saveOrUpdateBatch(List request) {
+ List list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class);
+ return R.data(contentDefinitionService.saveOrUpdateBatch(list));
+ }
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java
new file mode 100644
index 0000000..db7c303
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java
@@ -0,0 +1,35 @@
+package com.hnac.hzinfo.inspect.obj.feign;
+
+import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
+import com.hnac.hzinfo.inspect.obj.services.ProjectService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @ClassName ProjectClient
+ * @description:
+ * @author: hx
+ * @create: 2023-06-29 16:10
+ * @Version 4.0
+ **/
+@RestController
+@AllArgsConstructor
+@Slf4j
+public class ProjectClient extends BladeController implements IProjectClient {
+
+ private final ProjectService projectService;
+
+ @Override
+ @PostMapping(ADD_PROJECT_AND_CONTENT)
+ public R addProjectAndContent(@RequestBody @Valid List request) {
+ return R.data(projectService.addProjectAndContent(request));
+ }
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java
new file mode 100644
index 0000000..42e2b63
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java
@@ -0,0 +1,10 @@
+package com.hnac.hzinfo.inspect.obj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ContentDefinitionMapper extends BaseMapper {
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java
new file mode 100644
index 0000000..710d624
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java
@@ -0,0 +1,19 @@
+package com.hnac.hzinfo.inspect.obj.services;
+
+import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO;
+import org.springblade.core.mp.base.BaseService;
+
+import java.util.List;
+
+public interface IContentDefinitionService extends BaseService {
+
+ /**
+ * 根据筛选条件获取列表
+ * @param request 筛选条件
+ * @return
+ */
+ List list(ContentDefinitionDTO request);
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java
index e7aac45..75be494 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java
@@ -49,4 +49,11 @@ public interface ObjectService extends BaseService {
void previewQrCode(Long objectId);
List getReDbjectData(String tenantId);
+
+ /**
+ * 新增或修改巡检对象
+ * @param object
+ * @return
+ */
+ Boolean submit(ObjectEntity object);
}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
index 5c5bd7f..4dd7398 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
@@ -3,6 +3,7 @@ package com.hnac.hzinfo.inspect.obj.services;
import java.util.List;
+import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO;
import org.springblade.core.mp.base.BaseService;
@@ -14,4 +15,18 @@ import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
public interface ProjectService extends BaseService{
List getProjectData(String tenantId);
+
+ /**
+ * 获取巡检项目(目前筛选条件只支持emCode查询,想添加条件需自行在Entity内添加QueryField注解)
+ * @param req 筛选条件
+ * @return
+ */
+ ProjectEntity getOne(ProjectEntity req);
+
+ /**
+ * 新增设备巡检项目以及设备巡检内容以及两者之间的绑定关系
+ * @param request 设备巡检项目DTO
+ * @return
+ */
+ Boolean addProjectAndContent(List request);
}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java
new file mode 100644
index 0000000..1b5bdbd
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java
@@ -0,0 +1,46 @@
+package com.hnac.hzinfo.inspect.obj.services.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import com.hnac.hzinfo.inspect.obj.mapper.ContentDefinitionMapper;
+import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService;
+import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO;
+import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @ClassName ContentDefinitionServiceImpl
+ * @description: 巡检内容定义service类
+ * @author: hx
+ * @create: 2023-06-20 18:48
+ * @Version 4.0
+ **/
+
+@Service
+@AllArgsConstructor
+@Slf4j
+public class ContentDefinitionServiceImpl extends BaseServiceImpl
+ implements IContentDefinitionService {
+
+ @Override
+ public List list(ContentDefinitionDTO request) {
+ QueryWrapper queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(request, ContentDefinitionEntity.class));
+ LambdaQueryWrapper lambda = queryWrapper.lambda();
+ lambda.in(StringUtil.isNotBlank(request.getIds()),ContentDefinitionEntity::getId,Func.toLongList(",",request.getIds()));
+ return ContentDefinitionWrapper.build().listVO(this.list(lambda));
+ }
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
index 0f619d1..8a7e53b 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
@@ -4,30 +4,37 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.zxing.BarcodeFormat;
+import com.hnac.hzinfo.inspect.Constants;
+import com.hnac.hzinfo.inspect.obj.ObjectConstants;
import com.hnac.hzinfo.inspect.obj.entity.*;
import com.hnac.hzinfo.inspect.obj.services.*;
import com.hnac.hzinfo.inspect.obj.utils.CodeUtils;
import com.hnac.hzinfo.inspect.obj.vo.*;
+import com.hnac.hzinfo.inspect.plan.PlanContants;
import com.hnac.hzinfo.inspect.utils.HtmlModule;
import com.hnac.hzinfo.inspect.utils.HtmltoPdf;
import com.hnac.hzinfo.inspect.utils.ZxingGenCode;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
import java.io.File;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* @author h w
@@ -45,6 +52,10 @@ public class ObjectServiceImpl extends BaseServiceImpl {
+ throw new ServiceException("保存巡检对象失败!");
+ });
+ objectDangerService.remove(Wrappers.lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId()));
+ List objectDangers = object.getObjectDangers();
+ if(CollectionUtil.isNotEmpty(objectDangers)){
+ objectDangers.stream().forEach(e -> {
+ e.setObjectId(object.getId());
+ });
+ objectDangerService.saveBatch(objectDangers);
+ }
+ this.generateTemplate(object);
+ return true;
+ }
+
+ /**
+ * 根据巡检对象生成一条同名巡检模板
+ * @param object 巡检对象
+ */
+ private void generateTemplate(ObjectEntity object) {
+ // 若巡检对象设备编码存在,则生成巡检模板
+ if(Func.isNotEmpty(object.getEmCodes())) {
+ TemplateEntity template = new TemplateEntity();
+ template.setCode(String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond()));
+ template.setName(object.getName());
+ template.setDuplicateRecord(ObjectConstants.TemplateRecordEnum.ALLOW.getRecordType());
+ template.setSupportAutoVideo(Constants.InspectTypeEnum.COMMON.getVal());
+ template.setStatus(ObjectConstants.TemplateEnableEnum.YES.getEnableType());
+ Assert.isTrue(templateService.save(template),() -> {
+ throw new ServiceException("保存巡检模板失败!");
+ });
+ // 保存巡检对象与巡检模板的绑定关系
+ ObjectTemplateEntity banding = ObjectTemplateEntity.builder()
+ .templateId(template.getId()).objectId(object.getId()).code(template.getCode())
+ .name(template.getName()).supportAutoVideo(object.getSupportAutoVideo()).build();
+ objectTemplateService.save(banding);
+ // 保存巡检模板与巡检项目的绑定关系
+ List emCodeList = Func.toStrList(",", object.getEmCodes());
+ Function getTemplateProjectByEmCode = index -> {
+ ProjectEntity project = new ProjectEntity();
+ project.setEmCode(emCodeList.get(index));
+ project.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType());
+ ProjectEntity one = projectService.getOne(project);
+ return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).sort(index).build();
+ };
+ List templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size())
+ .map(getTemplateProjectByEmCode).collect(Collectors.toList());
+ templateProjectService.saveBatch(templateProjectList);
+ }
+ }
/**
* 导出巡检对象为 PDF
* @return pdf 文件路径
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
index 6d35c9a..a2d541a 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
@@ -1,23 +1,45 @@
package com.hnac.hzinfo.inspect.obj.services.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hnac.hzinfo.inspect.obj.ObjectConstants;
+import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
+import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO;
+import com.hnac.hzinfo.inspect.obj.entity.ContentEntity;
+import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper;
+import com.hnac.hzinfo.inspect.obj.services.ContentService;
+import com.hnac.hzinfo.inspect.obj.services.ProjectContentService;
import com.hnac.hzinfo.inspect.obj.services.ProjectService;
+import com.hnac.hzinfo.inspect.obj.utils.CodeUtils;
import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO;
+import com.hnac.hzinfo.inspect.utils.Condition;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+import java.util.Collection;
import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* 巡检项目service
*/
@Service
+@AllArgsConstructor
+@Slf4j
public class ProjectServiceImpl extends BaseServiceImpl implements ProjectService {
+ private final ContentService contentService;
+
@Override
public boolean save(ProjectEntity entity) {
if (ObjectUtil.isNotEmpty(entity)) {
@@ -35,4 +57,41 @@ public class ProjectServiceImpl extends BaseServiceImpl getProjectData(String tenantId) {
return this.baseMapper.getProjectData(tenantId);
}
+
+ @Override
+ public ProjectEntity getOne(ProjectEntity req) {
+ LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(req).lambda();
+ queryWrapper.eq(Func.isNotEmpty(req.getStatus()),ProjectEntity::getStatus,req.getStatus());
+ List list = this.list(queryWrapper);
+ Assert.isTrue(CollectionUtil.isNotEmpty(list) && list.size() == 1,() -> {
+ throw new ServiceException("getOne方法查询唯一设备巡检项目,index为:" + list.size());
+ });
+ return list.get(0);
+ }
+
+ @Override
+ public Boolean addProjectAndContent(List request) {
+ ProjectContentServiceImpl projectContentService = SpringUtil.getBean(ProjectContentServiceImpl.class);
+ request.forEach(projectDTO -> {
+ projectDTO.setCode(CodeUtils.randomCode());
+ projectDTO.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType());
+ ProjectEntity project = BeanUtil.copy(projectDTO, ProjectEntity.class);
+ if(this.save(project)) {
+ // 保存巡检内容以及添加绑定关系
+ if(CollectionUtil.isNotEmpty(projectDTO.getContentDTOList())) {
+ List contentDTOList = projectDTO.getContentDTOList();
+ contentDTOList.forEach(contentDTO -> contentDTO.setCode(CodeUtils.randomCode()));
+ List contentEntityList = JSONArray.parseArray(JSON.toJSONString(contentDTOList),ContentEntity.class);
+ if(contentService.saveBatch(contentEntityList)) {
+ // 保存巡检内容以及巡检项目的绑定关系
+ List projectContentList = Stream.iterate(0, n -> n + 1).limit(contentEntityList.size()).map(
+ index -> ProjectContentEntity.builder().projectId(project.getId()).contentId(contentEntityList.get(index).getId()).sort(index).build()
+ ).collect(Collectors.toList());
+ projectContentService.saveBatch(projectContentList);
+ }
+ }
+ }
+ });
+ return true;
+ }
}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java
new file mode 100644
index 0000000..fc28f45
--- /dev/null
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java
@@ -0,0 +1,51 @@
+package com.hnac.hzinfo.inspect.obj.web;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO;
+import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity;
+import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService;
+import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO;
+import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @ClassName ContentDefinitionController
+ * @description: 巡检内容定义controller
+ * @author: hx
+ * @create: 2023-06-20 19:13
+ * @Version 4.0
+ **/
+@RestController
+@RequestMapping("/content/definition")
+@Api(value = "巡检内容定义管理",tags = "巡检内容定义管理")
+@AllArgsConstructor
+public class ContentDefinitionController extends BladeController {
+
+ private final IContentDefinitionService contentDefinitionService;
+
+ @GetMapping("/page")
+ @ApiOperation("分页查询")
+ @ApiOperationSupport(order = 1)
+ public R> page(ContentDefinitionDTO content, Query query) {
+ QueryWrapper queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(content, ContentDefinitionEntity.class));
+ queryWrapper.lambda().eq(Func.isEmpty(content.getCreateDept()),ContentDefinitionEntity::getCreateDept,content.getCreateDept())
+ .eq(Func.isEmpty(content.getCreateUser()),ContentDefinitionEntity::getCreateUser,content.getCreateUser());
+ IPage page = contentDefinitionService.page(Condition.getPage(query), queryWrapper);
+ page.setRecords(ContentDefinitionWrapper.build().listVO(page.getRecords()));
+ return R.data(page);
+ }
+
+}
diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java
index 32bdf09..4a59031 100644
--- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java
+++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java
@@ -145,22 +145,7 @@ public class ObjectController extends BladeController {
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增或修改", notes = "传入object")
public R submit(@Valid @RequestBody ObjectEntity object) {
- if(object.getId()==null && Func.isBlank(object.getCode())){
- object.setCode(CodeUtils.randomCode());
- }
- if(object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().size() == 0)){
- throw new ServiceException("对象告警list为空");
- }
- objectService.saveOrUpdate(object);
- objectDangerService.remove(Wrappers.lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId()));
- List objectDangers = object.getObjectDangers();
- if(CollectionUtil.isNotEmpty(objectDangers)){
- objectDangers.stream().forEach(e -> {
- e.setObjectId(object.getId());
- });
- objectDangerService.saveBatch(objectDangers);
- }
- return R.success("操作成功!");
+ return R.data(objectService.submit(object));
}
@PostMapping("/saveBatch")
diff --git a/hzims-service/inspect/src/main/resources/db/1.0.1.sql b/hzims-service/inspect/src/main/resources/db/1.0.1.sql
new file mode 100644
index 0000000..729823c
--- /dev/null
+++ b/hzims-service/inspect/src/main/resources/db/1.0.1.sql
@@ -0,0 +1,58 @@
+-- 创建巡检内容定义表结构
+CREATE TABLE IF NOT EXISTS `hz_st_re_content_definition` (
+ `ID` bigint(64) NOT NULL COMMENT 'ID',
+ `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码:由系统自动生成自动生成',
+ `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称',
+ `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述',
+ `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型 0不记录 1仅选择 2仅记值 3选择并记值',
+ `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型 原来数据字典 暂时设计只支持99个类型',
+ `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
+ `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
+ `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
+ `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态',
+ `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户',
+ `CLOCK_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针识别,表盘ID',
+ `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID',
+ `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值',
+ `UP_LIMIT` double NULL DEFAULT NULL COMMENT '上限值',
+ `DOWN_LIMIT` double NULL DEFAULT NULL COMMENT '下限值',
+ `SUGGESTION` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题排除建议',
+ `SORT` int(11) NULL DEFAULT 0 COMMENT '排序',
+ `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是支持的巡检类型 0普通巡检 1视频自动巡检 2机器人巡检',
+ `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类 子类的子类通过-隔开例如:1-12',
+ `CAMERA_ADDR` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如:2 1 表示第三行第二列 行列均从0开始记录 默认 0 0 如果有多张图则:0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0',
+ `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数',
+ `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '校验值 用来判断当前值是否正确:枚举数据通过 “ ”隔开 区间通过~隔开',
+ PRIMARY KEY (`ID`) USING BTREE,
+ UNIQUE INDEX `UK_OBJECT_CONTENT_CODE`(`CODE`) USING BTREE,
+ INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象内容' ROW_FORMAT = Dynamic;
+SET FOREIGN_KEY_CHECKS = 1;
+
+-- 巡检内容定义添加物模型标识字段
+alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识';
+-- 巡检内容定义添加物模型属性标识字段
+alter table hz_st_re_content add COLUMN `attr_signage` VARCHAR(50) comment '属性标识';
+-- 巡检内容定义添加物模型属性名称字段
+alter table hz_st_re_content add COLUMN `attr_name` VARCHAR(64) comment '属性名称';
+
+-- 设备巡检内容添加物模型标识字段
+alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识';
+-- 设备巡检内容添加物模型属性标识字段
+alter table hz_st_re_content add COLUMN `attr_signage` VARCHAR(50) comment '属性标识';
+-- 设备巡检内容添加物模型属性名称字段
+alter table hz_st_re_content add COLUMN `attr_name` VARCHAR(64) comment '属性名称';
+-- 设备巡检内容添加采集点ID字段
+alter table hz_st_re_content add COLUMN `fac_device_id` VARCHAR(64) comment '关联的hz3000设备id';
+-- 设备巡检内容添加采集点名称字段
+alter table hz_st_re_content add COLUMN `fac_device_name` VARCHAR(64) comment '关联的hz3000设备名称';
+
+-- 设备巡检项目添加设备编号字段
+alter table hz_st_re_project add COLUMN `em_code` VARCHAR(50) comment '设备编号';
+
+-- 设备巡检对象添加设备字段
+alter table hz_st_re_object add COLUMN `em_codes` VARCHAR(255) comment '设备编号,按逗号分隔';
+
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
index 7ec8515..5382e24 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
@@ -1,7 +1,6 @@
package com.hnac.hzims.operational.duty.controller;
import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.util.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
@@ -32,7 +31,6 @@ import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -220,10 +218,21 @@ public class ImsDutyMainController extends BladeController {
@GetMapping("/exportDuty")
@ApiOperation(value = "导出排班计划")
- public void exportTemplate(HttpServletResponse response, Integer year, Integer month, Long deptId) throws IOException {
+ public void exportTemplate(HttpServletResponse response, String time, Long deptId) throws IOException {
+ Integer year;
+ Integer month;
if (Func.isEmpty(deptId)) {
deptId = Long.valueOf(AuthUtil.getDeptId());
}
+ if (Func.isEmpty(time)) {
+ Date date = new Date();
+ year = date.getYear();
+ month = date.getMonth()+1;
+ }else {
+ String[] split = time.split("-");
+ year=Integer.valueOf(split[0]);
+ month=Integer.valueOf(split[1]);
+ }
List list = imsDutyMainService.getExcelDutyData(year, month, deptId);
String deptName = sysClient.getDeptName(deptId).getData();
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java
index eede11e..0f6a0d0 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java
@@ -91,12 +91,13 @@ public class StationAttributeController extends BladeController {
return R.status(stationAttributeService.deleteLogic(Func.toLongList(ids)));
}
- @PutMapping("/bandingMonitor")
+ @GetMapping("/bandingMonitor")
@ApiOperation("根据设备编码更新集中监控监测点绑定")
@ApiOperationSupport(order = 4)
- public R> bandingMonitor(@ApiParam(value = "设备编码",required = true) String emCode,
+ public R> bandingMonitor(@ApiParam(value = "站点编码",required = true) String stationCode,
+ @ApiParam(value = "设备编码",required = true) String emCode,
@ApiParam(value = "站点类型",required = true) String stationType,
- @ApiParam(value = "设备类型",required = true) String emType) {
- return R.data(stationAttributeService.bandingMonitor(emCode,stationType,emType));
+ @ApiParam(value = "机组类型",required = true) String setType) {
+ return R.data(stationAttributeService.bandingMonitor(stationCode,emCode,stationType,setType));
}
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java
index d3ecdb8..9f0bdff 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java
@@ -45,5 +45,5 @@ public interface IStationAttributeService extends BaseService bandingMonitor(String emCode,String stationType,String emType);
+ List bandingMonitor(String stationCode,String emCode,String stationType,String setType);
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
index e9dd316..5b6f614 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
@@ -39,6 +39,7 @@ import org.springframework.util.Assert;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* @author hx
@@ -209,13 +210,14 @@ public class StationAttributeServiceImpl extends BaseServiceImpl bandingMonitor(String emCode,String stationType,String emType) {
+ public List bandingMonitor(String stationCode,String emCode,String stationType,String setType) {
List result;
// 获取集中监控属性配置
List attributes = attributeService.list(Wrappers.lambdaQuery()
.eq(FocusAttributeEntity::getDomainId, stationType)
- .eq(FocusAttributeEntity::getGroupId, emType)
+ .eq(FocusAttributeEntity::getGroupId, setType)
.eq(FocusAttributeEntity::getStatus, 0)
+ .orderByAsc(FocusAttributeEntity::getSort)
);
// 标识
List signages = attributes.stream().map(FocusAttributeEntity::getSignage).filter(Func::isNotEmpty).collect(Collectors.toList());
@@ -225,19 +227,65 @@ public class StationAttributeServiceImpl extends BaseServiceImpl> deviceChildrenListResult = deviceClient.getRealId(deviceChildrenDTO);
- boolean facAttrFlag = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData());
- // 根据集中监控属性配置获取站点集中监控属性配置
- Function convert = focusAttr -> {
- StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class);
- if(facAttrFlag) {
- List data = deviceChildrenListResult.getData();
- Optional facAttrOptional = data.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny();
- vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null));
- vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getName).orElse(null));
- }
- return vo;
- };
- result = attributes.stream().map(convert).collect(Collectors.toList());
+ List modelAttr = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData())
+ ? deviceChildrenListResult.getData() : new ArrayList<>();
+ // 获取
+ LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery()
+ .eq(StationAttributeEntity::getStationId, stationCode)
+ .eq(StationAttributeEntity::getEmCode, emCode);
+ List stationAttrList = this.list(queryWrapper);
+ result = attributes.stream().map(focusAttr -> this.fillFacAttr(modelAttr,focusAttr,stationCode,emCode))
+ .map(stationAttr -> this.fillAttrId(stationAttrList,stationAttr))
+ .sorted(Comparator.comparing(StationAttributeVo::getSort,Comparator.nullsLast(Integer::compareTo)))
+ .collect(Collectors.toList());
+ // 排序完成之后循环赋值
+ Stream.iterate(1,n -> n+1).limit(result.size()).forEach(index -> result.get(index-1).setSort(index));
return result;
}
+
+ /**
+ * 根据请求设备实例物模型属性填充集中监控属性配置采集点
+ * @param modelAttr 设备实例物模型属性
+ * @param focusAttr 集中监控属性配置
+ * @return
+ */
+ private StationAttributeVo fillFacAttr(List modelAttr,FocusAttributeEntity focusAttr,String stationCode,String emCode) {
+ StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class);
+ Optional facAttrOptional = modelAttr.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny();
+ vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null));
+ vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getFacName).orElse(null));
+ vo.setStationId(stationCode);
+ vo.setEmCode(emCode);
+ vo.setEnableShow(true);
+ vo.setId(null);
+ vo.setCreateUser(null);
+ vo.setCreateDept(null);
+ vo.setCreateTime(null);
+ vo.setUpdateTime(null);
+ vo.setUpdateUser(null);
+ return vo;
+ }
+
+ /**
+ * 填充属性ID
+ * @param stationAttrList 已保存进数据库的记录
+ * @param stationAttr 填充采集点后的属性模板
+ * @return
+ */
+ private StationAttributeVo fillAttrId(List stationAttrList,StationAttributeVo stationAttr) {
+ if(CollectionUtil.isNotEmpty(stationAttrList)) {
+ Optional attribute = stationAttrList.stream().filter(sa -> stationAttr.getAttributes().equals(sa.getAttributes())).findAny();
+ if(attribute.isPresent()) {
+ StationAttributeVo result = BeanUtil.copy(attribute.get(),StationAttributeVo.class);
+ result.setSignage(stationAttr.getSignage());
+ result.setSignageName(stationAttr.getSignageName());
+ result.setMonitorId(stationAttr.getMonitorId());
+ result.setMonitorName(stationAttr.getMonitorName());
+ result.setUpdateUser(null);
+ result.setUpdateTime(null);
+ return result;
+ }
+ }
+ return stationAttr;
+ }
}
diff --git a/hzims-service/operational/src/main/resources/db/1.0.1.sql b/hzims-service/operational/src/main/resources/db/1.0.1.sql
new file mode 100644
index 0000000..6204f7b
--- /dev/null
+++ b/hzims-service/operational/src/main/resources/db/1.0.1.sql
@@ -0,0 +1,2 @@
+-- 站点表添加是否为国外
+alter table `hzims_station` add column `is_abroad` TINYINT NULL comment '站点是否为国外 1:是;0:否';
\ No newline at end of file