From fe98baa55c34db41b158187f9c1837a269ec169b Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 11 三月 2024 18:28:17 +0800
Subject: [PATCH] 修改bug
---
cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java | 998 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 639 insertions(+), 359 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 b7be969..9629d6d 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
@@ -5,14 +5,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.account.dto.*;
import com.dsh.account.entity.*;
+import com.dsh.account.feignclient.course.CoursePackageClient;
import com.dsh.account.feignclient.course.CoursePaymentClient;
import com.dsh.account.feignclient.course.model.TCoursePackagePayment;
import com.dsh.account.model.QueryDataFee;
+import com.dsh.account.model.Student;
import com.dsh.account.model.StudentVo;
-import com.dsh.account.service.IVipPaymentService;
-import com.dsh.account.service.RechargeRecordsService;
-import com.dsh.account.service.TAppUserService;
-import com.dsh.account.service.TStudentService;
+import com.dsh.account.model.updateTimeDto;
+import com.dsh.account.service.*;
import com.dsh.account.util.ResultUtil;
import com.dsh.account.util.TokenUtil;
import com.dsh.account.util.ToolUtil;
@@ -54,52 +54,105 @@
@Autowired
private RechargeRecordsService rechargeRecordsService;
+ @Resource
+ private CoursePackageClient coursePackageClient;
+
+
+
/**
* 添加学员
+ *
* @return
*/
@RequestMapping("/base/student/addStudent")
- public Object addStudent(@RequestBody TStudent student){
+ public Object addStudent(@RequestBody TStudent student) {
student.setInsertTime(new Date());
student.setIsDefault(1);
- return studentService.save(student);
+ return studentService.save(student);
}
+
+ /**
+ * 获取有学员的用户ids
+ *
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/student/getHasStudentUser")
+ public List<Integer> getHasStudentUser() {
+ return studentService.list(new QueryWrapper<TStudent>()).stream().map(TStudent::getAppUserId).distinct().collect(Collectors.toList());
+ }
+
/**
* 获取用户学员列表
+ *
* @param appUserId
* @return
*/
@ResponseBody
@PostMapping("/student/queryStudentList")
- public List<TStudent> queryStudentList(@RequestBody Integer appUserId){
+ public List<TStudent> queryStudentList(@RequestBody Integer appUserId) {
try {
List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().eq("appUserId", appUserId).eq("state", 1));
return list;
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
return new ArrayList<>();
}
}
+
@ResponseBody
- @PostMapping("/student/queryStudentCom")
- public List<Map<String, Object>> queryStudentCom(@RequestBody Integer id){
-
- List<Map<String, Object>> list = studentService.queryCom(id);
+ @PostMapping("/student/queryListByIds")
+ public List<TStudent> queryListByIds(@RequestBody List<Integer> collect) {
+ try {
+ List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().in("id", collect).eq("state", 1));
return list;
-
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new ArrayList<>();
+ }
}
+ @ResponseBody
+ @PostMapping("/student/queryStudentCom")
+ public List<Map<String, Object>> queryStudentCom(@RequestBody Integer id) {
+
+ List<Map<String, Object>> list = studentService.queryCom(id);
+ return list;
+
+ }
+
+ @ResponseBody
+ @PostMapping("/student/frozen")
+ public void frozen(@RequestBody TStudent student) {
+ studentService.updateById(student);
+
+ }
+ @ResponseBody
+ @PostMapping("/student/getById")
+ public Date getById(@RequestBody Integer tStudentId) {
+ return studentService.getById(tStudentId).getValidity();
+
+ }
+ @ResponseBody
+ @PostMapping("/student/update1")
+ public void update(@RequestBody updateTimeDto updateTimeDto) {
+
+ TStudent student = new TStudent();
+ student.setId(updateTimeDto.getTStudentId());
+ student.setValidity(updateTimeDto.getDate());
+ studentService.updateById(student);
+ }
@ResponseBody
@PostMapping("/student/queryDefaultStudent")
- public TStudent queryDefaultStudent(@RequestBody Integer appUserId){
+ public TStudent queryDefaultStudent(@RequestBody Integer appUserId) {
try {
TStudent one = studentService.getOne(new QueryWrapper<TStudent>().eq("appUserId", appUserId).eq("isDefault", 1).eq("state", 1).last("limit 1"));
return one;
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
return null;
}
@@ -112,10 +165,10 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResultUtil<List<StudentVo>> queryStudentList(){
+ public ResultUtil<List<StudentVo>> queryStudentList() {
try {
Integer uid = tokenUtil.getUserIdFormRedis();
- if(null == uid){
+ if (null == uid) {
return ResultUtil.tokenErr();
}
List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().eq("appUserId", uid).eq("state", 1));
@@ -130,7 +183,7 @@
studentVo.setName(tStudent.getName());
}
return ResultUtil.success(listVo);
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
return ResultUtil.runErr();
}
@@ -139,54 +192,73 @@
/**
* 根据电话号码学员信息
+ *
* @param phone
* @return
*/
@ResponseBody
@PostMapping("/student/queryStudentByPhone")
- public TStudent queryStudentByPhone(@RequestBody String phone){
+ 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){
+ } catch (Exception e) {
e.printStackTrace();
return null;
}
}
+ @ResponseBody
+ @PostMapping("/student/queryById")
+ public TStudent queryById(@RequestBody Integer id) {
+ return studentService.getById(id);
+ }
+
+ @ResponseBody
+ @PostMapping("/base/appUser/updateTStudent")
+ public void updateTStudent(@RequestBody TStudent student) {
+ try {
+ studentService.updateById(student);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
/**
* 根据id获取数据
+ *
* @param id
* @return
*/
@ResponseBody
@PostMapping("/student/queryStudentById")
- public TStudent queryStudentById(@RequestBody Integer id){
+ 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){
+ public List<TStudent> queryStudentListByName(@RequestBody String name) {
return studentService.list(new QueryWrapper<TStudent>().eq("state", 1).like("name", name));
}
+
/**
* 根据名称模糊搜索学员
+ *
* @param name
* @return
*/
@PostMapping("/student/queryTStudentListByName")
- public List<TStudent> queryTStudentListByName(@RequestBody String name){
+ public List<TStudent> queryTStudentListByName(@RequestBody String name) {
return studentService.list(new QueryWrapper<TStudent>().eq("state", 1).like("name", name));
}
@@ -198,55 +270,54 @@
@ResponseBody
@PostMapping("/student/webStudentList")
- public List<TStudentDto> querywebStudent(@RequestBody StudentSearch search){
+ 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);
+ 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);
+ public void update(@RequestBody TStudent tStudent) {
+ System.out.println("======tStudent======" + tStudent);
studentService.updateById(tStudent);
}
@ResponseBody
@PostMapping("/student/createHistory")
- public void createHistory(@RequestBody CreateHistoryDto createHistoryDto){
+ 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();
+ 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);
-
+ public List<SelectDto> giftSelect(@RequestBody GiftSearchDto giftSearchDto) {
+ System.out.println("======giftSelect=========giftSearchDto====" + giftSearchDto);
+ TAppUser one = appUserService.getOne(new QueryWrapper<TAppUser>().eq("name", giftSearchDto.getName())
+ .eq("phone", giftSearchDto.getPhone()));
// Integer appId = studentService.getGiftSelect(giftSearchDto);
TCoursePackagePayment1 coursePackagePaymentById = paymentClient.getCoursePackagePaymentById1(giftSearchDto.getId());
// System.out.println("=======giftSelect======appId====>"+appId);
- List<TStudent> selectDtos = studentService.list(new QueryWrapper<TStudent>()
- .select("name, id")
+ List<TStudent> selectDtos = studentService.list(new QueryWrapper<TStudent>()
.eq("state", 1)
- .eq("name", giftSearchDto.getName()).eq("phone",giftSearchDto.getPhone()).ne("appUserId",coursePackagePaymentById.getAppUserId()));
-
-
+ .eq("appUserId", one.getId()));
List<SelectDto> list = new ArrayList<>();
for (TStudent student : selectDtos) {
SelectDto selectDto = new SelectDto();
@@ -254,56 +325,67 @@
selectDto.setId(student.getId());
list.add(selectDto);
}
- System.out.println("=======giftSelect======selectDtos====>"+list);
+ // 只筛选当前用户已经购买了这个课程的学员
+
+ System.out.println("=======giftSelect======selectDtos====>" + list);
return list;
}
@PostMapping("/student/getUserPt")
@ResponseBody
- public List<Integer> getUserPt(@RequestBody List<Integer> ids){
- if(ids.size()==0){
+ public List<Integer> getUserPt(@RequestBody List<Integer> ids) {
+ if (ids.size() == 0) {
ids.add(-1);
}
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1));
return list.stream().map(TAppUser::getId).collect(Collectors.toList());
}
+
@PostMapping("/student/getUserYYs")
@ResponseBody
- public List<Integer> getUserYYs(@RequestBody Integer id){
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id));
- return list.stream().map(TAppUser::getId).collect(Collectors.toList());
- }
- @ResponseBody
- @PostMapping("/student/getUserPtVip")
- public List<Integer> getUserPtVip(){
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1));
+ public List<Integer> getUserYYs(@RequestBody Integer id) {
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId, id));
return list.stream().map(TAppUser::getId).collect(Collectors.toList());
}
@PostMapping("/student/getUserStore")
@ResponseBody
- public List<Integer> getUserStore(@RequestBody Integer id){
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id));
+ public List<Integer> getUserStore(@RequestBody Integer id) {
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId, id));
+ return list.stream().map(TAppUser::getId).collect(Collectors.toList());
+ }
+
+ @PostMapping("/student/getUserYys")
+ @ResponseBody
+ public List<Integer> getUserYys(@RequestBody Integer id) {
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId, id));
+ return list.stream().map(TAppUser::getId).collect(Collectors.toList());
+ }
+
+ @ResponseBody
+ @PostMapping("/student/getUserPtVip")
+ public List<Integer> getUserPtVip() {
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1));
return list.stream().map(TAppUser::getId).collect(Collectors.toList());
}
@ResponseBody
@PostMapping("/student/userAndVipPt")
- public HashMap<String, Object> userAndVipPt(@RequestBody Integer type){
+ public HashMap<String, Object> userAndVipPt(@RequestBody Integer type) {
HashMap<String, Object> map = new HashMap<>();
// 所有的
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1));
- map.put("allUser",list.size());
- List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1));
- map.put("allVip",list1.size());
+ map.put("allUser", list.size());
+ List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1));
+ map.put("allVip", list1.size());
ArrayList<Object> integers = new ArrayList<>();
int year = DateUtil.year(new Date());
for (int i = 0; i < 10; i++) {
- integers.add(year-i);
+ integers.add(year - i);
}
List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
// 年
@@ -316,8 +398,8 @@
years.add(count);
yearsVip.add(count1);
}
- map.put("yearData",years);
- map.put("yearsVip",yearsVip);
+ map.put("yearData", years);
+ map.put("yearsVip", yearsVip);
ArrayList<Long> months = new ArrayList<>();
ArrayList<Long> monthsVip = new ArrayList<>();
@@ -325,9 +407,9 @@
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 月
for (int i = 1; i <= 12; i++) {
- String m=i+"";
- if(i<10){
- m="0"+i;
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
}
String s = year + "-" + m;
long count = list.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
@@ -335,8 +417,8 @@
months.add(count);
monthsVip.add(count1);
}
- map.put("monthData",months);
- map.put("monthsVip",monthsVip);
+ map.put("monthData", months);
+ map.put("monthsVip", monthsVip);
// 周
@@ -359,24 +441,24 @@
int count = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime, s7, s8));
- int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s7, s8));
+ int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s7, s8));
- int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime,s5,s6));
- int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s5,s6));
+ int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime, s5, s6));
+ int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s5, s6));
- int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime,s3,s4));
- int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s3,s4));
+ int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime, s3, s4));
+ int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s3, s4));
- int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime,s1,s2));
- int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s1,s2));
- map.put("count",count);
- map.put("count1",count1);
- map.put("count2",count2);
- map.put("count3",count3);
- map.put("countVip",countVip);
- map.put("countVip1",countVip1);
- map.put("countVip2",countVip2);
- map.put("countVip3",countVip3);
+ int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime, s1, s2));
+ int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
+ map.put("countVip", countVip);
+ map.put("countVip1", countVip1);
+ map.put("countVip2", countVip2);
+ map.put("countVip3", countVip3);
// 日
@@ -385,35 +467,36 @@
for (int i = 6; i >= 0; i--) {
String s = minNow.minusDays(i).toString();
String s9 = maxNow.minusDays(i).toString();
- int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime,s,s9));
- int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s,s9));
+ int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).between(TAppUser::getInsertTime, s, s9));
+ int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s, s9));
days.add(count4);
daysVip.add(countVip5);
}
- map.put("dayData",days);
- map.put("daysVip",daysVip);
+ map.put("dayData", days);
+ map.put("daysVip", daysVip);
return map;
}
+
@ResponseBody
@PostMapping("/student/stuPt")
- public HashMap<String, Object> stuPt(){
+ public HashMap<String, Object> stuPt() {
HashMap<String, Object> map = new HashMap<>();
// 所有的
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1));
List<Integer> collect1 = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect1.size()==0){
+ if (collect1.size() == 0) {
collect1.add(-1);
}
List<TStudent> students = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1));
- map.put("allUser",students.size());
+ map.put("allUser", students.size());
ArrayList<Object> integers = new ArrayList<>();
int year = DateUtil.year(new Date());
for (int i = 0; i < 10; i++) {
- integers.add(year-i);
+ integers.add(year - i);
}
List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
// 年
@@ -423,7 +506,7 @@
long count = students.stream().filter(e -> e.getInsertTime().toString().contains(s)).count();
years.add(count);
}
- map.put("yearData",years);
+ map.put("yearData", years);
ArrayList<Long> months = new ArrayList<>();
@@ -432,15 +515,15 @@
// 月
for (int i = 1; i <= 12; i++) {
- String m=i+"";
- if(i<10){
- m="0"+i;
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
}
String s = year + "-" + m;
long count = students.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
months.add(count);
}
- map.put("monthData",months);
+ map.put("monthData", months);
// 周
@@ -464,15 +547,15 @@
int count = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s7, s8));
- int count1 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s5,s6));
+ int count1 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s5, s6));
- int count2 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s3,s4));
+ int count2 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s3, s4));
- int count3 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s1,s2));
- map.put("count",count);
- map.put("count1",count1);
- map.put("count2",count2);
- map.put("count3",count3);
+ int count3 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
// 日
@@ -480,10 +563,98 @@
for (int i = 6; i >= 0; i--) {
String s = minNow.minusDays(i).toString();
String s9 = maxNow.minusDays(i).toString();
- int count4 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime,s,s9));
+ int count4 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect1).between(TStudent::getInsertTime, s, s9));
days.add(count4);
}
- map.put("dayData",days);
+ map.put("dayData", days);
+
+
+ return map;
+
+
+ }
+
+ @ResponseBody
+ @PostMapping("/student/stuYys")
+ public HashMap<String, Object> stuYys(@RequestBody List<Integer> ids) {
+ HashMap<String, Object> map = new HashMap<>();
+ List<TStudent> students = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids));
+ map.put("allUser", students.size());
+
+ ArrayList<Object> integers = new ArrayList<>();
+ int year = DateUtil.year(new Date());
+ for (int i = 0; i < 10; i++) {
+ integers.add(year - i);
+ }
+ List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
+ // 年
+ ArrayList<Long> years = new ArrayList<>();
+ for (Object o : collect) {
+ String s = o.toString();
+ long count = students.stream().filter(e -> e.getInsertTime().toString().contains(s)).count();
+ years.add(count);
+ }
+ map.put("yearData", years);
+
+ ArrayList<Long> months = new ArrayList<>();
+
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+
+ // 月
+ for (int i = 1; i <= 12; i++) {
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
+ }
+ String s = year + "-" + m;
+ long count = students.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
+ months.add(count);
+ }
+ map.put("monthData", months);
+
+ // 周
+
+ // 获取最近四周
+ LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+ LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+ // 周度数据
+ String s1 = minNow.minusDays(6).toString();
+ String s2 = maxNow.toString();
+
+ String s3 = minNow.minusDays(13).toString();
+ String s4 = maxNow.minusDays(6).toString();
+
+
+ String s5 = minNow.minusDays(20).toString();
+ String s6 = maxNow.minusDays(13).toString();
+
+ String s7 = minNow.minusDays(27).toString();
+ String s8 = maxNow.minusDays(20).toString();
+
+
+ int count = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s7, s8));
+
+ int count1 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s5, s6));
+
+ int count2 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s3, s4));
+
+ int count3 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
+
+
+ // 日
+ ArrayList<Integer> days = new ArrayList<>();
+ for (int i = 6; i >= 0; i--) {
+ String s = minNow.minusDays(i).toString();
+ String s9 = maxNow.minusDays(i).toString();
+ int count4 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s, s9));
+ days.add(count4);
+ }
+ map.put("dayData", days);
return map;
@@ -491,28 +662,138 @@
}
+ @ResponseBody
+ @PostMapping("/student/comdel")
+ public void comdel(@RequestBody Integer id) {
+ evaluateStudentService.removeById(id);
+
+ }
+
+ @ResponseBody
+ @PostMapping("/student/updatePassWord")
+ public void updatePassWord(@RequestBody List<String> strings) throws Exception {
+ appUserService.updatePassword1(strings.get(0),strings.get(1),strings.get(2));
+
+ }
+ @ResponseBody
+ @PostMapping("/student/stuStores")
+ public HashMap<String, Object> stuStores(@RequestBody List<Integer> ids) {
+ HashMap<String, Object> map = new HashMap<>();
+
+ List<TStudent> students = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids));
+ map.put("allUser", students.size());
+
+ ArrayList<Object> integers = new ArrayList<>();
+ int year = DateUtil.year(new Date());
+ for (int i = 0; i < 10; i++) {
+ integers.add(year - i);
+ }
+ List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
+ // 年
+ ArrayList<Long> years = new ArrayList<>();
+ for (Object o : collect) {
+ String s = o.toString();
+ long count = students.stream().filter(e -> e.getInsertTime().toString().contains(s)).count();
+ years.add(count);
+ }
+ map.put("yearData", years);
+
+ ArrayList<Long> months = new ArrayList<>();
+
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // 月
+ for (int i = 1; i <= 12; i++) {
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
+ }
+ String s = year + "-" + m;
+ long count = students.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
+ months.add(count);
+ }
+ map.put("monthData", months);
+ // 周
+
+ // 获取最近四周
+ LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+ LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+ // 周度数据
+ String s1 = minNow.minusDays(6).toString();
+ String s2 = maxNow.toString();
+
+ String s3 = minNow.minusDays(13).toString();
+ String s4 = maxNow.minusDays(6).toString();
+
+
+ String s5 = minNow.minusDays(20).toString();
+ String s6 = maxNow.minusDays(13).toString();
+
+ String s7 = minNow.minusDays(27).toString();
+ String s8 = maxNow.minusDays(20).toString();
+
+
+ int count = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s7, s8));
+
+ int count1 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s5, s6));
+
+ int count2 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s3, s4));
+
+ int count3 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
+
+
+ // 日
+ ArrayList<Integer> days = new ArrayList<>();
+ for (int i = 6; i >= 0; i--) {
+ String s = minNow.minusDays(i).toString();
+ String s9 = maxNow.minusDays(i).toString();
+ int count4 = studentService.count(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids).between(TStudent::getInsertTime, s, s9));
+ days.add(count4);
+ }
+ map.put("dayData", days);
+
+
+ return map;
+
+ }
+
+
+ @Autowired
+ private EvaluateStudentService evaluateStudentService;
+
+ @ResponseBody
+ @PostMapping("/student/save")
+ public void save(@RequestBody EvaluateStudent evaluateStudent) {
+ evaluateStudent.setInsertTime(new Date());
+ evaluateStudentService.saveOrUpdate(evaluateStudent);
+
+ }
@ResponseBody
@PostMapping("/student/userAndVipYys")
- public HashMap<String, Object> userAndVipYys(@RequestBody Integer id){
+ public HashMap<String, Object> userAndVipYys(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
+
// 所有的
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id));
- map.put("allUser",list.size());
- List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1));
- map.put("allVip",list1.size());
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
+ map.put("allUser", list.size());
+ List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1));
+ map.put("allVip", list1.size());
ArrayList<Object> integers = new ArrayList<>();
int year = DateUtil.year(new Date());
for (int i = 0; i < 10; i++) {
- integers.add(year-i);
+ integers.add(year - i);
}
List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
// 年
@@ -525,17 +806,17 @@
years.add(count);
yearsVip.add(count1);
}
- map.put("yearData",years);
- map.put("yearsVip",yearsVip);
+ map.put("yearData", years);
+ map.put("yearsVip", yearsVip);
ArrayList<Long> months = new ArrayList<>();
ArrayList<Long> monthsVip = new ArrayList<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 月
for (int i = 1; i <= 12; i++) {
- String m=i+"";
- if(i<10){
- m="0"+i;
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
}
String s = year + "-" + m;
long count = list.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
@@ -543,8 +824,8 @@
months.add(count);
monthsVip.add(count1);
}
- map.put("monthData",months);
- map.put("monthsVip",monthsVip);
+ map.put("monthData", months);
+ map.put("monthsVip", monthsVip);
// 周
@@ -566,25 +847,25 @@
String s8 = maxNow.minusDays(20).toString();
- int count = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime, s7, s8));
- int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s7, s8));
+ int count = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).between(TAppUser::getInsertTime, s7, s8));
+ int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s7, s8));
- int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s5,s6));
- int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s5,s6));
+ int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).between(TAppUser::getInsertTime, s5, s6));
+ int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s5, s6));
- int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s3,s4));
- int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s3,s4));
+ int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).between(TAppUser::getInsertTime, s3, s4));
+ int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s3, s4));
- int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s1,s2));
- int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s1,s2));
- map.put("count",count);
- map.put("count1",count1);
- map.put("count2",count2);
- map.put("count3",count3);
- map.put("countVip",countVip);
- map.put("countVip1",countVip1);
- map.put("countVip2",countVip2);
- map.put("countVip3",countVip3);
+ int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).between(TAppUser::getInsertTime, s1, s2));
+ int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
+ map.put("countVip", countVip);
+ map.put("countVip1", countVip1);
+ map.put("countVip2", countVip2);
+ map.put("countVip3", countVip3);
// 日
@@ -593,33 +874,34 @@
for (int i = 6; i >= 0; i--) {
String s = minNow.minusDays(i).toString();
String s9 = maxNow.minusDays(i).toString();
- int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s,s9));
- int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s,s9));
+ int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).between(TAppUser::getInsertTime, s, s9));
+ int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s, s9));
days.add(count4);
daysVip.add(countVip5);
}
- map.put("dayData",days);
- map.put("daysVip",daysVip);
+ map.put("dayData", days);
+ map.put("daysVip", daysVip);
return map;
}
+
@ResponseBody
@PostMapping("/student/userAndVipStore")
- public HashMap<String, Object> userAndVipStore(@RequestBody Integer id){
+ public HashMap<String, Object> userAndVipStore(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
// 所有的
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id));
- map.put("allUser",list.size());
- List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1));
- map.put("allVip",list1.size());
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
+ map.put("allUser", list.size());
+ List<TAppUser> list1 = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1));
+ map.put("allVip", list1.size());
ArrayList<Object> integers = new ArrayList<>();
int year = DateUtil.year(new Date());
for (int i = 0; i < 10; i++) {
- integers.add(year-i);
+ integers.add(year - i);
}
List<Object> collect = integers.stream().sorted().collect(Collectors.toList());
// 年
@@ -632,8 +914,8 @@
years.add(count);
yearsVip.add(count1);
}
- map.put("yearData",years);
- map.put("yearsVip",yearsVip);
+ map.put("yearData", years);
+ map.put("yearsVip", yearsVip);
ArrayList<Long> months = new ArrayList<>();
ArrayList<Long> monthsVip = new ArrayList<>();
@@ -641,9 +923,9 @@
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 1; i <= 12; i++) {
- String m=i+"";
- if(i<10){
- m="0"+i;
+ String m = i + "";
+ if (i < 10) {
+ m = "0" + i;
}
String s = year + "-" + m;
long count = list.stream().filter(e -> format.format(e.getInsertTime()).contains(s)).count();
@@ -651,8 +933,8 @@
months.add(count);
monthsVip.add(count1);
}
- map.put("monthData",months);
- map.put("monthsVip",monthsVip);
+ map.put("monthData", months);
+ map.put("monthsVip", monthsVip);
// 周
@@ -674,25 +956,25 @@
String s8 = maxNow.minusDays(20).toString();
- int count = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime, s7, s8));
- int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s7, s8));
+ int count = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).between(TAppUser::getInsertTime, s7, s8));
+ int countVip = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s7, s8));
- int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s5,s6));
- int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s5,s6));
+ int count1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).between(TAppUser::getInsertTime, s5, s6));
+ int countVip1 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s5, s6));
- int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s3,s4));
- int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s3,s4));
+ int count2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).between(TAppUser::getInsertTime, s3, s4));
+ int countVip2 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s3, s4));
- int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s1,s2));
- int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s1,s2));
- map.put("count",count);
- map.put("count1",count1);
- map.put("count2",count2);
- map.put("count3",count3);
- map.put("countVip",countVip);
- map.put("countVip1",countVip1);
- map.put("countVip2",countVip2);
- map.put("countVip3",countVip3);
+ int count3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).between(TAppUser::getInsertTime, s1, s2));
+ int countVip3 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s1, s2));
+ map.put("count", count);
+ map.put("count1", count1);
+ map.put("count2", count2);
+ map.put("count3", count3);
+ map.put("countVip", countVip);
+ map.put("countVip1", countVip1);
+ map.put("countVip2", countVip2);
+ map.put("countVip3", countVip3);
// 日
@@ -701,118 +983,111 @@
for (int i = 6; i >= 0; i--) {
String s = minNow.minusDays(i).toString();
String s9 = maxNow.minusDays(i).toString();
- int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).between(TAppUser::getInsertTime,s,s9));
- int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id).eq(TAppUser::getIsVip,1).between(TAppUser::getInsertTime, s,s9));
+ int count4 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).between(TAppUser::getInsertTime, s, s9));
+ int countVip5 = appUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getId, ids).eq(TAppUser::getIsVip, 1).between(TAppUser::getInsertTime, s, s9));
days.add(count4);
daysVip.add(countVip5);
}
- map.put("dayData",days);
- map.put("daysVip",daysVip);
+ map.put("dayData", days);
+ map.put("daysVip", daysVip);
return map;
}
-
-
-
-
@PostMapping("/student/queryFee")
- public HashMap<String, Object> queryFee(@RequestBody QueryDataFee queryDataFee){
+ public HashMap<String, Object> queryFee(@RequestBody QueryDataFee queryDataFee) {
HashMap<String, Object> map = new HashMap<>();
String data = queryDataFee.getData();
List<Integer> ids = queryDataFee.getIds();
- if(ids.size()==0){
+ if (ids.size() == 0) {
ids.add(-1);
}
LambdaQueryWrapper<VipPayment> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>();
- if(ToolUtil.isNotEmpty(data)){
- String stime = data.split(" - ")[0]+" 00:00:00";
- String etime = data.split(" - ")[1]+" 23:59:59";
- vipPaymentLambdaQueryWrapper.between(VipPayment::getInsertTime,stime,etime);
+ if (ToolUtil.isNotEmpty(data)) {
+ String stime = data.split(" - ")[0] + " 00:00:00";
+ String etime = data.split(" - ")[1] + " 23:59:59";
+ vipPaymentLambdaQueryWrapper.between(VipPayment::getInsertTime, stime, etime);
}
- vipPaymentLambdaQueryWrapper.in(VipPayment::getAppUserId,ids);
- vipPaymentLambdaQueryWrapper.eq(VipPayment::getPayStatus,2);
+ vipPaymentLambdaQueryWrapper.in(VipPayment::getAppUserId, ids);
+ vipPaymentLambdaQueryWrapper.eq(VipPayment::getPayStatus, 2);
List<VipPayment> list = vipPaymentService.list(vipPaymentLambdaQueryWrapper);
double sum = list.stream().mapToDouble(VipPayment::getAmount).sum();
- map.put("fee1",sum);
+ map.put("fee1", sum);
LambdaQueryWrapper<RechargeRecords> rechargeRecordsLambdaQueryWrapper = new LambdaQueryWrapper<>();
- if(ToolUtil.isNotEmpty(data)){
- String stime = data.split(" - ")[0]+" 00:00:00";
- String etime = data.split(" - ")[1]+" 23:59:59";
- rechargeRecordsLambdaQueryWrapper.between(RechargeRecords::getInsertTime,stime,etime);
+ if (ToolUtil.isNotEmpty(data)) {
+ String stime = data.split(" - ")[0] + " 00:00:00";
+ String etime = data.split(" - ")[1] + " 23:59:59";
+ rechargeRecordsLambdaQueryWrapper.between(RechargeRecords::getInsertTime, stime, etime);
}
- rechargeRecordsLambdaQueryWrapper.in(RechargeRecords::getAppUserId,ids);
- rechargeRecordsLambdaQueryWrapper.eq(RechargeRecords::getPayStatus,2);
+ rechargeRecordsLambdaQueryWrapper.in(RechargeRecords::getAppUserId, ids);
+ rechargeRecordsLambdaQueryWrapper.eq(RechargeRecords::getPayStatus, 2);
List<RechargeRecords> list1 = rechargeRecordsService.list(rechargeRecordsLambdaQueryWrapper);
- double sum1 = list1.stream().map(RechargeRecords::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add).doubleValue();
+ double sum1 = list1.stream().map(RechargeRecords::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
- map.put("fee2",sum1);
-
-
+ map.put("fee2", sum1);
return map;
}
-
@PostMapping("/student/queryUserAge")
- public HashMap<String, Object> queryUserAge(){
+ public HashMap<String, Object> queryUserAge() {
HashMap<String, Object> map = new HashMap<>();
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
+ if (collect.size() == 0) {
collect.add(-1);
}
List<TStudent> list1 = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect));
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int boy=0;
- int girl=0;
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int boy = 0;
+ int girl = 0;
for (TStudent tStudent : list1) {
Date birthday = tStudent.getBirthday();
long l = DateUtil.betweenYear(birthday, new Date(), true);
- if(l<7){
+ if (l < 7) {
age1++;
- }else if(l>=8 && l<11){
+ } else if (l >= 8 && l < 11) {
age2++;
- }else if(l>=11 && l<=12){
+ } else if (l >= 11 && l <= 12) {
age3++;
- }else {
+ } else {
age4++;
}
- if(tStudent.getSex()==1){
+ if (tStudent.getSex() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
-
}
+
@PostMapping("/student/queryUserAge1")
- public HashMap<String, Object> queryUserAge1(){
+ public HashMap<String, Object> queryUserAge1() {
HashMap<String, Object> map = new HashMap<>();
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 1));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
+ if (collect.size() == 0) {
collect.add(-1);
}
@@ -825,68 +1100,68 @@
int a = 0;
strings1.add(string);
for (TAppUser tAppUser : list) {
- if(tAppUser.getCity().equals(string)){
+ if (tAppUser.getCity().equals(string)) {
a++;
}
}
integers.add(a);
}
- map.put("cityData",strings1);
- map.put("cityNum",integers);
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int age5=0;
- int age6=0;
- int boy=0;
- int girl=0;
+ map.put("cityData", strings1);
+ map.put("cityNum", integers);
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int age5 = 0;
+ int age6 = 0;
+ int boy = 0;
+ int girl = 0;
for (TAppUser tStudent : list) {
Date birthday = tStudent.getBirthday();
- long l =0;
- if(birthday!=null){
+ long l = 0;
+ if (birthday != null) {
- l = DateUtil.betweenYear(birthday, new Date(), true);
+ l = DateUtil.betweenYear(birthday, new Date(), true);
}
- if(l<=12){
+ if (l <= 12) {
age1++;
- }else if(l>12 && l<18){
+ } else if (l > 12 && l < 18) {
age2++;
- }else if(l>=19 && l<=25){
+ } else if (l >= 19 && l <= 25) {
age3++;
- }else if(l>=26 && l<=35){
+ } else if (l >= 26 && l <= 35) {
age4++;
- }else if(l>=36 && l<=50){
+ } else if (l >= 36 && l <= 50) {
age5++;
- }else {
+ } else {
age6++;
}
- if(tStudent.getGender()!=null &&tStudent.getGender()==1){
+ if (tStudent.getGender() != null && tStudent.getGender() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("age5",age5);
- map.put("age6",age6);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("age5", age5);
+ map.put("age6", age6);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
-
}
+
@PostMapping("/student/queryUserAgeYys")
- public HashMap<String, Object> queryUserAgeYys(Integer id){
+ public HashMap<String, Object> queryUserAgeYys(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id));
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
+ if (collect.size() == 0) {
collect.add(-1);
}
@@ -899,66 +1174,67 @@
int a = 0;
strings1.add(string);
for (TAppUser tAppUser : list) {
- if(tAppUser.getCity().equals(string)){
+ if (tAppUser.getCity().equals(string)) {
a++;
}
}
integers.add(a);
}
- map.put("cityData",strings1);
- map.put("cityNum",integers);
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int age5=0;
- int age6=0;
- int boy=0;
- int girl=0;
+ map.put("cityData", strings1);
+ map.put("cityNum", integers);
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int age5 = 0;
+ int age6 = 0;
+ int boy = 0;
+ int girl = 0;
for (TAppUser tStudent : list) {
Date birthday = tStudent.getBirthday();
- long l =0;
- if(birthday!=null){
+ long l = 0;
+ if (birthday != null) {
- l = DateUtil.betweenYear(birthday, new Date(), true);
+ l = DateUtil.betweenYear(birthday, new Date(), true);
}
- if(l<=12){
+ if (l <= 12) {
age1++;
- }else if(l>12 && l<18){
+ } else if (l > 12 && l < 18) {
age2++;
- }else if(l>=19 && l<=25){
+ } else if (l >= 19 && l <= 25) {
age3++;
- }else if(l>=26 && l<=35){
+ } else if (l >= 26 && l <= 35) {
age4++;
- }else if(l>=36 && l<=50){
+ } else if (l >= 36 && l <= 50) {
age5++;
- }else {
+ } else {
age6++;
}
- if(tStudent.getGender()!=null &&tStudent.getGender()==1){
+ if (tStudent.getGender() != null && tStudent.getGender() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("age5",age5);
- map.put("age6",age6);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("age5", age5);
+ map.put("age6", age6);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
}
+
@PostMapping("/student/queryUserAgeStore")
- public HashMap<String, Object> queryUserAgeStore(Integer id){
+ public HashMap<String, Object> queryUserAgeStore(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id));
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
+ if (collect.size() == 0) {
collect.add(-1);
}
@@ -971,144 +1247,148 @@
int a = 0;
strings1.add(string);
for (TAppUser tAppUser : list) {
- if(tAppUser.getCity().equals(string)){
+ if (tAppUser.getCity().equals(string)) {
a++;
}
}
integers.add(a);
}
- map.put("cityData",strings1);
- map.put("cityNum",integers);
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int age5=0;
- int age6=0;
- int boy=0;
- int girl=0;
+ map.put("cityData", strings1);
+ map.put("cityNum", integers);
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int age5 = 0;
+ int age6 = 0;
+ int boy = 0;
+ int girl = 0;
for (TAppUser tStudent : list) {
Date birthday = tStudent.getBirthday();
- long l =0;
- if(birthday!=null){
+ long l = 0;
+ if (birthday != null) {
- l = DateUtil.betweenYear(birthday, new Date(), true);
+ l = DateUtil.betweenYear(birthday, new Date(), true);
}
- if(l<=12){
+ if (l <= 12) {
age1++;
- }else if(l>12 && l<18){
+ } else if (l > 12 && l < 18) {
age2++;
- }else if(l>=19 && l<=25){
+ } else if (l >= 19 && l <= 25) {
age3++;
- }else if(l>=26 && l<=35){
+ } else if (l >= 26 && l <= 35) {
age4++;
- }else if(l>=36 && l<=50){
+ } else if (l >= 36 && l <= 50) {
age5++;
- }else {
+ } else {
age6++;
}
- if(tStudent.getGender()!=null &&tStudent.getGender()==1){
+ if (tStudent.getGender() != null && tStudent.getGender() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("age5",age5);
- map.put("age6",age6);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("age5", age5);
+ map.put("age6", age6);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
}
+
@PostMapping("/student/queryUserAgeYys1")
- public HashMap<String, Object> queryUserAgeYys1(@RequestBody Integer id){
+ public HashMap<String, Object> queryUserAgeYys1(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 2).eq(TAppUser::getAddUserId,id));
+ List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
+ if (collect.size() == 0) {
collect.add(-1);
}
List<TStudent> list1 = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect));
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int boy=0;
- int girl=0;
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int boy = 0;
+ int girl = 0;
for (TStudent tStudent : list1) {
Date birthday = tStudent.getBirthday();
long l = DateUtil.betweenYear(birthday, new Date(), true);
- if(l<7){
+ if (l < 7) {
age1++;
- }else if(l>=8 && l<11){
+ } else if (l >= 8 && l < 11) {
age2++;
- }else if(l>=11 && l<=12){
+ } else if (l >= 11 && l <= 12) {
age3++;
- }else {
+ } else {
age4++;
}
- if(tStudent.getSex()==1){
+ if (tStudent.getSex() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
}
+
@PostMapping("/student/queryUserAgeStore1")
- public HashMap<String, Object> queryUserAgeStore1(@RequestBody Integer id){
+ public HashMap<String, Object> queryUserAgeStore1(@RequestBody List<Integer> ids) {
HashMap<String, Object> map = new HashMap<>();
- List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getInsertType, 3).eq(TAppUser::getAddUserId,id));
- List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
- if(collect.size()==0){
- collect.add(-1);
- }
- List<TStudent> list1 = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, collect));
- int age1=0;
- int age2=0;
- int age3=0;
- int age4=0;
- int boy=0;
- int girl=0;
+ List<TStudent> list1 = studentService.list(new LambdaQueryWrapper<TStudent>().in(TStudent::getAppUserId, ids));
+ int age1 = 0;
+ int age2 = 0;
+ int age3 = 0;
+ int age4 = 0;
+ int boy = 0;
+ int girl = 0;
for (TStudent tStudent : list1) {
Date birthday = tStudent.getBirthday();
long l = DateUtil.betweenYear(birthday, new Date(), true);
- if(l<7){
+ if (l < 7) {
age1++;
- }else if(l>=8 && l<11){
+ } else if (l >= 8 && l < 11) {
age2++;
- }else if(l>=11 && l<=12){
+ } else if (l >= 11 && l <= 12) {
age3++;
- }else {
+ } else {
age4++;
}
- if(tStudent.getSex()==1){
+ if (tStudent.getSex() == 1) {
boy++;
- }else {
+ } else {
girl++;
}
}
- map.put("age1",age1);
- map.put("age2",age2);
- map.put("age3",age3);
- map.put("age4",age4);
- map.put("boy",boy);
- map.put("girl",girl);
+ map.put("age1", age1);
+ map.put("age2", age2);
+ map.put("age3", age3);
+ map.put("age4", age4);
+ map.put("boy", boy);
+ map.put("girl", girl);
return map;
+ }
+
+ @ResponseBody
+ @PostMapping("/student/queryExpiredList")
+ public List<TStudent> queryExpiredList(){
+ List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().eq("state", 1).last(" and DATE_FORMAT(now(), '%Y-%m-%d') > validity"));
+ return list;
}
}
--
Gitblit v1.7.1