he2802 vor 3 Jahren
Ursprung
Commit
8e935985c2

+ 71 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamBeforeApplyController.java

@@ -0,0 +1,71 @@
+package com.zhongzheng.controller.exam;
+
+import java.util.List;
+import java.util.Arrays;
+
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyAddBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyQueryBo;
+import com.zhongzheng.modules.exam.service.IExamBeforeApplyService;
+import com.zhongzheng.modules.exam.vo.ExamBeforeApplyVo;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 前培绑定考试计划Controller
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Api(value = "前培绑定考试计划控制器", tags = {"前培绑定考试计划管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/exam/apply")
+public class ExamBeforeApplyController extends BaseController {
+
+    private final IExamBeforeApplyService iExamBeforeApplyService;
+
+    /**
+     * 查询前培绑定考试计划列表
+     */
+    @ApiOperation("查询前培绑定考试计划列表")
+    @PreAuthorize("@ss.hasPermi('system:apply:list')")
+    @GetMapping("/list")
+    public TableDataInfo<ExamBeforeApplyVo> list(ExamBeforeApplyQueryBo bo) {
+        startPage();
+        List<ExamBeforeApplyVo> list = iExamBeforeApplyService.queryList(bo);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 新增前培绑定考试计划
+     */
+    @ApiOperation("批量新增前培绑定考试计划")
+    @PreAuthorize("@ss.hasPermi('system:apply:add')")
+    @Log(title = "前培绑定考试计划", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody ExamBeforeApplyAddBo bo) {
+        return toAjax(iExamBeforeApplyService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+
+
+}

+ 5 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysLoginService.java

@@ -87,7 +87,11 @@ public class SysLoginService
 
             }
             // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
-            password = AES.decrypt(password,rsaPrivate);
+            if(password.length()>20){
+                password = AES.decrypt(password,rsaPrivate);
+            }
+            System.out.println(password);
+            System.out.println("密码");
             authentication = authenticationManager
                     .authenticate(new UsernamePasswordAuthenticationToken(username, password));
         }

+ 35 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamBeforeApplyAddBo.java

@@ -0,0 +1,35 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * 前培绑定考试计划添加对象 exam_before_apply
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Data
+@ApiModel("前培绑定考试计划添加对象")
+public class ExamBeforeApplyAddBo {
+
+    /** 前培ID */
+    @ApiModelProperty("前培ID")
+    private Long beforeId;
+    /** 添加时间 */
+    @ApiModelProperty("添加时间")
+    private Long createTime;
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+    /** 考试ID */
+    @ApiModelProperty("考试ID")
+    private Long applyId;
+    @ApiModelProperty("考试ID数组")
+    private List<Long> applyIds;
+}

+ 37 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamBeforeApplyEditBo.java

@@ -0,0 +1,37 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+/**
+ * 前培绑定考试计划编辑对象 exam_before_apply
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Data
+@ApiModel("前培绑定考试计划编辑对象")
+public class ExamBeforeApplyEditBo {
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long id;
+
+    /** 前培ID */
+    @ApiModelProperty("前培ID")
+    private Long beforeId;
+
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+
+
+    /** 考试ID */
+    @ApiModelProperty("考试ID")
+    private Long applyId;
+
+}

+ 45 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamBeforeApplyQueryBo.java

@@ -0,0 +1,45 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.zhongzheng.common.core.domain.BaseEntity;
+
+/**
+ * 前培绑定考试计划分页查询对象 exam_before_apply
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("前培绑定考试计划分页查询对象")
+public class ExamBeforeApplyQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** 前培ID */
+	@ApiModelProperty("前培ID")
+	private Long beforeId;
+	/** 考试ID */
+	@ApiModelProperty("考试ID")
+	private Long applyId;
+}

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamBeforeApply.java

