From a75bb5cc48daa9eaf6e40933e96bb0b8ff144ddc Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 12 九月 2024 09:18:55 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java |   77 +++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 7 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 0138f29..830e8fb 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,18 +1,25 @@
 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.log.enums.OperatorType;
+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>
@@ -27,22 +34,78 @@
 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;
     }
 
     /**
      * 添加计费策略管理
      */
     @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT)
-    @ApiOperation(tags = {"小程序-计费策略"},value = "添加集团用户申请")
+    @ApiOperation(tags = {"小程序-集团用户"},value = "添加集团用户申请")
     @PostMapping(value = "/add")
     public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) {
-        // TODO 用户id
+        // 用户id
+        dto.setAppUserId(tokenService.getLoginUserApplet().getUserId());
         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 R<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) {
+        // 用户id
+        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);
+        }
+    }
+    
+    
+    @Log(title = "【集团用户申请】填写备注", businessType = BusinessType.INSERT)
+    @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();
+    }
+    
+    @Log(title = "【集团用户申请】删除申请数据", businessType = BusinessType.DELETE)
+    @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