he2802 1 year ago
parent
commit
98d7274bc5

+ 2 - 0
zhongzheng-admin-saas/src/main/resources/application-dev.yml

@@ -190,6 +190,8 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
+    subscribeAddCertificate: http://192.168.1.7:9099/cd/exam/add/exam/result/certificate
     question: http://120.79.166.78:19013/common/question/getMeasureList
     questionDetail: http://120.79.166.78:19013/common/question/getTopicList
 

+ 1 - 0
zhongzheng-admin-saas/src/main/resources/application-pre.yml

@@ -186,6 +186,7 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
 
 ZsBank:
     publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=

+ 2 - 0
zhongzheng-admin/src/main/resources/application-dev.yml

@@ -191,6 +191,8 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
+    subscribeAddCertificate: http://192.168.1.7:9099/cd/exam/add/exam/result/certificate
     question: http://120.79.166.78:19013/common/question/getMeasureList
     questionDetail: http://120.79.166.78:19013/common/question/getTopicList
 

+ 1 - 1
zhongzheng-admin/src/main/resources/application-pre.yml

@@ -186,7 +186,7 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
-
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
 ZsBank:
     publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=
     privatekey: NBtl7WnuUtA2v5FaebEkU0/Jj1IodLGT6lQqwkzmd2E=

+ 2 - 0
zhongzheng-api/src/main/resources/application-dev.yml

@@ -193,6 +193,8 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
+    subscribeAddCertificate: http://192.168.1.7:9099/cd/exam/add/exam/result/certificate
     question: http://120.79.166.78:19013/common/question/getMeasureList
     questionDetail: http://120.79.166.78:19013/common/question/getTopicList
 

+ 1 - 0
zhongzheng-api/src/main/resources/application-pre.yml

@@ -186,6 +186,7 @@ exam:
     subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
     subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
     subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
 
 ZsBank:
     publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -64,6 +64,7 @@ import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodVo;
 import com.zhongzheng.modules.order.bo.SpecialQuestionBo;
+import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.vo.SpecialQuestionVo;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.system.domain.SysTenant;
@@ -151,6 +152,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
     @Autowired
     private IGoodsService iGoodsService;
     @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+    @Autowired
     private IGoodsQuestionRelService iGoodsQuestionRelService;
     @Autowired
     private IQuestionMerchantService iQuestionMerchantService;
@@ -1009,6 +1012,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             goodsUserVo.setPeriodStatus(classGradeVo.getPeriodStatus());
             goodsUserVo.setSignId(classGradeVo.getId());
             goodsUserVo.setOfficialStatus(classGradeVo.getOfficialStatus());
+
+            String businessName = iGoodsService.getGoodsBusinessName(goodsUserVo.getGoodsId());
+            if (businessName.contains("继续教育")){
+                goodsUserVo.setClassStatus(classGradeVo.getClassStatus());
+                goodsUserVo.setClassStartTime(classGradeVo.getClassStartTime());
+                goodsUserVo.setClassEndTime(classGradeVo.getClassEndTime());
+            }
         }
         return goodsUserVos;
     }

+ 30 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyCertificateBo.java

@@ -0,0 +1,30 @@
+package com.zhongzheng.modules.exam.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月20日 11:22
+ */
+@Data
+public class ExamApplyCertificateBo implements Serializable {
+
+    private String userName;
+
+    private String idCard;
+
+    /** 证书编号 */
+    private String certificateCode;
+    /** 发证时间 */
+    private Long certificateStartTime;
+    /** 到期时间 */
+    private Long certificateEndTime;
+    /** 证书下载地址 */
+    private String certificateUrl;
+
+    private String major;
+
+    private Long tenantId;
+}

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyResultExportBo.java

@@ -47,5 +47,13 @@ public class ExamApplyResultExportBo implements Serializable {
     @Excel(name = "证书编码")
     private String certificateCode;
 
+    private Long applyTime;
 
+    private String applyStartTime;
+
+    private String applyEndTime;
+
+    private String major;
+
+    private Long tenantId;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamActivity.java

@@ -48,4 +48,6 @@ private static final long serialVersionUID=1L;
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
 
+    private Long tenantId;
+
 }

+ 38 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamActivityServiceImpl.java

@@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
@@ -31,6 +35,8 @@ import com.zhongzheng.modules.mock.domain.MockMajor;
 import com.zhongzheng.modules.mock.domain.MockMajorSubject;
 import com.zhongzheng.modules.mock.service.IMockMajorService;
 import com.zhongzheng.modules.mock.service.IMockMajorSubjectService;
+import com.zhongzheng.modules.system.domain.SysTenant;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.service.IUserMockSubscribeService;
 import com.zhongzheng.modules.user.service.IUserService;
@@ -38,11 +44,14 @@ import com.zhongzheng.modules.wx.service.IWxLoginService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -75,6 +84,10 @@ public class ExamActivityServiceImpl extends ServiceImpl<ExamActivityMapper, Exa
     private IUserService userService;
     @Autowired
     private IUserMockSubscribeService userMockSubscribeService;
