Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/seven' into seven

# Conflicts:
#	zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml
yangdamao 2 anni fa
parent
commit
e13f97a0ed
19 ha cambiato i file con 429 aggiunte e 32 eliminazioni
  1. 2 0
      zhongzheng-admin-saas/src/main/resources/application-dev.yml
  2. 2 0
      zhongzheng-admin-saas/src/main/resources/application-pre.yml
  3. 2 0
      zhongzheng-admin-saas/src/main/resources/application-prod.yml
  4. 2 1
      zhongzheng-admin/src/main/resources/application-dev.yml
  5. 2 0
      zhongzheng-admin/src/main/resources/application-pre.yml
  6. 2 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  7. 3 1
      zhongzheng-api/src/main/resources/application-dev.yml
  8. 2 0
      zhongzheng-api/src/main/resources/application-pre.yml
  9. 2 0
      zhongzheng-api/src/main/resources/application-prod.yml
  10. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java
  11. 3 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java
  12. 364 5
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  13. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeUserVo.java
  14. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java
  15. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java
  16. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java
  17. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java
  18. 27 20
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml
  19. 2 1
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: http://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData

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

@@ -140,7 +140,8 @@ officialPush:
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
-
+    sevenInfoPath: http://sgry-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry-dev.gdcic.net/organjxjy/XueshiShenqing
 
 
 distributionOldPay:

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry-dev.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: http://test.jqbao.net/System/BussinessApi/AddRedPackData

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData

+ 3 - 1
zhongzheng-api/src/main/resources/application-dev.yml

@@ -143,6 +143,8 @@ officialPush:
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
@@ -174,4 +176,4 @@ oldSys:
 invoice:
     host: http://192.168.1.222:7077/sys/common/openMplatform/log
 
-liveHost: http://192.168.1.222:6009
+liveHost: http://192.168.1.222:6009

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

@@ -140,6 +140,8 @@ officialPush:
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: http://test.jqbao.net/System/BussinessApi/AddRedPackData

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

@@ -152,6 +152,8 @@ officialPush:
     periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java

@@ -62,6 +62,9 @@ public class CourseBusinessServiceImpl extends ServiceImpl<CourseBusinessMapper,
             if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")||fullName.equals("考前培训七大员施工现场专业人员")){
                 vo.setGoodsLearningOrder(2);
             }
+            if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                vo.setGoodsLearningOrder(2);
+            }
         }
         return BeanUtil.toBean(vo, CourseBusinessVo.class);
     }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -55,13 +55,15 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 	String pushOfficialInfo(ClassGradeUserQueryBo bo);
 
 
-
 	ClassPeriodStudentVo DecryptOfficialInfo(ClassGradeDecryptQueryBo bo);
 
+	ClassPeriodStudentVo DecryptSevenOfficialInfo(ClassGradeDecryptQueryBo bo);
+
 	String pushOfficialInfoMore(List<ClassGradeUserQueryBo> list);
 
 	String pushOfficialPeriod(ClassGradeUserQueryBo bo);
 
+
 	String pushOfficialPeriodMore(List<ClassGradeUserQueryBo> list);
 
 	Map<String,Object> exportPo(ClassGradeUserQueryBo bo);

+ 364 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -36,6 +36,7 @@ import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
 import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
 import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.domain.GoodsCourse;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
@@ -174,12 +175,22 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Value("${officialPush.token}")
     private String OFFICIALPUSH_TOKEN;
 
+    @Value("${officialPush.sevenInfoPath}")
+    private String OFFICIALPUSH_SEVEN_INFOPATH;
+
+    @Value("${officialPush.sevenPeriodPath}")
+    private String OFFICIALPUSH_SEVEN_PERIODPATH;
+
+
     @Autowired
     private IUserPeriodService iUserPeriodService;
 
     @Autowired
     private ISysOldOrgService sysOldOrgService;
 
