yangdamao пре 2 година
родитељ
комит
8a188c6a31
92 измењених фајлова са 1426 додато и 167 уклоњено
  1. 0 17
      run-prod.sh
  2. 2 0
      zhongzheng-admin-saas/src/main/resources/application-dev.yml
  3. 2 0
      zhongzheng-admin-saas/src/main/resources/application-pre.yml
  4. 2 0
      zhongzheng-admin-saas/src/main/resources/application-prod.yml
  5. 2 2
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/QuestionController.java
  6. 11 2
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  7. 2 1
      zhongzheng-admin/src/main/resources/application-dev.yml
  8. 2 0
      zhongzheng-admin/src/main/resources/application-pre.yml
  9. 2 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  10. 3 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java
  11. 7 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java
  12. 8 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserStudyRecordController.java
  13. 3 0
      zhongzheng-api/src/main/resources/application-dev.yml
  14. 2 0
      zhongzheng-api/src/main/resources/application-pre.yml
  15. 2 0
      zhongzheng-api/src/main/resources/application-prod.yml
  16. 5 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java
  17. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  18. 29 28
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  19. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java
  20. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  21. 19 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  22. 5 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java
  23. 0 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java
  24. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/ShoppingCartVo.java
  25. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterAddBo.java
  26. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterEditBo.java
  27. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseQueryBo.java
  28. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseChapter.java
  29. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseHandoutsService.java
  30. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java
  31. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java
  32. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterVo.java
  33. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsAddBo.java
  34. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsEditBo.java
  35. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/Goods.java
  36. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java
  37. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java
  38. 21 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  39. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java
  40. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsVo.java
  41. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeUserTempQueryBo.java
  42. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodAddBo.java
  43. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodEditBo.java
  44. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/ClassGrade.java
  45. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/ClassGradeUserTemp.java
  46. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriod.java
  47. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeMapper.java
  48. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java
  49. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeService.java
  50. 5 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java
  51. 30 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java
  52. 411 9
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  53. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserTempServiceImpl.java
  54. 51 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java
  55. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeUserVo.java
  56. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeVo.java
  57. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java
  58. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java
  59. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodVo.java
  60. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsAddBo.java
  61. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsEditBo.java
  62. 6 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsQueryBo.java
  63. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderGoods.java
  64. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderGoodsMapper.java
  65. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java
  66. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderService.java
  67. 6 6
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsRefundServiceImpl.java
  68. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java
  69. 0 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderInvoiceServiceImpl.java
  70. 123 15
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java
  71. 13 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java
  72. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java
  73. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysOldOrg.java
  74. 9 5
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java
  75. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java
  76. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java
  77. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java
  78. 12 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java
  79. 157 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java
  80. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java
  81. 57 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml
  82. 2 0
      zhongzheng-system/src/main/resources/mapper/modules/base/ShoppingCartMapper.xml
  83. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml
  84. 3 4
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseHandoutsMapper.xml
  85. 2 5
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml
  86. 14 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml
  87. 19 2
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml
  88. 105 29
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml
  89. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodMapper.xml
  90. 46 0
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml
  91. 2 2
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderInputMapper.xml
  92. 84 0
      zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

+ 0 - 17
run-prod.sh

@@ -1,12 +1,4 @@
 #!/usr/bin/env bash
-
-
-echo "开始等待20秒..."
-# 1-10秒内随机
-sleep 5
-echo "等待后继续"
-
-#!/usr/bin/env bash
 # 定义应用组名
 group_admin_name='zhongzheng'
 # 定义应用名称
@@ -40,12 +32,3 @@ docker run \
 -v /data/nginx/conf.d:/data/nginx/conf.d \
 -d ${group_admin_name}/${app_admin_name}:${app_admin_version}
 echo '----start container admin----'
-
-echo "开始等待20秒..."
-# 1-10秒内随机
-sleep 5
-echo "等待后继续"
-
-
-
-

