From 89e716d623a2b773591ba020acb8c5affc1db9cc Mon Sep 17 00:00:00 2001 From: liyj <1003249715@qq.com> Date: Thu, 12 Sep 2024 10:18:56 +0800 Subject: [PATCH] 1、查询上级综治中心组织 --- dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java | 25 ++++++++ dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java | 23 +++++++ dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java | 27 +++++++++ dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java | 40 +++++++++++++ dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java | 26 ++++++++ dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java | 16 +++++ dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java | 9 +++ 7 files changed, 166 insertions(+), 0 deletions(-) diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java new file mode 100644 index 0000000..73d35fd --- /dev/null +++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java @@ -0,0 +1,40 @@ +package cn.huge.module.mediate.constant; + +/** + * @title: 通用相关常量类 + * @description: 通用审核相关常量类 + * @company: hugeinfo + * @author: liyj + * @time: 2021-11-05 16:51:48 + * @version: 1.0.0 + */ +public class ApplyBaseConsts { + + /** + * 通用审核状态,0:未审核,1:已审核 + */ + public static final int AUDIT_STATUS_0 = 0; + public static final int AUDIT_STATUS_1 = 1; +} +/** + * -------------------_ooOoo_------------------- + * ------------------o8888888o------------------ + * ------------------88" . "88------------------ + * ------------------(| -_- |)------------------ + * ------------------O\ = /O------------------ + * ---------------____/`---'\____--------------- + * -------------.' \\| |// `.------------- + * ------------/ \\||| : |||// \------------ + * -----------/ _||||| -:- |||||- \----------- + * -----------| | \\\ - /// | |----------- + * -----------| \_| ''\---/'' | |----------- + * -----------\ .-\__ `-` ___/-. /----------- + * ---------___`. .' /--.--\ `. . __---------- + * ------."" '< `.___\_<|>_/___.' >'"".------- + * -----| | : `- \`.;`\ _ /`;.`/ - ` : | |----- + * -----\ \ `-. \_ __\ /__ _/ .-` / /----- + * ======`-.____`-.___\_____/___.-`____.-'====== + * -------------------`=---=' + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * ---------佛祖保佑---hugeinfo---永无BUG---------- + */ diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java index 64837de..5691399 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java @@ -3,6 +3,7 @@ import cn.huge.base.common.utils.ObjectUtils; import cn.huge.base.common.utils.ReturnFailUtils; import cn.huge.base.common.utils.ReturnSucUtils; +import cn.huge.base.config.CurrentUser; import cn.huge.module.ctuser.domain.po.CtUnit; import cn.huge.module.ctuser.domain.po.CtUser; import cn.huge.module.ctuser.service.CtUnitService; @@ -75,4 +76,19 @@ return ReturnFailUtils.getRepInfo(); } } + + /** + * 获取上级综治中心 + * @url {ctx}/api/client/ctUnit/getParentZzzxUnit + * @param unitId 组织编号 + * @return Object + */ + @GetMapping("/getParentZzzxUnit") + public Object getParentZzzxUnit(@RequestParam(value = "unitId") String unitId) { + try { + return ReturnSucUtils.getRepInfo(service.getParentZzzx(unitId)); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(e.getMessage()); + } + } } diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java index c769797..f709ba2 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java @@ -6,8 +6,12 @@ import cn.huge.base.config.CurrentUser; import cn.huge.module.ctuser.domain.po.CtUnit; import cn.huge.module.ctuser.domain.po.CtUser; +import cn.huge.module.ctuser.dto.AppearUnitDTO; import cn.huge.module.ctuser.service.CtUnitService; import cn.huge.module.ctuser.service.CtUserService; +import cn.huge.module.cust.dto.CtUnitDTO; +import cn.huge.module.cust.dto.CtUserDTO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -370,6 +374,7 @@ /** * 交办-选择组织 * @url {ctx}/api/web/ctUnit/unitChoose + * @param userId 组织编号 * @return Object */ @GetMapping("/unitChoose") @@ -381,4 +386,24 @@ return ReturnFailUtils.getRepInfo(e.getMessage()); } } + + /** + * web端任务处理-上报-查询上报的目标组织 + * @url {ctx}/api/web/ctUnit/getAppearToUnit + * @return Object + */ + @GetMapping("/getAppearToUnit") + public Object getAppearToUnit(@CurrentUser String userId) { + try { + // 获取当前登录用户 + CtUserDTO loginUser = ctUserService.clientGetUserAll(userId); + CtUnitDTO ctUnitDTO = service.getParentZzzx(loginUser.getUnitId()); + AppearUnitDTO appearUnitDTO = new AppearUnitDTO(); + appearUnitDTO.setAuditUnitId(ctUnitDTO.getId()); + appearUnitDTO.setAuditUnitName(ctUnitDTO.getUnitName()); + return ReturnSucUtils.getRepInfo(appearUnitDTO); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(e.getMessage()); + } + } } diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java new file mode 100644 index 0000000..d3b22e8 --- /dev/null +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java @@ -0,0 +1,27 @@ +package cn.huge.module.ctuser.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @title: 客户用户信息数据传输对象 + * @description: 客户用户信息数据传输对象 + * @company:hugeinfo + * @author: chenx + * @time: 2022-02-22 14:19:43 + * @version 1.0.0 + */ +@Data +public class AppearUnitDTO { + + /** + * 上报至目标单位编号 + */ + private String auditUnitId; + + /** + * 上报至目标单位名称 + */ + private String auditUnitName; +} 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 d212a5e..9825bee 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 @@ -13,14 +13,17 @@ import cn.huge.module.ctuser.domain.po.CtUnit; import cn.huge.module.ctuser.domain.po.CtUser; import cn.huge.module.ctuser.domain.po.CtUserole; +import cn.huge.module.ctuser.dto.AppearUnitDTO; import cn.huge.module.ctuser.dto.CtUnitWeChatCountDTO; import cn.huge.module.cust.constant.RoleBaseEnum; import cn.huge.module.cust.constant.UserBaseConsts; +import cn.huge.module.cust.dto.CtUnitDTO; import cn.huge.module.cust.dto.CtUserDTO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; @@ -467,4 +470,27 @@ return new ArrayList<>(); } } + + /** + * 获取上级综治中心 + * @param unitId 当前单位编号 + * @return + */ + public CtUnitDTO getParentZzzx(String unitId){ + try{ + // 查询当前单位的上级综治中心 + QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); + 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); + CtUnit zzzxCtUnit = mapper.selectOne(ctUnitQueryWrapper); + CtUnitDTO ctUnitDTO = new CtUnitDTO(); + BeanUtils.copyProperties(zzzxCtUnit, ctUnitDTO); + return ctUnitDTO; + }catch (Exception e){ + log.error("[CtUnitService.getParentZzzx]调用失败,异常信息:"+e, e); + throw new ServiceException("CtUnitService.getParentZzzx", e); + } + } } diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java index 199bd24..90b4b6d 100644 --- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java +++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java @@ -65,4 +65,13 @@ @GetMapping("/api/client/ctUnit/getUnitById") ReturnBO getUnitById(@RequestParam("unitId") String unitId); + /** + * 获取上级综治中心 + * @url {ctx}/api/client/ctUnit/getParentZzzxUnit + * @param unitId 组织编号 + * @return Object + */ + @GetMapping("/api/client/ctUnit/getParentZzzxUnit") + ReturnBO getParentZzzxUnit(@RequestParam(value = "unitId") String unitId); + } diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java index 879c4c5..1b708f4 100644 --- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java +++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java @@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; @@ -149,4 +150,26 @@ throw new ServiceException("CustClientImpl.getUnitById", e); } } + + /** + * 获取上级综治中心 + * @url {ctx}/api/client/ctUnit/getParentZzzxUnit + * @param unitId 组织编号 + * @return Object + */ + public CtUnitDTO getParentZzzxUnit(String unitId){ + try{ + ReturnBO returnBo = custClient.getParentZzzxUnit(unitId); + if (ReturnConsts.OK == returnBo.getCode()){ + CtUnitDTO ctUnitDTO = objectMapper.convertValue(returnBo.getData(), CtUnitDTO.class); + return ctUnitDTO; + }else{ + log.error("Client外服务接口[CustClientImpl.getParentZzzxUnit]请求异常:" + returnBo.getMsg(), returnBo.getMsg()); + throw new ClientException("CustClientImpl.getParentZzzxUnit", returnBo.getMsg()); + } + }catch (Exception e){ + log.error("service方法[CustClientImpl.getParentZzzxUnit]请求成功,处理异常:"+e, e); + throw new ServiceException("CustClientImpl.getParentZzzxUnit", e); + } + } } -- Gitblit v1.8.0