Commit 8d6bc19d by 张富康

fix(rpc-dj-riskmanage): 修正多处逻辑及配置问题

- 添加鸿蒙商户数量的日志记录
- 修改员工入职天数判断,使用previousQuarter结束日期且天数改为大于29天
- 调整渗透率计算逻辑,按手机号分组累加多个数据项的值
- 修复考试分数获取的空指针问题,增加非空判断
- 纠正渗透率区间判断逻辑,修复分数计算区间边界错误
- 配置平台商户Dubbo服务,指定特定服务URL
- 配置MerchantUserRemote时增加Dubbo服务URL
- 修正ScrmProxyDubboConfig中GoodsRelatedPartyRemote Bean的方法名错误
1 parent 2cb122fe
...@@ -20,7 +20,7 @@ public class PlatformMerchantsDubboConfig extends DubboConfig{ ...@@ -20,7 +20,7 @@ public class PlatformMerchantsDubboConfig extends DubboConfig{
@Bean @Bean
public MerchantRemote getMerchantRemote() { public MerchantRemote getMerchantRemote() {
return factory.builder(MerchantRemote.class).check(false).timeout(30000).version("2.0.0").build(); return factory.builder(MerchantRemote.class).check(false).url("dubbo://192.168.3.188:9251").timeout(30000).version("2.0.0").build();
} }
@Bean @Bean
public ServiceMerchantRemote getServiceMerchantRemote() { public ServiceMerchantRemote getServiceMerchantRemote() {
...@@ -34,7 +34,7 @@ public class PlatformMerchantsDubboConfig extends DubboConfig{ ...@@ -34,7 +34,7 @@ public class PlatformMerchantsDubboConfig extends DubboConfig{
@Bean @Bean
public MerchantUserRemote merchantUserRemote() { public MerchantUserRemote merchantUserRemote() {
return factory.builder(MerchantUserRemote.class).version("2.0.0").check(check).timeout(timeout).build(); return factory.builder(MerchantUserRemote.class).url("dubbo://192.168.3.188:9251").version("2.0.0").check(check).timeout(timeout).build();
} }
} }
...@@ -15,7 +15,7 @@ public class ScrmProxyDubboConfig extends DubboConfig{ ...@@ -15,7 +15,7 @@ public class ScrmProxyDubboConfig extends DubboConfig{
// } // }
// //
@Bean @Bean
public GoodsRelatedPartyRemote merchantRemote() { public GoodsRelatedPartyRemote goodsRelatedPartyRemote() {
return factory.builder(GoodsRelatedPartyRemote.class).check(check).timeout(timeout).build(); return factory.builder(GoodsRelatedPartyRemote.class).check(check).timeout(timeout).build();
} }
......
...@@ -21,8 +21,8 @@ public class GetDataStatsService { ...@@ -21,8 +21,8 @@ public class GetDataStatsService {
public DataResp<List<DataBusinessDTO>> getListDataResp(String jsonBody) { public DataResp<List<DataBusinessDTO>> getListDataResp(String jsonBody) {
DataResp<List<DataBusinessDTO>> dataResp; DataResp<List<DataBusinessDTO>> dataResp;
// String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://dc.com.cn/data"); String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://dc.com.cn/data");
String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.211:8021/data"); // String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.211:8021/data");
// post请求 // post请求
String jsonResponse; String jsonResponse;
try { try {
......
...@@ -74,6 +74,7 @@ public class DownloadReportService { ...@@ -74,6 +74,7 @@ public class DownloadReportService {
carBrandProvinceRequestDTO.setFirstBrandIdList(Collections.singletonList(brandId)); carBrandProvinceRequestDTO.setFirstBrandIdList(Collections.singletonList(brandId));
RpcResponse<List<MerchantProvinceDTO>> merchantListByBrandIdsProvince = merchantRemote.findMerchantListByBrandIdsProvince(carBrandProvinceRequestDTO); RpcResponse<List<MerchantProvinceDTO>> merchantListByBrandIdsProvince = merchantRemote.findMerchantListByBrandIdsProvince(carBrandProvinceRequestDTO);
List<MerchantProvinceDTO> merchantListByBrandIdsProvinceResult = merchantListByBrandIdsProvince.getResult(); List<MerchantProvinceDTO> merchantListByBrandIdsProvinceResult = merchantListByBrandIdsProvince.getResult();
log.info("鸿蒙商户-数量: {}", merchantListByBrandIdsProvinceResult.size());
if (CollUtil.isEmpty(merchantListByBrandIdsProvinceResult)) { if (CollUtil.isEmpty(merchantListByBrandIdsProvinceResult)) {
return result; return result;
} }
...@@ -115,12 +116,11 @@ public class DownloadReportService { ...@@ -115,12 +116,11 @@ public class DownloadReportService {
return result; return result;
} }
// 查询这些手机号入职天数大于30天的员工 日期设定yyyy-MM-dd 且没有离职的 // 查询这些手机号入职天数大于30天的员工 日期设定yyyy-MM-dd 且没有离职的
Date quarterStartDate = DateUtil.beginOfQuarter(DateUtil.parse(date));
listRpcResponseResult = listRpcResponseResult.stream() listRpcResponseResult = listRpcResponseResult.stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.filter(dto -> dto.getEntryDate() != null) .filter(dto -> dto.getEntryDate() != null)
.filter(beisenEmployeeInfoDTO -> StrUtil.isNotBlank(beisenEmployeeInfoDTO.getMobilePhone())) .filter(beisenEmployeeInfoDTO -> StrUtil.isNotBlank(beisenEmployeeInfoDTO.getMobilePhone()))
.filter(beisenEmployeeInfoDTO -> DateUtil.between(beisenEmployeeInfoDTO.getEntryDate(), quarterStartDate, DateUnit.DAY, false) > 30 .filter(beisenEmployeeInfoDTO -> DateUtil.between(beisenEmployeeInfoDTO.getEntryDate(), previousQuarter.getEndDate(), DateUnit.DAY, false) > 29
&& beisenEmployeeInfoDTO.getZzStatus() == 0) && beisenEmployeeInfoDTO.getZzStatus() == 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollUtil.isEmpty(listRpcResponseResult)) { if (CollUtil.isEmpty(listRpcResponseResult)) {
...@@ -168,15 +168,32 @@ public class DownloadReportService { ...@@ -168,15 +168,32 @@ public class DownloadReportService {
// 渗透率 = 订单成交数 / 应触客数 // 渗透率 = 订单成交数 / 应触客数
Map<String, BigDecimal> penetrationRateMap = new HashMap<>(); Map<String, BigDecimal> penetrationRateMap = new HashMap<>();
if (CollUtil.isNotEmpty(contentA075) && CollUtil.isNotEmpty(contentA061)) { if (CollUtil.isNotEmpty(contentA075) && CollUtil.isNotEmpty(contentA061)) {
Map<String, DataBusinessDTO> contentA075Map = contentA075.stream().collect(Collectors.toMap(DataBusinessDTO::getStaffId, Function.identity())); Map<String, List<DataBusinessDTO>> contentA075Map = contentA075.stream().collect(Collectors.groupingBy(DataBusinessDTO::getStaffPhone));
Map<String, DataBusinessDTO> contentA061Map = contentA061.stream().collect(Collectors.toMap(DataBusinessDTO::getStaffId, Function.identity())); Map<String, List<DataBusinessDTO>> contentA061Map = contentA061.stream().collect(Collectors.groupingBy(DataBusinessDTO::getStaffPhone));
for (String phone : staffPhoneList) { for (String phone : staffPhoneList) {
DataBusinessDTO dataBusinessDTOA075 = contentA075Map.get(phone); List<DataBusinessDTO> dataBusinessDTOsA075 = contentA075Map.get(phone);
DataBusinessDTO dataBusinessDTOA061 = contentA061Map.get(phone); List<DataBusinessDTO> dataBusinessDTOsA061 = contentA061Map.get(phone);
if (dataBusinessDTOA075 != null && dataBusinessDTOA061 != null && dataBusinessDTOA075.getItemValue() != null && dataBusinessDTOA061.getItemValue() != null) { if (CollUtil.isNotEmpty(dataBusinessDTOsA075) && CollUtil.isNotEmpty(dataBusinessDTOsA061)) {
// 累加
BigDecimal a075 = BigDecimal.ZERO;
BigDecimal a061 = BigDecimal.ZERO;
for (DataBusinessDTO dataBusinessDTO : dataBusinessDTOsA075) {
if (ObjectUtil.isNotEmpty(dataBusinessDTO)) {
if (ObjectUtil.isNotEmpty(dataBusinessDTO.getItemValue())) {
a075 = a075.add(dataBusinessDTO.getItemValue());
}
}
}
for (DataBusinessDTO dataBusinessDTO : dataBusinessDTOsA061) {
if (ObjectUtil.isNotEmpty(dataBusinessDTO)) {
if (ObjectUtil.isNotEmpty(dataBusinessDTO.getItemValue())) {
a061 = a061.add(dataBusinessDTO.getItemValue());
}
}
}
// A061 应触客数需要大于0 // A061 应触客数需要大于0
if (dataBusinessDTOA061.getItemValue().compareTo(BigDecimal.ZERO) > 0) { if (a061.compareTo(BigDecimal.ZERO) > 0) {
penetrationRateMap.put(phone, NumberUtil.div(NumberUtil.mul(dataBusinessDTOA075.getItemValue(), BigDecimal.valueOf(100)), dataBusinessDTOA061.getItemValue(), 2, RoundingMode.HALF_UP)); penetrationRateMap.put(phone, NumberUtil.div(NumberUtil.mul(a075, BigDecimal.valueOf(100)), a061, 2, RoundingMode.HALF_UP));
} }
} }
} }
...@@ -209,7 +226,10 @@ public class DownloadReportService { ...@@ -209,7 +226,10 @@ public class DownloadReportService {
item.setLevelResult("-"); item.setLevelResult("-");
if (ObjectUtil.isNotEmpty(beisenEmployeeInfoDTO)) { if (ObjectUtil.isNotEmpty(beisenEmployeeInfoDTO)) {
// 最高分 // 最高分
examScore = beiSenExaminationTraineesMap.get(beisenEmployeeInfoDTO.getUserID()).getTopPoint(); BeiSenExaminationTrainees beiSenExaminationTraineesItem = beiSenExaminationTraineesMap.get(beisenEmployeeInfoDTO.getUserID());
if (ObjectUtil.isNotEmpty(beiSenExaminationTraineesItem)) {
examScore = beiSenExaminationTraineesItem.getTopPoint();
}
item.setName(beisenEmployeeInfoDTO.getName()); item.setName(beisenEmployeeInfoDTO.getName());
if (ObjectUtil.isNotEmpty(beisenEmployeeInfoDTO.getEntryDate())) { if (ObjectUtil.isNotEmpty(beisenEmployeeInfoDTO.getEntryDate())) {
item.setEntryTime(DateUtil.format(beisenEmployeeInfoDTO.getEntryDate(), DatePattern.NORM_DATE_PATTERN)); item.setEntryTime(DateUtil.format(beisenEmployeeInfoDTO.getEntryDate(), DatePattern.NORM_DATE_PATTERN));
...@@ -245,26 +265,26 @@ public class DownloadReportService { ...@@ -245,26 +265,26 @@ public class DownloadReportService {
// 当渗透率 x∈[65%,70%) 时,得分为 90 分。 // 当渗透率 x∈[65%,70%) 时,得分为 90 分。
// 当渗透率 x∈[70%,100%] 时,得分为 100 分。 // 当渗透率 x∈[70%,100%] 时,得分为 100 分。
// 最终得分=考试成绩*40%+渗透率得分*60% 保留一位小数 // 最终得分=考试成绩*40%+渗透率得分*60% 保留一位小数
BigDecimal finalScore = BigDecimal.ZERO; BigDecimal finalScore;
if (penetrationRate.compareTo(BigDecimal.valueOf(50)) >= 0 && penetrationRate.compareTo(BigDecimal.valueOf(50)) < 0) { if (penetrationRate.compareTo(BigDecimal.valueOf(50)) < 0 && penetrationRate.compareTo(BigDecimal.valueOf(0)) >= 0) {
// 渗透率 x∈[0%,50%) // 渗透率 x∈[0%,50%)
finalScore = NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)).setScale(1, RoundingMode.HALF_UP); finalScore = NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)).setScale(1, RoundingMode.HALF_UP);
} else if (penetrationRate.compareTo(BigDecimal.valueOf(50)) >= 0 && penetrationRate.compareTo(BigDecimal.valueOf(55)) < 0) { } else if (penetrationRate.compareTo(BigDecimal.valueOf(50)) <= 0 && penetrationRate.compareTo(BigDecimal.valueOf(55)) > 0) {
// 渗透率 x∈[50%,55%) // 渗透率 x∈[50%,55%)
finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)), finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)),
NumberUtil.mul(BigDecimal.valueOf(60), BigDecimal.valueOf(0.6))) NumberUtil.mul(BigDecimal.valueOf(60), BigDecimal.valueOf(0.6)))
.setScale(1, RoundingMode.HALF_UP); .setScale(1, RoundingMode.HALF_UP);
} else if (penetrationRate.compareTo(BigDecimal.valueOf(55)) >= 0 && penetrationRate.compareTo(BigDecimal.valueOf(60)) < 0) { } else if (penetrationRate.compareTo(BigDecimal.valueOf(55)) <= 0 && penetrationRate.compareTo(BigDecimal.valueOf(60)) > 0) {
// 当渗透率 x∈[55%,60%) // 当渗透率 x∈[55%,60%)
finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)), finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)),
NumberUtil.mul(BigDecimal.valueOf(70), BigDecimal.valueOf(0.6))) NumberUtil.mul(BigDecimal.valueOf(70), BigDecimal.valueOf(0.6)))
.setScale(1, RoundingMode.HALF_UP); .setScale(1, RoundingMode.HALF_UP);
} else if (penetrationRate.compareTo(BigDecimal.valueOf(60)) >= 0 && penetrationRate.compareTo(BigDecimal.valueOf(65)) < 0) { } else if (penetrationRate.compareTo(BigDecimal.valueOf(60)) <= 0 && penetrationRate.compareTo(BigDecimal.valueOf(65)) > 0) {
// 渗透率 x∈[60%,65%) // 渗透率 x∈[60%,65%)
finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)), finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)),
NumberUtil.mul(BigDecimal.valueOf(80), BigDecimal.valueOf(0.6))) NumberUtil.mul(BigDecimal.valueOf(80), BigDecimal.valueOf(0.6)))
.setScale(1, RoundingMode.HALF_UP); .setScale(1, RoundingMode.HALF_UP);
} else if (penetrationRate.compareTo(BigDecimal.valueOf(65)) >= 0 && penetrationRate.compareTo(BigDecimal.valueOf(70)) < 0) { } else if (penetrationRate.compareTo(BigDecimal.valueOf(65)) <= 0 && penetrationRate.compareTo(BigDecimal.valueOf(70)) > 0) {
// 渗透率 x∈[65%,70%) // 渗透率 x∈[65%,70%)
finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)), finalScore = NumberUtil.add(NumberUtil.mul(examScore, BigDecimal.valueOf(0.4)),
NumberUtil.mul(BigDecimal.valueOf(90), BigDecimal.valueOf(0.6))) NumberUtil.mul(BigDecimal.valueOf(90), BigDecimal.valueOf(0.6)))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!