+ 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 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -76,8 +76,8 @@ public class QuestionController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<QuestionVo> list(QuestionQueryBo bo) {
         startPage();
-        List<QuestionVo> list = iQuestionService.selectListByBo(bo);
-        return getDataTable(list);
+    //    List<QuestionVo> list = ;
+        return iQuestionService.selectListByBo(bo);
     }
 
     /**

+ 11 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -639,11 +639,12 @@ public class CommonController extends BaseController {
     @PostMapping("/common/free/encryptDes")
     public AjaxResult encryptDes(@RequestBody ClassGradeDecryptQueryBo bo) {
         try{
-            String source = "bh="+bo.getBh()+"&idnum="+bo.getIdnum()+"&datetime=20230627";
+            byte[] Keys = new byte[]{0x22, 0x34, 0x76, 0x58, (byte) 0x90, (byte) 0xAB, (byte) 0xAD, (byte) 0xBF};
+            byte[] rgbKey = "83A3C737FC54B575CC2ABDEFDCE090".substring(0, 8).getBytes("UTF-8");
+            String source = "bh="+bo.getBh()+"&idnum="+bo.getIdnum()+"&datetime=20230821";
             System.out.println(source);
             return AjaxResult.success(ToolsUtils.encryptDesNew(source,bo.getToken().substring(0, 8)));
         }catch (Exception e){
-            System.out.println(e.getMessage());
             return null;
         }
     }
@@ -653,6 +654,8 @@ public class CommonController extends BaseController {
     @PostMapping("/common/free/dncryptDes")
     public AjaxResult dncryptDes(@RequestBody ClassGradeDecryptQueryBo bo) {
         try{
+            byte[] Keys = new byte[]{0x22, 0x34, 0x76, 0x58, (byte) 0x90, (byte) 0xAB, (byte) 0xAD, (byte) 0xBF};
+            byte[] rgbKey = "01b5d9833987efdff54483cdc9720da6".substring(0, 8).getBytes("UTF-8");
             System.out.println(ToolsUtils.decryptDesNew(bo.getData(), bo.getToken().substring(0, 8)));
             return AjaxResult.success();
         }catch (Exception e){
@@ -675,6 +678,12 @@ public class CommonController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("批量学时信息推送")
+    @PreAuthorize("@ss.hasPermi('app:user:edit')")
+    @PostMapping("/common/free/pushPeriod")
+    public AjaxResult pushPeriod(@RequestBody List<ClassGradeUserQueryBo>  list) {
+        return AjaxResult.success(iClassGradeUserService.pushOfficialPeriodMore(list));
+    }
     @ApiOperation("测试获取山东题库")
     @PreAuthorize("@ss.hasPermi('system:withdrawal:add')")
     @Log(title = "测试获取山东题库", businessType = BusinessType.INSERT)

+ 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/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -59,6 +59,7 @@ public class ClassGradeController extends BaseController {
         startPage();
         bo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
         bo.setPastDue(1L);
+
         List<ClassGradeVo> list = iClassGradeService.queryList(bo);
         return getDataTable(list);
     }
@@ -79,7 +80,8 @@ public class ClassGradeController extends BaseController {
     @ApiOperation("获取班级详细信息")
     @GetMapping("/{classId}")
     public AjaxResult<ClassGradeVo> getInfo(@PathVariable("classId") Long classId) {
-        return AjaxResult.success(iClassGradeService.queryById(classId));
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        return AjaxResult.success(iClassGradeService.queryClassById(classId,loginUser.getUser().getUserId()));
     }
 
     /**

+ 7 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java

@@ -211,4 +211,11 @@ public class OrderController extends BaseController {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         return AjaxResult.success(iOrderService.getHaveBuyGoodsNotExpired(bo.getGoodsId(),loginUser.getUser().getUserId()));
     }
+
+    @ApiOperation("七大员课程学习校验")
+    @GetMapping("/study/check/{orderGoodsId}")
+    public AjaxResult<Void> studyCheck(@PathVariable("orderGoodsId") Long orderGoodsId) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        return toAjax(iOrderService.studyCheck(orderGoodsId,loginUser.getUser().getUserId()) ? 1 : 0);
+    }
 }

+ 8 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserStudyRecordController.java

@@ -197,4 +197,12 @@ public class UserStudyRecordController extends BaseController {
         bo.setUserId(loginUser.getUser().getUserId());
         return AjaxResult.success(iUserStudyRecordService.queryLiveLast(bo));
     }
+
+    @ApiOperation("继教七大员公共课程同步")
+    @GetMapping("/syncSevenPublicClass")
+    public AjaxResult<Integer> syncSevenPublicClass(UserStudyRecordQueryBo bo){
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iUserStudyRecordService.syncSevenPublicClass(bo.getOrderGoodsId(),bo.getUserId()));
+    }
 }

+ 3 - 0
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
@@ -181,3 +183,4 @@ exam:
     applyUpdate: http://192.168.1.7:9099/cd/exam/update
     applyDelete: http://192.168.1.7:9099/cd/exam/delete
     subscribeSave: http://192.168.1.7:9099/cd/subscribe/save
+

+ 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

+ 5 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1573,6 +1573,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return baseMapper.listByIdsNotTenant(userIds);
     }
 
+    @Override
+    public String createToken(LoginUser loginUser) {
+        return tokenService.createToken(loginUser);
+    }
+
 
     @Override
     public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java

@@ -44,4 +44,5 @@ public interface OssService {
     InputStream getStreamByObject(String filePath) throws Exception;
 
     void processObject(String targetImage ,String sourceImage,String styleType) ;
+
 }

+ 29 - 28
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -289,34 +289,6 @@ public class OssServiceImpl implements OssService {
         }
     }
 
-    @Override
-    public String uploadWithUrl(OssRequest base, String urlString){
-        String path = null;
-        InputStream inputStream = null;
-        try {
-            URL url = new URL(urlString);
-            URLConnection con = url.openConnection();
-            //获取上传文件输入流
-            inputStream =con.getInputStream();
-            path = uploadInputStream(inputStream,base.getImageStatus());
-
-            // 关闭OSSClient。
-            //ossClient.shutdown();
-            return path;
-        } catch (Exception e) {
-
-        }finally {
-            try {
-                if (null != inputStream) {
-                    inputStream.close();
-                }
-            }catch (IOException e){
-
-            }
-            return path;
-        }
-    }
-
     @Override
     public String uploadInputStream(InputStream inputStream, Integer imageStatus) throws Exception {
         try {
@@ -432,6 +404,35 @@ public class OssServiceImpl implements OssService {
         }
     }
 
+    @Override
+    public String uploadWithUrl(OssRequest base, String urlString){
+        String path = null;
+        InputStream inputStream = null;
+        try {
+            URL url = new URL(urlString);
+            URLConnection con = url.openConnection();
+            //获取上传文件输入流
+            inputStream =con.getInputStream();
+            path = uploadInputStream(inputStream,base.getImageStatus());
+
+            // 关闭OSSClient。
+            //ossClient.shutdown();
+            return path;
+        } catch (Exception e) {
+
+        }finally {
+            try {
+                if (null != inputStream) {
+                    inputStream.close();
+                }
+            }catch (IOException e){
+
+            }
+            return path;
+        }
+    }
+
+
     public void zipFile(List<String> fileList, ZipOutputStream zipOut,String dir) {
         if (CollectionUtils.isEmpty(fileList)) {
             return;

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java

@@ -20,6 +20,10 @@ import java.util.List;
  * @date 2021-10-21
  */
 public interface QuestionMapper extends BaseMapper<Question> {
+    List<Long> selectListByBoBackId(QuestionQueryBo bo);
+
+    List<QuestionVo> selectListByBoWithId(QuestionQueryBo bo);
+
     List<QuestionVo> selectListByBo(QuestionQueryBo bo);
 
     List<GoodsUserQuestionVo> listGoodsUserQuestionVo(GoodsQueryBo bo);

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

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.bank.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.modules.bank.bo.QuestionAddBo;
 import com.zhongzheng.modules.bank.bo.QuestionBatchDelBo;
 import com.zhongzheng.modules.bank.bo.QuestionEditBo;
@@ -32,7 +33,7 @@ public interface IQuestionService extends IService<Question> {
 	 */
 	QuestionVo queryById(Long questionId);
 
-	List<QuestionVo> selectListByBo(QuestionQueryBo bo);
+	TableDataInfo<QuestionVo> selectListByBo(QuestionQueryBo bo);
 
 
 	List<GoodsUserQuestionVo> listUserFreeGoodsList(GoodsQueryBo bo);

+ 19 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.bank.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSON;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,6 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
@@ -150,8 +153,22 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     }
 
     @Override
-    public List<QuestionVo> selectListByBo(QuestionQueryBo bo) {
-        return questionMapper.selectListByBo(bo);
+    public TableDataInfo<QuestionVo> selectListByBo(QuestionQueryBo bo) {
+        TableDataInfo tableDataInfo = new TableDataInfo();
+        List<Long> ids = questionMapper.selectListByBoBackId(bo);
+        if(ids.size()>0){
+            bo.setIds(ids);
+            List<QuestionVo> list = questionMapper.selectListByBoWithId(bo);
+            tableDataInfo.setTotal(new PageInfo(ids).getTotal());
+            tableDataInfo.setRows(list);
+            tableDataInfo.setCode(HttpStatus.HTTP_OK);
+            return tableDataInfo;
+        }else{
+            tableDataInfo.setTotal(new PageInfo(ids).getTotal());
+            tableDataInfo.setRows(ids);
+            tableDataInfo.setCode(HttpStatus.HTTP_OK);
+            return tableDataInfo;
+        }
     }
 
     @Override

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

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -162,7 +163,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         studyRecordQueryBo.setGradeId(bo.getGradeId());
         UserStudyRecordVo studyRecordVo = iUserStudyRecordService.queryLast(studyRecordQueryBo);
         //获取培训结束时间
-        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
+        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                .eq(ClassGradeUser::getUserId, bo.getUserId())
+                .eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
+                .eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
         //获取章列表
         List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
         UserVo userVo = iUserService.queryById(bo.getUserId());

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

@@ -479,7 +479,6 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         sendAuidit(update);
         if (update.getStatus().equals(1)) {
             //审核通过同步身份证到用户信息
-   //         getUserPicInfo(update);
         }
         //审核承诺书发送消息
     //    sendAuiditSMS(update);

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/ShoppingCartVo.java

@@ -70,4 +70,6 @@ public class ShoppingCartVo {
 	private Integer choiceStatus;
 	@ApiModelProperty("班级列表")
 	private List<ClassGradeVo> gradeList;
+	@ApiModelProperty("七大员继教可选年份")
+	private String sevenYear;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterAddBo.java

@@ -53,4 +53,6 @@ public class CourseChapterAddBo {
     /** 导入编号 */
     @ApiModelProperty("导入编号")
     private String importNo;
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterEditBo.java

@@ -64,4 +64,7 @@ public class CourseChapterEditBo {
     /** 导入编号 */
     @ApiModelProperty("导入编号")
     private String importNo;
+
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseQueryBo.java

@@ -117,6 +117,7 @@ public class CourseQueryBo extends BaseEntity {
 
 	@ApiModelProperty("1未开始 2未完成 3已完成")
 	private Integer studyStatus;
+
 	/** 旧企业ID */
 	@ApiModelProperty("旧企业ID")
 	private String oldCompanyId;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseChapter.java

@@ -52,5 +52,7 @@ private static final long serialVersionUID=1L;
 
     @TableField(exist = false)
     private Long oId;
+    /** 公共标识:1公共章 0非公共章 */
+    private String commonSign;
 
 }

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseHandoutsService.java

@@ -61,6 +61,5 @@ public interface ICourseHandoutsService extends IService<CourseHandouts> {
 
 	void removeHandouts(Long handoutsId, Long tenantId);
 
-	List<CourseHandouts> getHandoutsListByTenant(String encoder, String handoutsName, Long tenantId);
-
+    List<CourseHandouts> getHandoutsListByTenant(String encoder, String handoutsName, Long tenantId);
 }

+ 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);
     }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -54,6 +54,7 @@ import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodVo;
 import com.zhongzheng.modules.order.bo.SpecialQuestionBo;
 import com.zhongzheng.modules.order.vo.SpecialQuestionVo;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import com.zhongzheng.modules.user.domain.UserBankRecord;
@@ -657,7 +658,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         return goodsUserVos;
     }
 
-
     @Override
     public List<GoodsUserVo> goodsStudyProgressList(CourseQueryBo bo) {
         List<GoodsUserVo> goodsUserVos = baseMapper.goodsStudyProgressList(bo);

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterVo.java

@@ -81,4 +81,6 @@ public class CourseChapterVo {
 	@Excel(name = "导入编号")
 	@ApiModelProperty("导入编号")
 	private String importNo;
+	@ApiModelProperty("公共标识:1公共章 0非公共章")
+	private Integer commonSign;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsAddBo.java

@@ -197,6 +197,9 @@ public class GoodsAddBo {
     /** 班级类型 1基础班 2强化班 3私塾班 */
     @ApiModelProperty("班级类型 1基础班 2强化班 3私塾班")
     private Integer gradeType;
+    /** 七大员继教可选年份 */
+    @ApiModelProperty("七大员继教可选年份")
+    private String sevenYear;
     @ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
     private String examLimitClient;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsEditBo.java

@@ -231,6 +231,9 @@ public class GoodsEditBo {
     /** 班级类型 1基础班 2强化班 3私塾班 */
     @ApiModelProperty("班级类型 1基础班 2强化班 3私塾班")
     private Integer gradeType;
+    /** 七大员继教可选年份 */
+    @ApiModelProperty("七大员继教可选年份")
+    private String sevenYear;
     @ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
     private String examLimitClient;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/Goods.java

@@ -166,4 +166,6 @@ private static final long serialVersionUID=1L;
     /** 商品试卷限制终端学习,多个,拼接  1公众号 2小程序 */
     @TableField(updateStrategy=FieldStrategy.IGNORED)
     private String examLimitClient;
+    /** 七大员继教可选年份 */
+    private String sevenYear;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -79,5 +79,7 @@ public interface GoodsMapper extends BaseMapper<Goods> {
     @InterceptorIgnore(tenantLine = "true")
     void updateHandoutsId(@Param("goodsId") Long goodsId,@Param("tenantId") Long tenantId,@Param("handoutsId") Long handoutsId);
 
+    String getGoodsBusinessName(Long goodsId);
+
     String getBusinessName(@Param("goodsId") Long goodsId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -143,5 +143,7 @@ public interface IGoodsService extends IService<Goods> {
 
     boolean goodsHandoutsCopyAddTenant(GoodsHandoutsCopyTenantBo bo);
 
+	String getGoodsBusinessName(Long goodsId);
+
 	String getBusinessName(Long goodsId);
 }

+ 21 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -956,10 +956,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         queryBo.setId(goodsVo.getBusinessId());
         String fullName = iCourseBusinessService.queryFullName(queryBo);
         goodsVo.setErJianErZao(false);
+        goodsVo.setJjShiGongYuan(false);
         if(Validator.isNotEmpty(fullName)){
             if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")){
                 goodsVo.setErJianErZao(true);
             }
+            if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                goodsVo.setJjShiGongYuan(true);
+            }
         }
         CourseBusinessVo businessVo = iCourseBusinessService.queryById(goodsVo.getBusinessId());
         if(Validator.isNotEmpty(businessVo)){
@@ -4906,19 +4910,27 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             if (ObjectUtils.isNull(goodsTwo)){
                 continue;
             }
-//           List<Long> goodsIds = iCourseHandoutsService.getGoodsIds(goodsTwo.getHandoutsId(),tenantId);
+            Set<Long> goodsIds = new HashSet<>();
+            goodsIds.add(goodsTwo.getGoodsId());
 //            if (goodsIds.stream().allMatch(x -> x.equals(goodsTwo.getGoodsId()))){
 //                //删除讲义
 //                iCourseHandoutsService.removeHandouts(goodsTwo.getHandoutsId(),tenantId);
 //            }
+
             //如果存在先删除掉之前的讲义
             List<CourseHandouts> handoutsList = iCourseHandoutsService.getHandoutsListByTenant(handouts.getEncoder(),handouts.getHandoutsName(),tenantId);
 
             if (CollectionUtils.isNotEmpty(handoutsList)){
                 handoutsList.forEach(item -> {
+                    List<Long> goodsIdsTwo = iCourseHandoutsService.getGoodsIds(item.getHandoutsId(), tenantId);
+                    if (CollectionUtils.isNotEmpty(goodsIdsTwo)){
+                        goodsIds.addAll(goodsIdsTwo);
+                    }
                     iCourseHandoutsService.removeHandouts(item.getHandoutsId(),tenantId);
                 });
+
             }
+
             //新增
             handouts.setHandoutsId(null);
             handouts.setTenantId(tenantId);
@@ -4953,11 +4965,18 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 handleCourseFile(courseFileList,newId,tenantId);
             }
 
-            updateHandoutsId(goodsTwo.getGoodsId(),tenantId,newId);
+            goodsIds.forEach(goodsId -> {
+                updateHandoutsId(goodsId,tenantId,newId);
+            });
         }
         return true;
     }
 
+    @Override
+    public String getGoodsBusinessName(Long goodsId) {
+        return baseMapper.getGoodsBusinessName(goodsId);
+    }
+
     @Override
     public String getBusinessName(Long goodsId) {
         return baseMapper.getBusinessName(goodsId);

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java

@@ -424,4 +424,9 @@ public class GoodsUserVo {
 
 	@ApiModelProperty("关联题库商品ID")
 	private Long questionGoodsId;
+
+	@ApiModelProperty("七大员继教商品年份")
+	private String sevenYear;
+	@ApiModelProperty("七大员继教订单商品年份")
+	private String orderYear;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsVo.java

@@ -369,4 +369,9 @@ public class GoodsVo {
 	@ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
 	private String examLimitClient;
 
+	/** 七大员继教可选年份 */
+	@ApiModelProperty("七大员继教可选年份")
+	private String sevenYear;
+	@ApiModelProperty("是否是继教施工员")
+	private Boolean jjShiGongYuan;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeUserTempQueryBo.java

@@ -54,4 +54,6 @@ public class ClassGradeUserTempQueryBo extends BaseEntity {
 	/** 订单编号 */
 	@ApiModelProperty("订单编号")
 	private String orderSn;
+	@ApiModelProperty("七大员继教商品年份")
+	private String sevenYear;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodAddBo.java

@@ -51,4 +51,7 @@ public class UserPeriodAddBo {
     /** 班级ID */
     @ApiModelProperty("班级ID")
     private Long gradeId;
+    /** 订单商品ID */
+    @ApiModelProperty("订单商品ID")
+    private Long orderGoodsId;
 }

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

@@ -82,4 +82,5 @@ public class UserPeriodEditBo {
     @ApiModelProperty("打回操作平台 1自有系统 2老系统")
     private Integer rollBackPlat;
 
+
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/ClassGrade.java

@@ -22,7 +22,8 @@ import com.zhongzheng.common.annotation.Excel;
 @TableName("class_grade")
 public class ClassGrade implements Serializable {
     public static final Integer INIT_UPPER = 300;  //初始人数
-    public static final Integer INIT_UPPER2 = 1000000;  //初始人数
+    public static final Integer INIT_UPPER2 = 100000;  //初始人数
+    public static final Integer INIT_UPPER3 = 1000;  //初始人数
 
 private static final long serialVersionUID=1L;
 

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/ClassGradeUserTemp.java

@@ -48,4 +48,6 @@ private static final long serialVersionUID=1L;
     private Long goodsId;
     /** 订单编号 */
     private String orderSn;
+    /** 七大员继教商品年份 */
+    private String sevenYear;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriod.java

@@ -50,4 +50,6 @@ private static final long serialVersionUID=1L;
     private Long chapterId;
     /** 班级ID */
     private Long gradeId;
+    /** 订单商品ID */
+    private Long orderGoodsId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeMapper.java

@@ -7,6 +7,7 @@ import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGrade;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.grade.vo.*;
+import com.zhongzheng.modules.order.domain.OrderGoods;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
@@ -86,4 +87,6 @@ public interface ClassGradeMapper extends BaseMapper<ClassGrade> {
 
     @InterceptorIgnore(tenantLine = "true")
     void UpGradeInterfaceByTenant(ClassGradeOpenUpBo upBo);
+
+    OrderGoods getOrderGoodsByClassId(@Param("gradeId") Long gradeId,@Param("userId") Long userId);
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java

@@ -88,4 +88,10 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
     List<ClassGradeUserVo> queryCountList(@Param("projectId")Integer projectId, @Param("businessId")Integer businessId, @Param("all") Integer all);
 
     Long checkFinishRequiredCourse(ClassGradeUserQueryBo bo);
+
+    Long getPeriodStartTime(ClassGradeUserQueryBo bo);
+
+    Long getPeriodEndTime(ClassGradeUserQueryBo bo);
+
+    List<ClassGradeUser> getClassInfoByUser(Long userId);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeService.java

@@ -23,6 +23,8 @@ public interface IClassGradeService extends IService<ClassGrade> {
 	 */
 	ClassGradeVo queryById(Long classId);
 
+	ClassGradeVo queryClassById(Long classId, Long userId);
+
 	/**
 	 * 查询列表
 	 */
@@ -104,4 +106,6 @@ public interface IClassGradeService extends IService<ClassGrade> {
 	void openOfficialGrade(ClassGradeOpenBo bo);
 
 	List<ClassNpUserInfoVo> otherClassUserList(ClassNpUserInfoBo bo);
+
+
 }

+ 5 - 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);
@@ -139,4 +141,6 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	Long checkFinishRequiredCourse(ClassGradeUserQueryBo bo);
 
+    List<ClassGradeUser> getClassInfoByUser(Long userId);
+
 }

+ 30 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -41,7 +41,9 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
 import com.zhongzheng.modules.inform.vo.InformRemindVo;
+import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.mapper.OrderMapper;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
@@ -154,6 +156,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Autowired
     private ISysOldOrgService sysOldOrgService;
 
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+
     @Autowired
     private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
 
@@ -179,6 +184,19 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         return entity2Vo(baseMapper.queryList(classGradeQueryBo)).get(0);
     }
 
+    @Override
+    public ClassGradeVo queryClassById(Long gradeId,Long userId) {
+        ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
+        classGradeQueryBo.setGradeId(gradeId);
+        ClassGradeVo vo = entity2Vo(baseMapper.queryList(classGradeQueryBo)).get(0);
+        //七大员继教年份
+        OrderGoods orderGoods = baseMapper.getOrderGoodsByClassId(gradeId,userId);
+        if (ObjectUtils.isNotNull(orderGoods)){
+            vo.setSevenYear(orderGoods.getSevenYear());
+        }
+        return vo;
+    }
+
     @Override
     @DataScope(businessAlias = "cb")
     public List<ClassGradeVo> queryList(ClassGradeQueryBo bo) {
@@ -199,6 +217,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         if (CollectionUtils.isEmpty(classGradeVos)) {
             return new ArrayList<>();
         }
+        for (ClassGradeVo classGradeVo : classGradeVos) {
+            classGradeVo.setStudentNumAll(classGradeVo.getStudentNum());
+        }
         return classGradeVos;
     }
 
@@ -240,13 +261,13 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
         add.setGradeCode(ServletUtils.getEncoded("BJ"));
-        LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
+        /*LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
         lqw.eq(ClassGrade::getClassName, add.getClassName());
         lqw.eq(ClassGrade::getStatus, 1);
         List<ClassGrade> list = this.list(lqw);
         if (CollectionUtils.isNotEmpty(list)) {
             throw new RuntimeException("班级名称不能重复");
-        }
+        }*/
         //企业ID
         String tenant = ServletUtils.getRequest().getHeader("TenantId");
         SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
@@ -437,7 +458,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         }
 
         if (bo.getStatus() != -1) {
-            LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
+           /* LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
             lqw.eq(ClassGrade::getClassName, update.getClassName());
             lqw.eq(ClassGrade::getStatus, 1);
             lqw.eq(ClassGrade::getGradeId, update.getGradeId());
@@ -450,7 +471,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 if (CollectionUtils.isNotEmpty(classList)) {
                     throw new RuntimeException("班级名称不能重复");
                 }
-            }
+            }*/
         }
         if (bo.getStatus() == -1) { //删除判断班级是否人数空
             ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
@@ -645,6 +666,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
      */
     private void validEntityBeforeSave(ClassGrade entity) {
         //TODO 做一些数据校验,如唯一约束
+        if(Validator.isNotEmpty(entity.getOfficialName())){
+            entity.setOfficialName(entity.getOfficialName().trim());
+        }
     }
 
     @Override
@@ -1282,6 +1306,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 classUserNumBo.setOfficialName(classGrade.getOfficialName());
                 ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
                 classGradeQueryBo.setOfficialName(classGrade.getOfficialName());
+                classGradeQueryBo.setClassSign(1);
                 Integer count = baseMapper.queryOfficialGradeCount(classGradeQueryBo);
                 classUserNumBo.setNum(ObjectUtils.isNotNull(count) ? count : 0);
                 return classUserNumBo;
@@ -1295,6 +1320,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         classUserNumBo.setOfficialName(encoded);
         ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
         classGradeQueryBo.setOfficialName(encoded);
+        classGradeQueryBo.setClassSign(1);
         Integer count = baseMapper.queryOfficialGradeCount(classGradeQueryBo);
         classUserNumBo.setNum(ObjectUtils.isNotNull(count) ? count : 0);
         return classUserNumBo;

+ 411 - 9
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -14,6 +14,8 @@ import com.github.pagehelper.Page;
 import com.google.common.base.Splitter;
 import com.zhongzheng.common.annotation.DataScope;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.core.redis.RedisLockEntity;
 import com.zhongzheng.common.exception.CustomException;
@@ -34,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.*;
@@ -52,6 +55,7 @@ import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
+import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserBankRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
@@ -68,6 +72,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.core.token.TokenService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -106,6 +111,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private OssService ossService;
 
+    @Autowired
+    private ISysUserService iSysUserService;
+
     @Autowired
     private IOrderService iOrderService;
 
@@ -121,6 +129,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private IGoodsService iGoodsService;
 
+
     @Autowired
     private RedisCache redisCache;
 
@@ -166,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
@@ -411,6 +430,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         if (Validator.isEmpty(bo.getGradeId())) {
             throw new CustomException("参数错误");
         }
+        if (Validator.isEmpty(bo.getOrderGoodsId())) {
+            throw new CustomException("参数错误");
+        }
         ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
         queryBo.setGradeId(bo.getGradeId());
         queryBo.setUserId(bo.getUserId());
@@ -422,6 +444,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
         subjectStudyRecordQueryBo.setUserId(bo.getUserId());
         subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
+        subjectStudyRecordQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
         List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
         for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
             secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
@@ -440,6 +463,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         classGradeUserQueryBo.setGradeId(bo.getGradeId());
         classGradeUserQueryBo.setUserId(bo.getUserId());
         classGradeUserQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
+        classGradeUserQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
         List<ClassPeriodUserVo> classPeriodUserVos1 = baseMapper.listPeriod(classGradeUserQueryBo);
         ClassPeriodUserVo classPeriodUserVos = classPeriodUserVos1.get(0);
         classPeriodUserVos.setPending(classPeriodStudentVo.getSecAllNum() - classPeriodUserVos.getPass() - classPeriodUserVos.getCheat());
@@ -533,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){
@@ -568,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 "班级开始时间缺失";
@@ -639,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;
@@ -680,7 +829,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         ClassGradeUser classGradeUser = null;
         ClassGrade grade = null;
         for (ClassGrade classGrade : classGradeList) {
-            classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, classGrade.getGradeId()).eq(ClassGradeUser::getUserId, user.getUserId()).last("limit 1"));
+            classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                    .eq(ClassGradeUser::getGradeId, classGrade.getGradeId())
+                    .eq(ClassGradeUser::getUserId, user.getUserId()).last("limit 1"));
             if (Validator.isNotEmpty(classGradeUser)) {
                 grade = classGrade;
                 break;
@@ -706,12 +857,117 @@ 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);
         }
         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;
     }
 
@@ -743,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 "";
 //        }
@@ -760,7 +1015,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         if (Validator.isEmpty(userVo)) {
             return "用户不存在";
         }
-        if (Validator.isEmpty(userVo.getInterfacePushId()) || !userVo.getInterfacePushId().equals(1L)) {
+        if (Validator.isEmpty(userVo.getInterfacePushId())) {
             return "没开通信息推送";
         }
         if (Validator.isEmpty(userVo.getOfficialName())) {
@@ -769,6 +1024,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         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) {
@@ -789,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)
@@ -807,19 +1076,147 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         studyRecordQueryBo.setGradeId(userVo.getGradeId());
         //第一条学习记录
         UserStudyRecordVo firstVo = iUserStudyRecordService.queryFirst(studyRecordQueryBo);
+        if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("office.account"))){
+            OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("office.account");
+            OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("office.token");
+        }
+        ClassGradeUserQueryBo userQueryBo = new ClassGradeUserQueryBo();
+        userQueryBo.setUserId(bo.getUserId());
+        userQueryBo.setGradeId(userVo.getGradeId());
+        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());
         params.put("xm", userVo.getRealName());
         params.put("sfz", userVo.getIdCard());
-        params.put("ksrq", DateUtils.timestampToDate(firstVo.getFirstStartTime()));
-        params.put("jsrq", DateUtils.timestampToDate(userVo.getPeriodWaitTime()));
+        params.put("ksrq", DateUtils.timestampToDate(startTime));
+        params.put("jsrq", DateUtils.timestampToDate(endTime));
         String dataTxt = params.get("zh") + params.get("bh") + params.get("xm") + params.get("sfz") + params.get("ksrq") + params.get("jsrq");
         String encrypted = dataSign(dataTxt, OFFICIALPUSH_TOKEN);
         params.put("SignMsg", encrypted);
         String respone = "";
+        log.info("学时信息推送参数"+ dataTxt);
         try {
             respone = HttpUtils.postFormBody(OFFICIALPUSH_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("请求错误");
+        }
+    }
+
+    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 "推送接口返回数据错误";
@@ -2847,6 +3244,11 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return baseMapper.checkFinishRequiredCourse(bo);
     }
 
+    @Override
+    public List<ClassGradeUser> getClassInfoByUser(Long userId) {
+        return baseMapper.getClassInfoByUser(userId);
+    }
+
 
     /**
      * 实体类转化成视图对象

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserTempServiceImpl.java

@@ -45,6 +45,7 @@ public class ClassGradeUserTempServiceImpl extends ServiceImpl<ClassGradeUserTem
         lqw.eq(bo.getStatus() != null, ClassGradeUserTemp::getStatus, bo.getStatus());
         lqw.eq(bo.getFromType() != null, ClassGradeUserTemp::getFromType, bo.getFromType());
         lqw.eq(StrUtil.isNotBlank(bo.getOrderSn()), ClassGradeUserTemp::getOrderSn, bo.getOrderSn());
+        lqw.eq(StrUtil.isNotBlank(bo.getSevenYear()), ClassGradeUserTemp::getSevenYear, bo.getSevenYear());
         return entity2Vo(this.list(lqw));
     }
 

+ 51 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -36,6 +36,7 @@ import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.exam.bo.CdUserSubscribeBo;
 import com.zhongzheng.modules.exam.domain.ExamApplyGoods;
 import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
+import com.zhongzheng.modules.course.vo.*;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
@@ -190,6 +191,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     @Autowired
     private ICourseChapterSectionService iCourseChapterSectionService;
 
+    @Autowired
+    private ICourseChapterService iCourseChapterService;
+
     @Value("${oldStudySys.syncPath}")
     private String SYNC_PATH;
 
@@ -308,6 +312,15 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
         classGradeUserQueryBo.setUserId(userPeriodVo.getUserId());
         classGradeUserQueryBo.setGradeId(userPeriodVo.getGradeId());
         classGradeUserQueryBo.setGoodsId(userPeriodVo.getGoodsId());
+        if(Validator.isNotEmpty(userPeriodVo.getOrderGoodsId())){
+            classGradeUserQueryBo.setOrderGoodsId(userPeriodVo.getOrderGoodsId());
+            bo.setOrderGoodsId(userPeriodVo.getOrderGoodsId());
+        }else{
+            //非七大员
+            ClassGradeUser classGradeUser =iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, userPeriodVo.getGradeId()).eq(ClassGradeUser::getUserId, userPeriodVo.getUserId()).last("limit 1"));
+            classGradeUserQueryBo.setOrderGoodsId(classGradeUser.getOrderGoodsId());
+            bo.setOrderGoodsId(classGradeUser.getOrderGoodsId());
+        }
         Integer gradePeriodStatus = iClassGradeUserService.updateUserPeriodStatus(classGradeUserQueryBo);
         //发送审核不通过消息
         bo.setStatus(gradePeriodStatus);
@@ -346,17 +359,19 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean editPeriodAll(UserPeriodEditBo bo) {
+        Long orderGoodsId = null;
         CourseBusiness business = null;
         for (Long id : bo.getIds()) {
             UserPeriodStatusVo oldData = userPeriodStatusService.queryById(id);
             Long goodsId;
             String userName = "系统自动审核通过";
+            UserPeriod period = getById(oldData.getPeriodId());
             if (ObjectUtils.isNotNull(bo.getGoodsId())){
                 goodsId = bo.getGoodsId();
             }else {
-                UserPeriod period = getById(oldData.getPeriodId());
                 goodsId = period.getGoodsId();
             }
+            orderGoodsId = period.getOrderGoodsId();
             //获取业务学时审核数据
             Goods goods = iGoodsService.getById(goodsId);
             business = iCourseBusinessService.getById(goods.getBusinessId());
@@ -400,12 +415,31 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
             userPeriods.eq(UserPeriodStatus::getPeriodStatus, 1);
             userPeriods.eq(UserPeriodStatus::getStatus, 2);
             userPeriodStatusService.update(userPeriodStatus, userPeriods);
+
+            CourseChapterVo chapterVo = iCourseChapterService.queryById(period.getChapterId());
+            if(Validator.isNotEmpty(chapterVo)&&Validator.isNotEmpty(chapterVo.getCommonSign())&&chapterVo.getCommonSign()==1){
+                if(bo.getStatus()==0){
+                    LambdaUpdateWrapper<OrderGoods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                    objectLambdaUpdateWrapper.eq(OrderGoods::getOrderGoodsId, period.getOrderGoodsId());
+                    objectLambdaUpdateWrapper.set(OrderGoods::getSevenClassStatus, 4);
+                    iOrderGoodsService.update(null, objectLambdaUpdateWrapper);
+                }
+            }
         }
         //更新班级学员信息
         ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
         classGradeUserQueryBo.setUserId(bo.getUserId());
         classGradeUserQueryBo.setGradeId(bo.getGradeId());
         classGradeUserQueryBo.setGoodsId(bo.getGoodsId());
+        if(Validator.isNotEmpty(orderGoodsId)){
+            classGradeUserQueryBo.setOrderGoodsId(orderGoodsId);
+            bo.setOrderGoodsId(orderGoodsId);
+        }else{
+            //非七大员
+            ClassGradeUser classGradeUser =iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, bo.getGradeId()).eq(ClassGradeUser::getUserId, bo.getUserId()).last("limit 1"));
+            classGradeUserQueryBo.setOrderGoodsId(classGradeUser.getOrderGoodsId());
+            bo.setOrderGoodsId(classGradeUser.getOrderGoodsId());
+        }
         Integer gradePeriodStatus = iClassGradeUserService.updateUserPeriodStatus(classGradeUserQueryBo);
         //发送审核不通过消息
         if (gradePeriodStatus == 0) {
@@ -428,6 +462,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
         ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
                 .eq(ClassGradeUser::getUserId, bo.getUserId())
                 .eq(ClassGradeUser::getGradeId, bo.getGradeId())
+                .eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
                 .last("limit 1"));
         //获取业务学时审核数据
         Goods goods = iGoodsService.getById(bo.getGoodsId());
@@ -477,6 +512,17 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
             classGradeUserQueryBo.setUserId(bo.getUserId());
             classGradeUserQueryBo.setGradeId(bo.getGradeId());
             classGradeUserQueryBo.setGoodsId(bo.getGoodsId());
+            classGradeUserQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
+
+            ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
+            if(Validator.isNotEmpty(gradeUser)){
+                OrderGoods newOrderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, gradeUser.getOrderGoodsId()));
+                if(newOrderGoods.getSevenClassStatus()==1||newOrderGoods.getSevenClassStatus()==2){
+                    newOrderGoods.setSevenClassStatus(3);
+                    newOrderGoods.setUpdateTime(DateUtils.getNowTime());
+                    iOrderGoodsService.updateById(newOrderGoods);
+                }
+            }
             periodPass(classGradeUserQueryBo);
             //发送消息
             bo.setStatus(1);
@@ -967,12 +1013,13 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean rollbackPeriod(UserPeriodEditBo bo) {
-        if (Validator.isEmpty(bo.getUserId()) || Validator.isEmpty(bo.getGoodsId()) || Validator.isEmpty(bo.getGradeId())) {
+        if (Validator.isEmpty(bo.getUserId()) || Validator.isEmpty(bo.getGoodsId()) || Validator.isEmpty(bo.getGradeId())|| Validator.isEmpty(bo.getOrderGoodsId())) {
             throw new CustomException("参数不全");
         }
         ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
                 .eq(ClassGradeUser::getUserId, bo.getUserId())
                 .eq(ClassGradeUser::getGradeId, bo.getGradeId())
+                .eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
                 .last("limit 1"));
         if (Validator.isEmpty(classGradeUser) || classGradeUser.getPeriodStatus() != 3) {
             throw new CustomException("非审核中状态无法打回操作");
@@ -1033,7 +1080,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
             return;
         }
         redisCache.setCacheObject(key, 1L, 10, TimeUnit.SECONDS);//1分钟
-        ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
+        ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).eq(ClassGradeUser::getOrderGoodsId,bo.getOrderGoodsId()).last("limit 1"));
         if(Validator.isNotEmpty(gradeUser)){
             bo.setOrderGoodsId(gradeUser.getOrderGoodsId());
         }
@@ -1144,7 +1191,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
             return;
         }
         redisCache.setCacheObject(key, 1L, 10, TimeUnit.SECONDS);//1分钟
-        ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
+        ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).eq(ClassGradeUser::getOrderGoodsId,bo.getOrderGoodsId()).last("limit 1"));
         if(Validator.isNotEmpty(gradeUser)){
             bo.setOrderGoodsId(gradeUser.getOrderGoodsId());
         }

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

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeVo.java

@@ -197,4 +197,7 @@ public class ClassGradeVo {
 	private Long goodsId;
 	@ApiModelProperty("用户ID")
 	private Long userId;
+
+	@ApiModelProperty("七大员继教年份")
+	private String sevenYear;
 }

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

@@ -227,4 +227,7 @@ public class ClassPeriodStudentVo {
 	private Integer gradeType;
 	@ApiModelProperty("业务层次名称")
 	private String fullName;
+	@ApiModelProperty("")
+	private String token;
+	private Long orderGoodsId;
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java

@@ -143,6 +143,7 @@ public class ClassPeriodUserVo {
 
 	private Long classEndTime;
 
-	@ApiModelProperty("官方班级名称")
+	@ApiModelProperty("官方班级")
 	private String officialName;
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodVo.java

@@ -63,4 +63,7 @@ public class UserPeriodVo {
 	/** 班级ID */
 	@ApiModelProperty("班级ID")
 	private Long gradeId;
+
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsAddBo.java

@@ -87,6 +87,15 @@ public class OrderGoodsAddBo {
     private String distributionCode;
     @ApiModelProperty("分销链编码")
     private String distributionLinkCode;
+    /** 七大员继教商品年份 */
+    @ApiModelProperty("七大员继教商品年份")
+    private String sevenYear;
+    /** 七大员公共课版本号 */
+    @ApiModelProperty("七大员公共课版本号")
+    private Integer sevenClassVersion;
+    /** 0 未学习 1学习中 2已学完  3已审核 4待重修 */
+    @ApiModelProperty("0 未学习 1学习中 2已学完  3已审核 4待重修")
+    private Integer sevenClassStatus;
     @ApiModelProperty("关联的订单商品ID")
     private Long relevanceId;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsEditBo.java

@@ -107,4 +107,10 @@ public class OrderGoodsEditBo {
     /** 关闭原因 */
     @ApiModelProperty("关闭原因")
     private String closeReason;
+    /** 七大员公共课版本号 */
+    @ApiModelProperty("七大员公共课版本号")
+    private Integer sevenClassVersion;
+    /** 0 未学习 1学习中 2已学完  3已审核 4待重修 */
+    @ApiModelProperty("0 未学习 1学习中 2已学完  3已审核 4待重修")
+    private Integer sevenClassStatus;
 }

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsQueryBo.java

@@ -103,5 +103,10 @@ public class OrderGoodsQueryBo extends BaseEntity {
 	private Integer rebuyOrderGoodsId;
 	@ApiModelProperty("商品类型 1视频2题库 3面授 4服务 5组合")
 	private Integer goodsType;
-
+	/** 七大员公共课版本号 */
+	@ApiModelProperty("七大员公共课版本号")
+	private Integer sevenClassVersion;
+	/** 0 未学习 1学习中 2已学完  3已审核 4待重修 */
+	@ApiModelProperty("0 未学习 1学习中 2已学完  3已审核 4待重修")
+	private Integer sevenClassStatus;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderGoods.java

@@ -94,6 +94,12 @@ private static final long serialVersionUID=1L;
     private Integer divideModel;
     @ApiModelProperty("分成钱")
     private BigDecimal divideMoney;
+    /** 七大员商品年份 */
+    private String sevenYear;
+    /** 七大员公共课版本号 */
+    private Integer sevenClassVersion;
+    /** 0 未学习 1学习中 2已学完  3已审核 4待重修 */
+    private Integer sevenClassStatus;
 
     private Long tenantId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderGoodsMapper.java

@@ -68,4 +68,8 @@ public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
     String getBusinessById(@Param("orderGoodsId") Long orderGoodsId);
 
     List<OrderGoods> getApplyOrderGoods(@Param("goodsIds")List<Long> goodsIds,@Param("userId") Long userId);
+
+    OrderGoods getSevenLastOne(@Param("projectId")Integer projectId,@Param("sevenYear")String sevenYear,@Param("userId")Long userId);
+
+    Long countOrderGoodsByYear(@Param("sevenYear") String sevenYear,@Param("goodsId") Long goodsId,@Param("userId") Long userId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -119,5 +119,7 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
 
     List<OrderGoods> getApplyOrderGoods(List<Long> goodsIds, Long userId);
 
+    OrderGoods getSevenLastOne(Integer projectId,String sevenYear,Long userId);
 
+    Long countOrderGoodsByYear(String sevenYear, Long goodsId, Long userId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderService.java

@@ -114,4 +114,6 @@ public interface IOrderService extends IService<Order> {
 	List<String> queryBusinessFullNameBySn(String orderSn);
 
 	boolean questionGoodsOpen(questionOpenBo bo);
+
+    Boolean studyCheck(Long orderGoodsId, Long userId);
 }

+ 6 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsRefundServiceImpl.java

@@ -190,11 +190,11 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean placeRefundSmallOrder(OrderGoodsRefundAddBo bo) {
-        if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderSn())){
+        if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderSn())||Validator.isEmpty(bo.getOrderGoodsId())){
             throw new CustomException("参数缺失");
         }
         OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn,bo.getOrderSn())
-                .eq(OrderGoods::getGoodsId, bo.getGoodsId()));
+                .eq(OrderGoods::getGoodsId, bo.getGoodsId()).eq(OrderGoods::getOrderGoodsId, bo.getOrderGoodsId()));
         if(Validator.isEmpty(orderGoods)){
             throw new CustomException("订单商品数据错误");
         }
@@ -245,7 +245,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
             }
             //判断是否已标记
             ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId,orderGoods.getGradeId())
