Forráskód Böngészése

1.积分统计改完统计当月
2.修改积分规则

zx 2 hónapja
szülő
commit
0386e7419e

+ 31 - 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -292,13 +292,42 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return sdf.format(sunday);
     }
 
+    /**
+     * 获取当前时间月的第一天
+     * @param format
+     * @return
+     */
+    public static String getFirstDayForMonthStr(String format){
+        Calendar calendar = Calendar.getInstance(); // 当前日期
+        calendar.set(Calendar.DAY_OF_MONTH, 1); // 当月第一天
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        return sdf.format(calendar.getTime());
+    }
+
+    /**
+     * 获取当前时间月的最后一天
+     * @param format
+     * @return
+     */
+    public static String getLastDayForMonthStr(String format){
+        Calendar calendar = Calendar.getInstance(); // 当前日期
+        calendar.set(Calendar.DAY_OF_MONTH, 1); // 当月第一天
+        int lastDayOfMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); // 当月最后一天
+        calendar.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        return sdf.format(calendar.getTime());
+    }
+
 
     public static void main(String[] args)throws Exception {
         //System.out.println(getNextMonday("20241125",YYYYMMDD));
        // System.out.println(covertStrToLocalTime("Fri Jan 17 2025 00:00:00 GMT+0800 (中国标准时间)"));
 
-        System.out.println(getLastMonday(YYYY_MM_DD));
-        System.out.println(getLastSunday(YYYY_MM_DD));
+        //System.out.println(getLastMonday(YYYY_MM_DD));
+        //System.out.println(getLastSunday(YYYY_MM_DD));
+
+        //System.out.println(getFirstDayForMonthStr(YYYYMMDD));
+        //System.out.println(getLastDayForMonthStr(YYYYMMDD));
     }
 
 }

+ 2 - 2
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/service/impl/PdmScoreRankManagerServiceImpl.java

@@ -107,8 +107,8 @@ public class PdmScoreRankManagerServiceImpl extends ServiceImpl<PdmScoreRankMana
     @Override
     public int saveRank(String startDate,String endDate) {
         if(StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)){
-            startDate = DateUtils.getFirstDateLastMonthStr(DateUtils.YYYYMMDD);
-            endDate = DateUtils.getLastDateLastMonthStr(DateUtils.YYYYMMDD);
+            startDate = DateUtils.getFirstDayForMonthStr(DateUtils.YYYYMMDD);
+            endDate = DateUtils.getLastDayForMonthStr(DateUtils.YYYYMMDD);
         }
         String reportDate = startDate.substring(0,6);
         this.remove(new LambdaUpdateWrapper<PdmScoreRankManager>().eq(PdmScoreRankManager::getReportDate,reportDate));

+ 2 - 2
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/service/impl/PdmScoreRankTeamServiceImpl.java

@@ -107,8 +107,8 @@ public class PdmScoreRankTeamServiceImpl extends ServiceImpl<PdmScoreRankTeamMap
     @Override
     public int saveTeam(String startDate,String endDate) {
         if(StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)){
-            startDate = DateUtils.getFirstDateLastMonthStr(DateUtils.YYYYMMDD);
-            endDate = DateUtils.getLastDateLastMonthStr(DateUtils.YYYYMMDD);
+            startDate = DateUtils.getFirstDayForMonthStr(DateUtils.YYYYMMDD);
+            endDate = DateUtils.getLastDayForMonthStr(DateUtils.YYYYMMDD);
         }
         String reportDate = startDate.substring(0,6);
         this.remove(new LambdaUpdateWrapper<PdmScoreRankTeam>().eq(PdmScoreRankTeam::getReportDate,reportDate));

+ 2 - 2
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/service/impl/PdmScoreRankWorkerServiceImpl.java

