Browse Source

统计分析和按季度查询优化

v2
蟑螂恶霸 2 years ago
parent
commit
72f86b4de6
  1. 253
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/analysis/analysis.html
  2. 34
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalController.java
  3. 41
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/StatisticalVo.java
  4. 4
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/StatisticalMapper.java
  5. 7
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalService.java
  6. 49
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalServiceImpl.java
  7. 24
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml
  8. 24
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml
  9. 24
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseLawEnforcementMapper.xml
  10. 52
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalMapper.xml

253
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/analysis/analysis.html

@ -3,48 +3,180 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="zdxtInclude :: header('图表分析')"/> <th:block th:include="zdxtInclude :: header('图表分析')"/>
<link type="text/css" href="/css/stat.css" rel="stylesheet" /> <link type="text/css" href="/css/stat.css" rel="stylesheet"/>
</head> </head>
<body> <body>
<div class="statwrap"> <div class="statwrap">
<h1 class="headtit">深圳市各类行政检查实施情况分析</h1> <h1 class="headtit">深圳市各类行政检查实施情况分析</h1>
<div class="seltime"><i class="icsty"></i><span><select name="year"> <div class="seltime">
<option>2024</option> <i class="icsty"></i>
<option>2023</option> <span><select id="qorm" name="qorm" onchange="selectDate()">
<option>2022</option> <option value="q">季度</option>
</select>年度</span> <option value="m">月度</option>
<span><select name="quarter"> </select>年度</span>
<option>2024-01</option> <span><select id="year" name="year" onchange="selectDate()">
</select>季度</span> <option value="2024">2024</option>
<span><select name="month"> <option value="2023">2023</option>
<option>2024-01</option> <option value="2022">2022</option>
<option>2024-02</option> </select>年度</span>
<option>2024-03</option> <span><select id="quarter" name="quarter" onchange="selectDate()">
</select>月度</span> <option value="q1">1季度</option>
</div> <option value="q2">2季度</option>
<div class="statit"><span id="one1" class="actit" onclick="setTab('one',1,4)">案件数量</span><span id="one2" onclick="setTab('one',2,4)">执法人员</span><span id="one3" onclick="setTab('one',3,4)">检查事项</span><span id="one4" onclick="setTab('one',4,4)" class="hover">企业类型</span></div> <option value="q3">3季度</option>
<div id="con_one_1" class="tab_item" style="display: block;"> <option value="q4">4季度</option>
<div class="chartbox" id="echartRing"></div> </select>季度</span>
<div class="chartbox" id="echartLine"></div> <span><select id="month" name="month" onchange="selectDate()">
<option value="01">1</option>
</div> <option value="02">2</option>
<div id="con_one_2" class="tab_item"> <option value="03">3</option>
</div> <option value="04">4</option>
<option value="05">5</option>
<div id="con_one_3" class="tab_item"> <option value="06">6</option>
</div> <option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>月度</span>
</div>
<div class="statit">
<span id="one1" class="actit" onclick="setTab('one',1,4)">案件数量</span>
<span id="one2" onclick="setTab('one',2,4)">执法人员</span>
<span id="one3" onclick="setTab('one',3,4)">检查事项</span>
<span id="one4" onclick="setTab('one',4,4)" class="hover">企业类型</span>
</div>
<div id="con_one_4" class="tab_item"> <div id="con_one_1" class="tab_item" style="display: block;">
</div> <div class="chartbox" id="echartRing"></div>
<div class="chartbox" id="echartLine"></div>
</div>
<div id="con_one_2" class="tab_item">
<div style="float: left; margin: 2% 2%; width: 100%; height: 100%" id="barEnforcer"></div>
</div>
<div id="con_one_3" class="tab_item">
</div>
<div id="con_one_4" class="tab_item">
<div style="float: left; margin: 2% 2%; width: 100%; height: 100%" id="pieEnterprise"></div>
</div>
</div> </div>
<th:block th:include="zdxtInclude :: footer"/> <th:block th:include="zdxtInclude :: footer"/>
<script type="text/javascript" src="/js/echarts.min.js" ></script> <script type="text/javascript" src="/js/echarts.min.js"></script>
<script type="text/javascript" src="/js/charts-analy.js" ></script> <script type="text/javascript" src="/js/charts-analy.js"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var dataList = [[${statisticalVos}]] var prefix = ctx + "statistical";
window.onload = function () { window.onload = function () {
selectDate();
}
function setTab(name, cursel, n) {
for (i = 1; i <= n; i++) {
var menu = document.getElementById(name + i);
var con = document.getElementById("con_" + name + "_" + i);
menu.className = i == cursel ? "actit" : "";
con.style.display = i == cursel ? "block" : "none";
}
}
function queryCaseAnalysis(qorm, year, quarter, month, month) {
$.ajax({
url: prefix + '/caseAnalysis', //后台url
data: {
"qorm": qorm,
"year": year,
"quarter": quarter,
"month": month,
},
type: "GET",
dataType: 'json',
success: function (data) { //成功,回调函数
caseAnalysis(data.data)
},
error: function (er) { //失败,回调函数
}
});
}
function queryEnforcerAnalysis(qorm, year, quarter, month, month) {
$.ajax({
url: prefix + '/enforcerAnalysis', //后台url
data: {
"qorm": qorm,
"year": year,
"quarter": quarter,
"month": month,
},
type: "GET",
dataType: 'json',
success: function (data) { //成功,回调函数
var names = [];
var values = [];
for (var i=0; i<data.data.length; i++) {
names.push(data.data[i].lawEnforcer);
values.push(data.data[i].total);
}
bar_across("barEnforcer", names, values);
},
error: function (er) { //失败,回调函数
}
});
}
function queryEnterpriseAnalysis(qorm, year, quarter, month, month) {
$.ajax({
url: prefix + '/enterpriseAnalysis', //后台url
data: {
"qorm": qorm,
"year": year,
"quarter": quarter,
"month": month,
},
type: "GET",
dataType: 'json',
success: function (data) { //成功,回调函数
pie_rose("pieEnterprise", [
{value:10, name:'rose1'},
{value:5, name:'rose2'},
{value:15, name:'rose3'},
{value:25, name:'rose4'},
{value:20, name:'rose5'},
{value:35, name:'rose6'},
{value:30, name:'rose7'},
{value:40, name:'rose8'}
]);
console.log("------")
console.log(data);
console.log("------")
var datas = [];
for (var i=0; i<data.data.length; i++) {
datas.push({
value: data.data[i].total,
name: data.data[i].lawEnforcement
});
}
pie_rose("pieEnterprise", datas);
},
error: function (er) { //失败,回调函数
}
});
}
function selectDate() {
var qormElement = document.getElementById("qorm");
var qormValue = qormElement.options[qormElement.selectedIndex].value;
var yearElement = document.getElementById("year");
var yearValue = yearElement.options[yearElement.selectedIndex].value;
var quarterElement = document.getElementById("quarter");
var quarterValue = quarterElement.options[quarterElement.selectedIndex].value;
var monthElement = document.getElementById("month");
var monthValue = monthElement.options[monthElement.selectedIndex].value;
queryCaseAnalysis(qormValue, yearValue, quarterValue, monthValue);
queryEnforcerAnalysis(qormValue, yearValue, quarterValue, monthValue);
queryEnterpriseAnalysis(qormValue, yearValue, quarterValue, monthValue);
}
function caseAnalysis(dataList) {
console.log(dataList) console.log(dataList)
var arr = []; var arr = [];
var arrName = []; var arrName = [];
@ -74,14 +206,57 @@
echartUtil.initSchedule("echartLine"); echartUtil.initSchedule("echartLine");
} }
function setTab(name,cursel,n){ function bar_across(targetId, names, values) {
for(i=1;i<=n;i++){ var myChart = echarts.init(document.getElementById(targetId));
var menu=document.getElementById(name+i); var option = {
var con=document.getElementById("con_"+name+"_"+i); tooltip : { trigger: 'axis' },
menu.className=i==cursel?"actit":""; xAxis : [{ type : 'value', }],
con.style.display=i==cursel?"block":"none"; yAxis : [{
type : 'category',
data : names,
}],
series : [{
type:'bar',
data: values,
itemStyle: { //图形样式
normal: { //normal 图形在默认状态下的样式;
barBorderRadius: 10, //柱条圆角半径,单位px.
}
},
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
myChart.resize();
window.addEventListener('resize', () => { myChart.resize(); });
}
function pie_rose(targetId, datas) {
var myChart = echarts.init(document.getElementById(targetId));
option = {
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
toolbox: {
show : true,
},
calculable : true,
series : [
{
name:'面积模式',
type:'pie',
roseType : 'area',
data: datas
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
myChart.resize();
window.addEventListener('resize', () => { myChart.resize(); });
} }
}
</script> </script>
</body> </body>
</html> </html>

34
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalController.java

@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,8 +38,8 @@ public class StatisticalController {
*/ */
@GetMapping("/analysis") @GetMapping("/analysis")
public String analysis(StatisticalVo statisticalVo,ModelMap mmp){ public String analysis(StatisticalVo statisticalVo,ModelMap mmp){
List<StatisticalVo> statisticalVos = statisticalService.StatisticalCaseload(statisticalVo); // List<StatisticalVo> statisticalVos = statisticalService.StatisticalCaseload(statisticalVo);
mmp.put("statisticalVos",statisticalVos); // mmp.put("statisticalVos",statisticalVos);
return prefix2 + "/analysis"; return prefix2 + "/analysis";
} }
/** /**
@ -51,4 +52,33 @@ public class StatisticalController {
Map<String, Object> map = statisticalService.statisticalData(statisticalVo); Map<String, Object> map = statisticalService.statisticalData(statisticalVo);
return ZDResponse.success("查询成功",map); return ZDResponse.success("查询成功",map);
} }
@GetMapping("/checkAnalysis")
@ResponseBody
public ZDResponse checkAnalysis(StatisticalVo statisticalVo){
List<StatisticalVo> statisticalVos = statisticalService.StatisticalCaseload(statisticalVo);
return ZDResponse.success("查询成功", statisticalVos);
}
@GetMapping("/caseAnalysis")
@ResponseBody
public ZDResponse caseAnalysis(StatisticalVo statisticalVo){
List<StatisticalVo> statisticalVos = statisticalService.caseAnalysis(statisticalVo);
return ZDResponse.success("查询成功", statisticalVos);
}
@GetMapping("/enforcerAnalysis")
@ResponseBody
public ZDResponse enforcerAnalysis(StatisticalVo statisticalVo){
List<StatisticalVo> statisticalVos = statisticalService.enforcerAnalysis(statisticalVo);
return ZDResponse.success("查询成功", statisticalVos);
}
@GetMapping("/enterpriseAnalysis")
@ResponseBody
public ZDResponse enterpriseAnalysis(StatisticalVo statisticalVo){
List<StatisticalVo> statisticalVos = statisticalService.enterpriseAnalysis(statisticalVo);
return ZDResponse.success("查询成功", statisticalVos);
}
} }

41
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/StatisticalVo.java

@ -43,6 +43,47 @@ public class StatisticalVo extends BaseDomain {
*/ */
private Integer complaintCount; private Integer complaintCount;
/** 季度 或 月度 */
private String qorm;
/** 年 */
private String year;
/** 季 */
private String quarter;
/** 月 */
private String month;
public String getQorm() {
return qorm;
}
public void setQorm(String qorm) {
this.qorm = qorm;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getQuarter() {
return quarter;
}
public void setQuarter(String quarter) {
this.quarter = quarter;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public String getLawEnforcement() { public String getLawEnforcement() {
return lawEnforcement; return lawEnforcement;
} }

4
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/StatisticalMapper.java

@ -42,4 +42,8 @@ public interface StatisticalMapper {
* @return * @return
*/ */
StatisticalVo statisticalToMouth(StatisticalVo statisticalVo); StatisticalVo statisticalToMouth(StatisticalVo statisticalVo);
List<StatisticalVo> caseAnalysis(StatisticalVo statisticalVo);
List<StatisticalVo> enforcerAnalysis(StatisticalVo statisticalVo);
List<StatisticalVo> enterpriseAnalysis(StatisticalVo statisticalVo);
} }

7
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalService.java

@ -21,4 +21,11 @@ public interface StatisticalService {
*/ */
Map<String,Object> statisticalData(StatisticalVo statisticalVo); Map<String,Object> statisticalData(StatisticalVo statisticalVo);
/** 统计案件数量 */
List<StatisticalVo> caseAnalysis(StatisticalVo statisticalVo);
/** 统计执法人员案件数量 */
List<StatisticalVo> enforcerAnalysis(StatisticalVo statisticalVo);
/** 统计案件中的企业类型 */
List<StatisticalVo> enterpriseAnalysis(StatisticalVo statisticalVo);
} }

49
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalServiceImpl.java

@ -9,6 +9,7 @@ import com.zdxt.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,7 +26,6 @@ public class StatisticalServiceImpl implements StatisticalService
@Override @Override
public List<StatisticalVo> StatisticalCaseload(StatisticalVo statisticalVo) { public List<StatisticalVo> StatisticalCaseload(StatisticalVo statisticalVo) {
List<StatisticalVo> statisticalVos = statisticalMapper.StatisticalCaseload(statisticalVo); List<StatisticalVo> statisticalVos = statisticalMapper.StatisticalCaseload(statisticalVo);
return statisticalVos; return statisticalVos;
} }
@ -57,4 +57,51 @@ public class StatisticalServiceImpl implements StatisticalService
dataList.put("mouth",statisticalVos3); dataList.put("mouth",statisticalVos3);
return dataList; return dataList;
} }
@Override
public List<StatisticalVo> caseAnalysis(StatisticalVo statisticalVo) {
this.putParams(statisticalVo);
List<StatisticalVo> statisticalVos = statisticalMapper.caseAnalysis(statisticalVo);
return statisticalVos;
}
@Override
public List<StatisticalVo> enforcerAnalysis(StatisticalVo statisticalVo) {
this.putParams(statisticalVo);
List<StatisticalVo> statisticalVos = statisticalMapper.enforcerAnalysis(statisticalVo);
return statisticalVos;
}
@Override
public List<StatisticalVo> enterpriseAnalysis(StatisticalVo statisticalVo) {
this.putParams(statisticalVo);
List<StatisticalVo> statisticalVos = statisticalMapper.enterpriseAnalysis(statisticalVo);
return statisticalVos;
}
private void putParams(StatisticalVo statisticalVo) {
Map<String, Object> params = statisticalVo.getParams();
if ("q".equals(statisticalVo.getQorm())) {
switch (statisticalVo.getQuarter()){
case "q1":
params.put("startDate", statisticalVo.getYear()+"-01");
params.put("endDate", statisticalVo.getYear()+"-03");
break;
case "q2":
params.put("startDate", statisticalVo.getYear()+"-04");
params.put("endDate", statisticalVo.getYear()+"-06");
break;
case "q3":
params.put("startDate", statisticalVo.getYear()+"-07");
params.put("endDate", statisticalVo.getYear()+"-09");
break;
case "q4":
params.put("startDate", statisticalVo.getYear()+"-10");
params.put("endDate", statisticalVo.getYear()+"-12");
break;
}
} else if ("m".equals(statisticalVo.getQorm())) {
params.put("yearMonth", statisticalVo.getYear()+'-'+statisticalVo.getMonth());
}
}
} }

24
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml

@ -46,20 +46,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if> </if>
<if test="dateType != null and dateType == 2"> <if test="dateType != null and dateType == 2">
and create_time >= CONCAT(YEAR(CURDATE()), '-', AND DATE_FORMAT(enforcement_time, '%Y-%m') >= CONCAT(YEAR(CURDATE()), '-',
CASE WHEN QUARTER(CURDATE()) IN (1) THEN 2 CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01'
WHEN QUARTER(CURDATE()) IN (2) THEN 4 WHEN QUARTER(CURDATE()) IN (2) THEN '04'
WHEN QUARTER(CURDATE()) IN (3) THEN 7 WHEN QUARTER(CURDATE()) IN (3) THEN '07'
ELSE 10 END, '-01') ELSE '10' END)
and create_time &lt;= CONCAT(YEAR(CURDATE()), '-', and DATE_FORMAT(enforcement_time, '%Y-%m') <= CONCAT(YEAR(CURDATE()), '-',
CASE CASE
WHEN QUARTER(CURDATE()) IN (1) THEN 3 WHEN QUARTER(CURDATE()) IN (1) THEN '03'
WHEN QUARTER(CURDATE()) IN (2) THEN 6 WHEN QUARTER(CURDATE()) IN (2) THEN '06'
WHEN QUARTER(CURDATE()) IN (3) THEN 9 WHEN QUARTER(CURDATE()) IN (3) THEN '09'
ELSE 12 ELSE '12'
END, END)
'-',
DAY(LAST_DAY(CURDATE())))
</if> </if>
<if test="dateType != null and dateType == 3"> <if test="dateType != null and dateType == 3">
and DATE_FORMAT(create_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y') and DATE_FORMAT(create_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y')

24
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml

@ -86,20 +86,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(enforcement_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') and DATE_FORMAT(enforcement_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if> </if>
<if test="dateType != null and dateType == 2"> <if test="dateType != null and dateType == 2">
and enforcement_time >= CONCAT(YEAR(CURDATE()), '-', AND DATE_FORMAT(enforcement_time, '%Y-%m') >= CONCAT(YEAR(CURDATE()), '-',
CASE WHEN QUARTER(CURDATE()) IN (1) THEN 2 CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01'
WHEN QUARTER(CURDATE()) IN (2) THEN 4 WHEN QUARTER(CURDATE()) IN (2) THEN '04'
WHEN QUARTER(CURDATE()) IN (3) THEN 7 WHEN QUARTER(CURDATE()) IN (3) THEN '07'
ELSE 10 END, '-01') ELSE '10' END)
and enforcement_time &lt;= CONCAT(YEAR(CURDATE()), '-', and DATE_FORMAT(enforcement_time, '%Y-%m') <= CONCAT(YEAR(CURDATE()), '-',
CASE CASE
WHEN QUARTER(CURDATE()) IN (1) THEN 3 WHEN QUARTER(CURDATE()) IN (1) THEN '03'
WHEN QUARTER(CURDATE()) IN (2) THEN 6 WHEN QUARTER(CURDATE()) IN (2) THEN '06'
WHEN QUARTER(CURDATE()) IN (3) THEN 9 WHEN QUARTER(CURDATE()) IN (3) THEN '09'
ELSE 12 ELSE '12'
END, END)
'-',
DAY(LAST_DAY(CURDATE())))
</if> </if>
<if test="dateType != null and dateType == 3"> <if test="dateType != null and dateType == 3">
and DATE_FORMAT(enforcement_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y') and DATE_FORMAT(enforcement_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y')

24
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseLawEnforcementMapper.xml

@ -72,20 +72,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(check_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') and DATE_FORMAT(check_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if> </if>
<if test="dateType != null and dateType == 2"> <if test="dateType != null and dateType == 2">
and check_time >= CONCAT(YEAR(CURDATE()), '-', AND DATE_FORMAT(enforcement_time, '%Y-%m') >= CONCAT(YEAR(CURDATE()), '-',
CASE WHEN QUARTER(CURDATE()) IN (1) THEN 2 CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01'
WHEN QUARTER(CURDATE()) IN (2) THEN 4 WHEN QUARTER(CURDATE()) IN (2) THEN '04'
WHEN QUARTER(CURDATE()) IN (3) THEN 7 WHEN QUARTER(CURDATE()) IN (3) THEN '07'
ELSE 10 END, '-01') ELSE '10' END)
and check_time &lt;= CONCAT(YEAR(CURDATE()), '-', and DATE_FORMAT(enforcement_time, '%Y-%m') <= CONCAT(YEAR(CURDATE()), '-',
CASE CASE
WHEN QUARTER(CURDATE()) IN (1) THEN 3 WHEN QUARTER(CURDATE()) IN (1) THEN '03'
WHEN QUARTER(CURDATE()) IN (2) THEN 6 WHEN QUARTER(CURDATE()) IN (2) THEN '06'
WHEN QUARTER(CURDATE()) IN (3) THEN 9 WHEN QUARTER(CURDATE()) IN (3) THEN '09'
ELSE 12 ELSE '12'
END, END)
'-',
DAY(LAST_DAY(CURDATE())))
</if> </if>
<if test="dateType != null and dateType == 3"> <if test="dateType != null and dateType == 3">
and DATE_FORMAT(check_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y') and DATE_FORMAT(check_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y')

52
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalMapper.xml

@ -111,4 +111,56 @@
</where> </where>
</select> </select>
<select id="caseAnalysis" parameterType="StatisticalVo" resultMap="StatisticalVoResult">
select law_enforcement,count(1) as total from enforcement_registration
<where>
<if test="params.startDate != null and params.startDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m') &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m') &lt;= #{params.endDate}
</if>
<if test="params.yearMonth != null and params.yearMonth != ''">
AND DATE_FORMAT(create_time, '%Y-%m') = #{params.yearMonth}
</if>
</where>
GROUP BY law_enforcement_id
</select>
<select id="enforcerAnalysis" parameterType="StatisticalVo" resultMap="StatisticalVoResult">
select law_enforcer,count(1) as total from enforcement_registration
<where>
<if test="params.startDate != null and params.startDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m') &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m') &lt;= #{params.endDate}
</if>
<if test="params.yearMonth != null and params.yearMonth != ''">
AND DATE_FORMAT(create_time, '%Y-%m') = #{params.yearMonth}
</if>
</where>
GROUP BY law_enforcer_id
</select>
<select id="enterpriseAnalysis" parameterType="StatisticalVo" resultMap="StatisticalVoResult">
SELECT i.company_org_type as law_enforcement, count(1) as total FROM enforcement_registration r
LEFT JOIN enterprise_information i
ON i.enterprise_number = r.enterprise_number
<where>
<if test="params.startDate != null and params.startDate != ''">
AND DATE_FORMAT(r.create_time, '%Y-%m') &gt;= #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
AND DATE_FORMAT(r.create_time, '%Y-%m') &lt;= #{params.endDate}
</if>
<if test="params.yearMonth != null and params.yearMonth != ''">
AND DATE_FORMAT(r.create_time, '%Y-%m') = #{params.yearMonth}
</if>
</where>
GROUP BY i.company_org_type
</select>
</mapper> </mapper>
Loading…
Cancel
Save