Commit 0a580817 authored by tianbo's avatar tianbo

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

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