+    private String SEVEN_OFFICIALPUSH_INFOACCOUNT;
+    private String SEVEN_OFFICIALPUSH_TOKEN;
+
     private static final Logger log = LoggerFactory.getLogger(ClassGradeUserServiceImpl.class);
 
     @Override
@@ -546,6 +557,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
      */
     @Override
     public String pushOfficialInfo(ClassGradeUserQueryBo bo) {
+        OFFICIALPUSH_INFOACCOUNT = null;
+        OFFICIALPUSH_TOKEN = null;
         log.info("报名信息推送" + JSON.toJSONString(bo));
         //暂时先关闭信息推送入口
 //        if (true){
@@ -581,10 +594,18 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
         goodsQueryBo.setUserId(bo.getUserId());
         goodsQueryBo.setGradeId(userVo.getGradeId());
+        goodsQueryBo.setOrderGoodsId(userVo.getOrderGoodsId());
         OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
         if (Validator.isEmpty(orderGoods)) {
             return "班级商品不存在";
         }
+        Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,orderGoods.getGoodsId()));
+        CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
+        queryBo.setId(goods.getBusinessId());
+        String fullName = iCourseBusinessService.queryFullName(queryBo);
+        if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+            return pushSevenOfficialInfo(bo,userVo,orderGoods);
+        }
         Long bmrq = 0L;
         if (Validator.isEmpty(userVo.getClassStartTime())) {
             return "班级开始时间缺失";
@@ -652,6 +673,121 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         }
     }
 
