|
|
@@ -12,10 +12,7 @@ import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.dao.SysDeptMapper;
|
|
|
import com.ydtech.modules.admin.dao.SysUserMapper;
|
|
|
import com.ydtech.modules.admin.dao.SysUserRoleMapper;
|
|
|
-import com.ydtech.modules.admin.model.SysDept;
|
|
|
-import com.ydtech.modules.admin.model.SysUser;
|
|
|
-import com.ydtech.modules.admin.model.SysUserRole;
|
|
|
-import com.ydtech.modules.admin.model.SysUserRoleKzt;
|
|
|
+import com.ydtech.modules.admin.model.*;
|
|
|
import com.ydtech.modules.admin.model.dto.*;
|
|
|
import com.ydtech.modules.admin.model.report.user.*;
|
|
|
import com.ydtech.modules.admin.model.vo.AppCustomerManagementQueryVo;
|
|
|
@@ -32,18 +29,25 @@ import com.ydtech.modules.esm.model.vo.EsmTeamPolicyVO;
|
|
|
import com.ydtech.modules.esm.model.vo.EsmUserCountVO;
|
|
|
import com.ydtech.modules.esm.model.vo.EsmUserPolicyVO;
|
|
|
import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesSumEntity;
|
|
|
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
+import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.web.config.QuerydslWebConfiguration;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -77,6 +81,11 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
|
|
|
@Autowired
|
|
|
private SysDeptService sysDeptService;
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadPath;
|
|
|
+
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String uploadUrl;
|
|
|
|
|
|
/**
|
|
|
* @version
|
|
|
@@ -269,6 +278,56 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
return HttpResult.error("查询异常");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult agentExcel(QxFrontlineAgentVo qxFrontlineAgentVo) {
|
|
|
+// QxFrontlineAgentExcel
|
|
|
+
|
|
|
+ HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
|
|
|
+ qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
|
|
|
+ qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));
|
|
|
+
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getQxFrontlineAgentList.sort((dto1, dto2) -> {
|
|
|
+ BigDecimal premium1 = new BigDecimal(dto1.getTotalPremium());
|
|
|
+ BigDecimal premium2 = new BigDecimal(dto2.getTotalPremium());
|
|
|
+ return premium2.compareTo(premium1); // 降序排序
|
|
|
+ });
|
|
|
+ List<QxFrontlineAgentExcel> resultList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (QxFrontlineAgentDto dto : getQxFrontlineAgentList) {
|
|
|
+ QxFrontlineAgentExcel qxFrontlineAgentExcel = new QxFrontlineAgentExcel();
|
|
|
+ BeanUtils.copyProperties(dto,qxFrontlineAgentExcel);
|
|
|
+ resultList.add(qxFrontlineAgentExcel);
|
|
|
+ }
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, qxFrontlineAgentVo.getManagementSource() .equals("1") ? "人员渠道导出":"人员代理人导出", QxFrontlineAgentExcel.class, resultList);
|
|
|
+ return HttpResult.ok("", uploadUrl + "excel/" + fileName);
|
|
|
+ }
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
@@ -380,6 +439,9 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getOrderManpowerNew(qxFrontlineAgentDto);
|
|
|
item.setAveragePremium(taskStatisticsDto.getAveragePremium());
|
|
|
item.setTotalPremium(taskStatisticsDto.getTotalPremium());
|
|
|
+ }else {
|
|
|
+ item.setAveragePremium("0");
|
|
|
+ item.setTotalPremium("0");
|
|
|
}
|
|
|
}
|
|
|
}
|