后端更新

This commit is contained in:
abu 2024-05-15 18:13:19 +08:00
parent 1cc8bfdfcd
commit 6e81582150
22 changed files with 629 additions and 178 deletions

View File

@ -1,14 +1,63 @@
#设置镜像使用的基础镜像 ##设置镜像使用的基础镜像
FROM openjdk:8u322-jre-buster #FROM openjdk:8u322-jre-buster
# 作者 ## 作者
MAINTAINER niefy <niefy@qq.com> ## MAINTAINER niefy <niefy@qq.com>
#设置镜像暴露的端口 这里要与application.properties中的server.port保持一致 ##设置镜像暴露的端口 这里要与application.properties中的server.port保持一致
#EXPOSE 80
##设置容器的挂载卷
#VOLUME /tmp
##编译镜像时将springboot生成的jar文件复制到镜像中
#ADD target/wx-api.jar /wx-api.jar
##编译镜像时运行脚本
#RUN bash -c 'touch /wx-api.jar'
##容器的入口程序,这里注意如果要指定外部配置文件需要使用-spring.config.location指定配置文件存放目录
#ENTRYPOINT ["java","-jar","/wx-api.jar"]
#
# 选择构建用基础镜像。如需更换,请到[dockerhub官方仓库](https://hub.docker.com/_/java?tab=tags)自行选择后替换。
FROM maven:3.6.0-jdk-8-slim as build
# 指定构建过程中的工作目录
WORKDIR /app
# 将src目录下所有文件拷贝到工作目录中src目录下.gitignore/.dockerignore中文件除外
COPY src /app/src
# 将pom.xml文件拷贝到工作目录下
COPY settings.xml pom.xml /app/
# 执行代码编译命令
# 自定义settings.xml, 选用国内镜像源以提高下载速度
RUN mvn -s /app/settings.xml -f /app/pom.xml clean package
# 选择运行时基础镜像
FROM alpine:3.13
# 安装依赖包如需其他依赖包请到alpine依赖包管理(https://pkgs.alpinelinux.org/packages?name=php8*imagick*&branch=v3.13)查找。
# 选用国内镜像源以提高下载速度
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tencent.com/g' /etc/apk/repositories \
&& apk add --update --no-cache openjdk8-jre-base \
&& rm -f /var/cache/apk/*
# 容器默认时区为UTC如需使用上海时间请启用以下时区设置命令
# RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone
# 使用 HTTPS 协议访问容器云调用证书安装
RUN apk add ca-certificates
# 指定运行时的工作目录
WORKDIR /app
# 将构建产物jar包拷贝到运行时目录中
COPY --from=build /app/target/*.jar .
# 暴露端口
# 此处端口必须与「服务设置」-「流水线」以及「手动上传代码包」部署时填写的端口一致,否则会部署失败。
EXPOSE 80 EXPOSE 80
#设置容器的挂载卷
VOLUME /tmp # 执行启动命令.
#编译镜像时将springboot生成的jar文件复制到镜像中 # 写多行独立的CMD命令是错误写法只有最后一行CMD命令会被执行之前的都会被忽略导致业务报错。
ADD target/wx-api.jar /wx-api.jar # 请参考[Docker官方文档之CMD命令](https://docs.docker.com/engine/reference/builder/#cmd)
#编译镜像时运行脚本 CMD ["java", "-jar", "/app/springboot-wxcloudrun-1.0.jar"]
RUN bash -c 'touch /wx-api.jar'
#容器的入口程序,这里注意如果要指定外部配置文件需要使用-spring.config.location指定配置文件存放目录
ENTRYPOINT ["java","-jar","/wx-api.jar"]

View File

@ -52,6 +52,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter-aop</artifactId>
</dependency> </dependency>
<!-- 参数校验-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
@ -140,7 +141,6 @@
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>3.3.4</version> <version>3.3.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@ -39,7 +39,6 @@ import static com.qiniu.util.Etag.data;
@RequestMapping("/excel") @RequestMapping("/excel")
public class ExcelController extends AbstractController { public class ExcelController extends AbstractController {
private H5WaiTeacherService h5WaiTeacherService; private H5WaiTeacherService h5WaiTeacherService;
private H5DormitoryInfoService h5DormitoryInfoService; private H5DormitoryInfoService h5DormitoryInfoService;

View File

@ -0,0 +1,189 @@
package com.github.niefy.modules.h5.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.niefy.common.utils.PageUtils;
import com.github.niefy.common.utils.R;
import com.github.niefy.modules.h5.entity.H5Invitation;
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
import com.github.niefy.modules.h5.excel.EasyExcelWriterFactory;
import com.github.niefy.modules.h5.service.H5InvitationService;
import com.github.niefy.modules.h5.service.H5WaiTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/inv")
@Api(tags = {"评卷管理-邀请函管理"})
public class H5InvitationController {
private final H5InvitationService h5InvitationService;
private final H5WaiTeacherService h5WaiTeacherService;
@Autowired
public H5InvitationController(H5InvitationService h5InvitationService, H5WaiTeacherService h5WaiTeacherService) {
this.h5InvitationService = h5InvitationService;
this.h5WaiTeacherService = h5WaiTeacherService;
}
/**
* 获取外校老师的邀请函信息
* @return
*/
/**
* 历史
* @param params
* @return
*/
@GetMapping("/list")
@RequiresPermissions("inv:user:list")
@ApiOperation(value = "用户列表", notes = "")
public R list(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表
// if (getUserId() != Constant.SUPER_ADMIN) {
// params.put("createUserId", getUserId());
// }
PageUtils page = h5InvitationService.queryPage(params);
return R.ok().put("page", page);
}
@GetMapping("/listy")
@RequiresPermissions("inv:user:list")
@ApiOperation(value = "用户列表", notes = "")
public R listy(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表
// if (getUserId() != Constant.SUPER_ADMIN) {
// params.put("createUserId", getUserId());
// }
PageUtils page = h5InvitationService.queryPageY(params);
return R.ok().put("page", page);
}
@GetMapping("/listd")
@RequiresPermissions("inv:user:list")
@ApiOperation(value = "用户列表", notes = "")
public R listd(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表
// if (getUserId() != Constant.SUPER_ADMIN) {
// params.put("createUserId", getUserId());
// }
PageUtils page = h5InvitationService.queryPageD(params);
return R.ok().put("page", page);
}
@GetMapping("/listl")
@RequiresPermissions("inv:user:list")
@ApiOperation(value = "用户列表", notes = "")
public R listl(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表
// if (getUserId() != Constant.SUPER_ADMIN) {
// params.put("createUserId", getUserId());
// }
PageUtils page = h5InvitationService.queryPageL(params);
return R.ok().put("page", page);
}
@GetMapping("/listz")
@RequiresPermissions("inv:user:list")
@ApiOperation(value = "用户列表", notes = "")
public R listz(@RequestParam Map<String, Object> params) {
//只有超级管理员才能查看所有管理员列表
// if (getUserId() != Constant.SUPER_ADMIN) {
// params.put("createUserId", getUserId());
// }
PageUtils page = h5InvitationService.queryPageZ(params);
return R.ok().put("page", page);
}
// @GetMapping("/list")
// public R list(){
// return R.ok().put("data",h5InvitationService.queryInvitation());
// }
@GetMapping("/update")
// @RequiresPermissions("inv:user:update")
@ApiOperation(value = "用户列表", notes = "")
public R update(@RequestParam("id") String id,@RequestParam("workNameQr") String workNameQr) {
H5Invitation byId = h5InvitationService.getById(id);
byId.setWorkNameQr(workNameQr);
h5InvitationService.updateById(byId);
return R.ok().put("page",null);
}
// 下载Excel
// 下载Excel
// 下载Excel
@GetMapping("/download")
@RequiresPermissions("inv:user:list")
public void download(HttpServletResponse response) throws IOException {
List<H5WaiTeacher> list = h5WaiTeacherService.list();
download(response,list, "外校老师所有信息");
}
/**
* 语文
* @param response
* @throws IOException
*/
@GetMapping("/downloady")
@RequiresPermissions("inv:user:list")
public void downloadY(HttpServletResponse response) throws IOException {
List<H5WaiTeacher> list = h5WaiTeacherService.queryListY(1);
download(response, list, "外校老师语文");
}
/**
* 地理
* @param response
* @throws IOException
*/
@GetMapping("/downloadd")
@RequiresPermissions("inv:user:list")
public void downloadD(HttpServletResponse response) throws IOException {
List<H5WaiTeacher> list = h5WaiTeacherService.queryListY(4);
download(response, list,"外校老师地理");
}
/**
* 历史
* @param response
* @throws IOException
*/
@GetMapping("/downloadl")
@RequiresPermissions("inv:user:list")
public void downloadL(HttpServletResponse response) throws IOException {
List<H5WaiTeacher> list = h5WaiTeacherService.queryListY(7);
download(response,list, "外校老师历史");
}
@GetMapping("/downloadz")
@RequiresPermissions("inv:user:list")
public void downloadZ(HttpServletResponse response) throws IOException {
List<H5WaiTeacher> list = h5WaiTeacherService.queryListY(8);
download(response,list, "外校老师政治");
}
public void download(HttpServletResponse response, List<H5WaiTeacher> list, String fileName) throws IOException {
// List<H5WaiTeacher> list = h5WaiTeacherService.list();
// 设置响应
EasyExcelWriterFactory excelWriter = EasyExcelUtil.writeWithSheetsWeb(response, fileName);
// 将列表数据写入Excel
// 将数据写入Excel并指定模型类作为表头
excelWriter.writeModel(H5WaiTeacher.class, list, fileName).finish();
// 关闭写入器
excelWriter.finish();
}
}

