Browse Source

fix 人脸比照 下架文案

he2802 3 years ago
parent
commit
6c9704c45a

+ 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));
+    }
+
     /**
      * 修改课程大章
      */

+ 38 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -228,7 +228,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return this.removeByIds(ids);
     }
 
+
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public List<QuestionImport> importQuestion(List<QuestionImport> questionList, Boolean isUpdateSupport, String operName) {
         if (Validator.isNull(questionList) || questionList.size() == 0) {
             throw new CustomException("导入数据不能为空!");
@@ -238,6 +240,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         int i = 1;
         Long nowTime = DateUtils.getNowTime();
         List<QuestionImport> errorList = new ArrayList<>();
+        Collections.reverse(questionList);
+        //案例附属题数组
+        List<QuestionAddBo> attList = new ArrayList<>();
         for (QuestionImport question : questionList) {
             QuestionAddBo bo = new QuestionAddBo();
 
@@ -252,6 +257,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 errorList.add(question);
                 continue;
             }
+            if(Validator.isEmpty(question.getAttached())){
+                question.setCause("是否案例小题错误");
+                errorList.add(question);
+                continue;
+            }
            /* if(!Validator.isNotEmpty(question.getPrefixName())){
                 errorLog+=question.getContent()+"-前缀名称空白\n";
                 continue;
@@ -266,28 +276,28 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             List<QuestionBusinessAddBo> businessList = new ArrayList<>();
             QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
             Long eduId = findEduId(question.getEducationType());
-            if (!Validator.isNotEmpty(eduId)) {
+            if (question.getAttached().equals("否")&&!Validator.isNotEmpty(eduId)) {
                 //         errorLog+=question.getEducationType()+"-该教育类型不存在\n";
                 question.setCause("教育类型不存在");
                 errorList.add(question);
                 continue;
             }
             Long projectId = findProjectId(question.getProject(), eduId);
-            if (!Validator.isNotEmpty(projectId)) {
+            if (question.getAttached().equals("否")&&!Validator.isNotEmpty(projectId)) {
                 //        errorLog+=question.getProject()+"-该项目类型不存在\n";
                 question.setCause("项目类型不存在");
                 errorList.add(question);
                 continue;
             }
             Long businessId = findBusinessId(question.getBusiness(), projectId);
-            if (!Validator.isNotEmpty(businessId)) {
+            if (question.getAttached().equals("否")&&!Validator.isNotEmpty(businessId)) {
                 //        errorLog+=question.getBusiness()+"-该业务层次不存在\n";
                 question.setCause("业务层次不存在");
                 errorList.add(question);
                 continue;
             }
             Long subjectId = findSubjectId(question.getSubject());
-            if (!Validator.isNotEmpty(subjectId)) {
+            if (question.getAttached().equals("否")&&!Validator.isNotEmpty(subjectId)) {
                 //        errorLog+=question.getSubject()+"-该科目不存在\n";
                 question.setCause("科目不存在");
                 errorList.add(question);
@@ -338,9 +348,31 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             bo.setPublishStatus(1);
             bo.setImportSort(nowTime + i); //导入时间从小到大排
             bo.setCreateTime(nowTime); //从大到小排
-            errorLog = insertByAddBoImport(bo, i);
+            System.out.println(question);
+            if (question.getAttached().equals("是")){
+                System.out.println("123");
+                attList.add(bo);
+            }else{
+                System.out.println(bo);
+                System.out.println("CCVF"+bo.getType());
+                if(bo.getType()==4){//案例题
+                    Collections.reverse(attList);
+                    System.out.println("777");
+                    bo.setJsonStr(JSON.toJSONString(attList));
+                    System.out.println("666");
+                    attList.clear();
+                }else {
+
+                    System.out.println(errorList);
+                    if(attList.size()>0){
+                        throw new CustomException("案例题格式错误");
+                    }
+                }
+                errorLog = insertByAddBoImport(bo, i);
+            }
             i++;
         }
+
         return errorList;
     }
 
@@ -490,6 +522,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                         }
                     }
                     content = dealTxt(content);
+                    System.out.println(content);
                     if (content.startsWith("#")||isQuestionStart(content)) {
                         if(nowPart>0){
                             //插入上一条

+ 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;
 

+ 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();