Commit 8a5ea366 by jianan

agms分公司寿险数据不对,按业绩降序排序

parent f3467cf6
...@@ -10,6 +10,7 @@ import com.yd.dal.entity.customer.practitioner.PractitionerRankInfo; ...@@ -10,6 +10,7 @@ import com.yd.dal.entity.customer.practitioner.PractitionerRankInfo;
import com.yd.dal.entity.meta.MdDropOptions; import com.yd.dal.entity.meta.MdDropOptions;
import com.yd.dal.service.agms.AgmsDashboardDALService; import com.yd.dal.service.agms.AgmsDashboardDALService;
import com.yd.dal.service.meta.MdDropOptionsDALService; import com.yd.dal.service.meta.MdDropOptionsDALService;
import com.yd.rmi.cache.SystemConfigService;
import com.yd.rmi.n22.salary.pojo.Achieve; import com.yd.rmi.n22.salary.pojo.Achieve;
import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementRequestBody; import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementRequestBody;
import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementResponseVO; import com.yd.rmi.n22.salary.pojo.SearchStaffAchievementResponseVO;
...@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service; ...@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -35,6 +37,8 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -35,6 +37,8 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
private MdDropOptionsDALService mdDropOptionsDALService; private MdDropOptionsDALService mdDropOptionsDALService;
@Autowired @Autowired
private N22SalaryService n22SalaryService; private N22SalaryService n22SalaryService;
@Autowired
private SystemConfigService systemConfigService;
@Override @Override
public StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO) { public StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO) {
...@@ -134,12 +138,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -134,12 +138,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
private List<StatisticsSalesInfo> statisticsSalesN22(String category, String type, String time) throws Exception { private List<StatisticsSalesInfo> statisticsSalesN22(String category, String type, String time) throws Exception {
// 1.根据Agent_id当前经纪人的佣金明细 // 1.根据Agent_id当前经纪人的佣金明细
SearchStaffAchievementResponseVO searchStaffAchievementResponseVO = this.queryN22(category, type, time); List<Achieve> achieveList = this.queryN22(category, type, time);
if (!"查询成功".equals(searchStaffAchievementResponseVO.getResponseHead().getMessage())){
throw new Exception( "N22寿险业绩统计查询错误");
}
List<Achieve> achieveList = searchStaffAchievementResponseVO.getResponseBody().getAchieveList();
// 2.筛选结果集 // 2.筛选结果集
if ("life".equals(category)) { if ("life".equals(category)) {
...@@ -147,10 +146,6 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -147,10 +146,6 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
achieveList = achieveList.stream() achieveList = achieveList.stream()
.filter((Achieve i) -> "寿险团队".equals(i.getRolegrouptype())) .filter((Achieve i) -> "寿险团队".equals(i.getRolegrouptype()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else if ("b".equals(type)) {
achieveList = achieveList.stream()
.filter((Achieve i) -> ("二级机构".equals(i.getRolegrouptype()) || "渠道机构".equals(i.getRolegrouptype())))
.collect(Collectors.toList());
} }
} }
...@@ -167,13 +162,20 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -167,13 +162,20 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
infoList.add(info); infoList.add(info);
} }
// 3.计算件均保费 // 4.计算件均保费
agmsDashboardDALService.getUnitPremium(infoList); agmsDashboardDALService.getUnitPremium(infoList);
// 5.排序
infoList.sort(Comparator.comparing(StatisticsSalesInfo::getFyc).reversed());
return infoList; return infoList;
} }
private SearchStaffAchievementResponseVO queryN22(String category, String type, String time) { private List<Achieve> queryN22(String category, String type, String time) throws Exception {
// 0.声明变量
SearchStaffAchievementResponseVO searchStaffAchievementResponseVO = null;
List<Achieve> achieveList = new ArrayList<>();
// 1.根据查询时间范围获取查询开始时间和结束时间 // 1.根据查询时间范围获取查询开始时间和结束时间
String startTime; String startTime;
String endTime; String endTime;
...@@ -200,21 +202,39 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -200,21 +202,39 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
searchStaffAchievementRequestBody.setIssuedateend(endTime); searchStaffAchievementRequestBody.setIssuedateend(endTime);
searchStaffAchievementRequestBody.setPolicystatus("201"); searchStaffAchievementRequestBody.setPolicystatus("201");
if ("life".equals(category)) { if ("life".equals(category)) {
if ("b".equals(type)) { if ("b".equals(type)) {
searchStaffAchievementRequestBody.setSearchtype("3"); searchStaffAchievementRequestBody.setSearchtype("3");
searchStaffAchievementRequestBody.setIsdown("0");
String organizationIds = systemConfigService.getSingleConfigValue("N22_Organization_ID");
// 机构数据根据机构id循环调接口查询
for (String organizationId :organizationIds.split(",")){
searchStaffAchievementRequestBody.setIsdown("1");
searchStaffAchievementRequestBody.setOrganization_id(organizationId);
searchStaffAchievementResponseVO = n22SalaryService.searchStaffAchievement(searchStaffAchievementRequestBody);
List<Achieve> achieves = n22SalaryService.searchStaffAchievementGetAchieveList(searchStaffAchievementResponseVO);
achieveList.addAll(achieves);
}
} else { } else {
searchStaffAchievementRequestBody.setSearchtype("2"); searchStaffAchievementRequestBody.setSearchtype("2");
searchStaffAchievementRequestBody.setIsdown("0"); searchStaffAchievementRequestBody.setIsdown("0");
searchStaffAchievementResponseVO = n22SalaryService.searchStaffAchievement(searchStaffAchievementRequestBody);
achieveList = n22SalaryService.searchStaffAchievementGetAchieveList(searchStaffAchievementResponseVO);
} }
} else if ("all".equals(category)) { } else if ("all".equals(category)) {
searchStaffAchievementRequestBody.setOrganization_id("HX6ZCQ"); searchStaffAchievementRequestBody.setOrganization_id("HX6ZCQ");
searchStaffAchievementRequestBody.setSearchtype("3"); searchStaffAchievementRequestBody.setSearchtype("3");
searchStaffAchievementRequestBody.setIsdown("1"); searchStaffAchievementRequestBody.setIsdown("1");
searchStaffAchievementResponseVO = n22SalaryService.searchStaffAchievement(searchStaffAchievementRequestBody);
achieveList = n22SalaryService.searchStaffAchievementGetAchieveList(searchStaffAchievementResponseVO);
} }
return n22SalaryService.searchStaffAchievement(searchStaffAchievementRequestBody); return achieveList;
} }
/** /**
......
...@@ -9,4 +9,6 @@ public interface N22SalaryService { ...@@ -9,4 +9,6 @@ public interface N22SalaryService {
SalaryDetailsSearchResponseVO salaryDetailsSearch(SalaryDetailsSearchRequestBody salaryDetailsSearchRequestBody); SalaryDetailsSearchResponseVO salaryDetailsSearch(SalaryDetailsSearchRequestBody salaryDetailsSearchRequestBody);
SearchStaffAchievementResponseVO searchStaffAchievement(SearchStaffAchievementRequestBody searchStaffAchievementRequestBody); SearchStaffAchievementResponseVO searchStaffAchievement(SearchStaffAchievementRequestBody searchStaffAchievementRequestBody);
List<Achieve> searchStaffAchievementGetAchieveList(SearchStaffAchievementResponseVO searchStaffAchievementResponseVO) throws Exception;
} }
...@@ -53,4 +53,12 @@ public class N22SalaryServiceImpl implements N22SalaryService { ...@@ -53,4 +53,12 @@ public class N22SalaryServiceImpl implements N22SalaryService {
return response; return response;
} }
@Override
public List<Achieve> searchStaffAchievementGetAchieveList(SearchStaffAchievementResponseVO searchStaffAchievementResponseVO) throws Exception {
if (!"查询成功".equals(searchStaffAchievementResponseVO.getResponseHead().getMessage())){
throw new Exception(searchStaffAchievementResponseVO.getResponseHead().getMessage());
}
return searchStaffAchievementResponseVO.getResponseBody().getAchieveList();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment