StrategySopMetaController.java
1.99 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
package cn.com.glsx.dj.strategy.controller;
import cn.com.glsx.dj.strategy.dto.sop.SopStrategyMetaDTO;
import cn.com.glsx.dj.strategy.remote.SopStrategyRemote;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.AbstractRopRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@Api("营销SOP-策略元数据")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class StrategySopMetaController {
@Autowired
private SopStrategyRemote sopStrategyRemote;
@ApiOperation("查询策略元数据")
@ServiceMethod(method = "dj.api.smartcarlife.sop.strategy.meta")
public RopResponse<SopStrategyMetaDTO> getSopStrategyMeta(AbstractRopRequest request) {
try {
log.info("查询策略元数据");
RpcResponse<SopStrategyMetaDTO> response = sopStrategyRemote.getSopStrategyMeta();
if (response.isFailed()) {
log.error("查询策略元数据失败: {}", response.getMessage());
throw new RpcServiceException(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("dj.api.smartcarlife.sop.strategy.meta rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("dj.api.smartcarlife.sop.strategy.meta exception", e);
return RopResponse.result(DefaultErrorEnum.SERVICE_ERROR);
}
}
}