he2802 2 years ago
parent
commit
4736a79637

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java

@@ -60,5 +60,5 @@ public interface IExamService extends IService<Exam> {
 
     Exam getExamByTenant(String code, Long newTenantId);
 
-	boolean getShanDongExam();
+	boolean getShanDongExam(Long userId,String majorname);
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionOtherService.java

@@ -36,7 +36,7 @@ public interface IQuestionOtherService extends IService<QuestionOther> {
 	 * @param bo 第三方题库新增业务对象
 	 * @return
 	 */
-	Boolean insertByAddBo(QuestionOtherAddBo bo);
+	Long insertByAddBo(QuestionOtherAddBo bo);
 
 	/**
 	 * 根据编辑业务对象修改第三方题库

+ 35 - 19
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
@@ -37,7 +38,9 @@ import com.zhongzheng.modules.goods.domain.GoodsAttached;
 import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.user.bo.CheckUserExamRecordBo;
+import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
+import com.zhongzheng.modules.user.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -76,6 +79,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     private IUserExamRecordService iUserExamRecordService;
     @Autowired
     private IQuestionOtherService iQuestionOtherService;
+    @Autowired
+    private IUserService iUserService;
 
     @Value("${oldSys.host}")
     private String OLD_SYS_HOST;
@@ -348,34 +353,45 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     }
 
     @Override
-    public boolean getShanDongExam() {
+    public boolean getShanDongExam(Long userId,String majorname) {
+        Boolean getNew = false;
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                .eq(User::getUserId, userId).last("limit 1"));
+        String idnum = user.getIdCard();
+        String username = user.getRealname();
         Long nowTime = DateUtils.getNowTime();
-        String sign = ToolsUtils.EncoderByMd5WithUtf("152301198304206010"+"土建质量员"+nowTime.toString() + "pubilc2022");
+        String sign = ToolsUtils.EncoderByMd5WithUtf(idnum+majorname+nowTime.toString() + "pubilc2022");
         Map<String,String> map = new HashMap<>();
-        map.put("idnum","152301198304206010");
+        map.put("idnum",idnum);//152301198304206010
         map.put("tenantId","867735392558919680");
-        map.put("username","袁红军");
-        map.put("majorname","土建质量员");
+        map.put("username",username);//袁红军
+        map.put("majorname",majorname);//土建质量员
         map.put("stamp",nowTime.toString());
         map.put("sign",sign);
     //    JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(map));
         String respone = "";
-        String url = OLD_SYS_HOST+"/system/BussinessApi/InitQdyQuiz";
-        try {
-            respone = HttpUtils.postFormBody(url, map);
-            QuestionOtherAddBo addBo = new QuestionOtherAddBo();
-            addBo.setJsonStr(respone);
-            addBo.setFromPlat(1);
-            addBo.setUserId(1L);
-            addBo.setMajorname("土建质量员");
-            iQuestionOtherService.insertByAddBo(addBo);
-            System.out.println(respone);
-            if (!respone.contains("\"msg\":\"获取成功\"")) {
-                throw new CustomException("同步请求错误" + respone);
+        if(getNew){
+            String url = OLD_SYS_HOST+"/system/BussinessApi/InitQdyQuiz";
+            try {
+                respone = HttpUtils.postFormBody(url, map);
+                if (!respone.contains("\"msg\":\"获取成功\"")) {
+                    throw new CustomException("同步请求错误" + respone);
+                }
+                QuestionOtherAddBo addBo = new QuestionOtherAddBo();
+                addBo.setJsonStr(respone);
+                addBo.setFromPlat(1);
+                addBo.setUserId(1L);
+                addBo.setMajorname(majorname);
+                Long id = iQuestionOtherService.insertByAddBo(addBo);
+                iQuestionOtherService.queryById(id);
+        //        System.out.println(respone);
+            } catch (Exception e) {
+                throw new CustomException("同步请求错误" + e.getMessage());
             }
-        } catch (Exception e) {
-            throw new CustomException("同步请求错误" + e.getMessage());
+        }else{
+
         }
+
         return false;
     }
 }

+ 3 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionOtherServiceImpl.java

@@ -262,12 +262,13 @@ public class QuestionOtherServiceImpl extends ServiceImpl<QuestionOtherMapper, Q
     }
 
     @Override
-    public Boolean insertByAddBo(QuestionOtherAddBo bo) {
+    public Long insertByAddBo(QuestionOtherAddBo bo) {
         QuestionOther add = BeanUtil.toBean(bo, QuestionOther.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        return this.save(add);
+        this.save(add);
+        return add.getId();
     }
 
     @Override

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -173,7 +173,7 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                 throw new CustomException("图片地址错误");
             }
         }
-        if(Validator.isEmpty(bo.getTypeStatus())||Validator.isEmpty(bo.getOrderGoodsId())||bo.getOrderGoodsId()==0L){
+        if(Validator.isEmpty(bo.getOrderGoodsId())||bo.getOrderGoodsId()==0L){
             throw new CustomException("参数错误");
         }
         UserProfile old = getOne(new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getOrderGoodsId, bo.getOrderGoodsId())