-                    .eq(ClassGradeUser::getUserId,order.getUserId()));
+                    .eq(ClassGradeUser::getUserId,order.getUserId()).eq(ClassGradeUser::getOrderGoodsId,orderGoods.getOrderGoodsId()));
             if(Validator.isNotEmpty(classGradeUser)&&Validator.isNotEmpty(classGradeUser.getLearnStatus())&&classGradeUser.getLearnStatus()==1){
                 throw new CustomException("已标记开通不满足退款");
             }
@@ -352,11 +352,11 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
     @Transactional(rollbackFor = Exception.class)
     public Boolean placeRefundInputOrder(List<OrderGoodsRefundAddBo> bos) {
         for(OrderGoodsRefundAddBo bo : bos){
-            if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderSn())){
+            if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderSn())||Validator.isEmpty(bo.getOrderGoodsId())){
                 throw new CustomException("参数缺失");
             }
             OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn,bo.getOrderSn())
-                    .eq(OrderGoods::getGoodsId, bo.getGoodsId()));
+                    .eq(OrderGoods::getGoodsId, bo.getGoodsId()).eq(OrderGoods::getOrderGoodsId, bo.getOrderGoodsId()));
             if(Validator.isEmpty(orderGoods)){
                 throw new CustomException("订单商品数据错误");
             }
