|
|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ydtech.constants.enums.dict.DictionaryManagement;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.core.page.PageResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.dao.SysDeptMapper;
|
|
|
import com.ydtech.modules.admin.dao.SysUserMapper;
|
|
|
@@ -200,23 +201,69 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
* @Description: 人员统计-前线人员-代理人统计
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineAgent(QxFrontlineAgentVo qxFrontlineAgentVo) {
|
|
|
+ public HttpResult<PageResult<QxFrontlineAgentDto>> queryQxFrontlineAgent(QxFrontlineAgentVo qxFrontlineAgentVo) {
|
|
|
try {
|
|
|
+ PageResult<QxFrontlineAgentDto> resultPage = new PageResult<>();
|
|
|
+
|
|
|
HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
|
|
|
qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));
|
|
|
- PageVo<SettlementDocumentaryFeesSumEntity> pageVo = new PageVo<>();
|
|
|
- Page page = new Page(qxFrontlineAgentVo.getPageNum(), qxFrontlineAgentVo.getPageSize());
|
|
|
- pageVo.setPageNum(qxFrontlineAgentVo.getPageNum());
|
|
|
- pageVo.setPageSize(qxFrontlineAgentVo.getPageSize());
|
|
|
- IPage<QxFrontlineAgentDto> sysUserListPage = sysUserMapper.queryQxFrontlineAgent(page, qxFrontlineAgentVo);
|
|
|
- List<QxFrontlineAgentDto> sysUserList = sysUserListPage.getRecords();
|
|
|
- if(qxFrontlineAgentVo.getManagementSource().equals("1")){// 渠道
|
|
|
- this.channelPerson(sysUserList,qxFrontlineAgentVo);
|
|
|
- }else if (qxFrontlineAgentVo.getManagementSource().equals("2")){// 代理人
|
|
|
- this.agentPerson(sysUserList,qxFrontlineAgentVo);
|
|
|
+
|
|
|
+ List<QxFrontlineAgentDto> getQxFrontlineAgentList = sysUserMapper.getQxFrontlineAgentList(qxFrontlineAgentVo);
|
|
|
+ if (qxFrontlineAgentVo.getManagementSource().equals("1")) {// 渠道
|
|
|
+ this.channelPerson(getQxFrontlineAgentList, qxFrontlineAgentVo);
|
|
|
+ } else if (qxFrontlineAgentVo.getManagementSource().equals("2")) {// 代理人
|
|
|
+ this.agentPerson(getQxFrontlineAgentList, qxFrontlineAgentVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(qxFrontlineAgentVo.getOutThere())) {
|
|
|
+ if ("1".equals(qxFrontlineAgentVo.getOutThere())) {
|
|
|
+ getQxFrontlineAgentList = getQxFrontlineAgentList.stream()
|
|
|
+ .filter(agent -> new BigDecimal(agent.getTotalPremium()).compareTo(BigDecimal.ZERO) > 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ getQxFrontlineAgentList = getQxFrontlineAgentList.stream()
|
|
|
+ .filter(agent -> new BigDecimal(agent.getTotalPremium()).compareTo(BigDecimal.ZERO) == 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resultPage.setTotalSize(getQxFrontlineAgentList.size());
|
|
|
+
|
|
|
+ getQxFrontlineAgentList.sort((dto1, dto2) -> {
|
|
|
+ BigDecimal premium1 = new BigDecimal(dto1.getTotalPremium());
|
|
|
+ BigDecimal premium2 = new BigDecimal(dto2.getTotalPremium());
|
|
|
+ return premium2.compareTo(premium1); // 降序排序
|
|
|
+ });
|
|
|
+
|
|
|
+ int fromIndex = (qxFrontlineAgentVo.getPageNum() - 1) * qxFrontlineAgentVo.getPageSize(); //创建分页数据
|
|
|
+ int toIndex = Math.min(fromIndex + qxFrontlineAgentVo.getPageSize(), getQxFrontlineAgentList.size());
|
|
|
+ List<QxFrontlineAgentDto> qxFrontlineAgentDtos = getQxFrontlineAgentList.subList(fromIndex, toIndex);
|
|
|
+ for (QxFrontlineAgentDto dto : qxFrontlineAgentDtos) {
|
|
|
+ String deptId = dto.getDeptId();
|
|
|
+ if(StringUtils.isNotEmpty(deptId)){
|
|
|
+ int length = deptId.length();
|
|
|
+ if (length > 0) {
|
|
|
+ if (length > 10) {
|
|
|
+ String substring = deptId.substring(0, 6);
|
|
|
+ String substring1 = deptId.substring(0, 8);
|
|
|
+ String province = deptId.substring(0, 4);
|
|
|
+ String storeDept = deptId.substring(0, 11);
|
|
|
+ SysDept cityName = sysDeptService.getById(substring);
|
|
|
+ SysDept districtName = sysDeptService.getById(substring1);
|
|
|
+ SysDept provinceName = sysDeptService.getById(province);
|
|
|
+ SysDept storeDeptEntity = sysDeptService.getById(storeDept);
|
|
|
+ String deptName = dto.getDeptName();
|
|
|
+ String a = provinceName.getName()+"-"+cityName.getName()+"-"+districtName.getName()+"-"+storeDeptEntity.getName()+"-"+deptName;
|
|
|
+ dto.setDeptName(a);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return HttpResult.ok(sysUserListPage);
|
|
|
+ resultPage.setContent(qxFrontlineAgentDtos);
|
|
|
+ resultPage.setPageNum(qxFrontlineAgentVo.getPageNum());
|
|
|
+ resultPage.setPageSize(qxFrontlineAgentVo.getPageSize());
|
|
|
+ resultPage.setTotalPages(qxFrontlineAgentDtos.size());
|
|
|
+ return HttpResult.ok(resultPage);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return HttpResult.error("查询异常");
|
|
|
@@ -285,25 +332,25 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
userItem.setTotalPremium(orderManpower.getTotalPremium());
|
|
|
//单均保费
|
|
|
userItem.setAveragePremium(orderManpower.getAveragePremium());
|
|
|
- String deptId = userItem.getDeptId();
|
|
|
- if(StringUtils.isNotEmpty(deptId)){
|
|
|
- int length = deptId.length();
|
|
|
- if (length > 0) {
|
|
|
- if (length > 10) {
|
|
|
- String substring = deptId.substring(0, 6);
|
|
|
- String substring1 = deptId.substring(0, 8);
|
|
|
- String province = deptId.substring(0, 4);
|
|
|
- String storeDept = deptId.substring(0, 11);
|
|
|
- SysDept cityName = sysDeptService.getById(substring);
|
|
|
- SysDept districtName = sysDeptService.getById(substring1);
|
|
|
- SysDept provinceName = sysDeptService.getById(province);
|
|
|
- SysDept storeDeptEntity = sysDeptService.getById(storeDept);
|
|
|
- String deptName = userItem.getDeptName();
|
|
|
- String a = provinceName.getName()+"-"+cityName.getName()+"-"+districtName.getName()+"-"+storeDeptEntity.getName()+"-"+deptName;
|
|
|
- userItem.setDeptName(a);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// String deptId = userItem.getDeptId();
|
|
|
+// if(StringUtils.isNotEmpty(deptId)){
|
|
|
+// int length = deptId.length();
|
|
|
+// if (length > 0) {
|
|
|
+// if (length > 10) {
|
|
|
+// String substring = deptId.substring(0, 6);
|
|
|
+// String substring1 = deptId.substring(0, 8);
|
|
|
+// String province = deptId.substring(0, 4);
|
|
|
+// String storeDept = deptId.substring(0, 11);
|
|
|
+// SysDept cityName = sysDeptService.getById(substring);
|
|
|
+// SysDept districtName = sysDeptService.getById(substring1);
|
|
|
+// SysDept provinceName = sysDeptService.getById(province);
|
|
|
+// SysDept storeDeptEntity = sysDeptService.getById(storeDept);
|
|
|
+// String deptName = userItem.getDeptName();
|
|
|
+// String a = provinceName.getName()+"-"+cityName.getName()+"-"+districtName.getName()+"-"+storeDeptEntity.getName()+"-"+deptName;
|
|
|
+// userItem.setDeptName(a);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -334,26 +381,6 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
item.setAveragePremium(taskStatisticsDto.getAveragePremium());
|
|
|
item.setTotalPremium(taskStatisticsDto.getTotalPremium());
|
|
|
}
|
|
|
- String deptId = item.getDeptId();
|
|
|
- if(StringUtils.isNotEmpty(deptId)){
|
|
|
- int length = deptId.length();
|
|
|
- if (length > 0) {
|
|
|
- if (length > 10) {
|
|
|
- String substring = deptId.substring(0, 6);
|
|
|
- String substring1 = deptId.substring(0, 8);
|
|
|
- String province = deptId.substring(0, 4);
|
|
|
- String storeDept = deptId.substring(0, 11);
|
|
|
- SysDept cityName = sysDeptService.getById(substring);
|
|
|
- SysDept districtName = sysDeptService.getById(substring1);
|
|
|
- SysDept provinceName = sysDeptService.getById(province);
|
|
|
- SysDept storeDeptEntity = sysDeptService.getById(storeDept);
|
|
|
- String deptName = item.getDeptName();
|
|
|
- String a = provinceName.getName()+"-"+cityName.getName()+"-"+districtName.getName()+"-"+storeDeptEntity.getName()+"-"+deptName;
|
|
|
- item.setDeptName(a);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|