Browse Source

新增:服务类型数量分析+代办服务趋势分析

master
wxz 2 years ago
parent
commit
ffcaa6495c
  1. 57
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/AgentServiceTrendAnalysisRstDTO.java
  2. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/LingShanScreenServiceRstDTO.java
  3. 20
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/ScreenAgentServiceCategoryAnalysisRstDTO.java
  4. 32
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java
  5. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LingshanAgentServiceRecordEntity.java
  6. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java
  7. 90
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java

57
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/AgentServiceTrendAnalysisRstDTO.java

@ -0,0 +1,57 @@
package com.epmet.dto.result.agentservice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Description
* {
* "time":"1月",
* "data":[
* {
* "name": "受理数",
* "value": 140
* },
* {
* "name": "办结率",
* "value": 95.3
* }
* ]
* },
* @Author wangxianzhang
* @Time 2023/5/16 1:38 PM
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AgentServiceTrendAnalysisRstDTO {
// 1月
private String time;
//
private List<DataObj> data;
public static class DataObj {
private String name;
private Integer value;
public DataObj() {
}
public DataObj(String name, Integer value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public Integer getValue() {
return value;
}
}
}

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/LingShanScreenServiceRstDTO.java

@ -17,4 +17,13 @@ public class LingShanScreenServiceRstDTO {
private Date createdTime;
private String agentName;
private String agentMobile;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
}

20
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/ScreenAgentServiceCategoryAnalysisRstDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result.agentservice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description 灵山大屏服务类别统计分析
* @Author wangxianzhang
* @Time 2023/5/16 12:48 PM
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScreenAgentServiceCategoryAnalysisRstDTO {
private String name;
private Integer value;
}

32
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java

@ -285,4 +285,36 @@ public class LingShanAgentServiceController {
return new Result<List<LingShanScreenServiceRstDTO>>().ok(rl);
}
/**
* @Description: 服务类型数量分析
* @param orgType:
* @param orgId:
* @Return com.epmet.commons.tools.utils.Result
* @Author: wangxianzhang
* @Date: 2023/5/16 12:47 PM
*/
@GetMapping("screen/serviceCategoryAnalysis")
public Result<List<ScreenAgentServiceCategoryAnalysisRstDTO>> serviceCategoryAnalysis(@RequestParam("orgType") String orgType,
@RequestParam("orgId") String orgId) {
List<ScreenAgentServiceCategoryAnalysisRstDTO> rl = lingShanServiceAgentService.serviceCategoryAnalysis(orgType, orgId);
return new Result<List<ScreenAgentServiceCategoryAnalysisRstDTO>>().ok(rl);
}
/**
* @Description: 代办服务趋势分析
* @param orgType:
* @param orgId:
* @Return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.agentservice.AgentServiceTrendAnalysisRstDTO>>
* @Author: wangxianzhang
* @Date: 2023/5/16 1:39 PM
*/
@GetMapping("screen/serviceTrendAnalysis")
public Result<List<AgentServiceTrendAnalysisRstDTO>> serviceTrendAnalysis(@RequestParam("orgType") String orgType,
@RequestParam("orgId") String orgId) {
List<AgentServiceTrendAnalysisRstDTO> rl = lingShanServiceAgentService.serviceTrendAnalysis(orgType, orgId);
return new Result<List<AgentServiceTrendAnalysisRstDTO>>().ok(rl);
}
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LingshanAgentServiceRecordEntity.java

@ -128,4 +128,6 @@ public class LingshanAgentServiceRecordEntity extends BaseEpmetEntity {
*/
private String latitude;
private transient int qty = 0;
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java

@ -34,4 +34,8 @@ public interface LingShanAgentServiceService {
List<LingShanScreenAgentRstDTO> screenAgentList(String orgType, String orgId);
List<LingShanScreenServiceRstDTO> screenServiceList(String orgType, String orgId, String dataType);
List<ScreenAgentServiceCategoryAnalysisRstDTO> serviceCategoryAnalysis(String orgType, String orgId);
List<AgentServiceTrendAnalysisRstDTO> serviceTrendAnalysis(String orgType, String orgId);
}

90
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java

@ -1,7 +1,9 @@
package com.epmet.service.impl;
import cn.hutool.http.useragent.UserAgentInfo;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.LingShanAgentServiceProcessStatusEnum;
import com.epmet.commons.tools.constant.ServiceConstant;
@ -19,6 +21,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.constant.OrgInfoConstant;
@ -527,7 +530,94 @@ public class LingShanAgentServiceServiceImpl implements LingShanAgentServiceServ
d.setApplicantName(rec.getApplicantName());
d.setApplicantMobile(rec.getContactMobile());
d.setAgentName(rec.getAgentName());
d.setLongitude(rec.getLongitude());
d.setLatitude(rec.getLatitude());
return d;
}).collect(Collectors.toList());
}
@Override
public List<ScreenAgentServiceCategoryAnalysisRstDTO> serviceCategoryAnalysis(String orgType, String orgId) {
String orgIdPath;
if (OrgInfoConstant.AGENCY.equals(orgType)) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids());
} else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId);
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids());
}
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> q = new QueryWrapper<LingshanAgentServiceRecordEntity>().select(" service_category, count(*) qty ")
.lambda()
.likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath)
.groupBy(LingshanAgentServiceRecordEntity::getServiceCategory);
Map<String, LingshanAgentServiceRecordEntity> categoryAndData =
agentServiceRecordDao.selectList(q).stream().collect(Collectors.toMap(LingshanAgentServiceRecordEntity::getServiceCategory, Function.identity()));
LambdaQueryWrapper<LingshanAgentServiceCategoryEntity> cq = new LambdaQueryWrapper<>();
cq.eq(LingshanAgentServiceCategoryEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId());
List<LingshanAgentServiceCategoryEntity> cateogries = agentServiceCategoryDao.selectList(cq);
return cateogries.stream().map(c -> {
LingshanAgentServiceRecordEntity data = categoryAndData.get(c.getId());
return new ScreenAgentServiceCategoryAnalysisRstDTO(c.getCategoryName(), data.getQty());
}).collect(Collectors.toList());
}
@Override
public List<AgentServiceTrendAnalysisRstDTO> serviceTrendAnalysis(String orgType, String orgId) {
// 计算得到时间列表
Map<String, Date[]> dateCatelogue = generateTimeCatelogue();
// 为了能使用索引,只能循环查询每个时间段的了,否则就要加一列日期,就这样吧
return dateCatelogue.entrySet().stream().map(entry -> {
String monthName = entry.getKey();
Date timeStart = entry.getValue()[0];
Date timeEnd = entry.getValue()[1];
// 1.受理数
// 受理数,使用processTime计算,processTime可用于表示受理时间和驳回时间。要查询受理数,要查询状态为已受理和已结案两种状态,使用processTime+processStatus结合查询
LambdaQueryWrapper<LingshanAgentServiceRecordEntity> rq = new LambdaQueryWrapper<>();
rq.ge(LingshanAgentServiceRecordEntity::getProcessTime, timeStart);
rq.le(LingshanAgentServiceRecordEntity::getProcessTime, timeEnd);
rq.in(LingshanAgentServiceRecordEntity::getProcessStatus,
LingShanAgentServiceProcessStatusEnum.ACCEPTED.getStatusCode(), LingShanAgentServiceProcessStatusEnum.CLOSED.getStatusCode());
Integer acceptCount = agentServiceRecordDao.selectCount(rq);
// 2.办结率 todo
// 3.组合数据
ArrayList<AgentServiceTrendAnalysisRstDTO.DataObj> dataList = new ArrayList<>();
dataList.add(new AgentServiceTrendAnalysisRstDTO.DataObj("受理数", acceptCount));
dataList.add(new AgentServiceTrendAnalysisRstDTO.DataObj("办结率", 0));
AgentServiceTrendAnalysisRstDTO rd = new AgentServiceTrendAnalysisRstDTO(monthName, dataList);
return rd;
}).collect(Collectors.toList());
}
/**
* @Description: 计算时间目录
* @param :
* @Return java.util.Map<java.lang.String,java.lang.String[]>
* @Author: wangxianzhang
* @Date: 2023/5/16 1:53 PM
*/
public Map<String, Date[]> generateTimeCatelogue() {
Date startDate = DateUtils.addDateMonths(new Date(), -11);
HashMap<String, Date[]> rm = new LinkedHashMap<>();
for (int c = 1; c <= 12; c++) {
Date monthStart = DateUtils.getMonthStart(startDate);
Date monthEnd = DateUtils.getMonthEnd(startDate);
rm.put(DateUtils.format(startDate, "MM") + "月", new Date[]{monthStart, monthEnd});
startDate = DateUtils.addDateMonths(startDate, 1);
}
return rm;
}
}
Loading…
Cancel
Save