he2802 3 år sedan
förälder
incheckning
a540e394e8

+ 7 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeEditBo.java

@@ -84,9 +84,13 @@ public class ClassGradeEditBo {
     @ApiModelProperty("备注")
     private String remark;
 
-    /** 官方账号开通 */
-    @ApiModelProperty("官方账号开通")
-    private Long interfaceAccountId;
+    /** 官方账号开通(有接口) */
+    @ApiModelProperty("官方账号开通(有接口)")
+    private Long inInterfaceAccountId;
+
+    /** 官方账号开通(无接口) */
+    @ApiModelProperty("官方账号开通(无接口)")
+    private Long noInterfaceAccountId;
 
     /** 学时推送 */
     @ApiModelProperty("学时推送")

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeUserQueryBo.java

@@ -248,7 +248,7 @@ public class ClassGradeUserQueryBo extends BaseEntity {
 	 * 有接口标识(0无配置 1有接口 2无接口)
 	 */
 	@ApiModelProperty("有接口标识")
-	private Long hasInterface;
+	private Integer hasInterface;
 
 
 }

+ 5 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/ClassGrade.java

@@ -64,14 +64,15 @@ private static final long serialVersionUID=1L;
     /** 班主任ID */
     private Long sysUserId;
 
-    /** 官方账号开通(有接口) */
+    /** 官方信息推送接口 */
     private Long interfacePushId;
-    /** 官方账号开通(无接口) */
-    private Long noInterfacePushId;
+
     /** 备注 */
     private String remark;
-    /** 官方账号开通 */
+    /** 官方账号开通(有接口) */
     private Long interfaceAccountId;
+    /** 官方账号开通(无接口) */
+    private Long noInterfaceAccountId;
     /** 学时推送 */
     private Long interfacePeriodId;
 

+ 65 - 80
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -5,14 +5,15 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpResponse;
-import cn.hutool.json.JSONObject;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.bo.CourseEducationTypeQueryBo;
@@ -56,6 +57,8 @@ import com.zhongzheng.modules.grade.mapper.ClassGradeMapper;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.net.HttpCookie;
 import java.text.SimpleDateFormat;
@@ -524,103 +527,85 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         // post 请求 传递json参数
         String postLoginRequestUrl = "https://zjzyk.etledu.com/Account/GetLoginInfo";
         // 参数
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("userCode", "gdxiangyue");
-        jsonObject.put("passWord", bo.getPassword());
-        jsonObject.put("typeId", "2");
-        jsonObject.put("yzm", bo.getYzm());
-        jsonObject.put("phoneNum", "15602322262");
-
-        // 设置请求头
-        Map<String, String> loginHead = new HashMap<>();
-        loginHead.put("Content-Type", "application/json;charset=UTF-8");
-        // 纯请求  要结果的话 最后加 .body()
-        HttpResponse loginHttpResponse = HttpRequest.post(postLoginRequestUrl) // url
-                .headerMap(loginHead, false) // 请求头设置
-                .body(jsonObject.toString()) // json参数
-                .timeout(5 * 60 * 1000) // 超时
-                .execute();
-
-        if (loginHttpResponse.body().contains("{\"\"success\"\":true")) {
-            HttpCookie cookie = loginHttpResponse.getCookie("jqb_cookies");
+        Map<String, String> paramMap =new HashMap<>();
+        paramMap.put("userCode", "gdxiangyue");
+        paramMap.put("passWord", bo.getPassword());
+        paramMap.put("typeId", "2");
+        paramMap.put("yzm", bo.getYzm());
+        paramMap.put("phoneNum", "15602322262");
+        String loginHttpResponse = "";
+        try {
+            String param = HttpUtils.appendUrl("", paramMap);
+            loginHttpResponse = HttpUtils.sendPost(postLoginRequestUrl, param.substring(1));
+            JSONObject ob = JSONObject.parseObject(loginHttpResponse);
+        }catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        if (loginHttpResponse.contains("{\"\"success\"\":true")) {
             List<StudyAccountStatusQueryBo> studyAccountStatusList = bo.getStudyAccountStatusQueryBos();
             if (Validator.isNotEmpty(studyAccountStatusList)) {
                 List<Long> ids = new ArrayList<>();
                 for (StudyAccountStatusQueryBo studyAccountStatusQueryBo : studyAccountStatusList) {
                     //查询学员url
                     String getInfoRequestUrl = "https://zjzyk.etledu.com/Student/GetCertInfos";
-                    JSONObject getJsonObject = new JSONObject();
-                    getJsonObject.put("personalId", studyAccountStatusQueryBo.getIdCard());
-                    // 设置请求头
-                    Map<String, String> getInfoHead = new HashMap<>();
-                    getInfoHead.put("Content-Type", "application/json;charset=UTF-8");
-                    getInfoHead.put("Cookie", cookie.toString());
-                    // 纯请求  要结果的话 最后加 .body()
-                    HttpResponse getInfoHttpResponse = HttpRequest.post(getInfoRequestUrl) // url
-                            .headerMap(getInfoHead, false) // 请求头设置
-                            .body(getJsonObject.toString()) // json参数
-                            .timeout(5 * 60 * 1000) // 超时
-                            .execute();
-                    if (getInfoHttpResponse.body().contains("{\"\"success\"\":true")) {
-                        PersonRoot personRoot = com.alibaba.fastjson.JSONObject.parseObject(getInfoHttpResponse.toString(), PersonRoot.class);
+                    paramMap.clear();
+                    paramMap.put("personalId", studyAccountStatusQueryBo.getIdCard());
+                    String getInfoHttpResponse = "";
+                    try {
+                        getInfoHttpResponse = HttpUtils.postFormBody(getInfoRequestUrl, paramMap);
+                    }catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                    if (getInfoHttpResponse.contains("{\"\"success\"\":true")) {
+                        PersonRoot personRoot = com.alibaba.fastjson.JSONObject.parseObject(getInfoHttpResponse, PersonRoot.class);
                         CertInfoListItem certInfoListItem = personRoot.getCertInfoList().get(0);
                         TrainInfosItem trainInfosItem = certInfoListItem.getTrainInfos().get(0);
-                        cookie = getInfoHttpResponse.getCookie("jqb_cookies");
                         //查询继教产品url
+                        paramMap.clear();
                         String getProductUrl = "https://zjzyk.etledu.com/Student/GetProducts";
-                        JSONObject getProductObject = new JSONObject();
-                        getProductObject.put("workTypeCode", certInfoListItem.getWorkTypeCode());
-                        getProductObject.put("period", "0");
-                        getProductObject.put("trainYear", bo.getTrainYear());
-                        // 设置请求头
-                        Map<String, String> getProductHead = new HashMap<>();
-                        getProductHead.put("Content-Type", "application/json;charset=UTF-8");
-                        getProductHead.put("Cookie", cookie.toString());
-                        // 纯请求  要结果的话 最后加 .body()
-                        HttpResponse getProductHttpResponse = HttpRequest.post(getProductUrl) // url
-                                .headerMap(getProductHead, false) // 请求头设置
-                                .body(getJsonObject.toString()) // json参数
-                                .timeout(5 * 60 * 1000) // 超时
-                                .execute();
-                        if (getProductHttpResponse.body().contains("{\"\"success\"\":true")) {
-                            ProductRoot productRoot = com.alibaba.fastjson.JSONObject.parseObject(getProductHttpResponse.toString(), ProductRoot.class);
+                        paramMap.put("workTypeCode", certInfoListItem.getWorkTypeCode());
+                        paramMap.put("period", "0");
+                        paramMap.put("trainYear", bo.getTrainYear());
+                        String getProductHttpResponse = "";
+                        try {
+                            getProductHttpResponse = HttpUtils.postFormBody(getProductUrl, paramMap);
+                        }catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                        if (getProductHttpResponse.contains("{\"\"success\"\":true")) {
+                            ProductRoot productRoot = com.alibaba.fastjson.JSONObject.parseObject(getProductHttpResponse, ProductRoot.class);
                             if (Validator.isEmpty(productRoot)) {
                                 throw new CustomException("未获取到相关继教商品信息");
                             }
                             ProductsItem productsItem = productRoot.getProducts().get(0);
-                            cookie = getProductHttpResponse.getCookie("jqb_cookies");
                             //学员开通url
                             String postOpenRequestUrl = "https://zjzyk.etledu.com/Student/SubmitProject";
-                            JSONObject sumitJsonObject = new JSONObject();
-                            sumitJsonObject.put("CertNumber", studyAccountStatusQueryBo.getIdCard());
-                            sumitJsonObject.put("CertState", certInfoListItem.getCertState());
-                            sumitJsonObject.put("CertTime", certInfoListItem.getCertTime());
-                            sumitJsonObject.put("Name", studyAccountStatusQueryBo.getRealname());
-                            sumitJsonObject.put("phoneNum", studyAccountStatusQueryBo.getTelphone());
-                            sumitJsonObject.put("PersonalId", certInfoListItem.getPersonalId());
-                            sumitJsonObject.put("ProvinceCode", certInfoListItem.getProvinceCode());
-                            sumitJsonObject.put("ProvinceName", certInfoListItem.getProvinceName());
-                            sumitJsonObject.put("WorkTypeCode", certInfoListItem.getWorkTypeCode());
-                            sumitJsonObject.put("WorkTypeName", certInfoListItem.getWorkTypeName());
-                            sumitJsonObject.put("productId", productsItem.getId());
-                            sumitJsonObject.put("trainPeriodDate", trainInfosItem.getTrainPeriodTime());
-                            sumitJsonObject.put("period", 0);
-                            sumitJsonObject.put("IsBuyBook", 1);
-                            sumitJsonObject.put("GetMethod", 1);
-                            // 设置请求头
-                            Map<String, String> sumitHead = new HashMap<>();
-                            sumitHead.put("Content-Type", "application/json;charset=UTF-8");
-                            sumitHead.put("Cookie", cookie.toString());
-                            // 纯请求  要结果的话 最后加 .body()
-                            HttpResponse sumitHttpResponse = HttpRequest.post(postOpenRequestUrl) // url
-                                    .headerMap(sumitHead, false) // 请求头设置
-                                    .body(sumitJsonObject.toString()) // json参数
-                                    .timeout(5 * 60 * 1000) // 超时
-                                    .execute();
-                            //.body(); // 请求
+                            paramMap.clear();
+                            paramMap.put("CertNumber", studyAccountStatusQueryBo.getIdCard());
+                            paramMap.put("CertState", certInfoListItem.getCertState().toString());
+                            paramMap.put("CertTime", certInfoListItem.getCertTime());
+                            paramMap.put("Name", studyAccountStatusQueryBo.getRealname());
+                            paramMap.put("phoneNum", studyAccountStatusQueryBo.getTelphone());
+                            paramMap.put("PersonalId", certInfoListItem.getPersonalId());
+                            paramMap.put("ProvinceCode", certInfoListItem.getProvinceCode());
+                            paramMap.put("ProvinceName", certInfoListItem.getProvinceName());
+                            paramMap.put("WorkTypeCode", certInfoListItem.getWorkTypeCode());
+                            paramMap.put("WorkTypeName", certInfoListItem.getWorkTypeName());
+                            paramMap.put("productId", productsItem.getId().toString());
+                            paramMap.put("trainPeriodDate", trainInfosItem.getTrainPeriodTime());
+                            paramMap.put("period", "0");
+                            paramMap.put("IsBuyBook", "1");
+                            paramMap.put("GetMethod", "1");
+                            String sumitHttpResponse = "";
+                            try {
+                                sumitHttpResponse = HttpUtils.postFormBody(getProductUrl, paramMap);
+                            }catch (IOException e) {
+                                e.printStackTrace();
+                            }
                             com.alibaba.fastjson.JSONObject.parseObject(sumitHttpResponse.toString(), ClassGradeUserQueryBo.class);
                             //开通成功同步修改本地库learnStatus状态
-                            if (sumitHttpResponse.body().contains("{\"\"success\"\":true")) {
+                            if (sumitHttpResponse.contains("{\"\"success\"\":true")) {
                                 ids.add(studyAccountStatusQueryBo.getId());
                             } else {
                                 falseCount++;

+ 3 - 3
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -428,13 +428,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="majorId != null and majorId != ''">
             AND m.id = #{majorId}
         </if>
-        <if test="hasInterface != null and noInterfaceAccountId == 0">
+        <if test="hasInterface != null and hasInterface == 0">
             AND cg.interface_account_id is null AND cg.no_interface_account_id is null
         </if>
-        <if test="hasInterface != null and noInterfaceAccountId == 1">
+        <if test="hasInterface != null and hasInterface == 1">
             AND cg.interface_account_id is not null
         </if>
-        <if test="hasInterface != null and noInterfaceAccountId == 2">
+        <if test="hasInterface != null and hasInterface == 2">
             AND cg.no_interface_account_id is not null
         </if>
         order by user_info_status desc ,user_status desc ,cgu.id desc

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -64,6 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND uew.goods_id = #{goodsId}
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND uew.order_goods_id = #{orderGoodsId}
+        </if>
         <if test="paperId != null and paperId != ''">
             AND e.exam_paper_id = #{paperId}
         </if>