+
+    public String pushSevenOfficialInfo(ClassGradeUserQueryBo bo,ClassGradeUserVo userVo,OrderGoodsVo orderGoods) {
+        SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
+        SEVEN_OFFICIALPUSH_TOKEN=null;
+        log.info("报名信息推送" + JSON.toJSONString(bo));
+        //暂时先关闭信息推送入口
+//        if (true){
+//            return "";
+//        }
+//        ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
+        if (Validator.isEmpty(userVo)) {
+            return "用户不存在";
+        }
+        if (Validator.isEmpty(userVo.getInterfacePushId())) {
+            return "没开通信息推送";
+        } else {
+            ClassGradeInterface gradeInterface = iClassGradeInterfaceService.getById(userVo.getInterfacePushId());
+            if (gradeInterface.getType() != 1) {
+                return "没开通信息推送";
+            }
+        }
+        if (Validator.isEmpty(userVo.getOfficialName())) {
+            return "没配置班号";
+        }
+        if (Validator.isEmpty(userVo.getClassStatus()) || userVo.getClassStatus() != 1) {
+            return "未开班";
+        }
+        if (Validator.isNotEmpty(userVo.getClassStartTime())) {
+            long nowTime = System.currentTimeMillis() / 1000;
+            if (userVo.getClassStartTime().longValue() > nowTime) {
+                return "班级有效期未开始";
+            }
+            if (nowTime > userVo.getClassEndTime().longValue()) {
+                return "班级有效期已结束";
+            }
+        }
+       /* OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
+        goodsQueryBo.setUserId(bo.getUserId());
+        goodsQueryBo.setGradeId(userVo.getGradeId());
+        goodsQueryBo.setOrderGoodsId(userVo.getOrderGoodsId());
+        OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);*/
+        if (Validator.isEmpty(orderGoods)) {
+            return "班级商品不存在";
+        }
+        Long bmrq = 0L;
+        if (Validator.isEmpty(userVo.getClassStartTime())) {
+            return "班级开始时间缺失";
+        }
+        if (userVo.getClassStartTime().longValue() < orderGoods.getCreateTime().longValue()) {
+            bmrq = orderGoods.getCreateTime();
+        } else {
+            bmrq = userVo.getClassStartTime();
+        }
+        if (Validator.isEmpty(userVo.getRealName()) || Validator.isEmpty(userVo.getIdCard()) || Validator.isEmpty(userVo.getTelPhone())) {
+            return "用户信息缺失";
+        }
+        if (Validator.isEmpty(orderGoods.getSevenYear())) {
+            return "商品年份缺失";
+        }
+        if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
+            SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
+            SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
+        }
+        Map<String, String> params = new HashMap<>();
+        params.put("zh", SEVEN_OFFICIALPUSH_INFOACCOUNT);
+        params.put("bh", userVo.getOfficialName());
+        params.put("year", orderGoods.getSevenYear());
+        params.put("xm", userVo.getRealName());
+        params.put("sfz", userVo.getIdCard());
+        params.put("dh", userVo.getTelPhone());
+        params.put("bmrq", DateUtils.timestampToDate(bmrq));
+        String dataTxt = params.get("zh") + params.get("bh") + params.get("year") + params.get("xm") + params.get("sfz") + params.get("dh") + params.get("bmrq");
+        log.info("报名信息推送参数"+ dataTxt);
+        String encrypted = dataSign(dataTxt, SEVEN_OFFICIALPUSH_TOKEN);
+        params.put("SignMsg", encrypted);
+        String respone = "";
+        try {
+            respone = HttpUtils.postFormBody(OFFICIALPUSH_SEVEN_INFOPATH, params);
+            if (Validator.isEmpty(respone)) {
+                return "响应信息空";
+            }
+            String[] split = respone.split("\\|");
+            if (split.length < 2) {
+                return "推送接口返回数据错误";
+            }
+            if (split[0].equals("OK")) {
+                //推送成功
+                LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatus, 1);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusMsg, respone);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime, DateUtils.getNowTime());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusNum, userVo.getOfficialStatusNum() + 1);
+                this.update(null, objectLambdaUpdateWrapper);
+
+                //修改资料变更状态
+
+                return null;
+            } else {
+                //推送失败
+                LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusMsg, respone);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime, DateUtils.getNowTime());
+                this.update(null, objectLambdaUpdateWrapper);
+                return respone;
+            }
+        } catch (IOException e) {
+            //    throw new CustomException("请求错误");
+            return null;
+        }
+    }
+
     @Override
     public ClassPeriodStudentVo DecryptOfficialInfo(ClassGradeDecryptQueryBo bo) {
         String pars;
@@ -721,6 +857,103 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         studentVo.setGoodsId(orderGoods.getGoodsId());
         studentVo.setGoodsName(goods.getGoodsName());
         studentVo.setFullName(fullName);
+        studentVo.setOrderGoodsId(orderGoods.getOrderGoodsId());
+        String userName = "erjian";
+        if(fullName.equals("继续教育二级建造师")){
+            studentVo.setGradeType(1);
+        }
+        if(fullName.equals("继续教育二级造价师")){
+            studentVo.setGradeType(2);
+            userName = "erzao";
+        }
+        SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>()
+                .eq(SysUser::getUserName, userName).last("limit 1"));
+        LoginUser loginUser = new LoginUser();
+        loginUser.setUser(sysUser);
+
+        studentVo.setToken(iUserService.createToken(loginUser));
+        return studentVo;
+    }
+
+    @Override
+    public ClassPeriodStudentVo DecryptSevenOfficialInfo(ClassGradeDecryptQueryBo bo) {
+        SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
+        SEVEN_OFFICIALPUSH_TOKEN=null;
+        String pars;
+        try {
+            if(Validator.isNotEmpty(bo.getTenantId())){
+                ServletUtils.getRequestAttributes().getResponse().setHeader("TenantId", bo.getTenantId());
+            }
+            if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
+                SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
+                SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
+            }
+            byte[] Keys = new byte[]{0x22, 0x34, 0x76, 0x58, (byte) 0x90, (byte) 0xAB, (byte) 0xAD, (byte) 0xBF};
+            byte[] rgbKey = SEVEN_OFFICIALPUSH_TOKEN.substring(0, 8).getBytes("UTF-8");
+            pars = ToolsUtils.decryptDesNew(bo.getData(), SEVEN_OFFICIALPUSH_TOKEN.substring(0, 8));
+        } catch (Exception e) {
+            throw new CustomException("解析错误");
+        }
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(pars);
+        String idCard = split.get("idnum");
+        String datetime = split.get("datetime");
+        String year = split.get("year");
+        if (Validator.isEmpty(datetime)) {
+            throw new CustomException("数据错误");
+        }
+        String datetimeStr = datetime.substring(0, 8);
+        if (!DateUtils.dateTimeNow(DateUtils.YYYYMMDD).equals(datetimeStr)) {
+            throw new CustomException("数据错误");
+        }
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getIdCard, EncryptHandler.encrypt(idCard)).last("limit 1"));
+        if (Validator.isEmpty(user)) {
+            throw new CustomException("身份证查无用户");
+        }
+        String bh = split.get("bh");
+        List<ClassGrade> classGradeList = iClassGradeService.list(new LambdaQueryWrapper<ClassGrade>().eq(ClassGrade::getOfficialName, bh));
+        if (Validator.isEmpty(classGradeList) || classGradeList.size() == 0) {
+            throw new CustomException("班级不存在");
+        }
+        ClassGradeUser classGradeUser = null;
+        ClassGrade grade = null;
+        OrderGoods orderGoods = null;
+        for (ClassGrade classGrade : classGradeList) {
+            LambdaQueryWrapper<ClassGradeUser> lqw = Wrappers.lambdaQuery();
+            lqw.eq(ClassGradeUser::getGradeId, classGrade.getGradeId());
+            lqw.eq(ClassGradeUser::getUserId,  user.getUserId());
+            List<ClassGradeUser> gradeUserList = iClassGradeUserService.list(lqw);
+            for (ClassGradeUser gu : gradeUserList) {
+                OrderGoods og = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, gu.getOrderGoodsId())
+                        .eq(OrderGoods::getSevenYear, year));
+                if (Validator.isNotEmpty(og)) {
+                    grade = classGrade;
+                    orderGoods = og;
+                    classGradeUser = gu;
+                    break;
+                }
+            }
+        }
+        if (Validator.isEmpty(classGradeUser)) {
+            throw new CustomException("班级用户不存在");
+        }
+
+        if (Validator.isEmpty(orderGoods)) {
+            throw new CustomException("订单商品不存在");
+        }
+        Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, orderGoods.getGoodsId()));
+        CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
+        queryBo.setId(goods.getBusinessId());
+        String fullName = iCourseBusinessService.queryFullName(queryBo);
+        ClassPeriodStudentVo studentVo = new ClassPeriodStudentVo();
+        studentVo.setGradeId(grade.getGradeId());
+        studentVo.setClassName(grade.getClassName());
+        studentVo.setRealName(user.getRealname());
+        studentVo.setUserId(user.getUserId());
+        studentVo.setIdCard(idCard);
+        studentVo.setGoodsId(orderGoods.getGoodsId());
+        studentVo.setGoodsName(goods.getGoodsName());
+        studentVo.setFullName(fullName);
+        studentVo.setOrderGoodsId(orderGoods.getOrderGoodsId());
         String userName = "erjian";
         if(fullName.equals("继续教育二级建造师")){
             studentVo.setGradeType(1);
@@ -766,15 +999,14 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
      */
     @Override
     public String pushOfficialPeriod(ClassGradeUserQueryBo bo) {
+        OFFICIALPUSH_INFOACCOUNT = null;
+        OFFICIALPUSH_TOKEN = null;
         //企业ID
         String tenant = ServletUtils.getRequest().getHeader("TenantId");
         SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
                 .eq(SysOldOrg::getTenantId, tenant)
                 .last("limit 1")).stream().findFirst().orElse(null);
-        //共享班级关闭学时推送入口
-        if (org.getShareClass() == 1) {
-            return "";
-        }
+
 //        if (true){
 //            return "";
 //        }
@@ -815,11 +1047,22 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
         goodsQueryBo.setUserId(bo.getUserId());
         goodsQueryBo.setGradeId(userVo.getGradeId());
+        goodsQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
         OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
         if (Validator.isEmpty(orderGoods)) {
             return "班级商品不存在";
         }
-
+        Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,orderGoods.getGoodsId()));
+        CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
+        queryBo.setId(goods.getBusinessId());
+        String fullName = iCourseBusinessService.queryFullName(queryBo);
+        if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+            return pushSevenOfficialPeriod(bo,userVo,orderGoods);
+        }
+        //共享班级关闭学时推送入口
+        if (org.getShareClass() == 1) {
+            return "";
+        }
        /* UserProfile userProfile = iUserProfileService.getOne(new LambdaQueryWrapper<UserProfile>()
                 .eq(UserProfile::getUserId, bo.getUserId()).eq(UserProfile::getGoodsId, orderGoods.getGoodsId())
                 .eq(UserProfile::getCurrentStatus, 1).eq(UserProfile::getTypeStatus, 1)
@@ -843,6 +1086,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         Long startTime = baseMapper.getPeriodStartTime(userQueryBo);
         Long endTime = baseMapper.getPeriodEndTime(userQueryBo);
 
+
         Map<String, String> params = new HashMap<>();
         params.put("zh", OFFICIALPUSH_INFOACCOUNT);
         params.put("bh", userVo.getOfficialName());
@@ -887,6 +1131,121 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         }
     }
 
+    public String pushSevenOfficialPeriod(ClassGradeUserQueryBo bo,ClassGradeUserVo userVo,OrderGoodsVo orderGoods) {
+        SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
+        SEVEN_OFFICIALPUSH_TOKEN=null;
+ //       ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
+        if (Validator.isEmpty(userVo)) {
+            return "用户不存在";
+        }
+        if (Validator.isEmpty(userVo.getInterfacePushId())) {
+            return "没开通信息推送";
+        }
+        if (Validator.isEmpty(userVo.getOfficialName())) {
+            return "没配置班号";
+        }
+        if (Validator.isEmpty(userVo.getClassStatus()) || userVo.getClassStatus() != 1) {
+            return "未开班";
+        }
+        if (Validator.isNotEmpty(userVo.getPeriodPlush())&&userVo.getPeriodPlush()==1) {
+            return "该用户已推送过";
+        }
+        if (Validator.isNotEmpty(userVo.getClassStartTime())) {
+            long nowTime = System.currentTimeMillis() / 1000;
+            if (userVo.getClassStartTime().longValue() > nowTime) {
+                return "班级有效期未开始";
+            }
+            if (Validator.isEmpty(userVo.getPeriodWaitTime())) {
+                return "审核状态错误";
+            }
+            //只要待审核时间早于班级结束时间就允许推送
+            if (userVo.getPeriodWaitTime().longValue() >= userVo.getClassEndTime().longValue()) {
+                return "班级有效期已结束";
+            }
+        }
+        if (userVo.getPeriodStatus() != 1) {
+            return "学时审核没通过";
+        }
+
+       /* OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
+        goodsQueryBo.setUserId(bo.getUserId());
+        goodsQueryBo.setGradeId(userVo.getGradeId());
+        goodsQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
+        OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);*/
+        if (Validator.isEmpty(orderGoods)) {
+            return "班级商品不存在";
+        }
+
+       /* UserProfile userProfile = iUserProfileService.getOne(new LambdaQueryWrapper<UserProfile>()
+                .eq(UserProfile::getUserId, bo.getUserId()).eq(UserProfile::getGoodsId, orderGoods.getGoodsId())
+                .eq(UserProfile::getCurrentStatus, 1).eq(UserProfile::getTypeStatus, 1)
+                .last("limit 1"));
+        if (Validator.isNotEmpty(userProfile) && userProfile.getStatus() != 1) {
+            return "资料审核没通过";
+        }*/
+
+        UserStudyRecordQueryBo studyRecordQueryBo = new UserStudyRecordQueryBo();
+        studyRecordQueryBo.setUserId(bo.getUserId());
+        studyRecordQueryBo.setGradeId(userVo.getGradeId());
+        studyRecordQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
+        //第一条学习记录
+        UserStudyRecordVo firstVo = iUserStudyRecordService.queryFirst(studyRecordQueryBo);
+        if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
+            SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
+            SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
+        }
+        ClassGradeUserQueryBo userQueryBo = new ClassGradeUserQueryBo();
+        userQueryBo.setUserId(bo.getUserId());
+        userQueryBo.setGradeId(userVo.getGradeId());
+        userQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
+        Long startTime = baseMapper.getPeriodStartTime(userQueryBo);
+        Long endTime = baseMapper.getPeriodEndTime(userQueryBo);
+
+        Map<String, String> params = new HashMap<>();
+        params.put("zh", SEVEN_OFFICIALPUSH_INFOACCOUNT);
+        params.put("bh", userVo.getOfficialName());
+        params.put("year", orderGoods.getSevenYear());
+        params.put("xm", userVo.getRealName());
+        params.put("sfz", userVo.getIdCard());
+        params.put("ksrq", DateUtils.timestampToDate(startTime));
+        params.put("jsrq", DateUtils.timestampToDate(endTime));
+        String dataTxt = params.get("zh") + params.get("bh") + params.get("year") + params.get("xm") + params.get("sfz") + params.get("ksrq") + params.get("jsrq");
+        String encrypted = dataSign(dataTxt, SEVEN_OFFICIALPUSH_TOKEN);
+        params.put("SignMsg", encrypted);
+        String respone = "";
+        log.info("学时信息推送参数"+ dataTxt);
+        try {
+            respone = HttpUtils.postFormBody(OFFICIALPUSH_SEVEN_PERIODPATH, params);
+            log.info("学时信息推送参数结果"+ respone);
+            String[] split = respone.split("\\|");
+            if (split.length < 2) {
+                return "推送接口返回数据错误";
+            }
+            if (split[0].equals("OK")) {
+                //推送成功
+                LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlush, 1);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushMsg, respone);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushTime, DateUtils.getNowTime());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodStatusNum, userVo.getPeriodStatusNum() + 1);
+                this.update(null, objectLambdaUpdateWrapper);
+                return null;
+            } else {
+                //推送失败
+                LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushMsg, respone);
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
+                this.update(null, objectLambdaUpdateWrapper);
+                return respone;
+            }
+        } catch (IOException e) {
+            throw new CustomException("请求错误");
+        }
+    }
+
     /**
      * 批量学时推送
      *

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeUserVo.java

@@ -159,4 +159,5 @@ public class ClassGradeUserVo {
 	@Excel(name = "学习记录同步到老系统时间")
 	@ApiModelProperty("学习记录同步到老系统时间")
 	private Long toOldTime;
+	private Long orderGoodsId;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java

@@ -229,4 +229,5 @@ public class ClassPeriodStudentVo {
 	private String fullName;
 	@ApiModelProperty("")
 	private String token;
+	private Long orderGoodsId;
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -346,7 +346,7 @@ public class OrderGoodsVo {
 
 	@ApiModelProperty("是否可以预约标识:1未参加考试 2已参加考试 3考试成绩未通过")
 	private Integer subscribeSign;
-
+	private String sevenYear;
 	/** 七大员公共课版本号 */
 	@Excel(name = "七大员公共课版本号")
 	@ApiModelProperty("七大员公共课版本号")

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -2183,6 +2183,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
             ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
             queryBo.setGradeId(vo.getGradeId());
             queryBo.setUserId(vo.getUserId());
