Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

xiaoqiao 10 mēneši atpakaļ
vecāks
revīzija
e6e2fe94c6

+ 1 - 0
src/main/java/com/bowintek/practice/mapper/cquery/FactWellCQuery.java

@@ -7,4 +7,5 @@ public interface FactWellCQuery {
     List<FactWellGroupList> getDayGroupList(String wellId, String startDay, String endDay);
     List<FactWellGroupList> getMonthGroupList(String wellId, String startDay, String endDay);
     List<FactWellGroupList> getYearGroupList(String wellId, String startDay, String endDay);
+    List<FactWellGroupList> getMonthShowInList(String wellId, String startDay, String endDay);
 }

+ 50 - 5
src/main/java/com/bowintek/practice/services/impl/FactWellServiceImpl.java

@@ -25,9 +25,48 @@ public class FactWellServiceImpl implements FactWellService {
     @Override
     @SwitchDataSource(DBTypeEnum.POSTGRE)
     public List<FactWellGroupList> getFactWellList(String wellId, String timeType){
-        if(timeType.equals("day")) return getDayGroupList(wellId);
-        if(timeType.equals("month")) return getMonthGroupList(wellId);
-        else return getYearGroupList(wellId);
+        //当前只有月份计算方式
+        return getMonthShowInList(wellId);
+    }
+
+    public List<FactWellGroupList> getMonthShowInList(String wellId){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(getToDay());
+
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        //上月最后
+        Date endTime = calendar.getTime();
+
+        //11月前的1号
+        calendar.add(Calendar.MONTH, -11);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        Date startTime = calendar.getTime();
+
+        return getMonthShowInList(wellId, startTime, endTime);
+    }
+    public List<FactWellGroupList> getMonthShowInList(String wellId, Date startTime, Date endTime){
+        //重新计算当前12月
+        if(startTime==null || endTime==null) return getMonthGroupList(wellId);
+
+        System.out.println("getMonthGroupList "+dateToDayString(startTime)+" "+dateToDayString(endTime));
+
+        List<FactWellGroupList> rtnList = factWellCQuery
+                .getMonthShowInList(wellId, dateToDayString(startTime), dateToDayString(endTime));
+
+        //补充列表数据
+        List<String> monthList = new ArrayList<>();
+        for(Date time = startTime;time.getTime()<=endTime.getTime();){
+            Calendar calendarTime = Calendar.getInstance();
+            calendarTime.setTime(time);
+            monthList.add(dateToMonthString(calendarTime.getTime()));
+            //下一月
+            calendarTime.add(Calendar.MONTH, 1);
+            time = calendarTime.getTime();
+        }
+
+        rtnList = supplementList(wellId, monthList, rtnList);
+        return rtnList;
     }
 
     @Override
@@ -41,6 +80,7 @@ public class FactWellServiceImpl implements FactWellService {
     public List<FactWellGroupList> getDayGroupList(String wellId){
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(getToDay()); // 设置当前天日期
+        //上月最后一天
         Date endTime = calendar.getTime();
 
         calendar.add(Calendar.DAY_OF_MONTH, -29);
@@ -81,11 +121,16 @@ public class FactWellServiceImpl implements FactWellService {
     public List<FactWellGroupList> getMonthGroupList(String wellId){
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(getToDay());
+
+        calendar.add(Calendar.MONTH, 1);
         calendar.set(Calendar.DAY_OF_MONTH, 1);
-        //当月1号
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        //当前月最后一天
         Date endTime = calendar.getTime();
+
         //11月前的1号
         calendar.add(Calendar.MONTH, -11);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
         Date startTime = calendar.getTime();
 
         return getMonthGroupList(wellId, startTime, endTime);
@@ -121,7 +166,7 @@ public class FactWellServiceImpl implements FactWellService {
         calendar.set(Calendar.DAY_OF_MONTH, 1);
         calendar.add(Calendar.MONTH, 1);
         calendar.add(Calendar.DAY_OF_MONTH, -1);
-        //当年12月30日
+        //当年最后一天
         Date endTime = calendar.getTime();
         //5年前1月1日
         calendar.add(Calendar.YEAR, -4);

+ 2 - 0
src/main/java/com/bowintek/practice/vo/FactWell/FactWellGroupList.java

@@ -11,6 +11,7 @@ public class FactWellGroupList {
     private double water;
     private double fluid;
     private double watercut;
+    private double vol;
 
     public static FactWellGroupList gen(String wellId, String timeStr){
         FactWellGroupList obj = new FactWellGroupList();
@@ -21,6 +22,7 @@ public class FactWellGroupList {
         obj.setFluid(0);
         obj.setWater(0);
         obj.setWatercut(0);
+        obj.setVol(0);
         return obj;
     }
 }

+ 49 - 14
src/main/resources/mapping/cquery/FactWellCQuery.xml

@@ -8,14 +8,16 @@
                 SUM(t.oil_prod_daily) oil,
                 SUM(t.fluid_prod_daily) fluid,
                 SUM(t.water_prod_daily) water,
-                SUM(t.water_cut) watercut
+                SUM(t.water_cut) watercut,
+                SUM(inj_vol_daily) vol
         FROM (  SELECT  wd.well_id,
                         TO_CHAR(wd.prod_date , 'YYYY-MM-DD') prod_time_str,
                         COALESCE(wd.gas_prod_daily, 0)      gas_prod_daily,
                         COALESCE(wd.oil_prod_daily, 0)      oil_prod_daily,
                         COALESCE(wd.fluid_prod_daily, 0)      fluid_prod_daily,
                         COALESCE(wd.water_prod_daily, 0)      water_prod_daily,
-                        COALESCE(wd.water_cut, 0)      water_cut
+                        COALESCE(wd.water_cut, 0)      water_cut,
+                        COALESCE(wd.inj_vol_daily)  inj_vol_daily
                 FROM by_dwr.fact_dwr_pc_pro_well_vol_d wd
                 WHERE wd.prod_date <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
                     and wd.prod_date <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
@@ -26,7 +28,7 @@
         GROUP BY t.well_id, t.prod_time_str
     </select>
 
-    <select id="getMonthGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
+    <select id="getMonthShowInList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
         SELECT t.well_id,
             t.prod_time_str time_str,
             MAX(t.gas_prod_mon) gas,
@@ -35,7 +37,7 @@
             MAX(t.fluid_prod_mon) fluid,
             0 watercut
         FROM (  SELECT wm.well_id,
-                    TO_CHAR(wm.prod_date , 'YYYY-MM-DD') prod_time_str,
+                    TO_CHAR(wm.prod_date , 'YYYY年MM月') prod_time_str,
                     COALESCE(wm.gas_prod_cum, 0) gas_prod_mon,
                     COALESCE(wm.oil_prod_cum, 0) oil_prod_mon,
                     COALESCE(wm.water_prod_cum, 0) water_prod_mon,
@@ -44,32 +46,65 @@
                 WHERE wm.prod_date is not null
                     and wm.prod_date <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
                     and wm.prod_date <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
-                  and wm.well_id=#{wellId}
+                    <if test="wellId!='' and wellId!=null">
+                        and wm.well_id=#{wellId}
+                    </if>
             ) t
         GROUP BY t.well_id, t.prod_time_str
     </select>
 
-    <select id="getYearGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
+    <select id="getMonthGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
         SELECT t.well_id,
             t.prod_time_str time_str,
             SUM(t.gas_prod_mon) gas,
             SUM(t.oil_prod_mon) oil,
             SUM(t.water_prod_mon) water,
             SUM(t.fluid_prod_mon) fluid,
-            0 watercut
+            SUM(t.water_cut_ratio_m) watercut,
+            SUM(t.inj_vol_mon) vol
         FROM (  SELECT wm.well_id,
-                    SUBSTRING(prod_date, 1, 4) prod_time_str,
+                    to_char(to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD'), 'YYYY年MM月') prod_time_str,
                     COALESCE(wm.gas_prod_mon, 0) gas_prod_mon,
                     COALESCE(wm.oil_prod_mon, 0) oil_prod_mon,
                     COALESCE(wm.water_prod_mon, 0) water_prod_mon,
-                    COALESCE(wm.fluid_prod_mon, 0) fluid_prod_mon
+                    COALESCE(wm.fluid_prod_mon, 0) fluid_prod_mon,
+                    COALESCE(wm.water_cut_ratio_m, 0) water_cut_ratio_m,
+                    COALESCE(wm.inj_vol_mon, 0) inj_vol_mon
                 FROM by_dwr.fact_dwr_pc_pro_well_vol_m wm
                 WHERE wm.prod_date is not null
-                and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
-                and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
-        <if test="wellId!='' and wellId!=null">
-            and wm.well_id=#{wellId}
-        </if>
+                    and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
+                    and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
+                    <if test="wellId!='' and wellId!=null">
+                        and wm.well_id=#{wellId}
+                    </if>
+        ) t
+        GROUP BY t.well_id, t.prod_time_str
+    </select>
+
+    <select id="getYearGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
+        SELECT t.well_id,
+            t.prod_time_str time_str,
+            MAX(t.gas_prod_year) gas,
+            MAX(t.oil_prod_year) oil,
+            MAX(t.water_prod_year) water,
+            MAX(t.fluid_prod_year) fluid,
+            MAX(t.water_cut_ratio_y) watercut,
+            MAX(t.inj_vol_year) vol
+        FROM (  SELECT wm.well_id,
+                    SUBSTRING(prod_date, 1, 4) prod_time_str,
+                    COALESCE(wm.gas_prod_year, 0) gas_prod_year,
+                    COALESCE(wm.oil_prod_year, 0) oil_prod_year,
+                    COALESCE(wm.water_prod_year, 0) water_prod_year,
+                    COALESCE(wm.liquid_prod_year, 0) fluid_prod_year,
+                    COALESCE(wm.water_cut_ratio_y, 0) water_cut_ratio_y,
+                    COALESCE(wm.inj_vol_year, 0) inj_vol_year
+                FROM by_dwr.fact_dwr_pc_pro_well_vol_m wm
+                WHERE wm.prod_date is not null
+                    and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
+                    and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD')  <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
+                    <if test="wellId!='' and wellId!=null">
+                        and wm.well_id=#{wellId}
+                    </if>
             ) t
         GROUP BY t.well_id, t.prod_time_str
     </select>

+ 4 - 4
src/main/resources/static/a4gis/index.html

@@ -187,19 +187,19 @@
       right: 20px;
     }
   </style>
-  <!--测试环境使用
+  <!--测试环境使用-->
   <link href='https://js.arcgis.com/3.27/esri/css/esri.css' rel='stylesheet' />
   <script src='jquery.min.js'></script>
   <script src='https://js.arcgis.com/3.27/init.js' type='text/javascript'></script>
   <script src='init-gmap.js?v=1.15.9' type='text/javascript'></script>
-  <script src='init-gcontrols.js?v=1.0.5' type='text/javascript'></script>-->
+  <script src='init-gcontrols.js?v=1.0.5' type='text/javascript'></script>
 
-  <!--正式环境使用-->
+  <!--正式环境使用
   <link href='http://a4.petrochina/gisapi/esri/css/esri.css' rel='stylesheet' />
   <script src='http://a4.petrochina/gisapi/third/jquery/jquery-1.9.1.min.js'></script>
   <script src='http://a4.petrochina/gisapi/init.js' type='text/javascript'></script>
   <script src='http://a4.petrochina/gisapi/lib/init-gmap.js?v=1.15.9' type='text/javascript'></script>
-  <script src='http://a4.petrochina/gisapi/lib/init-gcontrols.js?v=1.0.5' type='text/javascript'></script>
+  <script src='http://a4.petrochina/gisapi/lib/init-gcontrols.js?v=1.0.5' type='text/javascript'></script>-->
 
   <script>
     var map = null, app = { token: "d4b2b740-9814-4d75-9cda-dac96fc2bc10" };

+ 10 - 3
vue/src/components/basic/chart/chart-map.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="chart-map">
-    <div class="chart-map-input" v-if="wellId==null">
+    <div class="chart-map-input" v-if="isSearch">
       <a-auto-complete
         :dropdown-match-select-width="252"
         style="width: 300px"
@@ -35,7 +35,8 @@
 
   export  default defineComponent ({
     props:{
-      datas: null as any
+      datas: null as any,
+      isSearch : Boolean
     },
     name : 'ChartMap',
     data() {
@@ -69,10 +70,16 @@
           };
         });
       });
+
+      const isSearch = computed(() => {
+        return props.isSearch == null || props.isSearch == undefined ? true : props.isSearch
+      });
+
       return{
         datas,
         iframeSrc,
-        iframeRef
+        iframeRef,
+        isSearch
       }
     },
     mounted(){

+ 2 - 1
vue/src/components/basic/chart/chart-prod-dynamics.vue

@@ -144,7 +144,8 @@
           {label:'产水量', value:'water', unit:'万吨'},
           {label:'产液量', value:'fluid', unit:'万吨'},
           {label:'产气量', value:'gas', unit:'立方米'},
-          {label:'含水率', value:'watercut', unit:'万吨'}
+          {label:'含水率', value:'watercut', unit:'万吨'},
+          {label:'注水量', value:'vol', unit:'立方米'}
         ];
       },
       getTypes:function (){

+ 10 - 2
vue/src/views/wellinfo/detail.vue

@@ -328,7 +328,7 @@
       </template>
       <div v-if="cardSettings.cardGIS.expand">
         <div style="width:100%;height: 500px;margin-top:15px;">
-          <ChartMap :wellId="wellId"></ChartMap>
+          <ChartMap :datas="mapDatas"></ChartMap>
         </div>
       </div>
     </a-card>
@@ -402,7 +402,8 @@ export default defineComponent({
       historyAssignmentSummary: [],
       lastHistoryAssignment: {},
       historyAssignmentCount: 0,
-      dataIndexList: [] as any[]
+      dataIndexList: [] as any[],
+      mapDatas : [] as any
     });
 
     const loadData = async (id) => {
@@ -422,6 +423,13 @@ export default defineComponent({
         wellData.lastHistoryAssignment = data.lastHistoryAssignment ?? {};
         wellData.dataIndexList = data.dataIndexList;
         wellData.historyAssignmentCount = wellData.historyAssignmentSummary.reduce((total, it: any) => total + it.testing_num, 0);
+        wellData.mapDatas = [{
+          well_id : wellData.dataModel.well_id,
+          well_common_name : data.dataModel.well_common_name,
+          geo_description : data.dataModel.geo_description,
+          x : data.dataModel.well_coordinates_x,
+          y : data.dataModel.well_coordinates_y
+        }];
 
         fileOptions.businessType = wellData.dataIndexList.map(x => x.file_business_type);
         fileOptions.businessType = Array.from(new Set(fileOptions.businessType));

+ 1 - 1
vue/src/views/wellinfo/index.vue

@@ -286,7 +286,7 @@
                       @showSizeChange="(current,pageSize)=>handleTableChange({ current: current,pageSize: pageSize })"/>
       </a-spin>
       <div style="width:100%;height: 500px;margin-top:15px">
-        <ChartMap :datas="data"></ChartMap>
+        <ChartMap :datas="data" :isSearch="(true)"></ChartMap>
       </div>
     </div>
     <a-modal v-model:visible="isShowDoc" title="相关文档" :footer="null" @onCancel="isShowDoc=false">