Browse Source

Merge branch 'lingshan_master' of http://git.elinkit.com.cn:7070/r/epmet-cloud

master
wxz 2 years ago
parent
commit
4b070917eb
  1. 42
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/LingshanPublicServiceTimeStatsRstDTO.java
  2. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java
  3. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java
  4. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java
  5. 62
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java
  6. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
  7. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolReviewRecordDao.xml

42
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/LingshanPublicServiceTimeStatsRstDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Description 灵山大屏公共服务->柱状图统计服务次数和满意率
* @Author wangxianzhang
* @Time 2023/6/1 10:15 AM
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LingshanPublicServiceTimeStatsRstDTO {
private String orgId;
private String orgType;
private String orgName;
private String orgIdPath;
/**
* 服务总次数包括完成了和没完成的
*/
private int serveTimes = 0;
/**
* 满意的次数
*/
private int satisfactionTimes = 0;
/**
* 完成了多少次
*/
private int completedTimes = 0;
/**
* 满意率分子还是用浮点数吧精确一点
*/
private BigDecimal satisfactionRate = BigDecimal.ZERO;
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java

@ -14,11 +14,13 @@ import com.epmet.dto.IcServiceRecordV2DTO;
import com.epmet.dto.form.ServiceRecordV2DetailFormDTO;
import com.epmet.dto.form.IcServiceRecordV2AddEditFormDTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO;
import com.epmet.dto.result.ServiceRecordV2DetailResultDTO;
import com.epmet.service.IcServiceRecordV2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -109,4 +111,20 @@ public class IcServiceRecordV2Controller {
ValidatorUtils.validateEntity(formDTO,ServiceRecordV2DetailFormDTO.ServiceRecordV2DetailForm.class);
return new Result<ServiceRecordV2DetailResultDTO>().ok(icServiceRecordV2Service.serviceRecordV2Detail(formDTO));
}
/**
* @Description: 灵山大屏公共服务->柱状图统计服务次数和满意率
* @param orgId:
* @param orgType:
* @Return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO>>
* @Author: wangxianzhang
* @Date: 2023/6/1 10:15 AM
*/
@GetMapping("lingshan/screen/serviceTimeAndSatisStats")
public Result<List<LingshanPublicServiceTimeStatsRstDTO>> lingshanServiceTimeAndSatisStats(@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType) {
List<LingshanPublicServiceTimeStatsRstDTO> rl = icServiceRecordV2Service.lingshanServiceTimeAndSatisStats(orgId, orgType);
return new Result<List<LingshanPublicServiceTimeStatsRstDTO>>().ok(rl);
}
}

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordV2Dao.java

@ -2,9 +2,11 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO;
import com.epmet.dto.result.ServiceRecordV2ListResultDTO;
import com.epmet.entity.IcServiceRecordV2Entity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -25,4 +27,12 @@ public interface IcServiceRecordV2Dao extends BaseDao<IcServiceRecordV2Entity> {
*/
List<ServiceRecordV2ListResultDTO> serviceRecordV2List(ServiceRecordV2ListFormDTO formDTO);
/**
* @Description: 灵山大屏公共服务->柱状图统计服务次数和满意率
* @param orgIdPath:
* @Return java.util.List<com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO>
* @Author: wangxianzhang
* @Date: 2023/6/1 10:18 AM
*/
List<LingshanPublicServiceTimeStatsRstDTO> serviceTimeStatsByOrg(@Param("orgIdPath") String orgIdPath);
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceRecordV2Service.java

@ -6,6 +6,7 @@ import com.epmet.dto.IcServiceRecordV2DTO;
import com.epmet.dto.form.ServiceRecordV2DetailFormDTO;
import com.epmet.dto.form.IcServiceRecordV2AddEditFormDTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO;
import com.epmet.dto.result.ServiceRecordV2DetailResultDTO;
import com.epmet.entity.IcServiceRecordV2Entity;
@ -97,4 +98,6 @@ public interface IcServiceRecordV2Service extends BaseService<IcServiceRecordV2E
ServiceRecordV2DetailResultDTO serviceRecordV2Detail(ServiceRecordV2DetailFormDTO formDTO);
void cancel(IcServiceRecordV2AddEditFormDTO dto);
List<LingshanPublicServiceTimeStatsRstDTO> lingshanServiceTimeAndSatisStats(String orgId, String orgType);
}

62
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordV2ServiceImpl.java

