Commit 0a580817 authored by tianbo's avatar tianbo

refactor(jg): 优化获取管辖分局树接口并调整设备查询逻辑

- 在 CommonController 中为 creatTree 方法添加 client 参数
parent bbcea0c3
......@@ -385,11 +385,8 @@
<when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
WITH filtered_main_ids AS (
SELECT DISTINCT fu.sequence_nbr
SELECT fu.sequence_nbr
FROM tzs_jg_use_registration fu
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE fu.is_delete = '0'
<!-- 公共主表过滤条件 -->
<if test="dto.status != null and dto.status != ''">
......@@ -442,26 +439,31 @@
AND (fu.use_unit_credit_code = #{dto.unitCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri.EQU_LIST = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri.EQU_DEFINE = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri.EQU_CODE LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other.CODE96333 LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other.supervisory_code LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
AND exists(
SELECT 1 FROM tzs_jg_use_registration_eq re
INNER JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE re.equip_transfer_id = fu.sequence_nbr
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."EQU_CATEGORY" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
)
)
SELECT
fu.sequence_nbr AS sequenceNbr,
......
......@@ -109,8 +109,8 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/creatTree")
@ApiOperation(httpMethod = "GET", value = "获取管辖分局树", notes = "获取管辖分局树")
public ResponseModel<Object> creatTree() {
return ResponseHelper.buildResponse(commonService.getTree(getSelectedOrgInfo()));
public ResponseModel<Object> creatTree(@RequestParam(required = false) String client) {
return ResponseHelper.buildResponse(commonService.getTree(client, getSelectedOrgInfo()));
}
......
......@@ -30,7 +30,7 @@ public interface ICommonService {
List<LinkedHashMap> getRegion(String level, String parentId);
List<LinkedHashMap> getTree(ReginParams selectedOrgInfo);
List<LinkedHashMap> getTree(String client, ReginParams selectedOrgInfo);
List<LinkedHashMap> getApproveTree(ReginParams reginParams);
......
......@@ -733,9 +733,9 @@ public class CommonServiceImpl implements ICommonService {
}
@Override
public List<LinkedHashMap> getTree(ReginParams reginParams) {
public List<LinkedHashMap> getTree(String client, ReginParams reginParams) {
// 企业逻辑
if (reginParams.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY)) {
if (reginParams.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY) || "jgLook".equals(client)) {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree();
......@@ -871,7 +871,7 @@ public class CommonServiceImpl implements ICommonService {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
// 删除非行政审批局
// 删除非监管机构
Object companyTypeObj = e.get("companyType");
if (companyTypeObj == null || !companyTypeObj.toString().contains(companyType)) {
it.remove();
......
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