@@ -391,7 +391,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
                 }
                 //判断是否已标记
                 ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId,orderGoods.getGradeId())
-                        .eq(ClassGradeUser::getUserId,order.getUserId()));
+                        .eq(ClassGradeUser::getUserId,order.getUserId()).eq(ClassGradeUser::getOrderGoodsId,orderGoods.getOrderGoodsId()));
                 if(Validator.isNotEmpty(classGradeUser)&&Validator.isNotEmpty(classGradeUser.getLearnStatus())&&classGradeUser.getLearnStatus()==1){
                     throw new CustomException("已标记开通不满足退款");
                 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -788,6 +788,15 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
         return baseMapper.getApplyOrderGoods(goodsIds,userId);
     }
 
+    @Override
+    public OrderGoods getSevenLastOne(Integer projectId,String sevenYear,Long userId) {
+        return baseMapper.getSevenLastOne(projectId,sevenYear,userId);
+    }
+
+    @Override
+    public Long countOrderGoodsByYear(String sevenYear, Long goodsId, Long userId) {
+        return baseMapper.countOrderGoodsByYear(sevenYear, goodsId, userId);
+    }
 
     private boolean checkUnique(Long GoodsId,Long UserId) {
         ShoppingCart info = iShoppingCartService.getOne(new LambdaQueryWrapper<ShoppingCart>()

+ 0 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderInvoiceServiceImpl.java

@@ -147,7 +147,6 @@ public class OrderInvoiceServiceImpl extends ServiceImpl<OrderInvoiceMapper, Ord
                 iOrderInvoiceOrderService.insertByAddBo(item);
             }
         }
-
         String tenantId = ServletUtils.getRequest().getHeader("TenantId");
         SysOldOrg oldOrg = sysOldOrgService.getOne(new LambdaQueryWrapper<SysOldOrg>()
                 .eq(SysOldOrg::getTenantId, Long.valueOf(tenantId))
@@ -157,7 +156,6 @@ public class OrderInvoiceServiceImpl extends ServiceImpl<OrderInvoiceMapper, Ord
             //独立运营机构不需要开祥粤的发票
             return true;
         }
-
         //开发票
         OrderInvoiceBo invoiceBo = new OrderInvoiceBo();
         Long nowTime = DateUtils.getNowTime();

+ 123 - 15
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -508,6 +508,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (goods.getGoodsStatus() != 1) {
                 throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
             }
