EntmicroMerchantController.java
1.92 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
package cn.com.glsx.entmicro.controller;
import cn.com.glsx.entmicro.response.entmicromerchant.EntmicroMerchantBaseInfo;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.alibaba.fastjson.JSON;
import com.rop.AbstractRopRequest;
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.springframework.core.env.Environment;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author yelq
* @Version 1.0
* @Description:
* @Date 2022/10/14 17:13
*/
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("门店号选择服务")
@Slf4j
public class EntmicroMerchantController {
@Resource
private Environment environment;
/**
* 获取配置文件中配置的门店列表
* @return
*/
@ServiceMethod(method = "entmicro.api.merchant.listDepartmentTree.select.merchant", needInSession = NeedInSessionType.YES)
@ApiOperation("获取配置文件中配置的门店列表")
public RopResponse<List<EntmicroMerchantBaseInfo>> getMerchantList(AbstractRopRequest request){
List<EntmicroMerchantBaseInfo> response = new ArrayList<>();
String merchantObjs = environment.getProperty("merchant.staff.tree.select.merchantId");
try {
if (merchantObjs!=null){
List<EntmicroMerchantBaseInfo> baseInfos = JSON.parseArray(merchantObjs, EntmicroMerchantBaseInfo.class);
response.addAll(baseInfos);
}
} catch (Exception e) {
log.info("获取配置文件中配置的门店列表转换失败:{}",e);
return RopResponse.error("获取门店列表失败!请联系管理员检查配置。");
}
return RopResponse.success(response);
}
}