diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LingshanOfficeHallServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LingshanOfficeHallServiceRecordDTO.java index 8e43d3739b..aa455a6e0a 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LingshanOfficeHallServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LingshanOfficeHallServiceRecordDTO.java @@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.Length; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -119,7 +118,7 @@ public class LingshanOfficeHallServiceRecordDTO implements Serializable { */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @DateTimeFormat(pattern = "yyyy-MM-dd") - @NotNull(message = "申请日期不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) + // @NotNull(message = "申请日期不能为空",groups = {AddShowGroup.class,UpdateShowGroup.class}) private Date applicantTime; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/AgentServiceTrendAnalysisRstDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/AgentServiceTrendAnalysisRstDTO.java new file mode 100644 index 0000000000..effdcdb01f --- /dev/null +++ b/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 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; + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/LingShanScreenServiceRstDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/LingShanScreenServiceRstDTO.java index 77d3b3b4e1..4669c0a2ce 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/LingShanScreenServiceRstDTO.java +++ b/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; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/ScreenAgentServiceCategoryAnalysisRstDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/agentservice/ScreenAgentServiceCategoryAnalysisRstDTO.java new file mode 100644 index 0000000000..2d08f0285e --- /dev/null +++ b/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; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java index f46630f11f..e6cbb2311e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingShanAgentServiceController.java @@ -270,8 +270,8 @@ public class LingShanAgentServiceController { /** * @Description: 大屏中央:服务列表 * @param orgType: - * @param orgId: - * @param dataType: agnet service_unclosed service_closed + * @param orgId: + * @param dataType: agnet service_unclosed service_closed * @Return com.epmet.commons.tools.utils.Result * @Author: wangxianzhang * @Date: 2023/5/15 7:56 PM @@ -285,4 +285,36 @@ public class LingShanAgentServiceController { return new Result>().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> serviceCategoryAnalysis(@RequestParam("orgType") String orgType, + @RequestParam("orgId") String orgId) { + + List rl = lingShanServiceAgentService.serviceCategoryAnalysis(orgType, orgId); + return new Result>().ok(rl); + } + + /** + * @Description: 代办服务趋势分析 + * @param orgType: + * @param orgId: + * @Return com.epmet.commons.tools.utils.Result> + * @Author: wangxianzhang + * @Date: 2023/5/16 1:39 PM + */ + @GetMapping("screen/serviceTrendAnalysis") + public Result> serviceTrendAnalysis(@RequestParam("orgType") String orgType, + @RequestParam("orgId") String orgId) { + + List rl = lingShanServiceAgentService.serviceTrendAnalysis(orgType, orgId); + return new Result>().ok(rl); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LingshanAgentServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LingshanAgentServiceRecordEntity.java index a4d3a8c67e..a7c0798f70 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LingshanAgentServiceRecordEntity.java +++ b/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; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java index 04872b4797..adbcb0bbcd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingShanAgentServiceService.java @@ -34,4 +34,8 @@ public interface LingShanAgentServiceService { List screenAgentList(String orgType, String orgId); List screenServiceList(String orgType, String orgId, String dataType); + + List serviceCategoryAnalysis(String orgType, String orgId); + + List serviceTrendAnalysis(String orgType, String orgId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java index ae354b0ba6..7f96edbca9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingShanAgentServiceServiceImpl.java +++ b/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 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 q = new QueryWrapper().select(" service_category, count(*) qty ") + .lambda() + .likeRight(LingshanAgentServiceRecordEntity::getOrgIdPath, orgIdPath) + .groupBy(LingshanAgentServiceRecordEntity::getServiceCategory); + + Map categoryAndData = + agentServiceRecordDao.selectList(q).stream().collect(Collectors.toMap(LingshanAgentServiceRecordEntity::getServiceCategory, Function.identity())); + + LambdaQueryWrapper cq = new LambdaQueryWrapper<>(); + cq.eq(LingshanAgentServiceCategoryEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + + List 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 serviceTrendAnalysis(String orgType, String orgId) { + + // 计算得到时间列表 + Map 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 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 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 + * @Author: wangxianzhang + * @Date: 2023/5/16 1:53 PM + */ + public Map generateTimeCatelogue() { + Date startDate = DateUtils.addDateMonths(new Date(), -11); + HashMap 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; + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java index 565d54dae3..af2b6fa237 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java @@ -74,7 +74,7 @@ public class LingshanOfficeHallServiceRecordServiceImpl extends BaseServiceImpl< }); } PageInfo pageInfo = new PageInfo<>(resultList); - return new PageData<>(resultList, pageInfo.getTotal()); + return new PageData<>(resultList, pageInfo.getTotal(),formDTO.getPageSize()); } /**