| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.EnterpriseQuery; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.service.TEnterpriseUserApplicationService; |
| | | import com.sun.xml.internal.bind.v2.TODO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TEnterpriseUserApplicationController { |
| | | |
| | | private final TEnterpriseUserApplicationService enterpriseUserApplicationService; |
| | | private final TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Autowired |
| | | public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService) { |
| | | public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService, TokenService tokenService) { |
| | | this.enterpriseUserApplicationService = enterpriseUserApplicationService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 添加计费策略管理 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略","后台-申请表单-集团用户"},value = "添加集团用户申请") |
| | | @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"小程序-集团用户","后台-申请表单-集团用户"},value = "添加集团用户申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TEnterpriseUserApplication dto) { |
| | | // TODO 用户id |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { |
| | | // 用户id |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Boolean> page(@RequestBody TEnterpriseUserApplication dto) { |
| | | // TODO 用户id |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | public AjaxResult<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) { |
| | | // 用户id |
| | | if (enterpriseQuery.getPhone()!=null) { |
| | | List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData(); |
| | | if (userIds.isEmpty()){ |
| | | return AjaxResult.warn("未查询到用户"); |
| | | } |
| | | Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | return AjaxResult.ok(page); |
| | | }else { |
| | | Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | return AjaxResult.ok(page); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") |
| | | @GetMapping(value = "/remark") |
| | | public AjaxResult pass(Integer id,String remark) { |
| | | // 用户id |
| | | TEnterpriseUserApplication byId = enterpriseUserApplicationService.getById(id); |
| | | byId.setRemark(remark); |
| | | enterpriseUserApplicationService.updateById(byId); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") |
| | | @DeleteMapping(value = "/delete") |
| | | public AjaxResult delete(String ids) { |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | enterpriseUserApplicationService.removeById(s); |
| | | } |
| | | return AjaxResult.success(); |
| | | |
| | | } |
| | | |
| | | } |