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