Browse Source

大屏来信总数统计显示修改

master
21819 2 years ago
parent
commit
d4263d2b1f
  1. 251
      mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java

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

@ -25,98 +25,107 @@ import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@RequiredArgsConstructor
@Service
public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
private final MailMapper mailMapper;
private final MailFlowService mailFlowService;
public List<Map<String,Object>> mapData(String deptId){
private final MailFlowService mailFlowService;
public List<Map<String, Object>> mapData(String deptId) {
return baseMapper.mapData(deptId);
}
public List<Map<String,Object>> mapCountyData(String 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 Map<String, String> currentCountyMapJSON(Map<String, Object> params) {
if (params.size() == 0) {
return baseMapper.currentCountyMapJSON("1");
}else{
String deptId= params.get("id").toString();
return baseMapper.currentCountyMapJSON("1");
} else {
String deptId = params.get("id").toString();
return baseMapper.currentCountyMapJSON(deptId);
}
}
public List<Mail> selectRecentlyMailList(Map<String,Object> params) {
public List<Mail> selectRecentlyMailList(Map<String, Object> params) {
return baseMapper.selectRecentlyMailList(params);
}
/**
* 办结率
*
* @return
*/
public List<Map<String,String>> getCompletedRate(){
public List<Map<String, String>> getCompletedRate() {
return baseMapper.getCompletedRate();
}
/**
* 解决率
*
* @return
*/
public List<Map<String,String>> getResolvedRate(){
public List<Map<String, String>> getResolvedRate() {
return baseMapper.getResolvedRate();
}
/**
* 满意率
*
* @return
*/
public List<Map<String,String>> getSatisfiedRate(){
public List<Map<String, String>> getSatisfiedRate() {
return baseMapper.getSatisfiedRate();
}
/**
* 获取所队三率
*
* @return
*/
public List<Map<String,String>> getStationCompletedRateByDept(String deptId){
public List<Map<String, String>> getStationCompletedRateByDept(String deptId) {
return baseMapper.getStationCompletedRateByDept(deptId);
}
/**
* 获取所队三率
*
* @return
*/
public List<Map<String,String>> getStationResolvedRateByDept(String deptId){
public List<Map<String, String>> getStationResolvedRateByDept(String deptId) {
return baseMapper.getStationResolvedRateByDept(deptId);
}
/**
* 获取所队三率
*
* @return
*/
public List<Map<String,String>> getStationSatisfiedRateByDept(String deptId){
public List<Map<String, String>> getStationSatisfiedRateByDept(String deptId) {
return baseMapper.getStationSatisfiedRateByDept(deptId);
}
public Map<String, Object> consoleData(Map<String,Object> params) {
if(params.size()==0) {
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);
Long allSum = mailMapper.selectCount(null);
Long allSum = mailMapper.selectCount(new LambdaQueryWrapper<Mail>().ne(Mail::getMailCategory, "无效类").ne(Mail::getMailCategory, "终止类")
.ne(Mail::getMailCategory, "感谢信"));
Integer toDayCount = baseMapper.getTodayMailCount(null);
mapCompleted.putAll(mapResolved);
@ -124,13 +133,15 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
mapCompleted.put("todaySum", toDayCount);
mapCompleted.put("allSum", allSum);
return mapCompleted;
}else{
String deptId= params.get("id").toString();
} 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);
Long allSum = mailMapper.selectCount(new LambdaQueryWrapper<Mail>().eq(Mail::getSecondDeptId,deptId));
Long allSum = mailMapper.selectCount(new LambdaQueryWrapper<Mail>().ne(Mail::getMailCategory, "无效类").ne(Mail::getMailCategory, "终止类")
.ne(Mail::getMailCategory, "感谢信"));
Integer toDayCount = baseMapper.getTodayMailCount(deptId);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
@ -142,160 +153,160 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
}
public List<Map<String,Object>> mailTypeRank(Map<String,Object> params){
return baseMapper.mailTypeRank(params);
public List<Map<String, Object>> mailTypeRank(Map<String, Object> params) {
return baseMapper.mailTypeRank(params);
}
public Map<String,Object> getMailTrend( Map<String,Object> params){
Map dataMap=new HashMap();
public Map<String, Object> getMailTrend(Map<String, Object> params) {
Map dataMap = new HashMap();
//按天
Date endDayDate =new Date();
Date endDayDate = new Date();
Date startDayDate = DateUtils.getAddDate(endDayDate, Calendar.DAY_OF_YEAR, -(Integer.valueOf(params.get("day").toString())));
List<Date> dayList= DateUtils.findDates(startDayDate,endDayDate);
List<String> dayXList= new ArrayList<>();
List<Date> dayList = DateUtils.findDates(startDayDate, endDayDate);
List<String> dayXList = new ArrayList<>();
dayList.forEach(date -> {
dayXList.add(DateUtils.formatDate(date,"yyyy/MM/dd"));
dayXList.add(DateUtils.formatDate(date, "yyyy/MM/dd"));
});
String endDayDataStr=DateUtils.formatDate(endDayDate,"yyyy-MM-dd")+ " 23:59:59";
String startDayDateStr=DateUtils.formatDate(startDayDate,"yyyy-MM-dd")+ " 00:00:00";
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-> {
String endDayDataStr = DateUtils.formatDate(endDayDate, "yyyy-MM-dd") + " 23:59:59";
String startDayDateStr = DateUtils.formatDate(startDayDate, "yyyy-MM-dd") + " 00:00:00";
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 -> {
dayTrue.set(true);
dayDataList.forEach(map ->{
if(date.equals(map.get("create_time").toString()) ){
dayYList.add(Integer.valueOf(map.get("countsum").toString()) );
dayDataList.forEach(map -> {
if (date.equals(map.get("create_time").toString())) {
dayYList.add(Integer.valueOf(map.get("countsum").toString()));
dayTrue.set(false);
}
});
if(dayTrue.get()){
if (dayTrue.get()) {
dayYList.add(0);
}
});
dataMap.put("dayXList",dayXList);
dataMap.put("dayYList",dayYList);
dataMap.put("dayXList", dayXList);
dataMap.put("dayYList", dayYList);
//按周
Object week = params.get("week");
if (Objects.nonNull(week)) {
Date startWeekDate = DateUtils.getAddDate(endDayDate, Calendar.WEEK_OF_YEAR, -(Integer.valueOf(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,deptId);
List<Object> weekYList= new ArrayList<>();
AtomicReference<Boolean> weekTrue= new AtomicReference<>(true);
weekXList.forEach(date-> {
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, deptId);
List<Object> weekYList = new ArrayList<>();
AtomicReference<Boolean> weekTrue = new AtomicReference<>(true);
weekXList.forEach(date -> {
weekTrue.set(true);
weekDataList.forEach(map ->{
if(date.equals(map.get("week").toString()) ){
weekDataList.forEach(map -> {
if (date.equals(map.get("week").toString())) {
weekYList.add(Integer.valueOf(map.get("countsum").toString()));
weekTrue.set(false);
}
});
if(weekTrue.get()){
if (weekTrue.get()) {
weekYList.add(0);
}
});
dataMap.put("weekXList",weekXList);
dataMap.put("weekYList",weekYList);
dataMap.put("weekXList", weekXList);
dataMap.put("weekYList", weekYList);
}
Object yearVal = params.get("year");
if (Objects.nonNull(yearVal)) {
//按月
String year= yearVal.toString();
List<Integer> monthXList= DateUtils.getMonthList(Integer.valueOf(year));
List<Map<String,Object>> monthDataList= baseMapper.getMailMonthTrend(year,deptId);
List<Object> monthYList= new ArrayList<>();
AtomicReference<Boolean> monthTrue= new AtomicReference<>(true);
monthXList.forEach(month-> {
String year = yearVal.toString();
List<Integer> monthXList = DateUtils.getMonthList(Integer.valueOf(year));
List<Map<String, Object>> monthDataList = baseMapper.getMailMonthTrend(year, deptId);
List<Object> monthYList = new ArrayList<>();
AtomicReference<Boolean> monthTrue = new AtomicReference<>(true);
monthXList.forEach(month -> {
monthTrue.set(true);
monthDataList.forEach(map ->{
if(month.equals(Integer.valueOf(map.get("month").toString())) ){
monthDataList.forEach(map -> {
if (month.equals(Integer.valueOf(map.get("month").toString()))) {
monthYList.add(Integer.valueOf(map.get("countsum").toString()));
monthTrue.set(false);
}
});
if(monthTrue.get()) {
if (monthTrue.get()) {
monthYList.add(0);
}
});
dataMap.put("monthXList",monthXList);
dataMap.put("monthYList",monthYList);
dataMap.put("monthXList", monthXList);
dataMap.put("monthYList", monthYList);
}
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 dataMap;
return map;
}
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;
}
public MailDetail getMailDetail(Map<String,Object> params){
MailDetail mailDetail= baseMapper.getMailDetail(params);
if(StringUtils.isNotNull(mailDetail.getVerifyFollowupPolice())){
String verifyReportedPolicesJSON=mailDetail.getVerifyReportedPolices();
JSONArray jsonArray= JSONArray.parse(verifyReportedPolicesJSON);
List<Map> mapList=new ArrayList<>();
public MailDetail getMailDetail(Map<String, Object> params) {
MailDetail mailDetail = baseMapper.getMailDetail(params);
if (StringUtils.isNotNull(mailDetail.getVerifyFollowupPolice())) {
String verifyReportedPolicesJSON = mailDetail.getVerifyReportedPolices();
JSONArray jsonArray = JSONArray.parse(verifyReportedPolicesJSON);
List<Map> mapList = new ArrayList<>();
if (jsonArray.size() > 0) {
for (int i = 0; i < jsonArray.size(); i++) {
Map mapPolice = JSON.parseObject(jsonArray.get(i).toString());
mapList.add(baseMapper.getVerifyPolice(mapPolice)) ;
mapList.add(baseMapper.getVerifyPolice(mapPolice));
}
}
mailDetail.setVerifyPoliceList(mapList);
}
//获取主单位签收时长
Map<String,Integer> signMap = baseMapper.getDuration(mailDetail.getId(), FlowNodeEnum.SECOND_SIGN.getKey());
if(StringUtils.isNotNull(signMap) && signMap.size()>0 ) {
Map<String, Integer> signMap = baseMapper.getDuration(mailDetail.getId(), FlowNodeEnum.SECOND_SIGN.getKey());
if (StringUtils.isNotNull(signMap) && signMap.size() > 0) {
mailDetail.setSignDuration(signMap.get("consuming_time"));
mailDetail.setSignDuration(signMap.get("limited_time"));
mailDetail.setSignDurationStr(TimeUtils.secondsToTime(signMap.get("consuming_time")));
}
//获取三级机构联系群众时长
Map<String,Integer> contactMap = baseMapper.getDuration(mailDetail.getId(), FlowNodeEnum.CONTACT_WRITER.getKey());
if(StringUtils.isNotNull(contactMap) && contactMap.size()>0) {
mailDetail.setContactMassesDuration(contactMap.get("consuming_time"));
mailDetail.setContactLimitedDuration(contactMap.get("limited_time"));
mailDetail.setContactMassesDurationStr(TimeUtils.secondsToTime(contactMap.get("consuming_time")));
}
if(StringUtils.isNotNull(mailDetail.getVerifyFollowupPolice())){
String verifyFollowupPolice=mailDetail.getVerifyFollowupPolice();
JSONObject mapPolice = JSON.parseObject(verifyFollowupPolice);
mailDetail.setFollowName(mapPolice.getString("name"));
mailDetail.setFollowMobile(mapPolice.getString("phone"));
mailDetail.setFollowEmpNo(mapPolice.getString("empNo"));
}
mailDetail.setMailFlowList( mailFlowService.listOrderByCreateTimeDesc( mailDetail.getId()));
//获取三级机构联系群众时长
Map<String, Integer> contactMap = baseMapper.getDuration(mailDetail.getId(), FlowNodeEnum.CONTACT_WRITER.getKey());
if (StringUtils.isNotNull(contactMap) && contactMap.size() > 0) {
mailDetail.setContactMassesDuration(contactMap.get("consuming_time"));
mailDetail.setContactLimitedDuration(contactMap.get("limited_time"));
mailDetail.setContactMassesDurationStr(TimeUtils.secondsToTime(contactMap.get("consuming_time")));
}
if (StringUtils.isNotNull(mailDetail.getVerifyFollowupPolice())) {
String verifyFollowupPolice = mailDetail.getVerifyFollowupPolice();
JSONObject mapPolice = JSON.parseObject(verifyFollowupPolice);
mailDetail.setFollowName(mapPolice.getString("name"));
mailDetail.setFollowMobile(mapPolice.getString("phone"));
mailDetail.setFollowEmpNo(mapPolice.getString("empNo"));
}
mailDetail.setMailFlowList(mailFlowService.listOrderByCreateTimeDesc(mailDetail.getId()));
return mailDetail;
}
}
}

Loading…
Cancel
Save