Commit d37f41b2 authored by tianbo's avatar tianbo

feat(statistics): 新增根据行政区域查询公司编码功能

- 在 CommonBaseMapper 中增加 selectCompanyCodeByRegionCode 方法 - 在 CommonBaseMapper.xml 中实现递归查询公司编码的 SQL 逻辑 - 在 StCommonServiceImpl 中增加 regionCodeCompanyCodeMap 缓存并实现查询逻辑 - 车用气瓶登记生成证号使用区域code - 监管查询-使用登记列表筛选接受机构条件优化
parent 7ca41132
......@@ -428,7 +428,9 @@
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND fu.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
AND fu.receive_company_code = #{dto.receiveCompanyCode}
</if>
</otherwise>
</choose>
AND fu.status != '使用单位待提交'
......@@ -674,7 +676,9 @@
OR ur.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND ur.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
AND ur.receive_company_code = #{dto.receiveCompanyCode}
</if>
</otherwise>
</choose>
AND ur.status <![CDATA[<>]]> '使用单位待提交'
......
......@@ -122,7 +122,9 @@ public class JgUseRegistrationController extends BaseController {
info.getCompany().getCompanyCode().split("_")[1] : info.getCompany().getCompanyCode());
} else {
dto.setDataType(BaseController.COMPANY_TYPE_SUPERVISION);
dto.setReceiveCompanyCode(info.getCompany().getCompanyCode());
if (client.equals("jgAudit")) {
dto.setReceiveCompanyCode(info.getCompany().getCompanyCode());
}
dto.setSupervisionOrgCode(info.getCompany().getOrgCode());
}
if (dto.getAuditPassDateRange() != null && !dto.getAuditPassDateRange().isEmpty()) {
......
......@@ -50,6 +50,7 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
......@@ -198,6 +199,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Resource
private DiscardOrderCheckFactory discardOrderCheckFactory;
@Autowired
private CodeUtil codeUtil;
/**
* @param auditPassDate 通过时间
* @param exportParamsMap 参数map
......@@ -947,7 +951,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
jgVehicleInformation.setNextExecuteUserIds("");
// 生成使用登记证编号
String receiveCompanyCode = jgVehicleInformation.getReceiveCompanyCode();
String receiveCompanyCode = codeUtil.getCityRegionCode(jgVehicleInformation.getReceiveCompanyCode());
CompanyModel receiveCompanyResult = Privilege.companyClient.queryByCompanyCode(receiveCompanyCode).getResult();
//查询到局级
// 如果不是局级公司,则查询其上级公司信息
......
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
......@@ -24,4 +26,6 @@ public interface CommonBaseMapper {
* @return 地市对应行政区划seq
*/
String selectCompanyRegionSeq(@Param("receiveCompanyCode") String receiveCompanyCode);
List<String> selectCompanyCodeByRegionCode(Long regionSeq);
}
......@@ -18,4 +18,33 @@
where
company_code = #{receiveCompanyCode} and is_deleted = false
</select>
<select id="selectCompanyCodeByRegionCode" resultType="java.lang.String">
WITH RECURSIVE company_tree AS (
SELECT
sequence_nbr,
company_name,
company_code,
parent_id,
ARRAY[sequence_nbr] AS path
FROM privilege_company
WHERE region_seq = #{regionSeq}
and (level != 'company' and level != 'organization')
UNION ALL
SELECT
c.sequence_nbr,
c.company_name,
c.company_code,
c.parent_id,
ct.path || c.sequence_nbr
FROM privilege_company c
INNER JOIN company_tree ct ON c.parent_id = ct.sequence_nbr
WHERE NOT (c.sequence_nbr = ANY(ct.path))
and (c.level != 'company' and c.level != 'organization')
)
SELECT
company_code companyCode
FROM company_tree ct
ORDER BY sequence_nbr;
</select>
</mapper>
......@@ -96,6 +96,9 @@ public class StCommonServiceImpl {
private static Map<Integer, RegionModel> regionCodeRegionMap = new ConcurrentHashMap<>();
// 行政区域code对应监管/审批单位code Map
private static Map<Integer, List<String>> regionCodeCompanyCodeMap = new ConcurrentHashMap<>();
private static final List<RegionModel> regionModels = new ArrayList<>();
private static List<EquipmentCategoryDto> equipmentCategoryDtos;
......@@ -165,6 +168,8 @@ public class StCommonServiceImpl {
* @param dpFilterParamDto 过滤条件
*/
private void setChildCompanyCodeByRegion(String cityCode, DPFilterParamDto dpFilterParamDto) {
RegionModel region = regionCodeRegionMap.get(Integer.valueOf(cityCode));
dpFilterParamDto.setCompanyCodes(regionCodeCompanyCodeMap.computeIfAbsent(Integer.valueOf(cityCode), k -> commonMapper.selectCompanyCodeByRegionCode(region.getSequenceNbr())));
}
public String getAndSetOrgCode(String cityCode) {
......
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