浏览代码

计划执行统计

raojiang 3 月之前
父节点
当前提交
8695dc247b

+ 0 - 1
api/ruoyi-api-system/pom.xml

@@ -17,7 +17,6 @@
         <dependency>
             <groupId>com.hdkj</groupId>
             <artifactId>ruoyi-common-core</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
         </dependency>
     </dependencies>
 

+ 16 - 1
pom.xml

@@ -20,7 +20,7 @@
     <packaging>pom</packaging>
 
     <properties>
-        <revision>0.0.1-SNAPSHOT</revision>
+        <revision>1.0.25</revision>
         <java.version>1.8</java.version>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
@@ -109,11 +109,26 @@
                 <artifactId>load-transfer-mq-api</artifactId>
                 <version>${revision}</version>
             </dependency>
+            <dependency>
+                <groupId>com.hdkj</groupId>
+                <artifactId>load-transfer-bf-api</artifactId>
+                <version>${revision}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.hdkj</groupId>
+                <artifactId>load-transfer-io-api</artifactId>
+                <version>${revision}</version>
+            </dependency>
             <dependency>
                 <groupId>com.hdkj</groupId>
                 <artifactId>ruoyi-common-security</artifactId>
                 <version>${revision}</version>
             </dependency>
+            <dependency>
+                <groupId>com.hdkj</groupId>
+                <artifactId>ruoyi-common-datasource</artifactId>
+                <version>${revision}</version>
+            </dependency>
             <dependency>
                 <groupId>com.hdkj</groupId>
                 <artifactId>ruoyi-common-redis</artifactId>

+ 6 - 0
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/mapper/FhzgAutoTaskCountryInfoMapper.java

@@ -2,6 +2,9 @@ package com.hdkj.lt.bf.mapper;
 
 import com.hdkj.lt.bf.entity.FhzgAutoTaskCountryInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
 * @author Sunlit
@@ -11,6 +14,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 */
 public interface FhzgAutoTaskCountryInfoMapper extends BaseMapper<FhzgAutoTaskCountryInfo> {
 
+    List<FhzgAutoTaskCountryInfo> getFeederStaticData();
+
+    FhzgAutoTaskCountryInfo getPlanStaticData(@Param("cityCode")String cityCode, @Param("countryCode")String countryCode);
 }
 
 

+ 1 - 3
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/mapper/FhzgAutoTaskPlanMapper.java

@@ -15,9 +15,7 @@ import java.util.List;
  */
 public interface FhzgAutoTaskPlanMapper extends BaseMapper<FhzgAutoTaskPlan> {
 
-    List<String> getContactFeederList(@Param("cityCode") String cityCode);
-
-    List<String> getHaveStartKgFeederList(@Param("cityCode") String cityCode);
+    List<String> getHaveStartKgAndContactFeederList(@Param("cityCode") String cityCode);
 
     List<DwdShbDsFeederBase> getFeederInfoByCityCode(@Param("cityCode") String cityCode);
 }

+ 5 - 0
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/service/FhzgAutoTaskCountryInfoService.java

@@ -3,6 +3,8 @@ package com.hdkj.lt.bf.service;
 import com.hdkj.lt.bf.entity.FhzgAutoTaskCountryInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
 * @author Sunlit
 * @description 针对表【fhzg_auto_task_country_info】的数据库操作Service
@@ -10,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 */
 public interface FhzgAutoTaskCountryInfoService extends IService<FhzgAutoTaskCountryInfo> {
 
+    List<FhzgAutoTaskCountryInfo> getFeederStaticData();
+
+    FhzgAutoTaskCountryInfo getPlanStaticData(String cityCode, String countryCode);
 }

+ 1 - 3
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/service/FhzgAutoTaskPlanService.java

