|
|
@ -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; |
|
|
|
} |
|
|
|
} |