15928045575 2 лет назад
Родитель
Сommit
8553eb8c52

+ 15 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/DictItemEnum.java

@@ -1,5 +1,7 @@
 package com.sckw.core.model.enums;
 package com.sckw.core.model.enums;
 
 
+import java.util.Objects;
+
 /**
 /**
  * @author lfdc
  * @author lfdc
  * @description 字段检测要素枚举
  * @description 字段检测要素枚举
@@ -11,6 +13,7 @@ public enum DictItemEnum {
     LONGITUDE_X("longitude", "lng", "经度(X偏移)"),
     LONGITUDE_X("longitude", "lng", "经度(X偏移)"),
     LATITUDE_Y("latitude", "lat", "纬度(Y偏移)"),
     LATITUDE_Y("latitude", "lat", "纬度(Y偏移)"),
     ALTITUDE_Z("altitude", "alt", "海拔(z偏移)"),
     ALTITUDE_Z("altitude", "alt", "海拔(z偏移)"),
+    ALTITUDE_NULL("ISNULL", "ISNULL", "ISNULL"),
     ;
     ;
     private final String codeType;
     private final String codeType;
     private final String value;
     private final String value;
@@ -33,4 +36,16 @@ public enum DictItemEnum {
     public String getName() {
     public String getName() {
         return name;
         return name;
     }
     }
+
+    public static DictItemEnum getData(String value) {
+        for (DictItemEnum entry : values()) {
+            if(!Objects.isNull(entry.getValue())){
+                if (entry.getValue().equals(value)) {
+                    return entry;
+                }
+            }
+
+        }
+        return DictItemEnum.ALTITUDE_NULL;
+    }
 }
 }

+ 2 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -196,4 +196,6 @@ public class HttpStatus {
     public static final String PL34 = "3PL和4PL不能同时注册!";
     public static final String PL34 = "3PL和4PL不能同时注册!";
     public static final String DEVICE_SN_EXISTS = "设备SN已存在,不可重复!";
     public static final String DEVICE_SN_EXISTS = "设备SN已存在,不可重复!";
 
 
+    public static final String INTEGRATION_EXISTS = "集成要素名称已存在,不可重复!";
+
 }
 }

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/backTrackController.java

@@ -7,6 +7,7 @@ import com.sckw.core.web.response.HttpResult;
 
 
 import com.sckw.slope.detection.model.param.DeviceQuery;
 import com.sckw.slope.detection.model.param.DeviceQuery;
 import com.sckw.slope.detection.model.param.IntegrationQuery;
 import com.sckw.slope.detection.model.param.IntegrationQuery;
+import com.sckw.slope.detection.model.vo.IntegrationVo;
 import com.sckw.slope.detection.service.BackTrackService;
 import com.sckw.slope.detection.service.BackTrackService;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.validation.Valid;
 import jakarta.validation.Valid;
@@ -64,6 +65,22 @@ public class backTrackController {
         return HttpResult.ok(backTrackService.getIntegrationList(integrationQuery, request));
         return HttpResult.ok(backTrackService.getIntegrationList(integrationQuery, request));
     }
     }
 
 
+    @Log(description = "集成分析详情")
+    //@RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "集成分析详情", value = "/getIntegrationDetail", method = RequestMethod.GET)
+    public HttpResult getIntegrationDetail(@RequestParam("integrationId") String integrationId) {
+        log.info("集成分析详情 getIntegrationDetail param :{},",integrationId);
+        return backTrackService.getIntegrationDetail(integrationId);
+    }
+
+    @Log(description = "新增集成分析")
+    //@RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "新增集成分析", value = "/integrationAdd", method = RequestMethod.POST)
+    public HttpResult integrationAdd(@Valid @RequestBody IntegrationVo Vo, HttpServletRequest request) {
+        log.info("新增集成分析 integrationAdd param:{}", JSONObject.toJSONString(Vo));
+        return HttpResult.ok(backTrackService.integrationAdd(Vo, request));
+    }
+
 
 
 
 
 }
 }

+ 7 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/IntegrationVo.java

@@ -6,8 +6,10 @@ import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author lfdc
  * @author lfdc
@@ -33,6 +35,11 @@ public class IntegrationVo implements Serializable {
      */
      */
     private String partNames;
     private String partNames;
 
 