+            //校验是否有重复商品
+            if (StringUtils.isNotBlank(g.getSevenYear())){
+                Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
+                if (count > 0){
+                    throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
+                }
+            }
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
             if (g.getGoodsInputData() != null) {
@@ -547,7 +554,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -655,6 +662,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (Validator.isEmpty(goods)) {
                 throw new CustomException("商品不存在", 510);
             }
+            //校验是否有重复商品
+            if (StringUtils.isNotBlank(g.getSevenYear())){
+                Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
+                if (count > 0){
+                    throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
+                }
+            }
 //            if (goods.getGoodsStatus() != 1) {
 //                throw new CustomException(goods.getGoodsName()+"商品已下架,请重新选择商品下单", 510);
 //            }
@@ -694,7 +708,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -995,6 +1009,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (goods.getGoodsStatus() != 1) {
                 throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
             }
+            //校验是否有重复商品
+            if (StringUtils.isNotBlank(g.getSevenYear())){
+                Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
+                if (count > 0){
+                    throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
+                }
+            }
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
@@ -1069,7 +1090,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 }
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -1399,6 +1420,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (goods.getGoodsStatus() != 1) {
                 throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
             }
+            //校验是否有重复商品
+            if (StringUtils.isNotBlank(g.getSevenYear())){
+                Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
+                if (count > 0){
+                    throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
+                }
+            }
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
@@ -1473,7 +1501,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 }
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -1596,6 +1624,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (goods.getGoodsStatus() != 1) {
                 throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
             }
+            //校验是否有重复商品
+            if (StringUtils.isNotBlank(g.getSevenYear())){
+                Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
+                if (count > 0){
+                    throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
+                }
+            }
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
@@ -1640,7 +1675,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 }
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -2142,7 +2177,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     }
 
     //检查是否允许重复购买视频商品
-    public boolean canBuyRepeatGoods(Long goodsId, Long userId) {
+    public boolean canBuyRepeatGoods(Long goodsId, Long userId,String sevenYear) {
+        String businessName = iGoodsService.getGoodsBusinessName(goodsId);
+        if (businessName.contains("继续教育") && businessName.contains("施工现场专业人员")){
+            //判断是否有锁定的班级
+            ClassGradeUserTempQueryBo gradeUserTempQueryBo = new ClassGradeUserTempQueryBo();
+            gradeUserTempQueryBo.setUserId(userId);
+            gradeUserTempQueryBo.setGoodsId(goodsId);
+            gradeUserTempQueryBo.setSevenYear(sevenYear);
+            gradeUserTempQueryBo.setStatus(ClassGradeUserTemp.STATUS_LOCK);
+            List<ClassGradeUserTempVo> list1 = iClassGradeUserTempService.queryList(gradeUserTempQueryBo);
+            if (list1 != null && list1.size() > 0) {
+                throw new CustomException("当前所购买商品,存在订单未支付", 510);
+            }
+            return true;
+        }
         //判断是否还有未过期的班级
         ClassGradeQueryBo bo = new ClassGradeQueryBo();
         bo.setUserId(userId);
@@ -2171,6 +2220,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
     //检查是否购买过商品
     public boolean checkBuyGoods(Long goodsId, Long userId, Integer goodsType) {
+        String businessName = iGoodsService.getGoodsBusinessName(goodsId);
+        if (businessName.contains("继续教育") && businessName.contains("施工现场专业人员")){
+            return true;
+        }
         OrderGoodsQueryBo bo = new OrderGoodsQueryBo();
         bo.setUserId(userId);
         bo.setGoodsId(goodsId);
@@ -2202,6 +2255,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         if (classNum > 0){
             throw new CustomException("该学员已在此商品有效期内的班级,无法加入新的有效期班级,请查看该学员此商品下的班级");
         }*/
+        OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
         //指定班级
         if (gradeId != null && gradeId > 0) {
             ClassGradeVo classGradeVo = iClassGradeService.queryById(gradeId);
@@ -2229,12 +2283,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //预留0空位避免超人数
             if ((classGradeVo.getStudentUpper() - studentNum - locakStudentNum) > 0) {
                 ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, gradeId)
+                        .eq(ClassGradeUser::getOrderGoodsId,orderGoodsId)
                         .eq(ClassGradeUser::getUserId, userId));
                 //不在此班级内
                 if (Validator.isEmpty(gradeUser)) {
                     //班级还有剩位,直接锁定班级
                     if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
-                        return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn);
+                        return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn,orderGoods.getSevenYear());
                     }
 
                 }
@@ -2259,11 +2314,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 gradeId = classGradeVo.getGradeId();
                 //班级还有剩位,直接锁定班级
                 ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, gradeId)
+                        .eq(ClassGradeUser::getOrderGoodsId,orderGoodsId)
                         .eq(ClassGradeUser::getUserId, userId));
                 //不在此班级内
                 if (Validator.isEmpty(gradeUser)) {
                     if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
-                        return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn);
+                        return lockGrade(orderGoodsId, gradeId, userId, goodsId, orderSn,orderGoods.getSevenYear());
                     }
                 }
             }
@@ -2280,7 +2336,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         if (isConfigTp) {
             classGrade.setClassStatus(0);
             classGrade.setLearningStatus(2);//待定
-            classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
+            //七大员继教默认上限1000
+            String businessFullName = iGoodsService.getGoodsBusinessName(goodsId);
+            if (businessFullName.contains("继续教育") && businessFullName.contains("施工现场专业人员")){
+                //七大员继教
+                classGrade.setStudentUpper(ClassGrade.INIT_UPPER3); //上限1000
+            }else {
+                classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
+            }
 
             //企业ID
             String tenant = ServletUtils.getRequest().getHeader("TenantId");
@@ -2342,7 +2405,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         classGradeGoods.setUpdateTime(DateUtils.getNowTime());
         iClassGradeGoodsService.save(classGradeGoods);
         //锁定班级
-        lockGrade(orderGoodsId, classGrade.getGradeId(), userId, goodsId, orderSn);
+        lockGrade(orderGoodsId, classGrade.getGradeId(), userId, goodsId, orderSn,orderGoods.getSevenYear());
         return true;
     }
 
@@ -2406,7 +2469,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 }
                 Long gradeId = null;
                 //判断是否购买历史班级都过期
-                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId());
+                canRepeatBuy = this.canBuyRepeatGoods(g.getGoodsId(), bo.getUserId(),g.getSevenYear());
                 if (g.getGoodsInputData() != null) {
                     gradeId = g.getGoodsInputData().getGradeId();
                     if (Validator.isNotEmpty(oldOrderGoodsId)) {
@@ -2473,6 +2536,37 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         return payResult;
     }
 
+    @Override
+    public Boolean studyCheck(Long orderGoodsId, Long userId) {
+        OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
+        if (ObjectUtils.isNull(orderGoods)){
+            throw new CustomException("数据错误");
+        }
+        Order order = getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, orderGoods.getOrderSn()));
+        if (!order.getUserId().equals(userId)){
+            throw new CustomException("订单数据不匹配");
+        }
+        //校验是否有正在学习的七大员继教课程
+        List<ClassGradeUser> classGradeUser = iClassGradeUserService.getClassInfoByUser(userId);
+        if (CollectionUtils.isEmpty(classGradeUser)){
+            return true;
+        }
+        if (!classGradeUser.stream().noneMatch(x -> x.getOrderGoodsId().equals(orderGoodsId))){
+            ClassGradeUser gradeUser = classGradeUser.stream().findFirst().orElse(null);
+            OrderGoods orderGoodsTwo = iOrderGoodsService.getById(gradeUser.getOrderGoodsId());
+            Goods goods = iGoodsService.getById(orderGoodsTwo.getGoodsId());
+            throw new CustomException(String.format("请先学完【%s】课程!",goods.getGoodsName()));
+        }
+
+        return true;
+    }
+
+    public static void main(String[] args) {
+        List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
+        boolean b = integers.stream().noneMatch(x -> x == 3);
+        System.out.println("b = " + b);
+    }
+
     private String createGradeCode(Long goodsId, CourseBusinessVo business) {
 
         Goods goods = iGoodsService.getById(goodsId);
@@ -2579,7 +2673,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 throw new CustomException("该班级不支持该商品使用");
             }
             //判断用户是否在此班过
-            ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, userId).eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
+            ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                    .eq(ClassGradeUser::getUserId, userId)
+                    .eq(ObjectUtils.isNotNull(orderGoodsId),ClassGradeUser::getOrderGoodsId, orderGoodsId)
+                    .eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
             if (Validator.isEmpty(gradeUser)) {
                 LambdaQueryWrapper<ClassGradeUser> lqw = new LambdaQueryWrapper<>();
                 lqw.eq(ClassGradeUser::getGradeId, gradeId);
@@ -2619,7 +2716,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 //有空位则进入班级
                 gradeId = classGradeVo.getGradeId();
                 //判断用户是否在此班过
-                ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, userId).eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
+                ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                        .eq(ObjectUtils.isNotNull(orderGoodsId),ClassGradeUser::getOrderGoodsId, orderGoodsId)
+                        .eq(ClassGradeUser::getUserId, userId)
+                        .eq(ClassGradeUser::getGradeId, gradeId).last("limit 1"));
                 if (Validator.isEmpty(gradeUser)) {
                     //班级还有剩位,直接加入班级
                     if (iClassGradeService.checkEjjjPeopleNumLimit(businessId, gradeId)) { //判断全系统平台二建班级人数是否超300
@@ -2640,7 +2740,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         if (isConfigTp) {
             classGrade.setClassStatus(0);
             classGrade.setLearningStatus(2);//待定
-            classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
+            //七大员继教默认上限1000
+            String businessFullName = iGoodsService.getGoodsBusinessName(goodsId);
+            if (businessFullName.contains("继续教育") && businessFullName.contains("施工现场专业人员")){
+                //七大员继教
+                classGrade.setStudentUpper(ClassGrade.INIT_UPPER3); //上限1000
+            }else {
+                classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
+            }
         } else {
             classGrade.setLearningStatus(1);//即刻
             classGrade.setStudentUpper(ClassGrade.INIT_UPPER2); //上限1000000
@@ -2727,7 +2834,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
      * @param orderSn
      * @return
      */
-    public boolean lockGrade(Long orderGoodsId, Long gradeId, Long userId, Long goodsId, String orderSn) {
+    public boolean lockGrade(Long orderGoodsId, Long gradeId, Long userId, Long goodsId, String orderSn,String sevenYear) {
         //锁定班级
         ClassGradeUserTemp classGradeUserTemp = new ClassGradeUserTemp();
         classGradeUserTemp.setUserId(userId);
@@ -2736,6 +2843,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         classGradeUserTemp.setFromType(1);
         classGradeUserTemp.setGoodsId(goodsId);
         classGradeUserTemp.setOrderSn(orderSn);
+        classGradeUserTemp.setSevenYear(sevenYear);
         classGradeUserTemp.setCreateTime(DateUtils.getNowTime());
         classGradeUserTemp.setUpdateTime(DateUtils.getNowTime());
         iClassGradeUserTempService.save(classGradeUserTemp);

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

@@ -355,4 +355,17 @@ public class OrderGoodsVo {
 
 	@ApiModelProperty("关联题库商品ID")
 	private Long questionGoodsId;
+	/** 七大员公共课版本号 */
+	@Excel(name = "七大员公共课版本号")
+	@ApiModelProperty("七大员公共课版本号")
+	private Integer sevenClassVersion;
+	/** 0 未学习 1学习中 2已学完  3已审核 4待重修 */
+	@Excel(name = "0 未学习 1学习中 2已学完  3已审核 4待重修")
+	@ApiModelProperty("0 未学习 1学习中 2已学完  3已审核 4待重修")
+	private Integer sevenClassStatus;
+
+	@ApiModelProperty("七大员继教商品可选年份")
+	private String sevenYear;
+	@ApiModelProperty("七大员继教订单商品年份")
+	private String orderYear;
 }

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

@@ -2209,6 +2209,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);
         }
     }
@@ -2225,6 +2226,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);
         }
     }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysOldOrg.java

@@ -48,7 +48,8 @@ private static final long serialVersionUID=1L;
     /** 分成模式 1机构分成 2业务员分成 */
     private Integer divideModel;
 
-    /** 运营类型:1代运营 2独立运营 */
+    /** 运营模式 1代运营 2独立运营 */
     private Integer operationType;
 
+
 }

+ 9 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java

@@ -1368,7 +1368,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
     public boolean checkOrderStudent(TopOldOrderCheckBo bo) {
         TopOldOrder oldOrder = getOne(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getOrderSn, bo.getOrderSn()));
         //校验当前登入角色
-        List<TopSysUserRole> userRoles = topSysUserRoleService.list(new LambdaQueryWrapper<TopSysUserRole>().eq(TopSysUserRole::getUserId, bo.getOrderId()));
+        List<TopSysUserRole> userRoles = topSysUserRoleService.list(new LambdaQueryWrapper<TopSysUserRole>().eq(TopSysUserRole::getUserId, bo.getLoginId()));
         if (CollectionUtils.isEmpty(userRoles) && !"admin".equals(bo.getLoginName())) {
             throw new CustomException("当前账号没有审核权限");
         }
@@ -2619,7 +2619,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                                 //已支付 不能撤销
                                 throw new CustomException(String.format("订单号分成已结清不能取消【%s】", orderSn));
                             }
