Sfoglia il codice sorgente

调整累计产量查询语句,不显示当月数据

周壕 10 mesi fa
parent
commit
a80089eff5

+ 8 - 1
src/main/java/com/bowintek/practice/services/impl/FactWellServiceImpl.java

@@ -41,6 +41,9 @@ public class FactWellServiceImpl implements FactWellService {
     public List<FactWellGroupList> getDayGroupList(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();
 
         calendar.add(Calendar.DAY_OF_MONTH, -29);
@@ -81,11 +84,15 @@ public class FactWellServiceImpl implements FactWellService {
     public List<FactWellGroupList> getMonthGroupList(String wellId){
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(getToDay());
+
         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);

+ 1 - 1
src/main/resources/mapping/cquery/FactWellCQuery.xml

@@ -35,7 +35,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,