+            queryBo.setOrderGoodsId(vo.getOrderGoodsId());
             String result = iClassGradeUserService.pushOfficialInfo(queryBo);
         }
     }
@@ -2199,6 +2200,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
             ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
             queryBo.setGradeId(vo.getGradeId());
             queryBo.setUserId(vo.getUserId());
+            queryBo.setOrderGoodsId(vo.getOrderGoodsId());
             String result = iClassGradeUserService.pushOfficialPeriod(queryBo);
         }
     }

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -180,6 +180,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         lqw.eq(bo.getModuleId() != null, UserStudyRecord::getModuleId, bo.getModuleId());
         lqw.eq(bo.getChapterId() != null, UserStudyRecord::getChapterId, bo.getChapterId());
         lqw.eq(bo.getGradeId() != null, UserStudyRecord::getGradeId, bo.getGradeId());
+        lqw.eq(bo.getOrderGoodsId() != null, UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId());
         lqw.eq( UserStudyRecord::getCurrentStatus, 1);
         UserStudyRecord last = this.getOne(lqw.ge(UserStudyRecord::getFirstStartTime,0).last("limit 1"));
         if(Validator.isEmpty(last)){
@@ -358,7 +359,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         if(courseSectionVo.getSectionType()==1&&Validator.isNotEmpty(bo.getStatus())&&bo.getStatus()==1){
             if(Validator.isNotEmpty(goodsVo)){
                 if(Validator.isNotEmpty(fullName)){
-                    if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")||fullName.equals("考前培训七大员施工现场专业人员")){
+                    if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")||fullName.equals("考前培训七大员施工现场专业人员")||(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员"))){
                         if(Validator.isNotEmpty(courseSectionVo.getDurationTime())||Validator.isNotEmpty(bo.getVideoCurrentTime())){
                             Long videoTime = 0L;
                             if(Validator.isNotEmpty(courseSectionVo.getDurationTime())&&courseSectionVo.getDurationTime().longValue()>0){
@@ -370,6 +371,9 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                             if(fullName.equals("考前培训七大员施工现场专业人员")){
                                 num = 3;
                             }
+                            if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                                num =  (int)Math.ceil(videoTime.intValue()/(46*60));
+                            }
                             UserPeriodQueryBo userPeriodQueryBo2 = new UserPeriodQueryBo();
                             userPeriodQueryBo2.setSectionId(bo.getSectionId());
                             userPeriodQueryBo2.setCourseId(bo.getCourseId());
@@ -1261,7 +1265,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             throw new CustomException("公共章学习数据错误");
         }
         LambdaQueryWrapper<GoodsCourse> lqwCourse = Wrappers.lambdaQuery();
-        lqwCourse.eq(GoodsCourse::getGoodsId, goods.getGoodsId());;
+        lqwCourse.eq(GoodsCourse::getGoodsId, goods.getGoodsId());
         List<GoodsCourse> courseList = iGoodsCourseService.list(lqwCourse);
         Long courseId = null;
         for(GoodsCourse course : courseList){

+ 27 - 20
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -66,6 +66,7 @@
         <result property="toOldStatus" column="to_old_status"/>
         <result property="toOldResult" column="to_old_result"/>
         <result property="toOldTime" column="to_old_time"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
 
@@ -260,7 +261,7 @@
           AND g.change_grade = 0
         AND g.grade_id = #{gradeId}
         AND g.user_id = #{userId}
-
+        AND g.order_goods_id = #{orderGoodsId}
     </select>
 
     <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
@@ -965,7 +966,7 @@
         <if test="goodsId != null and goodsId !='' ">
             and gc.goods_id = #{goodsId}
         </if>
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null  ">
             and gc.course_id=#{courseId}
         </if>
         AND cm.type=3
@@ -1100,10 +1101,10 @@
         WHERE
         ccs.chapter_id = cc.chapter_id
         AND usr.current_status = 1
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null ">
             AND usr.course_id=#{courseId}
         </if>
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null">
             AND usr.module_id=#{moduleId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
@@ -1128,10 +1129,10 @@
         WHERE
         ccs.chapter_id = cc.chapter_id
         AND usr.current_status = 1
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null ">
             AND usr.course_id=#{courseId}
         </if>
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null">
             AND usr.module_id=#{moduleId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
@@ -1156,16 +1157,16 @@
         WHERE 1=1
         AND ubr.current_status = 1
         AND ubr.report_status = 1
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null ">
             AND ubr.module_id=#{moduleId}
         </if>
-        <if test="goodsId != null and goodsId !='' ">
+        <if test="goodsId != null">
             AND ubr.goods_id=#{goodsId}
         </if>
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null ">
             AND cme.module_id=#{moduleId}
         </if>
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null">
             AND cme.course_id =#{courseId}
         </if>
         <if test="userId != null and userId !='' ">
@@ -1179,10 +1180,10 @@
         LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
         WHERE
         1 = 1
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null ">
             AND cmc.module_id=#{moduleId}
         </if>
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null">
             AND cm.course_id =#{courseId}
         </if>
     </select>
@@ -1211,13 +1212,13 @@
         LEFT JOIN exam e ON cme.exam_id = e.exam_id
         WHERE 1=1
         AND  cme.type=1
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null">
             AND  cme.course_id=#{courseId}
         </if>
-        <if test="chapterId != null and chapterId !='' ">
+        <if test="chapterId != null">
             AND cme.chapter_id =#{chapterId}
         </if>
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null">
             AND cme.module_id =#{moduleId}
         </if>
     </select>
@@ -1245,10 +1246,10 @@
         LEFT JOIN exam e ON cme.exam_id = e.exam_id
         WHERE 1=1
         AND  cme.type=3
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null">
             AND  cme.course_id=#{courseId}
         </if>
-        <if test="moduleId != null and moduleId !='' ">
+        <if test="moduleId != null">
             AND cme.module_id =#{moduleId}
         </if>
     </select>
@@ -1281,7 +1282,7 @@
         LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
         WHERE
         1 = 1
-        <if test="chapterId != null and chapterId !='' ">
+        <if test="chapterId != null">
             AND ccs.chapter_id = #{chapterId}
         </if>
         ORDER BY
@@ -1312,10 +1313,10 @@
         WHERE 1=1
         and cme.module_id =0
         and cme.type =1
-        <if test="courseId != null and courseId !='' ">
+        <if test="courseId != null">
             AND  cme.course_id=#{courseId}
         </if>
-        <if test="chapterId != null and chapterId !='' ">
+        <if test="chapterId != null ">
             AND cme.chapter_id = #{chapterId}
         </if>
     </select>
@@ -1593,6 +1594,9 @@
             usr.current_status = 1
           AND usr.user_id = #{userId}
           AND usr.grade_id = #{gradeId}
+        <if test="orderGoodsId != null and orderGoodsId !='' ">
+            AND usr.order_goods_id = #{orderGoodsId}
+        </if>
           AND P.create_time IS NOT NULL
         ORDER BY
             P.create_time
@@ -1609,6 +1613,9 @@
             1 = 1
           AND up.user_id = #{userId}
           AND up.grade_id = #{gradeId}
+         <if test="orderGoodsId != null and orderGoodsId !='' ">
+          AND up.order_goods_id = #{orderGoodsId}
+         </if>
           AND ups.period_status = 1
         ORDER BY
             ups.record_end_time DESC

+ 2 - 1
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -32,6 +32,7 @@
         <result property="closeReason" column="close_reason"/>
         <result property="sevenClassVersion" column="seven_class_version"/>
         <result property="sevenClassStatus" column="seven_class_status"/>
+        <result property="sevenYear" column="seven_year"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.order.vo.OrderGoodsVo" id="OrderGoodsResultVo">
@@ -308,6 +309,7 @@
                  LEFT JOIN `order` o on og.order_sn = o.order_sn
         WHERE o.user_id = #{userId}
           and og.grade_id = #{gradeId}
+          and og.order_goods_id = #{orderGoodsId}
           and og.pay_status in (2, 3, 4)
           and og.refund_status !=2
     </select>
@@ -472,7 +474,6 @@
         og.service_end_time,
         og.order_goods_id,
         og.grade_id,
-        og.seven_year as order_year,
         (SELECT
         COUNT( m.id )
         FROM