@@ -110,8 +110,8 @@ public class PdmScoreRankWorkerServiceImpl extends ServiceImpl<PdmScoreRankWorke
     @Override
     public int saveWorker(String startDate, String endDate) {
         if(StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)){
-            startDate = DateUtils.getFirstDateLastMonthStr(DateUtils.YYYYMMDD);
-            endDate = DateUtils.getLastDateLastMonthStr(DateUtils.YYYYMMDD);
+            startDate = DateUtils.getFirstDayForMonthStr(DateUtils.YYYYMMDD);
+            endDate = DateUtils.getLastDayForMonthStr(DateUtils.YYYYMMDD);
         }
         String reportDate = startDate.substring(0,6);
         this.remove(new LambdaUpdateWrapper<PdmScoreRankWorker>().eq(PdmScoreRankWorker::getReportDate,reportDate));

+ 5 - 5
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmScoreRankManagerMapper.xml

@@ -117,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select report_year,report_date,t1.submit_org_nm,'1' team_type,t1.work_team_nm,t1.work_princip_nm,
         work_level_1+work_level_2+work_level_3+work_level_4+work_level_5
         -IFNULL(province_violation_1,0)-IFNULL(province_violation_2,0)-IFNULL(city_violation_1,0)-IFNULL(city_violation_2,0)
-        -IFNULL(city_problem_1,0)-IFNULL(city_problem_2,0) score
+        -IFNULL(city_problem_1,0) score
         from
         (
         SELECT
@@ -152,8 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT t3.submit_org_nm,work_team_nm,t3.work_princip_nm,t3.work_princip_id,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid
@@ -203,8 +203,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT work_team_nm,t3.work_princip_nm,t3.work_princip_id,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid

+ 5 - 5
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmScoreRankTeamMapper.xml

@@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         '1' team_type,t1.work_team_nm,
         work_level_1+work_level_2+work_level_3+work_level_4+work_level_5
         -IFNULL(province_violation_1,0)-IFNULL(province_violation_2,0)-IFNULL(city_violation_1,0)-IFNULL(city_violation_2,0)
-        -IFNULL(city_problem_1,0)-IFNULL(city_problem_2,0) score
+        -IFNULL(city_problem_1,0) score
         from
         (
         SELECT
@@ -146,8 +146,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT submit_org_nm,work_team_nm,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid
@@ -197,8 +197,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT work_team_nm,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid

+ 5 - 5
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmScoreRankWorkerMapper.xml

@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select report_year,report_date,t1.submit_org_nm,'1' team_type,t1.work_team_nm,t1.person_nm,
         work_level_1+work_level_2+work_level_3+work_level_4+work_level_5
         -IFNULL(province_violation_1,0)-IFNULL(province_violation_2,0)-IFNULL(city_violation_1,0)-IFNULL(city_violation_2,0)
-        -IFNULL(city_problem_1,0)-IFNULL(city_problem_2,0) score
+        -IFNULL(city_problem_1,0) score
         from
         (
         SELECT
@@ -170,8 +170,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT t3.submit_org_nm,work_team_nm,person_nm,person_id,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3*0.3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1*0.3 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3*0.3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1*0.3 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3,ads_cst_hywzqlc_pdmworkplanworker_df t4
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid and t3.uuid =t4.op_plan_id
@@ -222,8 +222,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN
         (
         SELECT work_team_nm,person_nm,person_id,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*3*0.3 city_problem_1,
-        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*1*0.3 city_problem_2
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level in('2070004','2070005','2070006','2070007'),1,0))*3*0.3 city_problem_1,
+        sum(if(t2.scene_rating_cd = '2018003' and audit_lvl_cd ='2025002' and t1.problem_level = '2070001',1,0))*1*0.3 city_problem_2
         from
         ads_cst_hywzqlc_pdminspectionproblemrecords_df t1,ads_cst_hywzqlc_pdminspectionrecords_df t2,ads_cst_hywzqlc_pdmworkplan_df t3,ads_cst_hywzqlc_pdmworkplanworker_df t4
         where t1.day_op_info_id = t2.day_op_info_id and  t2.day_op_info_id = t3.uuid and t3.uuid =t4.op_plan_id