he2802 2 rokov pred
rodič
commit
879c8d0958

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

@@ -142,6 +142,7 @@ officialPush:
     token: 0ca175b9c0f726a831d895e26933246
 
 
+
 distributionOldPay:
     host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
 

+ 37 - 7
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/http/HttpUtils.java

@@ -9,6 +9,8 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
@@ -21,6 +23,8 @@ import org.slf4j.LoggerFactory;
 import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
 import java.security.cert.X509Certificate;
 import java.util.*;
 
@@ -112,7 +116,12 @@ public class HttpUtils
         return result.toString();
     }
     public static String postFormBody(String url, Map<String, String> paramMap) throws IOException{
-        return post(url, paramMap, null);
+        try{
+            String result = post(url, paramMap, null);
+            return result;
+        }catch (Exception e){
+            return null;
+        }
 
     }
 
@@ -470,7 +479,7 @@ public class HttpUtils
      * @return 请求返回的数据
      * @throws IOException 读写异常
      */
-    private static String post(String url, Map<String, String> paramMap, String encoding) throws IOException {
+    private static String post(String url, Map<String, String> paramMap, String encoding) throws IOException, NoSuchAlgorithmException, KeyManagementException {
         log.debug("http 请求 url: {} , 请求参数: {}", url, appendUrl("", paramMap).replace("?", ""));
         encoding = encoding == null ? UTF8 : encoding;
         // 创建post方式请求对象
@@ -512,11 +521,28 @@ public class HttpUtils
      * @throws IOException 读写异常
      */
     private static <T> T post(String url, HttpPost httpPost, String encoding, DataParse<T> dataParse)
-            throws IOException {
+            throws IOException, NoSuchAlgorithmException, KeyManagementException {
+        TrustManager[] trustAllCerts = new TrustManager[] {
+                new X509TrustManager() {
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return null;
+                    }
+                    public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                        // don't check
+                    }
+                    public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                        // don't check
+                    }
+                }
+        };
+
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        ctx.init(null, trustAllCerts, null);
+        LayeredConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(ctx);
         T result = null;
         CloseableHttpResponse response = null;
         // 创建httpclient对象
-        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        CloseableHttpClient httpClient = HttpClientBuilder.create().setSSLSocketFactory(sslSocketFactory).build();
 
         // 执行请求操作,并拿到结果(同步阻塞)
         response = sendRequestAndGetResult(url, httpClient, httpPost);
@@ -599,8 +625,12 @@ public class HttpUtils
     }
 
     public static String postFormBodyHeader(String url, Map<String, String> paramMap, Map<String, String> headersMap, Header[] header) throws IOException{
-        return postHearder(url, paramMap, null, headersMap, header);
-
+        try{
+            String result = postHearder(url, paramMap, null, headersMap, header);
+            return result;
+        }catch (Exception e){
+            return null;
+        }
     }
 
     /**
@@ -612,7 +642,7 @@ public class HttpUtils
      * @return 请求返回的数据
      * @throws IOException 读写异常
      */
-    private static String postHearder(String url, Map<String, String> paramMap, String encoding, Map<String, String> headersMap, Header[] header) throws IOException {
+    private static String postHearder(String url, Map<String, String> paramMap, String encoding, Map<String, String> headersMap, Header[] header) throws IOException, NoSuchAlgorithmException, KeyManagementException {
         log.debug("http 请求 url: {} , 请求参数: {}", url, appendUrl("", paramMap).replace("?", ""));
         encoding = encoding == null ? UTF8 : encoding;
         // 创建post方式请求对象

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -801,6 +801,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                             else{
                                 bo.setAnswerQuestion("0");
                             }
+                            if(Validator.isEmpty(bo.getAnswerQuestion())){
+                                question.setCause("题目答案错误");
+                                errorList.add(question);
+                                continue;
+                            }
                         }
                         if(type==4){
                             isAnLi = true;
@@ -959,7 +964,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             addBo.setContent(entity.getOption());
             addBo.setOptionsId(j);
             optionsList.add(addBo);
-            if("是".equals(entity.getAnswer())){
+            if("是".equals(dealTxt(entity.getAnswer()))){
                 answerList.add(j);
                 /*if(type==1){ //单选
                     break;
@@ -1013,6 +1018,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     }
 
     private String dealTxt(String txt) {
+        if(Validator.isEmpty(txt)){
+            return null;
+        }
         txt = txt.trim();
         if (txt.startsWith("\\t")) {
             txt = txt.replace("\\t", "");

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsQueryBo.java

@@ -210,4 +210,5 @@ public class GoodsQueryBo extends BaseEntity {
 	/** 提交官方审核备注说明 */
 	@ApiModelProperty("提交官方审核备注说明")
 	private String commitPeriodRemark;
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -68,6 +68,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -1639,6 +1639,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         Collections.sort(classPeriodVos);
         Long startTotalTime = 0L;
         Long endTotalTime = 0L;
+        Long secTotalTime = 0L;
         for (ClassPeriodVo classPeriodVo : classPeriodVos) {
             //为模块搜索下面的章 和节 并搜索学时记录
             if (classPeriodVo.getType() == 1) {
@@ -1654,6 +1655,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         classPeriodSectionVos.addAll(baseMapper.listperiodExam(classPeriodChapterVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), classPeriodVo.getId()));
                         for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
                             if (classPeriodSectionVo.getType() == 3) {
+                                secTotalTime+=classPeriodSectionVo.getDurationTime();
                                 //节
                                 UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
                                 userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
@@ -1802,6 +1804,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId());
                 Collections.sort(classPeriodSectionVos);
                 for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                    secTotalTime+=classPeriodSectionVo.getDurationTime();
                     UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
                     userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
                     userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
@@ -1908,6 +1911,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
 
             //为节搜索学时记录
             if (classPeriodVo.getType() == 3) {
+                secTotalTime+=classPeriodVo.getDurationTime();
                 UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
                 userPeriodQueryBo.setSectionId(classPeriodVo.getId());
                 userPeriodQueryBo.setCourseId(classPeriodVo.getCourseId());
@@ -1961,6 +1965,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         if(classPeriodVos.size()>0){
             classPeriodVos.get(0).setStartTotalTime(startTotalTime);
             classPeriodVos.get(0).setEndTotalTime(endTotalTime);
+            classPeriodVos.get(0).setSecTotalTime(secTotalTime);
+
         }
         return classPeriodVos;
     }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -74,6 +74,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
 import java.text.DecimalFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java

@@ -201,6 +201,11 @@ public class ClassPeriodVo implements Comparable<ClassPeriodVo> {
 	@ApiModelProperty("上一次结束")
 	private Long preEndTime;
 
+	private Long startTotalTime;
+
+	private Long endTotalTime;
+
+	private Long secTotalTime;
 	@Override
 	public int compareTo(ClassPeriodVo o) {
 		if(o.getCourseSort()==this.getCourseSort()){
@@ -210,6 +215,5 @@ public class ClassPeriodVo implements Comparable<ClassPeriodVo> {
 		}
 
 	}
-	private Long startTotalTime;
-	private Long endTotalTime;
+
 }