+    /**
+     * 要素名称字符串,真实名
+     */
+    private List<Object> partTrueNames;
+
     /**
     /**
      * 单位(字典value)
      * 单位(字典value)
      */
      */

+ 57 - 3
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/BackTrackService.java

@@ -191,14 +191,68 @@ public class BackTrackService {
         if (CollectionUtils.isEmpty(list)) {
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
             return PageRes.build(pageInfo, list);
         }
         }
+        for(IntegrationVo vo : list){
+            List<Object> stringList = new ArrayList<>();
 
 
-        return PageRes.build(pageInfo, list);
-    }
-
+            String[] partNames = vo.getPartNames().split(",");
+            for(int i=0;i<partNames.length;i++){
+                Map<String,Object> strArray = new HashMap<>();
+                if(DictItemEnum.getData(partNames[i]).getName().equals("ISNULL")){
+                    strArray.put("name",partNames[i]);
+                }else{
+                    strArray.put("name",DictItemEnum.getData(partNames[i]).getName());
+                }
 
 
+                stringList.add(strArray);
+            }
 
 
+            vo.setPartTrueNames(stringList);
+        }
 
 
 
 
+        return PageRes.build(pageInfo, list);
+    }
 
 
+    public HttpResult getIntegrationDetail(String integrationId) {
+        KwsIntegration integration = integrationMapper.selectOne(new LambdaQueryWrapper<KwsIntegration>()
+                .eq(KwsIntegration::getId, integrationId)
+                .eq(KwsIntegration::getDelFlag, 0)
+        );
+        return HttpResult.ok(integration);
+    }
 
 
+    /**
+     * 新增设备
+     *
+     * @param vo 请求参数
+     * @param request   http流
+     * @return 返回值
+     */
+    @Transactional
+    public HttpResult integrationAdd(IntegrationVo vo, HttpServletRequest request) {
+        KwsIntegration has = integrationMapper.selectOne(new LambdaQueryWrapper<KwsIntegration>()
+                .eq(KwsIntegration::getIntegrationName, vo.getIntegrationName())
+                .eq(KwsIntegration::getDelFlag, 0)
+        );
+        if (!Objects.isNull(has)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.INTEGRATION_EXISTS);
+        }
+        HeaderData headerData = commonService.getHeaderData(request);
+        KwsIntegration integration = new KwsIntegration();
+        BeanUtils.copyProperties(vo, integration);
+        Date now = new Date();
+        long id = new IdWorker(NumberConstant.ONE).nextId();
+        integration.setId(id);
+        integration.setCreateBy(Long.parseLong(headerData.getCreateBy()));
+        integration.setCreateTime(now);
+        byte b = (byte) NumberConstant.ONE;
+        byte zero = (byte) NumberConstant.ZERO;
+        integration.setStatus(b);
+        integration.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
+        integration.setUpdateTime(now);
+        integration.setDelFlag(zero);
+        integration.setMountainId(headerData.getCompanyId());
+        integrationMapper.insert(integration);
+        return HttpResult.ok();
+    }
 }
 }

+ 2 - 2
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml

@@ -57,12 +57,12 @@
     insert into kws_integration (id, integration_name, part_names, 
     insert into kws_integration (id, integration_name, part_names, 
       unit, formula, remark, 
       unit, formula, remark, 
       `status`, create_by, create_time, 
       `status`, create_by, create_time, 
-      update_by, update_time, del_flag
+      update_by, update_time, del_flag,mountain_id
       )
       )
     values (#{id,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, #{partNames,jdbcType=VARCHAR}, 
     values (#{id,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, #{partNames,jdbcType=VARCHAR}, 
       #{unit,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
       #{unit,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
       #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
       #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}
+      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{mountainId,jdbcType=BIGINT}
       )
       )
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">