From 10de85f85ad0874b2d93c851bb4d3eacab24a183 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 21 八月 2024 14:45:25 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java | 62 +++++++++++++++++++++++++++---- 1 files changed, 54 insertions(+), 8 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java index f612c11..6b744dc 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java @@ -1,19 +1,24 @@ 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.domain.R; 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.query.PassDto; import com.ruoyi.other.service.TEnterpriseUserApplicationService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -29,6 +34,8 @@ private final TEnterpriseUserApplicationService enterpriseUserApplicationService; private final TokenService tokenService; + @Resource + private AppUserClient appUserClient; @Autowired public TEnterpriseUserApplicationController(TEnterpriseUserApplicationService enterpriseUserApplicationService, TokenService tokenService) { @@ -40,7 +47,7 @@ * 添加计费策略管理 */ @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) - @ApiOperation(tags = {"小程序-计费策略"},value = "添加集团用户申请") + @ApiOperation(tags = {"小程序-集团用户"},value = "添加集团用户申请") @PostMapping(value = "/add") public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { // 用户id @@ -48,14 +55,53 @@ return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); } + @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "后台添加集团用户申请") + @PostMapping(value = "/back/add") + public AjaxResult<Boolean> backAdd(@Validated @RequestBody TEnterpriseUserApplication dto) { + // 用户id + return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); + } @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") @PostMapping(value = "/page") - public AjaxResult<Boolean> page(@RequestBody TEnterpriseUserApplication dto) { + public R<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) { // 用户id - dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); - return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); + if (enterpriseQuery.getPhone()!=null) { + List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData(); + if (userIds.isEmpty()){ + return R.ok(); + } + Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); + return R.ok(page); + }else { + Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); + return R.ok(page); + } + } + + + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") + @PostMapping(value = "/remark") + public AjaxResult pass(@RequestBody PassDto passDto) { + // 用户id + TEnterpriseUserApplication byId = enterpriseUserApplicationService.getById(passDto.getId()); + byId.setRemark(passDto.getRemark()); + + 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(); + } } -- Gitblit v1.7.1