|
@@ -20,6 +20,7 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysPlanPkg;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmAgentEvaluation;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEntDrugtable;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmDaDrugEntDrugtable;
|
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.entity.WmPackageRedemptionNotice;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmQccInfo;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmQccInfo;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackage;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackage;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackageStatus;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmScorePackageStatus;
|
|
@@ -36,6 +37,7 @@ import com.qunzhixinxi.hnqz.admin.service.SysUserAreaService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmAgentEvaluationService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmAgentEvaluationService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntDrugtableService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntDrugtableService;
|
|
|
|
+import com.qunzhixinxi.hnqz.admin.service.WmPackageRedemptionNoticeService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmQccInfoService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmQccInfoService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageStatusService;
|
|
import com.qunzhixinxi.hnqz.admin.service.WmScorePackageStatusService;
|
|
@@ -87,6 +89,7 @@ public class SysStatisticManager {
|
|
private final WmDaDrugEntDrugtableService drugTableService;
|
|
private final WmDaDrugEntDrugtableService drugTableService;
|
|
private final WmAgentEvaluationService agentEvaluationService;
|
|
private final WmAgentEvaluationService agentEvaluationService;
|
|
private final WmScorePackageStatusService scorePackageStatusService;
|
|
private final WmScorePackageStatusService scorePackageStatusService;
|
|
|
|
+ private final WmPackageRedemptionNoticeService packageRedemptionNoticeService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取积分包统计
|
|
* 获取积分包统计
|
|
@@ -754,6 +757,168 @@ public class SysStatisticManager {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 统计服务商数据
|
|
|
|
+ * <p>
|
|
|
|
+ * 序号、服务商名称、所属区域、服务产品、企查查评分、服务评分、服务商平均分
|
|
|
|
+ *
|
|
|
|
+ * @param query 查询条件
|
|
|
|
+ * @param user 操作人
|
|
|
|
+ * @return 统计信息
|
|
|
|
+ */
|
|
|
|
+ public Page<?> statProviderDataNew(SysStatisticDto.OnProviderQccData query, HnqzUser user) {
|
|
|
|
+
|
|
|
|
+ // 获取服务商分页
|
|
|
|
+ Page<SysDept> page = new Page<>(query.getCurrent(), query.getSize());
|
|
|
|
+
|
|
|
|
+ // 获取当前操作人的角色
|
|
|
|
+ List<Integer> roles = SecurityUtils.getRoles();
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<SysDept> queryWrapper = Wrappers.<SysDept>lambdaQuery().eq(SysDept::getLevel, 4).eq(SysDept::getDelFlag, CommonConstants.STATUS_NORMAL);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 服务商
|
|
|
|
+ if (roles.contains(37)) {
|
|
|
|
+ queryWrapper.eq(SysDept::getDeptId, user.getDeptId());
|
|
|
|
+ }
|
|
|
|
+ // 区域管理员 || 地市经理
|
|
|
|
+ else if (CollUtil.containsAny(roles, List.of(4, 43))) {
|
|
|
|
+
|
|
|
|
+ List<Integer> entIds = getEntIds(user);
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(entIds)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.in(SysDept::getDeptId, entIds);
|
|
|
|
+ }
|
|
|
|
+ // 其他
|
|
|
|
+ else {
|
|
|
|
+ List<Integer> entIds = getEntIds(user);
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(entIds)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.in(SysDept::getDeptId, entIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ deptService.page(page, queryWrapper);
|
|
|
|
+
|
|
|
|
+ List<SysDept> depts = page.getRecords();
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(depts)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取企业的服务区域
|
|
|
|
+ List<Long> deptIds = depts.stream().mapToLong(SysDept::getDeptId).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
|
+ Map<Long, List<Long>> detpId2AreaCodesMap = enterpriseAreaService.listEntAreas1(deptIds);
|
|
|
|
+
|
|
|
|
+ // 获取企查查信息
|
|
|
|
+ List<String> regCodes = depts.stream().map(SysDept::getTaxCode).distinct().sorted().collect(Collectors.toList());
|
|
|
|
+ Map<String, List<WmQccInfo>> qccInfo = qccInfoService.getQccInfo1(regCodes);
|
|
|
|
+
|
|
|
|
+ // 获取服务评分
|
|
|
|
+ List<WmScorePackage> pkgs = packageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
|
+ .eq(WmScorePackage::getTypeid, UpmsType.PackageType.TYPE_1)
|
|
|
|
+ .eq(WmScorePackage::getEnableFlag, EnableEnum.ENABLE.val()));
|
|
|
|
+
|
|
|
|
+ List<Integer> pIds = pkgs.stream().mapToInt(p -> Integer.parseInt(p.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Map<String, List<WmScorePackage>> deptPackageMap = pkgs.stream().collect(Collectors.groupingBy(WmScorePackage::getDeptId));
|
|
|
|
+
|
|
|
|
+ Map<Integer, List<WmPackageRedemptionNotice>> noticeMap = CollUtil.isEmpty(pIds) ? Collections.emptyMap() : packageRedemptionNoticeService.list(Wrappers.<WmPackageRedemptionNotice>lambdaQuery()
|
|
|
|
+ .in(WmPackageRedemptionNotice::getPackageId, pIds)).stream().collect(Collectors.groupingBy(WmPackageRedemptionNotice::getPackageId));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 获取服务商的产品信息
|
|
|
|
+ List<ReDeptDrug> deptDrugs = deptDrugService.list(Wrappers.<ReDeptDrug>lambdaQuery().in(ReDeptDrug::getDeptId, deptIds.stream().mapToInt(Long::intValue).boxed().collect(Collectors.toList())));
|
|
|
|
+ Map<Integer, List<String>> drugMap;
|
|
|
|
+ if (CollUtil.isNotEmpty(deptDrugs)) {
|
|
|
|
+ List<String> drugIds = deptDrugs.stream().map(dd -> dd.getDrugId().toString()).distinct().sorted().collect(Collectors.toList());
|
|
|
|
+ Map<String, String> drugtableMap = drugTableService.list(Wrappers.<WmDaDrugEntDrugtable>lambdaQuery()
|
|
|
|
+ .eq(WmDaDrugEntDrugtable::getDelFlag, CommonConstants.STATUS_NORMAL)
|
|
|
|
+ .eq(WmDaDrugEntDrugtable::getEnableFlag, CommonConstants.STATUS_NORMAL)
|
|
|
|
+ .in(WmDaDrugEntDrugtable::getId, drugIds))
|
|
|
|
+ .stream()
|
|
|
|
+ .collect(Collectors.toMap(WmDaDrugEntDrugtable::getId, WmDaDrugEntDrugtable::getDrugnameTy));
|
|
|
|
+
|
|
|
|
+ drugMap = deptDrugs.stream().collect(Collectors.groupingBy(ReDeptDrug::getDeptId, Collectors.mapping(dd -> drugtableMap.get(dd.getDrugId().toString()), Collectors.toList())));
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ drugMap = Collections.emptyMap();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 封装参数 序号、服务商名称、所属区域、服务产品、企查查评分、服务评分、服务商平均分
|
|
|
|
+ List<Map<String, Object>> collect = depts.stream().map(d -> {
|
|
|
|
+ Map<String, Object> map = new HashMap<>(6);
|
|
|
|
+
|
|
|
|
+ // 企业ID
|
|
|
|
+ map.put("id", d.getDeptId());
|
|
|
|
+ // 服务商名称
|
|
|
|
+ map.put("providerName", d.getName());
|
|
|
|
+ // 区域(只显示省份)
|
|
|
|
+ List<Long> areaCodes = detpId2AreaCodesMap.get((long) d.getDeptId());
|
|
|
|
+ List<String> provinceNames = CollUtil.isEmpty(areaCodes)
|
|
|
|
+ ? Collections.emptyList()
|
|
|
|
+ : areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery()
|
|
|
|
+ .in(SysAreaEntity::getAreaType, UpmsType.AreaType.PROVINCE)
|
|
|
|
+ .in(SysAreaEntity::getAreaId, areaCodes))
|
|
|
|
+ .stream()
|
|
|
|
+ .map(SysAreaEntity::getAreaName)
|
|
|
|
+ .distinct()
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ ;
|
|
|
|
+
|
|
|
|
+ map.put("areaCodes", provinceNames);
|
|
|
|
+ // 服务产品
|
|
|
|
+ List<String> drugNames = drugMap.get(d.getDeptId());
|
|
|
|
+ map.put("products", drugNames);
|
|
|
|
+
|
|
|
|
+ // 企查查评分
|
|
|
|
+ Map<String, Object> creditRatingReportGrade;
|
|
|
|
+ if (StrUtil.isNotBlank(d.getTaxCode())) {
|
|
|
|
+ List<WmQccInfo> wmQccInfos = qccInfo.get(d.getTaxCode());
|
|
|
|
+ if (CollUtil.isNotEmpty(wmQccInfos)) {
|
|
|
|
+ creditRatingReportGrade = wmQccInfos.get(0).getCreditRatingReportGrade();
|
|
|
|
+ } else {
|
|
|
|
+ creditRatingReportGrade = Collections.emptyMap();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ creditRatingReportGrade = Collections.emptyMap();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ map.put("qccScore", creditRatingReportGrade);
|
|
|
|
+
|
|
|
|
+ // 服务商评分
|
|
|
|
+ List<WmScorePackage> packages = deptPackageMap.get(d.getDeptId().toString());
|
|
|
|
+
|
|
|
|
+ List<Map<String, Object>> pMaps = packages.stream().map(p -> {
|
|
|
|
+ Map<String, Object> m = new HashMap<>(3);
|
|
|
|
+ m.put("id", p.getId());
|
|
|
|
+ m.put("pkgName", p.getScorePackageName());
|
|
|
|
+ m.put("redemptionNotices", noticeMap.get(Integer.parseInt(p.getId())));
|
|
|
|
+
|
|
|
|
+ return m;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ map.put("packages", pMaps);
|
|
|
|
+
|
|
|
|
+ return map;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Page<Map<String, Object>> builds = new Page<>(query.getCurrent(), query.getSize());
|
|
|
|
+ builds.setRecords(collect);
|
|
|
|
+ builds.setTotal(page.getTotal());
|
|
|
|
+
|
|
|
|
+ return builds;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 服务提供商数据
|
|
* 服务提供商数据
|
|
*
|
|
*
|