diff --git a/mailbox-common/src/main/java/com/biutag/enums/DeptTypeEnum.java b/mailbox-common/src/main/java/com/biutag/enums/DeptTypeEnum.java index 27e266c..b59bd88 100644 --- a/mailbox-common/src/main/java/com/biutag/enums/DeptTypeEnum.java +++ b/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; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java index d339f19..c53b4de 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/datascreen/DataScreenController.java +++ b/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>> mapData(@RequestParam Map 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 > currentCountyMapJSON(@RequestParam Map params) { + ; + return AjaxResult.success(dataScreenService.currentCountyMapJSON(params)); + } @NotLogin @GetMapping("/peopleMail") @ApiOperation(value="群众来信") - public AjaxResult> peopleMail() { - return AjaxResult.success(dataScreenService.selectRecentlyMailList()); + public AjaxResult> peopleMail(@RequestParam Map params) { + return AjaxResult.success(dataScreenService.selectRecentlyMailList(params)); } @NotLogin @GetMapping("/consoleData") @ApiOperation(value="大屏数据") - public AjaxResult> consoleData() { - return AjaxResult.success(dataScreenService.consoleData(null)); + public AjaxResult> consoleData(@RequestParam Map params) { + return AjaxResult.success(dataScreenService.consoleData(params)); } @NotLogin @GetMapping("/dutyDay") @ApiOperation(value="今日值班") - public AjaxResult> dutyDay() { - Map map =new HashMap<>(); - List dutySjList = iDutyService.getSameDayDuty(DeptTypeEnum.SJ_TYPE.getType()); - List dutyFjList = iDutyService.getSameDayDuty(DeptTypeEnum.FJ_TYPE.getType()); - List dutyZdList = iDutyService.getSameDayDuty(DeptTypeEnum.ZD_TYPE.getType()); - List 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> dutyDay(@RequestParam Map params) { + return AjaxResult.success(dataScreenService.getToDayDuty(params)); } @NotLogin @GetMapping("/threeRate") @ApiOperation(value="三率") - public AjaxResult> threeRate() { + public AjaxResult> threeRate(@RequestParam Map params) { Map map =new HashMap<>(); - List> completeList = dataScreenService.getCompletedRate(); - List> satisfiedList = dataScreenService.getSatisfiedRate(); - List> resolvedList = dataScreenService.getResolvedRate(); + List> completeList = new ArrayList<>(); + List> satisfiedList = new ArrayList<>(); + List> 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>> mailTypeRank() { - return AjaxResult.success(dataScreenService.mailTypeRank()); + public AjaxResult< List>> mailTypeRank(@RequestParam Map params) { + return AjaxResult.success(dataScreenService.mailTypeRank(params)); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java index 35e19fa..47c5a07 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/mapper/DataScreenMapper.java +++ b/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 { List> mapData(String deptId); + + List> mapCountyData(String deptId); /** * 最近信件 * @return */ - List selectRecentlyMailList(); - + List selectRecentlyMailList(Map params); + Map currentCountyMapJSON(@Param("deptId") String deptId); /** * 获取三率 * @return @@ -125,13 +128,17 @@ public interface DataScreenMapper extends BaseMapper { * @param * @return */ - List< Map> mailTypeRank(); + List< Map> mailTypeRank(Map params); + + + + List< Map> getMailDayTrend(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("deptId") String deptId); + List< Map> getMailWeekTrend(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("deptId") String deptId); + List< Map> getMailMonthTrend(@Param("year") String year,@Param("deptId") String deptId); - List< Map> getMailDayTrend(@Param("startDate") String startDate,@Param("endDate") String endDate); - List< Map> getMailWeekTrend(@Param("startDate") String startDate,@Param("endDate") String endDate); - List< Map> getMailMonthTrend(@Param("year") String year); + List getToDayDuty(@Param("depatType") String depatType,@Param("deptId") String deptId); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java index db15bb1..9252fba 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java +++ b/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 { return baseMapper.mapData(deptId); } + public List> mapCountyData(String deptId){ + return baseMapper.mapCountyData(deptId); + } + + public Map currentCountyMapJSON(Map params){ + if(params.size()==0) { - public List selectRecentlyMailList() { + return baseMapper.currentCountyMapJSON("1"); + }else{ + String deptId= params.get("id").toString(); - return baseMapper.selectRecentlyMailList(); + return baseMapper.currentCountyMapJSON(deptId); + } + } + + public List selectRecentlyMailList(Map params) { + + return baseMapper.selectRecentlyMailList(params); } /** @@ -76,22 +95,37 @@ public class DataScreenService extends ServiceImpl { public List> getStationSatisfiedRateByDept(String deptId){ return baseMapper.getStationSatisfiedRateByDept(deptId); } - public Map consoleData(String deptId) { - Map mapCompleted = baseMapper.getAllCompletedRate(null);//获取长沙市局 办结率 - Map mapResolved = baseMapper.getAllResolvedRate(null);//获取长沙市局 解决率 - Map 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 consoleData(Map params) { + if(params.size()==0) { + Map mapCompleted = baseMapper.getAllCompletedRate(null);//获取长沙市局 办结率 + Map mapResolved = baseMapper.getAllResolvedRate(null);//获取长沙市局 解决率 + Map 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 mapCompleted = baseMapper.getAllCompletedRate(deptId);//获取长沙市局 办结率 + Map mapResolved = baseMapper.getAllResolvedRate(deptId);//获取长沙市局 解决率 + Map 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> mailTypeRank(){ - return baseMapper.mailTypeRank(); + public List> mailTypeRank(Map params){ + return baseMapper.mailTypeRank(params); } public Map getMailTrend( Map params){ @@ -107,7 +141,8 @@ public class DataScreenService extends ServiceImpl { }); String endDayDataStr=DateUtils.formatDate(endDayDate,"yyyy-MM-dd")+ " 23:59:59"; String startDayDateStr=DateUtils.formatDate(startDayDate,"yyyy-MM-dd")+ " 00:00:00"; - List< Map> dayDataList= baseMapper.getMailDayTrend(startDayDateStr,endDayDataStr); + String deptId=StringUtils.isNull(params.get("id"))? null:params.get("id").toString(); + List< Map> dayDataList= baseMapper.getMailDayTrend(startDayDateStr,endDayDataStr,deptId); List dayYList= new ArrayList<>(); AtomicReference dayTrue= new AtomicReference<>(true); dayXList.forEach(date-> { @@ -130,7 +165,7 @@ public class DataScreenService extends ServiceImpl { 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 weekXList= DateUtils.findWeeKDates(startWeekDate,endDayDate); - List< Map> weekDataList= baseMapper.getMailWeekTrend(startWeekDateStr,endDayDataStr); + List< Map> weekDataList= baseMapper.getMailWeekTrend(startWeekDateStr,endDayDataStr,deptId); List weekYList= new ArrayList<>(); AtomicReference weekTrue= new AtomicReference<>(true); weekXList.forEach(date-> { @@ -152,7 +187,7 @@ public class DataScreenService extends ServiceImpl { //按月 String year=params.get("year").toString(); List monthXList= DateUtils.getMonthList(Integer.valueOf(year)); - List> monthDataList= baseMapper.getMailMonthTrend(year); + List> monthDataList= baseMapper.getMailMonthTrend(year,deptId); List monthYList= new ArrayList<>(); AtomicReference monthTrue= new AtomicReference<>(true); monthXList.forEach(month-> { @@ -172,5 +207,28 @@ public class DataScreenService extends ServiceImpl { return dataMap; } - + public Map getToDayDuty(Map params){ + Map map =new HashMap<>(); + if(params.size()==0){ + List dutySjList = baseMapper.getToDayDuty(DeptTypeEnum.SJ_TYPE.getType(),null); + List dutyFjList = baseMapper.getToDayDuty(DeptTypeEnum.FJ_TYPE.getType(),null); + List dutyZdList = baseMapper.getToDayDuty(DeptTypeEnum.ZD_TYPE.getType(),null); + List 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 dutySjList = baseMapper.getToDayDuty(DeptTypeEnum.SJ_TYPE.getType(),null); + List dutyFjList = baseMapper.getToDayDuty(DeptTypeEnum.FJ_TYPE.getType(),deptId); + List dutyPcsList = baseMapper.getToDayDuty(DeptTypeEnum.PCS_TYPE.getType(),deptId); + List 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; + } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java index 6eb54ae..0b73df3 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java +++ b/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 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 iPage = dutyMapper.selectPage(new Page<>(page, limit), queryWrapper); List list = new LinkedList<>(); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java index 01a86fa..75eff03 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java +++ b/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 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 iPage = holidayMapper.selectPage(new Page<>(page, limit), queryWrapper); diff --git a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml b/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml index 179878e..169c238 100644 --- a/mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml +++ b/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 + and a.second_dept_id=#{id} + /*c.resolved ='1' or satisfied='1'*/ order by a.create_time desc limit 20; @@ -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 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 + and second_dept_id=#{id} + ),0),'%') countRate + + FROM + mail + where 1=1 + and second_dept_id=#{id} + GROUP BY + mail_first_category + order by sumCount desc + LIMIT 10 @@ -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 + + and second_dept_id=#{deptId} + + + and create_time between #{startDate} and #{endDate} + GROUP BY year,week order by year,week) a + + +