@ -7,15 +7,20 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dao.*;
import com.epmet.dto.IcServiceFeedbackV2DTO;
@ -25,11 +30,12 @@ import com.epmet.dto.form.IcServiceRecordV2AddEditFormDTO;
import com.epmet.dto.form.SendSmsFormDTO;
import com.epmet.dto.form.ServiceRecordV2DetailFormDTO;
import com.epmet.dto.form.ServiceRecordV2ListFormDTO;
import com.epmet.dto.result.ServiceRecordV2DetailResultDTO;
import com.epmet.dto.result.ServiceRecordV2ListResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.IcPartyUnitRedis;
import com.epmet.remote.EpmetUserRemoteService;
import com.epmet.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -40,7 +46,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 服务记录表
@ -50,7 +58,7 @@ import java.util.*;
*/
@Service
@Slf4j
public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecordV2Dao, IcServiceRecordV2Entity> implements IcServiceRecordV2Service {
public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecordV2Dao, IcServiceRecordV2Entity> implements IcServiceRecordV2Service, ResultDataResolver {
@Autowired
private IcPartyUnitRedis partyUnitRedis;
@ -73,6 +81,12 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecor
@Autowired
private IcPolicyDao icPolicyDao;
@Autowired
private EpmetUserRemoteService epmetUserRemoteService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<IcServiceRecordV2DTO> page(Map<String, Object> params) {
@ -276,4 +290,46 @@ public class IcServiceRecordV2ServiceImpl extends BaseServiceImpl<IcServiceRecor
return result;
}
@Override
public List<LingshanPublicServiceTimeStatsRstDTO> lingshanServiceTimeAndSatisStats(String orgId, String orgType) {
// 1.先拿orgIdPath,方便查询数据
String orgIdPath;
if (StringUtils.isAnyBlank(orgId, orgType)) {
// 前端没传递,那就用当前staff所属的
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails();
orgIdPath = loginUserDetails.getOrgIdPath();
orgId = loginUserDetails.getAgencyId();
orgType = OrgInfoConstant.AGENCY;
} else {
orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType);
}
//2. 再拿该组织所有下级组织,用于展示横坐标(因为没有服务数据,也要展示出来)
List<LingshanPublicServiceTimeStatsRstDTO> subOrgList = getResultDataOrThrowsException(govOrgOpenFeignClient.subOrgList(orgId), ServiceConstant.GOV_ORG_SERVER, null, "没有找到下级组织", null)
.stream().map(so -> {
return new LingshanPublicServiceTimeStatsRstDTO(so.getOrgId(), so.getOrgType(), so.getOrgName(),
PidUtils.convertPid2OrgIdPath(so.getOrgId(), so.getPids()), 0, 0, 0, BigDecimal.ZERO);
}).collect(Collectors.toList());
// 查询次数+满意率
List<LingshanPublicServiceTimeStatsRstDTO> tl = baseDao.serviceTimeStatsByOrg(orgIdPath);
subOrgList.forEach(so -> {
for (LingshanPublicServiceTimeStatsRstDTO e : tl) {
String eOrgIdPath = e.getOrgIdPath();
if (eOrgIdPath.contains(so.getOrgIdPath())) {
// 说明这条数据,是这个子级组织下的数据
so.setServeTimes(so.getServeTimes() + e.getServeTimes());
so.setCompletedTimes(so.getCompletedTimes() + e.getCompletedTimes());
so.setSatisfactionTimes(so.getSatisfactionTimes() + e.getSatisfactionTimes());
double satisfactionRate = so.getSatisfactionTimes() * 100.0 / so.getCompletedTimes();
so.setSatisfactionRate(new BigDecimal(satisfactionRate).setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
});
return subOrgList;
}
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

@ -43,5 +43,24 @@
ORDER BY sr.SERVICE_TIME_START DESC,sr.SERVICE_TIME_END DESC
</select>
<!--公共服务->柱状图统计服务次数和满意率
只要不是bade,就算满意。满意率 = 所有已完成的服务中满意度为good和perfect的个数/所有已完成的服务个数-->
<select id="serviceTimeStatsByOrg"
resultType="com.epmet.dto.result.LingshanPublicServiceTimeStatsRstDTO">
select ss.OBJECT_ID orgId
, ss.OBJECT_TYPE orgType
, ss.OBJECT_ID_PATH orgIdPath
, count(ss.ID) serveTimes
, count(sf.SATISFACTION) completedTimes
, count(sf.SATISFACTION != 'bad' or null) satisfactionTimes
from ic_service_record_v2 s
inner join ic_service_scope_v2 ss on (ss.DEL_FLAG = 0 and s.ID = ss.SERVICE_RECORD_ID)
left join ic_service_feedback_v2 sf on (sf.DEL_FLAG = 0 and s.ID = sf.SERVICE_RECORD_ID)
where s.DEL_FLAG = 0
and s.SERVICE_STATUS = 'completed'
and ss.OBJECT_ID_PATH like CONCAT(#{orgIdPath}, '%')
group by ss.OBJECT_ID, ss.OBJECT_TYPE, ss.OBJECT_ID_PATH
</select>
</mapper>

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolReviewRecordDao.xml

@ -23,8 +23,6 @@
a.inspectors inspectors,
a.review_time reviewTime,
a.detailed detailed,
a.DANGER_TYPE dangerType,
a.DANGER_NAME dangerName,
a.review_result reviewResult
FROM
ic_place_patrol_review_record a

Loading…
Cancel
Save