commit:权限模块新增分配详情功能

This commit is contained in:
Jerry
2020-11-21 11:35:22 +08:00
parent fcce270119
commit ab470fa0d3
55 changed files with 607 additions and 870 deletions

View File

@@ -1,7 +1,6 @@
target/
/target/
!.mvn/wrapper/maven-wrapper.jar
/.mvn/*
/zzlogs/*
### STS ###
.apt_generated
@@ -19,9 +18,9 @@ target/
*.ipr
### NetBeans ###
nbproject/private/
nbbuild/
dist/
nbdist/
.nb-gradle/
src/main/java/com/formmaker/.DS_Store
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

View File

@@ -1,7 +1,5 @@
### 服务接口文档
---
- Knife4j
- 服务启动后Knife4j的文档入口地址 [http://localhost:8082/doc.html#/plus](http://localhost:8082/doc.html#/plus)
- Postman
- 无需启动服务即可将当前工程的接口导出成Postman格式。在工程的common/common-tools/模块下找到ExportApiApp文件并执行main函数。

View File

@@ -30,11 +30,6 @@
<artifactId>application-common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.orange.demo</groupId>
<artifactId>common-swagger</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>

View File

@@ -1,6 +1,5 @@
package com.orange.demo.app.controller;
import io.swagger.annotations.Api;
import cn.jimmyshi.beanquery.BeanQuery;
import com.orange.demo.app.model.AreaCode;
import com.orange.demo.app.service.AreaCodeService;
@@ -20,7 +19,6 @@ import java.util.*;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "行政区划数据访问接口")
@RestController
@RequestMapping("/admin/app/areaCode")
public class AreaCodeController {
@@ -33,8 +31,8 @@ public class AreaCodeController {
*
* @return 字典形式的行政区划列表。
*/
@GetMapping("/listDictAreaCode")
public ResponseResult<List<Map<String, Object>>> listDictAreaCode() {
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict() {
List<AreaCode> resultList = areaCodeService.getAllList();
return ResponseResult.success(BeanQuery.select(
"parentId as parentId", "areaId as id", "areaName as name").executeFrom(resultList));
@@ -46,8 +44,8 @@ public class AreaCodeController {
* @param parentId 上级行政区划Id。
* @return 按照字典的形式返回下级行政区划列表。
*/
@GetMapping("/listDictAreaCodeByParentId")
public ResponseResult<List<Map<String, Object>>> listDictAreaCodeByParentId(@RequestParam(required = false) Long parentId) {
@GetMapping("/listDictByParentId")
public ResponseResult<List<Map<String, Object>>> listDictByParentId(@RequestParam(required = false) Long parentId) {
Collection<AreaCode> resultList = areaCodeService.getListByParentId(parentId);
if (CollectionUtils.isEmpty(resultList)) {
return ResponseResult.success(new LinkedList<>());

View File

@@ -16,8 +16,6 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.cache.SessionCacheHelper;
import com.orange.demo.config.ApplicationConfig;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -33,7 +31,6 @@ import javax.validation.groups.Default;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "课程数据管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/course")
@@ -54,25 +51,17 @@ public class CourseController {
* @param course 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {
"course.courseId",
"course.priceStart",
"course.priceEnd",
"course.classHourStart",
"course.classHourEnd",
"course.createTimeStart",
"course.createTimeEnd"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody Course course) {
String errorMessage = MyCommonUtil.getModelValidationError(course);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
CallResult callResult = courseService.verifyRelatedData(course, null);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
course = courseService.saveNew(course);
return ResponseResult.success(course.getCourseId());
@@ -84,23 +73,16 @@ public class CourseController {
* @param course 更新对象。
* @return 应答结果对象。
*/
@ApiOperationSupport(ignoreParameters = {
"course.priceStart",
"course.priceEnd",
"course.classHourStart",
"course.classHourEnd",
"course.createTimeStart",
"course.createTimeEnd"})
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody Course course) {
String errorMessage = MyCommonUtil.getModelValidationError(course, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
Course originalCourse = courseService.getById(course.getCourseId());
if (originalCourse == null) {
//NOTE: 修改下面方括号中的话述
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
@@ -108,7 +90,7 @@ public class CourseController {
CallResult callResult = courseService.verifyRelatedData(course, originalCourse);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!courseService.update(course, originalCourse)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -281,8 +263,8 @@ public class CourseController {
* @param filter 过滤对象。
* @return 应答结果对象,包含的数据为 List<Map<String, String>>map中包含两条记录key的值分别是id和namevalue对应具体数据。
*/
@GetMapping("/listDictCourse")
public ResponseResult<List<Map<String, Object>>> listDictCourse(Course filter) {
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict(Course filter) {
List<Course> resultList = courseService.getListByFilter(filter, null);
return ResponseResult.success(BeanQuery.select(
"courseId as id", "courseName as name").executeFrom(resultList));

View File

@@ -7,7 +7,6 @@ import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -20,7 +19,6 @@ import java.util.*;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "课程统计管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/courseTransStats")
@@ -62,7 +60,7 @@ public class CourseTransStatsController {
@PostMapping("/listWithGroup")
public ResponseResult<MyPageData<CourseTransStats>> listWithGroup(
@MyRequestBody CourseTransStats courseTransStatsFilter,
@MyRequestBody MyGroupParam groupParam,
@MyRequestBody(required = true) MyGroupParam groupParam,
@MyRequestBody MyOrderParam orderParam,
@MyRequestBody MyPageParam pageParam) {
String orderBy = MyOrderParam.buildOrderBy(orderParam, CourseTransStats.class);

View File

@@ -8,8 +8,6 @@ import com.orange.demo.common.core.object.ResponseResult;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -24,7 +22,6 @@ import java.util.*;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "年级管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/grade")
@@ -39,12 +36,11 @@ public class GradeController {
* @param grade 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {"grade.gradeId"})
@PostMapping("/add")
public ResponseResult<Integer> add(@MyRequestBody Grade grade) {
String errorMessage = MyCommonUtil.getModelValidationError(grade);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
grade = gradeService.saveNew(grade);
return ResponseResult.success(grade.getGradeId());
@@ -60,7 +56,7 @@ public class GradeController {
public ResponseResult<Void> update(@MyRequestBody Grade grade) {
String errorMessage = MyCommonUtil.getModelValidationError(grade, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
Grade originalGrade = gradeService.getById(grade.getGradeId());
if (originalGrade == null) {
@@ -95,8 +91,8 @@ public class GradeController {
*
* @return 应答结果对象,包含字典形式的数据集合。
*/
@GetMapping("/listDictGrade")
public ResponseResult<List<Map<String, Object>>> listDictGrade() {
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict() {
List<Grade> resultList = gradeService.getAllList();
return ResponseResult.success(BeanQuery.select(
"gradeId as id", "gradeName as name").executeFrom(resultList));

View File

@@ -9,8 +9,6 @@ import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -24,7 +22,6 @@ import javax.validation.groups.Default;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "校区数据管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/schoolInfo")
@@ -39,18 +36,17 @@ public class SchoolInfoController {
* @param schoolInfo 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {"schoolInfo.userId"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody SchoolInfo schoolInfo) {
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, null);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
schoolInfo = schoolInfoService.saveNew(schoolInfo);
return ResponseResult.success(schoolInfo.getSchoolId());
@@ -66,12 +62,12 @@ public class SchoolInfoController {
public ResponseResult<Void> update(@MyRequestBody SchoolInfo schoolInfo) {
String errorMessage = MyCommonUtil.getModelValidationError(schoolInfo, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
SchoolInfo originalSchoolInfo = schoolInfoService.getById(schoolInfo.getSchoolId());
if (originalSchoolInfo == null) {
//NOTE: 修改下面方括号中的话述
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
@@ -79,7 +75,7 @@ public class SchoolInfoController {
CallResult callResult = schoolInfoService.verifyRelatedData(schoolInfo, originalSchoolInfo);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!schoolInfoService.update(schoolInfo, originalSchoolInfo)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -159,8 +155,8 @@ public class SchoolInfoController {
* @param filter 过滤对象。
* @return 应答结果对象,包含的数据为 List<Map<String, String>>map中包含两条记录key的值分别是id和namevalue对应具体数据。
*/
@GetMapping("/listDictSchoolInfo")
public ResponseResult<List<Map<String, Object>>> listDictSchoolInfo(SchoolInfo filter) {
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict(SchoolInfo filter) {
List<SchoolInfo> resultList = schoolInfoService.getListByFilter(filter, null);
return ResponseResult.success(BeanQuery.select(
"schoolId as id", "schoolName as name").executeFrom(resultList));

View File

@@ -7,7 +7,6 @@ import com.orange.demo.common.core.object.*;
import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -20,7 +19,6 @@ import java.util.*;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "学生行为统计管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/studentActionStats")
@@ -62,7 +60,7 @@ public class StudentActionStatsController {
@PostMapping("/listWithGroup")
public ResponseResult<MyPageData<StudentActionStats>> listWithGroup(
@MyRequestBody StudentActionStats studentActionStatsFilter,
@MyRequestBody MyGroupParam groupParam,
@MyRequestBody(required = true) MyGroupParam groupParam,
@MyRequestBody MyOrderParam orderParam,
@MyRequestBody MyPageParam pageParam) {
String orderBy = MyOrderParam.buildOrderBy(orderParam, StudentActionStats.class);

View File

@@ -8,8 +8,6 @@ import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -23,7 +21,6 @@ import javax.validation.groups.Default;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "学生行为流水管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/studentActionTrans")
@@ -38,21 +35,17 @@ public class StudentActionTransController {
* @param studentActionTrans 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {
"studentActionTrans.transId",
"studentActionTrans.createTimeStart",
"studentActionTrans.createTimeEnd"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody StudentActionTrans studentActionTrans) {
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, null);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
studentActionTrans = studentActionTransService.saveNew(studentActionTrans);
return ResponseResult.success(studentActionTrans.getTransId());
@@ -64,19 +57,16 @@ public class StudentActionTransController {
* @param studentActionTrans 更新对象。
* @return 应答结果对象。
*/
@ApiOperationSupport(ignoreParameters = {
"studentActionTrans.createTimeStart",
"studentActionTrans.createTimeEnd"})
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody StudentActionTrans studentActionTrans) {
String errorMessage = MyCommonUtil.getModelValidationError(studentActionTrans, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
StudentActionTrans originalStudentActionTrans = studentActionTransService.getById(studentActionTrans.getTransId());
if (originalStudentActionTrans == null) {
//NOTE: 修改下面方括号中的话述
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
@@ -84,7 +74,7 @@ public class StudentActionTransController {
CallResult callResult = studentActionTransService.verifyRelatedData(studentActionTrans, originalStudentActionTrans);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!studentActionTransService.update(studentActionTrans, originalStudentActionTrans)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);

View File

@@ -8,8 +8,6 @@ import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -24,7 +22,6 @@ import java.util.stream.Collectors;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "班级数据管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/studentClass")
@@ -43,18 +40,17 @@ public class StudentClassController {
* @param studentClass 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {"studentClass.userId"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody StudentClass studentClass) {
String errorMessage = MyCommonUtil.getModelValidationError(studentClass);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
CallResult callResult = studentClassService.verifyRelatedData(studentClass, null);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
studentClass = studentClassService.saveNew(studentClass);
return ResponseResult.success(studentClass.getClassId());
@@ -70,12 +66,12 @@ public class StudentClassController {
public ResponseResult<Void> update(@MyRequestBody StudentClass studentClass) {
String errorMessage = MyCommonUtil.getModelValidationError(studentClass, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
StudentClass originalStudentClass = studentClassService.getById(studentClass.getClassId());
if (originalStudentClass == null) {
//NOTE: 修改下面方括号中的话述
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
@@ -83,7 +79,7 @@ public class StudentClassController {
CallResult callResult = studentClassService.verifyRelatedData(studentClass, originalStudentClass);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!studentClassService.update(studentClass, originalStudentClass)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -239,7 +235,7 @@ public class StudentClassController {
for (ClassCourse classCourse : classCourseList) {
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
}
Set<Long> courseIdSet =
@@ -262,7 +258,7 @@ public class StudentClassController {
public ResponseResult<Void> updateClassCourse(@MyRequestBody ClassCourse classCourse) {
String errorMessage = MyCommonUtil.getModelValidationError(classCourse);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!studentClassService.updateClassCourse(classCourse)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -392,7 +388,7 @@ public class StudentClassController {
for (ClassStudent classStudent : classStudentList) {
String errorMessage = MyCommonUtil.getModelValidationError(classStudent);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
}
Set<Long> studentIdSet =

View File

@@ -9,8 +9,6 @@ import com.orange.demo.common.core.util.*;
import com.orange.demo.common.core.constant.*;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -24,7 +22,6 @@ import javax.validation.groups.Default;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "学生数据管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/app/student")
@@ -39,24 +36,17 @@ public class StudentController {
* @param student 新增对象。
* @return 应答结果对象包含新增对象主键Id。
*/
@ApiOperationSupport(ignoreParameters = {
"student.studentId",
"student.searchString",
"student.birthdayStart",
"student.birthdayEnd",
"student.registerTimeStart",
"student.registerTimeEnd"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody Student student) {
String errorMessage = MyCommonUtil.getModelValidationError(student);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
CallResult callResult = studentService.verifyRelatedData(student, null);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
student = studentService.saveNew(student);
return ResponseResult.success(student.getStudentId());
@@ -68,22 +58,16 @@ public class StudentController {
* @param student 更新对象。
* @return 应答结果对象。
*/
@ApiOperationSupport(ignoreParameters = {
"student.searchString",
"student.birthdayStart",
"student.birthdayEnd",
"student.registerTimeStart",
"student.registerTimeEnd"})
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody Student student) {
String errorMessage = MyCommonUtil.getModelValidationError(student, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
// 验证关联Id的数据合法性
Student originalStudent = studentService.getById(student.getStudentId());
if (originalStudent == null) {
//NOTE: 修改下面方括号中的话述
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
@@ -91,7 +75,7 @@ public class StudentController {
CallResult callResult = studentService.verifyRelatedData(student, originalStudent);
if (!callResult.isSuccess()) {
errorMessage = callResult.getErrorMessage();
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
if (!studentService.update(student, originalStudent)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
@@ -171,8 +155,8 @@ public class StudentController {
* @param filter 过滤对象。
* @return 应答结果对象,包含的数据为 List<Map<String, String>>map中包含两条记录key的值分别是id和namevalue对应具体数据。
*/
@GetMapping("/listDictStudent")
public ResponseResult<List<Map<String, Object>>> listDictStudent(Student filter) {
@GetMapping("/listDict")
public ResponseResult<List<Map<String, Object>>> listDict(Student filter) {
List<Student> resultList = studentService.getListByFilter(filter, null);
return ResponseResult.success(BeanQuery.select(
"studentId as id", "studentName as name").executeFrom(resultList));

View File

@@ -1,7 +1,5 @@
package com.orange.demo.app.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
@@ -12,7 +10,6 @@ import javax.persistence.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("行政区划实体对象")
@Data
@Table(name = "zz_area_code")
public class AreaCode {
@@ -20,7 +17,6 @@ public class AreaCode {
/**
* 行政区划主键Id
*/
@ApiModelProperty(value = "行政区划主键Id", required = true)
@Id
@Column(name = "area_id")
private Long areaId;
@@ -28,21 +24,18 @@ public class AreaCode {
/**
* 行政区划名称
*/
@ApiModelProperty(value = "行政区划名称")
@Column(name = "area_name")
private String areaName;
/**
* 行政区划级别 (1: 省级别 2: 市级别 3: 区级别)
*/
@ApiModelProperty(value = "行政区划级别")
@Column(name = "area_level")
private Integer areaLevel;
/**
* 父级行政区划Id
*/
@ApiModelProperty(value = "父级行政区划Id")
@Column(name = "parent_id")
private Long parentId;
}

View File

@@ -1,8 +1,6 @@
package com.orange.demo.app.model;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("ClassCourse实体对象")
@Data
@Table(name = "zz_class_course")
public class ClassCourse {
@@ -21,7 +18,6 @@ public class ClassCourse {
/**
* 班级Id。
*/
@ApiModelProperty(value = "班级Id", required = true)
@NotNull(message = "数据验证失败班级Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "class_id")
@@ -30,7 +26,6 @@ public class ClassCourse {
/**
* 课程Id。
*/
@ApiModelProperty(value = "课程Id", required = true)
@NotNull(message = "数据验证失败课程Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "course_id")
@@ -39,7 +34,6 @@ public class ClassCourse {
/**
* 课程顺序(数值越小越靠前)。
*/
@ApiModelProperty(value = "课程顺序(数值越小越靠前)", required = true)
@NotNull(message = "数据验证失败,课程顺序(数值越小越靠前)不能为空!", groups = {UpdateGroup.class})
@Column(name = "course_order")
private Integer courseOrder;

View File

@@ -1,8 +1,6 @@
package com.orange.demo.app.model;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("ClassStudent实体对象")
@Data
@Table(name = "zz_class_student")
public class ClassStudent {
@@ -21,7 +18,6 @@ public class ClassStudent {
/**
* 班级Id。
*/
@ApiModelProperty(value = "班级Id", required = true)
@NotNull(message = "数据验证失败班级Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "class_id")
@@ -30,7 +26,6 @@ public class ClassStudent {
/**
* 学生Id。
*/
@ApiModelProperty(value = "学生Id", required = true)
@NotNull(message = "数据验证失败学生Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "student_id")

View File

@@ -8,8 +8,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.annotation.RelationConstDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -24,7 +22,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("Course实体对象")
@Data
@Table(name = "zz_course")
public class Course {
@@ -32,7 +29,6 @@ public class Course {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "course_id")
@@ -41,7 +37,6 @@ public class Course {
/**
* 课程名称。
*/
@ApiModelProperty(value = "课程名称", required = true)
@NotBlank(message = "数据验证失败,课程名称不能为空!")
@Column(name = "course_name")
private String courseName;
@@ -49,20 +44,17 @@ public class Course {
/**
* 课程价格。
*/
@ApiModelProperty(value = "课程价格", required = true)
@NotNull(message = "数据验证失败,课程价格不能为空!")
private BigDecimal price;
/**
* 课程描述。
*/
@ApiModelProperty(value = "课程描述")
private String description;
/**
* 课程难度(0: 容易 1: 普通 2: 很难)。
*/
@ApiModelProperty(value = "课程难度(0: 容易 1: 普通 2: 很难)", required = true)
@NotNull(message = "数据验证失败,课程难度不能为空!")
@ConstDictRef(constDictClass = CourseDifficult.class, message = "数据验证失败,课程难度为无效值!")
private Integer difficulty;
@@ -70,7 +62,6 @@ public class Course {
/**
* 年级Id。
*/
@ApiModelProperty(value = "年级Id", required = true)
@NotNull(message = "数据验证失败,所属年级不能为空!")
@Column(name = "grade_id")
private Integer gradeId;
@@ -78,7 +69,6 @@ public class Course {
/**
* 学科Id。
*/
@ApiModelProperty(value = "学科Id", required = true)
@NotNull(message = "数据验证失败,所属学科不能为空!")
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属学科为无效值!")
@Column(name = "subject_id")
@@ -87,7 +77,6 @@ public class Course {
/**
* 课时数量。
*/
@ApiModelProperty(value = "课时数量", required = true)
@NotNull(message = "数据验证失败,课时数量不能为空!")
@Column(name = "class_hour")
private Integer classHour;
@@ -95,7 +84,6 @@ public class Course {
/**
* 多张课程图片地址。
*/
@ApiModelProperty(value = "多张课程图片地址", required = true)
@UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
@NotBlank(message = "数据验证失败,课程图片不能为空!")
@Column(name = "picture_url")
@@ -104,74 +92,63 @@ public class Course {
/**
* 创建用户Id。
*/
@ApiModelProperty(value = "创建用户Id")
@Column(name = "create_user_id")
private Long createUserId;
/**
* 创建时间。
*/
@ApiModelProperty(value = "创建时间")
@Column(name = "create_time")
private Date createTime;
/**
* 最后修改时间。
*/
@ApiModelProperty(value = "最后修改时间")
@Column(name = "update_time")
private Date updateTime;
/**
* price 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "price 范围过滤起始值(>=)")
@Transient
private BigDecimal priceStart;
/**
* price 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "price 范围过滤结束值(<=)")
@Transient
private BigDecimal priceEnd;
/**
* classHour 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "classHour 范围过滤起始值(>=)")
@Transient
private Integer classHourStart;
/**
* classHour 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "classHour 范围过滤结束值(<=)")
@Transient
private Integer classHourEnd;
/**
* createTime 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
@Transient
private String createTimeStart;
/**
* createTime 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
@Transient
private String createTimeEnd;
/**
* courseId 的多对多关联表数据对象。
*/
@ApiModelProperty(hidden = true)
@Transient
private ClassCourse classCourse;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "gradeId",
slaveServiceName = "gradeService",
@@ -181,14 +158,12 @@ public class Course {
@Transient
private Map<String, Object> gradeIdDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "difficulty",
constantDictClass = CourseDifficult.class)
@Transient
private Map<String, Object> difficultyDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "subjectId",
constantDictClass = Subject.class)

View File

@@ -5,8 +5,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.annotation.RelationConstDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -20,7 +18,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("CourseTransStats实体对象")
@Data
@Table(name = "zz_course_trans_stats")
public class CourseTransStats {
@@ -28,7 +25,6 @@ public class CourseTransStats {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -38,7 +34,6 @@ public class CourseTransStats {
/**
* 统计日期。
*/
@ApiModelProperty(value = "统计日期", required = true)
@NotNull(message = "数据验证失败,统计日期不能为空!")
@Column(name = "stats_date")
private Date statsDate;
@@ -46,7 +41,6 @@ public class CourseTransStats {
/**
* 科目Id。
*/
@ApiModelProperty(value = "科目Id", required = true)
@NotNull(message = "数据验证失败,所属科目不能为空!")
@ConstDictRef(constDictClass = Subject.class, message = "数据验证失败,所属科目为无效值!")
@Column(name = "subject_id")
@@ -55,7 +49,6 @@ public class CourseTransStats {
/**
* 年级Id。
*/
@ApiModelProperty(value = "年级Id", required = true)
@NotNull(message = "数据验证失败,所属年级不能为空!")
@Column(name = "grade_id")
private Integer gradeId;
@@ -63,14 +56,12 @@ public class CourseTransStats {
/**
* 年级名称。
*/
@ApiModelProperty(value = "年级名称")
@Column(name = "grade_name")
private String gradeName;
/**
* 课程Id。
*/
@ApiModelProperty(value = "课程Id", required = true)
@NotNull(message = "数据验证失败课程Id不能为空")
@Column(name = "course_id")
private Long courseId;
@@ -78,14 +69,12 @@ public class CourseTransStats {
/**
* 课程名称。
*/
@ApiModelProperty(value = "课程名称")
@Column(name = "course_name")
private String courseName;
/**
* 学生上课次数。
*/
@ApiModelProperty(value = "学生上课次数", required = true)
@NotNull(message = "数据验证失败,上课次数不能为空!")
@Column(name = "student_attend_count")
private Integer studentAttendCount;
@@ -93,7 +82,6 @@ public class CourseTransStats {
/**
* 学生献花数量。
*/
@ApiModelProperty(value = "学生献花数量", required = true)
@NotNull(message = "数据验证失败,献花数量不能为空!")
@Column(name = "student_flower_amount")
private Integer studentFlowerAmount;
@@ -101,7 +89,6 @@ public class CourseTransStats {
/**
* 学生献花次数。
*/
@ApiModelProperty(value = "学生献花次数", required = true)
@NotNull(message = "数据验证失败,献花次数不能为空!")
@Column(name = "student_flower_count")
private Integer studentFlowerCount;
@@ -109,18 +96,15 @@ public class CourseTransStats {
/**
* statsDate 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
@Transient
private String statsDateStart;
/**
* statsDate 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
@Transient
private String statsDateEnd;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "gradeId",
slaveServiceName = "gradeService",
@@ -130,7 +114,6 @@ public class CourseTransStats {
@Transient
private Map<String, Object> gradeIdDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "subjectId",
constantDictClass = Subject.class)

View File

@@ -3,8 +3,6 @@ package com.orange.demo.app.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -15,7 +13,6 @@ import javax.validation.constraints.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("Grade实体对象")
@Data
@Table(name = "zz_grade")
public class Grade {
@@ -23,7 +20,6 @@ public class Grade {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -33,7 +29,6 @@ public class Grade {
/**
* 年级名称。
*/
@ApiModelProperty(value = "年级名称", required = true)
@NotBlank(message = "数据验证失败,年级名称不能为空!")
@Column(name = "grade_name")
private String gradeName;
@@ -41,7 +36,6 @@ public class Grade {
/**
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
*/
@ApiModelProperty(hidden = true)
@JSONField(serialize = false)
@DeletedFlagColumn
private Integer status;

View File

@@ -1,8 +1,6 @@
package com.orange.demo.app.model;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -13,7 +11,6 @@ import javax.validation.constraints.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("MaterialEdition实体对象")
@Data
@Table(name = "zz_material_edition")
public class MaterialEdition {
@@ -21,7 +18,6 @@ public class MaterialEdition {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -31,7 +27,6 @@ public class MaterialEdition {
/**
* 教材版本名称。
*/
@ApiModelProperty(value = "教材版本名称", required = true)
@NotBlank(message = "数据验证失败,教材版本名称不能为空!")
@Column(name = "edition_name")
private String editionName;
@@ -39,7 +34,6 @@ public class MaterialEdition {
/**
* 是否正在使用0不是1
*/
@ApiModelProperty(value = "是否正在使用0不是1", required = true)
@NotNull(message = "数据验证失败是否正在使用0不是1不能为空")
private Integer status;
}

View File

@@ -2,8 +2,6 @@ package com.orange.demo.app.model;
import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -16,7 +14,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("SchoolInfo实体对象")
@Data
@Table(name = "zz_school_info")
public class SchoolInfo {
@@ -24,7 +21,6 @@ public class SchoolInfo {
/**
* 学校Id。
*/
@ApiModelProperty(value = "学校Id", required = true)
@NotNull(message = "数据验证失败学校Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "school_id")
@@ -33,7 +29,6 @@ public class SchoolInfo {
/**
* 学校名称。
*/
@ApiModelProperty(value = "学校名称", required = true)
@NotBlank(message = "数据验证失败,学校名称不能为空!")
@Column(name = "school_name")
private String schoolName;
@@ -41,7 +36,6 @@ public class SchoolInfo {
/**
* 所在省Id。
*/
@ApiModelProperty(value = "所在省Id", required = true)
@NotNull(message = "数据验证失败,所在省份不能为空!")
@Column(name = "province_id")
private Long provinceId;
@@ -49,12 +43,10 @@ public class SchoolInfo {
/**
* 所在城市Id。
*/
@ApiModelProperty(value = "所在城市Id", required = true)
@NotNull(message = "数据验证失败,所在城市不能为空!")
@Column(name = "city_id")
private Long cityId;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "provinceId",
slaveServiceName = "areaCodeService",
@@ -64,7 +56,6 @@ public class SchoolInfo {
@Transient
private Map<String, Object> provinceIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "cityId",
slaveServiceName = "areaCodeService",

View File

@@ -7,8 +7,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.annotation.RelationConstDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -22,7 +20,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("Student实体对象")
@Data
@Table(name = "zz_student")
public class Student {
@@ -30,7 +27,6 @@ public class Student {
/**
* 学生Id。
*/
@ApiModelProperty(value = "学生Id", required = true)
@NotNull(message = "数据验证失败学生Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "student_id")
@@ -39,7 +35,6 @@ public class Student {
/**
* 登录手机。
*/
@ApiModelProperty(value = "登录手机", required = true)
@NotBlank(message = "数据验证失败,手机号码不能为空!")
@Column(name = "login_mobile")
private String loginMobile;
@@ -47,7 +42,6 @@ public class Student {
/**
* 学生姓名。
*/
@ApiModelProperty(value = "学生姓名", required = true)
@NotBlank(message = "数据验证失败,学生姓名不能为空!")
@Column(name = "student_name")
private String studentName;
@@ -55,7 +49,6 @@ public class Student {
/**
* 所在省份Id。
*/
@ApiModelProperty(value = "所在省份Id", required = true)
@NotNull(message = "数据验证失败,所在省份不能为空!")
@Column(name = "province_id")
private Long provinceId;
@@ -63,7 +56,6 @@ public class Student {
/**
* 所在城市Id。
*/
@ApiModelProperty(value = "所在城市Id", required = true)
@NotNull(message = "数据验证失败,所在城市不能为空!")
@Column(name = "city_id")
private Long cityId;
@@ -71,7 +63,6 @@ public class Student {
/**
* 区县Id。
*/
@ApiModelProperty(value = "区县Id", required = true)
@NotNull(message = "数据验证失败,所在区县不能为空!")
@Column(name = "district_id")
private Long districtId;
@@ -79,7 +70,6 @@ public class Student {
/**
* 学生性别 (0: 女生 1: 男生)。
*/
@ApiModelProperty(value = "学生性别 (0: 女生 1: 男生)", required = true)
@NotNull(message = "数据验证失败,学生性别不能为空!")
@ConstDictRef(constDictClass = Gender.class, message = "数据验证失败,学生性别为无效值!")
private Integer gender;
@@ -87,14 +77,12 @@ public class Student {
/**
* 生日。
*/
@ApiModelProperty(value = "生日", required = true)
@NotNull(message = "数据验证失败,出生日期不能为空!")
private Date birthday;
/**
* 经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)。
*/
@ApiModelProperty(value = "经验等级 (0: 初级 1: 中级 2: 高级 3: 资深)", required = true)
@NotNull(message = "数据验证失败,经验等级不能为空!")
@ConstDictRef(constDictClass = ExpLevel.class, message = "数据验证失败,经验等级为无效值!")
@Column(name = "experience_level")
@@ -103,7 +91,6 @@ public class Student {
/**
* 总共充值学币数量。
*/
@ApiModelProperty(value = "总共充值学币数量", required = true)
@NotNull(message = "数据验证失败,充值学币不能为空!", groups = {UpdateGroup.class})
@Column(name = "total_coin")
private Integer totalCoin;
@@ -111,7 +98,6 @@ public class Student {
/**
* 可用学币数量。
*/
@ApiModelProperty(value = "可用学币数量", required = true)
@NotNull(message = "数据验证失败,剩余学币不能为空!", groups = {UpdateGroup.class})
@Column(name = "left_coin")
private Integer leftCoin;
@@ -119,7 +105,6 @@ public class Student {
/**
* 年级Id。
*/
@ApiModelProperty(value = "年级Id", required = true)
@NotNull(message = "数据验证失败,年级不能为空!")
@Column(name = "grade_id")
private Integer gradeId;
@@ -127,7 +112,6 @@ public class Student {
/**
* 校区Id。
*/
@ApiModelProperty(value = "校区Id", required = true)
@NotNull(message = "数据验证失败,所属校区不能为空!")
@Column(name = "school_id")
private Long schoolId;
@@ -135,14 +119,12 @@ public class Student {
/**
* 注册时间。
*/
@ApiModelProperty(value = "注册时间")
@Column(name = "register_time")
private Date registerTime;
/**
* 学生状态 (0: 正常 1: 锁定 2: 注销)。
*/
@ApiModelProperty(value = "学生状态 (0: 正常 1: 锁定 2: 注销)", required = true)
@NotNull(message = "数据验证失败,学生状态不能为空!", groups = {UpdateGroup.class})
@ConstDictRef(constDictClass = StudentStatus.class, message = "数据验证失败,学生状态为无效值!")
private Integer status;
@@ -150,39 +132,33 @@ public class Student {
/**
* birthday 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "birthday 范围过滤起始值(>=)")
@Transient
private String birthdayStart;
/**
* birthday 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "birthday 范围过滤结束值(<=)")
@Transient
private String birthdayEnd;
/**
* registerTime 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "registerTime 范围过滤起始值(>=)")
@Transient
private String registerTimeStart;
/**
* registerTime 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "registerTime 范围过滤结束值(<=)")
@Transient
private String registerTimeEnd;
/**
* login_mobile / student_name LIKE搜索字符串。
*/
@ApiModelProperty(value = "LIKE模糊搜索字符串")
@Transient
private String searchString;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "provinceId",
slaveServiceName = "areaCodeService",
@@ -192,7 +168,6 @@ public class Student {
@Transient
private Map<String, Object> provinceIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "cityId",
slaveServiceName = "areaCodeService",
@@ -202,7 +177,6 @@ public class Student {
@Transient
private Map<String, Object> cityIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "districtId",
slaveServiceName = "areaCodeService",
@@ -212,7 +186,6 @@ public class Student {
@Transient
private Map<String, Object> districtIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "gradeId",
slaveServiceName = "gradeService",
@@ -222,7 +195,6 @@ public class Student {
@Transient
private Map<String, Object> gradeIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "schoolId",
slaveServiceName = "schoolInfoService",
@@ -232,21 +204,18 @@ public class Student {
@Transient
private Map<String, Object> schoolIdDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "gender",
constantDictClass = Gender.class)
@Transient
private Map<String, Object> genderDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "experienceLevel",
constantDictClass = ExpLevel.class)
@Transient
private Map<String, Object> experienceLevelDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "status",
constantDictClass = StudentStatus.class)

View File

@@ -2,8 +2,6 @@ package com.orange.demo.app.model;
import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -17,7 +15,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("StudentActionStats实体对象")
@Data
@Table(name = "zz_student_action_stats")
public class StudentActionStats {
@@ -25,7 +22,6 @@ public class StudentActionStats {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "stats_id")
@@ -34,7 +30,6 @@ public class StudentActionStats {
/**
* 统计日期。
*/
@ApiModelProperty(value = "统计日期", required = true)
@NotNull(message = "数据验证失败,统计日期不能为空!")
@Column(name = "stats_date")
private Date statsDate;
@@ -42,14 +37,12 @@ public class StudentActionStats {
/**
* 统计小时。
*/
@ApiModelProperty(value = "统计小时")
@Column(name = "stats_month")
private Date statsMonth;
/**
* 年级Id。
*/
@ApiModelProperty(value = "年级Id", required = true)
@NotNull(message = "数据验证失败,所属年级不能为空!")
@Column(name = "grade_id")
private Integer gradeId;
@@ -57,7 +50,6 @@ public class StudentActionStats {
/**
* 学生所在省Id。
*/
@ApiModelProperty(value = "学生所在省Id", required = true)
@NotNull(message = "数据验证失败,所在省份不能为空!")
@Column(name = "province_id")
private Long provinceId;
@@ -65,7 +57,6 @@ public class StudentActionStats {
/**
* 学生所在城市Id。
*/
@ApiModelProperty(value = "学生所在城市Id", required = true)
@NotNull(message = "数据验证失败,所在城市不能为空!", groups = {UpdateGroup.class})
@Column(name = "city_id")
private Long cityId;
@@ -73,7 +64,6 @@ public class StudentActionStats {
/**
* 购课学币数量。
*/
@ApiModelProperty(value = "购课学币数量", required = true)
@NotNull(message = "数据验证失败,购课学币数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_course_amount")
private Integer buyCourseAmount;
@@ -81,7 +71,6 @@ public class StudentActionStats {
/**
* 购买课程次数。
*/
@ApiModelProperty(value = "购买课程次数", required = true)
@NotNull(message = "数据验证失败,购买课程次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_course_count")
private Integer buyCourseCount;
@@ -89,7 +78,6 @@ public class StudentActionStats {
/**
* 购买视频学币数量。
*/
@ApiModelProperty(value = "购买视频学币数量", required = true)
@NotNull(message = "数据验证失败,购买视频学币数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_video_amount")
private Integer buyVideoAmount;
@@ -97,7 +85,6 @@ public class StudentActionStats {
/**
* 购买视频次数。
*/
@ApiModelProperty(value = "购买视频次数", required = true)
@NotNull(message = "数据验证失败,购买视频次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_video_count")
private Integer buyVideoCount;
@@ -105,7 +92,6 @@ public class StudentActionStats {
/**
* 购买作业学币数量。
*/
@ApiModelProperty(value = "购买作业学币数量", required = true)
@NotNull(message = "数据验证失败,购买作业学币数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_paper_amount")
private Integer buyPaperAmount;
@@ -113,7 +99,6 @@ public class StudentActionStats {
/**
* 购买作业次数。
*/
@ApiModelProperty(value = "购买作业次数", required = true)
@NotNull(message = "数据验证失败,购买作业次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_paper_count")
private Integer buyPaperCount;
@@ -121,7 +106,6 @@ public class StudentActionStats {
/**
* 购买献花数量。
*/
@ApiModelProperty(value = "购买献花数量", required = true)
@NotNull(message = "数据验证失败,购买献花数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_flower_amount")
private Integer buyFlowerAmount;
@@ -129,7 +113,6 @@ public class StudentActionStats {
/**
* 购买献花次数。
*/
@ApiModelProperty(value = "购买献花次数", required = true)
@NotNull(message = "数据验证失败,购买献花次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "buy_flower_count")
private Integer buyFlowerCount;
@@ -137,7 +120,6 @@ public class StudentActionStats {
/**
* 充值学币数量。
*/
@ApiModelProperty(value = "充值学币数量", required = true)
@NotNull(message = "数据验证失败,充值学币数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "recharge_coin_amount")
private Integer rechargeCoinAmount;
@@ -145,7 +127,6 @@ public class StudentActionStats {
/**
* 充值学币次数。
*/
@ApiModelProperty(value = "充值学币次数", required = true)
@NotNull(message = "数据验证失败,充值学币次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "recharge_coin_count")
private Integer rechargeCoinCount;
@@ -153,7 +134,6 @@ public class StudentActionStats {
/**
* 线下课程上课次数。
*/
@ApiModelProperty(value = "线下课程上课次数", required = true)
@NotNull(message = "数据验证失败,线下课程上课次数不能为空!")
@Column(name = "do_course_count")
private Integer doCourseCount;
@@ -161,7 +141,6 @@ public class StudentActionStats {
/**
* 观看视频次数。
*/
@ApiModelProperty(value = "观看视频次数", required = true)
@NotNull(message = "数据验证失败,观看视频次数不能为空!", groups = {UpdateGroup.class})
@Column(name = "watch_video_count")
private Integer watchVideoCount;
@@ -169,7 +148,6 @@ public class StudentActionStats {
/**
* 购买献花消费学币数量。
*/
@ApiModelProperty(value = "购买献花消费学币数量", required = true)
@NotNull(message = "数据验证失败,购买献花消费学币数量不能为空!")
@Column(name = "watch_video_total_second")
private Integer watchVideoTotalSecond;
@@ -177,7 +155,6 @@ public class StudentActionStats {
/**
* 做题数量。
*/
@ApiModelProperty(value = "做题数量", required = true)
@NotNull(message = "数据验证失败,做题数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "do_exercise_count")
private Integer doExerciseCount;
@@ -185,7 +162,6 @@ public class StudentActionStats {
/**
* 做题正确的数量。
*/
@ApiModelProperty(value = "做题正确的数量", required = true)
@NotNull(message = "数据验证失败,做题正确的数量不能为空!", groups = {UpdateGroup.class})
@Column(name = "do_exercise_correct_count")
private Integer doExerciseCorrectCount;
@@ -193,18 +169,15 @@ public class StudentActionStats {
/**
* statsDate 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "statsDate 范围过滤起始值(>=)")
@Transient
private String statsDateStart;
/**
* statsDate 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "statsDate 范围过滤结束值(<=)")
@Transient
private String statsDateEnd;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "gradeId",
slaveServiceName = "gradeService",
@@ -214,7 +187,6 @@ public class StudentActionStats {
@Transient
private Map<String, Object> gradeIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "provinceId",
slaveServiceName = "areaCodeService",
@@ -224,7 +196,6 @@ public class StudentActionStats {
@Transient
private Map<String, Object> provinceIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "cityId",
slaveServiceName = "areaCodeService",

View File

@@ -6,8 +6,6 @@ import com.orange.demo.common.core.annotation.RelationDict;
import com.orange.demo.common.core.annotation.RelationConstDict;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -21,7 +19,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("StudentActionTrans实体对象")
@Data
@Table(name = "zz_student_action_trans")
public class StudentActionTrans {
@@ -29,7 +26,6 @@ public class StudentActionTrans {
/**
* 主键Id。
*/
@ApiModelProperty(value = "主键Id", required = true)
@NotNull(message = "数据验证失败主键Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "trans_id")
@@ -38,7 +34,6 @@ public class StudentActionTrans {
/**
* 学生Id。
*/
@ApiModelProperty(value = "学生Id", required = true)
@NotNull(message = "数据验证失败学生Id不能为空")
@Column(name = "student_id")
private Long studentId;
@@ -46,7 +41,6 @@ public class StudentActionTrans {
/**
* 学生名称。
*/
@ApiModelProperty(value = "学生名称", required = true)
@NotBlank(message = "数据验证失败,学生名称不能为空!")
@Column(name = "student_name")
private String studentName;
@@ -54,7 +48,6 @@ public class StudentActionTrans {
/**
* 学生校区。
*/
@ApiModelProperty(value = "学生校区", required = true)
@NotNull(message = "数据验证失败,学生校区不能为空!")
@Column(name = "school_id")
private Long schoolId;
@@ -62,7 +55,6 @@ public class StudentActionTrans {
/**
* 年级Id。
*/
@ApiModelProperty(value = "年级Id", required = true)
@NotNull(message = "数据验证失败,学生年级不能为空!")
@Column(name = "grade_id")
private Integer gradeId;
@@ -70,7 +62,6 @@ public class StudentActionTrans {
/**
* 行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)。
*/
@ApiModelProperty(value = "行为类型(0: 充值 1: 购课 2: 上课签到 3: 上课签退 4: 看视频课 5: 做作业 6: 刷题 7: 献花)", required = true)
@NotNull(message = "数据验证失败,行为类型不能为空!")
@ConstDictRef(constDictClass = StudentActionType.class, message = "数据验证失败,行为类型为无效值!")
@Column(name = "action_type")
@@ -79,7 +70,6 @@ public class StudentActionTrans {
/**
* 设备类型(0: iOS 1: Android 2: PC)。
*/
@ApiModelProperty(value = "设备类型(0: iOS 1: Android 2: PC)", required = true)
@NotNull(message = "数据验证失败,设备类型不能为空!")
@ConstDictRef(constDictClass = DeviceType.class, message = "数据验证失败,设备类型为无效值!")
@Column(name = "device_type")
@@ -88,56 +78,48 @@ public class StudentActionTrans {
/**
* 看视频秒数。
*/
@ApiModelProperty(value = "看视频秒数")
@Column(name = "watch_video_seconds")
private Integer watchVideoSeconds;
/**
* 购买献花数量。
*/
@ApiModelProperty(value = "购买献花数量")
@Column(name = "flower_count")
private Integer flowerCount;
/**
* 购买作业数量。
*/
@ApiModelProperty(value = "购买作业数量")
@Column(name = "paper_count")
private Integer paperCount;
/**
* 购买视频数量。
*/
@ApiModelProperty(value = "购买视频数量")
@Column(name = "video_count")
private Integer videoCount;
/**
* 购买课程数量。
*/
@ApiModelProperty(value = "购买课程数量")
@Column(name = "course_count")
private Integer courseCount;
/**
* 充值学币数量。
*/
@ApiModelProperty(value = "充值学币数量")
@Column(name = "coin_count")
private Integer coinCount;
/**
* 做题是否正确标记。
*/
@ApiModelProperty(value = "做题是否正确标记")
@Column(name = "exercise_correct_flag")
private Integer exerciseCorrectFlag;
/**
* 发生时间。
*/
@ApiModelProperty(value = "发生时间", required = true)
@NotNull(message = "数据验证失败,发生时间不能为空!")
@Column(name = "create_time")
private Date createTime;
@@ -145,18 +127,15 @@ public class StudentActionTrans {
/**
* createTime 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
@Transient
private String createTimeStart;
/**
* createTime 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
@Transient
private String createTimeEnd;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "schoolId",
slaveServiceName = "schoolInfoService",
@@ -166,7 +145,6 @@ public class StudentActionTrans {
@Transient
private Map<String, Object> schoolIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "gradeId",
slaveServiceName = "gradeService",
@@ -176,14 +154,12 @@ public class StudentActionTrans {
@Transient
private Map<String, Object> gradeIdDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "actionType",
constantDictClass = StudentActionType.class)
@Transient
private Map<String, Object> actionTypeDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "deviceType",
constantDictClass = DeviceType.class)

View File

@@ -7,8 +7,6 @@ import com.orange.demo.common.core.annotation.RelationConstDict;
import com.orange.demo.common.core.annotation.DeletedFlagColumn;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -22,7 +20,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("StudentClass实体对象")
@Data
@Table(name = "zz_class")
public class StudentClass {
@@ -30,7 +27,6 @@ public class StudentClass {
/**
* 班级Id。
*/
@ApiModelProperty(value = "班级Id", required = true)
@NotNull(message = "数据验证失败班级Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "class_id")
@@ -39,7 +35,6 @@ public class StudentClass {
/**
* 班级名称。
*/
@ApiModelProperty(value = "班级名称", required = true)
@NotBlank(message = "数据验证失败,班级名称不能为空!")
@Column(name = "class_name")
private String className;
@@ -47,7 +42,6 @@ public class StudentClass {
/**
* 学校Id。
*/
@ApiModelProperty(value = "学校Id", required = true)
@NotNull(message = "数据验证失败,所属校区不能为空!")
@Column(name = "school_id")
private Long schoolId;
@@ -55,7 +49,6 @@ public class StudentClass {
/**
* 学生班长Id。
*/
@ApiModelProperty(value = "学生班长Id", required = true)
@NotNull(message = "数据验证失败,学生班长不能为空!")
@Column(name = "leader_id")
private Long leaderId;
@@ -63,7 +56,6 @@ public class StudentClass {
/**
* 已完成课时数量。
*/
@ApiModelProperty(value = "已完成课时数量", required = true)
@NotNull(message = "数据验证失败,已完成课时不能为空!", groups = {UpdateGroup.class})
@Column(name = "finish_class_hour")
private Integer finishClassHour;
@@ -71,7 +63,6 @@ public class StudentClass {
/**
* 班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)。
*/
@ApiModelProperty(value = "班级级别(0: 初级班 1: 培优班 2: 冲刺提分班 3: 竞赛班)", required = true)
@NotNull(message = "数据验证失败,班级级别不能为空!")
@ConstDictRef(constDictClass = ClassLevel.class, message = "数据验证失败,班级级别为无效值!")
@Column(name = "class_level")
@@ -80,26 +71,22 @@ public class StudentClass {
/**
* 创建用户。
*/
@ApiModelProperty(value = "创建用户")
@Column(name = "create_user_id")
private Long createUserId;
/**
* 班级创建时间。
*/
@ApiModelProperty(value = "班级创建时间")
@Column(name = "create_time")
private Date createTime;
/**
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
*/
@ApiModelProperty(hidden = true)
@JSONField(serialize = false)
@DeletedFlagColumn
private Integer status;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "schoolId",
slaveServiceName = "schoolInfoService",
@@ -109,7 +96,6 @@ public class StudentClass {
@Transient
private Map<String, Object> schoolIdDictMap;
@ApiModelProperty(hidden = true)
@RelationDict(
masterIdField = "leaderId",
slaveServiceName = "studentService",
@@ -119,7 +105,6 @@ public class StudentClass {
@Transient
private Map<String, Object> leaderIdDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "classLevel",
constantDictClass = ClassLevel.class)

View File

@@ -1,10 +1,6 @@
package com.orange.demo.upms.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import lombok.extern.slf4j.Slf4j;
import com.orange.demo.config.ApplicationConfig;
import com.orange.demo.upms.service.*;
@@ -12,6 +8,7 @@ import com.orange.demo.upms.model.SysUser;
import com.orange.demo.upms.model.constant.SysUserStatus;
import com.orange.demo.upms.model.constant.SysUserType;
import com.orange.demo.common.core.annotation.NoAuthInterface;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.constant.ApplicationConstant;
import com.orange.demo.common.core.constant.ErrorCodeEnum;
import com.orange.demo.common.core.object.ResponseResult;
@@ -32,8 +29,6 @@ import java.util.*;
* @author Jerry
* @date 2020-09-24
*/
@ApiSupport(order = 1)
@Api(tags = "用户登录接口")
@Slf4j
@RestController
@RequestMapping("/admin/upms/login")
@@ -55,23 +50,17 @@ public class LoginController {
* @param password 密码。
* @return 应答结果对象其中包括JWT的Token数据以及菜单列表。
*/
@ApiImplicitParams({
// 这里包含密码密文,仅用于方便开发期间的接口测试,集成测试和发布阶段,需要将当前注解去掉。
// 如果您重新生成了公钥和私钥请替换password的缺省值。
@ApiImplicitParam(name = "loginName", defaultValue = "admin"),
@ApiImplicitParam(name = "password", defaultValue = "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D")
})
@NoAuthInterface
@GetMapping("/doLogin")
@PostMapping("/doLogin")
public ResponseResult<JSONObject> doLogin(
@RequestParam String loginName, @RequestParam String password) throws Exception {
@MyRequestBody String loginName, @MyRequestBody String password) throws Exception {
if (MyCommonUtil.existBlankArgument(loginName, password)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
SysUser user = sysUserService.getSysUserByLoginName(loginName);
password = URLDecoder.decode(password, StandardCharsets.UTF_8.name());
//NOTE: 第一次使用时请务必阅读ApplicationConstant.PRIVATE_KEY的代码注释。
//执行RsaUtil工具类中的main函数可以生成新的公钥和私钥。
// NOTE: 第一次使用时请务必阅读ApplicationConstant.PRIVATE_KEY的代码注释。
// 执行RsaUtil工具类中的main函数可以生成新的公钥和私钥。
password = RsaUtil.decrypt(password, ApplicationConstant.PRIVATE_KEY);
if (user == null || !passwordEncoder.matches(password, user.getPassword())) {
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);
@@ -119,15 +108,15 @@ public class LoginController {
*/
@PostMapping("/changePassword")
public ResponseResult<Void> changePassword(
@RequestParam String oldPass, @RequestParam String newPass) throws Exception {
@MyRequestBody String oldPass, @MyRequestBody String newPass) throws Exception {
if (MyCommonUtil.existBlankArgument(oldPass, oldPass)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
TokenData tokenData = TokenData.takeFromRequest();
SysUser user = sysUserService.getById(tokenData.getUserId());
oldPass = URLDecoder.decode(oldPass, StandardCharsets.UTF_8.name());
//NOTE: 第一次使用时请务必阅读ApplicationConstant.PRIVATE_KEY的代码注释。
//执行RsaUtil工具类中的main函数可以生成新的公钥和私钥。
// NOTE: 第一次使用时请务必阅读ApplicationConstant.PRIVATE_KEY的代码注释。
// 执行RsaUtil工具类中的main函数可以生成新的公钥和私钥。
oldPass = RsaUtil.decrypt(oldPass, ApplicationConstant.PRIVATE_KEY);
if (user == null || !passwordEncoder.matches(oldPass, user.getPassword())) {
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);

View File

@@ -10,8 +10,6 @@ import com.orange.demo.common.core.annotation.MyRequestBody;
import com.orange.demo.common.core.validator.AddGroup;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.config.ApplicationConfig;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +24,6 @@ import javax.validation.groups.Default;
* @author Jerry
* @date 2020-09-24
*/
@Api(tags = "用户管理管理接口")
@Slf4j
@RestController
@RequestMapping("/admin/upms/sysUser")
@@ -45,19 +42,15 @@ public class SysUserController {
* @param sysUser 新增用户对象。
* @return 应答结果对象包含新增用户的主键Id。
*/
@ApiOperationSupport(ignoreParameters = {
"sysUser.userId",
"sysUser.createTimeStart",
"sysUser.createTimeEnd"})
@PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody SysUser sysUser) {
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, AddGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
CallResult result = sysUserService.verifyRelatedData(sysUser, null);
if (!result.isSuccess()) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
}
sysUserService.saveNew(sysUser);
return ResponseResult.success(sysUser.getUserId());
@@ -69,14 +62,11 @@ public class SysUserController {
* @param sysUser 更新用户对象。
* @return 应答结果对象。
*/
@ApiOperationSupport(ignoreParameters = {
"sysUser.createTimeStart",
"sysUser.createTimeEnd"})
@PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody SysUser sysUser) {
String errorMessage = MyCommonUtil.getModelValidationError(sysUser, Default.class, UpdateGroup.class);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, errorMessage);
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
SysUser originalUser = sysUserService.getById(sysUser.getUserId());
if (originalUser == null) {
@@ -84,7 +74,7 @@ public class SysUserController {
}
CallResult result = sysUserService.verifyRelatedData(sysUser, originalUser);
if (!result.isSuccess()) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATAED_FAILED, result.getErrorMessage());
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
}
if (!sysUserService.update(sysUser, originalUser)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);

View File

@@ -8,8 +8,6 @@ import com.orange.demo.common.core.annotation.DeletedFlagColumn;
import com.orange.demo.common.core.validator.AddGroup;
import com.orange.demo.common.core.validator.UpdateGroup;
import com.orange.demo.common.core.validator.ConstDictRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.*;
@@ -23,7 +21,6 @@ import java.util.Map;
* @author Jerry
* @date 2020-09-24
*/
@ApiModel("SysUser实体对象")
@Data
@Table(name = "zz_sys_user")
public class SysUser {
@@ -31,7 +28,6 @@ public class SysUser {
/**
* 用户Id。
*/
@ApiModelProperty(value = "用户Id", required = true)
@NotNull(message = "数据验证失败用户Id不能为空", groups = {UpdateGroup.class})
@Id
@Column(name = "user_id")
@@ -40,7 +36,6 @@ public class SysUser {
/**
* 登录用户名。
*/
@ApiModelProperty(value = "登录用户名", required = true)
@NotBlank(message = "数据验证失败,登录用户名不能为空!")
@Column(name = "login_name")
private String loginName;
@@ -48,14 +43,12 @@ public class SysUser {
/**
* 用户密码。
*/
@ApiModelProperty(value = "用户密码", required = true)
@NotBlank(message = "数据验证失败,用户密码不能为空!", groups = {AddGroup.class})
private String password;
/**
* 用户显示名称。
*/
@ApiModelProperty(value = "用户显示名称", required = true)
@NotBlank(message = "数据验证失败,用户显示名称不能为空!")
@Column(name = "show_name")
private String showName;
@@ -63,7 +56,6 @@ public class SysUser {
/**
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
*/
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)", required = true)
@NotNull(message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)不能为空!")
@ConstDictRef(constDictClass = SysUserType.class, message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)为无效值!")
@Column(name = "user_type")
@@ -72,14 +64,12 @@ public class SysUser {
/**
* 用户头像的Url。
*/
@ApiModelProperty(value = "用户头像的Url")
@Column(name = "head_image_url")
private String headImageUrl;
/**
* 用户状态(0: 正常 1: 锁定)。
*/
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)", required = true)
@NotNull(message = "数据验证失败,用户状态(0: 正常 1: 锁定)不能为空!")
@ConstDictRef(constDictClass = SysUserStatus.class, message = "数据验证失败,用户状态(0: 正常 1: 锁定)为无效值!")
@Column(name = "user_status")
@@ -88,7 +78,6 @@ public class SysUser {
/**
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
*/
@ApiModelProperty(hidden = true)
@JSONField(serialize = false)
@DeletedFlagColumn
@Column(name = "deleted_flag")
@@ -97,53 +86,45 @@ public class SysUser {
/**
* 创建用户Id。
*/
@ApiModelProperty(value = "创建用户Id")
@Column(name = "create_user_id")
private Long createUserId;
/**
* 创建用户名。
*/
@ApiModelProperty(value = "创建用户名")
@Column(name = "create_username")
private String createUsername;
/**
* 创建时间。
*/
@ApiModelProperty(value = "创建时间")
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间。
*/
@ApiModelProperty(value = "更新时间")
@Column(name = "update_time")
private Date updateTime;
/**
* createTime 范围过滤起始值(>=)。
*/
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
@Transient
private String createTimeStart;
/**
* createTime 范围过滤结束值(<=)。
*/
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
@Transient
private String createTimeEnd;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "userType",
constantDictClass = SysUserType.class)
@Transient
private Map<String, Object> userTypeDictMap;
@ApiModelProperty(hidden = true)
@RelationConstDict(
masterIdField = "userStatus",
constantDictClass = SysUserStatus.class)

View File

@@ -56,15 +56,6 @@ pagehelper:
supportMethodsArguments: false
params: count=countSql
swagger:
# 当enabled为false的时候则可禁用swagger。
enabled: true
# 工程的基础包名。
basePackage: com.orange.demo
title: 橙单单体开源版
description: 橙单单体开源版详情
version: 1.0
# 暴露监控端点
management:
endpoints:

View File

@@ -53,9 +53,6 @@
<root level="${OUTPUT_LOG_LEVEL}">
<AppenderRef ref="console"/>
</root>
<Logger name="springfox.documentation" additivity="false" level="error">
<AppenderRef ref="console"/>
</Logger>
<Logger name="com.orange.demo" additivity="false" level="info">
<AppenderRef ref="console"/>
<AppenderRef ref="file_log"/>

View File

@@ -74,7 +74,7 @@ public class CacheConfig {
@Bean
public CacheManager cacheManager() {
SimpleCacheManager manager = new SimpleCacheManager();
//把各个cache注册到cacheManager中CaffeineCache实现了org.springframework.cache.Cache接口
// 把各个cache注册到cacheManager中CaffeineCache实现了org.springframework.cache.Cache接口
ArrayList<CaffeineCache> caches = new ArrayList<>();
for (CacheEnum c : CacheEnum.values()) {
caches.add(new CaffeineCache(c.name(),

View File

@@ -1,6 +1,13 @@
package com.orange.demo.common.core.cache;
import com.orange.demo.common.core.exception.MapCacheAccessException;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
/**
@@ -11,6 +18,7 @@ import java.util.function.Function;
* @author Jerry
* @date 2020-09-24
*/
@Slf4j
public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
/**
@@ -21,6 +29,14 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* 获取字典主键数据的函数对象。
*/
protected Function<V, K> idGetter;
/**
* 由于大部分场景是读取操作,所以使用读写锁提高并发的伸缩性。
*/
protected ReadWriteLock lock = new ReentrantReadWriteLock();
/**
* 超时时长。单位毫秒。
*/
protected static final long TIMEOUT = 2000L;
/**
* 当前对象的构造器函数。
@@ -52,10 +68,27 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @return 全部字段数据列表。
*/
@Override
public synchronized List<V> getAll() {
public List<V> getAll() {
List<V> resultList = new LinkedList<>();
for (Map.Entry<K, V> entry : dataMap.entrySet()) {
resultList.add(entry.getValue());
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
for (Map.Entry<K, V> entry : dataMap.entrySet()) {
resultList.add(entry.getValue());
}
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return resultList;
}
@@ -67,14 +100,31 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @return 对象列表。
*/
@Override
public synchronized List<V> getInList(Set<K> keys) {
public List<V> getInList(Set<K> keys) {
List<V> resultList = new LinkedList<>();
keys.forEach(key -> {
V object = dataMap.get(key);
if (object != null) {
resultList.add(object);
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
keys.forEach(key -> {
V object = dataMap.get(key);
if (object != null) {
resultList.add(object);
}
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
});
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return resultList;
}
@@ -84,14 +134,31 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @param dataList 待缓存的数据列表。
*/
@Override
public synchronized void putAll(List<V> dataList) {
public void putAll(List<V> dataList) {
if (dataList == null) {
return;
}
dataList.forEach(dataObj -> {
K id = idGetter.apply(dataObj);
dataMap.put(id, dataObj);
});
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
dataList.forEach(dataObj -> {
K id = idGetter.apply(dataObj);
dataMap.put(id, dataObj);
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
@@ -101,12 +168,32 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @param force true则强制刷新如果false当缓存中存在数据时不刷新。
*/
@Override
public synchronized void reload(List<V> dataList, boolean force) {
public void reload(List<V> dataList, boolean force) {
if (!force && this.getCount() > 0) {
return;
}
this.invalidateAll();
this.putAll(dataList);
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
dataMap.clear();
dataList.forEach(dataObj -> {
K id = idGetter.apply(dataObj);
dataMap.put(id, dataObj);
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
@@ -116,8 +203,30 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @return 获取到的数据如果没有返回null。
*/
@Override
public synchronized V get(K id) {
return id == null ? null : dataMap.get(id);
public V get(K id) {
if (id == null) {
return null;
}
V data;
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
data = dataMap.get(id);
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return data;
}
/**
@@ -127,8 +236,25 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @param object 字典数据对象。
*/
@Override
public synchronized void put(K id, V object) {
dataMap.put(id, object);
public void put(K id, V object) {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
dataMap.put(id, object);
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
@@ -137,7 +263,7 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @return 返回缓存的数据数量。
*/
@Override
public synchronized int getCount() {
public int getCount() {
return dataMap.size();
}
@@ -148,8 +274,30 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @return 返回被删除的对象如果主键不存在返回null。
*/
@Override
public synchronized V invalidate(K id) {
return id == null ? null : dataMap.remove(id);
public V invalidate(K id) {
if (id == null) {
return null;
}
String exceptionMessage;
V data;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
data = dataMap.remove(id);
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return data;
}
/**
@@ -158,19 +306,53 @@ public class MapDictionaryCache<K, V> implements DictionaryCache<K, V> {
* @param keys 待删除数据的主键集合。
*/
@Override
public synchronized void invalidateSet(Set<K> keys) {
keys.forEach(id -> {
if (id != null) {
dataMap.remove(id);
public void invalidateSet(Set<K> keys) {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
keys.forEach(id -> {
if (id != null) {
dataMap.remove(id);
}
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
});
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
* 清空缓存。
*/
@Override
public synchronized void invalidateAll() {
dataMap.clear();
public void invalidateAll() {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
dataMap.clear();
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
}

View File

@@ -1,9 +1,13 @@
package com.orange.demo.common.core.cache;
import com.orange.demo.common.core.exception.MapCacheAccessException;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
/**
@@ -14,6 +18,7 @@ import java.util.function.Function;
* @author Jerry
* @date 2020-09-24
*/
@Slf4j
public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
/**
@@ -61,8 +66,27 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
* @param parentId 父主键Id。
* @return 子数据列表。
*/
public synchronized List<V> getListByParentId(K parentId) {
return new LinkedList<>(allTreeMap.get(parentId));
public List<V> getListByParentId(K parentId) {
List<V> resultList = new LinkedList<>();
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
resultList.addAll(allTreeMap.get(parentId));
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return resultList;
}
/**
@@ -71,16 +95,33 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
* @param dataList 待缓存的数据列表。
*/
@Override
public synchronized void putAll(List<V> dataList) {
public void putAll(List<V> dataList) {
if (dataList == null) {
return;
}
super.putAll(dataList);
dataList.forEach(data -> {
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
allTreeMap.put(parentId, data);
});
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
super.putAll(dataList);
dataList.forEach(data -> {
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
allTreeMap.put(parentId, data);
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
@@ -90,11 +131,28 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
* @param data 字典数据对象。
*/
@Override
public synchronized void put(K id, V data) {
super.put(id, data);
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
allTreeMap.put(parentId, data);
public void put(K id, V data) {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
super.put(id, data);
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
allTreeMap.put(parentId, data);
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
@@ -104,11 +162,29 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
* @return 返回被删除的对象如果主键不存在返回null。
*/
@Override
public synchronized V invalidate(K id) {
V v = super.invalidate(id);
if (v != null) {
K parentId = parentIdGetter.apply(v);
allTreeMap.remove(parentId, v);
public V invalidate(K id) {
V v;
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
v = super.invalidate(id);
if (v != null) {
K parentId = parentIdGetter.apply(v);
allTreeMap.remove(parentId, v);
}
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
return v;
}
@@ -119,24 +195,58 @@ public class MapTreeDictionaryCache<K, V> extends MapDictionaryCache<K, V> {
* @param keys 待删除数据的主键集合。
*/
@Override
public synchronized void invalidateSet(Set<K> keys) {
keys.forEach(id -> {
if (id != null) {
V data = dataMap.remove(id);
if (data != null) {
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
public void invalidateSet(Set<K> keys) {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
keys.forEach(id -> {
if (id != null) {
V data = dataMap.remove(id);
if (data != null) {
K parentId = parentIdGetter.apply(data);
allTreeMap.remove(parentId, data);
}
}
});
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
});
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
/**
* 清空缓存。
*/
@Override
public synchronized void invalidateAll() {
super.invalidateAll();
allTreeMap.clear();
public void invalidateAll() {
String exceptionMessage;
try {
if (lock.readLock().tryLock(TIMEOUT, TimeUnit.MILLISECONDS)) {
try {
super.invalidateAll();
allTreeMap.clear();
} finally {
lock.readLock().unlock();
}
} else {
throw new TimeoutException();
}
} catch (Exception e) {
exceptionMessage = String.format(
"LOCK Operation of [MapDictionaryCache::getInList] encountered EXCEPTION [%s] for DICT.",
e.getClass().getSimpleName());
log.warn(exceptionMessage);
throw new MapCacheAccessException(exceptionMessage, e);
}
}
}

View File

@@ -8,6 +8,10 @@ package com.orange.demo.common.core.constant;
*/
public final class ApplicationConstant {
/**
* 为字典表数据缓存时,缓存名称的固定后缀。
*/
public static final String DICT_CACHE_NAME_SUFFIX = "-DICT";
/**
* 图片文件上传的父目录。
*/

View File

@@ -37,7 +37,7 @@ public enum ErrorCodeEnum {
INVALID_USER_STATUS("用户状态错误,请刷新后重试!"),
HAS_CHILDREN_DATA("数据验证失败,子数据存在,请刷新后重试!"),
DATA_VALIDATAED_FAILED("数据验证失败,请核对!"),
DATA_VALIDATED_FAILED("数据验证失败,请核对!"),
UPLOAD_FILE_FAILED("文件上传失败,请联系管理员!"),
DATA_SAVE_FAILED("数据保存失败,请联系管理员!"),
DATA_ACCESS_FAILED("数据访问失败,请联系管理员!"),

View File

@@ -0,0 +1,20 @@
package com.orange.demo.common.core.exception;
/**
* 内存缓存访问失败。比如:获取分布式数据锁超时、等待线程中断等。
*
* @author Jerry
* @date 2020-09-24
*/
public class MapCacheAccessException extends RuntimeException {
/**
* 构造函数。
*
* @param msg 错误信息。
* @param cause 原始异常。
*/
public MapCacheAccessException(String msg, Throwable cause) {
super(msg, cause);
}
}

View File

@@ -20,6 +20,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal;
import java.util.*;
/**
@@ -45,6 +46,7 @@ public class MyRequestArgumentResolver implements HandlerMethodArgumentResolver
classSet.add(Double.class);
classSet.add(Boolean.class);
classSet.add(Byte.class);
classSet.add(BigDecimal.class);
classSet.add(Character.class);
}
@@ -100,7 +102,7 @@ public class MyRequestArgumentResolver implements HandlerMethodArgumentResolver
}
// 获取参数类型。
Class<?> parameterType = parameter.getParameterType();
//基本类型
// 基本类型
if (parameterType.isPrimitive()) {
return parsePrimitive(parameterType.getName(), value);
}
@@ -196,6 +198,12 @@ public class MyRequestArgumentResolver implements HandlerMethodArgumentResolver
return number.doubleValue();
} else if (parameterType == Byte.class) {
return number.byteValue();
} else if (parameterType == BigDecimal.class) {
if (value instanceof Double || value instanceof Float) {
return BigDecimal.valueOf(number.doubleValue());
} else {
return BigDecimal.valueOf(number.longValue());
}
}
} else if (parameterType == Boolean.class) {
return value.toString();

View File

@@ -76,6 +76,9 @@ public class MyGroupParam extends ArrayList<MyGroupParam.GroupInfo> {
private static GroupBaseData parseGroupBaseData(GroupInfo groupInfo, Class<?> modelClazz) {
GroupBaseData baseData = new GroupBaseData();
if (StringUtils.isBlank(groupInfo.fieldName)) {
throw new IllegalArgumentException("GroupInfo.fieldName can't be EMPTY");
}
String[] stringArray = StringUtils.split(groupInfo.fieldName,'.');
if (stringArray.length == 1) {
baseData.modelName = modelClazz.getSimpleName();

View File

@@ -110,11 +110,11 @@ public class LocalUpDownloader extends BaseUpDownloader {
try {
byte[] bytes = uploadFile.getBytes();
Path path = Paths.get(uploadPath + responseInfo.getFilename());
//如果没有files文件夹则创建
// 如果没有files文件夹则创建
if (!Files.isWritable(path)) {
Files.createDirectories(Paths.get(uploadPath));
}
//文件写入指定路径
// 文件写入指定路径
Files.write(path, bytes);
} catch (IOException e) {
log.error("Failed to write uploaded file [" + uploadFile.getOriginalFilename() + " ].", e);

View File

@@ -6,6 +6,9 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Map;
/**
* Spring 系统启动应用感知对象主要用于获取Spring Bean的上下文对象后续的代码中可以直接查找系统中加载的Bean对象。
*
@@ -62,6 +65,19 @@ public class ApplicationContextHolder implements ApplicationContextAware {
return applicationContext.getBean(beanType);
}
/**
* 根据Bean的ClassType获取Bean对象列表。
*
* @param beanType Bean的Class类型。。
* @param <T> 返回的Bean类型。
* @return Bean对象列表。
*/
public static <T> Collection<T> getBeanListOfType(Class<T> beanType) {
assertApplicationContext();
Map<String, T> beanMap = applicationContext.getBeansOfType(beanType);
return beanMap == null ? null : beanMap.values();
}
private static void assertApplicationContext() {
if (ApplicationContextHolder.applicationContext == null) {
throw new MyRuntimeException("applicaitonContext属性为null,请检查是否注入了ApplicationContextHolder!");

View File

@@ -31,29 +31,29 @@ public class IpUtil {
*/
public static String getRemoteIpAddress(HttpServletRequest request) {
String ip = null;
//X-Forwarded-ForSquid 服务代理
// X-Forwarded-ForSquid 服务代理
String ipAddresses = request.getHeader("X-Forwarded-For");
if (StringUtils.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) {
//Proxy-Client-IPapache 服务代理
// Proxy-Client-IPapache 服务代理
ipAddresses = request.getHeader("Proxy-Client-IP");
}
if (StringUtils.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) {
//WL-Proxy-Client-IPweblogic 服务代理
// WL-Proxy-Client-IPweblogic 服务代理
ipAddresses = request.getHeader("WL-Proxy-Client-IP");
}
if (StringUtils.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) {
//HTTP_CLIENT_IP有些代理服务器
// HTTP_CLIENT_IP有些代理服务器
ipAddresses = request.getHeader("HTTP_CLIENT_IP");
}
if (StringUtils.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) {
//X-Real-IPnginx服务代理
// X-Real-IPnginx服务代理
ipAddresses = request.getHeader("X-Real-IP");
}
//有些网络通过多层代理那么获取到的ip就会有多个一般都是通过逗号,分割开来并且第一个ip为客户端的真实IP
// 有些网络通过多层代理那么获取到的ip就会有多个一般都是通过逗号,分割开来并且第一个ip为客户端的真实IP
if (StringUtils.isNotBlank(ipAddresses)) {
ip = ipAddresses.split(",")[0];
}
//还是不能获取到最后再通过request.getRemoteAddr();获取
// 还是不能获取到最后再通过request.getRemoteAddr();获取
if (StringUtils.isBlank(ipAddresses) || UNKNOWN.equalsIgnoreCase(ipAddresses)) {
ip = request.getRemoteAddr();
}

View File

@@ -50,6 +50,59 @@ public class MyModelUtil {
*/
private static Map<String, Tuple2<String, Integer>> cachedColumnInfoMap = new ConcurrentHashMap<>();
/**
* 拷贝源类型的集合数据到目标类型的集合中,其中源类型和目标类型中的对象字段类型完全相同。
* NOTE: 该函数主要应用于框架中Dto和Model之间的copy特别针对一对一关联的深度copy。
* 在Dto中一对一对象可以使用Map来表示而不需要使用从表对象的Dto。
*
* @param sourceCollection 源类型集合。
* @param targetClazz 目标类型的Class对象。
* @param <S> 源类型。
* @param <T> 目标类型。
* @return copy后的目标类型对象集合。
*/
public static <S, T> List<T> copyCollectionTo(Collection<S> sourceCollection, Class<T> targetClazz) {
List<T> targetList = new LinkedList<>();
if (CollectionUtils.isNotEmpty(sourceCollection)) {
for (S source : sourceCollection) {
try {
T target = targetClazz.newInstance();
BeanUtil.copyProperties(source, target);
targetList.add(target);
} catch (Exception e) {
log.error("Failed to call MyModelUtil.copyCollectionTo", e);
return Collections.emptyList();
}
}
}
return targetList;
}
/**
* 拷贝源类型的对象数据到目标类型的对象中,其中源类型和目标类型中的对象字段类型完全相同。
* NOTE: 该函数主要应用于框架中Dto和Model之间的copy特别针对一对一关联的深度copy。
* 在Dto中一对一对象可以使用Map来表示而不需要使用从表对象的Dto。
*
* @param source 源类型对象。
* @param targetClazz 目标类型的Class对象。
* @param <S> 源类型。
* @param <T> 目标类型。
* @return copy后的目标类型对象。
*/
public static <S, T> T copyTo(S source, Class<T> targetClazz) {
if (source == null) {
return null;
}
try {
T target = targetClazz.newInstance();
BeanUtil.copyProperties(source, target);
return target;
} catch (Exception e) {
log.error("Failed to call MyModelUtil.copyTo", e);
return null;
}
}
/**
* 映射Model对象的字段反射对象获取与该字段对应的数据库列名称。
*

View File

@@ -46,9 +46,9 @@ public class RsaUtil {
// 得到私钥字符串
String privateKeyString = Base64.getEncoder().encodeToString(privateKey.getEncoded());
// 将公钥和私钥保存到Map
//0表示公钥
// 0表示公钥
keyMap.put(0, publicKeyString);
//1表示私钥
// 1表示私钥
keyMap.put(1, privateKeyString);
}
@@ -61,11 +61,11 @@ public class RsaUtil {
* @throws Exception 加密过程中的异常信息
*/
public static String encrypt(String str, String publicKey) throws Exception {
//base64编码的公钥
// base64编码的公钥
byte[] decoded = Base64.getDecoder().decode(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密。后面这个更安全但是SonarQube始终report安全漏洞。"RSA/ECB/PKCS1Padding"
//而浏览器自带的Javascript加密功能目前safari不支持而且用的人也不太多。所以暂时都不考虑了。
// RSA加密。后面这个更安全但是SonarQube始终report安全漏洞。"RSA/ECB/PKCS1Padding"
// 而浏览器自带的Javascript加密功能目前safari不支持而且用的人也不太多。所以暂时都不考虑了。
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.getEncoder().encodeToString(cipher.doFinal(str.getBytes(StandardCharsets.UTF_8)));
@@ -80,12 +80,12 @@ public class RsaUtil {
* @throws Exception 解密过程中的异常信息
*/
public static String decrypt(String str, String privateKey) throws Exception {
//64位解码加密后的字符串
// 64位解码加密后的字符串
byte[] inputByte = Base64.getDecoder().decode(str);
//base64编码的私钥
// base64编码的私钥
byte[] decoded = Base64.getDecoder().decode(privateKey);
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
//RSA解密
// RSA解密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, priKey);
return new String(cipher.doFinal(inputByte));
@@ -93,9 +93,9 @@ public class RsaUtil {
public static void main(String[] args) throws Exception {
long temp = System.currentTimeMillis();
//生成公钥和私钥
// 生成公钥和私钥
genKeyPair();
//加密字符串
// 加密字符串
System.out.println("公钥:" + keyMap.get(0));
System.out.println("私钥:" + keyMap.get(1));
System.out.println("生成密钥消耗时间:" + (System.currentTimeMillis() - temp) / 1000.0 + "");

View File

@@ -9,6 +9,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
* @date 2020-09-24
*/
@EnableConfigurationProperties({IdGeneratorProperties.class})
public class IdGeneratorAutoConfigure {
public class IdGeneratorAutoConfig {
}

View File

@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.orange.demo.common.sequence.config.IdGeneratorAutoConfigure
com.orange.demo.common.sequence.config.IdGeneratorAutoConfig

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>common</artifactId>
<groupId>com.orange.demo</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common-swagger</artifactId>
<version>1.0.0</version>
<name>common-swagger</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>com.orange.demo</groupId>
<artifactId>common-core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,56 +0,0 @@
package com.orange.demo.common.swagger.config;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* 自动加载bean的配置对象。
*
* @author Jerry
* @date 2020-09-24
*/
@EnableSwagger2
@EnableKnife4j
@EnableConfigurationProperties(SwaggerProperties.class)
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
public class SwaggerAutoConfiguration {
@Bean
public Docket upmsDocket(SwaggerProperties properties) {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("1. 用户权限分组接口")
.ignoredParameterTypes(MyRequestBody.class)
.apiInfo(apiInfo(properties))
.select()
.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage() + ".upms.controller"))
.paths(PathSelectors.any()).build();
}
@Bean
public Docket bizDocket(SwaggerProperties properties) {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("2. 业务应用分组接口")
.ignoredParameterTypes(MyRequestBody.class)
.apiInfo(apiInfo(properties))
.select()
.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage() + ".app.controller"))
.paths(PathSelectors.any()).build();
}
private ApiInfo apiInfo(SwaggerProperties properties) {
return new ApiInfoBuilder()
.title(properties.getTitle())
.description(properties.getDescription())
.version(properties.getVersion()).build();
}
}

View File

@@ -1,44 +0,0 @@
package com.orange.demo.common.swagger.config;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.ArrayList;
import java.util.List;
/**
* 配置参数对象。
*
* @author Jerry
* @date 2020-09-24
*/
@Data
@ConfigurationProperties("swagger")
public class SwaggerProperties {
/**
* 是否开启Swagger。
*/
private Boolean enabled;
/**
* Swagger解析的基础包路径。
**/
private String basePackage = "";
/**
* ApiInfo中的标题。
**/
private String title = "";
/**
* ApiInfo中的描述信息。
**/
private String description = "";
/**
* ApiInfo中的版本信息。
**/
private String version = "";
}

View File

@@ -1,85 +0,0 @@
package com.orange.demo.common.swagger.plugin;
import cn.hutool.core.lang.Assert;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.github.xiaoymin.knife4j.core.conf.Consts;
import javassist.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import springfox.documentation.service.ResolvedMethodParameter;
import java.util.List;
/**
* 通过字节码方式动态创建接口参数封装对象。
*
* @author Jerry
* @date 2020-09-24
*/
@Slf4j
public class ByteBodyUtils {
private static final ClassPool CLASS_POOL = ClassPool.getDefault();
public static Class<?> createDynamicModelClass(String name, List<ResolvedMethodParameter> parameters) {
String clazzName = Consts.BASE_PACKAGE_PREFIX + name;
try {
CtClass tmp = CLASS_POOL.getCtClass(clazzName);
if (tmp != null) {
tmp.detach();
}
} catch (NotFoundException e) {
// 需要吃掉这个异常。
}
CtClass ctClass = CLASS_POOL.makeClass(clazzName);
try {
int fieldCount = 0;
for (ResolvedMethodParameter dynamicParameter : parameters) {
// 因为在调用这个方法之前这些参数都包含MyRequestBody注解。
MyRequestBody myRequestBody =
dynamicParameter.findAnnotation(MyRequestBody.class).orNull();
Assert.notNull(myRequestBody);
String fieldName = dynamicParameter.defaultName().isPresent()
? dynamicParameter.defaultName().get() : "parameter";
if (StringUtils.isNotBlank(myRequestBody.value())) {
fieldName = myRequestBody.value();
}
ctClass.addField(createField(dynamicParameter, fieldName, ctClass));
fieldCount++;
}
if (fieldCount > 0) {
return ctClass.toClass();
}
} catch (Throwable e) {
log.error(e.getMessage());
}
return null;
}
private static CtField createField(ResolvedMethodParameter parameter, String parameterName, CtClass ctClass)
throws NotFoundException, CannotCompileException {
CtField field = new CtField(getFieldType(parameter.getParameterType().getErasedType()), parameterName, ctClass);
field.setModifiers(Modifier.PUBLIC);
return field;
}
private static CtClass getFieldType(Class<?> propetyType) {
CtClass fieldType = null;
try {
if (!propetyType.isAssignableFrom(Void.class)) {
fieldType = CLASS_POOL.get(propetyType.getName());
} else {
fieldType = CLASS_POOL.get(String.class.getName());
}
} catch (NotFoundException e) {
//抛异常
ClassClassPath path = new ClassClassPath(propetyType);
CLASS_POOL.insertClassPath(path);
try {
fieldType = CLASS_POOL.get(propetyType.getName());
} catch (NotFoundException e1) {
log.error(e1.getMessage(), e1);
}
}
return fieldType;
}
}

View File

@@ -1,61 +0,0 @@
package com.orange.demo.common.swagger.plugin;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.fasterxml.classmate.TypeResolver;
import com.google.common.base.CaseFormat;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.service.ResolvedMethodParameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationModelsProviderPlugin;
import springfox.documentation.spi.service.contexts.RequestMappingContext;
import java.util.List;
import java.util.stream.Collectors;
/**
* 生成参数包装类的插件。
*
* @author Jerry
* @date 2020-09-24
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE + 200)
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
public class DynamicBodyModelPlugin implements OperationModelsProviderPlugin {
private final TypeResolver typeResolver;
public DynamicBodyModelPlugin(TypeResolver typeResolver) {
this.typeResolver = typeResolver;
}
@Override
public void apply(RequestMappingContext context) {
List<ResolvedMethodParameter> parameterTypes = context.getParameters();
if (CollectionUtils.isEmpty(parameterTypes)) {
return;
}
List<ResolvedMethodParameter> bodyParameter = parameterTypes.stream()
.filter(p -> p.hasParameterAnnotation(MyRequestBody.class)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(bodyParameter)) {
return;
}
String groupName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, context.getGroupName());
String clazzName = groupName + StringUtils.capitalize(context.getName());
Class<?> clazz = ByteBodyUtils.createDynamicModelClass(clazzName, bodyParameter);
if (clazz != null) {
context.operationModelsBuilder().addInputParam(typeResolver.resolve(clazz));
}
}
@Override
public boolean supports(DocumentationType delimiter) {
//支持2.0版本
return delimiter == DocumentationType.SWAGGER_2;
}
}

View File

@@ -1,64 +0,0 @@
package com.orange.demo.common.swagger.plugin;
import com.orange.demo.common.core.annotation.MyRequestBody;
import com.google.common.base.CaseFormat;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.Parameter;
import springfox.documentation.service.ResolvedMethodParameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.spi.service.contexts.OperationContext;
import springfox.documentation.spi.service.contexts.ParameterContext;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 构建操作接口参数对象的插件。
*
* @author Jerry
* @date 2020-09-24
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE + 102)
@ConditionalOnProperty(prefix = "swagger", name = "enabled")
public class DynamicBodyParameterBuilder implements OperationBuilderPlugin {
@Override
public void apply(OperationContext context) {
List<ResolvedMethodParameter> methodParameters = context.getParameters();
List<Parameter> parameters = new ArrayList<>();
if (CollectionUtils.isNotEmpty(methodParameters)) {
List<ResolvedMethodParameter> bodyParameter = methodParameters.stream()
.filter(p -> p.hasParameterAnnotation(MyRequestBody.class)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(bodyParameter)) {
//构造model
String groupName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, context.getGroupName());
String clazzName = groupName + StringUtils.capitalize(context.getName());
ResolvedMethodParameter methodParameter = bodyParameter.get(0);
ParameterContext parameterContext = new ParameterContext(methodParameter,
new ParameterBuilder(),
context.getDocumentationContext(),
context.getGenericsNamingStrategy(),
context);
Parameter parameter = parameterContext.parameterBuilder()
.parameterType("body").modelRef(new ModelRef(clazzName)).name(clazzName).build();
parameters.add(parameter);
}
}
context.operationBuilder().parameters(parameters);
}
@Override
public boolean supports(DocumentationType delimiter) {
return delimiter == DocumentationType.SWAGGER_2;
}
}

View File

@@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.orange.demo.common.swagger.config.SwaggerAutoConfiguration

View File

@@ -14,6 +14,5 @@
<modules>
<module>common-core</module>
<module>common-sequence</module>
<module>common-swagger</module>
</modules>
</project>

View File

@@ -34,9 +34,6 @@
<mybatis-generator.version>1.3.7</mybatis-generator.version>
<pagehelper.version>1.2.13</pagehelper.version>
<qdox.version>2.0.0</qdox.version>
<knife4j.version>2.0.5</knife4j.version>
<springfox.version>2.9.2</springfox.version>
<swagger.version>1.5.21</swagger.version>
</properties>
<modules>

View File

@@ -163,16 +163,16 @@ userId|Long|true|指定对象主键Id。
## 业务应用模块
### AreaCodeController
#### listDictAreaCode
- **URI:** /admin/app/areaCode/listDictAreaCode
#### listDict
- **URI:** /admin/app/areaCode/listDict
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**
Name|Type|Description
--|--|--
Authorization|String|身份验证的Token
#### listDictAreaCodeByParentId
- **URI:** /admin/app/areaCode/listDictAreaCodeByParentId
#### listDictByParentId
- **URI:** /admin/app/areaCode/listDictByParentId
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**
@@ -327,8 +327,8 @@ Parameter|Type|Required|Description
fieldName|String|true|上传文件名。
asImage|Boolean|true|是否作为图片上传。如果是图片,今后下载的时候无需权限验证。否则就是附件上传,下载时需要权限验证。
uploadFile|File|true|上传文件对象。
#### listDictCourse
- **URI:** /admin/app/course/listDictCourse
#### listDict
- **URI:** /admin/app/course/listDict
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**
@@ -476,8 +476,8 @@ Authorization|String|身份验证的Token
"gradeId" : "Integer | true | 删除对象主键Id。"
}
```
#### listDictGrade
- **URI:** /admin/app/grade/listDictGrade
#### listDict
- **URI:** /admin/app/grade/listDict
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**
@@ -584,8 +584,8 @@ Authorization|String|身份验证的Token
Parameter|Type|Required|Description
--|--|--|--
schoolId|Long|true|指定对象主键Id。
#### listDictSchoolInfo
- **URI:** /admin/app/schoolInfo/listDictSchoolInfo
#### listDict
- **URI:** /admin/app/schoolInfo/listDict
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**
@@ -1267,8 +1267,8 @@ Authorization|String|身份验证的Token
Parameter|Type|Required|Description
--|--|--|--
studentId|Long|true|指定对象主键Id。
#### listDictStudent
- **URI:** /admin/app/student/listDictStudent
#### listDict
- **URI:** /admin/app/student/listDict
- **Type:** GET
- **Content-Type:** multipart/form-data
- **Request-Headers:**

View File

@@ -15,7 +15,7 @@
"name": "AreaCodeController",
"item": [
{
"name": "listDictAreaCode",
"name": "listDict",
"request": {
"method": "GET",
"header": [
@@ -26,7 +26,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/areaCode/listDictAreaCode",
"raw": "http://{{host}}:8082//admin/app/areaCode/listDict",
"protocol": "http",
"host": [
"{{host}}"
@@ -36,14 +36,14 @@
"admin",
"app",
"areaCode",
"listDictAreaCode"
"listDict"
]
}
},
"response": []
},
{
"name": "listDictAreaCodeByParentId",
"name": "listDictByParentId",
"request": {
"method": "GET",
"header": [
@@ -54,7 +54,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/areaCode/listDictAreaCodeByParentId",
"raw": "http://{{host}}:8082//admin/app/areaCode/listDictByParentId",
"protocol": "http",
"host": [
"{{host}}"
@@ -64,7 +64,7 @@
"admin",
"app",
"areaCode",
"listDictAreaCodeByParentId"
"listDictByParentId"
],
"query": [
{
@@ -110,7 +110,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"course\" : {\n\t\t\"courseName\" : \"\",\n\t\t\"price\" : \"\",\n\t\t\"description\" : \"\",\n\t\t\"difficulty\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"subjectId\" : \"\",\n\t\t\"classHour\" : \"\",\n\t\t\"pictureUrl\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"course\" : {\n\t\t\"courseName\" : \"\",\n\t\t\"price\" : \"\",\n\t\t\"description\" : \"\",\n\t\t\"difficulty\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"subjectId\" : \"0\",\n\t\t\"classHour\" : \"0\",\n\t\t\"pictureUrl\" : \"\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -147,7 +147,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"course\" : {\n\t\t\"courseId\" : \"\",\n\t\t\"courseName\" : \"\",\n\t\t\"price\" : \"\",\n\t\t\"description\" : \"\",\n\t\t\"difficulty\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"subjectId\" : \"\",\n\t\t\"classHour\" : \"\",\n\t\t\"pictureUrl\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"course\" : {\n\t\t\"courseId\" : \"0\",\n\t\t\"courseName\" : \"\",\n\t\t\"price\" : \"\",\n\t\t\"description\" : \"\",\n\t\t\"difficulty\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"subjectId\" : \"0\",\n\t\t\"classHour\" : \"0\",\n\t\t\"pictureUrl\" : \"\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -360,7 +360,7 @@
"response": []
},
{
"name": "listDictCourse",
"name": "listDict",
"request": {
"method": "GET",
"header": [
@@ -371,7 +371,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/course/listDictCourse",
"raw": "http://{{host}}:8082//admin/app/course/listDict",
"protocol": "http",
"host": [
"{{host}}"
@@ -381,7 +381,7 @@
"admin",
"app",
"course",
"listDictCourse"
"listDict"
],
"query": [
{
@@ -623,7 +623,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"grade\" : {\n\t\t\"gradeId\" : \"\",\n\t\t\"gradeName\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"grade\" : {\n\t\t\"gradeId\" : \"0\",\n\t\t\"gradeName\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -671,7 +671,7 @@
"response": []
},
{
"name": "listDictGrade",
"name": "listDict",
"request": {
"method": "GET",
"header": [
@@ -682,7 +682,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/grade/listDictGrade",
"raw": "http://{{host}}:8082//admin/app/grade/listDict",
"protocol": "http",
"host": [
"{{host}}"
@@ -692,7 +692,7 @@
"admin",
"app",
"grade",
"listDictGrade"
"listDict"
]
}
},
@@ -760,7 +760,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"schoolInfo\" : {\n\t\t\"schoolName\" : \"\",\n\t\t\"provinceId\" : \"\",\n\t\t\"cityId\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"schoolInfo\" : {\n\t\t\"schoolName\" : \"\",\n\t\t\"provinceId\" : \"0\",\n\t\t\"cityId\" : \"0\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -797,7 +797,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"schoolInfo\" : {\n\t\t\"schoolId\" : \"\",\n\t\t\"schoolName\" : \"\",\n\t\t\"provinceId\" : \"\",\n\t\t\"cityId\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"schoolInfo\" : {\n\t\t\"schoolId\" : \"0\",\n\t\t\"schoolName\" : \"\",\n\t\t\"provinceId\" : \"0\",\n\t\t\"cityId\" : \"0\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -916,7 +916,7 @@
"response": []
},
{
"name": "listDictSchoolInfo",
"name": "listDict",
"request": {
"method": "GET",
"header": [
@@ -927,7 +927,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/schoolInfo/listDictSchoolInfo",
"raw": "http://{{host}}:8082//admin/app/schoolInfo/listDict",
"protocol": "http",
"host": [
"{{host}}"
@@ -937,7 +937,7 @@
"admin",
"app",
"schoolInfo",
"listDictSchoolInfo"
"listDict"
],
"query": [
{
@@ -1110,7 +1110,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"studentActionTrans\" : {\n\t\t\"studentId\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"actionType\" : \"\",\n\t\t\"deviceType\" : \"\",\n\t\t\"watchVideoSeconds\" : \"\",\n\t\t\"flowerCount\" : \"\",\n\t\t\"paperCount\" : \"\",\n\t\t\"videoCount\" : \"\",\n\t\t\"courseCount\" : \"\",\n\t\t\"coinCount\" : \"\",\n\t\t\"exerciseCorrectFlag\" : \"\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"studentActionTrans\" : {\n\t\t\"studentId\" : \"0\",\n\t\t\"studentName\" : \"\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"actionType\" : \"0\",\n\t\t\"deviceType\" : \"0\",\n\t\t\"watchVideoSeconds\" : \"0\",\n\t\t\"flowerCount\" : \"0\",\n\t\t\"paperCount\" : \"0\",\n\t\t\"videoCount\" : \"0\",\n\t\t\"courseCount\" : \"0\",\n\t\t\"coinCount\" : \"0\",\n\t\t\"exerciseCorrectFlag\" : \"0\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1147,7 +1147,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"studentActionTrans\" : {\n\t\t\"transId\" : \"\",\n\t\t\"studentId\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"actionType\" : \"\",\n\t\t\"deviceType\" : \"\",\n\t\t\"watchVideoSeconds\" : \"\",\n\t\t\"flowerCount\" : \"\",\n\t\t\"paperCount\" : \"\",\n\t\t\"videoCount\" : \"\",\n\t\t\"courseCount\" : \"\",\n\t\t\"coinCount\" : \"\",\n\t\t\"exerciseCorrectFlag\" : \"\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"studentActionTrans\" : {\n\t\t\"transId\" : \"0\",\n\t\t\"studentId\" : \"0\",\n\t\t\"studentName\" : \"\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"actionType\" : \"0\",\n\t\t\"deviceType\" : \"0\",\n\t\t\"watchVideoSeconds\" : \"0\",\n\t\t\"flowerCount\" : \"0\",\n\t\t\"paperCount\" : \"0\",\n\t\t\"videoCount\" : \"0\",\n\t\t\"courseCount\" : \"0\",\n\t\t\"coinCount\" : \"0\",\n\t\t\"exerciseCorrectFlag\" : \"0\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1299,7 +1299,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"studentClass\" : {\n\t\t\"className\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"leaderId\" : \"\",\n\t\t\"finishClassHour\" : \"\",\n\t\t\"classLevel\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"studentClass\" : {\n\t\t\"className\" : \"\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"leaderId\" : \"0\",\n\t\t\"finishClassHour\" : \"0\",\n\t\t\"classLevel\" : \"0\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1336,7 +1336,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"studentClass\" : {\n\t\t\"classId\" : \"\",\n\t\t\"className\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"leaderId\" : \"\",\n\t\t\"finishClassHour\" : \"\",\n\t\t\"classLevel\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"studentClass\" : {\n\t\t\"classId\" : \"0\",\n\t\t\"className\" : \"\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"leaderId\" : \"0\",\n\t\t\"finishClassHour\" : \"0\",\n\t\t\"classLevel\" : \"0\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1555,7 +1555,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"classId\" : \"\",\n\t\"classCourseList\" : [\n\t\t{\n\t\t\t\"classId\" : \"\",\n\t\t\t\"courseId\" : \"\",\n\t\t\t\"courseOrder\" : \"\"\n\t\t}\n\t]\n}\n",
"raw": "{\n\t\"classId\" : \"\",\n\t\"classCourseList\" : [\n\t\t{\n\t\t\t\"classId\" : \"0\",\n\t\t\t\"courseId\" : \"0\",\n\t\t\t\"courseOrder\" : \"0\"\n\t\t}\n\t]\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1592,7 +1592,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"classCourse\" : {\n\t\t\"classId\" : \"\",\n\t\t\"courseId\" : \"\",\n\t\t\"courseOrder\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"classCourse\" : {\n\t\t\"classId\" : \"0\",\n\t\t\"courseId\" : \"0\",\n\t\t\"courseOrder\" : \"0\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1778,7 +1778,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"classId\" : \"\",\n\t\"classStudentList\" : [\n\t\t{\n\t\t\t\"classId\" : \"\",\n\t\t\t\"studentId\" : \"\"\n\t\t}\n\t]\n}\n",
"raw": "{\n\t\"classId\" : \"\",\n\t\"classStudentList\" : [\n\t\t{\n\t\t\t\"classId\" : \"0\",\n\t\t\t\"studentId\" : \"0\"\n\t\t}\n\t]\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1859,7 +1859,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"student\" : {\n\t\t\"loginMobile\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"provinceId\" : \"\",\n\t\t\"cityId\" : \"\",\n\t\t\"districtId\" : \"\",\n\t\t\"gender\" : \"\",\n\t\t\"birthday\" : \"\",\n\t\t\"experienceLevel\" : \"\",\n\t\t\"totalCoin\" : \"\",\n\t\t\"leftCoin\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"registerTime\" : \"\",\n\t\t\"status\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"student\" : {\n\t\t\"loginMobile\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"provinceId\" : \"0\",\n\t\t\"cityId\" : \"0\",\n\t\t\"districtId\" : \"0\",\n\t\t\"gender\" : \"0\",\n\t\t\"birthday\" : \"\",\n\t\t\"experienceLevel\" : \"0\",\n\t\t\"totalCoin\" : \"0\",\n\t\t\"leftCoin\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"registerTime\" : \"\",\n\t\t\"status\" : \"0\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -1896,7 +1896,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"student\" : {\n\t\t\"studentId\" : \"\",\n\t\t\"loginMobile\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"provinceId\" : \"\",\n\t\t\"cityId\" : \"\",\n\t\t\"districtId\" : \"\",\n\t\t\"gender\" : \"\",\n\t\t\"birthday\" : \"\",\n\t\t\"experienceLevel\" : \"\",\n\t\t\"totalCoin\" : \"\",\n\t\t\"leftCoin\" : \"\",\n\t\t\"gradeId\" : \"\",\n\t\t\"schoolId\" : \"\",\n\t\t\"registerTime\" : \"\",\n\t\t\"status\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"student\" : {\n\t\t\"studentId\" : \"0\",\n\t\t\"loginMobile\" : \"\",\n\t\t\"studentName\" : \"\",\n\t\t\"provinceId\" : \"0\",\n\t\t\"cityId\" : \"0\",\n\t\t\"districtId\" : \"0\",\n\t\t\"gender\" : \"0\",\n\t\t\"birthday\" : \"\",\n\t\t\"experienceLevel\" : \"0\",\n\t\t\"totalCoin\" : \"0\",\n\t\t\"leftCoin\" : \"0\",\n\t\t\"gradeId\" : \"0\",\n\t\t\"schoolId\" : \"0\",\n\t\t\"registerTime\" : \"\",\n\t\t\"status\" : \"0\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -2015,7 +2015,7 @@
"response": []
},
{
"name": "listDictStudent",
"name": "listDict",
"request": {
"method": "GET",
"header": [
@@ -2026,7 +2026,7 @@
}
],
"url": {
"raw": "http://{{host}}:8082//admin/app/student/listDictStudent",
"raw": "http://{{host}}:8082//admin/app/student/listDict",
"protocol": "http",
"host": [
"{{host}}"
@@ -2036,7 +2036,7 @@
"admin",
"app",
"student",
"listDictStudent"
"listDict"
],
"query": [
{
@@ -2145,7 +2145,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"sysUser\" : {\n\t\t\"loginName\" : \"\",\n\t\t\"password\" : \"\",\n\t\t\"showName\" : \"\",\n\t\t\"userType\" : \"\",\n\t\t\"headImageUrl\" : \"\",\n\t\t\"userStatus\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createUsername\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"sysUser\" : {\n\t\t\"loginName\" : \"\",\n\t\t\"password\" : \"\",\n\t\t\"showName\" : \"\",\n\t\t\"userType\" : \"0\",\n\t\t\"headImageUrl\" : \"\",\n\t\t\"userStatus\" : \"0\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createUsername\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -2182,7 +2182,7 @@
},
"body": {
"mode": "raw",
"raw": "{\n\t\"sysUser\" : {\n\t\t\"userId\" : \"\",\n\t\t\"loginName\" : \"\",\n\t\t\"password\" : \"\",\n\t\t\"showName\" : \"\",\n\t\t\"userType\" : \"\",\n\t\t\"headImageUrl\" : \"\",\n\t\t\"userStatus\" : \"\",\n\t\t\"createUserId\" : \"\",\n\t\t\"createUsername\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"raw": "{\n\t\"sysUser\" : {\n\t\t\"userId\" : \"0\",\n\t\t\"loginName\" : \"\",\n\t\t\"password\" : \"\",\n\t\t\"showName\" : \"\",\n\t\t\"userType\" : \"0\",\n\t\t\"headImageUrl\" : \"\",\n\t\t\"userStatus\" : \"0\",\n\t\t\"createUserId\" : \"0\",\n\t\t\"createUsername\" : \"\",\n\t\t\"createTime\" : \"\",\n\t\t\"updateTime\" : \"\"\n\t}\n}\n",
"options": {
"raw": {
"language": "json"
@@ -2355,7 +2355,7 @@
{
"listen": "test",
"script": {
"id": "c63506c1-46b6-4add-ab33-3b0080afd35f",
"id": "390e8f3a-76f0-477a-8ebd-5fd958d286d8",
"type": "text/javascript",
"exec": [
"pm.test(\"登录操作\", function () {",
@@ -2371,7 +2371,7 @@
{
"listen": "prerequest",
"script": {
"id": "8cd658df-8043-4d1d-889e-4aa5fd3ec4ae",
"id": "efe7a1c1-5f2b-433b-b235-0bf97a581840",
"type": "text/javascript",
"exec": [
""
@@ -2383,22 +2383,16 @@
"disableBodyPruning": true
},
"request": {
"method": "GET",
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "loginName",
"value": "admin",
"type": "text"
},
{
"key": "password",
"value": "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D",
"type": "text"
"mode": "raw",
"raw": "{\n \"loginName\":\"admin\",\n \"password\":\"IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D\"\n}",
"options": {
"raw": {
"language": "json"
}
]
}
},
"url": {
"raw": "http://{{host}}:8082/admin/upms/login/doLogin",
@@ -2457,19 +2451,13 @@
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "oldPass",
"value": "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D",
"type": "text"
},
{
"key": "newPass",
"value": "IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D",
"type": "text"
"mode": "raw",
"raw": "{\n \"oldPass\": \"IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D\",\n \"newPass\": \"IP3ccke3GhH45iGHB5qP9p7iZw6xUyj28Ju10rnBiPKOI35sc%2BjI7%2FdsjOkHWMfUwGYGfz8ik31HC2Ruk%2Fhkd9f6RPULTHj7VpFdNdde2P9M4mQQnFBAiPM7VT9iW3RyCtPlJexQ3nAiA09OqG%2F0sIf1kcyveSrulxembARDbDo%3D\"\n}",
"options": {
"raw": {
"language": "json"
}
]
}
},
"url": {
"raw": "http://{{host}}:8082/admin/upms/login/changePassword",