forked from gzzfw/backEnd/gz-dyh

liyj
2024-09-11 b6fa58652c12f0c61409cc44dfd8ad78f821b6c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package cn.huge.module.client.api.impl;
 
import cn.huge.base.common.bo.ReturnBO;
import cn.huge.base.common.constant.ReturnConsts;
import cn.huge.base.common.exception.ClientException;
import cn.huge.base.common.exception.ServiceException;
import cn.huge.module.client.api.UtilsClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
 
/**
 * @title: 公共工具微服务调用接口
 * @description: 公共工具微服务调用接口
 * @company: hugeinfo
 * @author: liyj
 * @time: 2021-11-05 16:51:48
 * @version: 1.0.0
 */
@Slf4j
@Component
public class UtilsClientImpl {
 
    private UtilsClient utilsClient;
 
    @Autowired
    public UtilsClientImpl(UtilsClient utilsClient) {
        this.utilsClient = utilsClient;
    }
 
    /**
     * 公共工具-id工具-获取时间Id,后四位常量
     * @url {ctx}/api/client/mediateUtils/getNewTimeId
     * @return ReturnBO
     */
    public String getNewTimeId(){
        try{
            ReturnBO returnBo = utilsClient.getNewTimeId();
            if (ReturnConsts.OK == returnBo.getCode()){
                String id = (String) returnBo.getData();
                return id;
            }else{
                log.error("Client外服务接口[UtilsClientImpl.getNewTimeId]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("UtilsClientImpl.getNewTimeId", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[UtilsClientImpl.getNewTimeId]请求成功,处理异常:"+e, e);
            throw new ServiceException("UtilsClientImpl.getNewTimeId", e);
        }
    }
 
    /**
     * 公共工具-id工具-获取时间Id,后四位常量
     * @url {ctx}/api/client/mediateUtils/getNewTimeCaseId
     * @return ReturnBO
     */
    public String getNewTimeCaseId(){
        try{
            ReturnBO returnBo = utilsClient.getNewTimeCaseId();
            if (ReturnConsts.OK == returnBo.getCode()){
                String id = (String) returnBo.getData();
                return id;
            }else{
                log.error("Client外服务接口[UtilsClientImpl.getNewTimeCaseId]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("UtilsClientImpl.getNewTimeCaseId", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[UtilsClientImpl.getNewTimeCaseId]请求成功,处理异常:"+e, e);
            throw new ServiceException("UtilsClientImpl.getNewTimeCaseId", e);
        }
    }
 
    /**
     * 生成新的调解案号
     * @url {ctx}/api/client/mediateUtils/createCaseNo
     * @param area 区
     * @return Object
     */
    public String createCaseNo(String area){
        try{
            ReturnBO returnBo = utilsClient.createCaseNo(area);
            if (ReturnConsts.OK == returnBo.getCode()){
                String caseNo = (String) returnBo.getData();
                return caseNo;
            }else{
                log.error("Client外服务接口[UtilsClientImpl.createCaseNo]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("UtilsClientImpl.createCaseNo", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[UtilsClientImpl.createCaseNo]请求成功,处理异常:"+e, e);
            throw new ServiceException("UtilsClientImpl.createCaseNo", e);
        }
    }
 
    /**
     * 生成新的事项编号
     * @url {ctx}/common/api/caseNoUtils/createCaseRef
     * @return Object
     */
    public String createCaseRef(){
        try{
            ReturnBO returnBo = utilsClient.createCaseRef();
            if (ReturnConsts.OK == returnBo.getCode()){
                String caseNo = (String) returnBo.getData();
                return caseNo;
            }else{
                log.error("Client外服务接口[UtilsClientImpl.createCaseRef]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("UtilsClientImpl.createCaseRef", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[UtilsClientImpl.createCaseRef]请求成功,处理异常:"+e, e);
            throw new ServiceException("UtilsClientImpl.createCaseRef", e);
        }
    }
 
}