+    @Autowired
+    private ISysTenantService sysTenantService;
+    @Value("${liveGotoURL}")
+    private String liveGotoURL;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -204,7 +217,31 @@ public class ExamActivityServiceImpl extends ServiceImpl<ExamActivityMapper, Exa
 
     @Override
     public String getActivityApplyCode(Long activityId) {
-        return wxLoginService.getActivityApplyCode(activityId);
+        ExamActivity activity = getById(activityId);
+        if (ObjectUtils.isNull(activity)){
+            throw new CustomException("活动不存在");
+        }
+        //H5域名
+        SysTenant tenant = sysTenantService.getById(activity.getTenantId());
+        String hostH5 = tenant.getHostH5();
+        String urlBase64 = "";
+        try {
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            BitMatrix bitMatrix = qrCodeWriter.encode(String.format("%s%s/pages5/mockExam/examApply?tid=%s",liveGotoURL,hostH5,activityId),
+                    BarcodeFormat.QR_CODE, 300, 300);
+            // 写到输出流
+            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            MatrixToImageWriter.writeToStream(bitMatrix, "jpg", outputStream);
+            //转换为base64
+            Base64.Encoder encoder1 = Base64.getEncoder();
+            urlBase64 = "data:image/jpeg;base64,"
+                    + encoder1.encodeToString(outputStream.toByteArray());
+        }catch (Exception e) {
+            e.printStackTrace();
+            throw new CustomException("二维码生成失败");
+        }
+//        wxLoginService.getActivityApplyCode(activityId);
+        return urlBase64;
     }
 
     @Override

+ 31 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -55,6 +55,7 @@ import com.zhongzheng.modules.system.domain.SysConfig;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
+import com.zhongzheng.modules.user.bo.CdExamSubscribeBo;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserSubscribe;
 import com.zhongzheng.modules.user.service.IUserService;
@@ -136,6 +137,10 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
 
     @Value("${zhongzheng.profile}")
     private String ZHONGZHENG_PROFILE;
+    @Value("${exam.subscribeAddExamResult}")
+    private String EXAM_SUBSCRIBE_SAVE_RESULT;
+    @Value("${exam.subscribeAddCertificate}")
+    private String EXAM_SUBSCRIBE_SAVE_RESULT_CERTIFICATE;
 
     @Override
     public ExamApplyVo queryById(Long applyId) {
@@ -1328,9 +1333,18 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                     default :
                         break;
             }
-
+            bo.setApplyTime(DateUtils.dateTimeSec("yyyy-MM-dd",collect.get(0)));
+            bo.setApplyStartTime(getTimeStr(collect.get(1)));
+            bo.setApplyEndTime(getTimeStr(collect.get(3)));
+            bo.setTenantId(user.getTenantId());
+            bo.setMajor(majorName);
             iUserSubscribeService.updateByIdNoTenant(subscribe);
         });
+
+        //通知B端系统
+        String param = JSONArray.toJSONString(exportBo);
+        Map<String, String> headersMap = new HashMap<>();
+        HttpUtils.sendPostJsonHeaderAsync(EXAM_SUBSCRIBE_SAVE_RESULT, param, headersMap);
     }
 
     @Override
@@ -1339,6 +1353,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
             return "请勿上传空文件!";
         }
         List<String> msgList = new ArrayList<>();
+        List<ExamApplyCertificateBo> certificateBos = new ArrayList<>();
         files.forEach(multipartFile -> {
             //文件名= 身份证号码_岗位名称_证书编号_发证日期
             String fileName = multipartFile.getOriginalFilename();
@@ -1378,6 +1393,15 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
             try {
                 String upload = ossService.upload(ossRequest);
                 subscribe.setCertificateUrl(upload);
+                ExamApplyCertificateBo examAp = new ExamApplyCertificateBo();
+                examAp.setCertificateUrl(upload);
+                examAp.setCertificateEndTime(timeTwo);
+                examAp.setCertificateStartTime(time);
+                examAp.setCertificateCode(collect.get(2));
+                examAp.setMajor(collect.get(1));
+                examAp.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
+                examAp.setTenantId(user.getTenantId());
+                certificateBos.add(examAp);
             } catch (Exception e) {
 //                log.error("证书上传有误:"+collect.get(0));
                 msgList.add(multipartFile.getOriginalFilename());
@@ -1385,6 +1409,12 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
             }
             iUserSubscribeService.updateByIdNoTenant(subscribe);
         });
+        //通知B端系统
+        if (CollectionUtils.isNotEmpty(certificateBos)){
+            String param = JSONArray.toJSONString(certificateBos);
+            Map<String, String> headersMap = new HashMap<>();
+            HttpUtils.sendPostJsonHeaderAsync(EXAM_SUBSCRIBE_SAVE_RESULT_CERTIFICATE, param, headersMap);
+        }
         return msgList.stream().collect(Collectors.joining(","));
     }
 

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplySiteServiceImpl.java

@@ -158,7 +158,7 @@ public class ExamApplySiteServiceImpl extends ServiceImpl<ExamApplySiteMapper, E
                 CdExamRoomUpdateBo roomBo = new CdExamRoomUpdateBo();
                 roomBo.setSignId(apply.getApplyId());
                 roomBo.setDataFrom(1);
-//                roomBo.setTenantId(apply.getTenantId());
+                roomBo.setTenantId(apply.getTenantId());
                 roomBo.setExamType(apply.getApplyNature());
                 roomBo.setExamTime(timeAddBo.getExamTime());
                 ExamApplySiteTimeTwoAddBo twoAddBo = timeAddBo.getExamApplySiteTimeTwo().stream().findFirst().orElse(null);
@@ -178,7 +178,7 @@ public class ExamApplySiteServiceImpl extends ServiceImpl<ExamApplySiteMapper, E
                 CdExamRoomBo roomBo = new CdExamRoomBo();
                 roomBo.setSignId(apply.getApplyId());
                 roomBo.setDataFrom(1);
-//                roomBo.setTenantId(apply.getTenantId());
+                roomBo.setTenantId(apply.getTenantId());
                 roomBo.setType(1);//七大员预约
                 roomBo.setExamType(apply.getApplyNature());
                 roomBo.setExamTime(timeAddBo.getExamTime());