-                            List<String> tenantIds = Arrays.asList("1", "867735392558919680");
+                            List<String> tenantIds = Arrays.asList("867735392558919680");
                             if (tenantIds.contains(order.getTenantId())) {
                                 //C端订单 不能撤销
                                 throw new CustomException(String.format("C端订单不能取消完单【%s】", orderSn));
@@ -2653,13 +2653,16 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                                 //账款未收完 不能完单
                                 throw new CustomException(String.format("订单未审核不能完单【%s】", orderSn));
                             }
+                            //成本设置项
+                            String costJson = order.getCostJson();
+                            if (StringUtils.isBlank(costJson)) {
+                                return;
+                            }
                             //获取机构分成方式
                             SysTenant tenant = sysTenantService
                                     .getOne(new LambdaQueryWrapper<SysTenant>()
                                             .eq(SysTenant::getTenantId, order.getTenantId()));
                             Integer divideModel = tenant.getDivideModel();
-                            //成本设置项
-                            String costJson = order.getCostJson();
                             if (StringUtils.isBlank(costJson)) {
                                 order.setFinishStatus(1);//已完单
                                 order.setDivideModel(divideModel);
@@ -2860,7 +2863,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         List<TopOldOrderCheck> checkList = topOldOrderCheckService
                 .list(new LambdaQueryWrapper<TopOldOrderCheck>().in(TopOldOrderCheck::getCheckType, Arrays.asList(5, 6))
                         .orderByAsc(TopOldOrderCheck::getCheckSort));
-        if (CollectionUtils.isNotEmpty(checkList) && divideTotal.compareTo(BigDecimal.ZERO) > 0) {
+        if (CollectionUtils.isNotEmpty(checkList)) {
             List<TopOldOrderCheckLog> logs = new ArrayList<>();
             for (int i = 0; i < checkList.size(); i++) {
                 TopOldOrderCheck check = checkList.get(i);
@@ -2874,6 +2877,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 log.setCheckSign(i > 0 ? 0 : 1);
                 log.setCheckSort(check.getCheckSort());
                 log.setType(check.getCheckType());
+                log.setTenantId(order.getTenantId());
                 if (check.getCheckType() == 6) {
                     //分成支付
                     log.setCheckStatus(2);//待支付

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordMapper.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.course.bo.CourseSectionDetailBo;
 import com.zhongzheng.modules.course.bo.CourseSectionDetailVo;
 import com.zhongzheng.modules.course.bo.CourseStatementBo;
 import com.zhongzheng.modules.course.bo.CourseStatementVo;
+import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.vo.ClassPeriodVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
@@ -109,4 +110,8 @@ public interface UserStudyRecordMapper extends BaseMapper<UserStudyRecord> {
 
     @InterceptorIgnore(tenantLine = "true")
     UserStudyRecord getStudyRecord(@Param("userId") Long userId,@Param("gradeId") Long gradeId,@Param("sort") String sort);
+
+    UserStudyRecord getSevenStudyRecord(@Param("orderGoodsId") Long orderGoodsId,@Param("gradeId") Long gradeId);
+
+    UserPeriod selectSevenUserPeriod(UserStudyRecord bo);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.user.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.vo.*;
@@ -135,4 +136,6 @@ public interface IUserService extends IService<User> {
 	UserLiveAccountLoginVo liveUnifyLoginRefresh(UserLiveAccountLoginBo bo);
 
     List<User> listByIdsNotTenant(List<Long> userIds);
+
+	String createToken(LoginUser loginUser);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordService.java

@@ -142,4 +142,6 @@ public interface IUserStudyRecordService extends IService<UserStudyRecord> {
 	List<UserWatchStatisticsVo> getUserWatchStatistics(CourseSectionDetailBo bo);
 
     UserStudyRecord getStudyRecord(Long userId, Long gradeId, String asc);
+
+	Integer syncSevenPublicClass(Long orderGoodsId,Long userId);
 }

+ 12 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -19,6 +19,8 @@ import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserBankRecord;
@@ -84,7 +86,8 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
     @Autowired
     private IExamPaperService iExamPaperService;
 
-
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
 
     private static Logger log = LoggerFactory.getLogger(UserBankRecordServiceImpl.class);
 
@@ -206,15 +209,20 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
 
     private void updateExam(UserBankRecordVo userBankRecordVo,UserBankRecord add) {
         //试卷及格绑定成绩和记录做题,待审,通过不记录
-
+        OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, userBankRecordVo.getOrderGoodsId()));
+        UserBankRecordVo bakVo =  BeanUtil.toBean(userBankRecordVo, UserBankRecordVo.class);
+        if(Validator.isEmpty(orderGoods.getSevenYear())){
+            bakVo.setOrderGoodsId(null);
+        }
         if(userBankRecordVo.getType()==1||userBankRecordVo.getType()==3){ //章卷 模块卷才进来
-            if (userStudyRecordMapper.selectStudyExamRecord(userBankRecordVo)  < 1 && Validator.isNotEmpty(add.getReportStatus())&& add.getReportStatus().equals(1)){
+            if (userStudyRecordMapper.selectStudyExamRecord(bakVo)  < 1 && Validator.isNotEmpty(add.getReportStatus())&& add.getReportStatus().equals(1)){
                 //增加一条审核记录
                 UserPeriod userPeriod = new UserPeriod();
                 userPeriod.setUserId(userBankRecordVo.getUserId());
                 userPeriod.setCourseId(userBankRecordVo.getCourseId());
                 userPeriod.setExamId(userBankRecordVo.getExamId());
                 userPeriod.setGoodsId(userBankRecordVo.getGoodsId());
+                userPeriod.setOrderGoodsId(userBankRecordVo.getOrderGoodsId());
                 if(userBankRecordVo.getType()==1){
                     userPeriod.setType(2);
                 }
@@ -250,7 +258,7 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
             }
 
             //待重修
-            if (userStudyRecordMapper.selectStudyExamRecordOr(userBankRecordVo) > 0 && add.getReportStatus().equals(1)){
+            if (userStudyRecordMapper.selectStudyExamRecordOr(bakVo) > 0 && add.getReportStatus().equals(1)){
                 //将待重修改为待审核
                 UserPeriodStatus userPeriodStatus = userStudyRecordMapper.selectStudyExamRecordCount(userBankRecordVo);
                 userPeriodStatus.setStatus(2);

+ 157 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -17,10 +17,7 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
 import com.zhongzheng.modules.course.bo.*;
-import com.zhongzheng.modules.course.domain.CourseBusiness;
-import com.zhongzheng.modules.course.domain.CourseMenuExam;
-import com.zhongzheng.modules.course.domain.CoursePhotoLog;
-import com.zhongzheng.modules.course.domain.CourseSection;
+import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
 import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
@@ -28,6 +25,7 @@ import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
 import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.domain.GoodsCourse;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
@@ -48,6 +46,8 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
 import com.zhongzheng.modules.inform.vo.InformRemindVo;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.polyv.bo.PolyvLiveQueryBo;
 import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
@@ -158,6 +158,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Autowired
     private IGoodsCourseService iGoodsCourseService;
 
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
+
     @Override
     public UserStudyRecordVo queryById(Long recordId) {
         UserStudyRecord db = this.baseMapper.selectById(recordId);
@@ -174,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)){
@@ -280,6 +287,10 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         lqw.eq(bo.getStudyDuration() != null, UserStudyRecord::getStudyDuration, bo.getStudyDuration());
         lqw.eq(bo.getStartTime() != null, UserStudyRecord::getStartTime, bo.getStartTime());
         lqw.eq(bo.getEndTime() != null, UserStudyRecord::getEndTime, bo.getEndTime());
+        lqw.eq(bo.getOrderGoodsId() != null, UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId());
+        lqw.eq(bo.getGradeId() != null, UserStudyRecord::getGradeId, bo.getGradeId());
+        lqw.eq(bo.getChapterId() != null, UserStudyRecord::getChapterId, bo.getChapterId());
+        lqw.eq(bo.getCurrentStatus() != null, UserStudyRecord::getCurrentStatus, bo.getCurrentStatus());
         return entity2Vo(this.list(lqw));
     }
 
@@ -348,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){
@@ -360,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());
@@ -528,7 +542,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         }
 
         //新增学时记录,照片
-        userPeriodSave(add, bo);
+        userPeriodSave(add, bo,fullName);
         //判断有无学习结束
         studyFinish(add);
         //完成当天学习计划
@@ -562,8 +576,10 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             //发送课时完成
             //获取旧信息
             ClassGradeUser gradeUser =iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
-                    .eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()
-                    ).eq(ClassGradeUser::getStatus,1).eq(ClassGradeUser::getChangeGrade,0).eq(ClassGradeUser::getPeriodStatus,-1).last("limit 1"));
+                    .eq(ClassGradeUser::getUserId,bo.getUserId())
+                    .eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
+                    .eq(ClassGradeUser::getGradeId,bo.getGradeId())
+                    .eq(ClassGradeUser::getStatus,1).eq(ClassGradeUser::getChangeGrade,0).eq(ClassGradeUser::getPeriodStatus,-1).last("limit 1"));
             //原本未审核才可进来
             if(Validator.isNotEmpty(gradeUser)&&gradeUser.getPeriodStatus()==-1){
                 //最新数据学完变为待审核
@@ -1208,6 +1224,129 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         return baseMapper.getStudyRecord(userId, gradeId, asc);
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public Integer syncSevenPublicClass(Long orderGoodsId,Long userId) {
+        if(Validator.isEmpty(orderGoodsId)||Validator.isEmpty(userId)){
+            throw new CustomException("参数错误");
+        }
+        OrderGoods newOrderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, orderGoodsId));
+        if(newOrderGoods.getSevenClassStatus()==1||newOrderGoods.getSevenClassStatus()==2||newOrderGoods.getSevenClassStatus()==3){
+            return 0;
+        }
+        Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, newOrderGoods.getGoodsId()));
+        String fullName;
+        CourseBusinessQueryBo queryBusinessBo = new CourseBusinessQueryBo();
+        queryBusinessBo.setId(goods.getBusinessId());
+        fullName = iCourseBusinessService.queryFullName(queryBusinessBo);
+        if(!fullName.contains("继续教育")||!fullName.contains("施工现场专业人员")){
+            return 0;
+        }
+        if(Validator.isEmpty(newOrderGoods.getSevenYear())){
+            return 0;
+        }
+        OrderGoods oldOrderGoods = iOrderGoodsService.getSevenLastOne(goods.getProjectId(),newOrderGoods.getSevenYear(),userId);
+        if(Validator.isEmpty(oldOrderGoods)){
+            newOrderGoods.setSevenClassVersion(newOrderGoods.getSevenClassVersion()+1);
+            newOrderGoods.setSevenClassStatus(1);
+            newOrderGoods.setUpdateTime(DateUtils.getNowTime());
+            iOrderGoodsService.updateById(newOrderGoods);
+            return 1;
+        }
+        if(newOrderGoods.getSevenClassStatus()==4){
+            newOrderGoods.setSevenClassVersion(oldOrderGoods.getSevenClassVersion()+1);
+            newOrderGoods.setSevenClassStatus(1);
+            newOrderGoods.setUpdateTime(DateUtils.getNowTime());
+            iOrderGoodsService.updateById(newOrderGoods);
+            return 1;
+        }
+        UserStudyRecord userStudyRecord = baseMapper.getSevenStudyRecord(oldOrderGoods.getOrderGoodsId(),oldOrderGoods.getGradeId());
+        if(Validator.isEmpty(userStudyRecord)){
+            throw new CustomException("公共章学习数据错误");
+        }
+        LambdaQueryWrapper<GoodsCourse> lqwCourse = Wrappers.lambdaQuery();
+        lqwCourse.eq(GoodsCourse::getGoodsId, goods.getGoodsId());
+        List<GoodsCourse> courseList = iGoodsCourseService.list(lqwCourse);
+        Long courseId = null;
+        for(GoodsCourse course : courseList){
+            CourseMenu courseMenu = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getCourseId, course.getCourseId())
+                    .eq(CourseMenu::getType, 2).eq(CourseMenu::getMenuId, userStudyRecord.getChapterId()).eq(CourseMenu::getParentId, 0));
+            if(Validator.isNotEmpty(courseMenu)){
+                courseId = course.getCourseId();
+            }
+        }
+        if(Validator.isEmpty(courseId)){
+            throw new CustomException("课程定位错误");
+        }
+        String key = "SYNC_SEVEN_Record:"+orderGoodsId;
+        Long keyStatus = redisCache.getCacheObject(key);
+        if(Validator.isNotEmpty(keyStatus)&&keyStatus==100L){
+            return 100;
+        }
+        redisCache.setCacheObject(key, 100L,5, TimeUnit.SECONDS);
+        LambdaQueryWrapper<UserStudyRecord> lqw = Wrappers.lambdaQuery();
+        lqw.eq(UserStudyRecord::getOrderGoodsId, userStudyRecord.getOrderGoodsId());
+        lqw.eq(UserStudyRecord::getGradeId, userStudyRecord.getGradeId());
+        lqw.eq(UserStudyRecord::getChapterId, userStudyRecord.getChapterId());
+        lqw.eq(UserStudyRecord::getCurrentStatus, 1);
+        List<UserStudyRecord> list = this.list(lqw);
+        for(UserStudyRecord vo : list){
+            UserStudyRecord copyVo = BeanUtil.toBean(vo, UserStudyRecord.class);
+            copyVo.setOrderGoodsId(newOrderGoods.getOrderGoodsId());
+            copyVo.setGradeId(newOrderGoods.getGradeId());
+            copyVo.setCourseId(courseId);
+            copyVo.setRecordId(null);
+            this.save(copyVo);
+            Long periodId = null;
+            UserPeriod copyUserPeriod = baseMapper.selectSevenUserPeriod(copyVo);
+            UserPeriodStatus copyUserPeriodStatus;
+            UserPeriod userPeriod = baseMapper.selectSevenUserPeriod(vo);
+            if(Validator.isEmpty(userPeriod)){
+                throw new CustomException("学时数据错误");
+            }
+            UserPeriodStatus userPeriodStatus = iUserPeriodStatusService.getOne(new LambdaQueryWrapper<UserPeriodStatus>()
+                    .eq(UserPeriodStatus::getPeriodId, userPeriod.getId())
+                    .eq(UserPeriodStatus::getStatus, 1)
+                    .eq(UserPeriodStatus::getPeriodStatus, 1));
+            if(Validator.isEmpty(copyUserPeriod)){
+                copyUserPeriod = BeanUtil.toBean(userPeriod, UserPeriod.class);
+                copyUserPeriod.setOrderGoodsId(newOrderGoods.getOrderGoodsId());
+                copyUserPeriod.setGradeId(newOrderGoods.getGradeId());
+                copyUserPeriod.setCourseId(courseId);
+                copyUserPeriod.setId(null);
+                iUserPeriodService.save(copyUserPeriod);
+
+                copyUserPeriodStatus = BeanUtil.toBean(userPeriodStatus, UserPeriodStatus.class);
+                copyUserPeriodStatus.setPeriodId(copyUserPeriod.getId());
+                copyUserPeriodStatus.setId(null);
+                iUserPeriodStatusService.save(copyUserPeriodStatus);
+            }else{
+                copyUserPeriodStatus = iUserPeriodStatusService.getOne(new LambdaQueryWrapper<UserPeriodStatus>()
+                        .eq(UserPeriodStatus::getPeriodId, copyUserPeriod.getId())
+                        .eq(UserPeriodStatus::getStatus, 1)
+                        .eq(UserPeriodStatus::getPeriodStatus, 1));
+            }
+            LambdaQueryWrapper<UserStudyRecordPhoto> lqwPhoto = Wrappers.lambdaQuery();
+            lqwPhoto.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatus.getId());
+            lqwPhoto.eq(UserStudyRecordPhoto::getRecordId, vo.getRecordId());
+            lqwPhoto.eq(UserStudyRecordPhoto::getStatus, 1);
+            List<UserStudyRecordPhoto> listPhoto = userStudyRecordPhotoService.list(lqwPhoto);
+            for(UserStudyRecordPhoto photo : listPhoto){
+                UserStudyRecordPhoto copyPhoto = BeanUtil.toBean(photo, UserStudyRecordPhoto.class);
+                copyPhoto.setRecordId(copyVo.getRecordId());
+                copyPhoto.setPeriodId(copyUserPeriodStatus.getId());
+                copyPhoto.setId(null);
+                userStudyRecordPhotoService.save(copyPhoto);
+            }
+        }
+        newOrderGoods.setSevenClassVersion(oldOrderGoods.getSevenClassVersion());
+        newOrderGoods.setSevenClassStatus(2);
+        newOrderGoods.setUpdateTime(DateUtils.getNowTime());
+        iOrderGoodsService.updateById(newOrderGoods);
+        redisCache.deleteObject(key);
+        return 2;
+    }
+
 
     /**
      * 获取最后一次看完的节
@@ -1248,11 +1387,15 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     }
 
 
-    private void userPeriodSave(UserStudyRecord entity, UserStudyRecordAddBo bo) {
+    private void userPeriodSave(UserStudyRecord entity, UserStudyRecordAddBo bo,String businessFullName) {
         //记录学时审核
         Long periodId = null;
+        UserStudyRecord bakStudyRecord =  BeanUtil.toBean(entity, UserStudyRecord.class);
+        if(!businessFullName.contains("继续教育")||!businessFullName.contains("施工现场专业人员")){
+            bakStudyRecord.setOrderGoodsId(null);
+        }
         // 学习无记录加一条学时审核记录
-        if (baseMapper.selectStudyRecord(entity) < 1) {
+        if ( baseMapper.selectStudyRecord(bakStudyRecord) < 1) {
             UserPeriod userPeriod = new UserPeriod();
             userPeriod.setUserId(entity.getUserId());
             userPeriod.setCourseId(entity.getCourseId());
@@ -1264,6 +1407,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             userPeriod.setModuleId(entity.getModuleId());
             userPeriod.setChapterId(entity.getChapterId());
             userPeriod.setGradeId(entity.getGradeId());
+            userPeriod.setOrderGoodsId(entity.getOrderGoodsId());
             iUserPeriodService.save(userPeriod);
             periodId = userPeriod.getId();
             UserPeriodStatus userPeriodStatusAddBo = new UserPeriodStatus();
@@ -1566,4 +1710,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     public SectionStudyRecordVo listExamRecord(SubjectStudyRecordQueryBo bo) {
         return this.baseMapper.listExamRecord(bo);
     }
+
+
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java

@@ -1102,10 +1102,12 @@ public class WxPayServiceImpl implements IWxPayService {
     @Override
     public boolean joinLockGrade(String orderSn, Long goodsId, Long orderGoodsId) {
         GoodsVo goodsVo = iGoodsService.queryById(goodsId);
+        OrderGoods orderGoods = iOrderGoodsService.getById(orderGoodsId);
         if (goodsVo.getGoodsType().equals(1)) {
             LambdaQueryWrapper<ClassGradeUserTemp> lqwLock = new LambdaQueryWrapper<>();
             lqwLock.eq(ClassGradeUserTemp::getOrderSn, orderSn);
             lqwLock.eq(ClassGradeUserTemp::getGoodsId, goodsId);
+            lqwLock.eq(StringUtils.isNotBlank(orderGoods.getSevenYear()),ClassGradeUserTemp::getSevenYear,orderGoods.getSevenYear());
             lqwLock.eq(ClassGradeUserTemp::getStatus, ClassGradeUserTemp.STATUS_LOCK);
             ClassGradeUserTemp classGradeUserTemp = iClassGradeUserTempService.getOne(lqwLock);
             if (classGradeUserTemp != null) {

+ 57 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -178,6 +178,63 @@
         <result property="doExamNum" column="do_exam_num"/>
         <result property="subjectNames" column="subject_names"/>
     </resultMap>
+    <select id="selectListByBoWithId" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
+        SELECT
+             q.*
+        FROM
+            question q
+        where 1=1
+        <if test="ids != null and ids.size()!=0 ">
+            AND q.question_id in
+            <foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        ORDER BY q.question_id DESC
+    </select>
+    <select id="selectListByBoBackId" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultType="Long">
+        SELECT
+        q.question_id
+        FROM
+        question q
+        LEFT JOIN question_business qb ON q.question_id = qb.major_id AND qb.type = 1
+        WHERE
+        1 = 1 AND q.status !=-1
+        <if test="status != null and status.size()!=0 ">
+            AND q.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND qb.education_type_id = #{educationTypeId}
+        </if>
+        <if test="subjectId != null and subjectId != ''">
+            AND qb.subject_id = #{subjectId}
+        </if>
+        <if test="type != null and type != ''">
+            AND q.type = #{type}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND qb.business_id = #{businessId}
+        </if>
+        <if test="publishStatus != null ">
+            AND q.publish_status = #{publishStatus}
+        </if>
+        <if test="prefixName != null and prefixName != ''">
+            AND q.prefix_name like concat('%', #{prefixName}, '%')
+        </if>
+        <if test="key != null and key != ''">
+            AND (q.content like concat('%', #{key}, '%') or q.prefix_name like concat('%', #{key}, '%') or q.code like concat('%', #{key}, '%'))
+        </if>
+        GROUP BY
+        q.question_id
+        <if test="pageSizeSelf != null and pageSizeSelf != ''">
+            LIMIT #{currIndex} , #{pageSizeSelf}
+        </if>
+        ORDER BY q.question_id DESC
+    </select>
 
     <select id="selectListByBo" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
         SELECT

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/base/ShoppingCartMapper.xml

@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="classHours" column="class_hours"/>
         <result property="distributionCode" column="distribution_code"/>
         <result property="choiceStatus" column="choice_status"/>
+        <result property="sevenYear" column="seven_year"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.base.bo.ShoppingCartQueryBo"  resultMap="ShoppingCartVoResult">
@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             g.goods_status,
             g.project_id,
             g.class_hours,
+            g.seven_year,
             ot.type AS template_type,
             cet.education_name,
             cpt.project_name,

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
         <result property="importNo" column="import_no"/>
+        <result property="commonSign" column="common_sign"/>
         <collection property="businessList" column="chapter_id" select="findBusinessList"/>
         <collection property="moduleList" column="chapter_id" select="findModuleList"/>
         <collection property="courseList" column="chapter_id" select="findCourseList"/>

+ 3 - 4
zhongzheng-system/src/main/resources/mapper/modules/course/CourseHandoutsMapper.xml

@@ -143,12 +143,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         DELETE FROM course_file WHERE handouts_id = #{handoutsId} AND tenant_id = #{tenantId}
     </delete>
 
-    <delete id="removeHandoutsRecord" parameterType="java.lang.Long" >
-        DELETE FROM sys_goods_copy_record WHERE new_id = #{handoutsId} AND tenant_id = #{tenantId} AND type = 15
-    </delete>
-
     <select id="getHandoutsListByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseHandouts" >
         SELECT * FROM `course_handouts` WHERE encoder = #{encoder} AND handouts_name = #{handoutsName} AND tenant_id = #{tenantId}
     </select>
 
+    <delete id="removeHandoutsRecord" parameterType="java.lang.Long" >
+        DELETE FROM sys_goods_copy_record WHERE new_id = #{handoutsId} AND tenant_id = #{tenantId} AND type = 15
+    </delete>
 </mapper>

+ 2 - 5
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -198,6 +198,8 @@
         <result property="orderGoodsId" column="order_goods_id"/>
         <result property="profileStatus" column="profile_status"/>
         <result property="profileTpStatus" column="profile_tp_status"/>
+        <result property="sevenYear" column="seven_year"/>
+        <result property="orderYear" column="order_year"/>
 
         <result property="subExamStatus" column="sub_exam_status"/>
         <result property="subPerformance" column="sub_performance"/>
@@ -212,10 +214,6 @@
         <result property="subjectNames" column="subject_names"/>
         <result property="sectionNum" column="section_num"/>
         <result property="goodsLearningOrder" column="goods_learning_order"/>
-        <result property="realName" column="realname"/>
-        <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
-        <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
-        <result property="studyStatus" column="study_status"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeVo" id="ClassGradeVoResult">
@@ -600,7 +598,6 @@
         order by og.create_time desc
     </select>
 
-
     <select id="goodsStudyProgressList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo"  resultMap="GoodsUserVo">
         SELECT
         g.*,

+ 14 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -101,6 +101,7 @@
         <result property="specialGoods" column="special_goods"/>
         <result property="externalLink" column="external_link"/>
         <result property="externalLinkStatus" column="external_link_status"/>
+        <result property="sevenYear" column="seven_year"/>
 
         <result property="supplyName" column="supply_name"/>
         <result property="educationName" column="education_name"/>
@@ -143,6 +144,7 @@
         <result property="commitPeriodRemark" column="commit_period_remark"/>
         <result property="gradeType" column="grade_type"/>
         <result property="examLimitClient" column="exam_limit_client"/>
+        <result property="optionalYear" column="optional_year"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
@@ -941,6 +943,18 @@
         UPDATE goods SET handouts_id = #{handoutsId} WHERE goods_id = #{goodsId} and tenant_id = #{tenantId}
     </update>
 
+    <select id="getGoodsBusinessName" parameterType="java.lang.Long" resultType="java.lang.String">
+        SELECT
+            CONCAT( cet.education_name, cb.business_name, cpt.project_name )
+        FROM
+            goods g
+                LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+                LEFT JOIN course_business cb ON g.business_id = cb.id
+        WHERE
+            g.goods_id = #{goodsId}
+    </select>
+
     <select id="getBusinessName" parameterType="java.lang.Long" resultType="java.lang.String">
         SELECT
             CONCAT( cet.education_name, cb.business_name, cpt.project_name ) AS business_name

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

@@ -895,7 +895,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     <if test="classSign != null">
                         AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = cgu.tenant_id AND sog.share_class = #{classSign}) > 0
                     </if>
-             ) + (
+
+            ) + (
                  SELECT
                      count(*)
                  FROM
@@ -907,7 +908,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     <if test="classSign != null">
                         AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = cgu.tenant_id AND sog.share_class = #{classSign}) > 0
                     </if>
-             ))
+
+            ))
 
     </select>
 
@@ -1082,4 +1084,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="UpGradeInterfaceByTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeOpenUpBo" >
         update class_grade set interface_push_id = #{interfacePushId} where grade_id = #{gradeId}
     </update>
+
+    <select id="getOrderGoodsByClassId" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.order.domain.OrderGoods" >
+        SELECT
+            og.*
+        FROM
+            order_goods og
+                LEFT JOIN `order` o ON og.order_sn = o.order_sn
+        WHERE
+            og.pay_status IN ( 2, 3, 4 )
+            AND og.refund_status != 2
+	        AND og.`status` = 1
+	        AND o.`status` = 1
+	        AND o.user_id = #{userId}
+	        AND og.grade_id = #{gradeId}
+    </select>
 </mapper>

+ 105 - 29
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>
 
 
@@ -160,6 +161,7 @@
         <result property="orderGoodsId" column="order_goods_id"/>
         <result property="classStartTime" column="class_start_time"/>
         <result property="classEndTime" column="class_end_time"/>
+        <result property="officialName" column="official_name"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
@@ -259,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"
@@ -815,6 +817,7 @@
         cg.official_name,
         cg.class_start_time,
         cg.class_end_time,
+        cg.official_name,
         g.class_hours,
         u.one_inch_photos,
         u.id_card_img1,
@@ -823,26 +826,26 @@
         cgu.order_goods_id,
         (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
         class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type in (1,3) ) as exam_num,
-        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id, ubr.exam_id) FROM user_bank_record ubr  where ubr.`status` = 1 and ubr.`type` in (1,3) and ubr.report_status =1 and ubr.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.current_status=1) as record_num,
+        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id, ubr.exam_id) FROM user_bank_record ubr  where ubr.`status` = 1 and ubr.`type` in (1,3) and ubr.report_status =1 and ubr.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.order_goods_id=cgu.order_goods_id and ubr.current_status=1) as record_num,
         (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
-        ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cgu.grade_id and up.`type` = 1) as pass,
+        ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cgu.grade_id and up.order_goods_id=cgu.order_goods_id and up.`type` = 1) as pass,
         (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
-        ups.`status` =2 and up.grade_id = cg.grade_id  and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type` = 1) as pending,
+        ups.`status` =2 and up.grade_id = cg.grade_id  and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.order_goods_id=cgu.order_goods_id and up.user_id = #{userId} and up.`type` = 1) as pending,
         (SELECT
         COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
-        =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and  up.user_id = #{userId} and up.`type` = 1) as cheat,
+        =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.order_goods_id=cgu.order_goods_id and  up.user_id = #{userId} and up.`type` = 1) as cheat,
         (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
-        ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cg.grade_id and up.`type` in (2,3)) as exam_pass,
+        ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.order_goods_id=cgu.order_goods_id and up.grade_id = cg.grade_id and up.`type` in (2,3)) as exam_pass,
         (SELECT
         COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
-        =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type`  in (2,3)) as exam_cheat,
+        =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.order_goods_id=cgu.order_goods_id and up.user_id = #{userId} and up.`type`  in (2,3)) as exam_cheat,
         (SELECT
         COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
-        =2 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.`type`  in (2,3)) as exam_pending,
+        =2 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.order_goods_id=cgu.order_goods_id and up.user_id = #{userId} and up.`type`  in (2,3)) as exam_pending,
         (SELECT up.key_value FROM user_profile up where up.goods_id = #{goodsId} and up.user_id =#{userId} and up.order_goods_id = cgu.order_goods_id and up.current_status = 1 and up.`status` = 1 and up.type_status =1 LIMIT 1) as key_value
         <if test="userId != null and userId !='' ">
-            ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_start_time,
-            (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_end_time
+            ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) as study_start_time,
+            (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) as study_end_time
         </if>
         FROM
         class_grade_user cgu
@@ -860,6 +863,9 @@
         <if test="periodStatus != null and periodStatus !='' ">
             and cgu.period_status = #{periodStatus}
         </if>
+        <if test="orderGoodsId != null and orderGoodsId !='' ">
+            and cgu.order_goods_id = #{orderGoodsId}
+        </if>
         LIMIT 1
     </select>
 
@@ -961,7 +967,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
@@ -1096,10 +1102,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 !='' ">
@@ -1124,10 +1130,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 !='' ">
@@ -1152,16 +1158,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 !='' ">
@@ -1175,10 +1181,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>
@@ -1207,13 +1213,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>
@@ -1241,10 +1247,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>
@@ -1277,7 +1283,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
@@ -1308,10 +1314,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>
@@ -1578,4 +1584,74 @@
           AND up.grade_id = cgu.grade_id
             )>0
     </select>
+
+    <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
+        SELECT
+            p.create_time
+        FROM
+            user_study_record usr
+                LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
+        WHERE
+            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
+            LIMIT 1
+    </select>
+
+    <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
+        SELECT
+            ups.record_end_time
+        FROM
+            user_period_status ups
+                LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+            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
+            LIMIT 1
+    </select>
+
+    <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
+        SELECT
+            cgu.*
+        FROM
+            class_grade_user cgu
+                LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
+                LEFT JOIN goods g ON og.goods_id = g.goods_id
+                LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+                LEFT JOIN course_business cb ON g.business_id = cb.id
+        WHERE
+                cgu.`status` = 1
+                AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
+                AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
+                AND og.`status` = 1
+                AND og.refund_status != 2
+	            AND og.pay_status IN ( 2, 3, 4 )
+	            AND cgu.period_status = 0
+	            AND cgu.finish_status = 0
+	            AND (
+	            SELECT
+	            	COUNT( usr.record_id )
+	            FROM
+	            	user_study_record usr
+	            WHERE
+	            	usr.order_goods_id = cgu.order_goods_id
+	            	AND usr.user_id = cgu.user_id
+	            	AND usr.current_status = 1
+	            ) > 0
+	            AND cgu.user_id = #{userId}
+    </select>
 </mapper>

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodMapper.xml

@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
         <result property="moduleId" column="module_id"/>
         <result property="chapterId" column="chapter_id"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
     <select id="checkGoodsChange" parameterType="com.zhongzheng.modules.grade.bo.UserPeriodQueryBo" resultType="Long">

+ 46 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -30,6 +30,9 @@
         <result property="serviceStartTime" column="service_start_time"/>
         <result property="serviceEndTime" column="service_end_time"/>
         <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">
@@ -109,6 +112,10 @@
         <result property="classHours" column="class_hours"/>
         <result property="courseNum" column="course_num"/>
         <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
+        <result property="sevenClassVersion" column="seven_class_version"/>
+        <result property="sevenClassStatus" column="seven_class_status"/>
+        <result property="sevenYear" column="seven_year"/>
+        <result property="orderYear" column="order_year"/>
     </resultMap>
 
     <select id="selectListBybo" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
@@ -302,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>
@@ -870,4 +878,42 @@
 	        AND o.`status` = 1
 	        AND o.user_id = #{userId}
     </select>
+
+    <select id="getSevenLastOne" parameterType="map" resultType="com.zhongzheng.modules.order.domain.OrderGoods">
+        SELECT
+        og.*
+        FROM
+        order_goods og
+        LEFT JOIN goods g ON og.goods_id = g.goods_id
+        LEFT JOIN `order` o ON og.order_sn = o.order_sn
+        WHERE
+        og.`status` = 1
+        AND og.refund_status != 2
+        AND o.user_id = #{userId}
+        AND og.pay_status IN ( 2, 3, 4 )
+        AND g.project_id = #{projectId}
+        AND og.seven_class_status = 3
+        AND og.seven_year = #{sevenYear}
+        AND og.seven_class_version > 0
+        ORDER BY og.seven_class_version DESC
+        LIMIT 1
+    </select>
+
+    <select id="countOrderGoodsByYear" parameterType="map" resultType="java.lang.Long">
+        SELECT
+            COUNT( og.order_goods_id )
+        FROM
+            order_goods og
+            LEFT JOIN `order` o ON og.order_sn = o.order_sn
+        WHERE
+            og.refund_status != 2
+            AND og.pay_status IN ( 2, 3, 4 )
+            AND og.`status` = 1
+            AND o.`status` = 1
+            AND o.user_id = #{userId}
+            AND og.goods_id = #{goodsId}
+            AND og.seven_year = #{sevenYear}
+            AND og.service_start_time <![CDATA[  <=  ]]> UNIX_TIMESTAMP()
+            AND og.service_end_time <![CDATA[   >=  ]]> UNIX_TIMESTAMP()
+    </select>
 </mapper>

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

@@ -64,8 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         any_value ( cb.business_name ) business_name,
         (select IFNULL(sum(og.goods_received),0) from order_goods og LEFT JOIN `order` o on o.order_sn = og.order_sn  where o.input_order_sn = u.input_order_sn and og.refund_status = 2) goods_refund,
         IFNULL(sum( og.goods_received ),0) goods_received,
-        IFNULL(sum(u.order_price ),0) order_price,
-        IFNULL(sum(u.pay_price),0) pay_price,
+        IFNULL(sum(og.goods_price ),0) order_price,
+        IFNULL(sum(og.goods_real_price),0) pay_price,
         any_value ( u.create_username ) create_username,
         any_value ( u.create_time ) create_time FROM (SELECT
         oi.*,

+ 84 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -816,6 +816,9 @@
                 AND up.goods_id = 0
             </otherwise>
         </choose>
+        <if test="orderGoodsId != null and orderGoodsId != '' ">
+            AND up.order_goods_id =  #{orderGoodsId}
+        </if>
         AND up.user_id = #{userId}
     </select>
 
@@ -890,6 +893,9 @@
         <if test="type != null and type == 3">
             and up.type = 3
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != '' ">
+            AND up.order_goods_id =  #{orderGoodsId}
+        </if>
         AND up.user_id = #{userId}
     </select>
 
@@ -1188,6 +1194,9 @@
         <if test="type != null and type == 3">
             and up.type = 3
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != '' ">
+            AND up.order_goods_id =  #{orderGoodsId}
+        </if>
         AND up.user_id = #{userId}
     </select>
 
@@ -1262,6 +1271,9 @@
         <if test="type != null and type == 3">
             and up.type = 3
         </if>
+        <if test="orderGoodsId != null and orderGoodsId != '' ">
+            AND up.order_goods_id =  #{orderGoodsId}
+        </if>
         AND up.user_id = #{userId}
         AND ups.period_status = 1
     </select>
@@ -1742,4 +1754,76 @@
     <select id="getStudyRecord" parameterType="map" resultType="com.zhongzheng.modules.user.domain.UserStudyRecord">
         SELECT * FROM user_study_record WHERE user_id = #{userId} AND grade_id = #{gradeId} ORDER BY create_time ${sort} LIMIT 1
     </select>
+
+
+    <select id="getSevenStudyRecord" parameterType="map" resultType="com.zhongzheng.modules.user.domain.UserStudyRecord">
+        SELECT
+            usr.*
+        FROM
+            user_study_record usr
+                LEFT JOIN course_chapter cc ON usr.chapter_id = cc.chapter_id
+        WHERE
+            usr.order_goods_id = #{orderGoodsId} AND usr.grade_id = #{gradeId} AND cc.common_sign = 1 AND usr.current_status = 1 AND usr.`status` = 1  LIMIT 1
+    </select>
+
+    <select id="selectSevenUserPeriod" parameterType="com.zhongzheng.modules.user.domain.UserBankRecord" resultType="com.zhongzheng.modules.grade.domain.UserPeriod">
+        SELECT
+        up.*
+        FROM
+        user_period up
+        WHERE
+        1 =1
+        <choose>
+            <when test="chapterId != null and chapterId !=''">
+                AND up.chapter_id = #{chapterId}
+            </when>
+            <otherwise>
+                AND up.chapter_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="sectionId != null and sectionId !=''">
+                AND up.section_id = #{sectionId}
+            </when>
+            <otherwise>
+                AND up.section_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="moduleId != null and moduleId !=''">
+                AND up.module_id = #{moduleId}
+            </when>
+            <otherwise>
+                AND up.module_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="courseId != null and courseId !=''">
+                AND up.course_id = #{courseId}
+            </when>
+            <otherwise>
+                AND up.course_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="gradeId != null and gradeId !=''">
+                AND up.grade_id = #{gradeId}
+            </when>
+            <otherwise>
+                AND up.grade_id = 0
+            </otherwise>
+        </choose>
+        <choose>
+            <when test="goodsId != null and goodsId !=''">
+                AND up.goods_id = #{goodsId}
+            </when>
+            <otherwise>
+                AND up.goods_id = 0
+            </otherwise>
+        </choose>
+        <if test="orderGoodsId != null and orderGoodsId != '' ">
+            AND up.order_goods_id =  #{orderGoodsId}
+        </if>
+        AND up.user_id = #{userId}
+    </select>
 </mapper>