forked from gzzfw/backEnd/gz-dyh

liyj
2024-09-12 89e716d623a2b773591ba020acb8c5affc1db9cc
1、查询上级综治中心组织
2 files added
5 files modified
166 ■■■■■ changed files
dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java 40 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java 16 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java 25 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java 27 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java 26 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/CustClient.java 9 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java 23 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/ApplyBaseConsts.java
New file
@@ -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----------
 */
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());
        }
    }
}
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());
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/AppearUnitDTO.java
New file
@@ -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;
}
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);
        }
    }
}
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);
}
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);
        }
    }
}