@@ -14,9 +14,7 @@ import java.util.List;
 */
 public interface FhzgAutoTaskPlanService extends IService<FhzgAutoTaskPlan> {
 
-    List<String> getContactFeederList(String cityCode);
-
-    List<String> getHaveStartKgFeederList(String cityCode);
+    List<String> getHaveStartKgAndContactFeederList(String cityCode);
 
     List<DwdShbDsFeederBase> getFeederInfoByCityCode(String cityCode);
 }

+ 25 - 9
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/service/impl/AutoTaskServiceImpl.java

@@ -401,15 +401,11 @@ public class AutoTaskServiceImpl implements AutoTaskService {
             fhzgAutoTaskPlan.setCreateTime(now);
             autoTaskPlanService.save(fhzgAutoTaskPlan);
             //查询对应地市的线路
-            List<String> contactFeederList = autoTaskPlanService.getContactFeederList(cityCode);
-            List<String> haveStartKgFeederList = autoTaskPlanService.getHaveStartKgFeederList(cityCode);
+            List<String> haveStartKgAndContactFeederList = autoTaskPlanService.getHaveStartKgAndContactFeederList(cityCode);
             List<DwdShbDsFeederBase> feederBaseList = autoTaskPlanService.getFeederInfoByCityCode(cityCode);
             Map<String, DwdShbDsFeederBase> feederSwitchBaseMap = feederBaseList.stream().collect(Collectors.toMap(DwdShbDsFeederBase::getPsrId, i -> i));
-
-            Set<String> haveStartKgAndContactFeederSet = new HashSet<>(haveStartKgFeederList);
-            haveStartKgAndContactFeederSet.addAll(contactFeederList);
             List<FhzgAutoTaskPlanDetail> detailList = new ArrayList<>();
-            haveStartKgAndContactFeederSet.forEach(i -> {
+            haveStartKgAndContactFeederList.forEach(i -> {
                 DwdShbDsFeederBase dwdShbDsFeederBase = feederSwitchBaseMap.get(i);
                 FhzgAutoTaskPlanDetail fhzgAutoTaskPlanDetail = new FhzgAutoTaskPlanDetail();
                 fhzgAutoTaskPlanDetail.setTaskId(snowflakeNextId);
@@ -430,7 +426,7 @@ public class AutoTaskServiceImpl implements AutoTaskService {
         }
     }
 
-    @Scheduled(cron = "0 0/5 * * * *")
+    @Scheduled(cron = "0 0/2 * * * *")
     public void runTask() {
         LambdaQueryWrapper<FhzgAutoTaskPlanDetail> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.isNull(FhzgAutoTaskPlanDetail::getPlanNo);
@@ -447,9 +443,29 @@ public class AutoTaskServiceImpl implements AutoTaskService {
         }
     }
 
+    @Scheduled(cron = "0 0 0 1 * ?")
+    public void updateFeederStaticData(){
+        List<FhzgAutoTaskCountryInfo> countryInfoList =  autoTaskCountryInfoService.getFeederStaticData();
+        countryInfoList.forEach(i -> i.setUpdateTime(LocalDate.now()));
+        autoTaskCountryInfoService.saveBatch(countryInfoList);
+    }
 
-    public void updateStaticData(){
-
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void updatePlanStaticData(){
+        LambdaQueryWrapper<FhzgAutoTaskCountryInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.between(FhzgAutoTaskCountryInfo::getUpdateTime,LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()),LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()));
+        List<FhzgAutoTaskCountryInfo> list = autoTaskCountryInfoService.list(queryWrapper);
+        for (FhzgAutoTaskCountryInfo fhzgAutoTaskCountryInfo : list) {
+            FhzgAutoTaskCountryInfo fhzgAutoTaskCountryInfo1 = autoTaskCountryInfoService.getPlanStaticData(fhzgAutoTaskCountryInfo.getCityCode(),fhzgAutoTaskCountryInfo.getCountryCode());
+            fhzgAutoTaskCountryInfo.setSimulationSuccess(fhzgAutoTaskCountryInfo1.getSimulationSuccess());
+            fhzgAutoTaskCountryInfo.setSimulationSuccessRate(fhzgAutoTaskCountryInfo1.getSimulationSuccessRate());
+            fhzgAutoTaskCountryInfo.setSchemeSuccess(fhzgAutoTaskCountryInfo1.getSchemeSuccess());
+            fhzgAutoTaskCountryInfo.setSchemeSuccessRate(fhzgAutoTaskCountryInfo1.getSchemeSuccessRate());
+            fhzgAutoTaskCountryInfo.setSvgSuccess(fhzgAutoTaskCountryInfo1.getSvgSuccess());
+            fhzgAutoTaskCountryInfo.setSvgSuccessRate(fhzgAutoTaskCountryInfo1.getSvgSuccessRate());
+            fhzgAutoTaskCountryInfo.setUpdateTime(fhzgAutoTaskCountryInfo1.getUpdateTime());
+            autoTaskCountryInfoService.updateById(fhzgAutoTaskCountryInfo);
+        }
     }
 
 }

+ 13 - 0
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/service/impl/FhzgAutoTaskCountryInfoServiceImpl.java

@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hdkj.lt.bf.entity.FhzgAutoTaskCountryInfo;
 import com.hdkj.lt.bf.service.FhzgAutoTaskCountryInfoService;
 import com.hdkj.lt.bf.mapper.FhzgAutoTaskCountryInfoMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
 * @author Sunlit
 * @description 针对表【fhzg_auto_task_country_info】的数据库操作Service实现
@@ -15,6 +19,15 @@ import org.springframework.stereotype.Service;
 public class FhzgAutoTaskCountryInfoServiceImpl extends ServiceImpl<FhzgAutoTaskCountryInfoMapper, FhzgAutoTaskCountryInfo>
     implements FhzgAutoTaskCountryInfoService{
 
+    @Override
+    public List<FhzgAutoTaskCountryInfo> getFeederStaticData() {
+        return baseMapper.getFeederStaticData();
+    }
+
+    @Override
+    public FhzgAutoTaskCountryInfo getPlanStaticData(String cityCode, String countryCode) {
+        return baseMapper.getPlanStaticData(cityCode,countryCode);
+    }
 }
 
 

+ 2 - 7
services/load-transfer-bf/src/main/java/com/hdkj/lt/bf/service/impl/FhzgAutoTaskPlanServiceImpl.java

@@ -22,13 +22,8 @@ public class FhzgAutoTaskPlanServiceImpl extends ServiceImpl<FhzgAutoTaskPlanMap
     implements FhzgAutoTaskPlanService{
 
     @Override
-    public List<String> getContactFeederList(String cityCode) {
-        return this.baseMapper.getContactFeederList(cityCode);
-    }
-
-    @Override
-    public List<String> getHaveStartKgFeederList(String cityCode) {
-        return this.baseMapper.getHaveStartKgFeederList(cityCode);
+    public List<String> getHaveStartKgAndContactFeederList(String cityCode) {
+        return this.baseMapper.getHaveStartKgAndContactFeederList(cityCode);
     }
 
     @Override

+ 28 - 5
services/load-transfer-bf/src/main/resources/mapper/FhzgAutoTaskCountryInfoMapper.xml

@@ -15,9 +15,32 @@
             <result property="svgSuccessRate" column="svg_success_rate" jdbcType="INTEGER"/>
     </resultMap>
 
-    <sql id="Base_Column_List">
-        id,city_code,country_code,
-        feeder_total,contact_feeder_total,simulation_success_rate,
-        scheme_success_rate,svg_success_rate
-    </sql>
+    <select id="getFeederStaticData" resultType="com.hdkj.lt.bf.entity.FhzgAutoTaskCountryInfo">
+        select city as city_code, city_name, maint_org as country_code, maint_org_name as country_name,count(*) as feeder_total,count(cf.feeder) as contact_feeder_total
+        from dwd_shb_ds_feeder_base dsdfb
+                 left join (select distinct feeder from t_feeder_topo where normal_open = 'true') cf on dsdfb.psr_id = cf.feeder
+        where psr_state = '20'
+        group by  city, city_name, maint_org, maint_org_name;
+    </select>
+
+    <select id="getPlanStaticData" resultType="com.hdkj.lt.bf.entity.FhzgAutoTaskCountryInfo">
+        SELECT city_code,
+               city_name,
+               country_code,
+               country_name,
+               sum(is_simulation_success)                                as simulation_success,
+               sum(is_simulation_success) / COUNT(*) * 100               as simulation_success_rate,
+               sum(is_scheme_success)                                    as scheme_success,
+               sum(is_scheme_success) / sum(is_simulation_success) * 100 as scheme_success_rate,
+               sum(is_svg_success)                                       as svg_success,
+               sum(is_svg_success) / sum(is_scheme_success) * 100        as svg_success_rate,
+               now()                                                     as update_time
+        from fhzg_auto_task_plan_detail
+        WHERE
+            city_code = #{cityCode} and country_code = #{countryCode}
+        GROUP by city_code,
+                 city_name,
+                 country_code,
+                 country_name
+    </select>
 </mapper>

+ 2 - 5
services/load-transfer-bf/src/main/resources/mapper/FhzgAutoTaskPlanMapper.xml

@@ -14,11 +14,8 @@
             <result property="status" column="status" jdbcType="INTEGER"/>
     </resultMap>
 
-    <select id="getHaveStartKgFeederList" resultType="java.lang.String">
-        select distinct feeder from t_feeder_topo where city_code = #{cityCode} and is_start_kg = 1;
-    </select>
-    <select id="getContactFeederList" resultType="java.lang.String">
-        select distinct feeder from t_feeder_topo where city_code = #{cityCode} and normal_open = 'true';
+    <select id="getHaveStartKgAndContactFeederList" resultType="java.lang.String">
+        select distinct feeder from t_feeder_topo where city_code = #{cityCode} and is_start_kg = 1 and normal_open = 'true';
     </select>
 
     <select id="getFeederInfoByCityCode" resultType="com.hdkj.lt.core.bizms.modle.po.DwdShbDsFeederBase">

+ 4 - 1
services/load-transfer-si/src/main/resources/bootstrap.yml

@@ -3,4 +3,7 @@ spring:
     active: @environment@
 
 simulation:
-  xToken: 1sadasd123-dadasd
+  xToken: 1sadasd123-dadasd
+
+server:
+  address: 127.0.0.1

+ 0 - 3
services/pom.xml

@@ -37,7 +37,6 @@
         <dependency>
             <groupId>com.hdkj</groupId>
             <artifactId>ruoyi-common-datasource</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.hdkj</groupId>
@@ -50,12 +49,10 @@
         <dependency>
             <groupId>com.hdkj</groupId>
             <artifactId>load-transfer-bf-api</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.hdkj</groupId>
             <artifactId>load-transfer-io-api</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.hdkj</groupId>

+ 1 - 0
services/ruoyi-job/src/main/java/com/hdkj/lt/job/service/impl/DealFeederBaseServiceImpl.java

@@ -71,6 +71,7 @@ public class DealFeederBaseServiceImpl implements IDealFeederBaseService {
             FeederBaseResponse.ResultDTO.DkxDTO.RecordsDTO.ResourceDTO resource = i.getResource();
             FeederBaseResponse.ResultDTO.DkxDTO.RecordsDTO.AssetsDTO assets = i.getAssets().get(0);
             DwdShbDsFeederBase feederBase = EntityConvertor.INSTANCE.toDwdShbDsFeederBase(resource, assets);
+            feederBase.setDelFlag("0");
             result.add(feederBase);
         });
         return result;