案件信息情况大数据页面接口
This commit is contained in:
parent
7e52595280
commit
cb093a1548
@ -0,0 +1,362 @@
|
||||
package com.cm.systemcity.controller.datarelease;
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
import com.cm.systemcity.dao.datarelease.IDataReleaseDao;
|
||||
import com.cm.systemcity.pojo.dtos.dict.DictDTO;
|
||||
import com.cm.systemcity.service.datarelease.IDataReleaseService;
|
||||
import com.cm.systemcity.service.dict.IDictService;
|
||||
import com.cm.systemcity.utils.BigDataResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 网格治理对外提供数据接口类
|
||||
* @author xwangs
|
||||
* @create 2021-07-22 10:50
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_PREFIX + "网格治理对外提供数据接口类")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/data-external-release")
|
||||
public class DataReleaseController extends AbstractController {
|
||||
|
||||
@Autowired
|
||||
private IDataReleaseService dataReleaseService;
|
||||
@Autowired
|
||||
private IDataReleaseDao dataReleaseDao;
|
||||
@Autowired
|
||||
private IDictService dictService;
|
||||
|
||||
@ApiOperation(value = "案件情况-数量", notes = "案件情况-数量")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-case-report-count-info")
|
||||
public BigDataResult getCaseReportCountInfo(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
// 判断获取哪类案件的标识
|
||||
if(reqParams.get("dataCatalog") == null && reqParams.get("dataCatalog").toString().length() == 0){
|
||||
return new BigDataResult();
|
||||
}
|
||||
String dataCatalog = reqParams.get("dataCatalog").toString();
|
||||
// dept职能部门案件 street街镇案件 person群众上报 special特殊案件
|
||||
// {type:'up',value:98625,percentage:15.6}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
Map<String, Object> query = new HashMap<>(8);
|
||||
Map<String, Object> bdrData = new HashMap<>(8);
|
||||
bdrData.put("value",0);
|
||||
bdrData.put("type","up");
|
||||
bdrData.put("percentage","0");
|
||||
String nowMonth = DateUtil.getDay().substring(0,7);
|
||||
String lastMonth = bdr.lastMonth();
|
||||
query.put("caseStatus","6");
|
||||
query.put("dataCatalog",dataCatalog);
|
||||
switch (dataCatalog){
|
||||
case "dept" :
|
||||
List<Map<String, Object>> deptList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("value",deptList.size());
|
||||
// 本月数据
|
||||
query.put("gmtModified", nowMonth);
|
||||
List<Map<String, Object>> nowMonthList = dataReleaseDao.listReportCase(query);
|
||||
// 上月数据
|
||||
query.put("gmtModified", lastMonth);
|
||||
List<Map<String, Object>> lastMonthList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("type" ,nowMonthList.size() - lastMonthList.size() >= 0 ? "up" : "down");
|
||||
bdrData.put("percentage", Math.abs(nowMonthList.size() - lastMonthList.size()) + "件");
|
||||
break;
|
||||
case "street" :
|
||||
List<Map<String, Object>> streetList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("value",streetList.size());
|
||||
// 本月数据
|
||||
query.put("gmtModified", nowMonth);
|
||||
List<Map<String, Object>> nowMonthStreetList = dataReleaseDao.listReportCase(query);
|
||||
// 上月数据
|
||||
query.put("gmtModified", lastMonth);
|
||||
List<Map<String, Object>> lastMonthStreetList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("type" ,nowMonthStreetList.size() - lastMonthStreetList.size() >= 0 ? "up" : "down");
|
||||
bdrData.put("percentage", Math.abs(nowMonthStreetList.size() - lastMonthStreetList.size()) + "件");
|
||||
break;
|
||||
case "person" :
|
||||
List<Map<String, Object>> personList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("value",personList.size());
|
||||
// 本月数据
|
||||
query.put("gmtModified", nowMonth);
|
||||
List<Map<String, Object>> nowMonthPersonList = dataReleaseDao.listReportCase(query);
|
||||
// 上月数据
|
||||
query.put("gmtModified", lastMonth);
|
||||
List<Map<String, Object>> lastMonthPersonList = dataReleaseDao.listReportCase(query);
|
||||
bdrData.put("type" ,nowMonthPersonList.size() - lastMonthPersonList.size() >= 0 ? "up" : "down");
|
||||
bdrData.put("percentage", Math.abs(nowMonthPersonList.size() - lastMonthPersonList.size()) + "件");
|
||||
break;
|
||||
case "special" :
|
||||
List<Map<String, Object>> specialList = dataReleaseDao.listSpecialReportCase(query);
|
||||
bdrData.put("value",specialList.size());
|
||||
// 本月数据
|
||||
query.put("gmtModified", nowMonth);
|
||||
List<Map<String, Object>> nowMonthSpecialList = dataReleaseDao.listSpecialReportCase(query);
|
||||
// 上月数据
|
||||
query.put("gmtModified", lastMonth);
|
||||
List<Map<String, Object>> lastMonthSpecialList = dataReleaseDao.listSpecialReportCase(query);
|
||||
bdrData.put("type" ,nowMonthSpecialList.size() - lastMonthSpecialList.size() >= 0 ? "up" : "down");
|
||||
bdrData.put("percentage", Math.abs(nowMonthSpecialList.size() - lastMonthSpecialList.size()) + "件");
|
||||
break;
|
||||
default:
|
||||
return bdr;
|
||||
}
|
||||
bdr.setData(bdrData);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "各区域案件占比-包含特殊案件量", notes = "各区域案件占比-包含特殊案件量")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-community-report-case")
|
||||
public BigDataResult getCommunityReportCase(){
|
||||
// {data:{},list:[{name:'万水泉镇',value:300},{name:'民馨路',value:1200},{name:'稀土路',value:3600}],msg:'加载成功',state:'200'}
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
reqParams.put("dictParentId","9d179f05-3ea0-48f7-853c-d3b7124b791c");
|
||||
List<DictDTO> dictDTOS = dictService.listDict(reqParams);
|
||||
if(dictDTOS == null || dictDTOS.size() == 0){
|
||||
return new BigDataResult();
|
||||
}
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
for(DictDTO dictItem : dictDTOS){
|
||||
reqParams.clear();
|
||||
Map<String, Object> resItem = new HashMap<>(8);
|
||||
resItem.put("name",dictItem.getDictName());
|
||||
// 查询该街镇下所有普通案件
|
||||
reqParams.put("areaId",dictItem.getDictId());
|
||||
List<Map<String, Object>> normalList = dataReleaseDao.listReportCase(reqParams);
|
||||
// 查询该街镇下所有特殊案件
|
||||
List<Map<String, Object>> specialList = dataReleaseDao.listSpecialReportCase(reqParams);
|
||||
resItem.put("value",normalList.size() + specialList.size());
|
||||
resList.add(resItem);
|
||||
}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "案件类型TOP10", notes = "案件类型TOP10")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-case-type-top10")
|
||||
public BigDataResult getCaseTypeTop10(){
|
||||
// {data:{nameColumns:['案件数量']},list:[{name:'餐厨垃圾',columns:[3]},{name:'污水管网及井盖养护',columns:[0]},{name:'暂住人口问题',columns:[5]},
|
||||
// {name:'道路交通设施',columns:[5]},{name:'人行道维修养护',columns:[25]}],msg:'加载成功',state:'200'}
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
List<Map<String, Object>> caseTypeList = dataReleaseDao.getCaseTypeTop10(reqParams);
|
||||
if(caseTypeList == null || caseTypeList.size() == 0){
|
||||
return new BigDataResult();
|
||||
}
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
for(Map<String, Object> caseTypeItem : caseTypeList){
|
||||
Map<String, Object> resItem = new HashMap<>(8);
|
||||
resItem.put("name",caseTypeItem.get("dictName").toString());
|
||||
List<Integer> columnsList = new ArrayList<>();
|
||||
columnsList.add(Integer.parseInt(caseTypeItem.get("caseTypeCount").toString()));
|
||||
resItem.put("columns",columnsList);
|
||||
resList.add(resItem);
|
||||
}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
Map<String, Object> resData = new HashMap<>(4);
|
||||
resData.put("caseTypeCount","案件数量");
|
||||
bdr.setData(resData);
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "7日案件进展情况", notes = "7日案件进展情况")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-7day-report-case")
|
||||
public BigDataResult get7DayReportCase(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
// {data:{},list:[{name:'受理',value:585},{name:'立案',value:25},{name:'下派',value:89},{name:'处理',value:856},
|
||||
// {name:'检查',value:856},{name:'归档',value:856}],msg:'加载成功',state:'200'}
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
Map<String, Object> itemMap;
|
||||
String nowDate = DateUtil.getDay();
|
||||
String last7Date = DateUtil.getBeforeDate(7,"yyyy-MM-dd");
|
||||
reqParams.put("modifiedStr",last7Date + " 00:00:00");
|
||||
reqParams.put("modifiedEnd", nowDate + " 00:00:00");
|
||||
// 受理
|
||||
reqParams.put("caseStatusCompareUp","1");
|
||||
List<Map<String, Object>> list1 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "受理");
|
||||
itemMap.put("value", list1 == null ? 0 : list1.size());
|
||||
resList.add(itemMap);
|
||||
// 立案
|
||||
reqParams.put("caseStatusCompareUp","2");
|
||||
List<Map<String, Object>> list2 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "立案");
|
||||
itemMap.put("value", list2 == null ? 0 : list2.size());
|
||||
resList.add(itemMap);
|
||||
// 下派
|
||||
reqParams.put("caseStatusCompareUp","3");
|
||||
List<Map<String, Object>> list3 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "下派");
|
||||
itemMap.put("value", list3 == null ? 0 : list3.size());
|
||||
resList.add(itemMap);
|
||||
// 处理
|
||||
reqParams.put("caseStatusCompareUp","4");
|
||||
List<Map<String, Object>> list4 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "处理");
|
||||
itemMap.put("value", list4 == null ? 0 : list4.size());
|
||||
resList.add(itemMap);
|
||||
// 检查
|
||||
reqParams.put("caseStatusCompareUp","5");
|
||||
List<Map<String, Object>> list5 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "检查");
|
||||
itemMap.put("value", list5 == null ? 0 : list5.size());
|
||||
resList.add(itemMap);
|
||||
// 归档
|
||||
reqParams.put("caseStatusCompareUp","6");
|
||||
List<Map<String, Object>> list6 = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap = new HashMap<>(4);
|
||||
itemMap.put("name", "归档");
|
||||
itemMap.put("value", list6 == null ? 0 : list6.size());
|
||||
resList.add(itemMap);
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "案件处理满意度", notes = "案件处理满意度")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-grade-ratio")
|
||||
public BigDataResult getGradeRatio(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
// {data:{value:96.5},list:[],msg:'加载成功',state:'200'}
|
||||
reqParams.put("caseStatus","6");
|
||||
List<Map<String, Object>> gradeList = dataReleaseDao.listReportCase(reqParams);
|
||||
if(gradeList == null || gradeList.size() == 0){
|
||||
return new BigDataResult();
|
||||
}
|
||||
Integer totalGrade = gradeList.size() * 5;
|
||||
Integer nowGrade = 0;
|
||||
for (Map<String, Object> gradeItem : gradeList){
|
||||
if(gradeItem.get("grade") != null
|
||||
|| !"".equals(gradeItem.get("grade").toString())
|
||||
|| !"null".equals(gradeItem.get("grade").toString())
|
||||
){
|
||||
nowGrade += Integer.parseInt(gradeItem.get("grade").toString());
|
||||
}
|
||||
}
|
||||
BigDecimal ratioBigDecimal = bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2);
|
||||
Map<String, Object> resData = new HashMap<>(4);
|
||||
resData.put("value",ratioBigDecimal.doubleValue());
|
||||
bdr.setData(resData);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "各月份案件情况统计", notes = "各月份案件情况统计")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-month-report-case")
|
||||
public BigDataResult getMonthReportCase(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
// {data:{},list:[{name:' 1月',value:22},{name:'2月',value:'968'},{name:'3月',value:6952},{name:'4月',value:5955},{name:'5月',
|
||||
// value:1204},{name:'6月',value:2054},{name:'7月',value:3250},{name:'8月',value:1048},
|
||||
// {name:'9月',value:458},{name:'10月',value:1520},{name:'11月',value:1952},{name:'12月',value:702},],msg:'加载成功',state:'200'}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
String year = DateUtil.getYear();
|
||||
List<String> monthList = new ArrayList<>();
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
for(int i = 1;i <= 12; i++){
|
||||
if(i < 10){
|
||||
monthList.add(year + "-0" + i);
|
||||
continue;
|
||||
}
|
||||
monthList.add(year + "-" + i);
|
||||
}
|
||||
for(int i = 0; i < monthList.size(); i++){
|
||||
reqParams.clear();
|
||||
reqParams.put("gmtCreateLike", monthList.get(i));
|
||||
Map<String, Object> itemMap = new HashMap<>(4);
|
||||
List<Map<String, Object>> list = dataReleaseDao.listReportCase(reqParams);
|
||||
itemMap.put("name", (i+1) + "月");
|
||||
itemMap.put("value", list == null ? 0 : list.size());
|
||||
resList.add(itemMap);
|
||||
}
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "案件动态", notes = "案件动态")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-report-case-dynamic")
|
||||
public BigDataResult getReportCaseDynamic(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
// {title:'万水泉 ',content:'村名王某因为被隔壁邻居的狗咬了,产生了纠纷,村名报警。',date:'2021-03-15'}
|
||||
// 默认查询10条
|
||||
List<Map<String, Object>> logList = dataReleaseDao.listReportCaseLog(reqParams);
|
||||
if(logList == null || logList.size() == 0){
|
||||
return new BigDataResult();
|
||||
}
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
for (Map<String, Object> logItem : logList){
|
||||
Map<String, Object> resData = new HashMap<>(8);
|
||||
resData.put("title", "【" + logItem.get("optionType").toString() + "】- " + logItem.get("userName").toString());
|
||||
resData.put("date", logItem.get("gmtCreate").toString().substring(0,19));
|
||||
resData.put("content", logItem.get("caseContent").toString());
|
||||
resList.add(resData);
|
||||
}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员实时活跃情况", notes = "人员实时活跃情况")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get-user-dynamic-position")
|
||||
public BigDataResult getUserDynamicPosition(){
|
||||
Map<String,Object> reqParams = requestParams();
|
||||
Date nowData = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
||||
String nowHour = sdf.format(nowData);
|
||||
//nowHour = "10";
|
||||
String nowDate = DateUtil.getDay() + " ";
|
||||
//nowDate = "2021-07-19 ";
|
||||
System.out.println(nowHour);
|
||||
List<Map<String, Object>> resList = new ArrayList<>();
|
||||
// 分割当前小时为6段 10分钟一段 统计活跃人数 最后一段统计59分59秒
|
||||
for(int i = 0; i < 6; i++){
|
||||
Map<String, Object> resData = new HashMap<>(8);
|
||||
Map<String, Object> query = new HashMap<>(8);
|
||||
if(i == 0){
|
||||
query.put("timeStr",nowDate + nowHour + ":00:00");
|
||||
} else {
|
||||
query.put("timeStr",nowDate + nowHour + ":" + (i * 10) + ":00");
|
||||
}
|
||||
if(i == 5){
|
||||
query.put("timeEnd",nowDate + nowHour + ":59:59");
|
||||
query.put("time", nowHour + ":59");
|
||||
resData.put("time", nowHour + ":59");
|
||||
} else {
|
||||
query.put("timeEnd",nowDate + nowHour + ":" + (i + 1) * 10 + ":00");
|
||||
query.put("time", nowHour + ":" + (i + 1) * 10);
|
||||
resData.put("time", nowHour + ":" + (i + 1) * 10);
|
||||
}
|
||||
List<Map<String, Object>> positionList = dataReleaseDao.listUserDynamicPosition(query);
|
||||
resData.put("value", positionList == null ? 0 : positionList.size());
|
||||
resList.add(resData);
|
||||
}
|
||||
BigDataResult bdr = new BigDataResult();
|
||||
bdr.setList(resList);
|
||||
return bdr;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.cm.systemcity.dao.datarelease;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xwangs
|
||||
* @create 2021-07-23 14:00
|
||||
* @description
|
||||
*/
|
||||
@Repository
|
||||
public interface IDataReleaseDao {
|
||||
|
||||
/**
|
||||
* 查询案件数量接口
|
||||
* @param query case_flow_type 1职能部门 2街镇案件(上报人不是微信用户)
|
||||
* case_status 6归档
|
||||
* case_reporter 上报人姓名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listReportCase(Map<String, Object> query);
|
||||
|
||||
/**
|
||||
* 查询特殊案件数量接口
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listSpecialReportCase(Map<String, Object> query);
|
||||
|
||||
/**
|
||||
* 查询案件类型TOP10
|
||||
* @param reqParams
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getCaseTypeTop10(Map<String, Object> reqParams);
|
||||
|
||||
/**
|
||||
* 案件动态查询-log表
|
||||
* @param reqParams
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listReportCaseLog(Map<String, Object> reqParams);
|
||||
|
||||
/**
|
||||
* 实时定位列表查询
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listUserDynamicPosition(Map<String, Object> query);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.cm.systemcity.service.datarelease;
|
||||
|
||||
import com.cm.systemcity.service.BaseService;
|
||||
|
||||
/**
|
||||
* @author xwangs
|
||||
* @create 2021-07-23 11:40
|
||||
* @description
|
||||
*/
|
||||
public interface IDataReleaseService {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.cm.systemcity.service.datarelease.impl;
|
||||
|
||||
import com.cm.systemcity.service.BaseService;
|
||||
import com.cm.systemcity.service.datarelease.IDataReleaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author xwangs
|
||||
* @create 2021-07-23 11:41
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class DataReleaseServiceImpl extends BaseService implements IDataReleaseService {
|
||||
|
||||
}
|
75
src/main/java/com/cm/systemcity/utils/BigDataResult.java
Normal file
75
src/main/java/com/cm/systemcity/utils/BigDataResult.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.cm.systemcity.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BigDataResult {
|
||||
|
||||
private Map<String, Object> data = new HashMap<String, Object>();
|
||||
|
||||
private List<Object> list = new ArrayList<Object>();
|
||||
|
||||
private String msg = "加载成功";
|
||||
|
||||
private String state = "200";
|
||||
|
||||
public static BigDataResult getInstance() {
|
||||
return new BigDataResult();
|
||||
}
|
||||
|
||||
public Map<String, Object> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Map<String, Object> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List getList() {
|
||||
if (list == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg == null ? "" : msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state == null ? "" : state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public BigDecimal getRatio(Double val1, Double val2, int decimal){
|
||||
if(val2 == 0d || val1 == 0d){
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
BigDecimal ratioDecimal = new BigDecimal(( val1 / val2 ) * 100);
|
||||
ratioDecimal.setScale(decimal,BigDecimal.ROUND_HALF_UP);
|
||||
return ratioDecimal;
|
||||
}
|
||||
|
||||
public String lastMonth() {
|
||||
LocalDate today = LocalDate.now();
|
||||
today = today.minusMonths(1);
|
||||
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
return formatters.format(today);
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.systemcity.dao.datarelease.IDataReleaseDao">
|
||||
|
||||
<!-- 查询上报案件 -->
|
||||
<select id="listReportCase" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
city_report_case
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
<if test="caseStatus != null and caseStatus != ''">
|
||||
AND case_status = #{caseStatus}
|
||||
</if>
|
||||
<if test="dataCatalog != null and dataCatalog == 'dept'">
|
||||
AND case_flow_type = '1'
|
||||
</if>
|
||||
<if test="dataCatalog != null and dataCatalog == 'street'">
|
||||
AND case_flow_type = '2'
|
||||
AND case_reporter NOT LIKE CONCAT('%',CONCAT('微信', '%'))
|
||||
</if>
|
||||
<if test="dataCatalog != null and dataCatalog == 'person'">
|
||||
AND case_flow_type = '2'
|
||||
AND case_reporter LIKE CONCAT('%',CONCAT('微信', '%'))
|
||||
</if>
|
||||
<if test="gmtCreateLike != null and gmtCreateLike != ''">
|
||||
AND gmt_create LIKE CONCAT('%',CONCAT(#{gmtCreateLike}, '%'))
|
||||
</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">
|
||||
AND gmt_modified LIKE CONCAT('%',CONCAT(#{gmtModified}, '%'))
|
||||
</if>
|
||||
<if test="areaId != null and areaId !=''">
|
||||
AND area_id = #{areaId}
|
||||
</if>
|
||||
<if test="caseStatusCompareUp != null and caseStatusCompareUp !=''">
|
||||
AND case_status <![CDATA[>=]]> #{caseStatusCompareUp}
|
||||
</if>
|
||||
<if test="modifiedStr != null and modifiedStr !=''">
|
||||
AND gmt_modified <![CDATA[>=]]> #{modifiedStr}
|
||||
</if>
|
||||
<if test="modifiedEnd != null and modifiedEnd !=''">
|
||||
AND gmt_modified <![CDATA[<=]]> #{modifiedEnd}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listSpecialReportCase" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
city_special_report_case
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
<if test="caseStatus != null and caseStatus != ''">
|
||||
AND case_status = #{caseStatus}
|
||||
</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">
|
||||
AND gmt_modified LIKE CONCAT('%',CONCAT(#{gmtModified}, '%'))
|
||||
</if>
|
||||
<if test="areaId != null and areaId !=''">
|
||||
AND area_id = #{areaId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCaseTypeTop10" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
t1.case_type_id caseTypeId,
|
||||
t2.dict_name dictName,
|
||||
COUNT(t1.case_type_id) caseTypeCount
|
||||
FROM
|
||||
city_report_case t1
|
||||
LEFT JOIN city_dict t2 ON t1.case_type_id = t2.dict_id
|
||||
WHERE
|
||||
t1.is_delete = '0'
|
||||
GROUP BY
|
||||
t1.case_type_id,
|
||||
t2.dict_name
|
||||
ORDER BY
|
||||
caseTypeCount DESC
|
||||
LIMIT 0,10
|
||||
</select>
|
||||
|
||||
<select id="listReportCaseLog" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
t1.option_type optionType,
|
||||
t1.user_name userName,
|
||||
t1.gmt_create gmtCreate,
|
||||
t2.case_content caseContent
|
||||
FROM
|
||||
city_report_case_log t1
|
||||
LEFT JOIN city_report_case t2 ON t1.case_id = t2.report_case_id
|
||||
ORDER BY
|
||||
t1.gmt_create DESC
|
||||
LIMIT 0,10
|
||||
</select>
|
||||
|
||||
<select id="listUserDynamicPosition" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
creator,
|
||||
user_name
|
||||
FROM
|
||||
city_user_location
|
||||
WHERE
|
||||
gmt_create <![CDATA[ >= ]]> #{timeStr}
|
||||
AND gmt_create <![CDATA[ <= ]]> #{timeEnd}
|
||||
GROUP BY
|
||||
creator,user_name
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user