Commit 7e531288 authored by tianbo's avatar tianbo

注册监管区域树获取修改

parent 9116e6c3
package com.yeejoin.amos.boot.module.tzs.api.common;
/**
* @Description: 通用常量类
* @Author: DELL
* @Date: 2021/5/26
*/
public interface BizCommonConstant {
/**
* 所有平台企业数据redisKey
*/
public final static String COMPANY_TREE_REDIS_KEY = "companyTreeAll";;
}
package com.yeejoin.amos.boot.module.tzs.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
* <pre>
* 平台单位等级枚举
* </pre>
*
* @author tb
* @date 2023-05-31
*/
@Getter
@AllArgsConstructor
public enum CompanyLevelEnum {
HEADQUARTER("headquarter", "省级"),
PREFECTURE_LEVEL("prefecture-level", "地市级"),
COUNTY("county", "区县级"),
ORGANIZATION("organization", "基层机构"),;
private String code;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static CompanyLevelEnum getEnum(String code) {
for (CompanyLevelEnum status : CompanyLevelEnum.values()) {
if (status.getCode().equals(code)) {
return status;
}
}
return null;
}
}
...@@ -39,9 +39,9 @@ public class EnterpriseStatisticController extends BaseController { ...@@ -39,9 +39,9 @@ public class EnterpriseStatisticController extends BaseController {
@ApiOperation(value = "根据搜索信息获取表格数据") @ApiOperation(value = "根据搜索信息获取表格数据")
@GetMapping(value = "/getTableInfoPage") @GetMapping(value = "/getTableInfoPage")
public ResponseModel<Page<CylinderTableDto>> cylinderTableInfoPage(String pageNumber, String pageSize, public ResponseModel<Page<CylinderTableDto>> cylinderTableInfoPage(String pageNumber, String pageSize,
@RequestParam(value = "developerAgency" ,required = false) String developerAgency, @RequestParam(value = "regionName" ,required = false) String regionName,
@RequestParam(value = "unitName" ,required = false) String unitName) { @RequestParam(value = "unitName" ,required = false) String unitName) {
Page<CylinderTableDto> cylinderTableDtoPage = cylinderDateInfoService.selectTodayDatePage(pageNumber, pageSize, developerAgency, unitName); Page<CylinderTableDto> cylinderTableDtoPage = cylinderDateInfoService.selectTodayDatePage(pageNumber, pageSize, regionName, unitName);
return ResponseHelper.buildResponse(cylinderTableDtoPage); return ResponseHelper.buildResponse(cylinderTableDtoPage);
} }
} }
...@@ -12,9 +12,11 @@ import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil; ...@@ -12,9 +12,11 @@ import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto; import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence; import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.api.enums.CompanyLevelEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService;
...@@ -61,6 +63,7 @@ import java.util.*; ...@@ -61,6 +63,7 @@ import java.util.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask; import java.util.concurrent.FutureTask;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 单位注册信息表服务实现类 * 单位注册信息表服务实现类
...@@ -415,13 +418,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -415,13 +418,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 组织架构中单位级别为:省级、地市级、区县级的单位 // 组织架构中单位级别为:省级、地市级、区县级的单位
List<CompanyModel> companyModels = new ArrayList<CompanyModel>(); List<CompanyModel> companyModels = new ArrayList<CompanyModel>();
if (StringUtils.isEmpty(orgCode)) { if (StringUtils.isEmpty(orgCode)) {
companyModels = (List<CompanyModel>) Privilege.companyClient.queryAgencyTree(null).getResult(); if (redisUtil.hasKey(BizCommonConstant.COMPANY_TREE_REDIS_KEY)) {
companyModels = (List<CompanyModel>) redisUtil.get(BizCommonConstant.COMPANY_TREE_REDIS_KEY);
} else {
companyModels = (List<CompanyModel>) Privilege.companyClient.queryAgencyTree(null).getResult();
redisUtil.set(BizCommonConstant.COMPANY_TREE_REDIS_KEY, companyModels);
}
} else { } else {
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult(); .queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) { for (Map.Entry<Object, Object> it : l.entrySet()) {
Privilege.companyClient.queryByOrgcode(orgCode).getResult();
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()), CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class); CompanyModel.class);
if (companyModel != null) { if (companyModel != null) {
...@@ -431,9 +437,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -431,9 +437,10 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
break; break;
} }
} }
return companyModels.stream().filter(c -> "headquarter".equals(c.getLevel()) List<CompanyModel> result =
|| "prefecture-level".equals(c.getLevel()) || "county".equals(c.getLevel())).map(this::dealChildCompany) companyModels.stream().filter(c -> !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel()))).map(this::dealChildCompany)
.collect(Collectors.toList()); .collect(Collectors.toList());
return result;
} }
@Override @Override
...@@ -529,8 +536,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -529,8 +536,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
cm.setChildren(this.getFilterChild(cm.getChildren() != null ? cm.getChildren() : new ArrayList())); cm.setChildren(this.getFilterChild(cm.getChildren() != null ? cm.getChildren() : new ArrayList()));
cm.getChildren().stream().filter(n -> { cm.getChildren().stream().filter(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel()));
|| "county".equals(c.getLevel());
}).map(n -> { }).map(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return dealChildCompany(c); return dealChildCompany(c);
...@@ -541,8 +547,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -541,8 +547,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
private List getFilterChild(Collection children) { private List getFilterChild(Collection children) {
return (List) children.stream().filter(n -> { return (List) children.stream().filter(n -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(n), CompanyModel.class);
return "headquarter".equals(c.getLevel()) || "prefecture-level".equals(c.getLevel()) return !ValidationUtil.isEmpty(CompanyLevelEnum.getEnum(c.getLevel()));
|| "county".equals(c.getLevel());
}).map(s -> { }).map(s -> {
CompanyModel c = JSONObject.parseObject(JSON.toJSONString(s), CompanyModel.class); CompanyModel c = JSONObject.parseObject(JSON.toJSONString(s), CompanyModel.class);
c.setChildren(this.getFilterChild(c.getChildren() != null ? c.getChildren() : new ArrayList())); c.setChildren(this.getFilterChild(c.getChildren() != null ? c.getChildren() : new ArrayList()));
......
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