|
@@ -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;
|
|
|
}
|
|
|
}
|