DracImConfigController.java
3.48 KB
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
package cn.com.glsx.entmicro.controller.drainage;
import cn.com.glsx.entmicro.request.drainage.DracImConfigAddRequest;
import cn.com.glsx.entmicro.request.drainage.DracImConfigSearchRequest;
import cn.com.glsx.entmicro.request.drainage.DracImConfigUpdateRequest;
import cn.com.glsx.entmicro.response.drainage.DracImConfigRopResponse;
import cn.com.glsx.entmicro.service.drainage.DracImConfigService;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/11/15 20:10
*/
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("引流配置服务")
@Slf4j
public class DracImConfigController {
@Autowired
private DracImConfigService dracImConfigService;
/**
* 新增配置
*
* @param dracImConfigAddRequest 入参
* @return
*/
@ServiceMethod(method = "entmicro.api.dracImConfig.addConfig",needInSession = NeedInSessionType.YES)
@ApiOperation("新增配置")
public RopResponse<Boolean> addConfig(DracImConfigAddRequest dracImConfigAddRequest) {
try {
return RopResponse.success(dracImConfigService.addConfig(dracImConfigAddRequest));
} catch (RpcServiceException e) {
log.info("=======DracImConfigController__invoke__addConfig__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 更新配置
*
* @param dracImConfigUpdateRequest 入参
* @return
*/
@ServiceMethod(method = "entmicro.api.dracImConfig.updateConfig",needInSession = NeedInSessionType.YES)
@ApiOperation("更新配置")
public RopResponse<Boolean> updateConfig(DracImConfigUpdateRequest dracImConfigUpdateRequest) {
try {
return RopResponse.success(dracImConfigService.updateConfig(dracImConfigUpdateRequest));
} catch (RpcServiceException e) {
log.info("=======DracImConfigController__invoke__updateConfig__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询配置
*
* @param dracImConfigSearchRequest 入参
* @return
*/
@ServiceMethod(method = "entmicro.api.dracImConfig.findConfig",needInSession = NeedInSessionType.YES)
@ApiOperation("查询配置")
public RopResponse<DracImConfigRopResponse> findConfig(DracImConfigSearchRequest dracImConfigSearchRequest) {
try {
DracImConfigRopResponse dracImConfigRopResponse=null;
List<DracImConfigRopResponse> config = dracImConfigService.findConfig(dracImConfigSearchRequest);
if(CollectionUtils.isNotEmpty(config)){
dracImConfigRopResponse=config.get(0);
}
return RopResponse.success(dracImConfigRopResponse);
} catch (RpcServiceException e) {
log.info("=======DracImConfigController__invoke__updateConfig__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}