فهرست منبع

指标录入功能操作

wangchangsheng 2 سال پیش
والد
کامیت
80d067ff73

+ 4 - 3
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/controller/ProBasicTargetPlanController.java

@@ -65,10 +65,11 @@ public class ProBasicTargetPlanController {
     @ApiOperation(value = "指标计划表-新增or修改", notes = "指标计划表-新增or修改")
     public R addAll(@RequestBody ProBasicTargetPlan proBasicTargetPlan) {
 
-        boolean b = proBasicTargetPlanService.saveOrUpdate(proBasicTargetPlan);
-        if (b) {
+        boolean b = false;
+        try {
+            b = proBasicTargetPlanService.addOrUpdate(proBasicTargetPlan);
             return R.ok().data(b);
-        } else {
+        } catch (Exception e) {
             return R.error().data("保存失败!");
         }
     }

+ 1 - 1
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/IProBasicTargetPlanService.java

@@ -16,5 +16,5 @@ public interface IProBasicTargetPlanService extends IService<ProBasicTargetPlan>
 
     IPage<ProBasicTargetPlan> list(String id, String companyCode, String targetCode , String targetDate,String pageNum, String  pageSize);
 
-
+    public boolean addOrUpdate(ProBasicTargetPlan proBasicTargetPlan) throws Exception;
 }

+ 2 - 2
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/impl/ProBasicPowerstationPointServiceImpl.java

@@ -74,11 +74,11 @@ public class ProBasicPowerstationPointServiceImpl extends ServiceImpl<ProBasicPo
 
 
         if (StringUtils.isNotEmpty(uniformCode)){
-            qw.eq("uniformCode",uniformCode);
+            qw.eq("uniform_code",uniformCode);
         }
 
         if (StringUtils.isNotEmpty(windpowerstationId)){
-            qw.eq("windpowerstationId",windpowerstationId);
+            qw.eq("windpowerstation_id",windpowerstationId);
         }
 
         List<ProBasicPowerstationPoint> list = baseMapper.selectList(qw);

+ 38 - 0
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/impl/ProBasicTargetPlanServiceImpl.java

@@ -3,12 +3,22 @@ package com.gyee.backconfig.service.auto.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.backconfig.model.auto.ProBasicPowerstationPoint;
 import com.gyee.backconfig.model.auto.ProBasicTargetPlan;
 import com.gyee.backconfig.mapper.auto.ProBasicTargetPlanMapper;
+import com.gyee.backconfig.service.auto.IProBasicPowerstationPointService;
 import com.gyee.backconfig.service.auto.IProBasicTargetPlanService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.backconfig.until.realtimedate.EdosUtil;
+import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -21,6 +31,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProBasicTargetPlanServiceImpl extends ServiceImpl<ProBasicTargetPlanMapper, ProBasicTargetPlan> implements IProBasicTargetPlanService {
 
+    @Autowired
+    private IProBasicPowerstationPointService proBasicPowerstationPointService;
+
+    @Autowired
+    private EdosUtil goldenUtil;
+
     @Override
     public IPage<ProBasicTargetPlan> list(String id, String companyCode, String targetCode, String targetDate, String pageNum, String pageSize) {
         QueryWrapper<ProBasicTargetPlan> qw = new QueryWrapper<>();
@@ -43,4 +59,26 @@ public class ProBasicTargetPlanServiceImpl extends ServiceImpl<ProBasicTargetPla
         IPage<ProBasicTargetPlan> targetPlans = getBaseMapper().selectPage(page, qw);
         return targetPlans;
     }
+
+    @Transactional
+    @Override
+    public boolean addOrUpdate(ProBasicTargetPlan proBasicTargetPlan) throws Exception{
+
+        this.saveOrUpdate(proBasicTargetPlan);
+        List<ProBasicPowerstationPoint> stationlist = proBasicPowerstationPointService.getStationpointByUniformcode(proBasicTargetPlan.getCompanyCode(), proBasicTargetPlan.getTargetCode());
+
+        if (null == stationlist || stationlist.size() <= 0) {
+            throw new RuntimeException();
+        }
+        PointData point = new PointData();
+        point.setEdnaId(stationlist.get(0).getNemCode());
+        Date date = DateUtils.parseDate1(proBasicTargetPlan.getTargetDate());
+        point.setPointTime(date.getTime());
+        point.setPointValueInDouble(Double.valueOf(proBasicTargetPlan.getTargetValue()));
+        goldenUtil.sendSinglePoint(point);
+        return true;
+
+    }
+
+
 }

+ 5 - 1
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/until/realtimedate/EdosUtil.java

@@ -8,6 +8,7 @@ import com.gyee.common.model.DNAStatVal;
 import com.gyee.common.model.DNAVal;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
@@ -20,7 +21,10 @@ import java.util.*;
 public class EdosUtil  implements IEdosUtil {
 
     private RestTemplate restTemplate =new RestTemplate();
-    private static String baseURL = "http://10.81.3.155:8011/ts";
+
+    @Value("${db.url}")
+    private String baseURL;
+
     @Override
     public PointData getRealData(ProBasicPowerstationPoint point) throws Exception {
         try {

+ 2 - 0
web/backmanagerconfig-xktj/src/main/resources/application-jn.yml

@@ -98,6 +98,8 @@ logging:
   level:
     root: info
     com.example: debug
+db:
+  url: http://124.70.75.91:8011/ts
 
 
 

+ 24 - 13
web/backmanagerconfig-xktj/src/main/resources/application-test.yml

@@ -19,9 +19,9 @@ spring:
 #      password: nacos
 #  #redis集群
   redis:
-    host: 120.46.148.180
+    host: 124.70.18.168
     port: 6379
-    timeout: 100000
+    password: gdnxfd123
 #    #    集群环境打开下面注释,单机不需要打开
 #    #    cluster:
 #    #      集群信息
@@ -29,22 +29,22 @@ spring:
 #    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
 #    #      maxRedirects: 3
 #    password:
-#    application:
-#      name: test
-#    jedis:
-#      pool:
-#        max-active: 8
-#        min-idle: 0
-#        max-idle: 8
-#        max-wait: -1
-#    database: 0
+    application:
+      name: test
+    jedis:
+      pool:
+        max-active: 8
+        min-idle: 0
+        max-idle: 8
+        max-wait: -1
+    database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://120.46.148.180:5432/wisdom
-    username: gdprod
+    url: jdbc:postgresql://124.70.75.91:5432/jn_test #IMS_NEM_SD
+    username: postgres
     password: gd123
     oracle-schema=:
     #    type: com.alibaba.druid.pool.DruidDataSource
@@ -99,6 +99,17 @@ logging:
     root: info
     com.example: debug
 
+async:
+  thread:
+  core_pool_size: 4
+  max_pool_size: 8
+  queue_capacity: 135
+  name:
+    prefix: ticketManager-worker-
+db:
+  url: http://124.70.75.91:8011/ts
+
+
 
 
 

+ 4 - 1
web/backmanagerconfig-xktj/src/main/resources/application-xk.yml

@@ -43,7 +43,7 @@ spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://192.168.11.248:5432/IMS_NEM_SD?rewriteBatchedStatements=true
+    url: jdbc:postgresql://192.168.11.248:5432/IMS_NEM_HNX?rewriteBatchedStatements=true
     username: postgres
     password: postgres
     oracle-schema=:
@@ -94,6 +94,9 @@ logging:
     root: info
     com.example: debug
 
+db:
+  url: http://192.168.11.250:8011/ts
+