View File

@ -12,6 +12,7 @@ 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.entity.H5WaiTeacher;
import com.github.niefy.modules.h5.service.H5InvitationService;
import com.github.niefy.modules.h5.service.H5StudentService; import com.github.niefy.modules.h5.service.H5StudentService;
import com.github.niefy.modules.h5.service.H5UserService; import com.github.niefy.modules.h5.service.H5UserService;
import com.github.niefy.modules.sys.controller.AbstractController; import com.github.niefy.modules.sys.controller.AbstractController;
@ -36,6 +37,7 @@ import java.util.Map;
public class H5StudentController extends AbstractController{ public class H5StudentController extends AbstractController{
private final H5StudentService studentService; private final H5StudentService studentService;
private final H5UserService h5UserService; private final H5UserService h5UserService;
@Autowired @Autowired
public H5StudentController(H5StudentService studentService, H5UserService h5UserService) { public H5StudentController(H5StudentService studentService, H5UserService h5UserService) {
this.studentService = studentService; this.studentService = studentService;

View File

@ -9,19 +9,24 @@ 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.*; import com.github.niefy.modules.h5.entity.*;
import com.github.niefy.modules.h5.entity.excel_entiry.H5UserExcelEntity;
import com.github.niefy.modules.h5.excel.DormitoryInfo;
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
import com.github.niefy.modules.h5.service.*; import com.github.niefy.modules.h5.service.*;
import com.github.niefy.modules.sys.controller.AbstractController; import com.github.niefy.modules.sys.controller.AbstractController;
import com.github.niefy.modules.sys.entity.SysUserEntity; import com.github.niefy.modules.sys.entity.SysUserEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
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.List;
import java.util.Map;
/** /**
* H5用户关的api * H5用户关的api
@ -40,13 +45,15 @@ public class H5UserController extends AbstractController {
private final H5StudentService h5StudentService; private final H5StudentService h5StudentService;
private final H5WaiTeacherService h5WaiTeacherService; private final H5WaiTeacherService h5WaiTeacherService;
private final H5AdminInfoService h5AdminInfoService; private final H5AdminInfoService h5AdminInfoService;
private final H5InvitationService h5InvitationService;
@Autowired @Autowired
public H5UserController(H5UserService h5UserService, H5LocalTeacherService h5LocalTeacherService, H5StudentService h5StudentService, H5WaiTeacherService h5WaiTeacherService,H5AdminInfoService h5AdminInfoService) { public H5UserController(H5UserService h5UserService, H5LocalTeacherService h5LocalTeacherService, H5StudentService h5StudentService, H5WaiTeacherService h5WaiTeacherService,H5AdminInfoService h5AdminInfoService,H5InvitationService h5InvitationService) {
this.h5UserService = h5UserService; this.h5UserService = h5UserService;
this.h5LocalTeacherService = h5LocalTeacherService; this.h5LocalTeacherService = h5LocalTeacherService;
this.h5StudentService = h5StudentService; this.h5StudentService = h5StudentService;
this.h5WaiTeacherService = h5WaiTeacherService; this.h5WaiTeacherService = h5WaiTeacherService;
this.h5AdminInfoService = h5AdminInfoService; this.h5AdminInfoService = h5AdminInfoService;
this.h5InvitationService = h5InvitationService;
} }
@ -230,7 +237,7 @@ public class H5UserController extends AbstractController {
/** /**
* 所有用户列表 *
*/ */
@GetMapping("/autoId") @GetMapping("/autoId")
// @RequiresPermissions("h5:user:list") // @RequiresPermissions("h5:user:list")
@ -241,5 +248,62 @@ public class H5UserController extends AbstractController {
return R.ok().put("success"); return R.ok().put("success");
} }
/**
* 分组获取用户信息接口
* @param groupId
* @return
*/
@GetMapping("/qall")
@ApiOperation(value = "查询用户分组列表", notes = "")
public R queryUserAllUser(@RequestParam Integer groupId) {
//只有超级管理员才能查看所有管理员列表
// List<H5User> groupUser = h5UserService.getGroupUser(1);
List<H5User> all = h5UserService.queryUserAllUser();
List<H5User> groupUser = h5UserService.getGroupUser(groupId);
Map<String, Object> map = new HashMap<>();
map.put("all", all);
map.put("groupUser", groupUser);
return R.ok(map);
}
/**
* 数据管理文件上传
* @param file
* @return
* @throws IOException
*/
@PostMapping("/upload")
@ResponseBody
// @RequiresPermissions("h5:user:list")
public String upload(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
List<H5UserExcelEntity> list = EasyExcelUtil.syncReadModel(inputStream, H5UserExcelEntity.class, 0, 1);
List<H5User> h5List = new ArrayList<>();
for (H5UserExcelEntity map : list) {
H5User h5User = new H5User();
h5User.setUpdateTime(LocalDateTime.now());
BeanUtils.copyProperties(map, h5User);
h5List.add(h5User);
// System.out.println(h5DormitoryInfo);
}
h5UserService.saveBatch(h5List);
List<H5Invitation> h5Invitations = new ArrayList<>();
for (H5User h5User : h5List) {
if (h5User.getIdentity()==9){
H5Invitation h5Invitation = new H5Invitation();
h5Invitation.setUserId(h5User.getUserId());
h5Invitation.setGroupId(h5User.getGroupId());
h5Invitation.setMajorId(h5User.getMajorId());
h5Invitation.setUserMajorId(h5User.getUserMajorId());
h5Invitation.setUserMajorId(h5User.getUserMajorId());
h5Invitations.add(h5Invitation);
}
}
h5InvitationService.saveBatch(h5Invitations);
h5Invitations.clear();
return "success";
}
} }

View File

@ -1,6 +1,7 @@
package com.github.niefy.modules.h5.controller; package com.github.niefy.modules.h5.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.niefy.common.annotation.SysLog; import com.github.niefy.common.annotation.SysLog;
import com.github.niefy.common.utils.Constant; import com.github.niefy.common.utils.Constant;
import com.github.niefy.common.utils.PageUtils; import com.github.niefy.common.utils.PageUtils;
@ -8,9 +9,11 @@ import com.github.niefy.common.utils.R;
import com.github.niefy.common.validator.ValidatorUtils; 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.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.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;
@ -38,11 +41,13 @@ 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;
@Autowired @Autowired
public H5WaiTeacherController(H5WaiTeacherService h5WaiTeacherService, H5UserService h5UserService) { public H5WaiTeacherController(H5WaiTeacherService h5WaiTeacherService, H5UserService h5UserService,H5InvitationService h5InvitationService) {
this.h5WaiTeacherService = h5WaiTeacherService; this.h5WaiTeacherService = h5WaiTeacherService;
this.h5UserService = h5UserService; this.h5UserService = h5UserService;
this.h5InvitationService = h5InvitationService;
} }
@RequestMapping("/save") @RequestMapping("/save")
@ -56,6 +61,10 @@ public class H5WaiTeacherController extends AbstractController{
oneUser.setUserName(waiTeacher.getUserName()); oneUser.setUserName(waiTeacher.getUserName());
h5WaiTeacherService.save(waiTeacher); h5WaiTeacherService.save(waiTeacher);
h5UserService.updateById(oneUser); h5UserService.updateById(oneUser);
LambdaUpdateWrapper<H5Invitation> qw = new LambdaUpdateWrapper<>();
qw.eq(H5Invitation::getUserId, oneUser.getUserId());
qw.set(H5Invitation::getWorkName,waiTeacher.getWorkName());
h5InvitationService.update(qw);
map.put("user", waiTeacher); map.put("user", waiTeacher);
map.put("router", "/mainPage"); map.put("router", "/mainPage");
return R.ok(map); return R.ok(map);

View File

@ -25,25 +25,7 @@ public class H5Group implements Serializable {
*/ */
private String name; private String name;
/**
*
*/
private String userName;
/**
*
*/
private String userId;
private String userMajorId;
private Integer parentId;
/**
*
*/
private Integer identity;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* *

View File

@ -1,5 +1,7 @@
package com.github.niefy.modules.h5.entity; package com.github.niefy.modules.h5.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -15,61 +17,71 @@ import lombok.Data;
*/ */
@TableName(value ="h5_wai_teacher") @TableName(value ="h5_wai_teacher")
@Data @Data
@ExcelIgnoreUnannotated
public class H5WaiTeacher implements Serializable { public class H5WaiTeacher implements Serializable {
/** /**
* 主键 * 主键
*/ */
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Integer id;
/** /**
* openid * openid
*/ */
// 不需要导出这个字段
private String openId; private String openId;
/** /**
* 用户id * 用户id
*/ */
@ExcelProperty(value = "身份码", index = 0)
private String userId; private String userId;
/** /**
* 名称 * 名称
*/ */
@ExcelProperty(value = "姓名", index = 1)
private String userName; private String userName;
/** /**
* 手机号 * 手机号
*/ */
@ExcelProperty(value = "手机号", index = 2)
private String phone; private String phone;
/** /**
* 职称 * 职称
*/ */
@ExcelProperty(value = "职称", index = 3)
private String jobTitle; private String jobTitle;
/** /**
* 银行卡号 * 银行卡号
*/ */
@ExcelProperty(value = "银行卡", index = 4)
private String pyCard; private String pyCard;
/** /**
* 办公位 * 办公位
*/ */
@ExcelProperty(value = "职位", index = 5)
private String office; private String office;
/** /**
* 工作名称 * 工作名称
*/ */
@ExcelProperty(value = "工作单位", index = 6)
private String workName; private String workName;
/** /**
* 固定电话 * 固定电话
*/ */
@ExcelProperty(value = "固定电话", index = 7)
private String workPhone; private String workPhone;
/** /**
* 身份证 * 身份证
*/ */
@ExcelProperty(value = "身份证", index = 8)
private String identityId; private String identityId;
/** /**
@ -80,25 +92,29 @@ public class H5WaiTeacher implements Serializable {
/** /**
* 宿舍 * 宿舍
*/ */
@ExcelProperty(value = "宿舍", index = 9)
private String dormitory; private String dormitory;
/** /**
* 车牌号 * 车牌号
*/ */
@ExcelProperty(value = "车牌号", index = 10)
private String carNumber; private String carNumber;
/** /**
* 是否住宿 * 是否住宿
*/ */
private int dormitoryStatus; private int dormitoryStatus;
/** /**
* 开户所在地 * 开户所在地
*/ */
@ExcelProperty(value = "开户所在地", index = 11)
private String bankAddress; private String bankAddress;
/** /**
* 开户行 * 开户行
*/ */
@ExcelProperty(value = "开户行", index = 12)
private String bankName; private String bankName;
/** /**
@ -119,6 +135,7 @@ public class H5WaiTeacher implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelProperty(value = "时间", index = 13)
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**

View File

@ -0,0 +1,47 @@
package com.github.niefy.modules.h5.entity.excel_entiry;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class H5UserExcelEntity {
/**
* 用户id
*/
private String userId;
/**
* 用户专业id
*/
private String userMajorId;
/**
* 组id
*/
private Integer groupId;
/**
* 身份管理员2 学生3老师 6 外校老师9
*/
private Integer identity;
/**
* 专业id,0表示未选择
*/
private Integer majorId;
/**
* 状态0正常 1禁用
*/
private Integer status;
}

View File

@ -39,6 +39,8 @@ public class EasyExcelWriterFactory {
return this; return this;
} }
/** /**
* 链式自定义表头写入 * 链式自定义表头写入
* @param head * @param head

View File

@ -4,6 +4,8 @@ import com.github.niefy.modules.h5.entity.H5User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* @author 27428 * @author 27428
* @description 针对表h5_user的数据库操作Mapper * @description 针对表h5_user的数据库操作Mapper
@ -13,6 +15,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface H5UserMapper extends BaseMapper<H5User> { public interface H5UserMapper extends BaseMapper<H5User> {
List<H5User> queryUserAllUser();
List<H5User> getGroupUser(Integer groupId);
} }

View File

@ -3,6 +3,9 @@ package com.github.niefy.modules.h5.mapper;
import com.github.niefy.modules.h5.entity.H5WaiTeacher; import com.github.niefy.modules.h5.entity.H5WaiTeacher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* @author 27428 * @author 27428
@ -13,6 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface H5WaiTeacherMapper extends BaseMapper<H5WaiTeacher> { public interface H5WaiTeacherMapper extends BaseMapper<H5WaiTeacher> {
@Select("select * from h5_wai_teacher where user_id in (select user_id from h5_invitation where major_id = ${id})")
public List<H5WaiTeacher> queryListY(Integer id);
} }

View File

@ -6,6 +6,7 @@ import com.github.niefy.modules.h5.entity.H5User;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.github.niefy.modules.sys.entity.SysUserEntity; import com.github.niefy.modules.sys.entity.SysUserEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -22,4 +23,8 @@ public interface H5UserService extends IService<H5User> {
void createAccount(Integer groupType, Integer num,Integer majorId); void createAccount(Integer groupType, Integer num,Integer majorId);
// public void saveUser(H5User user); // public void saveUser(H5User user);
List<H5User> queryUserAllUser();
List<H5User> getGroupUser(Integer groupId);
} }

View File

@ -5,6 +5,7 @@ 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 org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -21,5 +22,7 @@ public interface H5WaiTeacherService extends IService<H5WaiTeacher> {
void startTask(); void startTask();
Map<String,Object> countingPeople(); Map<String,Object> countingPeople();
List<H5WaiTeacher> queryListY(Integer id);
// void createTask(MultipartFile file); // void createTask(MultipartFile file);
} }

View File

@ -26,11 +26,11 @@ public class H5GroupServiceImpl extends ServiceImpl<H5GroupMapper, H5Group>
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<H5Group> page = this.page( IPage<H5Group> page = this.page(
new Query<H5Group>().getPage(params), new Query<H5Group>().getPage(params)
new QueryWrapper<H5Group>() // new QueryWrapper<H5Group>()
// 查询parent_id不等于0的所有记录 // 查询parent_id不等于0的所有记录
// .ne("parent_id", 0) // .ne("parent_id", 0)
.eq("parent_id", 0) // .eq("parent_id", 0)
// .like(StringUtils.isNotBlank(userId), "user_id", userId) // .like(StringUtils.isNotBlank(userId), "user_id", userId)
// 按时间降序排序 // 按时间降序排序

View File

@ -9,6 +9,7 @@ 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.*; import com.github.niefy.modules.h5.entity.*;
import com.github.niefy.modules.h5.mapper.*; import com.github.niefy.modules.h5.mapper.*;
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 org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -33,16 +34,18 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
private final H5LocalTeacherMapper h5LocalTeacherMapper; private final H5LocalTeacherMapper h5LocalTeacherMapper;
private final H5WaiTeacherMapper h5WaiTeacherMapper; private final H5WaiTeacherMapper h5WaiTeacherMapper;
private final H5AdminInfoMapper h5AdminInfoMapper; private final H5AdminInfoMapper h5AdminInfoMapper;
private final H5InvitationService h5InvitationService;
// private final CounterService counterService; // private final CounterService counterService;
// private final RedisTemplate<String, Object> redisTemplate; // private final RedisTemplate<String, Object> redisTemplate;
@Autowired @Autowired
public H5UserServiceImpl(H5UserMapper h5UserMapper, H5StudentMapper h5StudentMapper, H5LocalTeacherMapper h5LocalTeacherMapper, H5WaiTeacherMapper h5WaiTeacherMapper, H5AdminInfoMapper h5AdminInfoMapper) { public H5UserServiceImpl(H5UserMapper h5UserMapper, H5StudentMapper h5StudentMapper, H5LocalTeacherMapper h5LocalTeacherMapper, H5WaiTeacherMapper h5WaiTeacherMapper, H5AdminInfoMapper h5AdminInfoMapper,H5InvitationService h5InvitationService) {
this.h5UserMapper = h5UserMapper; this.h5UserMapper = h5UserMapper;
this.h5StudentMapper = h5StudentMapper; this.h5StudentMapper = h5StudentMapper;
this.h5LocalTeacherMapper = h5LocalTeacherMapper; this.h5LocalTeacherMapper = h5LocalTeacherMapper;
this.h5WaiTeacherMapper = h5WaiTeacherMapper; this.h5WaiTeacherMapper = h5WaiTeacherMapper;
this.h5AdminInfoMapper = h5AdminInfoMapper; this.h5AdminInfoMapper = h5AdminInfoMapper;
this.h5InvitationService = h5InvitationService;
// this.counterService = counterService; // this.counterService = counterService;
// this.redisTemplate = redisTemplate; // this.redisTemplate = redisTemplate;
} }
@ -79,6 +82,13 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
LambdaQueryWrapper<H5AdminInfo> H5AdminInfoWreapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<H5AdminInfo> H5AdminInfoWreapper = new LambdaQueryWrapper<>();
H5AdminInfoWreapper.eq(H5AdminInfo::getUserId, h5User1.getUserId()); H5AdminInfoWreapper.eq(H5AdminInfo::getUserId, h5User1.getUserId());
H5AdminInfo h5AdminInfo = h5AdminInfoMapper.selectOne(H5AdminInfoWreapper); H5AdminInfo h5AdminInfo = h5AdminInfoMapper.selectOne(H5AdminInfoWreapper);
if ("".equals(h5User1.getOpenId())) {
h5User1.setOpenId(h5User.getOpenId());
h5UserMapper.updateById(h5User1);
} else {
return R.error("微信已经和其他账号关联");
}
if (h5AdminInfo != null) { if (h5AdminInfo != null) {
// 返回整个user // 返回整个user
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
@ -278,7 +288,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
map.put("router", "/leaderShip"); map.put("router", "/leaderShip");
return R.ok(map); return R.ok(map);
} else { } else {
return R.error("管理员账号还未申请通过!"); return R.ok().put("router", "myIndex");
} }
//学生2 //学生2
case 3: case 3:
@ -288,17 +298,16 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
stuWrapper.eq(H5Student::getUserId, userId); stuWrapper.eq(H5Student::getUserId, userId);
H5Student h5Student = h5StudentMapper.selectOne(stuWrapper); H5Student h5Student = h5StudentMapper.selectOne(stuWrapper);
if (h5Student != null && h5Student.getOpenId().equals(openid)) { if (h5Student != null && h5Student.getOpenId().equals(openid)) {
// 说明已经填写过个人信息了直接放行到主页面
// 返回整个user
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("user", h5Student); map.put("user", h5Student);
map.put("major", user.getMajorId());
map.put("status", "2"); //填写过信息 map.put("status", "2"); //填写过信息
map.put("router", "/mainPage"); map.put("router", "/mainPage");
return R.ok(map); return R.ok(map);
} else { } else {
return R.ok().put("router", "myIndex"); return R.ok().put("router", "myIndex");
} }
// 直接跳到信息填写的页面
//老师3 //老师3
case 6: case 6:
@ -311,9 +320,12 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
// 返回整个user // 返回整个user
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("user", h5LocalTeacher); map.put("user", h5LocalTeacher);
map.put("major", user.getMajorId());
map.put("status", "2"); //填写过信息 map.put("status", "2"); //填写过信息
map.put("router", "/mainPage"); map.put("router", "/mainPage");
return R.ok(map); return R.ok(map);
} else {
return R.ok().put("router", "myIndex");
} }
@ -328,9 +340,13 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
// 返回整个user // 返回整个user
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("user", h5WaiTeacher); map.put("user", h5WaiTeacher);
// map.put("baseUser", user);
map.put("major", user.getMajorId());
map.put("status", "2"); //填写过信息 map.put("status", "2"); //填写过信息
map.put("router", "/mainPage"); map.put("router", "/mainPage");
return R.ok(map); return R.ok(map);
} else {
return R.ok().put("router", "myIndex");
} }
} }
return R.error("未知错误"); return R.error("未知错误");
@ -448,6 +464,23 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
break; break;
} }
this.saveBatch(h5Users); this.saveBatch(h5Users);
// 如果外小老师则添加到邀请函表中
if (groupType == 9) {
List<H5Invitation> h5Invitations = new ArrayList<>();
h5Users.forEach((item) -> {
H5Invitation h5Invitation = new H5Invitation();
h5Invitation.setUserId(item.getUserId());
h5Invitation.setGroupId(item.getGroupId());
h5Invitation.setUserMajorId(item.getUserMajorId());
h5Invitation.setUserMajorId(item.getUserMajorId());
h5Invitation.setMajorId(item.getMajorId());
h5Invitations.add(h5Invitation);
});
h5InvitationService.saveBatch(h5Invitations);
h5Invitations.clear();
}
h5Users.clear(); h5Users.clear();
set.clear(); set.clear();
userMIDList.clear(); userMIDList.clear();
@ -489,15 +522,33 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
} }
// 编写一个辅助函数功能随机自动生成八位数字 // 编写一个辅助函数功能随机自动生成八位数字
// public static String getRandomNum(int length) {
////功能随机自动生成八位数字
// StringBuilder sb = new StringBuilder();
// for (int i = 0; i < length; i++) {
// sb.append((int) (Math.random() * 10));
// }
// return sb.toString();
// }
public static String getRandomNum(int length) { public static String getRandomNum(int length) {
//功能随机自动生成八位数字
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) { sb.append((int) (Math.random() * 9) + 1); // 第一位不能为0
for (int i = 1; i < length; i++) {
sb.append((int) (Math.random() * 10)); sb.append((int) (Math.random() * 10));
} }
return sb.toString(); return sb.toString();
} }
@Override
public List<H5User> queryUserAllUser() {
return h5UserMapper.queryUserAllUser();
}
@Override
public List<H5User> getGroupUser(Integer groupId) {
return h5UserMapper.getGroupUser(groupId);
}
} }

View File

@ -41,8 +41,14 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
// //
// @Value("${exel.path}") // @Value("${exel.path}")
// private String basePath; // private String basePath;
private final H5DormitoryInfoService h5DormitoryInfoService;
private final H5WaiTeacherMapper h5WaiTeacherMapper;
@Autowired @Autowired
private H5DormitoryInfoService h5DormitoryInfoService; public H5WaiTeacherServiceImpl(H5DormitoryInfoService h5DormitoryInfoService, H5WaiTeacherMapper h5WaiTeacherMapper) {
this.h5DormitoryInfoService = h5DormitoryInfoService;
this.h5WaiTeacherMapper = h5WaiTeacherMapper;
}
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
@ -155,6 +161,11 @@ public class H5WaiTeacherServiceImpl extends ServiceImpl<H5WaiTeacherMapper, H5W
return map; return map;
} }
@Override
public List<H5WaiTeacher> queryListY(Integer id) {
return h5WaiTeacherMapper.queryListY(id);
}
} }

View File

@ -64,6 +64,7 @@ public class SysMenuEntity implements Serializable {
*/ */
private Integer orderNum; private Integer orderNum;
/** /**
* ztree属性 * ztree属性
*/ */

View File

@ -14,8 +14,8 @@ debug: false
spring: spring:
profiles: profiles:
# active: ${PROFILE_ACTIVE:dev} #此处由maven的环境选择决定参考https://www.jianshu.com/p/b7c75b0c364c active: ${PROFILE_ACTIVE:dev} #此处由maven的环境选择决定参考https://www.jianshu.com/p/b7c75b0c364c
active: ${PROFILE_ACTIVE:prod} #此处由maven的环境选择决定参考https://www.jianshu.com/p/b7c75b0c364c # active: ${PROFILE_ACTIVE :prod} #此处由maven的环境选择决定参考https://www.jianshu.com/p/b7c75b0c364c
# jackson时间格式化 # jackson时间格式化
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
@ -82,11 +82,11 @@ logging:
chanjar: debug chanjar: debug
#公众号配置 #公众号配置
mywx: mywx:
# appid: wxb37a727764fc080b appid: wxb37a727764fc080b
appid: wx2b5899dac09216d4 # appid: wx2b5899dac09216d4
# h5回调url # h5回调url
h5url: http://wx-api-101281-5-1320792097.sh.run.tcloudbase.com # h5url: http://wx-api-101281-5-1320792097.sh.run.tcloudbase.com
# h5url: http://154.8.196.128:9999 h5url: http://154.8.196.128:9999
# h5url: http://154.8.196.128 # h5url: http://154.8.196.128
#exel: #exel:

View File

@ -23,4 +23,12 @@
major_id,status,create_time, major_id,status,create_time,
update_time update_time
</sql> </sql>
<!-- 获取用户列表-->
<select id="queryUserAllUser" resultType="com.github.niefy.modules.h5.entity.H5User">
select id,user_id,user_name,major_id,group_id,identity from h5_user
</select>
<select id="getGroupUser" resultType="com.github.niefy.modules.h5.entity.H5User">
select id,user_id,user_name,major_id,group_id,identity from h5_user where group_id = #{groupId}
</select>
</mapper> </mapper>