xuekang
2024-05-13 15a0280ae9e7db96fdf0744c722d214d2cb5a0e5
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
package com.nuvole.four.controller.pc;
 
import com.github.pagehelper.PageHelper;
import com.nuvole.base.domain.SysUser;
import com.nuvole.common.domain.emnu.CommonResultEmnu;
import com.nuvole.common.domain.result.CommonResult;
import com.nuvole.common.domain.result.PageBean;
import com.nuvole.four.contants.Contants;
import com.nuvole.four.controller.BaseController;
import com.nuvole.four.domain.dto.ChannelOrgConfigDetailDto;
import com.nuvole.four.domain.dto.ChannelOrgConfigDto;
import com.nuvole.four.domain.params.ChannelOrgConfigParam;
import com.nuvole.four.service.ChannelOrgConfigService;
import com.nuvole.four.util.SystemUtil;
import com.nuvole.util.CommonUtil;
import com.nuvole.util.PageUtils;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * @Desc: 机构通道配置Controller
 * @Author: dqh
 * @Date: 2024-04-10
 **/
@Api(value = "机构通道配置", tags = "机构通道配置")
@Slf4j
@RestController
@RequestMapping(value = "/v1/four/pc/channel/org/config")
public class ChannelOrgConfigController extends BaseController {
    @Autowired
    private ChannelOrgConfigService channelOrgConfigService;
 
    /**
     * 方法描述: 查询机构通道列表
     * 仅包含当前orgId的下级,不包含(二三四级等)
     * @date  2024-04-11 18:50
     **/
    @ApiOperation(value = "查询机构通道列表", notes = "查询机构通道列表")
    @GetMapping("/getChannelOrgList")
    public CommonResult<PageBean> getChannelOrgConfigList(
            @ApiParam(name = "orgId", value = "机构ID;顶级则不传") Long orgId,
            @ApiParam(name = "orgName", value = "机构名称") String orgName,
            @ApiParam(name = "pageNumber", value = "页码", defaultValue = "1", required = true) Integer pageNumber,
            @ApiParam(name = "pageSize", value = "条数", defaultValue = "10", required = true) Integer pageSize,
            @ApiParam(name = "sortName", value = "排序名称") String sortName,
            @ApiParam(name = "sortOrder", value = "排序方式") String sortOrder
    ) {
        if (StringUtils.isNotBlank(sortName) && StringUtils.isNotBlank(sortOrder)) {
            PageHelper.orderBy(PageUtils.orderParser(sortName, sortOrder));
        }
 
        PageHelper.startPage(pageNumber, pageSize);
        List<ChannelOrgConfigDto> list = channelOrgConfigService.queryAllChannelOrg(orgId,orgName);
        CommonResult result = new CommonResult<>(new PageBean(list));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
 
    /**
     * 方法描述: 配置通道、设置默认
     *
     * @date  2024-04-11 18:51
     **/
    @ApiOperation(value = "配置通道", notes = "配置通道")
    @ApiImplicitParams({ @ApiImplicitParam(name = "ChannelOrgConfigParam") })
    @PostMapping("/config/channel")
    public CommonResult<Integer> configChannel() {
        ChannelOrgConfigParam configParam = CommonUtil.getObjFromReq(ChannelOrgConfigParam.class);
        channelOrgConfigService.configChannel(configParam);
        return new CommonResult(CommonResultEmnu.OK);
    }
 
    /**
     * 方法描述: 查询机构通道详情
     * 详情中的通道 仅包含当前orgId对应的pId对应的通道
     * @date  2024-04-11 20:04
     **/
    @ApiOperation(value = "查询机构通道详情", notes = "查询机构通道详情")
    @GetMapping("/getDetail")
    public CommonResult<ChannelOrgConfigDetailDto> getChannelOrgConfigDetail(
            @ApiParam(name = "orgId", value = "机构ID") Long orgId) {
        if (orgId == null) {
            SysUser user = SystemUtil.getLoginUser(Contants.LOGIN_TYPE_PC);
            if (user != null) {
                orgId = user.getOrgId();
            }
        }
        if (orgId == null) {
            return new CommonResult<>(CommonResultEmnu.INVALID_PARAMS, "参数为空!");
        }
        ChannelOrgConfigDetailDto dtoList = channelOrgConfigService.getChannelOrgConfigDetail(orgId);
        return new CommonResult(dtoList);
    }
 
 
}