Browse Source

近一年案件数

lyq 7 months ago
parent
commit
6ebb989dce

+ 3 - 9
src/main/java/com/sooka/sponest/lawenforcement/record/controller/LawenforcementViewController.java

@@ -23,8 +23,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
-import static com.ruoyi.common.core.utils.DateUtils.getLast30Days;
-import static com.ruoyi.common.core.utils.DateUtils.getLast6Months;
+import static com.ruoyi.common.core.utils.DateUtils.getLastMonths;
 
 
 /**
 /**
  * 可视化Controller
  * 可视化Controller
@@ -65,18 +64,13 @@ public class LawenforcementViewController extends BaseController {
         }
         }
         if ("item".equals(lawenforcementViewBO.getMark())) {
         if ("item".equals(lawenforcementViewBO.getMark())) {
             ExcelUtil<LawenforcementViewItemVO> util = new ExcelUtil<>(LawenforcementViewItemVO.class);
             ExcelUtil<LawenforcementViewItemVO> util = new ExcelUtil<>(LawenforcementViewItemVO.class);
-            util.exportExcel(response, JSONObject.parseArray(JSON.toJSONString(list), LawenforcementViewItemVO.class), "任务类型统计");
+            util.exportExcel(response, JSONObject.parseArray(JSON.toJSONString(list), LawenforcementViewItemVO.class), "执法事项统计");
         }
         }
     }
     }
 
 
     @GetMapping("/getRecordYearMonth")
     @GetMapping("/getRecordYearMonth")
     public R getRecordYearMonth(LawenforcementViewBO lawenforcementViewBO) {
     public R getRecordYearMonth(LawenforcementViewBO lawenforcementViewBO) {
-        if ("dept".equals(lawenforcementViewBO.getMark())) {
-            lawenforcementViewBO.setDates(getLast6Months());
-        }
-        if ("person".equals(lawenforcementViewBO.getMark())) {
-            lawenforcementViewBO.setDates(getLast30Days());
-        }
+        lawenforcementViewBO.setDates(getLastMonths(12));
         return R.ok(lawenforcementViewService.getRecordYearMonth(lawenforcementViewBO));
         return R.ok(lawenforcementViewService.getRecordYearMonth(lawenforcementViewBO));
     }
     }
 }
 }

+ 19 - 18
src/main/resources/mapper/lawenforcement/LawenforcementViewMapper.xml

@@ -109,27 +109,28 @@
     </select>
     </select>
 
 
     <select id="getRecordYearMonth" parameterType="LawenforcementViewBO" resultType="map">
     <select id="getRecordYearMonth" parameterType="LawenforcementViewBO" resultType="map">
-        SELECT a.d, IFNULL(r.total, 0) total, IFNULL(c.lian, 0) lian, IFNULL(e.yujing, 0) yujing FROM (
+        SELECT
+            a.d,
+            IFNULL(r.total, 0) total,
+            IFNULL(c.lian, 0) lian
+        FROM (
         <foreach item="date" collection="dates" open="select" separator="union" close="">
         <foreach item="date" collection="dates" open="select" separator="union" close="">
             #{date} d
             #{date} d
-        </foreach>) a
+        </foreach>
+        ) a
         LEFT JOIN (
         LEFT JOIN (
-        SELECT DATE_FORMAT( FROM_UNIXTIME( SUBSTR( check_start_time, 1, 10 ) ),
-        <if test="mark != null and mark == 'dept'">'%Y-%m'</if>
-        <if test="mark != null and mark == 'person'">'%Y-%m-%d'</if>) d, count(*) total,
-        count(DISTINCT check_object_name) obj
-        FROM lawenforcement_record GROUP BY d) r ON r.d = a.d
+            SELECT
+                DATE_FORMAT( FROM_UNIXTIME( SUBSTR( check_start_time, 1, 10 ) ), '%Y-%m' ) d,
+                count(*) total
+            FROM lawenforcement_record
+            GROUP BY d
+        ) r ON r.d = a.d
         LEFT JOIN (
         LEFT JOIN (
-        SELECT DATE_FORMAT( create_time,
-        <if test="mark != null and mark == 'dept'">'%Y-%m'</if>
-        <if test="mark != null and mark == 'person">'%Y-%m-%d'</if>) d, count(*) lian
-        FROM lawenforcement_case GROUP BY d) c ON c.d = a.d
-        <if test="mark != null and mark == 'dept'">
-            LEFT JOIN (
-            SELECT DATE_FORMAT( create_time,
-            <if test="mark != null and mark == 'dept'">'%Y-%m'</if>
-            <if test="mark != null and mark == 'person'">'%Y-%m-%d'</if>) d, count(*) yujing
-            FROM ${onest_event}.centerevent_t_eventcatalogue WHERE event_type_xl = 1301 GROUP BY d) e ON e.d = a.d
-        </if>
+            SELECT
+                DATE_FORMAT( create_time, '%Y-%m' ) d,
+                count(*) lian
+            FROM lawenforcement_case
+            GROUP BY d
+        ) c ON c.d = a.d
     </select>
     </select>
 </mapper>
 </mapper>