he2802 3 gadi atpakaļ
vecāks
revīzija
142e5b11e5

+ 11 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseChapterController.java

@@ -94,6 +94,17 @@ public class CourseChapterController extends BaseController {
         return AjaxResult.success(iCourseChapterService.insertByAddBo(bo));
     }
 
+    /**
+     * 新增课程大章
+     */
+    @ApiOperation("批量新增课程大章")
+    @PreAuthorize("@ss.hasPermi('system:chapter:add')")
+    @Log(title = "课程大章", businessType = BusinessType.INSERT)
+    @PostMapping("/addMore")
+    public AjaxResult<List<Long>> addMore(@RequestBody List<CourseChapterAddBo> list) {
+        return AjaxResult.success(iCourseChapterService.insertByAddBoMore(list));
+    }
+
     /**
      * 修改课程大章
      */

+ 3 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/base/LockController.java

@@ -50,7 +50,7 @@ public class LockController extends BaseController {
     public AjaxResult<Void> lockAction(@Validated @RequestBody ActionLockQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         String key = "LockAppAction_"+bo.getAction()+"-"+loginUser.getUser().getUserId();
-        redisCache.setCacheObject(key, bo.getAction(),13, TimeUnit.SECONDS);//13秒锁定
+        redisCache.setCacheObject(key, bo.getUuid(),13, TimeUnit.SECONDS);//13秒锁定
         return AjaxResult.success();
     }
 
@@ -64,8 +64,8 @@ public class LockController extends BaseController {
     public AjaxResult<Void> lockStatus(@RequestBody ActionLockQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         String key = "LockAppAction_"+bo.getAction()+"-"+loginUser.getUser().getUserId();
-        String action = redisCache.getCacheObject(key);
-        if(Validator.isEmpty(action)){
+        String uuid = redisCache.getCacheObject(key);
+        if(Validator.isEmpty(uuid)||uuid.equals(bo.getUuid())){
             return AjaxResult.error("无其他端在操作");
         }else{
             return AjaxResult.success("有其他端在操作");

+ 195 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DoubleUtils.java

@@ -0,0 +1,195 @@
+package com.zhongzheng.common.utils;
+
+import java.math.BigDecimal;
+
+public class DoubleUtils {
+    // 默认除法运算精度
+    private static final Integer DEF_DIV_SCALE = 2;
+
+    /**
+     * 提供精确的加法运算。
+     *
+     * @param value1
+     *            被加数
+     * @param value2
+     *            加数
+     * @return 两个参数的和
+     */
+    public static Double add(Number value1, Number value2) {
+        return add(value1, value2, DEF_DIV_SCALE);
+    }
+
+    /**
+     * 提供精确的加法运算。
+     *
+     * @param value1
+     *            被加数
+     * @param value2
+     *            加数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     * @return 两个参数的和
+     */
+    public static Double add(Number value1, Number value2, Integer scale) {
+        BigDecimal b1 = new BigDecimal(Double.toString(value1.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(value2.doubleValue()));
+        BigDecimal add = b1.add(b2);
+        BigDecimal setScale = add.setScale(scale, BigDecimal.ROUND_HALF_UP);
+        return setScale.doubleValue();
+    }
+
+    /**
+     * 提供精确的减法运算。
+     *
+     * @param value1
+     *            被减数
+     * @param value2
+     *            减数
+     * @return
+     */
+    public static Double sub(Number value1, Number value2) {
+        return sub(value1, value2, DEF_DIV_SCALE);
+    }
+
+    /**
+     *
+     * @param value1
+     *            被减数
+     * @param value2
+     *            减数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     * @return 两个参数的差
+     */
+    public static Double sub(Number value1, Number value2, Integer scale) {
+        BigDecimal b1 = new BigDecimal(Double.toString(value1.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(value2.doubleValue()));
+        BigDecimal subtract = b1.subtract(b2);
+        BigDecimal setScale = subtract.setScale(scale, BigDecimal.ROUND_HALF_UP);
+        return setScale.doubleValue();
+    }
+
+    /**
+     * 提供精确的乘法运算。
+     *
+     * @param value1
+     *            被乘数
+     * @param value2
+     *            乘数
+     * @return 两个参数的积
+     */
+    public static Double mul(Number value1, Number value2) {
+        return mul(value1, value2, DEF_DIV_SCALE);
+    }
+
+    /**
+     * 提供精确的乘法运算。
+     *
+     * @param value1
+     *            被乘数
+     * @param value2
+     *            乘数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     * @return 两个参数的积
+     */
+    public static Double mul(Number value1, Number value2, Integer scale) {
+        BigDecimal b1 = new BigDecimal(Double.toString(value1.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(value2.doubleValue()));
+        BigDecimal multiply = b1.multiply(b2);
+        BigDecimal setScale = multiply.setScale(scale, BigDecimal.ROUND_HALF_UP);
+        return setScale.doubleValue();
+    }
+
+    /**
+     * 提供精确的乘法运算。
+     *
+     * @param value1
+     *            被乘数
+     * @param value2
+     *            乘数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     *
+     * @return 两个参数的积
+     */
+    public static Double mul(Number value1, Number value2, int scale, int roundingMode) {
+        BigDecimal b1 = new BigDecimal(Double.toString(value1.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(value2.doubleValue()));
+        BigDecimal multiply = b1.multiply(b2);
+        BigDecimal setScale = multiply.setScale(scale, roundingMode);
+        return setScale.doubleValue();
+    }
+
+    /**
+     * 提供(相对)精确的除法运算,当发生除不尽的情况时, 精确到小数点以后2位,以后的数字四舍五入。
+     *
+     * @param dividend
+     *            被除数
+     * @param divisor
+     *            除数
+     * @return 两个参数的商
+     */
+    public static Double div(Number dividend, Number divisor) {
+        return DoubleUtils.div(dividend, divisor, DEF_DIV_SCALE);
+    }
+
+    /**
+     * 提供(相对)精确的除法运算。 当发生除不尽的情况时,由scale参数指定精度,以后的数字四舍五入。
+     *
+     * @param dividend
+     *            被除数
+     * @param divisor
+     *            除数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     * @return 两个参数的商
+     */
+    public static Double div(Number dividend, Number divisor, Integer scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        BigDecimal b1 = new BigDecimal(Double.toString(dividend.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(divisor.doubleValue()));
+        return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+    /**
+     * 提供(相对)精确的除法运算。 当发生除不尽的情况时,由scale参数指定精度,以后的数字四舍五入。
+     *
+     * @param dividend
+     *            被除数
+     * @param divisor
+     *            除数
+     * @param scale
+     *            表示需要精确到小数点以后几位。
+     * @return 两个参数的商
+     */
+    public static Double div(Number dividend, Number divisor, Integer scale, int roundingMode) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        BigDecimal b1 = new BigDecimal(Double.toString(dividend.doubleValue()));
+        BigDecimal b2 = new BigDecimal(Double.toString(divisor.doubleValue()));
+        return b1.divide(b2, scale, roundingMode).doubleValue();
+    }
+
+    /**
+     * 提供精确的小数位四舍五入处理。
+     *
+     * @param value
+     *            需要四舍五入的数字
+     * @param scale
+     *            小数点后保留几位
+     * @return 四舍五入后的结果
+     */
+    public static Double round(Double value, Integer scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        BigDecimal b = new BigDecimal(Double.toString(value));
+        BigDecimal one = new BigDecimal("1");
+        return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+}

+ 7 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java

@@ -9,6 +9,9 @@ import java.util.Iterator;
 import java.util.Random;
 
 public class ToolsUtils {
+
+    public static final int EMU_PER_PX = 9525;
+
     /**
      * 获取模块编码参数
      */
@@ -36,4 +39,8 @@ public class ToolsUtils {
         }
         return sb.toString();
     }
+
+    public static final int emuToPx(double emu) {
+        return DoubleUtils.div(emu, EMU_PER_PX).intValue();
+    }
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -210,6 +210,9 @@ public class OssServiceImpl implements OssService {
             case 7:
                 RandomFilename = "certificate" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
                 break;
+            case 8:
+                RandomFilename = "question" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
         }
 
         return RandomFilename;
@@ -270,7 +273,7 @@ public class OssServiceImpl implements OssService {
     private String uploadInputStreamAction(InputStream inputStream, Integer imageStatus) throws Exception {
         try {
             OssRequest ossRequest = new OssRequest();
-            ossRequest.setImageStatus(7);
+            ossRequest.setImageStatus(imageStatus);
             String fileName = generateRandomFilename(ossRequest) + ".jpg";
 
             //调用oss方法实现上传

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 414 - 339
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java


+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/QuestionImport.java

@@ -38,6 +38,9 @@ public class QuestionImport implements Serializable {
     @Excel(name = "题目类型")
     private String type;
 
+    @Excel(name = "是否案例小题")
+    private String attached;
+
     @Excel(name = "正确答案")
     private String answerQuestion;
 

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ActionLockQueryBo.java

@@ -25,4 +25,7 @@ public class ActionLockQueryBo extends BaseEntity {
 	@NotBlank(message = "行为不能为空")
 	private String action;
 
+	@ApiModelProperty("识别号")
+	private String uuid;
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterService.java

@@ -39,6 +39,8 @@ public interface ICourseChapterService extends IService<CourseChapter> {
 	 */
 	Long insertByAddBo(CourseChapterAddBo bo);
 
+	List<Long> insertByAddBoMore(List<CourseChapterAddBo> list);
+
 	/**
 	 * 根据编辑业务对象修改课程大章
 	 * @param bo 课程大章编辑业务对象

+ 10 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -23,10 +23,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -131,6 +128,15 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
         return add.getChapterId();
     }
 
+    @Override
+    public List<Long> insertByAddBoMore(List<CourseChapterAddBo> list) {
+        List<Long> ids = new ArrayList<>();
+        for(CourseChapterAddBo bo : list){
+            ids.add(insertByAddBo(bo));
+        }
+        return ids;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(CourseChapterEditBo bo) {

+ 6 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -263,7 +263,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //订单商品
             Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
             if (goods.getGoodsStatus() != 1) {
-                throw new CustomException("商品尚未上架");
+                throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
             }
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
@@ -398,7 +398,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //订单商品
             Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
             if (goods.getGoodsStatus() != 1) {
-                throw new CustomException("商品尚未上架", 510);
+                throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单", 510);
             }
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
@@ -570,7 +570,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //订单商品
             Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
             if (goods.getGoodsStatus() != 1) {
-                throw new CustomException("商品尚未上架");
+                throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
             }
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
@@ -713,7 +713,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //订单商品
             Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
             if (goods.getGoodsStatus() != 1) {
-                throw new CustomException("商品尚未上架");
+                throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
             }
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
@@ -853,7 +853,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             for (OrderGoods g : goodsList) {
                 Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
                 if (goods.getGoodsStatus() != 1) {
-                    throw new CustomException("商品尚未上架");
+                    throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
                 }
                 body = "中正祥粤云-" + goods.getGoodsName();
                 break;
@@ -969,7 +969,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             for (OrderGoods g : goodsList) {
                 Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, g.getGoodsId()));
                 if (goods.getGoodsStatus() != 1) {
-                    throw new CustomException("商品尚未上架");
+                    throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单");
                 }
                 body = "中正祥粤云-" + goods.getGoodsName();
                 break;

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/tencentcloud/service/impl/FaceOcrServiceImpl.java

@@ -209,17 +209,16 @@ public class FaceOcrServiceImpl implements IFaceOcrService {
     @Override
     public Integer idCardCompareFace(FaceQueryBo bo) {
         try{
-            if(Validator.isEmpty(bo.getOrderGoodsId())){
-                throw new CustomException("缺少参数");
+            if(Validator.isEmpty(bo.getUrlA())||Validator.isEmpty(bo.getOneInchPhotos())){
+                throw new CustomException("参数错误");
             }
-
             String oneInchPhotos =bo.getOneInchPhotos();
             Credential cred = new Credential(SecretId, SecretKey);
             ClientProfile clientProfile = new ClientProfile();
             clientProfile.setSignMethod(clientProfile.SIGN_TC3_256);
             IaiClient iaiClient = new IaiClient(cred,"ap-guangzhou");
             CompareFaceRequest faceRequest = new CompareFaceRequest();
-            faceRequest.setUrlA(ossHost+"/"+bo.getImageA()); //身份证照片OSS URL
+            faceRequest.setUrlA(ossHost+"/"+bo.getUrlA()); //身份证照片OSS URL
             faceRequest.setImageB(oneInchPhotos); //一寸近照
             CompareFaceResponse response = iaiClient.CompareFace(faceRequest);
             return response.getScore().intValue();

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -207,7 +207,7 @@
         </if>
         GROUP BY
         q.question_id
-        ORDER BY q.create_time DESC,q.import_sort
+        ORDER BY q.question_id DESC
     </select>
 
     <select id="selectList_COUNT" resultType="Long">

+ 2 - 1
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -82,7 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         GROUP BY
         e.exam_id
-
+        ORDER BY
+        e.create_time desc
     </select>
 
     <select id="selectExamQuestionList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="QuestionResultVo">

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels