|
@@ -74,922 +74,1077 @@ import java.util.stream.Collectors;
|
|
|
@AllArgsConstructor
|
|
|
public class WmPackageManager {
|
|
|
|
|
|
-
|
|
|
- private static final int BIZ_ADMIN_ROLE = 41;
|
|
|
- private static final int SERV_ADMIN_ROLE = 37;
|
|
|
- private static final int DIST_ADMIN_ROLE = 4;
|
|
|
- private static final int OK_CHAIN_TASK_NODE = 6;
|
|
|
-
|
|
|
- private final WmScorePackageService scorePackageService;
|
|
|
- private final SysUserRoleService userRoleService;
|
|
|
- private final WmTaskService taskService;
|
|
|
- private final WmTaskTypeService taskTypeService;
|
|
|
- private final SysCheckChainNodeCheckHistoryService checkChainNodeCheckHistoryService;
|
|
|
- private final WmPackageRedemptionNoticeService packageRedemptionNoticeService;
|
|
|
- private final WmPackageTaskTypeQtyService pkgTaskTypeQtyService;
|
|
|
- private final SysPlanPkgService planPkgService;
|
|
|
- private final SysImplementPlanService implementPlanService;
|
|
|
- private final SysUserDrugService userDrugService;
|
|
|
- private final SysEnterpriseAreaService enterpriseAreaService;
|
|
|
- private final SysAreaEntityService areaEntityService;
|
|
|
- private final SysUserAreaService userAreaService;
|
|
|
- private final SysDeptService deptService;
|
|
|
- private final WmDaDrugEntDrugtableMapper wmDaDrugEntDrugtableMapper;
|
|
|
- private final WmPackageTaskTypeQtyService packageTaskTypeQtyService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 创建执行包兑付通知
|
|
|
- *
|
|
|
- * @param resource 兑付信息
|
|
|
- * @param user 添加人
|
|
|
- * @return 创建结果
|
|
|
- */
|
|
|
- public Boolean createPackageRedemptionNotice(WmPkgDTO.OnRedemptionNoticeCreate resource, HnqzUser user) {
|
|
|
-
|
|
|
- boolean noticed = packageRedemptionNoticeService.hasNotice(resource.getPackageId(), resource.getStep());
|
|
|
-
|
|
|
- if (noticed) {
|
|
|
- throw new BizException("当前执行包,已存在第【" + resource.getStep() + "】兑付通知,请勿重新发起");
|
|
|
- }
|
|
|
-
|
|
|
- return packageRedemptionNoticeService.createPackageRedemptionNotice(resource, user);
|
|
|
+ private static final int BIZ_ADMIN_ROLE = 41;
|
|
|
+ private static final int SERV_ADMIN_ROLE = 37;
|
|
|
+ private static final int DIST_ADMIN_ROLE = 4;
|
|
|
+ private static final int OK_CHAIN_TASK_NODE = 6;
|
|
|
+
|
|
|
+ private final WmScorePackageService scorePackageService;
|
|
|
+ private final SysUserRoleService userRoleService;
|
|
|
+ private final WmTaskService taskService;
|
|
|
+ private final WmTaskTypeService taskTypeService;
|
|
|
+ private final SysCheckChainNodeCheckHistoryService checkChainNodeCheckHistoryService;
|
|
|
+ private final WmPackageRedemptionNoticeService packageRedemptionNoticeService;
|
|
|
+ private final WmPackageTaskTypeQtyService pkgTaskTypeQtyService;
|
|
|
+ private final SysPlanPkgService planPkgService;
|
|
|
+ private final SysImplementPlanService implementPlanService;
|
|
|
+ private final SysUserDrugService userDrugService;
|
|
|
+ private final SysEnterpriseAreaService enterpriseAreaService;
|
|
|
+ private final SysAreaEntityService areaEntityService;
|
|
|
+ private final SysUserAreaService userAreaService;
|
|
|
+ private final SysDeptService deptService;
|
|
|
+ private final WmDaDrugEntDrugtableMapper wmDaDrugEntDrugtableMapper;
|
|
|
+ private final WmPackageTaskTypeQtyService packageTaskTypeQtyService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建执行包兑付通知
|
|
|
+ *
|
|
|
+ * @param resource 兑付信息
|
|
|
+ * @param user 添加人
|
|
|
+ * @return 创建结果
|
|
|
+ */
|
|
|
+ public Boolean createPackageRedemptionNotice(
|
|
|
+ WmPkgDTO.OnRedemptionNoticeCreate resource, HnqzUser user) {
|
|
|
+
|
|
|
+ boolean noticed =
|
|
|
+ packageRedemptionNoticeService.hasNotice(resource.getPackageId(), resource.getStep());
|
|
|
+
|
|
|
+ if (noticed) {
|
|
|
+ throw new BizException("当前执行包,已存在第【" + resource.getStep() + "】兑付通知,请勿重新发起");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取兑付通知分页
|
|
|
- *
|
|
|
- * @param query 查询条件
|
|
|
- * @param user 查询人
|
|
|
- * @return 返回结果
|
|
|
- */
|
|
|
- public Page<Map<String, Object>> pageRedemptionNotices(WmPkgDTO.OnRedemptionNoticePage query, HnqzUser user) {
|
|
|
-
|
|
|
- Page<Map<String, Object>> res = new Page<>(query.getCurrent(), query.getSize());
|
|
|
-
|
|
|
- // 获取用户角色
|
|
|
- List<Integer> roles = SecurityUtils.getRoles();
|
|
|
- // Set<Integer> roleIds = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, user.getId()))
|
|
|
- // .stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
-
|
|
|
- Page<WmPackageRedemptionNotice> page = new Page<>(query.getCurrent(), query.getSize());
|
|
|
- LambdaQueryWrapper<WmPackageRedemptionNotice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
-
|
|
|
- // 根据用户角色判断是管理员还是服务商
|
|
|
- // 区域管理员
|
|
|
- if (roles.contains(DIST_ADMIN_ROLE)) {
|
|
|
- queryWrapper.eq(WmPackageRedemptionNotice::getFromEntId, user.getDeptId()).eq(WmPackageRedemptionNotice::getCreateBy, user.getUsername());
|
|
|
- }
|
|
|
- // 事业部分管领导 || 所有监督角色
|
|
|
- else if (CollUtil.containsAny(roles, List.of(BIZ_ADMIN_ROLE, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61))) {
|
|
|
- // 只能看见所绑定药品的包的内容
|
|
|
- List<SysUserDrug> userDrugs = userDrugService.list(Wrappers.<SysUserDrug>lambdaQuery().eq(SysUserDrug::getUserId, user.getId()));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(userDrugs)) {
|
|
|
- throw new BizException("当前人员并未绑定产品,无法确定可见范围,请核实");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 1. 获取操作可见的区域
|
|
|
- List<Long> areaIds = userAreaService.listUserAreas(Long.valueOf(user.getId()));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(areaIds)) {
|
|
|
- throw new BizException("当前人员并未绑定区域,无法确定可见范围,请核实");
|
|
|
- }
|
|
|
-
|
|
|
- List<Long> collect = areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery().in(SysAreaEntity::getAreaId, areaIds).eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
|
|
|
- .stream().mapToLong(SysAreaEntity::getAreaId).boxed().collect(Collectors.toList());
|
|
|
-
|
|
|
- List<Long> entIds = enterpriseAreaService.listAreaEnts(collect);
|
|
|
-
|
|
|
-
|
|
|
- List<String> drugIds = userDrugs.stream().map(ud -> ud.getDrugId().toString()).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- List<WmScorePackage> pkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
- .in(WmScorePackage::getSendPackageDeptId, entIds)
|
|
|
- .in(WmScorePackage::getDrugtable, drugIds));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(pkgs)) {
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> pkgIds = pkgs.stream().mapToInt(p -> Integer.parseInt(p.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- queryWrapper.in(WmPackageRedemptionNotice::getPackageId, pkgIds);
|
|
|
-
|
|
|
- }
|
|
|
- // 服务商
|
|
|
- else if (roles.contains(SERV_ADMIN_ROLE)) {
|
|
|
- queryWrapper
|
|
|
- .eq(WmPackageRedemptionNotice::getCheckState, WmPackageRedemptionNotice.CheckState.PASSED)
|
|
|
- .eq(WmPackageRedemptionNotice::getToEntId, user.getDeptId());
|
|
|
- } else {
|
|
|
- throw new BizException("角色不支持该数据查询");
|
|
|
- }
|
|
|
-
|
|
|
- packageRedemptionNoticeService.page(page, queryWrapper);
|
|
|
-
|
|
|
- List<WmPackageRedemptionNotice> records = page.getRecords();
|
|
|
- List<Map<String, Object>> resList;
|
|
|
- if (CollUtil.isNotEmpty(records)) {
|
|
|
-
|
|
|
- Set<Integer> pkgIds = records.stream().mapToInt(WmPackageRedemptionNotice::getPackageId).boxed().collect(Collectors.toSet());
|
|
|
-
|
|
|
- Map<String, WmScorePackage> pkgIdToPkgMap = scorePackageService.listByIds(pkgIds).stream().collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
|
|
|
-
|
|
|
-
|
|
|
- resList = records.stream().map(r -> {
|
|
|
- Map<String, Object> map = BeanUtil.copyProperties(r, Map.class);
|
|
|
-
|
|
|
- WmScorePackage wmScorePackage = pkgIdToPkgMap.get(r.getPackageId().toString());
|
|
|
- String pkgName = Objects.nonNull(wmScorePackage) ? wmScorePackage.getScorePackageName() : "";
|
|
|
- String score = Objects.nonNull(wmScorePackage) ? wmScorePackage.getScore().toString() : "";
|
|
|
-
|
|
|
- map.put("packageName", pkgName);
|
|
|
- map.put("packageScore", score);
|
|
|
- return map;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- } else {
|
|
|
- resList = Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- res.setRecords(resList);
|
|
|
- res.setTotal(page.getTotal());
|
|
|
- return res;
|
|
|
+ return packageRedemptionNoticeService.createPackageRedemptionNotice(resource, user);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取兑付通知分页
|
|
|
+ *
|
|
|
+ * @param query 查询条件
|
|
|
+ * @param user 查询人
|
|
|
+ * @return 返回结果
|
|
|
+ */
|
|
|
+ public Page<Map<String, Object>> pageRedemptionNotices(
|
|
|
+ WmPkgDTO.OnRedemptionNoticePage query, HnqzUser user) {
|
|
|
+
|
|
|
+ Page<Map<String, Object>> res = new Page<>(query.getCurrent(), query.getSize());
|
|
|
+
|
|
|
+ // 获取用户角色
|
|
|
+ List<Integer> roles = SecurityUtils.getRoles();
|
|
|
+ // Set<Integer> roleIds =
|
|
|
+ // userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId,
|
|
|
+ // user.getId()))
|
|
|
+ // .stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Page<WmPackageRedemptionNotice> page = new Page<>(query.getCurrent(), query.getSize());
|
|
|
+ LambdaQueryWrapper<WmPackageRedemptionNotice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+
|
|
|
+ // 根据用户角色判断是管理员还是服务商
|
|
|
+ // 区域管理员
|
|
|
+ if (roles.contains(DIST_ADMIN_ROLE)) {
|
|
|
+ queryWrapper
|
|
|
+ .eq(WmPackageRedemptionNotice::getFromEntId, user.getDeptId())
|
|
|
+ .eq(WmPackageRedemptionNotice::getCreateBy, user.getUsername());
|
|
|
}
|
|
|
+ // 事业部分管领导 || 所有监督角色
|
|
|
+ else if (CollUtil.containsAny(
|
|
|
+ roles, List.of(BIZ_ADMIN_ROLE, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61))) {
|
|
|
+ // 只能看见所绑定药品的包的内容
|
|
|
+ List<SysUserDrug> userDrugs =
|
|
|
+ userDrugService.list(
|
|
|
+ Wrappers.<SysUserDrug>lambdaQuery().eq(SysUserDrug::getUserId, user.getId()));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(userDrugs)) {
|
|
|
+ throw new BizException("当前人员并未绑定产品,无法确定可见范围,请核实");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1. 获取操作可见的区域
|
|
|
+ List<Long> areaIds = userAreaService.listUserAreas(Long.valueOf(user.getId()));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(areaIds)) {
|
|
|
+ throw new BizException("当前人员并未绑定区域,无法确定可见范围,请核实");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> collect =
|
|
|
+ areaEntityService
|
|
|
+ .list(
|
|
|
+ Wrappers.<SysAreaEntity>lambdaQuery()
|
|
|
+ .in(SysAreaEntity::getAreaId, areaIds)
|
|
|
+ .eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
|
|
|
+ .stream()
|
|
|
+ .mapToLong(SysAreaEntity::getAreaId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Long> entIds = enterpriseAreaService.listAreaEnts(collect);
|
|
|
+
|
|
|
+ List<String> drugIds =
|
|
|
+ userDrugs.stream()
|
|
|
+ .map(ud -> ud.getDrugId().toString())
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<WmScorePackage> pkgs =
|
|
|
+ scorePackageService.list(
|
|
|
+ Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ .in(WmScorePackage::getSendPackageDeptId, entIds)
|
|
|
+ .in(WmScorePackage::getDrugtable, drugIds));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(pkgs)) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 阅读通知
|
|
|
- *
|
|
|
- * @param resource 阅读信息
|
|
|
- * @param user 阅读人
|
|
|
- * @return 操作结果
|
|
|
- */
|
|
|
- public Boolean readRedemptionNotice(WmPkgDTO.OnNoticeRead resource, HnqzUser user) {
|
|
|
-
|
|
|
- this.checkRole(user);
|
|
|
-
|
|
|
+ List<Integer> pkgIds =
|
|
|
+ pkgs.stream()
|
|
|
+ .mapToInt(p -> Integer.parseInt(p.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
- boolean read = packageRedemptionNoticeService.hasRead(resource.getNoticeId());
|
|
|
- if (read) {
|
|
|
- return Boolean.TRUE;
|
|
|
- }
|
|
|
+ queryWrapper.in(WmPackageRedemptionNotice::getPackageId, pkgIds);
|
|
|
|
|
|
- return packageRedemptionNoticeService.readRedemptionNotice(resource, user);
|
|
|
+ }
|
|
|
+ // 服务商
|
|
|
+ else if (roles.contains(SERV_ADMIN_ROLE)) {
|
|
|
+ queryWrapper
|
|
|
+ .eq(WmPackageRedemptionNotice::getCheckState, WmPackageRedemptionNotice.CheckState.PASSED)
|
|
|
+ .eq(WmPackageRedemptionNotice::getToEntId, user.getDeptId());
|
|
|
+ } else {
|
|
|
+ throw new BizException("角色不支持该数据查询");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 确认通知
|
|
|
- *
|
|
|
- * @param resource 确认信息
|
|
|
- * @param user 确认人
|
|
|
- * @return 操作结果
|
|
|
- */
|
|
|
- public Boolean doAcceptNotice(WmPkgDTO.OnAcceptNotice resource, HnqzUser user) {
|
|
|
-
|
|
|
- this.checkRole(user);
|
|
|
- return packageRedemptionNoticeService.doAcceptNotice(resource, user);
|
|
|
+ packageRedemptionNoticeService.page(page, queryWrapper);
|
|
|
+
|
|
|
+ List<WmPackageRedemptionNotice> records = page.getRecords();
|
|
|
+ List<Map<String, Object>> resList;
|
|
|
+ if (CollUtil.isNotEmpty(records)) {
|
|
|
+
|
|
|
+ Set<Integer> pkgIds =
|
|
|
+ records.stream()
|
|
|
+ .mapToInt(WmPackageRedemptionNotice::getPackageId)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Map<String, WmScorePackage> pkgIdToPkgMap =
|
|
|
+ scorePackageService.listByIds(pkgIds).stream()
|
|
|
+ .collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
|
|
|
+
|
|
|
+ resList =
|
|
|
+ records.stream()
|
|
|
+ .map(
|
|
|
+ r -> {
|
|
|
+ Map<String, Object> map = BeanUtil.copyProperties(r, Map.class);
|
|
|
+
|
|
|
+ WmScorePackage wmScorePackage = pkgIdToPkgMap.get(r.getPackageId().toString());
|
|
|
+ String pkgName =
|
|
|
+ Objects.nonNull(wmScorePackage) ? wmScorePackage.getScorePackageName() : "";
|
|
|
+ String score =
|
|
|
+ Objects.nonNull(wmScorePackage) ? wmScorePackage.getScore().toString() : "";
|
|
|
+
|
|
|
+ map.put("packageName", pkgName);
|
|
|
+ map.put("packageScore", score);
|
|
|
+ return map;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ resList = Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
+ res.setRecords(resList);
|
|
|
+ res.setTotal(page.getTotal());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 阅读通知
|
|
|
+ *
|
|
|
+ * @param resource 阅读信息
|
|
|
+ * @param user 阅读人
|
|
|
+ * @return 操作结果
|
|
|
+ */
|
|
|
+ public Boolean readRedemptionNotice(WmPkgDTO.OnNoticeRead resource, HnqzUser user) {
|
|
|
+
|
|
|
+ this.checkRole(user);
|
|
|
+
|
|
|
+ boolean read = packageRedemptionNoticeService.hasRead(resource.getNoticeId());
|
|
|
+ if (read) {
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
|
|
|
- private void checkRole(HnqzUser user) {
|
|
|
- List<SysUserRole> userRoles = userRoleService.list(Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, user.getId()));
|
|
|
+ return packageRedemptionNoticeService.readRedemptionNotice(resource, user);
|
|
|
+ }
|
|
|
|
|
|
- Set<Integer> roleIds = userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
+ /**
|
|
|
+ * 确认通知
|
|
|
+ *
|
|
|
+ * @param resource 确认信息
|
|
|
+ * @param user 确认人
|
|
|
+ * @return 操作结果
|
|
|
+ */
|
|
|
+ public Boolean doAcceptNotice(WmPkgDTO.OnAcceptNotice resource, HnqzUser user) {
|
|
|
|
|
|
- if (!roleIds.contains(SERV_ADMIN_ROLE)) {
|
|
|
- throw new BizException("您没有阅读权限");
|
|
|
- }
|
|
|
- }
|
|
|
+ this.checkRole(user);
|
|
|
+ return packageRedemptionNoticeService.doAcceptNotice(resource, user);
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 获取执行包兑付通知信息
|
|
|
- *
|
|
|
- * @param packageId 执行包ID
|
|
|
- * @param user 操作人
|
|
|
- * @return 统计信息
|
|
|
- */
|
|
|
- public Map<String, Object> getRedemptionValueStat(Integer packageId, HnqzUser user) {
|
|
|
+ private void checkRole(HnqzUser user) {
|
|
|
+ List<SysUserRole> userRoles =
|
|
|
+ userRoleService.list(
|
|
|
+ Wrappers.<SysUserRole>lambdaQuery().eq(SysUserRole::getUserId, user.getId()));
|
|
|
|
|
|
- // 获取积分包
|
|
|
- WmScorePackage scorePackage = scorePackageService.getById(packageId);
|
|
|
+ Set<Integer> roleIds =
|
|
|
+ userRoles.stream().mapToInt(SysUserRole::getRoleId).boxed().collect(Collectors.toSet());
|
|
|
|
|
|
- // 获取服务计划
|
|
|
- List<SysPlanPkg> list = planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().eq(SysPlanPkg::getPkgId, packageId));
|
|
|
-
|
|
|
- long planScore = 0L;
|
|
|
+ if (!roleIds.contains(SERV_ADMIN_ROLE)) {
|
|
|
+ throw new BizException("您没有阅读权限");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(list)) {
|
|
|
+ /**
|
|
|
+ * 获取执行包兑付通知信息
|
|
|
+ *
|
|
|
+ * @param packageId 执行包ID
|
|
|
+ * @param user 操作人
|
|
|
+ * @return 统计信息
|
|
|
+ */
|
|
|
+ public Map<String, Object> getRedemptionValueStat(Integer packageId, HnqzUser user) {
|
|
|
|
|
|
- SysImplementPlan plan = implementPlanService.getById(list.get(0).getPlanId());
|
|
|
+ // 获取积分包
|
|
|
+ WmScorePackage scorePackage = scorePackageService.getById(packageId);
|
|
|
|
|
|
- if (plan != null) {
|
|
|
- planScore = plan.getPlanScore();
|
|
|
- }
|
|
|
+ // 获取服务计划
|
|
|
+ List<SysPlanPkg> list =
|
|
|
+ planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().eq(SysPlanPkg::getPkgId, packageId));
|
|
|
|
|
|
- }
|
|
|
+ long planScore = 0L;
|
|
|
|
|
|
- // 获取积分包中的任务
|
|
|
- List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().eq(WmTask::getScorePackageId, packageId));
|
|
|
- Map<String, WmTask> taskId2EntityMap = tasks.stream().collect(Collectors.toMap(WmTask::getId, Function.identity()));
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
|
- Set<Integer> taskIds = tasks.stream().map(WmTask::getId).mapToInt(Integer::valueOf).boxed().collect(Collectors.toSet());
|
|
|
+ SysImplementPlan plan = implementPlanService.getById(list.get(0).getPlanId());
|
|
|
|
|
|
- // 审核通过的记录
|
|
|
- List<SysCheckChainNodeCheckHistory> okTasks = CollUtil.isNotEmpty(tasks) ? checkChainNodeCheckHistoryService.list(Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery().eq(SysCheckChainNodeCheckHistory::getNodeId, OK_CHAIN_TASK_NODE)
|
|
|
- .in(SysCheckChainNodeCheckHistory::getTargetId, taskIds)) : Collections.emptyList();
|
|
|
+ if (plan != null) {
|
|
|
+ planScore = plan.getPlanScore();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // 兑付信息
|
|
|
- List<WmPackageRedemptionNotice> notices = packageRedemptionNoticeService.list(Wrappers.<WmPackageRedemptionNotice>lambdaQuery()
|
|
|
+ // 获取积分包中的任务
|
|
|
+ List<WmTask> tasks =
|
|
|
+ taskService.list(Wrappers.<WmTask>lambdaQuery().eq(WmTask::getScorePackageId, packageId));
|
|
|
+ Map<String, WmTask> taskId2EntityMap =
|
|
|
+ tasks.stream().collect(Collectors.toMap(WmTask::getId, Function.identity()));
|
|
|
+
|
|
|
+ Set<Integer> taskIds =
|
|
|
+ tasks.stream()
|
|
|
+ .map(WmTask::getId)
|
|
|
+ .mapToInt(Integer::valueOf)
|
|
|
+ .boxed()
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 审核通过的记录
|
|
|
+ List<SysCheckChainNodeCheckHistory> okTasks =
|
|
|
+ CollUtil.isNotEmpty(tasks)
|
|
|
+ ? checkChainNodeCheckHistoryService.list(
|
|
|
+ Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
+ .eq(SysCheckChainNodeCheckHistory::getNodeId, OK_CHAIN_TASK_NODE)
|
|
|
+ .in(SysCheckChainNodeCheckHistory::getTargetId, taskIds))
|
|
|
+ : Collections.emptyList();
|
|
|
+
|
|
|
+ // 兑付信息
|
|
|
+ List<WmPackageRedemptionNotice> notices =
|
|
|
+ packageRedemptionNoticeService.list(
|
|
|
+ Wrappers.<WmPackageRedemptionNotice>lambdaQuery()
|
|
|
.eq(WmPackageRedemptionNotice::getPackageId, packageId)
|
|
|
- .in(WmPackageRedemptionNotice::getNoticeState, WmPackageRedemptionNotice.NoticeState.CONFIRM.getState(), WmPackageRedemptionNotice.NoticeState.ARGUE.getState(), WmPackageRedemptionNotice.NoticeState.DONE.getState())
|
|
|
+ .in(
|
|
|
+ WmPackageRedemptionNotice::getNoticeState,
|
|
|
+ WmPackageRedemptionNotice.NoticeState.CONFIRM.getState(),
|
|
|
+ WmPackageRedemptionNotice.NoticeState.ARGUE.getState(),
|
|
|
+ WmPackageRedemptionNotice.NoticeState.DONE.getState())
|
|
|
.orderByDesc(WmPackageRedemptionNotice::getCreateTime));
|
|
|
|
|
|
- Map<String, Object> result = new HashMap<>(11);
|
|
|
- result.put("id", packageId);
|
|
|
- result.put("pkgSn", scorePackage.getPackageSn());
|
|
|
- result.put("pkgName", scorePackage.getScorePackageName());
|
|
|
- result.put("pkgScore", scorePackage.getScore());
|
|
|
- result.put("nextStep", CollUtil.isNotEmpty(notices) ? notices.get(0).getStep() + 1 : 1);
|
|
|
+ Map<String, Object> result = new HashMap<>(11);
|
|
|
+ result.put("id", packageId);
|
|
|
+ result.put("pkgSn", scorePackage.getPackageSn());
|
|
|
+ result.put("pkgName", scorePackage.getScorePackageName());
|
|
|
+ result.put("pkgScore", scorePackage.getScore());
|
|
|
+ result.put("nextStep", CollUtil.isNotEmpty(notices) ? notices.get(0).getStep() + 1 : 1);
|
|
|
+
|
|
|
+ int taskTotalCount = tasks.size();
|
|
|
|
|
|
- int taskTotalCount = tasks.size();
|
|
|
+ // 任务
|
|
|
+ result.put("taskTotalCount", taskTotalCount);
|
|
|
|
|
|
- // 任务
|
|
|
- result.put("taskTotalCount", taskTotalCount);
|
|
|
+ // 服务项目完成度
|
|
|
+ long okTaskScoreSum = 0L;
|
|
|
|
|
|
- // 服务项目完成度
|
|
|
- long okTaskScoreSum = 0L;
|
|
|
+ for (SysCheckChainNodeCheckHistory node : okTasks) {
|
|
|
+ WmTask wmTask = taskId2EntityMap.get(node.getTargetId().toString());
|
|
|
+ if (wmTask != null) {
|
|
|
+ okTaskScoreSum += wmTask.getScore();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- for (SysCheckChainNodeCheckHistory node : okTasks) {
|
|
|
- WmTask wmTask = taskId2EntityMap.get(node.getTargetId().toString());
|
|
|
- if (wmTask != null) {
|
|
|
- okTaskScoreSum += wmTask.getScore();
|
|
|
- }
|
|
|
- }
|
|
|
+ result.put(
|
|
|
+ "servicePlanDeviationRate",
|
|
|
+ String.format("%.2f", okTaskScoreSum * 100.0 / ((planScore == 0) ? 1 : planScore)));
|
|
|
|
|
|
- result.put("servicePlanDeviationRate", String.format("%.2f", okTaskScoreSum * 100.0 / ((planScore == 0) ? 1 : planScore)));
|
|
|
+ // 任务完成比例
|
|
|
+ result.put(
|
|
|
+ "taskCompleteRate",
|
|
|
+ String.format(
|
|
|
+ "%.2f", okTasks.size() * 100.0 / ((taskTotalCount == 0) ? 1 : taskTotalCount)));
|
|
|
|
|
|
- // 任务完成比例
|
|
|
- result.put("taskCompleteRate", String.format("%.2f", okTasks.size() * 100.0 / ((taskTotalCount == 0) ? 1 : taskTotalCount)));
|
|
|
+ // 客户接洽率
|
|
|
+ // result.put("marketCustomerContactRate", "3");
|
|
|
|
|
|
- // 客户接洽率
|
|
|
- // result.put("marketCustomerContactRate", "3");
|
|
|
+ // 执行包数量
|
|
|
+ result.put("pkgQty", 1);
|
|
|
|
|
|
- // 执行包数量
|
|
|
- result.put("pkgQty", 1);
|
|
|
+ // 发包企业
|
|
|
+ result.put("fromEntId", scorePackage.getSendPackageDeptId());
|
|
|
|
|
|
- // 发包企业
|
|
|
- result.put("fromEntId", scorePackage.getSendPackageDeptId());
|
|
|
+ // 接包企业
|
|
|
+ result.put("toEntId", scorePackage.getDeptId());
|
|
|
|
|
|
- // 接包企业
|
|
|
- result.put("toEntId", scorePackage.getDeptId());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取积分包任务信息详情
|
|
|
+ *
|
|
|
+ * @param pkgId 积分包ID
|
|
|
+ * @return 积分包任务信息详情
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> listPkgTaskDetails(Integer pkgId) {
|
|
|
|
|
|
- return result;
|
|
|
+ // 获取积分包拆解信息
|
|
|
+ List<WmPackageTaskTypeQty> packageTaskTypeQtyList =
|
|
|
+ pkgTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(Collections.singletonList(pkgId));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(packageTaskTypeQtyList)) {
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取积分包任务信息详情
|
|
|
- *
|
|
|
- * @param pkgId 积分包ID
|
|
|
- * @return 积分包任务信息详情
|
|
|
- */
|
|
|
- public List<Map<String, Object>> listPkgTaskDetails(Integer pkgId) {
|
|
|
-
|
|
|
- // 获取积分包拆解信息
|
|
|
- List<WmPackageTaskTypeQty> packageTaskTypeQtyList = pkgTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(Collections.singletonList(pkgId));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(packageTaskTypeQtyList)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
- // 获取任务类型
|
|
|
- List<WmTaskType> taskTypes = taskTypeService.listParentTaskType();
|
|
|
- Map<String, WmTaskType> taskTypeName2EntityMap = taskTypes.stream()
|
|
|
- .collect(Collectors.toMap(WmTaskType::getTaskTypeName, Function.identity(), (v1, v2) -> v2));
|
|
|
-
|
|
|
- // 获取完成的任务数量
|
|
|
- List<WmTask> tasks = taskService.listPkgTasks(pkgId.toString());
|
|
|
- Map<String, List<WmTask>> taskTypeId2TaskMap = tasks.stream().collect(Collectors.groupingBy(WmTask::getTaskTypeId));
|
|
|
-
|
|
|
-
|
|
|
- return packageTaskTypeQtyList.stream().filter(ttq -> ttq.getQty() > 0).map(ttq -> {
|
|
|
- Map<String, Object> result = new HashMap<>(5);
|
|
|
- result.put("taskTypeName", ttq.getTaskTypeName());
|
|
|
- result.put("qty", ttq.getQty());
|
|
|
- result.put("price", ttq.getPrice());
|
|
|
-
|
|
|
- WmTaskType taskType = taskTypeName2EntityMap.get(ttq.getTaskTypeName());
|
|
|
- long count = 0L;
|
|
|
- String baseId = null;
|
|
|
- if (taskType != null) {
|
|
|
+ // 获取任务类型
|
|
|
+ List<WmTaskType> taskTypes = taskTypeService.listParentTaskType();
|
|
|
+ Map<String, WmTaskType> taskTypeName2EntityMap =
|
|
|
+ taskTypes.stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(WmTaskType::getTaskTypeName, Function.identity(), (v1, v2) -> v2));
|
|
|
+
|
|
|
+ // 获取完成的任务数量
|
|
|
+ List<WmTask> tasks = taskService.listPkgTasks(pkgId.toString());
|
|
|
+ Map<String, List<WmTask>> taskTypeId2TaskMap =
|
|
|
+ tasks.stream().collect(Collectors.groupingBy(WmTask::getTaskTypeId));
|
|
|
+
|
|
|
+ return packageTaskTypeQtyList.stream()
|
|
|
+ .filter(ttq -> ttq.getQty() > 0)
|
|
|
+ .map(
|
|
|
+ ttq -> {
|
|
|
+ Map<String, Object> result = new HashMap<>(5);
|
|
|
+ result.put("taskTypeName", ttq.getTaskTypeName());
|
|
|
+ result.put("qty", ttq.getQty());
|
|
|
+ result.put("price", ttq.getPrice());
|
|
|
+
|
|
|
+ WmTaskType taskType = taskTypeName2EntityMap.get(ttq.getTaskTypeName());
|
|
|
+ long count = 0L;
|
|
|
+ String baseId = null;
|
|
|
+ if (taskType != null) {
|
|
|
baseId = taskType.getBaseId();
|
|
|
List<WmTask> wmTasks = taskTypeId2TaskMap.get(taskType.getId());
|
|
|
if (CollUtil.isNotEmpty(wmTasks)) {
|
|
|
- count = wmTasks.stream().filter(t -> !"4".equals(t.getTaskStatus())).count();
|
|
|
+ count = wmTasks.stream().filter(t -> !"4".equals(t.getTaskStatus())).count();
|
|
|
}
|
|
|
- }
|
|
|
- result.put("baseId", baseId);
|
|
|
- result.put("count", count);
|
|
|
- return result;
|
|
|
-
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+ result.put("baseId", baseId);
|
|
|
+ result.put("count", count);
|
|
|
+ return result;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生效兑付同种
|
|
|
+ *
|
|
|
+ * @param resource 生效信息
|
|
|
+ * @param user 操作人
|
|
|
+ * @return 操作结果
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean launchPackageRedemptionNotice(
|
|
|
+ WmPkgDTO.OnRedemptionNoticeLaunch resource, HnqzUser user) {
|
|
|
+
|
|
|
+ WmPackageRedemptionNotice notice = new WmPackageRedemptionNotice();
|
|
|
+ notice.setNoticeId(resource.getRedemptionNoticeId());
|
|
|
+ notice.setCheckState(WmPackageRedemptionNotice.CheckState.CKT2.getState());
|
|
|
+ notice.setUpdateBy(user.getUsername());
|
|
|
+ notice.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ return packageRedemptionNoticeService.updateById(notice);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核兑付通知
|
|
|
+ *
|
|
|
+ * @param resource 生效信息
|
|
|
+ * @param user 操作人
|
|
|
+ * @return 操作结果
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean checkPackageRedemptionNotice(
|
|
|
+ WmPkgDTO.OnRedemptionNoticeCheck resource, HnqzUser user) {
|
|
|
+
|
|
|
+ Boolean checkResult = resource.getCheckResult();
|
|
|
+
|
|
|
+ WmPackageRedemptionNotice.NoticeState noticeState;
|
|
|
+ WmPackageRedemptionNotice.CheckState checkState;
|
|
|
+ String checkRemarks;
|
|
|
+
|
|
|
+ // 审核通过
|
|
|
+ if (checkResult) {
|
|
|
+ noticeState = WmPackageRedemptionNotice.NoticeState.SEND;
|
|
|
+ checkState = WmPackageRedemptionNotice.CheckState.PASSED;
|
|
|
+ checkRemarks =
|
|
|
+ StrUtil.isBlank(resource.getCheckRemarks()) ? "通过(系统追加)" : resource.getCheckRemarks();
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 生效兑付同种
|
|
|
- *
|
|
|
- * @param resource 生效信息
|
|
|
- * @param user 操作人
|
|
|
- * @return 操作结果
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean launchPackageRedemptionNotice(WmPkgDTO.OnRedemptionNoticeLaunch resource, HnqzUser user) {
|
|
|
-
|
|
|
- WmPackageRedemptionNotice notice = new WmPackageRedemptionNotice();
|
|
|
- notice.setNoticeId(resource.getRedemptionNoticeId());
|
|
|
- notice.setCheckState(WmPackageRedemptionNotice.CheckState.CKT2.getState());
|
|
|
- notice.setUpdateBy(user.getUsername());
|
|
|
- notice.setUpdateTime(LocalDateTime.now());
|
|
|
-
|
|
|
- return packageRedemptionNoticeService.updateById(notice);
|
|
|
+ // 审核不通过
|
|
|
+ else {
|
|
|
+ noticeState = WmPackageRedemptionNotice.NoticeState.PENDING;
|
|
|
+ checkState = WmPackageRedemptionNotice.CheckState.REJECTED;
|
|
|
+ checkRemarks = resource.getCheckRemarks();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 审核兑付通知
|
|
|
- *
|
|
|
- * @param resource 生效信息
|
|
|
- * @param user 操作人
|
|
|
- * @return 操作结果
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean checkPackageRedemptionNotice(WmPkgDTO.OnRedemptionNoticeCheck resource, HnqzUser user) {
|
|
|
-
|
|
|
- Boolean checkResult = resource.getCheckResult();
|
|
|
-
|
|
|
- WmPackageRedemptionNotice.NoticeState noticeState;
|
|
|
- WmPackageRedemptionNotice.CheckState checkState;
|
|
|
- String checkRemarks;
|
|
|
-
|
|
|
- // 审核通过
|
|
|
- if (checkResult) {
|
|
|
- noticeState = WmPackageRedemptionNotice.NoticeState.SEND;
|
|
|
- checkState = WmPackageRedemptionNotice.CheckState.PASSED;
|
|
|
- checkRemarks = StrUtil.isBlank(resource.getCheckRemarks()) ? "通过(系统追加)" : resource.getCheckRemarks();
|
|
|
- }
|
|
|
- // 审核不通过
|
|
|
- else {
|
|
|
- noticeState = WmPackageRedemptionNotice.NoticeState.PENDING;
|
|
|
- checkState = WmPackageRedemptionNotice.CheckState.REJECTED;
|
|
|
- checkRemarks = resource.getCheckRemarks();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- WmPackageRedemptionNotice notice = new WmPackageRedemptionNotice();
|
|
|
- notice.setNoticeId(resource.getRedemptionNoticeId());
|
|
|
-
|
|
|
- notice.setNoticeState(noticeState.getState());
|
|
|
- notice.setCheckState(checkState.getState());
|
|
|
- notice.setCheckResult(checkResult);
|
|
|
- notice.setCheckRemarks(checkRemarks);
|
|
|
- notice.setUpdateBy(user.getUsername());
|
|
|
- notice.setUpdateTime(LocalDateTime.now());
|
|
|
-
|
|
|
-
|
|
|
- return packageRedemptionNoticeService.updateById(notice);
|
|
|
+ WmPackageRedemptionNotice notice = new WmPackageRedemptionNotice();
|
|
|
+ notice.setNoticeId(resource.getRedemptionNoticeId());
|
|
|
+
|
|
|
+ notice.setNoticeState(noticeState.getState());
|
|
|
+ notice.setCheckState(checkState.getState());
|
|
|
+ notice.setCheckResult(checkResult);
|
|
|
+ notice.setCheckRemarks(checkRemarks);
|
|
|
+ notice.setUpdateBy(user.getUsername());
|
|
|
+ notice.setUpdateTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ return packageRedemptionNoticeService.updateById(notice);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取需要导出的积分包信息
|
|
|
+ public List<WmScorePackageInfoExcelModel> exportPkgInfo(LocalDate startDate, LocalDate endDate) {
|
|
|
+
|
|
|
+ Set<Integer> ignoreIds = new HashSet<>();
|
|
|
+ ignoreIds.add(1716964676);
|
|
|
+ ignoreIds.add(-1020826);
|
|
|
+ ignoreIds.add(-1019986);
|
|
|
+
|
|
|
+ // 获取所有的企业
|
|
|
+ List<SysDept> depts =
|
|
|
+ deptService
|
|
|
+ .list(
|
|
|
+ Wrappers.<SysDept>lambdaQuery()
|
|
|
+ .eq(SysDept::getDelFlag, CommonConstants.STATUS_NORMAL))
|
|
|
+ .stream()
|
|
|
+ .filter(d -> !ignoreIds.contains(d.getDeptId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(depts)) {
|
|
|
+ throw new BizException("不存在生效的企业信息,无法获取导出数据");
|
|
|
}
|
|
|
|
|
|
+ // 分别过滤区域和服务商
|
|
|
+ Map<Integer, SysDept> dis =
|
|
|
+ depts.stream()
|
|
|
+ .filter(d -> d.getLevel() == 3)
|
|
|
+ .collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
+ Map<Integer, SysDept> service =
|
|
|
+ depts.stream()
|
|
|
+ .filter(d -> d.getLevel() == 4)
|
|
|
+ .collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(dis) || CollUtil.isEmpty(service)) {
|
|
|
+ throw new BizException("不存在生效的区域或服务商,无法获取导出数据");
|
|
|
+ }
|
|
|
|
|
|
- // 获取需要导出的积分包信息
|
|
|
- public List<WmScorePackageInfoExcelModel> exportPkgInfo(LocalDate startDate, LocalDate endDate) {
|
|
|
-
|
|
|
- Set<Integer> ignoreIds = new HashSet<>();
|
|
|
- ignoreIds.add(1716964676);
|
|
|
- ignoreIds.add(-1020826);
|
|
|
- ignoreIds.add(-1019986);
|
|
|
-
|
|
|
- // 获取所有的企业
|
|
|
- List<SysDept> depts = deptService.list(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, CommonConstants.STATUS_NORMAL)).stream().filter(d -> !ignoreIds.contains(d.getDeptId())).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(depts)) {
|
|
|
- throw new BizException("不存在生效的企业信息,无法获取导出数据");
|
|
|
- }
|
|
|
-
|
|
|
- // 分别过滤区域和服务商
|
|
|
- Map<Integer, SysDept> dis = depts.stream().filter(d -> d.getLevel() == 3).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
- Map<Integer, SysDept> service = depts.stream().filter(d -> d.getLevel() == 4).collect(Collectors.toMap(SysDept::getDeptId, Function.identity()));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(dis) || CollUtil.isEmpty(service)) {
|
|
|
- throw new BizException("不存在生效的区域或服务商,无法获取导出数据");
|
|
|
- }
|
|
|
-
|
|
|
- // 获取区域发的包
|
|
|
- List<WmScorePackage> pkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ // 获取区域发的包
|
|
|
+ List<WmScorePackage> pkgs =
|
|
|
+ scorePackageService.list(
|
|
|
+ Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
.eq(WmScorePackage::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
.between(WmScorePackage::getCreateTime, startDate, endDate)
|
|
|
- .in(WmScorePackage::getSendPackageDeptId, dis.keySet().stream().map(String::valueOf).sorted().collect(Collectors.toList())));
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(pkgs)) {
|
|
|
- throw new BizException(String.format("%s至%s没有区域发包记录,不支持导出", DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(startDate), DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(endDate)));
|
|
|
- }
|
|
|
-
|
|
|
- // 获取上级包
|
|
|
- List<String> ppid = pkgs.stream().map(WmScorePackage::getRelationScoreId).distinct().sorted().collect(Collectors.toList());
|
|
|
- Map<String, WmScorePackage> ppMap = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
- .eq(WmScorePackage::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
- .in(WmScorePackage::getId, ppid)).stream().collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
|
|
|
-
|
|
|
-
|
|
|
- List<String> pkgIds = pkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- // 获取包所关联的产品
|
|
|
- List<String> drugIds = pkgs.stream().flatMap(p -> Arrays.stream(p.getDrugtable())).distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- Map<String, WmDaDrugEntDrugtable> drugtableMap = CollUtil.isEmpty(drugIds) ? Collections.emptyMap() :
|
|
|
- wmDaDrugEntDrugtableMapper.selectBatchIds(drugIds).stream().collect(Collectors.toMap(WmDaDrugEntDrugtable::getId, Function.identity()));
|
|
|
-
|
|
|
- // 获得包所管理计划
|
|
|
- Map<Integer, Integer> pkg2PlanMap = planPkgService.list(Wrappers.<SysPlanPkg>lambdaQuery().in(SysPlanPkg::getPkgId, pkgIds.stream().mapToInt(Integer::parseInt).boxed().distinct().sorted().collect(Collectors.toList()))).stream().collect(Collectors.toMap(SysPlanPkg::getPkgId, SysPlanPkg::getPlanId));
|
|
|
- List<Integer> planIds = pkg2PlanMap.values().stream().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- Map<Integer, SysImplementPlan> planMap = implementPlanService.listByIds(planIds).stream().collect(Collectors.toMap(SysImplementPlan::getPlanId, Function.identity()));
|
|
|
+ .in(
|
|
|
+ WmScorePackage::getSendPackageDeptId,
|
|
|
+ dis.keySet().stream()
|
|
|
+ .map(String::valueOf)
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList())));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(pkgs)) {
|
|
|
+ throw new BizException(
|
|
|
+ String.format(
|
|
|
+ "%s至%s没有区域发包记录,不支持导出",
|
|
|
+ DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(startDate),
|
|
|
+ DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(endDate)));
|
|
|
+ }
|
|
|
|
|
|
- // 获取子集包
|
|
|
- List<WmScorePackage> childrenPkgs = scorePackageService.list(Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ // 获取上级包
|
|
|
+ List<String> ppid =
|
|
|
+ pkgs.stream()
|
|
|
+ .map(WmScorePackage::getRelationScoreId)
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ Map<String, WmScorePackage> ppMap =
|
|
|
+ scorePackageService
|
|
|
+ .list(
|
|
|
+ Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
+ .eq(WmScorePackage::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
+ .in(WmScorePackage::getId, ppid))
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(WmScorePackage::getId, Function.identity()));
|
|
|
+
|
|
|
+ List<String> pkgIds =
|
|
|
+ pkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 获取包所关联的产品
|
|
|
+ List<String> drugIds =
|
|
|
+ pkgs.stream()
|
|
|
+ .flatMap(p -> Arrays.stream(p.getDrugtable()))
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, WmDaDrugEntDrugtable> drugtableMap =
|
|
|
+ CollUtil.isEmpty(drugIds)
|
|
|
+ ? Collections.emptyMap()
|
|
|
+ : wmDaDrugEntDrugtableMapper.selectBatchIds(drugIds).stream()
|
|
|
+ .collect(Collectors.toMap(WmDaDrugEntDrugtable::getId, Function.identity()));
|
|
|
+
|
|
|
+ // 获得包所管理计划
|
|
|
+ Map<Integer, Integer> pkg2PlanMap =
|
|
|
+ planPkgService
|
|
|
+ .list(
|
|
|
+ Wrappers.<SysPlanPkg>lambdaQuery()
|
|
|
+ .in(
|
|
|
+ SysPlanPkg::getPkgId,
|
|
|
+ pkgIds.stream()
|
|
|
+ .mapToInt(Integer::parseInt)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList())))
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(SysPlanPkg::getPkgId, SysPlanPkg::getPlanId));
|
|
|
+ List<Integer> planIds =
|
|
|
+ pkg2PlanMap.values().stream().distinct().sorted().collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Integer, SysImplementPlan> planMap =
|
|
|
+ implementPlanService.listByIds(planIds).stream()
|
|
|
+ .collect(Collectors.toMap(SysImplementPlan::getPlanId, Function.identity()));
|
|
|
+
|
|
|
+ // 获取子集包
|
|
|
+ List<WmScorePackage> childrenPkgs =
|
|
|
+ scorePackageService.list(
|
|
|
+ Wrappers.<WmScorePackage>lambdaQuery()
|
|
|
.eq(WmScorePackage::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
.in(WmScorePackage::getRelationScoreId, pkgIds));
|
|
|
- List<String> cPkgIds = childrenPkgs.stream().map(WmScorePackage::getId).distinct().sorted().collect(Collectors.toList());
|
|
|
- // 父级下的所有子集
|
|
|
- Map<String, List<String>> parentId2PkgMap = CollUtil.isEmpty(childrenPkgs) ? Collections.emptyMap() :
|
|
|
- childrenPkgs.stream().collect(Collectors.groupingBy(WmScorePackage::getRelationScoreId, Collectors.mapping(WmScorePackage::getId, Collectors.toList())));
|
|
|
-
|
|
|
- // 获取全部的任务
|
|
|
- List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, cPkgIds)/*.ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED)*/);
|
|
|
- // List<WmTask> tasks = taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId, cPkgIds).ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED));
|
|
|
-
|
|
|
- // 根据任务类型id分组
|
|
|
- Map<String, List<WmTask>> pkg2TaskListMap = tasks.stream().collect(Collectors.groupingBy(WmTask::getScorePackageId));
|
|
|
-
|
|
|
- // 获取下发的
|
|
|
- List<WmPackageTaskTypeQty> taskTypeQties = packageTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(cPkgIds.stream().mapToInt(Integer::parseInt).boxed().distinct().sorted().collect(Collectors.toList()));
|
|
|
- Map<Integer, List<WmPackageTaskTypeQty>> pttMap = taskTypeQties.stream().collect(Collectors.groupingBy(WmPackageTaskTypeQty::getPackageId));
|
|
|
-
|
|
|
-
|
|
|
- List<WmScorePackageInfoExcelModel> result = pkgs.parallelStream().map(pkg -> {
|
|
|
-
|
|
|
- // 基础信息
|
|
|
- WmScorePackageInfoExcelModel model = new WmScorePackageInfoExcelModel();
|
|
|
- model.setPkgId(pkg.getId());
|
|
|
- model.setPkgName(pkg.getScorePackageName());
|
|
|
- model.setScore(String.valueOf(pkg.getScore()));
|
|
|
-
|
|
|
- // 父级包
|
|
|
- WmScorePackage wmScorePackages = ppMap.get(pkg.getRelationScoreId());
|
|
|
- model.setParentPkgName(wmScorePackages != null ? wmScorePackages.getScorePackageName() : "");
|
|
|
-
|
|
|
- // 计划名称
|
|
|
- Integer planId = pkg2PlanMap.get(Integer.parseInt(pkg.getId()));
|
|
|
- SysImplementPlan plan = planMap.get(planId);
|
|
|
- model.setPlanName(plan.getPlanName());
|
|
|
-
|
|
|
- // 产品&生产企业
|
|
|
- WmDaDrugEntDrugtable drugtable = drugtableMap.get(pkg.getDrugtable()[0]);
|
|
|
-
|
|
|
- model.setSkuName(drugtable == null ? "未分配产品" : drugtable.getDrugname());
|
|
|
- model.setProdName(drugtable == null ? "未分配产品" : drugtable.getDrugnameTy());
|
|
|
- model.setMah(drugtable == null ? "未知" : drugtable.getDrugEntName());
|
|
|
-
|
|
|
- // 承接对象
|
|
|
- SysDept s = service.get(Integer.parseInt(pkg.getDeptId()));
|
|
|
- model.setServiceName(s.getName());
|
|
|
-
|
|
|
- List<String> cPkgIdList = parentId2PkgMap.get(pkg.getId());
|
|
|
-
|
|
|
- // 任务数据统计
|
|
|
- if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
-
|
|
|
- // 任务提交总数
|
|
|
- int tt53Submit = 0;
|
|
|
- int tt52submit = 0;
|
|
|
- int tt51submit = 0;
|
|
|
- int tt14submit = 0;
|
|
|
- int tt17submit = 0;
|
|
|
- int tt12submit = 0;
|
|
|
- int tt13submit = 0;
|
|
|
- int tt1submit = 0;
|
|
|
- int tt2submit = 0;
|
|
|
- int tt5submit = 0;
|
|
|
- int tt3submit = 0;
|
|
|
- int tt4submit = 0;
|
|
|
- int tt64submit = 0;
|
|
|
- int tt19submit = 0;
|
|
|
-
|
|
|
- // 任务拒绝记录
|
|
|
- int tt53rejected = 0;
|
|
|
- int tt52rejected = 0;
|
|
|
- int tt51rejected = 0;
|
|
|
- int tt14rejected = 0;
|
|
|
- int tt17rejected = 0;
|
|
|
- int tt12rejected = 0;
|
|
|
- int tt13rejected = 0;
|
|
|
- int tt1rejected = 0;
|
|
|
- int tt2rejected = 0;
|
|
|
- int tt5rejected = 0;
|
|
|
- int tt3rejected = 0;
|
|
|
- int tt4rejected = 0;
|
|
|
- int tt64rejected = 0;
|
|
|
- int tt19rejected = 0;
|
|
|
-
|
|
|
-
|
|
|
- for (String cPkgId : cPkgIdList) {
|
|
|
-
|
|
|
- List<WmTask> list = pkg2TaskListMap.get(cPkgId);
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(list)) {
|
|
|
+ List<String> cPkgIds =
|
|
|
+ childrenPkgs.stream()
|
|
|
+ .map(WmScorePackage::getId)
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ // 父级下的所有子集
|
|
|
+ Map<String, List<String>> parentId2PkgMap =
|
|
|
+ CollUtil.isEmpty(childrenPkgs)
|
|
|
+ ? Collections.emptyMap()
|
|
|
+ : childrenPkgs.stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.groupingBy(
|
|
|
+ WmScorePackage::getRelationScoreId,
|
|
|
+ Collectors.mapping(WmScorePackage::getId, Collectors.toList())));
|
|
|
+
|
|
|
+ // 获取全部的任务
|
|
|
+ List<WmTask> tasks =
|
|
|
+ taskService.list(
|
|
|
+ Wrappers.<WmTask>lambdaQuery()
|
|
|
+ .in(
|
|
|
+ WmTask::getScorePackageId,
|
|
|
+ cPkgIds) /*.ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED)*/);
|
|
|
+ // List<WmTask> tasks =
|
|
|
+ // taskService.list(Wrappers.<WmTask>lambdaQuery().in(WmTask::getScorePackageId,
|
|
|
+ // cPkgIds).ne(WmTask::getTaskStatus, UpmsState.TaskState.REJECTED));
|
|
|
+
|
|
|
+ // 根据任务类型id分组
|
|
|
+ Map<String, List<WmTask>> pkg2TaskListMap =
|
|
|
+ tasks.stream().collect(Collectors.groupingBy(WmTask::getScorePackageId));
|
|
|
+
|
|
|
+ // 获取下发的
|
|
|
+ List<WmPackageTaskTypeQty> taskTypeQties =
|
|
|
+ packageTaskTypeQtyService.listPkgTaskTypeQtyByPkgIds(
|
|
|
+ cPkgIds.stream()
|
|
|
+ .mapToInt(Integer::parseInt)
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ Map<Integer, List<WmPackageTaskTypeQty>> pttMap =
|
|
|
+ taskTypeQties.stream().collect(Collectors.groupingBy(WmPackageTaskTypeQty::getPackageId));
|
|
|
+
|
|
|
+ List<WmScorePackageInfoExcelModel> result =
|
|
|
+ pkgs.parallelStream()
|
|
|
+ .map(
|
|
|
+ pkg -> {
|
|
|
+
|
|
|
+ // 基础信息
|
|
|
+ WmScorePackageInfoExcelModel model = new WmScorePackageInfoExcelModel();
|
|
|
+ model.setPkgId(pkg.getId());
|
|
|
+ model.setPkgName(pkg.getScorePackageName());
|
|
|
+ model.setScore(String.valueOf(pkg.getScore()));
|
|
|
+
|
|
|
+ // 父级包
|
|
|
+ WmScorePackage wmScorePackages = ppMap.get(pkg.getRelationScoreId());
|
|
|
+ model.setParentPkgName(
|
|
|
+ wmScorePackages != null ? wmScorePackages.getScorePackageName() : "");
|
|
|
+
|
|
|
+ // 计划名称
|
|
|
+ Integer planId = pkg2PlanMap.get(Integer.parseInt(pkg.getId()));
|
|
|
+ SysImplementPlan plan = planMap.get(planId);
|
|
|
+ model.setPlanName(plan.getPlanName());
|
|
|
+
|
|
|
+ // 产品&生产企业
|
|
|
+ WmDaDrugEntDrugtable drugtable = drugtableMap.get(pkg.getDrugtable()[0]);
|
|
|
+
|
|
|
+ model.setSkuName(drugtable == null ? "未分配产品" : drugtable.getDrugname());
|
|
|
+ model.setProdName(drugtable == null ? "未分配产品" : drugtable.getDrugnameTy());
|
|
|
+ model.setMah(drugtable == null ? "未知" : drugtable.getDrugEntName());
|
|
|
+
|
|
|
+ // 承接对象
|
|
|
+ SysDept s = service.get(Integer.parseInt(pkg.getDeptId()));
|
|
|
+ model.setServiceName(s.getName());
|
|
|
+
|
|
|
+ List<String> cPkgIdList = parentId2PkgMap.get(pkg.getId());
|
|
|
+
|
|
|
+ // 任务数据统计
|
|
|
+ if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
+
|
|
|
+ // 任务提交总数
|
|
|
+ int tt53Submit = 0;
|
|
|
+ int tt52submit = 0;
|
|
|
+ int tt51submit = 0;
|
|
|
+ int tt14submit = 0;
|
|
|
+ int tt17submit = 0;
|
|
|
+ int tt12submit = 0;
|
|
|
+ int tt13submit = 0;
|
|
|
+ int tt1submit = 0;
|
|
|
+ int tt2submit = 0;
|
|
|
+ int tt5submit = 0;
|
|
|
+ int tt3submit = 0;
|
|
|
+ int tt4submit = 0;
|
|
|
+ int tt64submit = 0;
|
|
|
+ int tt19submit = 0;
|
|
|
+
|
|
|
+ // 任务拒绝记录
|
|
|
+ int tt53rejected = 0;
|
|
|
+ int tt52rejected = 0;
|
|
|
+ int tt51rejected = 0;
|
|
|
+ int tt14rejected = 0;
|
|
|
+ int tt17rejected = 0;
|
|
|
+ int tt12rejected = 0;
|
|
|
+ int tt13rejected = 0;
|
|
|
+ int tt1rejected = 0;
|
|
|
+ int tt2rejected = 0;
|
|
|
+ int tt5rejected = 0;
|
|
|
+ int tt3rejected = 0;
|
|
|
+ int tt4rejected = 0;
|
|
|
+ int tt64rejected = 0;
|
|
|
+ int tt19rejected = 0;
|
|
|
+
|
|
|
+ for (String cPkgId : cPkgIdList) {
|
|
|
+
|
|
|
+ List<WmTask> list = pkg2TaskListMap.get(cPkgId);
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
continue;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- for (WmTask task : list) {
|
|
|
+ for (WmTask task : list) {
|
|
|
|
|
|
- boolean rejected = UpmsState.TaskState.REJECTED.getState().equals(task.getTaskStatus());
|
|
|
+ boolean rejected =
|
|
|
+ UpmsState.TaskState.REJECTED.getState().equals(task.getTaskStatus());
|
|
|
|
|
|
String taskTypeId = task.getTaskTypeId();
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "53")) {
|
|
|
- tt53Submit++;
|
|
|
+ tt53Submit++;
|
|
|
|
|
|
- if (rejected) {
|
|
|
- tt53rejected++;
|
|
|
- }
|
|
|
+ if (rejected) {
|
|
|
+ tt53rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "52")) {
|
|
|
- tt52submit++;
|
|
|
+ tt52submit++;
|
|
|
|
|
|
- if (rejected) {
|
|
|
- tt52rejected++;
|
|
|
- }
|
|
|
+ if (rejected) {
|
|
|
+ tt52rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "51")) {
|
|
|
- tt51submit++;
|
|
|
- if (rejected) {
|
|
|
- tt51rejected++;
|
|
|
- }
|
|
|
+ tt51submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt51rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "14")) {
|
|
|
- tt14submit++;
|
|
|
- if (rejected) {
|
|
|
- tt14rejected++;
|
|
|
- }
|
|
|
+ tt14submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt14rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "17")) {
|
|
|
- tt17submit++;
|
|
|
- if (rejected) {
|
|
|
- tt17rejected++;
|
|
|
- }
|
|
|
+ tt17submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt17rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "12")) {
|
|
|
- tt12submit++;
|
|
|
- if (rejected) {
|
|
|
- tt12rejected++;
|
|
|
- }
|
|
|
+ tt12submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt12rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "13")) {
|
|
|
- tt13submit++;
|
|
|
- if (rejected) {
|
|
|
- tt13rejected++;
|
|
|
- }
|
|
|
+ tt13submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt13rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "1")) {
|
|
|
- tt1submit++;
|
|
|
- if (rejected) {
|
|
|
- tt1rejected++;
|
|
|
- }
|
|
|
+ tt1submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt1rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "2")) {
|
|
|
- tt2submit++;
|
|
|
- if (rejected) {
|
|
|
- tt2rejected++;
|
|
|
- }
|
|
|
+ tt2submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt2rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "5")) {
|
|
|
- tt5submit++;
|
|
|
- if (rejected) {
|
|
|
- tt5rejected++;
|
|
|
- }
|
|
|
+ tt5submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt5rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "3")) {
|
|
|
- tt3submit++;
|
|
|
- if (rejected) {
|
|
|
- tt3rejected++;
|
|
|
- }
|
|
|
+ tt3submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt3rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "4")) {
|
|
|
- tt4submit++;
|
|
|
- if (rejected) {
|
|
|
- tt4rejected++;
|
|
|
- }
|
|
|
+ tt4submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt4rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "64")) {
|
|
|
- tt64submit++;
|
|
|
- if (rejected) {
|
|
|
- tt64rejected++;
|
|
|
- }
|
|
|
+ tt64submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt64rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "19")) {
|
|
|
- tt19submit++;
|
|
|
- if (rejected) {
|
|
|
- tt19rejected++;
|
|
|
- }
|
|
|
+ tt19submit++;
|
|
|
+ if (rejected) {
|
|
|
+ tt19rejected++;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- model.setTt53Submit(String.valueOf(tt53Submit - tt53rejected));
|
|
|
- model.setTt52submit(String.valueOf(tt52submit - tt52rejected));
|
|
|
- model.setTt51submit(String.valueOf(tt51submit - tt51rejected));
|
|
|
- model.setTt14submit(String.valueOf(tt14submit - tt14rejected));
|
|
|
- model.setTt17submit(String.valueOf(tt17submit - tt17rejected));
|
|
|
- model.setTt12submit(String.valueOf(tt12submit - tt12rejected));
|
|
|
- model.setTt13submit(String.valueOf(tt13submit - tt13rejected));
|
|
|
- model.setTt1submit(String.valueOf(tt1submit - tt1rejected));
|
|
|
- model.setTt2submit(String.valueOf(tt2submit - tt2rejected));
|
|
|
- model.setTt5submit(String.valueOf(tt5submit - tt5rejected));
|
|
|
- model.setTt3submit(String.valueOf(tt3submit - tt3rejected));
|
|
|
- model.setTt4submit(String.valueOf(tt4submit - tt4rejected));
|
|
|
- model.setTt64submit(String.valueOf(tt64submit - tt64rejected));
|
|
|
- model.setTt19submit(String.valueOf(tt19submit - tt19rejected));
|
|
|
-
|
|
|
- model.setTt53rejected(String.valueOf(tt53rejected));
|
|
|
- model.setTt52rejected(String.valueOf(tt52rejected));
|
|
|
- model.setTt51rejected(String.valueOf(tt51rejected));
|
|
|
- model.setTt14rejected(String.valueOf(tt14rejected));
|
|
|
- model.setTt17rejected(String.valueOf(tt17rejected));
|
|
|
- model.setTt12rejected(String.valueOf(tt12rejected));
|
|
|
- model.setTt13rejected(String.valueOf(tt13rejected));
|
|
|
- model.setTt1rejected(String.valueOf(tt1rejected));
|
|
|
- model.setTt2rejected(String.valueOf(tt2rejected));
|
|
|
- model.setTt5rejected(String.valueOf(tt5rejected));
|
|
|
- model.setTt3rejected(String.valueOf(tt3rejected));
|
|
|
- model.setTt4rejected(String.valueOf(tt4rejected));
|
|
|
- model.setTt64rejected(String.valueOf(tt64rejected));
|
|
|
- model.setTt19rejected(String.valueOf(tt19rejected));
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 下发任务统计
|
|
|
- if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
-
|
|
|
- int tt53dist = 0;
|
|
|
- int tt52dist = 0;
|
|
|
- int tt51dist = 0;
|
|
|
- int tt14dist = 0;
|
|
|
- int tt17dist = 0;
|
|
|
- int tt12dist = 0;
|
|
|
- int tt13dist = 0;
|
|
|
- int tt1dist = 0;
|
|
|
- int tt2dist = 0;
|
|
|
- int tt5dist = 0;
|
|
|
- int tt3dist = 0;
|
|
|
- int tt4dist = 0;
|
|
|
- int tt64dist = 0;
|
|
|
- int tt19dist = 0;
|
|
|
-
|
|
|
- for (String cPkgId : cPkgIdList) {
|
|
|
- List<WmPackageTaskTypeQty> packageTaskTypeQtyList = pttMap.get(Integer.parseInt(cPkgId));
|
|
|
- if (CollUtil.isEmpty(packageTaskTypeQtyList)) {
|
|
|
+ model.setTt53Submit(String.valueOf(tt53Submit - tt53rejected));
|
|
|
+ model.setTt52submit(String.valueOf(tt52submit - tt52rejected));
|
|
|
+ model.setTt51submit(String.valueOf(tt51submit - tt51rejected));
|
|
|
+ model.setTt14submit(String.valueOf(tt14submit - tt14rejected));
|
|
|
+ model.setTt17submit(String.valueOf(tt17submit - tt17rejected));
|
|
|
+ model.setTt12submit(String.valueOf(tt12submit - tt12rejected));
|
|
|
+ model.setTt13submit(String.valueOf(tt13submit - tt13rejected));
|
|
|
+ model.setTt1submit(String.valueOf(tt1submit - tt1rejected));
|
|
|
+ model.setTt2submit(String.valueOf(tt2submit - tt2rejected));
|
|
|
+ model.setTt5submit(String.valueOf(tt5submit - tt5rejected));
|
|
|
+ model.setTt3submit(String.valueOf(tt3submit - tt3rejected));
|
|
|
+ model.setTt4submit(String.valueOf(tt4submit - tt4rejected));
|
|
|
+ model.setTt64submit(String.valueOf(tt64submit - tt64rejected));
|
|
|
+ model.setTt19submit(String.valueOf(tt19submit - tt19rejected));
|
|
|
+
|
|
|
+ model.setTt53rejected(String.valueOf(tt53rejected));
|
|
|
+ model.setTt52rejected(String.valueOf(tt52rejected));
|
|
|
+ model.setTt51rejected(String.valueOf(tt51rejected));
|
|
|
+ model.setTt14rejected(String.valueOf(tt14rejected));
|
|
|
+ model.setTt17rejected(String.valueOf(tt17rejected));
|
|
|
+ model.setTt12rejected(String.valueOf(tt12rejected));
|
|
|
+ model.setTt13rejected(String.valueOf(tt13rejected));
|
|
|
+ model.setTt1rejected(String.valueOf(tt1rejected));
|
|
|
+ model.setTt2rejected(String.valueOf(tt2rejected));
|
|
|
+ model.setTt5rejected(String.valueOf(tt5rejected));
|
|
|
+ model.setTt3rejected(String.valueOf(tt3rejected));
|
|
|
+ model.setTt4rejected(String.valueOf(tt4rejected));
|
|
|
+ model.setTt64rejected(String.valueOf(tt64rejected));
|
|
|
+ model.setTt19rejected(String.valueOf(tt19rejected));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下发任务统计
|
|
|
+ if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
+
|
|
|
+ int tt53dist = 0;
|
|
|
+ int tt52dist = 0;
|
|
|
+ int tt51dist = 0;
|
|
|
+ int tt14dist = 0;
|
|
|
+ int tt17dist = 0;
|
|
|
+ int tt12dist = 0;
|
|
|
+ int tt13dist = 0;
|
|
|
+ int tt1dist = 0;
|
|
|
+ int tt2dist = 0;
|
|
|
+ int tt5dist = 0;
|
|
|
+ int tt3dist = 0;
|
|
|
+ int tt4dist = 0;
|
|
|
+ int tt64dist = 0;
|
|
|
+ int tt19dist = 0;
|
|
|
+
|
|
|
+ for (String cPkgId : cPkgIdList) {
|
|
|
+ List<WmPackageTaskTypeQty> packageTaskTypeQtyList =
|
|
|
+ pttMap.get(Integer.parseInt(cPkgId));
|
|
|
+ if (CollUtil.isEmpty(packageTaskTypeQtyList)) {
|
|
|
continue;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- for (WmPackageTaskTypeQty packageTaskTypeQty : packageTaskTypeQtyList) {
|
|
|
+ for (WmPackageTaskTypeQty packageTaskTypeQty : packageTaskTypeQtyList) {
|
|
|
String taskTypeName = packageTaskTypeQty.getTaskTypeName();
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "基础拜访")) {
|
|
|
- tt53dist += packageTaskTypeQty.getQty();
|
|
|
+ tt53dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "专项拜访")) {
|
|
|
- tt52dist += packageTaskTypeQty.getQty();
|
|
|
+ tt52dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "专业拜访")) {
|
|
|
- tt51dist += packageTaskTypeQty.getQty();
|
|
|
+ tt51dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "数据收集")) {
|
|
|
- tt14dist += packageTaskTypeQty.getQty();
|
|
|
+ tt14dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "医学警戒信息收集")) {
|
|
|
- tt17dist += packageTaskTypeQty.getQty();
|
|
|
+ tt17dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "产品展示")) {
|
|
|
- tt12dist += packageTaskTypeQty.getQty();
|
|
|
+ tt12dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "业务宣传服务")) {
|
|
|
- tt13dist += packageTaskTypeQty.getQty();
|
|
|
+ tt13dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "POV科室会")) {
|
|
|
- tt1dist += packageTaskTypeQty.getQty();
|
|
|
+ tt1dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "区县学术会议")) {
|
|
|
- tt2dist += packageTaskTypeQty.getQty();
|
|
|
+ tt2dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "沙龙会")) {
|
|
|
- tt5dist += packageTaskTypeQty.getQty();
|
|
|
+ tt5dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "市级学术会议")) {
|
|
|
- tt3dist += packageTaskTypeQty.getQty();
|
|
|
+ tt3dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "省级学术会议")) {
|
|
|
- tt4dist += packageTaskTypeQty.getQty();
|
|
|
+ tt4dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "线上学术会议")) {
|
|
|
- tt64dist += packageTaskTypeQty.getQty();
|
|
|
+ tt64dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeName, "健康教育课堂")) {
|
|
|
- tt19dist += packageTaskTypeQty.getQty();
|
|
|
+ tt19dist += packageTaskTypeQty.getQty();
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
- model.setTt53dist(String.valueOf(tt53dist));
|
|
|
- model.setTt52dist(String.valueOf(tt52dist));
|
|
|
- model.setTt51dist(String.valueOf(tt51dist));
|
|
|
- model.setTt14dist(String.valueOf(tt14dist));
|
|
|
- model.setTt17dist(String.valueOf(tt17dist));
|
|
|
- model.setTt12dist(String.valueOf(tt12dist));
|
|
|
- model.setTt13dist(String.valueOf(tt13dist));
|
|
|
- model.setTt1dist(String.valueOf(tt1dist));
|
|
|
- model.setTt2dist(String.valueOf(tt2dist));
|
|
|
- model.setTt5dist(String.valueOf(tt5dist));
|
|
|
- model.setTt3dist(String.valueOf(tt3dist));
|
|
|
- model.setTt4dist(String.valueOf(tt4dist));
|
|
|
- model.setTt64dist(String.valueOf(tt64dist));
|
|
|
- model.setTt19dist(String.valueOf(tt19dist));
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 审批统计
|
|
|
- if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
-
|
|
|
- int tt53checked = 0;
|
|
|
- int tt52checked = 0;
|
|
|
- int tt51checked = 0;
|
|
|
- int tt14checked = 0;
|
|
|
- int tt17checked = 0;
|
|
|
- int tt12Checked = 0;
|
|
|
- int tt13checked = 0;
|
|
|
- int tt1checked = 0;
|
|
|
- int tt2Checked = 0;
|
|
|
- int tt5checked = 0;
|
|
|
- int tt3checked = 0;
|
|
|
- int tt4checked = 0;
|
|
|
- int tt64checked = 0;
|
|
|
- int tt19checked = 0;
|
|
|
-
|
|
|
- for (String cPkgId : cPkgIdList) {
|
|
|
- // 获取单个子包任务信息
|
|
|
- List<WmTask> tasks1 = pkg2TaskListMap.get(cPkgId);
|
|
|
- if (CollUtil.isEmpty(tasks1)) {
|
|
|
+ model.setTt53dist(String.valueOf(tt53dist));
|
|
|
+ model.setTt52dist(String.valueOf(tt52dist));
|
|
|
+ model.setTt51dist(String.valueOf(tt51dist));
|
|
|
+ model.setTt14dist(String.valueOf(tt14dist));
|
|
|
+ model.setTt17dist(String.valueOf(tt17dist));
|
|
|
+ model.setTt12dist(String.valueOf(tt12dist));
|
|
|
+ model.setTt13dist(String.valueOf(tt13dist));
|
|
|
+ model.setTt1dist(String.valueOf(tt1dist));
|
|
|
+ model.setTt2dist(String.valueOf(tt2dist));
|
|
|
+ model.setTt5dist(String.valueOf(tt5dist));
|
|
|
+ model.setTt3dist(String.valueOf(tt3dist));
|
|
|
+ model.setTt4dist(String.valueOf(tt4dist));
|
|
|
+ model.setTt64dist(String.valueOf(tt64dist));
|
|
|
+ model.setTt19dist(String.valueOf(tt19dist));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审批统计
|
|
|
+ if (CollUtil.isNotEmpty(cPkgIdList)) {
|
|
|
+
|
|
|
+ int tt53checked = 0;
|
|
|
+ int tt52checked = 0;
|
|
|
+ int tt51checked = 0;
|
|
|
+ int tt14checked = 0;
|
|
|
+ int tt17checked = 0;
|
|
|
+ int tt12Checked = 0;
|
|
|
+ int tt13checked = 0;
|
|
|
+ int tt1checked = 0;
|
|
|
+ int tt2Checked = 0;
|
|
|
+ int tt5checked = 0;
|
|
|
+ int tt3checked = 0;
|
|
|
+ int tt4checked = 0;
|
|
|
+ int tt64checked = 0;
|
|
|
+ int tt19checked = 0;
|
|
|
+
|
|
|
+ for (String cPkgId : cPkgIdList) {
|
|
|
+ // 获取单个子包任务信息
|
|
|
+ List<WmTask> tasks1 = pkg2TaskListMap.get(cPkgId);
|
|
|
+ if (CollUtil.isEmpty(tasks1)) {
|
|
|
continue;
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> tIds = tasks1.stream().mapToInt(t -> Integer.parseInt(t.getId())).boxed().distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- Set<Integer> collect = checkChainNodeCheckHistoryService.list(Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
- .in(SysCheckChainNodeCheckHistory::getTargetId, tIds)
|
|
|
- .eq(SysCheckChainNodeCheckHistory::getCheckResult, Boolean.TRUE)
|
|
|
- .eq(SysCheckChainNodeCheckHistory::getNodeId, 6))
|
|
|
- .stream()
|
|
|
- .map(SysCheckChainNodeCheckHistory::getTargetId)
|
|
|
- .collect(Collectors.toSet());
|
|
|
-
|
|
|
- if (CollUtil.isEmpty(collect)) {
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> tIds =
|
|
|
+ tasks1.stream()
|
|
|
+ .mapToInt(t -> Integer.parseInt(t.getId()))
|
|
|
+ .boxed()
|
|
|
+ .distinct()
|
|
|
+ .sorted()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Set<Integer> collect =
|
|
|
+ checkChainNodeCheckHistoryService
|
|
|
+ .list(
|
|
|
+ Wrappers.<SysCheckChainNodeCheckHistory>lambdaQuery()
|
|
|
+ .in(SysCheckChainNodeCheckHistory::getTargetId, tIds)
|
|
|
+ .eq(
|
|
|
+ SysCheckChainNodeCheckHistory::getCheckResult,
|
|
|
+ Boolean.TRUE)
|
|
|
+ .eq(SysCheckChainNodeCheckHistory::getNodeId, 6))
|
|
|
+ .stream()
|
|
|
+ .map(SysCheckChainNodeCheckHistory::getTargetId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(collect)) {
|
|
|
continue;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- for (WmTask task : tasks1) {
|
|
|
+ for (WmTask task : tasks1) {
|
|
|
Integer id = Integer.valueOf(task.getId());
|
|
|
|
|
|
if (!collect.contains(id)) {
|
|
|
- continue;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
String taskTypeId = task.getTaskTypeId();
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "53")) {
|
|
|
- tt53checked++;
|
|
|
+ tt53checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "52")) {
|
|
|
- tt52checked++;
|
|
|
+ tt52checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "51")) {
|
|
|
- tt51checked++;
|
|
|
+ tt51checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "14")) {
|
|
|
- tt14checked++;
|
|
|
+ tt14checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "17")) {
|
|
|
- tt17checked++;
|
|
|
+ tt17checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "12")) {
|
|
|
- tt12Checked++;
|
|
|
+ tt12Checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "13")) {
|
|
|
- tt13checked++;
|
|
|
+ tt13checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "1")) {
|
|
|
- tt1checked++;
|
|
|
+ tt1checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "2")) {
|
|
|
- tt2Checked++;
|
|
|
+ tt2Checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "5")) {
|
|
|
- tt5checked++;
|
|
|
+ tt5checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "3")) {
|
|
|
- tt3checked++;
|
|
|
+ tt3checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "4")) {
|
|
|
- tt4checked++;
|
|
|
+ tt4checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "64")) {
|
|
|
- tt64checked++;
|
|
|
+ tt64checked++;
|
|
|
}
|
|
|
|
|
|
if (StrUtil.equals(taskTypeId, "19")) {
|
|
|
- tt19checked++;
|
|
|
+ tt19checked++;
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- model.setTt53checked(String.valueOf(tt53checked));
|
|
|
- model.setTt52checked(String.valueOf(tt52checked));
|
|
|
- model.setTt51checked(String.valueOf(tt51checked));
|
|
|
- model.setTt14checked(String.valueOf(tt14checked));
|
|
|
- model.setTt17checked(String.valueOf(tt17checked));
|
|
|
- model.setTt12Checked(String.valueOf(tt12Checked));
|
|
|
- model.setTt13checked(String.valueOf(tt13checked));
|
|
|
- model.setTt1checked(String.valueOf(tt1checked));
|
|
|
- model.setTt2checked(String.valueOf(tt2Checked));
|
|
|
- model.setTt5checked(String.valueOf(tt5checked));
|
|
|
- model.setTt3checked(String.valueOf(tt3checked));
|
|
|
- model.setTt4checked(String.valueOf(tt4checked));
|
|
|
- model.setTt64checked(String.valueOf(tt64checked));
|
|
|
- model.setTt19checked(String.valueOf(tt19checked));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return model;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
+ model.setTt53checked(String.valueOf(tt53checked));
|
|
|
+ model.setTt52checked(String.valueOf(tt52checked));
|
|
|
+ model.setTt51checked(String.valueOf(tt51checked));
|
|
|
+ model.setTt14checked(String.valueOf(tt14checked));
|
|
|
+ model.setTt17checked(String.valueOf(tt17checked));
|
|
|
+ model.setTt12Checked(String.valueOf(tt12Checked));
|
|
|
+ model.setTt13checked(String.valueOf(tt13checked));
|
|
|
+ model.setTt1checked(String.valueOf(tt1checked));
|
|
|
+ model.setTt2checked(String.valueOf(tt2Checked));
|
|
|
+ model.setTt5checked(String.valueOf(tt5checked));
|
|
|
+ model.setTt3checked(String.valueOf(tt3checked));
|
|
|
+ model.setTt4checked(String.valueOf(tt4checked));
|
|
|
+ model.setTt64checked(String.valueOf(tt64checked));
|
|
|
+ model.setTt19checked(String.valueOf(tt19checked));
|
|
|
+ }
|
|
|
+
|
|
|
+ return model;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
-
|