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 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 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 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 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); } }