Browse Source

派出所大屏功能

dev_ycq
OUMYYE\Administrator 2 years ago
parent
commit
02c6882720
  1. 6
      mailbox-common/src/main/java/com/biutag/enums/DeptTypeEnum.java
  2. 63
      mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java
  3. 19
      mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java
  4. 96
      mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java
  5. 29
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java
  6. 19
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java
  7. 112
      mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

6
mailbox-common/src/main/java/com/biutag/enums/DeptTypeEnum.java

@ -20,7 +20,11 @@ public enum DeptTypeEnum {
BW_TYPE("4", "部委警校"),
// 三级机构领导
SD_TYPE("5", "所队");
PCS_TYPE("5", "派出所"),
// 二级机构领导
DD_TYPE("6", "大队");
// 三级机构领导
private String type;

63
mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java

@ -11,6 +11,8 @@ import com.biutag.lan.service.DataScreenService;
import com.biutag.lan.service.IDutyService;
import com.biutag.lan.service.IIndexService;
import com.biutag.util.DateUtils;
import com.biutag.util.StringUtils;
import com.google.gson.JsonObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
@ -37,53 +39,66 @@ public class DataScreenController {
@NotLogin
@GetMapping("/mapData")
@ApiOperation(value="地图数据")
@ApiOperation(value="大屏地图数据")
public AjaxResult<List<Map<String, Object>>> mapData(@RequestParam Map<String,Object> params) {
if(params.size()==0){
return AjaxResult.success(dataScreenService.mapData(null));
}else {
String deptId= params.get("id").toString();
return AjaxResult.success(dataScreenService.mapCountyData(deptId));
}
return AjaxResult.success(dataScreenService.mapData(null));
}
}
@NotLogin
@GetMapping("/currentCountyMapJSON")
@ApiOperation(value="地图边界JSON数据")
public AjaxResult< Map<String,String> > currentCountyMapJSON(@RequestParam Map<String,Object> params) {
;
return AjaxResult.success(dataScreenService.currentCountyMapJSON(params));
}
@NotLogin
@GetMapping("/peopleMail")
@ApiOperation(value="群众来信")
public AjaxResult<List<Mail>> peopleMail() {
return AjaxResult.success(dataScreenService.selectRecentlyMailList());
public AjaxResult<List<Mail>> peopleMail(@RequestParam Map<String,Object> params) {
return AjaxResult.success(dataScreenService.selectRecentlyMailList(params));
}
@NotLogin
@GetMapping("/consoleData")
@ApiOperation(value="大屏数据")
public AjaxResult<Map<String, Object>> consoleData() {
return AjaxResult.success(dataScreenService.consoleData(null));
public AjaxResult<Map<String, Object>> consoleData(@RequestParam Map<String,Object> params) {
return AjaxResult.success(dataScreenService.consoleData(params));
}
@NotLogin
@GetMapping("/dutyDay")
@ApiOperation(value="今日值班")
public AjaxResult<Map<String, Object>> dutyDay() {
Map<String, Object> map =new HashMap<>();
List<Duty> dutySjList = iDutyService.getSameDayDuty(DeptTypeEnum.SJ_TYPE.getType());
List<Duty> dutyFjList = iDutyService.getSameDayDuty(DeptTypeEnum.FJ_TYPE.getType());
List<Duty> dutyZdList = iDutyService.getSameDayDuty(DeptTypeEnum.ZD_TYPE.getType());
List<Duty> dutyBwList = iDutyService.getSameDayDuty(DeptTypeEnum.BW_TYPE.getType());
map.put("dutySjList",dutySjList);
map.put("dutyFjList",dutyFjList);
map.put("dutyZdList",dutyZdList);
map.put("dutyBwList",dutyBwList);
return AjaxResult.success(map);
public AjaxResult<Map<String, Object>> dutyDay(@RequestParam Map<String,String> params) {
return AjaxResult.success(dataScreenService.getToDayDuty(params));
}
@NotLogin
@GetMapping("/threeRate")
@ApiOperation(value="三率")
public AjaxResult<Map<String, Object>> threeRate() {
public AjaxResult<Map<String, Object>> threeRate(@RequestParam Map<String,String> params) {
Map<String, Object> map =new HashMap<>();
List<Map<String, String>> completeList = dataScreenService.getCompletedRate();
List<Map<String, String>> satisfiedList = dataScreenService.getSatisfiedRate();
List<Map<String, String>> resolvedList = dataScreenService.getResolvedRate();
List<Map<String, String>> completeList = new ArrayList<>();
List<Map<String, String>> satisfiedList = new ArrayList<>();
List<Map<String, String>> resolvedList = new ArrayList<>();
if(params.size()>0){
String deptId=params.get("id");
completeList = dataScreenService.getStationCompletedRateByDept(deptId);
satisfiedList = dataScreenService.getStationSatisfiedRateByDept(deptId);
resolvedList = dataScreenService.getStationResolvedRateByDept(deptId);
}else{
completeList = dataScreenService.getCompletedRate();
satisfiedList = dataScreenService.getSatisfiedRate();
resolvedList = dataScreenService.getResolvedRate();
}
map.put("completeList",completeList);
map.put("satisfiedList",satisfiedList);
map.put("resolvedList",resolvedList);
@ -102,8 +117,8 @@ public class DataScreenController {
@NotLogin
@GetMapping("/mailTypeRank")
@ApiOperation(value="信件类型排行")
public AjaxResult< List<Map<String, Object>>> mailTypeRank() {
return AjaxResult.success(dataScreenService.mailTypeRank());
public AjaxResult< List<Map<String, Object>>> mailTypeRank(@RequestParam Map<String,Object> params) {
return AjaxResult.success(dataScreenService.mailTypeRank(params));
}

19
mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.entity.system.Duty;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailSource;
import com.biutag.lan.domain.Work;
@ -20,13 +21,15 @@ public interface DataScreenMapper extends BaseMapper<Mail> {
List<Map<String,Object>> mapData(String deptId);
List<Map<String,Object>> mapCountyData(String deptId);
/**
* 最近信件
* @return
*/
List<Mail> selectRecentlyMailList();
List<Mail> selectRecentlyMailList(Map<String,Object> params);
Map<String,String> currentCountyMapJSON(@Param("deptId") String deptId);
/**
* 获取三率
* @return
@ -125,13 +128,17 @@ public interface DataScreenMapper extends BaseMapper<Mail> {
* @param
* @return
*/
List< Map<String,Object>> mailTypeRank();
List< Map<String,Object>> mailTypeRank(Map<String,Object> params);
List< Map<String,Object>> getMailDayTrend(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("deptId") String deptId);
List< Map<String,Object>> getMailWeekTrend(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("deptId") String deptId);
List< Map<String,Object>> getMailMonthTrend(@Param("year") String year,@Param("deptId") String deptId);
List< Map<String,Object>> getMailDayTrend(@Param("startDate") String startDate,@Param("endDate") String endDate);
List< Map<String,Object>> getMailWeekTrend(@Param("startDate") String startDate,@Param("endDate") String endDate);
List< Map<String,Object>> getMailMonthTrend(@Param("year") String year);
List<Duty> getToDayDuty(@Param("depatType") String depatType,@Param("deptId") String deptId);
}

96
mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java

@ -1,9 +1,14 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.entity.system.Duty;
import com.biutag.enums.DeptTypeEnum;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.mapper.DataScreenMapper;
import com.biutag.util.DateUtils;
import com.biutag.util.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -19,10 +24,24 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
return baseMapper.mapData(deptId);
}
public List<Map<String,Object>> mapCountyData(String deptId){
return baseMapper.mapCountyData(deptId);
}
public Map<String,String> currentCountyMapJSON(Map<String,Object> params){
if(params.size()==0) {
public List<Mail> selectRecentlyMailList() {
return baseMapper.currentCountyMapJSON("1");
}else{
String deptId= params.get("id").toString();
return baseMapper.selectRecentlyMailList();
return baseMapper.currentCountyMapJSON(deptId);
}
}
public List<Mail> selectRecentlyMailList(Map<String,Object> params) {
return baseMapper.selectRecentlyMailList(params);
}
/**
@ -76,22 +95,37 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
public List<Map<String,String>> getStationSatisfiedRateByDept(String deptId){
return baseMapper.getStationSatisfiedRateByDept(deptId);
}
public Map<String, Object> consoleData(String deptId) {
Map<String, Object> mapCompleted = baseMapper.getAllCompletedRate(null);//获取长沙市局 办结率
Map<String, Object> mapResolved = baseMapper.getAllResolvedRate(null);//获取长沙市局 解决率
Map<String, Object> mapSatisfied = baseMapper.getAllSatisfiedRate(null);//获取长沙市局 满意率
Integer allSum =baseMapper.getAllMailCount(null);
Integer toDayCount=baseMapper.getTodayMailCount(null);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
mapCompleted.put("todaySum",toDayCount);
mapCompleted.put("allSum",allSum);
return mapCompleted;
public Map<String, Object> consoleData(Map<String,Object> params) {
if(params.size()==0) {
Map<String, Object> mapCompleted = baseMapper.getAllCompletedRate(null);//获取长沙市局 办结率
Map<String, Object> mapResolved = baseMapper.getAllResolvedRate(null);//获取长沙市局 解决率
Map<String, Object> mapSatisfied = baseMapper.getAllSatisfiedRate(null);//获取长沙市局 满意率
Integer allSum = baseMapper.getAllMailCount(null);
Integer toDayCount = baseMapper.getTodayMailCount(null);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
mapCompleted.put("todaySum", toDayCount);
mapCompleted.put("allSum", allSum);
return mapCompleted;
}else{
String deptId= params.get("id").toString();
Map<String, Object> mapCompleted = baseMapper.getAllCompletedRate(deptId);//获取长沙市局 办结率
Map<String, Object> mapResolved = baseMapper.getAllResolvedRate(deptId);//获取长沙市局 解决率
Map<String, Object> mapSatisfied = baseMapper.getAllSatisfiedRate(deptId);//获取长沙市局 满意率
Integer allSum = baseMapper.getAllMailCount(deptId);
Integer toDayCount = baseMapper.getTodayMailCount(deptId);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
mapCompleted.put("todaySum", toDayCount);
mapCompleted.put("allSum", allSum);
return mapCompleted;
}
}
public List<Map<String,Object>> mailTypeRank(){
return baseMapper.mailTypeRank();
public List<Map<String,Object>> mailTypeRank(Map<String,Object> params){
return baseMapper.mailTypeRank(params);
}
public Map<String,Object> getMailTrend( Map<String,Object> params){
@ -107,7 +141,8 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
});
String endDayDataStr=DateUtils.formatDate(endDayDate,"yyyy-MM-dd")+ " 23:59:59";
String startDayDateStr=DateUtils.formatDate(startDayDate,"yyyy-MM-dd")+ " 00:00:00";
List< Map<String,Object>> dayDataList= baseMapper.getMailDayTrend(startDayDateStr,endDayDataStr);
String deptId=StringUtils.isNull(params.get("id"))? null:params.get("id").toString();
List< Map<String,Object>> dayDataList= baseMapper.getMailDayTrend(startDayDateStr,endDayDataStr,deptId);
List<Object> dayYList= new ArrayList<>();
AtomicReference<Boolean> dayTrue= new AtomicReference<>(true);
dayXList.forEach(date-> {
@ -130,7 +165,7 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
Date startWeekDate = DateUtils.getAddDate(endDayDate, Calendar.WEEK_OF_YEAR, -(Integer.valueOf(params.get("week").toString())));
String startWeekDateStr=DateUtils.formatDate(startWeekDate,"yyyy-MM-dd")+ " 00:00:00";
List<String> weekXList= DateUtils.findWeeKDates(startWeekDate,endDayDate);
List< Map<String,Object>> weekDataList= baseMapper.getMailWeekTrend(startWeekDateStr,endDayDataStr);
List< Map<String,Object>> weekDataList= baseMapper.getMailWeekTrend(startWeekDateStr,endDayDataStr,deptId);
List<Object> weekYList= new ArrayList<>();
AtomicReference<Boolean> weekTrue= new AtomicReference<>(true);
weekXList.forEach(date-> {
@ -152,7 +187,7 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
//按月
String year=params.get("year").toString();
List<Integer> monthXList= DateUtils.getMonthList(Integer.valueOf(year));
List<Map<String,Object>> monthDataList= baseMapper.getMailMonthTrend(year);
List<Map<String,Object>> monthDataList= baseMapper.getMailMonthTrend(year,deptId);
List<Object> monthYList= new ArrayList<>();
AtomicReference<Boolean> monthTrue= new AtomicReference<>(true);
monthXList.forEach(month-> {
@ -172,5 +207,28 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
return dataMap;
}
public Map<String, Object> getToDayDuty(Map<String,String> params){
Map<String, Object> map =new HashMap<>();
if(params.size()==0){
List<Duty> dutySjList = baseMapper.getToDayDuty(DeptTypeEnum.SJ_TYPE.getType(),null);
List<Duty> dutyFjList = baseMapper.getToDayDuty(DeptTypeEnum.FJ_TYPE.getType(),null);
List<Duty> dutyZdList = baseMapper.getToDayDuty(DeptTypeEnum.ZD_TYPE.getType(),null);
List<Duty> dutyBwList = baseMapper.getToDayDuty(DeptTypeEnum.BW_TYPE.getType(),null);
map.put("dutySjList",dutySjList);
map.put("dutyFjList",dutyFjList);
map.put("dutyZdList",dutyZdList);
map.put("dutyBwList",dutyBwList);
}else {
String deptId=StringUtils.isNull(params.get("id"))? null:params.get("id").toString();
List<Duty> dutySjList = baseMapper.getToDayDuty(DeptTypeEnum.SJ_TYPE.getType(),null);
List<Duty> dutyFjList = baseMapper.getToDayDuty(DeptTypeEnum.FJ_TYPE.getType(),deptId);
List<Duty> dutyPcsList = baseMapper.getToDayDuty(DeptTypeEnum.PCS_TYPE.getType(),deptId);
List<Duty> dutyDdList = baseMapper.getToDayDuty(DeptTypeEnum.DD_TYPE.getType(),deptId);
map.put("dutySjList",dutySjList);
map.put("dutyFjList",dutyFjList);
map.put("dutyPcsList",dutyPcsList);
map.put("dutyDdList",dutyDdList);
}
return map;
}
}

29
mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java

@ -21,6 +21,7 @@ import com.biutag.mapper.system.DutyMapper;
import com.biutag.mapper.setting.DictDataMapper;
import com.biutag.mapper.system.DeptMapper;
import com.biutag.mapper.system.PoliceUserMapper;
import com.biutag.util.StringUtils;
import com.biutag.util.TimeUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
@ -66,16 +67,26 @@ public class DutyServiceImpl implements IDutyService {
QueryWrapper<Duty> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("create_time");
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:departName@depart_name:str",
"like:policeName@police_name:str",
"like:mobile:str",
"like:empNo@emp_no:str",
"=:deptType@dept_type:str",
"<=:searchTime@start_time:str",
">=:searchTime@end_time:str",
});
if(StringUtils.isNotEmpty(searchValidate.getSearchTime()) ) {
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:departName@depart_name:str",
"like:policeName@police_name:str",
"like:mobile:str",
"like:empNo@emp_no:str",
"=:deptType@dept_type:str",
"<=:searchTime@start_time:str",
">=:searchTime@end_time:str",
});
}else{
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:departName@depart_name:str",
"like:policeName@police_name:str",
"like:mobile:str",
"like:empNo@emp_no:str",
"=:deptType@dept_type:str",
});
}
IPage<Duty> iPage = dutyMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<DutyListedVo> list = new LinkedList<>();

19
mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java

@ -13,6 +13,7 @@ import com.biutag.lan.vo.system.HolidayDetailVo;
import com.biutag.core.PageResult;
import com.biutag.entity.system.Holiday;
import com.biutag.mapper.system.HolidayMapper;
import com.biutag.util.StringUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -46,11 +47,19 @@ public class HolidayServiceImpl implements IHolidayService {
QueryWrapper<Holiday> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id");
holidayMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:holidayName@holiday_name:str",
"<=:searchDate@start_date:str",
">=:searchDate@end_date:str",
});
if(StringUtils.isNotEmpty(searchValidate.getSearchDate()) ) {
holidayMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:holidayName@holiday_name:str",
"<=:searchDate@start_date:str",
">=:searchDate@end_date:str",
});
}else{
holidayMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:holidayName@holiday_name:str",
});
}
IPage<Holiday> iPage = holidayMapper.selectPage(new Page<>(page, limit), queryWrapper);

112
mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

@ -10,7 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.id,contact_name,contact_phone,a.create_time ,b.name mail_state from mail a
left join dict_data b on a.mail_state=b.value
left join mail_mark c on a.id=c.mail_id
/* where c.resolved ='1' or satisfied='1'*/
where 1=1
<if test="id != null and id != ''"> and a.second_dept_id=#{id} </if>
/*c.resolved ='1' or satisfied='1'*/
order by a.create_time desc limit 20;
</select>
@ -18,13 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY second_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
GROUP BY second_dept_name order by rateNumber desc limit 10
</select>
<select id="getResolvedRate" resultType="java.util.Map">
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
select b.second_dept_name name,
CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2' GROUP BY second_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
GROUP BY second_dept_name order by rateNumber desc limit 10
</select>
<select id="getSatisfiedRate" resultType="java.util.Map">
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
@ -38,35 +44,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
<select id="getStationResolvedRateByDept" resultType="java.util.Map" parameterType="String">
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
<select id="getStationSatisfiedRateByDept" resultType="java.util.Map" parameterType="String">
select b.three_dept_name name,CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') rate,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.id=b.three_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc limit 10
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
</select>
<select id="getTodayMailCount" resultType="Integer" parameterType="String">
select count(1) mailCount from mail where create_time>=CURRENT_DATE
<if test="deptId != null and deptId != ''">and second_dep_id=#{deptId} </if>
<if test="deptId != null and deptId != ''">and second_dept_id=#{deptId} </if>
</select>
<select id="getAllMailCount" resultType="Integer">
select count(1) as countSum from mail_mark
select count(1) as countSum from mail_mark where 1=1 <if test="deptId != null and deptId != ''">and second_dept_id=#{deptId} </if>
</select>
<select id="getResolvedRateByDeptId" resultType="java.util.Map" >
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
select b.second_dept_name name,CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') rate,SUM(COALESCE(b.resolved, 0)) resolved,
count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where a.category='2'
<if test="deptId != null and deptId != ''">and b.second_dept_id=#{deptId} GROUP BY second_dept_name </if>
@ -89,14 +96,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != ''"> and a.category='2' and b.second_dept_id=#{deptId} GROUP BY second_dept_name</if>
</select>
<select id="mailTypeRank" resultType="java.util.Map">
select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber , mail_first_category category,count(1) sumCount ,CONCAT(ROUND(count(1)*100/(select count(1) from mail),0),'%') countRate
from mail group by mail_first_category limit 10
<select id="mailTypeRank" resultType="java.util.Map" parameterType="java.util.Map">
select ROW_NUMBER() OVER (ORDER BY sumCount desc) AS rowNumber ,
mail_first_category category,count(1) sumCount ,
CONCAT(ROUND(count(1)*100/(select count(1) from mail where 1=1
<if test="id != null and id != ''"> and second_dept_id=#{id} </if>
),0),'%') countRate
FROM
mail
where 1=1
<if test="id != null and id != ''"> and second_dept_id=#{id} </if>
GROUP BY
mail_first_category
order by sumCount desc
LIMIT 10
</select>
<select id="getMailDayTrend" resultType="java.util.Map">
select TO_CHAR(create_time, 'YYYY/MM/DD') create_time,count(1) countsum from mail
WHERE create_time between #{startDate} and #{endDate}
WHERE
1=1
<if test="deptId != null and deptId != ''">
and second_dept_id=#{deptId}
</if>
<if test="startDate != null and startDate != ''">
and create_time between #{startDate} and #{endDate}
</if>
group by TO_CHAR(create_time, 'YYYY/MM/DD') order by create_time
</select>
@ -106,14 +132,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
EXTRACT(YEAR FROM create_time) AS year,
EXTRACT(WEEK FROM create_time) AS week ,
count(1) countSum
FROM mail WHERE create_time between #{startDate} and #{endDate}
FROM mail WHERE 1=1
<if test="deptId != null and deptId != ''">
and second_dept_id=#{deptId}
</if>
<if test="startDate != null and startDate != ''">
and create_time between #{startDate} and #{endDate}
</if>
GROUP BY year,week order by year,week) a
</select>
<select id="getMailMonthTrend" resultType="java.util.Map">
SELECT
to_char(create_time::DATE, 'MM') AS month ,
count(1) countSum
FROM mail where EXTRACT(YEAR FROM create_time)=#{year}
FROM mail where
1=1
<if test="deptId != null and deptId != ''">
and second_dept_id=#{deptId}
</if>
<if test="year != null and year != ''">
and EXTRACT(YEAR FROM create_time)=#{year}
</if>
GROUP BY month order by month
</select>
<select id="mapData" resultType="java.util.Map">
@ -134,6 +173,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY d.name,a.id
</select>
<select id="currentCountyMapJSON" resultType="java.util.Map" parameterType="java.lang.String">
select geometry from county_street_dept where 1=1
<if test="deptId != null and deptId != ''">and dept_id=#{deptId}</if>
limit 1
</select>
<select id="getToDayDuty" resultType="com.biutag.entity.system.Duty">
select a.* from duty a
inner join dept b on a.depart_id=b.id where
now() BETWEEN a.start_time and a.end_time
<if test="depatType!=null and depatType!=''">
and a.dept_type=#{depatType}
</if>
<if test="deptId!=null and deptId!=''">
and b.pid=#{deptId}
</if>
order by a.create_time desc
</select>
<select id="mapCountyData" resultType="java.util.Map" parameterType="java.lang.String">
select d.name, a.id,
(select count(1) mailCount from mail c where c.create_time>=CURRENT_DATE and c.three_dept_id=a.id) todaysum ,
CONCAT(ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0),'%') resolvedRate,
SUM(COALESCE(b.resolved, 0)) resolved,
ROUND(sum(COALESCE(b.completed, 0))*100/count(b.mail_id),0) value,
CONCAT(ROUND(sum(COALESCE(b.completed, 0))*100/count(b.mail_id),0),'%') completedRate,
SUM(COALESCE(b.completed, 0)) completed,
CONCAT(ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0),'%') satisfiedRate,
SUM(COALESCE(b.satisfied, 0)) satisfied,
count(1) allsum
from mail_mark b left join dept a on a.id=b.three_dept_id
inner join county_street_dept d on b.three_dept_id=d.dept_id
where 1=1
<if test="deptId != null and deptId != ''"> and b.second_dept_id=#{deptId}</if>
GROUP BY d.name,a.id
</select>
</mapper>

Loading…
Cancel
Save