@@ -0,0 +1,39 @@
+package com.zhongzheng.modules.exam.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.zhongzheng.common.annotation.Excel;
+
+/**
+ * 前培绑定考试计划对象 exam_before_apply
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("exam_before_apply")
+public class ExamBeforeApply implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 前培ID */
+    private Long beforeId;
+    /** 添加时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** 修改时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+    /** 考试ID */
+    private Long applyId;
+}

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamBeforeApplyMapper.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.exam.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.exam.domain.ExamBeforeApply;
+
+/**
+ * 前培绑定考试计划Mapper接口
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+public interface ExamBeforeApplyMapper extends BaseMapper<ExamBeforeApply> {
+
+}

+ 52 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamBeforeApplyService.java

@@ -0,0 +1,52 @@
+package com.zhongzheng.modules.exam.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyAddBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyEditBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyQueryBo;
+import com.zhongzheng.modules.exam.domain.ExamBeforeApply;
+import com.zhongzheng.modules.exam.vo.ExamBeforeApplyVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 前培绑定考试计划Service接口
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+public interface IExamBeforeApplyService extends IService<ExamBeforeApply> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	ExamBeforeApplyVo queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+	List<ExamBeforeApplyVo> queryList(ExamBeforeApplyQueryBo bo);
+
+	/**
+	 * 根据新增业务对象插入前培绑定考试计划
+	 * @param bo 前培绑定考试计划新增业务对象
+	 * @return
+	 */
+	Boolean insertByAddBo(ExamBeforeApplyAddBo bo);
+
+	/**
+	 * 根据编辑业务对象修改前培绑定考试计划
+	 * @param bo 前培绑定考试计划编辑业务对象
+	 * @return
+	 */
+	Boolean updateByEditBo(ExamBeforeApplyEditBo bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 109 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamBeforeApplyServiceImpl.java

@@ -0,0 +1,109 @@
+package com.zhongzheng.modules.exam.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import com.zhongzheng.modules.course.domain.CourseChapterSection;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyAddBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyEditBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeApplyQueryBo;
+import com.zhongzheng.modules.exam.domain.ExamBeforeApply;
+import com.zhongzheng.modules.exam.mapper.ExamBeforeApplyMapper;
+import com.zhongzheng.modules.exam.service.IExamBeforeApplyService;
+import com.zhongzheng.modules.exam.vo.ExamBeforeApplyVo;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.Page;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 前培绑定考试计划Service业务层处理
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Service
+public class ExamBeforeApplyServiceImpl extends ServiceImpl<ExamBeforeApplyMapper, ExamBeforeApply> implements IExamBeforeApplyService {
+
+    @Override
+    public ExamBeforeApplyVo queryById(Long id){
+        ExamBeforeApply db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, ExamBeforeApplyVo.class);
+    }
+
+    @Override
+    public List<ExamBeforeApplyVo> queryList(ExamBeforeApplyQueryBo bo) {
+        LambdaQueryWrapper<ExamBeforeApply> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getBeforeId() != null, ExamBeforeApply::getBeforeId, bo.getBeforeId());
+        lqw.eq(bo.getApplyId() != null, ExamBeforeApply::getApplyId, bo.getApplyId());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<ExamBeforeApplyVo> entity2Vo(Collection<ExamBeforeApply> collection) {
+        List<ExamBeforeApplyVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, ExamBeforeApplyVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<ExamBeforeApply> page = (Page<ExamBeforeApply>)collection;
+            Page<ExamBeforeApplyVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(ExamBeforeApplyAddBo bo) {
+        remove(new LambdaQueryWrapper<ExamBeforeApply>().eq(ExamBeforeApply::getBeforeId, bo.getBeforeId()));
+        Collection<ExamBeforeApply> coll = new HashSet<>();
+        for(Long applyId : bo.getApplyIds()){
+            ExamBeforeApply add = new ExamBeforeApply();
+            add.setBeforeId(bo.getBeforeId());
+            add.setApplyId(applyId);
+            add.setCreateTime(DateUtils.getNowTime());
+            add.setUpdateTime(DateUtils.getNowTime());
+            coll.add(add);
+        }
+        return saveBatch(coll);
+    }
+
+    @Override
+    public Boolean updateByEditBo(ExamBeforeApplyEditBo bo) {
+        ExamBeforeApply update = BeanUtil.toBean(bo, ExamBeforeApply.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(ExamBeforeApply entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+}

+ 35 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamBeforeApplyVo.java

@@ -0,0 +1,35 @@
+package com.zhongzheng.modules.exam.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 前培绑定考试计划视图对象 mall_package
+ *
+ * @author hjl
+ * @date 2022-05-19
+ */
+@Data
+@ApiModel("前培绑定考试计划视图对象")
+public class ExamBeforeApplyVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** 前培ID */
+	@Excel(name = "前培ID")
+	@ApiModelProperty("前培ID")
+	private Long beforeId;
+	/** 考试ID */
+	@Excel(name = "考试ID")
+	@ApiModelProperty("考试ID")
+	private Long applyId;
+}

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -37,7 +37,7 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
 
     List<OrderGoodsVo> rebuyInfo(OrderGoodsQueryBo bo);
 
-
+    Boolean closeOrderGoods(OrderGoodsQueryBo bo);
     /**
      * 根据新增业务对象插入订单商品
      *

+ 17 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -114,6 +114,23 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         return this.baseMapper.rebuyInfo(bo);
     }
 
+    /**
+     * 关闭订单
+     * @param bo
+     * @return
+     */
+    @Override
+    public Boolean closeOrderGoods(OrderGoodsQueryBo bo) {
+        if(Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("参数错误");
+        }
+        OrderGoods db = this.baseMapper.selectById(bo.getOrderGoodsId());
+        if(db.getStatus()==0){
+            throw new CustomException("无法操作");
+        }
+        return false;
+    }
+
     /**
      * 实体类转化成视图对象
      *

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamBeforeApplyMapper.xml

@@ -0,0 +1,16 @@
+<?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.zhongzheng.modules.exam.mapper.ExamBeforeApplyMapper">
+
+    <resultMap type="com.zhongzheng.modules.exam.domain.ExamBeforeApply" id="ExamBeforeApplyResult">
+        <result property="id" column="id"/>
+        <result property="beforeId" column="before_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="applyId" column="apply_id"/>
+    </resultMap>
+
+
+</mapper>