From 8c55ab2701c99cec16eff92a26fefdf77fcdd28f Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 25 九月 2023 16:17:44 +0800
Subject: [PATCH] app接口修改

---
 cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java |  127 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 124 insertions(+), 3 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
index c264ecf..5341278 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
@@ -1,9 +1,12 @@
 package com.dsh.account.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.dsh.account.dto.*;
+import com.dsh.account.entity.GiftSearchDto;
 import com.dsh.account.entity.TStudent;
+import com.dsh.account.feignclient.course.CoursePaymentClient;
+import com.dsh.account.feignclient.course.model.TCoursePackagePayment;
 import com.dsh.account.model.StudentVo;
-import com.dsh.account.service.TAppUserService;
 import com.dsh.account.service.TStudentService;
 import com.dsh.account.util.ResultUtil;
 import com.dsh.account.util.TokenUtil;
@@ -12,7 +15,9 @@
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import springfox.documentation.swagger2.mappers.ModelMapper;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -69,8 +74,6 @@
     @PostMapping("/api/student/queryStudentList")
     @ApiOperation(value = "获取学员列表", tags = {"APP-课程列表"})
     @ApiImplicitParams({
-            @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true),
-            @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true),
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
     public ResultUtil<List<StudentVo>> queryStudentList(){
@@ -88,6 +91,7 @@
                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
                 studentVo.setAge(Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())));
                 listVo.add(studentVo);
+                studentVo.setName(tStudent.getName());
             }
             return ResultUtil.success(listVo);
         }catch (Exception e){
@@ -96,4 +100,121 @@
         }
     }
 
+
+    /**
+     * 根据电话号码学员信息
+     * @param phone
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/student/queryStudentByPhone")
+    public TStudent queryStudentByPhone(@RequestBody String phone){
+        try {
+            TStudent one = studentService.getOne(new QueryWrapper<TStudent>().eq("phone", phone).eq("state", 1));
+            return one;
+        }catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+    /**
+     * 根据id获取数据
+     * @param id
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/student/queryStudentById")
+    public TStudent queryStudentById(@RequestBody Integer id){
+        TStudent student = studentService.getById(id);
+        return student;
+    }
+
+
+
+
+    /**
+     * 根据名称模糊搜索学员
+     * @param name
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/student/queryStudentListByName")
+    public List<TStudent> queryStudentListByName(@RequestBody String name){
+        return studentService.list(new QueryWrapper<TStudent>().eq("state", 1).like("name", name));
+    }
+
+    /**
+     * web端查找学员
+     *
+     * @return
+     */
+
+    @ResponseBody
+    @PostMapping("/student/webStudentList")
+    public List<TStudentDto> querywebStudent(@RequestBody StudentSearch search){
+        return studentService.listAll(search);
+    }
+
+    @ResponseBody
+    @PostMapping("/student/webOneStudent")
+    public TStudentDto querywebStudentOne(@RequestParam("id")Integer id){
+        System.out.println("===?==》"+id);
+        return studentService.listOne(id);
+    }
+
+    @ResponseBody
+    @PostMapping("/student/update")
+    public  void update(@RequestBody TStudent tStudent){
+        System.out.println("======tStudent======"+tStudent);
+        studentService.updateById(tStudent);
+    }
+
+    @ResponseBody
+    @PostMapping("/student/createHistory")
+    public  void createHistory(@RequestBody CreateHistoryDto createHistoryDto){
+        createHistoryDto.setDate(new Date());
+        studentService.createHistory(createHistoryDto);
+
+
+    }
+
+
+    @ResponseBody
+    @PostMapping("/student/getHisory")
+    public  List<GetHistoryDto> getHisory(){
+
+        List<GetHistoryDto> getHistoryDtos =  studentService.getHistory();
+
+        return getHistoryDtos;
+    }
+
+
+    @Resource
+    private CoursePaymentClient paymentClient;
+    @ResponseBody
+    @PostMapping("/student/giftSelect")
+    public  List<SelectDto> giftSelect(@RequestBody GiftSearchDto giftSearchDto){
+        System.out.println("======giftSelect=========giftSearchDto===="+giftSearchDto);
+
+//       Integer appId = studentService.getGiftSelect(giftSearchDto);
+        TCoursePackagePayment coursePackagePaymentById = paymentClient.getCoursePackagePaymentById(giftSearchDto.getId());
+//        System.out.println("=======giftSelect======appId====>"+appId);
+        List<TStudent> selectDtos =  studentService.list(new QueryWrapper<TStudent>()
+                .select("name, id")
+                .eq("state", 1)
+                .eq("name", giftSearchDto.getName()).eq("phone",giftSearchDto.getPhone()).ne("appUserId",coursePackagePaymentById.getAppUserId()));
+
+
+        List<SelectDto> list = new ArrayList<>();
+        for (TStudent student : selectDtos) {
+            SelectDto selectDto = new SelectDto();
+            selectDto.setValue(student.getName());
+            selectDto.setId(student.getId());
+            list.add(selectDto);
+        }
+        System.out.println("=======giftSelect======selectDtos====>"+list);
+        return list;
+    }
 }

--
Gitblit v1.7.1