From c1a463b9f1c0a7160dbd0ac1c7490eef13861a5e Mon Sep 17 00:00:00 2001 From: huangh <hshgjzd5@163.com> Date: Tue, 29 Oct 2024 15:02:25 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/gzdyh_test' into gzdyh_test --- dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java | 83 +++++++++++++++++++++++++++++++++-------- 1 files changed, 66 insertions(+), 17 deletions(-) diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java index 787bcb9..17bb4a9 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java @@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -331,10 +332,10 @@ unitSelectTerm.setLabel(ctUnit.getUnitName()); unitSelectTerm.setParentId(ctUnit.getParentId()); unitSelectTerm.setCheckable(true); - if (UserBaseConsts.UNIT_TYPE_2 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_102 == ctUnit.getUnitType()){ szbmList.add(unitSelectTerm); } - if (UserBaseConsts.UNIT_TYPE_1 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_101 == ctUnit.getUnitType()){ qzzzxList.add(unitSelectTerm); } } @@ -379,10 +380,10 @@ unitSelectTerm.setLabel(ctUnit.getUnitName()); unitSelectTerm.setParentId(ctUnit.getParentId()); unitSelectTerm.setCheckable(true); - if (UserBaseConsts.UNIT_TYPE_2 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_102 == ctUnit.getUnitType()){ qzbmList.add(unitSelectTerm); } - if (UserBaseConsts.UNIT_TYPE_1 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_101 == ctUnit.getUnitType()){ zjzzzxList.add(unitSelectTerm); } } @@ -414,19 +415,37 @@ return result; }else if (UserBaseConsts.UNIT_GRADE_3 == loginUnit.getUnitGrade()){ // 镇街交办 - // 查询镇街部门数组 - QueryWrapper<CtDept> ctDeptQueryWrapper = new QueryWrapper<>(); - ctDeptQueryWrapper.eq("unit_id", loginUnit.getId()); - List<CtDept> deptList = ctDeptService.list(ctDeptQueryWrapper); + // 查询镇街的直属部门组织 List<SelectTermDTO> zjbmList = new ArrayList<>(); - for (CtDept ctDept: deptList){ + QueryWrapper<CtUnit> zjCtUnitQueryWrapper = new QueryWrapper<>(); + zjCtUnitQueryWrapper.eq("parent_id", loginUnit.getId()) + .eq("unit_grade", UserBaseConsts.UNIT_GRADE_3) + .eq("unit_type", UserBaseConsts.UNIT_TYPE_102); + List<CtUnit> zjCtUnitList = mapper.selectList(zjCtUnitQueryWrapper); + for (CtUnit zjCtUnit: zjCtUnitList){ SelectTermDTO unitSelectTerm = new SelectTermDTO(); - unitSelectTerm.setValue(ctDept.getId()); - unitSelectTerm.setLabel(ctDept.getName()); - unitSelectTerm.setParentId(loginUnit.getId()); + unitSelectTerm.setValue(zjCtUnit.getId()); + unitSelectTerm.setLabel(zjCtUnit.getUnitName()); + unitSelectTerm.setParentId(zjCtUnit.getParentId()); unitSelectTerm.setCheckable(true); zjbmList.add(unitSelectTerm); + } + + // 查询镇街部门数组 +// QueryWrapper<CtDept> ctDeptQueryWrapper = new QueryWrapper<>(); +// ctDeptQueryWrapper.eq("unit_id", loginUnit.getId()); +// List<CtDept> deptList = ctDeptService.list(ctDeptQueryWrapper); +// List<SelectTermDTO> zjbmList = new ArrayList<>(); +// for (CtDept ctDept: deptList){ +// SelectTermDTO unitSelectTerm = new SelectTermDTO(); +// unitSelectTerm.setValue(ctDept.getId()); +// unitSelectTerm.setLabel(ctDept.getName()); +// unitSelectTerm.setParentId(loginUnit.getId()); +// unitSelectTerm.setCheckable(true); +// zjbmList.add(unitSelectTerm); +// } + // 查询村社数组 QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()).eq("unit_grade", UserBaseConsts.UNIT_GRADE_4); @@ -513,10 +532,10 @@ unitSelectTerm.setLabel(ctUnit.getUnitName()); unitSelectTerm.setParentId(ctUnit.getParentId()); unitSelectTerm.setCheckable(true); - if (UserBaseConsts.UNIT_TYPE_1 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_101 == ctUnit.getUnitType()){ szbmList.add(unitSelectTerm); } - if (UserBaseConsts.UNIT_TYPE_2 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_102 == ctUnit.getUnitType()){ qzzzxList.add(unitSelectTerm); } } @@ -561,10 +580,10 @@ unitSelectTerm.setLabel(ctUnit.getUnitName()); unitSelectTerm.setParentId(ctUnit.getParentId()); unitSelectTerm.setCheckable(true); - if (UserBaseConsts.UNIT_TYPE_2 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_102 == ctUnit.getUnitType()){ qzbmList.add(unitSelectTerm); } - if (UserBaseConsts.UNIT_TYPE_3 == ctUnit.getUnitType()){ + if (UserBaseConsts.UNIT_TYPE_103 == ctUnit.getUnitType()){ zjzzzxList.add(unitSelectTerm); } } @@ -660,7 +679,7 @@ ctUnitQueryWrapper.eq("id", unitId).select("parent_id"); CtUnit loginCtUnit = mapper.selectOne(ctUnitQueryWrapper); ctUnitQueryWrapper.clear(); - ctUnitQueryWrapper.eq("id", loginCtUnit.getParentId()).eq("unit_type", UserBaseConsts.UNIT_TYPE_1); + ctUnitQueryWrapper.eq("id", loginCtUnit.getParentId()).eq("unit_type", UserBaseConsts.UNIT_TYPE_101); CtUnit zzzxCtUnit = mapper.selectOne(ctUnitQueryWrapper); CtUnitDTO ctUnitDTO = new CtUnitDTO(); BeanUtils.copyProperties(zzzxCtUnit, ctUnitDTO); @@ -670,4 +689,34 @@ throw new ServiceException("CtUnitService.getParentZzzx", e); } } + + /** + * 获取本级综治中心 + * @param unitId 当前单位编号 + * @return + */ + public CtUnitDTO getBjZzzx(String unitId){ + try{ + CtUnitDTO ctUnitDTO = new CtUnitDTO(); + // 查询自己是否是综治中心 + CtUnit loginCtUnit = mapper.selectById(unitId); + if (UserBaseConsts.UNIT_TYPE_101 == loginCtUnit.getUnitType()){ + BeanUtils.copyProperties(loginCtUnit, ctUnitDTO); + }else { + // 查询当前单位的上级综治中心 + QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); + ctUnitQueryWrapper.eq("id", loginCtUnit.getParentId()).eq("unit_type", UserBaseConsts.UNIT_TYPE_101); + CtUnit zzzxCtUnit = mapper.selectOne(ctUnitQueryWrapper); + BeanUtils.copyProperties(zzzxCtUnit, ctUnitDTO); + } + return ctUnitDTO; + }catch (Exception e){ + log.error("[CtUnitService.getParentZzzx]调用失败,异常信息:"+e, e); + throw new ServiceException("CtUnitService.getParentZzzx", e); + } + } + + public CtUnit selectUnitByGridId(String gridUnitId){ + return mapper.selectUnitByGridId(gridUnitId); + } } -- Gitblit v1.8.0