最终版1.1

This commit is contained in:
abu 2024-06-25 10:05:23 +08:00
parent 6c447fc525
commit dbcbb1bcd0
47 changed files with 1061 additions and 293 deletions

View File

@ -1,43 +1,2 @@
# wx-api # wx-api
微信公众号管理系统支持多公众号接入。提供公众号菜单、自动回复、公众号素材、模板消息、CMS等管理功能 微信公众号管理系统支持多公众号接入。提供公众号菜单、自动回复、公众号素材、模板消息、CMS等管理功能
### [📖使用文档](https://www.yuque.com/nifury/wx) | [Github仓库](https://github.com/niefy/wx-api) | [码云仓库](https://gitee.com/niefy/wx-api)
## 项目说明
- wx-api是一个轻量级的公众号开发种子项目可快速接入微信公众号管理功能
- 管理后台前端项目wx-managehttps://github.com/niefy/wx-manage
- 移动端示例wx-client: https://github.com/niefy/wx-client
- swagger文档启动wx-api后查看http://localhost:8088/wx/swagger-ui/index.html
## [docker方式启动文档](https://www.yuque.com/nifury/wx/nf1rvm)
## [开发环境启动文档](https://www.yuque.com/nifury/wx/guobb7)
## [生产环境部署步骤](https://www.yuque.com/nifury/wx/ofehhv)
## 技术选型
- 核心框架Spring Boot
- 安全框架Apache Shiro
- 持久层框架:[MyBatis-Plus](https://baomidou.oschina.io/mybatis-plus-doc/#/quick-start)
- 公众号开发框架:[WxJava](https://github.com/Wechat-Group/WxJava)
- 项目脚手架:[renren-fast](https://gitee.com/renrenio/renren-fast)
- 页面交互Vue2.x、ElementUI、TinyMce Editor、Vuex
## 截图
![公众号账号](https://s1.ax1x.com/2020/06/23/NUTQAg.png)
![公众号菜单](https://s1.ax1x.com/2020/06/23/NUTlNQ.png)
![自动回复](https://s1.ax1x.com/2020/04/10/GTqyQA.png)
![模板消息配置](https://s1.ax1x.com/2020/04/18/JnKZhF.jpg)
![模板消息发送](https://s1.ax1x.com/2020/04/18/JnKEkT.jpg)
![粉丝管理](https://s1.ax1x.com/2020/04/18/JnKVtU.jpg)
![带参二维码](https://s1.ax1x.com/2020/04/18/JnKF00.jpg)
![素材管理](https://s1.ax1x.com/2020/05/20/Y7djHI.jpg)
![公众号消息](https://s1.ax1x.com/2020/05/20/Y7dXDA.jpg)
![文章编辑](https://s1.ax1x.com/2020/04/10/GTqrzd.png)
![系统菜单管理](https://s1.ax1x.com/2020/04/18/JnKk7V.jpg)
![管理员列表](https://s1.ax1x.com/2020/04/18/JnKimq.jpg)
## [项目开发进度](https://www.yuque.com/nifury/wx/kens6d)
## [代码贡献指南](https://www.yuque.com/nifury/wx/ykqswi)
## 开发交流
QQ群1023785886已满、993128490 技术交流群严禁广告,发广告立即踢出+拉黑+举报加群密码wx

View File

@ -7,7 +7,6 @@
<version>0.8.2</version> <version>0.8.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>wx-api</description> <description>wx-api</description>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
@ -32,6 +31,10 @@
<weixin-java.version>4.5.6.B</weixin-java.version> <weixin-java.version>4.5.6.B</weixin-java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -40,7 +40,7 @@ public class RRExceptionHandler {
@ExceptionHandler(DuplicateKeyException.class) @ExceptionHandler(DuplicateKeyException.class)
public R handleDuplicateKeyException(DuplicateKeyException e) { public R handleDuplicateKeyException(DuplicateKeyException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
return R.error("数据库中已存在该记录"); return R.error("此ID已被使用请重新确认");
} }
@ExceptionHandler(AuthorizationException.class) @ExceptionHandler(AuthorizationException.class)

View File

@ -96,9 +96,14 @@ public class H5LocalTeacherController extends AbstractController{
// } // }
List<Long> list = Arrays.asList(id); List<Long> list = Arrays.asList(id);
teacherService.listByIds(list).forEach(h5LocalTeacher -> { teacherService.listByIds(list).forEach(h5LocalTeacher -> {
h5UserService.remove(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5LocalTeacher.getUserId())); H5User one = h5UserService.getOne(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5LocalTeacher.getUserId()));
one.setOpenId("");
one.setUserName("");
one.setGroupId(0);
one.setWorkload(0);
h5UserService.updateById(one);
// h5UserService.remove();
}); });
teacherService.deleteBatch(id); teacherService.deleteBatch(id);
return R.ok(); return R.ok();
} }
@ -158,9 +163,9 @@ public class H5LocalTeacherController extends AbstractController{
*/ */
@GetMapping("/export") @GetMapping("/export")
@ApiOperation(value = "用户列表", notes = "") @ApiOperation(value = "用户列表", notes = "")
public List<H5LocalTeacher> export() { public List<H5LocalTeacher> export(@RequestParam(value = "major",required = false) String major) {
// List<H5User> h5Users = h5UserService.list(); // List<H5User> h5Users = h5UserService.list();
List<H5LocalTeacher> students =teacherService.queryExcelUser(getUserId()); List<H5LocalTeacher> students =teacherService.queryExcelUser(getUserId(),major);
return students; return students;
} }

View File

@ -98,7 +98,13 @@ public class H5StudentController extends AbstractController{
// } // }
List<Long> list = Arrays.asList(id); List<Long> list = Arrays.asList(id);
studentService.listByIds(list).forEach(h5Student -> { studentService.listByIds(list).forEach(h5Student -> {
h5UserService.remove(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5Student.getUserId())); H5User one = h5UserService.getOne(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId, h5Student.getUserId()));
one.setOpenId("");
one.setUserName("");
one.setGroupId(0);
one.setWorkload(0);
h5UserService.updateById(one);
// h5UserService.remove();
}); });
studentService.deleteBatch(id); studentService.deleteBatch(id);
return R.ok(); return R.ok();
@ -158,9 +164,9 @@ public class H5StudentController extends AbstractController{
*/ */
@GetMapping("/export") @GetMapping("/export")
@ApiOperation(value = "用户列表", notes = "") @ApiOperation(value = "用户列表", notes = "")
public List<H5Student> export() { public List<H5Student> export(@RequestParam(value = "major",required = false) String major) {
// List<H5User> h5Users = h5UserService.list(); // List<H5User> h5Users = h5UserService.list();
List<H5Student> students =studentService.queryExcelUser(getUserId()); List<H5Student> students =studentService.queryExcelUser(getUserId(),major);
return students; return students;
} }

View File

@ -10,41 +10,44 @@ import com.github.niefy.common.validator.ValidatorUtils;
import com.github.niefy.common.validator.group.AddGroup; import com.github.niefy.common.validator.group.AddGroup;
import com.github.niefy.common.validator.group.UpdateGroup; import com.github.niefy.common.validator.group.UpdateGroup;
import com.github.niefy.modules.h5.entity.H5Invitation; import com.github.niefy.modules.h5.entity.H5Invitation;
import com.github.niefy.modules.h5.entity.H5LocalTeacher;
import com.github.niefy.modules.h5.entity.H5User; import com.github.niefy.modules.h5.entity.H5User;
import com.github.niefy.modules.h5.entity.H5WaiTeacher; import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.entity.excel_entiry.H5WaiTeacherExcel;
import com.github.niefy.modules.h5.entity.excel_entiry.MealCardExcel;
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
import com.github.niefy.modules.h5.service.H5InvitationService; import com.github.niefy.modules.h5.service.H5InvitationService;
import com.github.niefy.modules.h5.service.H5UserService; import com.github.niefy.modules.h5.service.H5UserService;
import com.github.niefy.modules.h5.service.H5WaiTeacherService; import com.github.niefy.modules.h5.service.H5WaiTeacherService;
import com.github.niefy.modules.sys.controller.AbstractController; import com.github.niefy.modules.sys.controller.AbstractController;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 外校老师相关的api * 外校老师相关的api
*
* @author 阿卜 * @author 阿卜
* @date 2024/4/13 * @date 2024/4/13
*/ */
@RestController @RestController
@RequestMapping("/wai") @RequestMapping("/wai")
public class H5WaiTeacherController extends AbstractController{ public class H5WaiTeacherController extends AbstractController {
private final H5WaiTeacherService h5WaiTeacherService; private final H5WaiTeacherService h5WaiTeacherService;
private final H5UserService h5UserService; private final H5UserService h5UserService;
private final H5InvitationService h5InvitationService; private final H5InvitationService h5InvitationService;
@Autowired @Autowired
public H5WaiTeacherController(H5WaiTeacherService h5WaiTeacherService, H5UserService h5UserService,H5InvitationService h5InvitationService) { public H5WaiTeacherController(H5WaiTeacherService h5WaiTeacherService, H5UserService h5UserService, H5InvitationService h5InvitationService) {
this.h5WaiTeacherService = h5WaiTeacherService; this.h5WaiTeacherService = h5WaiTeacherService;
this.h5UserService = h5UserService; this.h5UserService = h5UserService;
this.h5InvitationService = h5InvitationService; this.h5InvitationService = h5InvitationService;
@ -65,7 +68,7 @@ public class H5WaiTeacherController extends AbstractController{
h5UserService.updateById(oneUser); h5UserService.updateById(oneUser);
LambdaUpdateWrapper<H5Invitation> qw = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<H5Invitation> qw = new LambdaUpdateWrapper<>();
qw.eq(H5Invitation::getUserId, oneUser.getUserId()); qw.eq(H5Invitation::getUserId, oneUser.getUserId());
qw.set(H5Invitation::getWorkName,waiTeacher.getWorkName()); qw.set(H5Invitation::getWorkName, waiTeacher.getWorkName());
h5InvitationService.update(qw); h5InvitationService.update(qw);
map.put("user", waiTeacher); map.put("user", waiTeacher);
map.put("router", "/mainPage"); map.put("router", "/mainPage");
@ -80,7 +83,7 @@ public class H5WaiTeacherController extends AbstractController{
*/ */
@GetMapping("/list") @GetMapping("/list")
@RequiresPermissions("wai:user:list") @RequiresPermissions("wai:user:list")
@ApiOperation(value = "用户列表",notes = "") @ApiOperation(value = "用户列表", notes = "")
public R list(@RequestParam Map<String, Object> params) { public R list(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表 //只有超级管理员才能查看所有管理员列表
if (getUserId() != Constant.SUPER_ADMIN) { if (getUserId() != Constant.SUPER_ADMIN) {
@ -99,7 +102,7 @@ public class H5WaiTeacherController extends AbstractController{
@SysLog("删除用户") @SysLog("删除用户")
@PostMapping("/delete") @PostMapping("/delete")
@RequiresPermissions("wai:user:delete") @RequiresPermissions("wai:user:delete")
@ApiOperation(value = "删除用户",notes = "") @ApiOperation(value = "删除用户", notes = "")
public R delete(@RequestBody Long[] id) { public R delete(@RequestBody Long[] id) {
// if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) { // if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
// return R.error("系统管理员不能删除"); // return R.error("系统管理员不能删除");
@ -109,17 +112,47 @@ public class H5WaiTeacherController extends AbstractController{
// } // }
List<Long> list = Arrays.asList(id); List<Long> list = Arrays.asList(id);
h5WaiTeacherService.listByIds(list).forEach(h5WaiTeacher -> { h5WaiTeacherService.listByIds(list).forEach(h5WaiTeacher -> {
h5UserService.remove(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5WaiTeacher.getUserId())); H5User one = h5UserService.getOne(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId, h5WaiTeacher.getUserId()));
one.setOpenId("");
one.setUserName("");
one.setGroupId(0);
one.setWorkload(0);
h5UserService.updateById(one);
// h5UserService.remove();
}); });
h5WaiTeacherService.deleteBatch(id); h5WaiTeacherService.deleteBatch(id);
return R.ok(); return R.ok();
} }
/**
* 确认外校老师信息
*/
@SysLog("确认外校老师信息")
@GetMapping("/confirm")
// @RequiresPermissions("wai:user:delete")
@ApiOperation(value = "确认外校老师信息", notes = "")
public R confirm(@RequestParam(value = "id") Integer id,@RequestParam(value = "un", required = false) String un) {
if (StringUtils.isEmpty(un)){
LambdaUpdateWrapper<H5WaiTeacher> waiUpdateWrapper = new LambdaUpdateWrapper<>();
waiUpdateWrapper.eq(H5WaiTeacher::getId, id).set(H5WaiTeacher::getStatus, 0);
h5WaiTeacherService.update(waiUpdateWrapper);
}else {
LambdaUpdateWrapper<H5WaiTeacher> waiUpdateWrapper = new LambdaUpdateWrapper<>();
waiUpdateWrapper.eq(H5WaiTeacher::getId, id).set(H5WaiTeacher::getStatus, 1);
h5WaiTeacherService.update(waiUpdateWrapper);
}
return R.ok();
}
/** /**
* 更新时候获取用户信息 * 更新时候获取用户信息
*/ */
@GetMapping("/info/{userId}") @GetMapping("/info/{userId}")
@RequiresPermissions("wai:user:info") @RequiresPermissions("wai:user:info")
@ApiOperation(value = "用户信息",notes = "") @ApiOperation(value = "用户信息", notes = "")
public R info(@PathVariable("userId") Long userId) { public R info(@PathVariable("userId") Long userId) {
H5WaiTeacher user = h5WaiTeacherService.getById(userId); H5WaiTeacher user = h5WaiTeacherService.getById(userId);
return R.ok().put("user", user); return R.ok().put("user", user);
@ -132,13 +165,17 @@ public class H5WaiTeacherController extends AbstractController{
@SysLog("保存用户") @SysLog("保存用户")
@PostMapping("/backsave") @PostMapping("/backsave")
@RequiresPermissions("wai:user:save") @RequiresPermissions("wai:user:save")
@ApiOperation(value = "保存用户",notes = "") @ApiOperation(value = "保存用户", notes = "")
public R backSave(@RequestBody H5WaiTeacher user) { public R backSave(@RequestBody H5WaiTeacher user) {
ValidatorUtils.validateEntity(user, AddGroup.class); ValidatorUtils.validateEntity(user, AddGroup.class);
user.setCreateTime(LocalDateTime.now()); user.setCreateTime(LocalDateTime.now());
// user.setCreateUserId(getUserId());
h5WaiTeacherService.save(user); boolean save= h5WaiTeacherService.saveWaiTeacher(user,getUserId());
return R.ok();
if (!save){
return R.error("操作失败");
}
return R.ok("操作成功");
} }
@ -148,12 +185,12 @@ public class H5WaiTeacherController extends AbstractController{
@SysLog("修改用户") @SysLog("修改用户")
@PostMapping("/update") @PostMapping("/update")
@RequiresPermissions("wai:user:update") @RequiresPermissions("wai:user:update")
@ApiOperation(value = "修改用户",notes = "") @ApiOperation(value = "修改用户", notes = "")
public R update(@RequestBody H5WaiTeacher user) { public R update(@RequestBody H5WaiTeacher user) {
ValidatorUtils.validateEntity(user, UpdateGroup.class); ValidatorUtils.validateEntity(user, UpdateGroup.class);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
h5UserLambdaQueryWrapper.eq(H5User::getUserId,user.getUserId()); h5UserLambdaQueryWrapper.eq(H5User::getUserId, user.getUserId());
H5User one = h5UserService.getOne(h5UserLambdaQueryWrapper); H5User one = h5UserService.getOne(h5UserLambdaQueryWrapper);
one.setGroupId(user.getGroupId()); one.setGroupId(user.getGroupId());
one.setUserName(user.getUserName()); one.setUserName(user.getUserName());
@ -178,22 +215,33 @@ public class H5WaiTeacherController extends AbstractController{
return R.ok("分配成功"); return R.ok("分配成功");
} }
@GetMapping("count") // @GetMapping("count")
public R countingPeople() { // public R countingPeople() {
Map<String, Object> stringLongMap = h5WaiTeacherService.countingPeople(); // Map<String, Object> stringLongMap = h5WaiTeacherService.countingPeople();
return R.ok(stringLongMap); // return R.ok(stringLongMap);
} // }
/**
* 统计
* @param major
* @return
*/
@GetMapping("/count")
public R queryCount(@RequestParam(value = "major",required = false) Integer major) {
Map<String, Long> stringLongMap = h5WaiTeacherService.queryCount(getUserId(), major);
return R.ok().put(stringLongMap);
}
@GetMapping("/export") @GetMapping("/export")
@ApiOperation(value = "用户列表", notes = "") @ApiOperation(value = "用户列表", notes = "")
public List<H5WaiTeacher> export() { public List<H5WaiTeacher> export(@RequestParam(value = "major",required = false) String major) {
List<H5WaiTeacher> students =h5WaiTeacherService.queryExcelUser(getUserId()); return h5WaiTeacherService.queryExcelUser(getUserId(),major);
return students;
} }
/** /**
* 手动宿舍分配 * 手动宿舍分配
*
* @param params * @param params
* @return * @return
*/ */
@ -205,5 +253,110 @@ public class H5WaiTeacherController extends AbstractController{
h5WaiTeacherService.getWoManList(params); h5WaiTeacherService.getWoManList(params);
return R.ok().put("page", ""); return R.ok().put("page", "");
} }
//
/**
* 数据管理文件上传
*
* @param file
* @return
* @throws IOException
*/
@PostMapping("/upload")
// @ResponseBody
// @RequiresPermissions("h5:user:list")
public String upload(MultipartFile file) {
List<H5WaiTeacherExcel> list = null;
// LambdaQueryWrapper<H5User> queryWrapper = new LambdaQueryWrapper<>();
try {
InputStream inputStream = file.getInputStream();
list = EasyExcelUtil.syncReadModel(inputStream, H5WaiTeacherExcel.class, 0, 1);
for (H5WaiTeacherExcel user : list) {
LambdaQueryWrapper<H5WaiTeacher> updateWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<H5User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(H5User::getUserMajorId, user.getUserMajorId());
H5User h5User = h5UserService.getOne(queryWrapper);
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
if (h5User != null) {
h5WaiTeacher.setUserId(h5User.getUserId());
h5WaiTeacher.setMajorId(h5User.getMajorId());
}
h5WaiTeacher.setUserMajorId(user.getUserMajorId());
h5WaiTeacher.setUserName(user.getUserName());
h5WaiTeacher.setPhone(user.getPhone());
h5WaiTeacher.setJobTitle(user.getJobTitle());
h5WaiTeacher.setOffice(user.getOffice());
h5WaiTeacher.setWorkName(user.getWorkName());
h5WaiTeacher.setWorkPhone(user.getWorkPhone());
h5WaiTeacher.setIdentityId(user.getIdentityId());
if (StringUtils.isNotEmpty(user.getAge())) {
h5WaiTeacher.setAge(Integer.parseInt(user.getAge()));
}
h5WaiTeacher.setSex(user.getSex());
h5WaiTeacher.setCarNumber(user.getCarNumber());
if (StringUtils.isEmpty(user.getCarNumber())) {
h5WaiTeacher.setCarStatus(0);
}
if ("".equals(user.getDormitoryStatus())) {
h5WaiTeacher.setDormitoryStatus(0);
} else if ("".equals(user.getDormitoryStatus())) {
h5WaiTeacher.setDormitoryStatus(1);
} else {
h5WaiTeacher.setDormitoryStatus(0);
}
h5WaiTeacher.setPyCard(user.getPyCard());
h5WaiTeacher.setBankAddress(user.getBankAddress());
h5WaiTeacher.setBankName(user.getBankName());
// 按照getUserMajorId来更新这个整个对象
if (h5User != null) {
updateWrapper.eq(H5WaiTeacher::getOpenId, h5User.getOpenId());
}
H5WaiTeacher teacher = h5WaiTeacherService.getOne(updateWrapper);
if (teacher == null) {
h5WaiTeacherService.save(h5WaiTeacher);
// h5WaiTeacherService.update(h5WaiTeacher,updateWrapper);
} else {
teacher.setMealCard(user.getMealCard());
teacher.setDormitory(user.getDormitory());
h5WaiTeacherService.update(teacher, updateWrapper);
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
throw new RuntimeException("上传失败");
}
return "上传成功";
}
/**
* 饭卡信息上传
*
* @param file
* @return
* @throws IOException
*/
// @PostMapping("/mealUpload")
//// @ResponseBody
//// @RequiresPermissions("h5:user:list")
// public String upload11(MultipartFile file) throws IOException {
// List<MealCardExcel> list = null;
// InputStream inputStream = file.getInputStream();
// list = EasyExcelUtil.syncReadModel(inputStream, MealCardExcel.class, 0, 1);
// if (!list.isEmpty()) {
// for (MealCardExcel card : list) {
// LambdaUpdateWrapper<H5WaiTeacher> waiUpdateWrapper = new LambdaUpdateWrapper<>();
// String userMajorId = card.getUserMajorId();
// String mealCard = card.getMealCard();
// waiUpdateWrapper.eq(H5WaiTeacher::getUserMajorId, userMajorId);
// waiUpdateWrapper.set(H5WaiTeacher::getMealCard, mealCard);
// h5WaiTeacherService.update(waiUpdateWrapper);
// }
// return "上传成功";
// }
// return "上传失败";
// }
} }

View File

@ -0,0 +1,14 @@
package com.github.niefy.modules.h5.entity.dto;
import com.github.niefy.modules.h5.entity.H5User;
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import lombok.Data;
//import java.io.Serializable;
//import java.util.List;
//@Data
//public class ExportWaiTeacherVO implements Serializable {
// private List<H5User> users;
// private List<H5WaiTeacher> waiTeachers;
// private static final long serialVersionUID = 1L;
//}

View File

@ -0,0 +1,100 @@
package com.github.niefy.modules.h5.entity.excel_entiry;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @TableName h5_wai_teacher
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class H5WaiTeacherExcel {
private String id;
/**
* 名称
*/
private String userName;
/**
* 用户专业id
*/
private String userMajorId;
/**
* 手机号
*/
private String phone;
/**
* 学科
*/
private String major;
/**
* 职称
* 高级正高级
*/
private String jobTitle;
/**
* 职务
*/
private String office;
/**
* 单位名称
*/
private String workName;
/**
* 单位电话
*/
private String workPhone;
/**
* 身份证
*/
private String identityId;
/**
* 年龄
*/
private String age;
/**
* 性别
*/
private String sex;
/**
* 车牌号
*/
private String carNumber;
/**
* 是否住宿
*/
private String dormitoryStatus;
/**
* 银行卡号
*/
private String pyCard;
/**
* 开户所在地
*/
private String bankAddress;
/**
* 开户行
*/
private String bankName;
/**
* 宿舍信息
*/
private String dormitory;
/**
* 饭卡信息
*/
private String mealCard;
}

View File

@ -0,0 +1,23 @@
package com.github.niefy.modules.h5.entity.excel_entiry;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class MealCardExcel {
/**
* 用户专业id
*/
private String userMajorId;
/**
* 饭卡
*/
private String mealCard;
}

View File

@ -17,5 +17,5 @@ public interface H5LocalTeacherService extends IService<H5LocalTeacher> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
public void deleteBatch(Long[] userId); public void deleteBatch(Long[] userId);
List<H5LocalTeacher> queryExcelUser(Long userId); List<H5LocalTeacher> queryExcelUser(Long userId, String myMajor);
} }

View File

@ -16,7 +16,7 @@ import java.util.Map;
public interface H5StudentService extends IService<H5Student> { public interface H5StudentService extends IService<H5Student> {
public List<H5Student> queryExcelUser(Long userId); public List<H5Student> queryExcelUser(Long userId, String myMajor) ;
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
public void deleteBatch(Long[] userId); public void deleteBatch(Long[] userId);

View File

@ -3,7 +3,7 @@ package com.github.niefy.modules.h5.service;
import com.github.niefy.common.utils.PageUtils; import com.github.niefy.common.utils.PageUtils;
import com.github.niefy.modules.h5.entity.H5WaiTeacher; import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -24,9 +24,12 @@ public interface H5WaiTeacherService extends IService<H5WaiTeacher> {
List<H5WaiTeacher> queryListY(Integer id); List<H5WaiTeacher> queryListY(Integer id);
List<H5WaiTeacher> queryExcelUser(Long userId); List<H5WaiTeacher> queryExcelUser(Long userId,String major);
void getWoManList(Map<String, Object> params); void getWoManList(Map<String, Object> params);
boolean saveWaiTeacher(H5WaiTeacher user,Long userId);
// void createTask(MultipartFile file); // void createTask(MultipartFile file);
public Map<String,Long> queryCount(Long userId,Integer myMajor);
} }

View File

@ -9,9 +9,11 @@ import com.github.niefy.common.utils.Query;
import com.github.niefy.common.utils.R; import com.github.niefy.common.utils.R;
import com.github.niefy.modules.h5.entity.H5LocalTeacher; import com.github.niefy.modules.h5.entity.H5LocalTeacher;
import com.github.niefy.modules.h5.entity.H5Student; import com.github.niefy.modules.h5.entity.H5Student;
import com.github.niefy.modules.h5.entity.H5User;
import com.github.niefy.modules.h5.entity.H5WaiTeacher; import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.service.H5LocalTeacherService; import com.github.niefy.modules.h5.service.H5LocalTeacherService;
import com.github.niefy.modules.h5.mapper.H5LocalTeacherMapper; import com.github.niefy.modules.h5.mapper.H5LocalTeacherMapper;
import com.github.niefy.modules.h5.service.H5UserService;
import com.github.niefy.modules.h5.util.H5Util; import com.github.niefy.modules.h5.util.H5Util;
import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl; import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -32,11 +34,13 @@ public class H5LocalTeacherServiceImpl extends ServiceImpl<H5LocalTeacherMapper,
implements H5LocalTeacherService{ implements H5LocalTeacherService{
private final ShiroServiceImpl shiroServiceImpl; private final ShiroServiceImpl shiroServiceImpl;
private final H5LocalTeacherMapper localTeacherMapper; private final H5LocalTeacherMapper localTeacherMapper;
private final H5UserService h5UserService;
@Autowired @Autowired
public H5LocalTeacherServiceImpl(H5LocalTeacherMapper localTeacherMapper, ShiroServiceImpl shiroServiceImpl) { public H5LocalTeacherServiceImpl( H5UserService h5UserService,H5LocalTeacherMapper localTeacherMapper, ShiroServiceImpl shiroServiceImpl) {
this.shiroServiceImpl = shiroServiceImpl; this.shiroServiceImpl = shiroServiceImpl;
this.localTeacherMapper = localTeacherMapper; this.localTeacherMapper = localTeacherMapper;
this.h5UserService = h5UserService;
} }
@Override @Override
@ -129,6 +133,11 @@ public class H5LocalTeacherServiceImpl extends ServiceImpl<H5LocalTeacherMapper,
if (StringUtils.isNotBlank(userName)) { if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName); queryWrapper.like("user_name", userName);
} }
// 按学科分类
String major = (String) params.get("major");
if (major != null) {
queryWrapper.like("major_id", major);
}
} else { } else {
queryWrapper.eq("major_id", majorId); queryWrapper.eq("major_id", majorId);
if (StringUtils.isNotBlank(userName)) { if (StringUtils.isNotBlank(userName)) {
@ -160,39 +169,173 @@ public class H5LocalTeacherServiceImpl extends ServiceImpl<H5LocalTeacherMapper,
} }
// @Override
// public List<H5LocalTeacher> queryExcelUser(Long userId) {
// Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
// boolean containsy = userPermissions.contains("wai:user:listy");
// boolean containsd = userPermissions.contains("wai:user:listd");
// boolean containsl = userPermissions.contains("wai:user:listl");
// boolean containsz = userPermissions.contains("wai:user:listz");
// LambdaQueryWrapper<H5LocalTeacher> h5userQuery = new LambdaQueryWrapper<>();
// if (userPermissions.size()>30){
// return localTeacherMapper.selectList(null);
// }else if(containsy){
//// 查看语文学科人
// h5userQuery.eq(H5LocalTeacher::getMajorId,1);
// return localTeacherMapper.selectList(h5userQuery);
//// 地理学科
// }else if (containsd){
// h5userQuery.eq(H5LocalTeacher::getMajorId,4);
// return localTeacherMapper.selectList(h5userQuery);
//// 历史
// }else if (containsl){
//
// h5userQuery.eq(H5LocalTeacher::getMajorId,7);
// return localTeacherMapper.selectList(h5userQuery);
//// 政治
// }else if (containsz){
// h5userQuery.eq(H5LocalTeacher::getMajorId,8);
// return localTeacherMapper.selectList(h5userQuery);
// }
// return null;
// }
@Override @Override
public List<H5LocalTeacher> queryExcelUser(Long userId) { public List<H5LocalTeacher> queryExcelUser(Long userId, String myMajor) {
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId); Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
boolean containsy = userPermissions.contains("wai:user:listy"); boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd"); boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl"); boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz"); boolean containsz = userPermissions.contains("wai:user:listz");
LambdaQueryWrapper<H5LocalTeacher> h5userQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5LocalTeacher> h5userQuery = new LambdaQueryWrapper<>();
if (userPermissions.size()>30){ LambdaQueryWrapper<H5User> userWrapper = new LambdaQueryWrapper<>();
return localTeacherMapper.selectList(null); if (userPermissions.size() > 30) {
}else if(containsy){ userWrapper.eq(H5User::getIdentity, 9);
// 查看语文学科人 if (StringUtils.isNotBlank(myMajor)) {
h5userQuery.eq(H5LocalTeacher::getMajorId,1); userWrapper.eq(H5User::getMajorId, myMajor);
return localTeacherMapper.selectList(h5userQuery); }
// 地理学科 List<H5User> list = h5UserService.list(userWrapper);
}else if (containsd){ LambdaQueryWrapper<H5LocalTeacher> teacherWrapper = new LambdaQueryWrapper<>();
h5userQuery.eq(H5LocalTeacher::getMajorId,4); if (StringUtils.isNotBlank(myMajor)) {
return localTeacherMapper.selectList(h5userQuery); teacherWrapper.eq(H5LocalTeacher::getMajorId, myMajor);
// 历史 }
}else if (containsl){ List<H5LocalTeacher> teachers = localTeacherMapper.selectList(teacherWrapper);
// 使用HashSet来存储已经存在的localTeachers对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5LocalTeacher localTeacher : teachers) {
existingUserIds.add(localTeacher.getUserId());
}
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5LocalTeacher teacher = new H5LocalTeacher();
teacher.setUserId(item.getUserId());
teacher.setMajorId(item.getMajorId());
teacher.setUserMajorId(item.getUserMajorId());
teachers.add(teacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return teachers;
h5userQuery.eq(H5LocalTeacher::getMajorId,7); } else if (containsy) {
return localTeacherMapper.selectList(h5userQuery); //// 查看语文学科人
userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 1);
List<H5User> list = h5UserService.list(userWrapper);
h5userQuery.eq(H5LocalTeacher::getMajorId, 1);
List<H5LocalTeacher> localTeachers = localTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5LocalTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5LocalTeacher localTeacher : localTeachers) {
existingUserIds.add(localTeacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的localTeachers对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5LocalTeacher teacher = new H5LocalTeacher();
teacher.setUserId(item.getUserId());
teacher.setMajorId(item.getMajorId());
teacher.setUserMajorId(item.getUserMajorId());
localTeachers.add(teacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return localTeachers;
// 地理学科
} else if (containsd) {
LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 4);
List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5LocalTeacher::getMajorId, 4);
List<H5LocalTeacher> h5Teachers = localTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5LocalTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5LocalTeacher teacher : h5Teachers) {
existingUserIds.add(teacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5LocalTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5LocalTeacher teacher = new H5LocalTeacher();
teacher.setUserId(item.getUserId());
teacher.setMajorId(item.getMajorId());
teacher.setUserMajorId(item.getUserMajorId());
h5Teachers.add(teacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5Teachers;
// 历史
} else if (containsl) {
LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 7);
List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5LocalTeacher::getMajorId, 7);
List<H5LocalTeacher> h5teachers = localTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5LocalTeacher teacher : h5teachers) {
existingUserIds.add(teacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5LocalTeacher teacher = new H5LocalTeacher();
teacher.setUserId(item.getUserId());
teacher.setMajorId(item.getMajorId());
teacher.setUserMajorId(item.getUserMajorId());
h5teachers.add(teacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5teachers;
// 政治 // 政治
}else if (containsz){ } else if (containsz) {
h5userQuery.eq(H5LocalTeacher::getMajorId,8); LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 8);
return localTeacherMapper.selectList(h5userQuery); List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5LocalTeacher::getMajorId, 8);
List<H5LocalTeacher> teachers = localTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5LocalTeacher teacher : teachers) {
existingUserIds.add(teacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5LocalTeacher teacher = new H5LocalTeacher();
teacher.setUserId(item.getUserId());
teacher.setMajorId(item.getMajorId());
teacher.setUserMajorId(item.getUserMajorId());
teachers.add(teacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return teachers;
} }
return null; return null;
} }
} }

View File

@ -9,18 +9,17 @@ import com.github.niefy.common.utils.Query;
import com.github.niefy.modules.h5.entity.H5LocalTeacher; import com.github.niefy.modules.h5.entity.H5LocalTeacher;
import com.github.niefy.modules.h5.entity.H5Student; import com.github.niefy.modules.h5.entity.H5Student;
import com.github.niefy.modules.h5.entity.H5User; import com.github.niefy.modules.h5.entity.H5User;
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.service.H5StudentService; import com.github.niefy.modules.h5.service.H5StudentService;
import com.github.niefy.modules.h5.mapper.H5StudentMapper; import com.github.niefy.modules.h5.mapper.H5StudentMapper;
import com.github.niefy.modules.h5.service.H5UserService;
import com.github.niefy.modules.h5.util.H5Util; import com.github.niefy.modules.h5.util.H5Util;
import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl; import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* @author 27428 * @author 27428
@ -32,11 +31,13 @@ public class H5StudentServiceImpl extends ServiceImpl<H5StudentMapper, H5Student
implements H5StudentService{ implements H5StudentService{
private final ShiroServiceImpl shiroServiceImpl; private final ShiroServiceImpl shiroServiceImpl;
private final H5StudentMapper h5StudentMapper; private final H5StudentMapper h5StudentMapper;
private final H5UserService h5UserService;
@Autowired @Autowired
public H5StudentServiceImpl(H5StudentMapper h5StudentMapper,ShiroServiceImpl shiroServiceImpl) { public H5StudentServiceImpl(H5UserService h5UserService,H5StudentMapper h5StudentMapper,ShiroServiceImpl shiroServiceImpl) {
this.shiroServiceImpl = shiroServiceImpl; this.shiroServiceImpl = shiroServiceImpl;
this.h5StudentMapper = h5StudentMapper; this.h5StudentMapper = h5StudentMapper;
this.h5UserService = h5UserService;
} }
@ -113,6 +114,11 @@ public class H5StudentServiceImpl extends ServiceImpl<H5StudentMapper, H5Student
if (StringUtils.isNotBlank(userName)) { if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName); queryWrapper.like("user_name", userName);
} }
// 按学科分类
String major = (String) params.get("major");
if (major != null) {
queryWrapper.like("major_id", major);
}
// 字段映射 // 字段映射
String s = H5Util.mapSortField(sortField); String s = H5Util.mapSortField(sortField);
@ -140,41 +146,176 @@ public class H5StudentServiceImpl extends ServiceImpl<H5StudentMapper, H5Student
// @Override
// public List<H5Student> queryExcelUser(Long userId) {
// Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
// boolean containsy = userPermissions.contains("wai:user:listy");
// boolean containsd = userPermissions.contains("wai:user:listd");
// boolean containsl = userPermissions.contains("wai:user:listl");
// boolean containsz = userPermissions.contains("wai:user:listz");
// if (userPermissions.size()>30){
// return h5StudentMapper.selectList(null);
// }else if(containsy){
//// 查看语文学科人
// LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>();
// h5userQuery.eq(H5Student::getMajorId,1);
// return h5StudentMapper.selectList(h5userQuery);
//// 地理学科
// }else if (containsd){
// LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>();
// h5userQuery.eq(H5Student::getMajorId,4);
// return h5StudentMapper.selectList(h5userQuery);
//// 历史
// }else if (containsl){
// LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>();
// h5userQuery.eq(H5Student::getMajorId,7);
// return h5StudentMapper.selectList(h5userQuery);
//// 政治
// }else if (containsz){
// LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>();
// h5userQuery.eq(H5Student::getMajorId,8);
// return h5StudentMapper.selectList(h5userQuery);
// }
// return null;
// }
@Override @Override
public List<H5Student> queryExcelUser(Long userId) { public List<H5Student> queryExcelUser(Long userId, String myMajor) {
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId); Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
boolean containsy = userPermissions.contains("wai:user:listy"); boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd"); boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl"); boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz"); boolean containsz = userPermissions.contains("wai:user:listz");
if (userPermissions.size()>30){ LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>();
return h5StudentMapper.selectList(null); LambdaQueryWrapper<H5User> userWrapper = new LambdaQueryWrapper<>();
}else if(containsy){ if (userPermissions.size() > 30) {
// 查看语文学科人 userWrapper.eq(H5User::getIdentity, 9);
LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(myMajor)) {
h5userQuery.eq(H5Student::getMajorId,1); userWrapper.eq(H5User::getMajorId, myMajor);
return h5StudentMapper.selectList(h5userQuery); }
List<H5User> list = h5UserService.list(userWrapper);
LambdaQueryWrapper<H5Student> teacher = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(myMajor)) {
teacher.eq(H5Student::getMajorId, myMajor);
}
List<H5Student> students = h5StudentMapper.selectList(teacher);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5Student h5Student : students) {
existingUserIds.add(h5Student.getUserId());
}
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5Student h5Student = new H5Student();
h5Student.setUserId(item.getUserId());
h5Student.setMajorId(item.getMajorId());
h5Student.setUserMajorId(item.getUserMajorId());
students.add(h5Student);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return students;
} else if (containsy) {
//// 查看语文学科人
userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 1);
List<H5User> list = h5UserService.list(userWrapper);
h5userQuery.eq(H5Student::getMajorId, 1);
List<H5Student> students = h5StudentMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5Student student : students) {
existingUserIds.add(student.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5Student student = new H5Student();
student.setUserId(item.getUserId());
student.setMajorId(item.getMajorId());
student.setUserMajorId(item.getUserMajorId());
students.add(student);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return students;
// 地理学科 // 地理学科
}else if (containsd){ } else if (containsd) {
LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 4);
h5userQuery.eq(H5Student::getMajorId,4); List<H5User> list = h5UserService.list(eq);
return h5StudentMapper.selectList(h5userQuery); h5userQuery.eq(H5Student::getMajorId, 4);
List<H5Student> students = h5StudentMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5Student student : students) {
existingUserIds.add(student.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5Student student = new H5Student();
student.setUserId(item.getUserId());
student.setMajorId(item.getMajorId());
student.setUserMajorId(item.getUserMajorId());
students.add(student);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return students;
// 历史 // 历史
}else if (containsl){ } else if (containsl) {
LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 7);
h5userQuery.eq(H5Student::getMajorId,7); List<H5User> list = h5UserService.list(eq);
return h5StudentMapper.selectList(h5userQuery); h5userQuery.eq(H5Student::getMajorId, 7);
List<H5Student> students = h5StudentMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5Student student : students) {
existingUserIds.add(student.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5Student student = new H5Student();
student.setUserId(item.getUserId());
student.setMajorId(item.getMajorId());
student.setUserMajorId(item.getUserMajorId());
students.add(student);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return students;
// 政治 // 政治
}else if (containsz){ } else if (containsz) {
LambdaQueryWrapper<H5Student> h5userQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 8);
h5userQuery.eq(H5Student::getMajorId,8); List<H5User> list = h5UserService.list(eq);
return h5StudentMapper.selectList(h5userQuery); h5userQuery.eq(H5Student::getMajorId, 8);
List<H5Student> students = h5StudentMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5Student student : students) {
existingUserIds.add(student.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5Student student = new H5Student();
student.setUserId(item.getUserId());
student.setMajorId(item.getMajorId());
student.setUserMajorId(item.getUserMajorId());
students.add(student);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return students;
} }
return null; return null;
} }
} }

View File

@ -211,6 +211,25 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
if (checkAcc(h5User)) { if (checkAcc(h5User)) {
return R.error("微信已经和其他账号关联"); return R.error("微信已经和其他账号关联");
} }
// 如果已经存在该用户
LambdaQueryWrapper<H5WaiTeacher> h5WaiTeacherWrapper = new LambdaQueryWrapper<>();
h5WaiTeacherWrapper.eq(H5WaiTeacher::getUserId, h5User1.getUserId());
H5WaiTeacher h5WaiTeacher = h5WaiTeacherMapper.selectOne(h5WaiTeacherWrapper);
if (h5WaiTeacher != null) {
//设置openid
h5User1.setOpenId(h5User.getOpenId());
//直接更新h5User表
h5UserMapper.update(h5User1, h5UserQuery);
h5WaiTeacher.setOpenId(h5User.getOpenId());
h5WaiTeacherMapper.updateById(h5WaiTeacher);
// 说明已经填写过个人信息了直接放行到主页面
// 返回整个user
HashMap<String, Object> map = new HashMap<>();
map.put("user", h5WaiTeacher);
map.put("status", "2"); //填写过信息
map.put("router", "/mainPage");
return R.ok(map);
}
//设置openid //设置openid
h5User1.setOpenId(h5User.getOpenId()); h5User1.setOpenId(h5User.getOpenId());
//直接更新h5User表 //直接更新h5User表
@ -609,11 +628,14 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
// } // }
if (majorId == 0) { if (majorId == 0) {
QueryWrapper<H5User> queryWrapper = new QueryWrapper<>(); QueryWrapper<H5User> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(userName)) { if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName); queryWrapper.like("user_name", userName);
} }
// 按学科查询
String major = (String) params.get("major");
if (major != null) {
queryWrapper.like("major_id", major);
}
// 动态设置排序字段和排序顺序 // 动态设置排序字段和排序顺序
if (StringUtils.isNotBlank(sortField) && StringUtils.isNotBlank(sortOrder)) { if (StringUtils.isNotBlank(sortField) && StringUtils.isNotBlank(sortOrder)) {
String s = H5Util.mapSortField(sortField); String s = H5Util.mapSortField(sortField);
@ -755,8 +777,10 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
BeanUtils.copyProperties(h5User, h5UserDTO); BeanUtils.copyProperties(h5User, h5UserDTO);
if (h5User.getIdentity() == 9) { if (h5User.getIdentity() == 9) {
H5WaiTeacher h5WaiTeacher = h5WaiTeacherMapper.selectOne(new LambdaQueryWrapper<H5WaiTeacher>().eq(H5WaiTeacher::getUserId, h5User.getUserId())); H5WaiTeacher h5WaiTeacher = h5WaiTeacherMapper.selectOne(new LambdaQueryWrapper<H5WaiTeacher>().eq(H5WaiTeacher::getUserId, h5User.getUserId()));
h5UserDTO.setAge(h5WaiTeacher.getAge()); if (h5WaiTeacher!=null){
h5UserDTO.setSex(h5WaiTeacher.getSex()); h5UserDTO.setAge(h5WaiTeacher.getAge());
h5UserDTO.setSex(h5WaiTeacher.getSex());
}
h5UserDTOS.add(h5UserDTO); h5UserDTOS.add(h5UserDTO);
} else { } else {
h5UserDTOS.add(h5UserDTO); h5UserDTOS.add(h5UserDTO);

View File

@ -2,6 +2,7 @@ package com.github.niefy.modules.h5.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.niefy.common.utils.PageUtils; import com.github.niefy.common.utils.PageUtils;
@ -10,7 +11,9 @@ import com.github.niefy.modules.h5.entity.H5DormitoryInfo;
import com.github.niefy.modules.h5.entity.H5LocalTeacher; import com.github.niefy.modules.h5.entity.H5LocalTeacher;
import com.github.niefy.modules.h5.entity.H5User; import com.github.niefy.modules.h5.entity.H5User;
import com.github.niefy.modules.h5.entity.H5WaiTeacher; import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.service.H5DormitoryInfoService; import com.github.niefy.modules.h5.service.H5DormitoryInfoService;
import com.github.niefy.modules.h5.service.H5UserService;
import com.github.niefy.modules.h5.service.H5WaiTeacherService; import com.github.niefy.modules.h5.service.H5WaiTeacherService;
import com.github.niefy.modules.h5.mapper.H5WaiTeacherMapper; import com.github.niefy.modules.h5.mapper.H5WaiTeacherMapper;
import com.github.niefy.modules.h5.util.H5Util; import com.github.niefy.modules.h5.util.H5Util;
@ -47,12 +50,15 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
private final H5DormitoryInfoService h5DormitoryInfoService; private final H5DormitoryInfoService h5DormitoryInfoService;
private final H5WaiTeacherMapper h5WaiTeacherMapper; private final H5WaiTeacherMapper h5WaiTeacherMapper;
private final H5UserService h5UserService;
private final ShiroServiceImpl shiroServiceImpl; private final ShiroServiceImpl shiroServiceImpl;
@Autowired @Autowired
public H5WaiTeacherServiceImpl(ShiroServiceImpl shiroServiceImpl,H5DormitoryInfoService h5DormitoryInfoService, H5WaiTeacherMapper h5WaiTeacherMapper) { public H5WaiTeacherServiceImpl(H5UserService h5UserService, ShiroServiceImpl shiroServiceImpl, H5DormitoryInfoService h5DormitoryInfoService, H5WaiTeacherMapper h5WaiTeacherMapper) {
this.h5DormitoryInfoService = h5DormitoryInfoService; this.h5DormitoryInfoService = h5DormitoryInfoService;
this.h5WaiTeacherMapper = h5WaiTeacherMapper; this.h5WaiTeacherMapper = h5WaiTeacherMapper;
this.shiroServiceImpl = shiroServiceImpl; this.shiroServiceImpl = shiroServiceImpl;
this.h5UserService = h5UserService;
} }
@Override @Override
@ -63,26 +69,27 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
String sortOrder = (String) params.get("sort"); String sortOrder = (String) params.get("sort");
// 排序字段 // 排序字段
String sortField = (String) params.get("prop"); String sortField = (String) params.get("prop");
String arr = (String) params.get("arr");
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(PUserId); Set<String> userPermissions = shiroServiceImpl.getUserPermissions(PUserId);
boolean containsy = userPermissions.contains("wai:user:listy"); boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd"); boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl"); boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz"); boolean containsz = userPermissions.contains("wai:user:listz");
// 如果是管理源看到所有人 // 如果是管理源看到所有人
if (userPermissions.size()>30){ if (userPermissions.size() > 30) {
return queryPageUser(params, userName,0,sortOrder,sortField); return queryPageUser(params, userName, 0, sortOrder, sortField, arr);
}else if(containsy){ } else if (containsy) {
// 查看语文学科人 // 查看语文学科人
return queryPageUser(params, userName,1,sortOrder,sortField); return queryPageUser(params, userName, 1, sortOrder, sortField, arr);
// 地理学科 // 地理学科
}else if (containsd){ } else if (containsd) {
return queryPageUser(params, userName,4,sortOrder,sortField); return queryPageUser(params, userName, 4, sortOrder, sortField, arr);
// 历史 // 历史
}else if (containsl){ } else if (containsl) {
return queryPageUser(params, userName,7,sortOrder,sortField); return queryPageUser(params, userName, 7, sortOrder, sortField, arr);
// 政治 // 政治
}else if (containsz){ } else if (containsz) {
return queryPageUser(params, userName,8,sortOrder,sortField); return queryPageUser(params, userName, 8, sortOrder, sortField, arr);
} }
return null; return null;
} }
@ -100,83 +107,86 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
hwaiWrapper.eq(H5WaiTeacher::getDormitoryStatus, 1).eq(H5WaiTeacher::getDormitory, ""); hwaiWrapper.eq(H5WaiTeacher::getDormitoryStatus, 1).eq(H5WaiTeacher::getDormitory, "");
List<H5WaiTeacher> list = this.list(hwaiWrapper); List<H5WaiTeacher> list = this.list(hwaiWrapper);
// list.forEach(item -> { // list.forEach(item -> {
for(H5WaiTeacher item:list) { for (H5WaiTeacher item : list) {
item.setDormitory(""); item.setDormitory("");
if (item.getIdentityId().length() == 18) { if (item.getIdentityId().length() == 18) {
char genderDigit = item.getIdentityId().charAt(16); // 获取身份证号倒数第二位数字 char genderDigit = item.getIdentityId().charAt(16); // 获取身份证号倒数第二位数字
int gender = Character.getNumericValue(genderDigit); int gender = Character.getNumericValue(genderDigit);
if (gender % 2 == 0) { if (gender % 2 == 0) {
System.out.println("性别:女性"); System.out.println("性别:女性");
// 查询一个宿舍把宿舍 // 查询一个宿舍把宿舍
LambdaQueryWrapper<H5DormitoryInfo> Wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5DormitoryInfo> Wrapper = new LambdaQueryWrapper<>();
Wrapper.eq(H5DormitoryInfo::getDormitoryStatus, "0").eq(H5DormitoryInfo::getDormitoryType, "0"); Wrapper.eq(H5DormitoryInfo::getDormitoryStatus, "0").eq(H5DormitoryInfo::getDormitoryType, "0");
// H5DormitoryInfo dormitory = h5DormitoryInfoService.getOne(Wrapper); // H5DormitoryInfo dormitory = h5DormitoryInfoService.getOne(Wrapper);
List<H5DormitoryInfo> list1 = h5DormitoryInfoService.list(Wrapper); List<H5DormitoryInfo> list1 = h5DormitoryInfoService.list(Wrapper);
if (list1 != null || list1.size() > 0) { if (list1 != null || list1.size() > 0) {
H5DormitoryInfo dormitory = list1.get(0); H5DormitoryInfo dormitory = list1.get(0);
if (dormitory.getDormitoryNum() > 0) { if (dormitory.getDormitoryNum() > 0) {
dormitory.setDormitoryNum(dormitory.getDormitoryNum() - 1); dormitory.setDormitoryNum(dormitory.getDormitoryNum() - 1);
String dormitory1 = dormitory.getDormitory(); String dormitory1 = dormitory.getDormitory();
// 设置宿舍 // 设置宿舍
item.setDormitory(dormitory1); item.setDormitory(dormitory1);
h5DormitoryInfoService.updateById(dormitory); h5DormitoryInfoService.updateById(dormitory);
this.updateById(item); this.updateById(item);
} else if (dormitory.getDormitoryNum() == 0) { } else if (dormitory.getDormitoryNum() == 0) {
dormitory.setDormitoryStatus("1"); dormitory.setDormitoryStatus("1");
h5DormitoryInfoService.updateById(dormitory); h5DormitoryInfoService.updateById(dormitory);
}
}
} else {
System.out.println("性别:男性");
LambdaQueryWrapper<H5DormitoryInfo> Wrapper = new LambdaQueryWrapper<>();
Wrapper.eq(H5DormitoryInfo::getDormitoryStatus, "0").eq(H5DormitoryInfo::getDormitoryType, "1");
List<H5DormitoryInfo> list1 = h5DormitoryInfoService.list(Wrapper);
if (list1 != null || list1.size() > 0) {
H5DormitoryInfo dormitory = list1.get(0);
if (list1.get(0).getDormitoryNum() > 0) {
dormitory.setDormitoryNum(dormitory.getDormitoryNum() - 1);
String dormitory1 = dormitory.getDormitory();
// 设置宿舍
item.setDormitory(dormitory1);
h5DormitoryInfoService.updateById(dormitory);
this.updateById(item);
}
if (dormitory.getDormitoryNum() == 0) {
dormitory.setDormitoryStatus("1");
h5DormitoryInfoService.updateById(dormitory);
}
} }
} }
} else { } else {
System.out.println("身份证号长度不正确"); System.out.println("性别:男性");
LambdaQueryWrapper<H5DormitoryInfo> Wrapper = new LambdaQueryWrapper<>();
Wrapper.eq(H5DormitoryInfo::getDormitoryStatus, "0").eq(H5DormitoryInfo::getDormitoryType, "1");
List<H5DormitoryInfo> list1 = h5DormitoryInfoService.list(Wrapper);
if (list1 != null || list1.size() > 0) {
H5DormitoryInfo dormitory = list1.get(0);
if (list1.get(0).getDormitoryNum() > 0) {
dormitory.setDormitoryNum(dormitory.getDormitoryNum() - 1);
String dormitory1 = dormitory.getDormitory();
// 设置宿舍
item.setDormitory(dormitory1);
h5DormitoryInfoService.updateById(dormitory);
this.updateById(item);
}
if (dormitory.getDormitoryNum() == 0) {
dormitory.setDormitoryStatus("1");
h5DormitoryInfoService.updateById(dormitory);
}
}
} }
} else {
System.out.println("身份证号长度不正确");
} }
}
// }); // });
} }
// 统计人数
// 统计人数 public Map<String, Object> countingPeople() {
public Map<String,Object> countingPeople() {
List<H5WaiTeacher> list = this.list(); List<H5WaiTeacher> list = this.list();
long count = this.count(); long count = this.count();
Long nv = list.stream().filter(item -> item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 == 0).count(); Long nv = list.stream().filter(item -> item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 == 0).count();
Long nan = list.stream().filter(item -> item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 != 0).count(); Long nan = list.stream().filter(item -> item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 != 0).count();
// 住宿人数 // 住宿人数
Long zhu = list.stream().filter(item -> item.getDormitoryStatus() == 0).count(); Long zhu = list.stream().filter(item -> item.getDormitoryStatus() == 0).count();
// 住宿人里面的男人 // 住宿人里面的男人
Long zhuNan = list.stream().filter(item -> item.getDormitoryStatus() == 0 && item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 != 0).count(); Long zhuNan = list.stream().filter(item -> item.getDormitoryStatus() == 0 && item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 != 0).count();
Long Already = list.stream().filter(item -> item.getStatus() == 0).count();
Long DidntAlready = list.stream().filter(item -> item.getStatus() == 1).count();
Long zhuNv = list.stream().filter(item -> item.getDormitoryStatus() == 0 && item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 == 0).count(); Long zhuNv = list.stream().filter(item -> item.getDormitoryStatus() == 0 && item.getIdentityId().length() == 18 && item.getIdentityId().charAt(16) % 2 == 0).count();
// System.out.println("男:"+nan+"女:"+nv); // System.out.println("男:"+nan+"女:"+nv);
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("male",nan); map.put("male", nan);
map.put("female",nv); map.put("female", nv);
map.put("zhu",zhu); map.put("zhu", zhu);
map.put("zhuNan",zhuNan); map.put("zhuNan", zhuNan);
map.put("zhuNv",zhuNv); map.put("zhuNv", zhuNv);
map.put("count",count); map.put("Already", Already);
map.put("DidntAlready", DidntAlready);
map.put("count", count);
return map; return map;
} }
@ -186,8 +196,7 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
} }
// public PageUtils queryPageUser(Map<String, Object> params,String userName,Integer majorId, String sortOrder, String sortField) {
// public PageUtils queryPageUser(Map<String, Object> params,String userName,Integer majorId, String sortOrder, String sortField) {
// if (majorId==0){ // if (majorId==0){
// IPage<H5WaiTeacher> page = this.page( // IPage<H5WaiTeacher> page = this.page(
// new Query<H5WaiTeacher>().getPage(params), // new Query<H5WaiTeacher>().getPage(params),
@ -209,95 +218,311 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
// ); // );
// return new PageUtils(page); // return new PageUtils(page);
// } // }
public PageUtils queryPageUser(Map<String, Object> params, String userName, Integer majorId, String sortOrder, String sortField) { public PageUtils queryPageUser(Map<String, Object> params, String userName, Integer majorId, String sortOrder, String sortField, String arr) {
QueryWrapper<H5WaiTeacher> queryWrapper = new QueryWrapper<>(); QueryWrapper<H5WaiTeacher> queryWrapper = new QueryWrapper<>();
// 按照,来分隔
String[] list = arr.split(",");
// 添加条件查询
if (majorId != null && majorId == 0) {
if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName);
}
String major = (String) params.get("major");
if (major != null) {
queryWrapper.like("major_id", major);
}
} else {
queryWrapper.eq("major_id", majorId);
if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName);
}
}
// 判断数组list不等于null并且第一个元素非空串
if (list.length > 0 && list[0] != null && !list[0].equals("")) {
params.put("limit", "400");
}
// 添加条件查询 for (String s : list) {
if (majorId != null && majorId == 0) { queryWrapper.like("major_id", s);
if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName);
} }
} else { // 字段映射
queryWrapper.eq("major_id", majorId); String s = H5Util.mapSortField(sortField);
if (StringUtils.isNotBlank(userName)) {
queryWrapper.like("user_name", userName); // 动态设置排序字段和排序顺序
if (StringUtils.isNotBlank(s) && StringUtils.isNotBlank(sortOrder)) {
if ("ascending".equalsIgnoreCase(sortOrder)) {
queryWrapper.orderByAsc(s + " IS NULL", s);
} else if ("descending".equalsIgnoreCase(sortOrder)) {
queryWrapper.orderByDesc(s + " IS NULL", s);
}
} else {
// 默认排序方式
queryWrapper.orderByDesc("update_time");
} }
// 执行分页查询
IPage<H5WaiTeacher> page = this.page(
new Query<H5WaiTeacher>().getPage(params),
queryWrapper
);
return new PageUtils(page);
} }
// 字段映射
String s = H5Util.mapSortField(sortField);
// 动态设置排序字段和排序顺序
if (StringUtils.isNotBlank(s) && StringUtils.isNotBlank(sortOrder)) {
if ("ascending".equalsIgnoreCase(sortOrder)) {
queryWrapper.orderByAsc(s + " IS NULL", s);
} else if ("descending".equalsIgnoreCase(sortOrder)) {
queryWrapper.orderByDesc(s + " IS NULL", s);
}
} else {
// 默认排序方式
queryWrapper.orderByDesc("update_time");
}
// 执行分页查询
IPage<H5WaiTeacher> page = this.page(
new Query<H5WaiTeacher>().getPage(params),
queryWrapper
);
return new PageUtils(page);
}
@Override @Override
public List<H5WaiTeacher> queryExcelUser(Long userId) { public List<H5WaiTeacher> queryExcelUser(Long userId, String myMajor) {
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId); Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
boolean containsy = userPermissions.contains("wai:user:listy"); boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd"); boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl"); boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz"); boolean containsz = userPermissions.contains("wai:user:listz");
LambdaQueryWrapper<H5WaiTeacher> h5userQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5WaiTeacher> h5userQuery = new LambdaQueryWrapper<>();
if (userPermissions.size()>30){ LambdaQueryWrapper<H5User> userWrapper = new LambdaQueryWrapper<>();
return h5WaiTeacherMapper.selectList(null); if (userPermissions.size() > 30) {
}else if(containsy){ userWrapper.eq(H5User::getIdentity, 9);
// 查看语文学科人 if (StringUtils.isNotBlank(myMajor)) {
h5userQuery.eq(H5WaiTeacher::getMajorId,1); userWrapper.eq(H5User::getMajorId, myMajor);
return h5WaiTeacherMapper.selectList(h5userQuery); }
// 地理学科 List<H5User> list = h5UserService.list(userWrapper);
}else if (containsd){ LambdaQueryWrapper<H5WaiTeacher> waiteacher = new LambdaQueryWrapper<>();
h5userQuery.eq(H5WaiTeacher::getMajorId,4); if (StringUtils.isNotBlank(myMajor)) {
return h5WaiTeacherMapper.selectList(h5userQuery); waiteacher.eq(H5WaiTeacher::getMajorId, myMajor);
// 历史 }
}else if (containsl){ List<H5WaiTeacher> h5WaiTeachers = h5WaiTeacherMapper.selectList(waiteacher);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5WaiTeacher h5WaiTeacher : h5WaiTeachers) {
existingUserIds.add(h5WaiTeacher.getUserId());
}
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
h5WaiTeacher.setUserId(item.getUserId());
h5WaiTeacher.setMajorId(item.getMajorId());
h5WaiTeacher.setUserMajorId(item.getUserMajorId());
h5WaiTeachers.add(h5WaiTeacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5WaiTeachers;
h5userQuery.eq(H5WaiTeacher::getMajorId,7); } else if (containsy) {
return h5WaiTeacherMapper.selectList(h5userQuery); //// 查看语文学科人
userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 1);
List<H5User> list = h5UserService.list(userWrapper);
h5userQuery.eq(H5WaiTeacher::getMajorId, 1);
List<H5WaiTeacher> h5WaiTeachers = h5WaiTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5WaiTeacher h5WaiTeacher : h5WaiTeachers) {
existingUserIds.add(h5WaiTeacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
h5WaiTeacher.setUserId(item.getUserId());
h5WaiTeacher.setMajorId(item.getMajorId());
h5WaiTeacher.setUserMajorId(item.getUserMajorId());
h5WaiTeachers.add(h5WaiTeacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5WaiTeachers;
// 地理学科
} else if (containsd) {
LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 4);
List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5WaiTeacher::getMajorId, 4);
List<H5WaiTeacher> h5WaiTeachers = h5WaiTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5WaiTeacher h5WaiTeacher : h5WaiTeachers) {
existingUserIds.add(h5WaiTeacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
h5WaiTeacher.setUserId(item.getUserId());
h5WaiTeacher.setMajorId(item.getMajorId());
h5WaiTeacher.setUserMajorId(item.getUserMajorId());
h5WaiTeachers.add(h5WaiTeacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5WaiTeachers;
// 历史
} else if (containsl) {
LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 7);
List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5WaiTeacher::getMajorId, 7);
List<H5WaiTeacher> h5WaiTeachers = h5WaiTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5WaiTeacher h5WaiTeacher : h5WaiTeachers) {
existingUserIds.add(h5WaiTeacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
h5WaiTeacher.setUserId(item.getUserId());
h5WaiTeacher.setMajorId(item.getMajorId());
h5WaiTeacher.setUserMajorId(item.getUserMajorId());
h5WaiTeachers.add(h5WaiTeacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5WaiTeachers;
// 政治 // 政治
}else if (containsz){ } else if (containsz) {
h5userQuery.eq(H5WaiTeacher::getMajorId,8); LambdaQueryWrapper<H5User> eq = userWrapper.eq(H5User::getIdentity, 9).eq(H5User::getMajorId, 8);
return h5WaiTeacherMapper.selectList(h5userQuery); List<H5User> list = h5UserService.list(eq);
h5userQuery.eq(H5WaiTeacher::getMajorId, 8);
List<H5WaiTeacher> h5WaiTeachers = h5WaiTeacherMapper.selectList(h5userQuery);
// 使用HashSet来存储已经存在的H5WaiTeacher对象以提高查找效率
Set<String> existingUserIds = new HashSet<>();
for (H5WaiTeacher h5WaiTeacher : h5WaiTeachers) {
existingUserIds.add(h5WaiTeacher.getUserId());
}
// 遍历H5User列表并且只添加那些userId不在existingUserIds中的H5WaiTeacher对象
for (H5User item : list) {
if (!existingUserIds.contains(item.getUserId())) {
H5WaiTeacher h5WaiTeacher = new H5WaiTeacher();
h5WaiTeacher.setUserId(item.getUserId());
h5WaiTeacher.setMajorId(item.getMajorId());
h5WaiTeacher.setUserMajorId(item.getUserMajorId());
h5WaiTeachers.add(h5WaiTeacher);
existingUserIds.add(item.getUserId()); // 添加到HashSet中避免重复添加
}
}
return h5WaiTeachers;
} }
return null; return null;
} }
@Override @Override
public void getWoManList(Map<String, Object> params) { public void getWoManList(Map<String, Object> params) {
String dorName = (String)params.get("dorName"); String dorName = (String) params.get("dorName");
String userId = (String)params.get("userId"); String userId = (String) params.get("userId");
H5WaiTeacher waiUser = this.getById(userId); H5WaiTeacher waiUser = this.getById(userId);
LambdaQueryWrapper<H5DormitoryInfo> qrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5DormitoryInfo> qrapper = new LambdaQueryWrapper<>();
qrapper.eq(H5DormitoryInfo::getDormitory,dorName); qrapper.eq(H5DormitoryInfo::getDormitory, dorName);
H5DormitoryInfo one = h5DormitoryInfoService.getOne(qrapper); H5DormitoryInfo one = h5DormitoryInfoService.getOne(qrapper);
if (one.getDormitoryNum()>0){ if (one.getDormitoryNum() > 0) {
waiUser.setDormitory(one.getDormitory()); waiUser.setDormitory(one.getDormitory());
one.setDormitoryNum(one.getDormitoryNum()-1); one.setDormitoryNum(one.getDormitoryNum() - 1);
this.updateById(waiUser); this.updateById(waiUser);
h5DormitoryInfoService.updateById(one); h5DormitoryInfoService.updateById(one);
} }
if (one.getDormitoryNum()==0){ if (one.getDormitoryNum() == 0) {
one.setDormitoryStatus("1"); one.setDormitoryStatus("1");
h5DormitoryInfoService.updateById(one); h5DormitoryInfoService.updateById(one);
} }
} }
@Override
public Map<String, Long> queryCount(Long userId, Integer myMajor) {
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz");
HashMap<String, Long> map = new HashMap<>();
List<H5WaiTeacher> list = this.list();
Long Already = 0L;
Long DidntAlready = 0L;
if (userPermissions.size() > 30) {
if (myMajor != null&&!myMajor.equals(0)) {
Already = list.stream().filter(item -> item.getStatus() == 0 && item.getMajorId().equals(myMajor)).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1 && item.getMajorId().equals(myMajor)).count();
} else {
Already = list.stream().filter(item -> item.getStatus() == 0).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1).count();
}
map.put("already", Already);
map.put("didntAlready", DidntAlready);
return map;
}
if (containsy) {
Already = list.stream().filter(item -> item.getStatus() == 0&&item.getMajorId().equals(1)).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1&&item.getMajorId().equals(1)).count();
map.put("already", Already);
map.put("didntAlready", DidntAlready);
return map;
} else if (containsd) {
Already = list.stream().filter(item -> item.getStatus() == 0&&item.getMajorId().equals(4)).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1&&item.getMajorId().equals(4)).count();
map.put("already", Already);
map.put("didntAlready", DidntAlready);
return map;
} else if (containsl) {
Already = list.stream().filter(item -> item.getStatus() == 0&&item.getMajorId().equals(7)).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1&&item.getMajorId().equals(7)).count();
map.put("already", Already);
map.put("didntAlready", DidntAlready);
return map;
} else if (containsz) {
Already = list.stream().filter(item -> item.getStatus() == 0&&item.getMajorId().equals(8)).count();
DidntAlready = list.stream().filter(item -> item.getStatus() == 1&&item.getMajorId().equals(8)).count();
map.put("already", Already);
map.put("didntAlready", DidntAlready);
return map;
}
map.put("blank", 0L);
return map;
}
/**
* 保存外校老师信息
*
* @param user
* @return
*/
@Override
public boolean saveWaiTeacher(H5WaiTeacher user, Long userId) {
Set<String> userPermissions = shiroServiceImpl.getUserPermissions(userId);
boolean containsy = userPermissions.contains("wai:user:listy");
boolean containsd = userPermissions.contains("wai:user:listd");
boolean containsl = userPermissions.contains("wai:user:listl");
boolean containsz = userPermissions.contains("wai:user:listz");
if (user == null) {
return false;
}
LambdaQueryWrapper<H5User> userQueryWrapper = new LambdaQueryWrapper<>();
userQueryWrapper.eq(H5User::getUserMajorId, user.getUserMajorId());
H5User h5user = h5UserService.getOne(userQueryWrapper);
if (h5user == null) {
return false;
}
h5user.setUserName(user.getUserName());
h5UserService.updateById(h5user);
user.setUserMajorId(h5user.getUserMajorId());
user.setStatus(1);
if (userPermissions.size() > 30) {
return this.save(user);
}
if (containsy) {
user.setMajorId(1);
return this.save(user);
} else if (containsd) {
user.setMajorId(4);
return this.save(user);
} else if (containsl) {
user.setMajorId(7);
return this.save(user);
} else if (containsz) {
user.setMajorId(8);
return this.save(user);
}
return false;
}
} }

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}nav{padding:30px}nav a{font-weight:700;color:#2c3e50}nav a.router-link-exact-active{color:#42b983}.main-page[data-v-71a43f98]{height:100vh;width:100vw;background:url(/img/bj1.f55ea532.svg) no-repeat;background-size:100%}.main-page .hrbun[data-v-71a43f98]{height:44vh;width:100vw}.main-page .hrbun img[data-v-71a43f98]{padding-top:6vh;width:90%}.main-page .hsd[data-v-71a43f98]{width:100vw;height:12vh}.main-page .hsd img[data-v-71a43f98]{width:85%}.code[data-v-71a43f98]{width:90%;height:270px;margin:0 auto}.code .input-code[data-v-71a43f98]{text-align:center;font-size:35px;height:2.5rem;width:80%;opacity:1;color:rgba(237,75,54,.6);font-weight:600;border-radius:132px;background:#fff,#fff;border:4px solid rgba(237,75,54,.6);box-shadow:0 0 0 rgba(0,0,0,.1),0 3px 7px rgba(0,0,0,.1),0 12px 12px rgba(0,0,0,.09),0 27px 16px rgba(0,0,0,.05),0 47px 19px rgba(0,0,0,.01),0 74px 21px transparent}.code .text1[data-v-71a43f98]{width:90%}.code .sbm[data-v-71a43f98]{width:90%;margin-top:2vh;height:40px}.code .dl[data-v-71a43f98]{width:50%;margin-top:2vh}.footer[data-v-71a43f98]{width:100vw}.footer img[data-v-71a43f98]{padding-top:3vh;width:100%}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

View File

@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><link rel="icon" href="/favicon.ico"><title></title><script defer="defer" src="/js/chunk-vendors.7242451c.js"></script><script defer="defer" src="/js/app.10ee5c61.js"></script><link href="/css/chunk-vendors.67a2fae0.css" rel="stylesheet"><link href="/css/app.de459042.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> <!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><link rel="icon" href="/favicon.ico"><title></title><script defer="defer" src="/js/chunk-vendors.7242451c.js"></script><script defer="defer" src="/js/app.29c38722.js"></script><link href="/css/chunk-vendors.67a2fae0.css" rel="stylesheet"><link href="/css/app.1866639f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
.custom-header span{color:red}

View File

@ -1 +0,0 @@
.edit_dev[data-v-fc3f32bc] .el-transfer-panel{width:250px}

View File

@ -1 +0,0 @@
.demo-table-expand{font-size:0;margin-left:15px}.demo-table-expand label{width:90px;color:#99a9bf}.demo-table-expand .el-form-item{margin-right:0;margin-bottom:0;width:50%}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="never"><meta name="viewport" content="width=device-width,initial-scale=1"><title>评阅人员管理系统</title><script src="https://cdn.bootcdn.net/ajax/libs/tinymce/5.10.4/tinymce.min.js"></script><script defer="defer" type="module" src="js/chunk-vendors.2f7a65dc.js"></script><script defer="defer" type="module" src="js/app.9a4353c2.js"></script><link href="css/chunk-vendors.c90a9993.css" rel="stylesheet"><link href="css/app.e4089920.css" rel="stylesheet"><script defer="defer" src="js/chunk-vendors-legacy.b50b24da.js" nomodule></script><script defer="defer" src="js/app-legacy.2fac56cb.js" nomodule></script></head><body><noscript><strong>We're sorry but weixin-manage doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="never"><meta name="viewport" content="width=device-width,initial-scale=1"><title>评阅人员管理系统</title><script src="https://cdn.bootcdn.net/ajax/libs/tinymce/5.10.4/tinymce.min.js"></script><script defer="defer" type="module" src="js/chunk-vendors.2f7a65dc.js"></script><script defer="defer" type="module" src="js/app.4faf79fe.js"></script><link href="css/chunk-vendors.c90a9993.css" rel="stylesheet"><link href="css/app.62f85525.css" rel="stylesheet"><script defer="defer" src="js/chunk-vendors-legacy.b50b24da.js" nomodule></script><script defer="defer" src="js/app-legacy.eed768ca.js" nomodule></script></head><body><noscript><strong>We're sorry but weixin-manage doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long