BusinessContoller.java 2.4 KB
Newer Older
T
Thinkingcao 已提交
1 2
package com.silence.web.controller.business;

T
Thinkingcao 已提交
3
import com.google.common.collect.Lists;
T
Thinkingcao 已提交
4 5
import com.google.common.collect.Maps;
import com.silence.common.core.domain.AjaxResult;
T
Thinkingcao 已提交
6
import com.silence.weixin.config.WxMpProperties;
T
Thinkingcao 已提交
7 8 9
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
T
Thinkingcao 已提交
10
import org.springframework.beans.factory.annotation.Autowired;
T
Thinkingcao 已提交
11 12 13 14
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

T
Thinkingcao 已提交
15
import java.util.List;
T
Thinkingcao 已提交
16 17 18
import java.util.Map;

/**
T
Thinkingcao 已提交
19
 * @desc: 测试的Controller
T
Thinkingcao 已提交
20 21 22 23 24 25 26 27
 * @author: cao_wencao
 * @date: 2019-08-28 16:48
 */
@Slf4j
@RestController
@Api(value = "业务测试Controller")
@RequestMapping(value = "/business")
public class BusinessContoller {
T
Thinkingcao 已提交
28 29 30 31 32 33 34 35

    @Autowired
    private WxMpProperties wxMpProperties;

    @RequestMapping(value = "/queryList", method = RequestMethod.GET)
    @ApiOperation(value = "查询List集合", notes = "查询集合数据", response = AjaxResult.class, httpMethod = "GET")
    public AjaxResult queryList() {
        Map<String, String> mapData = Maps.newHashMap();
T
Thinkingcao 已提交
36 37
        mapData.put("name", "曹");
        mapData.put("sex", "男");
T
Thinkingcao 已提交
38 39
        mapData.put("age", "20");
        return AjaxResult.success("查询用户集合成功", mapData);
T
Thinkingcao 已提交
40 41
    }

T
Thinkingcao 已提交
42 43 44
    @RequestMapping(value = "/getUser", method = RequestMethod.GET)
    @ApiOperation(value = "查询User", notes = "查询用户", response = AjaxResult.class, httpMethod = "GET")
    public String getUser() {
T
Thinkingcao 已提交
45 46
        return "宁浩";
    }
T
Thinkingcao 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

    @RequestMapping(value = "/getWxConfig", method = RequestMethod.GET)
    @ApiOperation(value = "查询微信配置", notes = "查询微信数据", response = AjaxResult.class, httpMethod = "GET")
    public AjaxResult getWxConfig() {
        Map<String, String> mapData = Maps.newHashMap();
        List<Map>  result = Lists.newArrayList();
        final List<WxMpProperties.MpConfig> configs = this.wxMpProperties.getConfigs();
        for (WxMpProperties.MpConfig config : configs) {
            mapData.put("appId", config.getAppId());
            mapData.put("secret", config.getSecret());
            mapData.put("token", config.getToken());
            mapData.put("aesKey", config.getAesKey());
            result.add(mapData);
        }
        return AjaxResult.success("查询微信配置成功", result);
    }
T
Thinkingcao 已提交
63
}