新增:学生管理模块
This commit is contained in:
@@ -0,0 +1,115 @@
|
|||||||
|
package com.gxwebsoft.booking.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.booking.service.StudentService;
|
||||||
|
import com.gxwebsoft.booking.entity.Student;
|
||||||
|
import com.gxwebsoft.booking.param.StudentParam;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
@Api(tags = "学生管理管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/booking/student")
|
||||||
|
public class StudentController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private StudentService studentService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询学生管理")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<Student>> page(StudentParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(studentService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部学生管理")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<Student>> list(StudentParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(studentService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('booking:student:list')")
|
||||||
|
@ApiOperation("根据id查询学生管理")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<Student> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(studentService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加学生管理")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody Student student) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
student.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
if (studentService.save(student)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改学生管理")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody Student student) {
|
||||||
|
if (studentService.updateById(student)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除学生管理")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (studentService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加学生管理")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<Student> list) {
|
||||||
|
if (studentService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改学生管理")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<Student> batchParam) {
|
||||||
|
if (batchParam.update(studentService, "student_id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除学生管理")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (studentService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.gxwebsoft.booking.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "Student对象", description = "学生管理")
|
||||||
|
@TableName("booking_student")
|
||||||
|
public class Student implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@TableId(value = "student_id", type = IdType.AUTO)
|
||||||
|
private Integer studentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学生姓名")
|
||||||
|
private String studentName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学生头像")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "老师介绍")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "性别")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出生年月")
|
||||||
|
private LocalDate birthday;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "证件号码")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "服装尺寸")
|
||||||
|
private String clothingSize;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "身高")
|
||||||
|
private String height;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体重")
|
||||||
|
private String weight;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关联家长ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.booking.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.booking.entity.Student;
|
||||||
|
import com.gxwebsoft.booking.param.StudentParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
public interface StudentMapper extends BaseMapper<Student> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Student>
|
||||||
|
*/
|
||||||
|
List<Student> selectPageRel(@Param("page") IPage<Student> page,
|
||||||
|
@Param("param") StudentParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<Student> selectListRel(@Param("param") StudentParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.gxwebsoft.booking.mapper.StudentMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM booking_student a
|
||||||
|
<where>
|
||||||
|
<if test="param.studentId != null">
|
||||||
|
AND a.student_id = #{param.studentId}
|
||||||
|
</if>
|
||||||
|
<if test="param.phone != null">
|
||||||
|
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.studentName != null">
|
||||||
|
AND a.student_name LIKE CONCAT('%', #{param.studentName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.image != null">
|
||||||
|
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.content != null">
|
||||||
|
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.sex != null">
|
||||||
|
AND a.sex = #{param.sex}
|
||||||
|
</if>
|
||||||
|
<if test="param.birthday != null">
|
||||||
|
AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.idCard != null">
|
||||||
|
AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.clothingSize != null">
|
||||||
|
AND a.clothing_size LIKE CONCAT('%', #{param.clothingSize}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.height != null">
|
||||||
|
AND a.height LIKE CONCAT('%', #{param.height}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.weight != null">
|
||||||
|
AND a.weight LIKE CONCAT('%', #{param.weight}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.merchantId != null">
|
||||||
|
AND a.merchant_id = #{param.merchantId}
|
||||||
|
</if>
|
||||||
|
<if test="param.comments != null">
|
||||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.status != null">
|
||||||
|
AND a.status = #{param.status}
|
||||||
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Student">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Student">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.gxwebsoft.booking.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "StudentParam对象", description = "学生管理查询参数")
|
||||||
|
public class StudentParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer studentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学生姓名")
|
||||||
|
private String studentName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学生头像")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "老师介绍")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "性别")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出生年月")
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "证件号码")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "服装尺寸")
|
||||||
|
private String clothingSize;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "身高")
|
||||||
|
private String height;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "体重")
|
||||||
|
private String weight;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关联家长ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer merchantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.booking.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.booking.entity.Student;
|
||||||
|
import com.gxwebsoft.booking.param.StudentParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
public interface StudentService extends IService<Student> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<Student>
|
||||||
|
*/
|
||||||
|
PageResult<Student> pageRel(StudentParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Student>
|
||||||
|
*/
|
||||||
|
List<Student> listRel(StudentParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param studentId ID
|
||||||
|
* @return Student
|
||||||
|
*/
|
||||||
|
Student getByIdRel(Integer studentId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.booking.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.booking.mapper.StudentMapper;
|
||||||
|
import com.gxwebsoft.booking.service.StudentService;
|
||||||
|
import com.gxwebsoft.booking.entity.Student;
|
||||||
|
import com.gxwebsoft.booking.param.StudentParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学生管理Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-06-08 23:37:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<Student> pageRel(StudentParam param) {
|
||||||
|
PageParam<Student, StudentParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
List<Student> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Student> listRel(StudentParam param) {
|
||||||
|
List<Student> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<Student, StudentParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Student getByIdRel(Integer studentId) {
|
||||||
|
StudentParam param = new StudentParam();
|
||||||
|
param.setStudentId(studentId);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,11 +4,15 @@ import cn.hutool.core.date.DateField;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.gxwebsoft.booking.entity.UserCard;
|
import com.gxwebsoft.booking.entity.UserCard;
|
||||||
import com.gxwebsoft.booking.service.UserCardService;
|
import com.gxwebsoft.booking.service.UserCardService;
|
||||||
|
import com.gxwebsoft.cms.entity.Website;
|
||||||
|
import com.gxwebsoft.cms.entity.WebsiteField;
|
||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.shop.entity.Order;
|
import com.gxwebsoft.shop.entity.Order;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import com.gxwebsoft.booking.entity.UserCard;
|
|||||||
import com.gxwebsoft.booking.entity.UserCardLog;
|
import com.gxwebsoft.booking.entity.UserCardLog;
|
||||||
import com.gxwebsoft.booking.service.UserCardLogService;
|
import com.gxwebsoft.booking.service.UserCardLogService;
|
||||||
import com.gxwebsoft.booking.service.UserCardService;
|
import com.gxwebsoft.booking.service.UserCardService;
|
||||||
|
import com.gxwebsoft.cms.entity.Website;
|
||||||
|
import com.gxwebsoft.cms.entity.WebsiteField;
|
||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
@@ -277,7 +279,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
requestUtil.setTenantId(order.getTenantId().toString());
|
requestUtil.setTenantId(order.getTenantId().toString());
|
||||||
String api = "/system/user/updateUserBalance"; // 更新余额接口
|
String api = "/system/user/updateUserBalance"; // 更新余额接口
|
||||||
final BigDecimal subtract = loginUser.getBalance().subtract(order.getTotalPrice());
|
final BigDecimal subtract = loginUser.getBalance().subtract(order.getTotalPrice());
|
||||||
|
|
||||||
loginUser.setBalance(subtract);
|
loginUser.setBalance(subtract);
|
||||||
|
// 累加会员积分
|
||||||
|
String key = "SiteInfo:" + order.getTenantId();
|
||||||
|
final String siteInfo = redisUtil.get(key);
|
||||||
|
// 从缓存读取信息
|
||||||
|
if(StrUtil.isNotBlank(siteInfo)){
|
||||||
|
final Website website = JSONObject.parseObject(siteInfo, Website.class);
|
||||||
|
final List<WebsiteField> fields = website.getFields();
|
||||||
|
fields.forEach(d -> {
|
||||||
|
if(d.getName().equals("integral_enabled") && d.getValue().equals("1")){
|
||||||
|
loginUser.setPoints(loginUser.getPoints() + order.getPayPrice().intValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
final ApiResult<?> apiResult = requestUtil.updateUserBalance(api, loginUser);
|
final ApiResult<?> apiResult = requestUtil.updateUserBalance(api, loginUser);
|
||||||
if (apiResult.getCode().equals(0)) {
|
if (apiResult.getCode().equals(0)) {
|
||||||
// 记录余额明细
|
// 记录余额明细
|
||||||
|
|||||||
@@ -62,8 +62,9 @@ public class BookingGenerator {
|
|||||||
// "booking_user_card",
|
// "booking_user_card",
|
||||||
// "booking_user_card_log",
|
// "booking_user_card_log",
|
||||||
// "booking_item",
|
// "booking_item",
|
||||||
"booking_course",
|
// "booking_course",
|
||||||
"booking_course_category"
|
// "booking_course_category",
|
||||||
|
"booking_student"
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user