yangdamao 2 жил өмнө
parent
commit
cec9a11ea8
100 өөрчлөгдсөн 3233 нэмэгдсэн , 469 устгасан
  1. 71 2
      run-prod.sh
  2. 0 105
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/order/TopOldOrderAttachmentController.java
  3. 16 9
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/order/TopOldOrderController.java
  4. 1 0
      zhongzheng-admin-saas/src/main/resources/application-dev.yml
  5. 1 0
      zhongzheng-admin-saas/src/main/resources/application-pre.yml
  6. 1 0
      zhongzheng-admin-saas/src/main/resources/application-prod.yml
  7. 16 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/alioss/OssController.java
  8. 10 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/QuestionController.java
  9. 6 3
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  10. 84 21
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java
  11. 59 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java
  12. 11 1
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserMockSubscribeController.java
  13. 3 2
      zhongzheng-admin/src/main/resources/application-dev.yml
  14. 1 0
      zhongzheng-admin/src/main/resources/application-pre.yml
  15. 1 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  16. 3 3
      zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionController.java
  17. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/base/ProfileTpController.java
  18. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/base/UserProfileStampController.java
  19. 6 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java
  20. 7 8
      zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java
  21. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java
  22. 4 4
      zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java
  23. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/inform/InformUserController.java
  24. 2 2
      zhongzheng-api/src/main/java/com/zhongzheng/controller/mock/MockApplyController.java
  25. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java
  26. 3 3
      zhongzheng-api/src/main/java/com/zhongzheng/controller/plan/UserPlanController.java
  27. 2 2
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserBankRecordController.java
  28. 25 5
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java
  29. 1 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserNoteController.java
  30. 8 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserStudyRecordController.java
  31. 1 0
      zhongzheng-api/src/main/resources/application-dev.yml
  32. 1 0
      zhongzheng-api/src/main/resources/application-pre.yml
  33. 1 0
      zhongzheng-api/src/main/resources/application-prod.yml
  34. 5 0
      zhongzheng-common/pom.xml
  35. 49 6
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java
  36. 46 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/JavaMailUtils.java
  37. 147 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/FileUtils.java
  38. 49 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java
  39. 11 4
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/security/filter/JwtAuthenticationTokenFilter.java
  40. 1 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java
  41. 137 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserLoginKeyServiceImpl.java
  42. 5 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java
  43. 23 14
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxTokenService.java
  44. 2 0
      zhongzheng-generator/src/main/java/com/zhongzheng/generator/controller/FilterController.java
  45. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  46. 21 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  47. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  48. 361 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  49. 23 7
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java
  50. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseQueryBo.java
  51. 10 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseBusinessServiceImpl.java
  52. 42 19
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java
  53. 10 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyAddBo.java
  54. 10 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyEditBo.java
  55. 6 7
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyQueryBo.java
  56. 118 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyRoomQueryBo.java
  57. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplySendmailBo.java
  58. 26 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyUserImportBo.java
  59. 9 11
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamApply.java
  60. 7 5
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamApplySiteTime.java
  61. 8 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java
  62. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java
  63. 20 24
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyGoodsServiceImpl.java
  64. 573 66
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java
  65. 22 20
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplySiteServiceImpl.java
  66. 57 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyPlaceVo.java
  67. 11 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyVo.java
  68. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java
  69. 11 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeUserQueryBo.java
  70. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java
  71. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java
  72. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java
  73. 545 13
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  74. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodChapterVo.java
  75. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodSectionVo.java
  76. 3 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportAllVo.java
  77. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportVo.java
  78. 92 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportWeekAllVo.java
  79. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java
  80. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java
  81. 29 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/WeekDataVo.java
  82. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java
  83. 3 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java
  84. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java
  85. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/impl/TopNuoMplatformLogServiceImpl.java
  86. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/vo/TopNuoMplatformLogVo.java
  87. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTopTenantAddBo.java
  88. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTopTenantEditBo.java
  89. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java
  90. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/vo/SysTenantVo.java
  91. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/tencentcloud/service/impl/FaceOcrServiceImpl.java
  92. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderAddBo.java
  93. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderEditBo.java
  94. 26 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderQueryBo.java
  95. 3 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/domain/TopOldOrder.java
  96. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopOldOrderMapper.java
  97. 4 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopOldOrderService.java
  98. 148 37
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java
  99. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderGoodsListVo.java
  100. 25 33
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderVo.java

+ 71 - 2
run-prod.sh

@@ -1,5 +1,76 @@
 #!/usr/bin/env bash
+# 定义应用组名
+group_name='zhongzheng'
+# 定义应用名称
+app_name='zhongzheng-saas-api'
+# 定义应用版本
+app_version='1.0-SNAPSHOT'
+# 定义应用环境
+profile_active='prod'
+echo '----copy jar----'
+docker stop ${app_name}
+echo '----stop container----'
+docker rm ${app_name}
+echo '----rm container----'
+docker rmi ${group_name}/${app_name}:${app_version}
+echo '----rm image----'
+# 打包编译docker镜像
+docker build -f /mydata/maven/build/Dockerfile -t ${group_name}/${app_name}:${app_version} .
+echo '----build image----'
+docker run -p 5055:5055 --name ${app_name} \
+--restart=always \
+-e 'spring.profiles.active'=${profile_active} \
+-e TZ="Asia/Shanghai" \
+-m 10240m \
+--cpus=3 \
+--log-opt max-size=50m \
+--log-opt max-file=3 \
+-v /etc/localtime:/etc/localtime \
+-v /usr/share/fonts:/usr/share/fonts \
+-v /data/logs/prod_api:/logs \
+-v /mydata/app/${app_name}/logs:/var/logs \
+-d ${group_name}/${app_name}:${app_version}
+echo '----start container----'
 
+echo "开始等待20秒..."
+# 1-10秒内随机
+sleep 5
+echo "等待后继续"
+
+#!/usr/bin/env bash
+# 定义应用组名
+group_admin_name='zhongzheng'
+# 定义应用名称
+app_admin_name='zhongzheng-saas-admin'
+# 定义应用版本
+app_admin_version='1.0-SNAPSHOT'
+# 定义应用环境
+profile_active='prod'
+echo '----copy jar admin----'
+docker stop ${app_admin_name}
+echo '----stop container admin----'
+docker rm ${app_admin_name}
+echo '----rm container admin----'
+docker rmi ${group_admin_name}/${app_admin_name}:${app_admin_version}
+echo '----rm image admin----'
+# 打包编译docker镜像
+docker build -f /mydata/maven/build/Dockerfile-admi -t ${group_admin_name}/${app_admin_name}:${app_admin_version} .
+echo '----build image admin----'
+docker run \
+-p 5030:5030 \
+--name ${app_admin_name} \
+--restart=always \
+--log-opt max-size=50m \
+--log-opt max-file=3 \
+-e 'spring.profiles.active'=${profile_active} \
+-e TZ="Asia/Shanghai" \
+-v /etc/localtime:/etc/localtime \
+-v /usr/share/fonts:/usr/share/fonts \
+-v /data/logs/prod_admin:/logs \
+-v /mydata/app/${app_admin_name}/logs:/var/logs \
+-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秒内随机
@@ -41,5 +112,3 @@ docker run \
 -d ${group_admin_name}/${app_admin_name}:${app_admin_version}
 echo '----start container admin top----'
 
-
-

+ 0 - 105
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/order/TopOldOrderAttachmentController.java

@@ -1,105 +0,0 @@
-package com.zhongzheng.controller.order;
-
-import com.zhongzheng.common.annotation.Log;
-import com.zhongzheng.common.core.controller.BaseController;
-import com.zhongzheng.common.core.domain.AjaxResult;
-import com.zhongzheng.common.core.page.TableDataInfo;
-import com.zhongzheng.common.enums.BusinessType;
-import com.zhongzheng.common.utils.poi.ExcelUtil;
-import com.zhongzheng.modules.top.goods.bo.TopOldOrderAttachmentAddBo;
-import com.zhongzheng.modules.top.goods.bo.TopOldOrderAttachmentEditBo;
-import com.zhongzheng.modules.top.goods.bo.TopOldOrderAttachmentQueryBo;
-import com.zhongzheng.modules.top.goods.service.ITopOldOrderAttachmentService;
-import com.zhongzheng.modules.top.goods.vo.TopOldOrderAttachmentVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 订单附件Controller
- * 
- * @author ruoyi
- * @date 2023-04-20
- */
-@Api(value = "订单附件控制器", tags = {"订单附件管理"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
-@RestController
-@RequestMapping("/system/order/attachment")
-public class TopOldOrderAttachmentController extends BaseController {
-
-    private final ITopOldOrderAttachmentService iTopOrderAttachmentService;
-
-    /**
-     * 查询订单附件列表
-     */
-    @ApiOperation("查询订单附件列表")
-    @PreAuthorize("@ss.hasPermi('system:attachment:list')")
-    @GetMapping("/list")
-    public TableDataInfo<TopOldOrderAttachmentVo> list(TopOldOrderAttachmentQueryBo bo) {
-        startPage();
-        List<TopOldOrderAttachmentVo> list = iTopOrderAttachmentService.queryList(bo);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出订单附件列表
-     */
-    @ApiOperation("导出订单附件列表")
-    @PreAuthorize("@ss.hasPermi('system:attachment:export')")
-    @Log(title = "订单附件", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult<TopOldOrderAttachmentVo> export(TopOldOrderAttachmentQueryBo bo) {
-        List<TopOldOrderAttachmentVo> list = iTopOrderAttachmentService.queryList(bo);
-        ExcelUtil<TopOldOrderAttachmentVo> util = new ExcelUtil<TopOldOrderAttachmentVo>(TopOldOrderAttachmentVo.class);
-        return util.exportExcel(list, "订单附件");
-    }
-
-    /**
-     * 获取订单附件详细信息
-     */
-    @ApiOperation("获取订单附件详细信息")
-    @PreAuthorize("@ss.hasPermi('system:attachment:query')")
-    @GetMapping("/{id}")
-    public AjaxResult<TopOldOrderAttachmentVo> getInfo(@PathVariable("id" ) Long id) {
-        return AjaxResult.success(iTopOrderAttachmentService.queryById(id));
-    }
-
-    /**
-     * 新增订单附件
-     */
-    @ApiOperation("新增订单附件")
-    @PreAuthorize("@ss.hasPermi('system:attachment:add')")
-    @Log(title = "订单附件", businessType = BusinessType.INSERT)
-    @PostMapping()
-    public AjaxResult<Void> add(@RequestBody TopOldOrderAttachmentAddBo bo) {
-        return toAjax(iTopOrderAttachmentService.insertByAddBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 修改订单附件
-     */
-    @ApiOperation("修改订单附件")
-    @PreAuthorize("@ss.hasPermi('system:attachment:edit')")
-    @Log(title = "订单附件", businessType = BusinessType.UPDATE)
-    @PutMapping()
-    public AjaxResult<Void> edit(@RequestBody TopOldOrderAttachmentEditBo bo) {
-        return toAjax(iTopOrderAttachmentService.updateByEditBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 删除订单附件
-     */
-    @ApiOperation("删除订单附件")
-    @PreAuthorize("@ss.hasPermi('system:attachment:remove')")
-    @Log(title = "订单附件" , businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult<Void> remove(@PathVariable Long[] ids) {
-        return toAjax(iTopOrderAttachmentService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
-    }
-}

+ 16 - 9
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/order/TopOldOrderController.java

@@ -20,7 +20,6 @@ import com.zhongzheng.modules.top.goods.vo.TopOrderStatisticsVo;
 import com.zhongzheng.modules.top.goods.vo.TopRefundOrderDetailVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCommissionExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
-import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderSellerExportVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -29,9 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -72,7 +68,7 @@ public class TopOldOrderController extends BaseController {
     public AjaxResult<TopOldOrderVo> export(TopOldOrderQueryBo bo) {
         List<TopOldOrderVo> list = iTopOldOrderService.queryList(bo);
         ExcelUtil<TopOldOrderVo> util = new ExcelUtil<TopOldOrderVo>(TopOldOrderVo.class);
-        return util.exportExcel(list, "订单");
+        return util.exportExcel(list, "订单信息");
     }
 
     /**
@@ -95,6 +91,17 @@ public class TopOldOrderController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 订单学员信息导出
+     */
+    @ApiOperation("订单学员信息导出")
+    @GetMapping("/student/export")
+    public AjaxResult<TopOldOrderGoodsListVo> exportStudent(TopOldOrderGoodsQuery bo) {
+        List<TopOldOrderGoodsListVo> list = iTopOldOrderService.getOrderGoodsList(bo);
+        ExcelUtil<TopOldOrderGoodsListVo> util = new ExcelUtil<TopOldOrderGoodsListVo>(TopOldOrderGoodsListVo.class);
+        return util.exportExcel(list, "订单学员信息");
+    }
+
     /**
      * 新增订单
      */
@@ -220,7 +227,7 @@ public class TopOldOrderController extends BaseController {
     @ApiOperation("批量修改订单备注")
     @PostMapping("/update/remark")
     public AjaxResult<Void> updateRemark(@RequestBody TopUpdateRemarkBo bo) {
-        return toAjax(iTopOldOrderService.updateRemark(bo) ? 1 : 0);
+        return toAjax(iTopOldOrderService.updateFinanceRemark(bo) ? 1 : 0);
     }
 
     /**
@@ -239,9 +246,9 @@ public class TopOldOrderController extends BaseController {
      * 订单统计
      */
     @ApiOperation("订单统计")
-    @PostMapping("/statistics")
-    public AjaxResult<TopOrderStatisticsVo> statisticsOrder() {
-        return AjaxResult.success(iTopOldOrderService.statisticsOrder());
+    @GetMapping("/statistics")
+    public AjaxResult<TopOrderStatisticsVo> statisticsOrder(TopOldOrderQueryBo bo) {
+        return AjaxResult.success(iTopOldOrderService.statisticsOrder(bo));
     }
 
     @ApiOperation("订单应收应付统计")

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://gdxypx.xy.com/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:5030/common/platform/pay
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
+    updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://gdxypx.xy.com

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://test.jqbao.net/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:6030/common/platform/pay
     refundPayHandle: http://192.168.1.222:6030/common/platform/pay/handle
+    updateRemark: http://test.jqbao.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://test.jqbao.net

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://www.xyyxt.net/WitSystem/BussinessApi/CommissionRate
     refundPay: https://cloud.xyyxt.net/common/platform/pay
     refundPayHandle: https://cloud.xyyxt.net/common/platform/pay/handle
+    updateRemark: http://www.xyyxt.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: https://www.xyyxt.net

+ 16 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/alioss/OssController.java

@@ -18,6 +18,8 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
 import java.util.Map;
 
 /**
@@ -70,4 +72,18 @@ public class OssController extends BaseController {
         return AjaxResult.success("返回图片路径",result);
     }
 
+    @ApiOperation("上传file图片")
+    @PostMapping("/uploadTest")
+    public AjaxResult<String> uploadTest() throws Exception {
+        InputStream in = ossService.getStreamByObject("oss/images/avatar/114/1315/1686203595404_1371903125");
+        FileOutputStream fos = new FileOutputStream("D:\\testfile\\b.jpg");
+        byte[] b = new byte[1024];
+        while ((in.read(b)) != -1) {
+            fos.write(b);// 写入数据
+        }
+        in.close();
+        fos.close();// 保存数据
+        return AjaxResult.success("返回图片路径","");
+    }
+
 }

+ 10 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -279,4 +279,14 @@ public class QuestionController extends BaseController {
         Map<String,Object> result = iQuestionService.importWordQuestionList(file,  eduId,  projectId,  businessId, subjectId);
         return AjaxResult.success(result);
     }
+
+
+    @ApiOperation("导入建匠题目Word模板列表")
+    @PreAuthorize("@ss.hasPermi('system:question:import')")
+    @PostMapping("/importJJWordQuestionList")
+    public AjaxResult<Map<String,Object>> importJJWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId) throws Exception
+    {
+        Map<String,Object> result = iQuestionService.importJJWordQuestionList(file,  eduId,  projectId,  businessId, subjectId);
+        return AjaxResult.success(result);
+    }
 }

+ 6 - 3
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -14,6 +14,7 @@ import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
@@ -148,11 +149,10 @@ public class CommonController extends BaseController {
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, realFileName);
             FileUtils.writeBytes(filePath, response.getOutputStream());
-           /* if (delete)
+            if (delete)
             {
                 FileUtils.deleteFile(filePath);
-            }*/
-            FileUtils.deleteFile(filePath);
+            }
         } catch (Exception e) {
             log.error("下载文件失败", e);
         }
@@ -492,6 +492,9 @@ public class CommonController extends BaseController {
         Map<String, Object> map = new HashMap<>();
         String jsonStr = configService.selectConfigByKey("home.header");
         JSONObject objectJson = JSON.parseObject(jsonStr);
+        if(Validator.isEmpty(objectJson)){
+            throw new CustomException("数据错误");
+        }
         map.put("companyName", String.valueOf(objectJson.get("companyName")));
         return AjaxResult.success(map);
     }

+ 84 - 21
zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java

@@ -1,33 +1,30 @@
 package com.zhongzheng.controller.exam;
 
-import java.util.List;
-import java.util.Arrays;
-
-import com.zhongzheng.modules.exam.bo.*;
-import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
-import com.zhongzheng.modules.exam.service.IExamApplySiteService;
-import com.zhongzheng.modules.exam.service.IExamApplyUserService;
-import com.zhongzheng.modules.exam.vo.*;
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.utils.poi.EasyPoiUtil;
+import com.zhongzheng.modules.exam.bo.*;
+import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
 import com.zhongzheng.modules.exam.service.IExamApplyService;
-import com.zhongzheng.common.utils.poi.ExcelUtil;
-import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.exam.service.IExamApplySiteService;
+import com.zhongzheng.modules.exam.service.IExamApplyUserService;
+import com.zhongzheng.modules.exam.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
 
 /**
  * 考试安排Controller
@@ -61,6 +58,36 @@ public class ExamApplyController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询考场列表
+     */
+    @ApiOperation("查询考场列表")
+    @GetMapping("/place")
+    public TableDataInfo<ExamApplyPlaceVo> placeList(ExamApplyRoomQueryBo bo) {
+        startPage();
+        List<ExamApplyPlaceVo> list = iExamApplyService.getPlaceList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 考场邮件信息
+     */
+    @ApiOperation("考场邮件地址")
+    @GetMapping("/sendmail")
+    public AjaxResult getSendmailUrl(ExamApplyQueryBo bo) {
+        String url = iExamApplyService.getSendmailUrl(bo.getIds());
+        return AjaxResult.success(url);
+    }
+
+    /**
+     * 考场邮件发送
+     */
+    @ApiOperation("考场邮件发送")
+    @PostMapping("/send")
+    public AjaxResult<Void> sendmail(@RequestBody ExamApplySendmailBo bo) {
+        return toAjax(iExamApplyService.sendmail(bo)? 1 : 0);
+    }
+
 
     /**
      * 获取考试安排详细信息
@@ -94,6 +121,24 @@ public class ExamApplyController extends BaseController {
         return toAjax(iExamApplyService.insertByAddBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 新增考试安排
+     */
+    @ApiOperation("新增考试安排")
+    @PostMapping("/save")
+    public AjaxResult<Void> saveExamApply(MultipartFile file, String param) {
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数有误!");
+        }
+        ExamApplyAddBo addBo = JSONObject.parseObject(param, ExamApplyAddBo.class);
+        if (ObjectUtils.isNotNull(file)){
+            //学员资料解析
+            List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
+            addBo.setApplyUsers(applyUsers);
+        }
+        return toAjax(iExamApplyService.saveExamApply(addBo) ? 1 : 0);
+    }
+
     /**
      * 修改考试安排
      */
@@ -105,6 +150,24 @@ public class ExamApplyController extends BaseController {
         return toAjax(iExamApplyService.updateByEditBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 修改考试安排
+     */
+    @ApiOperation("修改考试安排")
+    @PostMapping("/editApply")
+    public AjaxResult<Void> editExamApply(MultipartFile file, String param) {
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数有误!");
+        }
+        ExamApplyEditBo editBo = JSONObject.parseObject(param, ExamApplyEditBo.class);
+        if (ObjectUtils.isNotNull(file)){
+            //学员资料解析
+            List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(file,0,1,ExamApplyUserImportBo.class);
+            editBo.setApplyUsers(applyUsers);
+        }
+        return toAjax(iExamApplyService.editExamApply(editBo) ? 1 : 0);
+    }
+
     /**
      * 新增考试安排地点
      */

+ 59 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -237,6 +237,15 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("按周查询学员学时学习记录列表")
+    @PreAuthorize("@ss.hasPermi('grade:user:list')")
+    @GetMapping("/listUserPeriodWeekRecord")
+    public TableDataInfo<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo) {
+        startPage();
+        List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodWeekRecord(bo);
+        return getDataTable(list);
+    }
+
 
     @ApiOperation("查询学员视频学习记录列表")
     @PreAuthorize("@ss.hasPermi('grade:user:list')")
@@ -258,6 +267,15 @@ public class ClassGradeController extends BaseController {
         List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyRecordV2(bo);
         return getDataTable(list);
     }
+
+    @ApiOperation("周查询学员学习记录列表")
+    @PreAuthorize("@ss.hasPermi('grade:user:list')")
+    @GetMapping("/listUserStudyRecordV2Week")
+    public TableDataInfo<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo) {
+        startPage();
+        List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyRecordV2Week(bo);
+        return getDataTable(list);
+    }
     /**
      * 查询学时学员记录列表
      *//*
@@ -314,6 +332,47 @@ public class ClassGradeController extends BaseController {
         return AjaxResult.success(map);
     }
 
+    @ApiOperation("周导出学员学时列表")
+    @PreAuthorize("@ss.hasPermi('system:profile:export')")
+    @Log(title = "周导出学员学时列表", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportWeek")
+    public AjaxResult<Map<String,Object>> exportWeek(@RequestBody ClassGradeUserQueryBo bo) {
+        String fileName = "";
+        if(Validator.isEmpty(bo.getStudyStatus())){
+            bo.setStudyStatus(0);
+            fileName="全部";
+        }else{
+            if(bo.getStudyStatus()==0){
+                fileName="全部";
+            }
+            if(bo.getStudyStatus()==1){
+                fileName="未完成学习";
+            }
+            if(bo.getStudyStatus()==2){
+                fileName="完成学习";
+            }
+        }
+        bo.setUserPhoto(1);
+        Map<String,Object> map = iClassGradeUserService.exportWeekPo(bo);
+        List<ClassPeriodStudentExportWeekAllVo> list = (List<ClassPeriodStudentExportWeekAllVo>)map.get("list");
+        ExcelUtil<ClassPeriodStudentExportWeekAllVo> util = new ExcelUtil<ClassPeriodStudentExportWeekAllVo>(ClassPeriodStudentExportWeekAllVo.class);
+        ExportParams deptExportParams = new ExportParams();
+        // 设置sheet得名称
+        deptExportParams.setSheetName("表1");
+        String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        Map<String, Object> deptExportMap = new HashMap<>();
+        deptExportMap.put("title", deptExportParams);
+        deptExportMap.put("entity", ClassPeriodStudentExportWeekAllVo.class);
+        // sheet中要填充得数据
+        deptExportMap.put("data", list);
+        List<Map<String, Object>> sheetsList = new ArrayList<>();
+        sheetsList.add(deptExportMap);
+        String businessName = Validator.isNotEmpty(bo.getBusinessName())?bo.getBusinessName():"";
+        map.put("excel",util.exportEasyExcel(sheetsList, businessName+"-"+fileName+"-学员学习记录-"+timeStr));
+        map.remove("list");
+        return AjaxResult.success(map);
+    }
+
     /**
      * 查询学员学时信息列表
      */

+ 11 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserMockSubscribeController.java

@@ -22,7 +22,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.text.ParseException;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -53,6 +52,17 @@ public class UserMockSubscribeController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 模考导出
+     */
+    @ApiOperation("模考导出")
+    @GetMapping("/listSubscribe/export")
+    public AjaxResult<UserMockSubscribeVo> listSubscribeExport(UserMockSubscribeQueryBo bo) {
+        List<UserMockSubscribeVo> list = iUserMockSubscribeService.listSubscribe(bo);
+        ExcelUtil<UserMockSubscribeVo> util = new ExcelUtil<UserMockSubscribeVo>(UserMockSubscribeVo.class);
+        return util.exportExcel(list, "模考数据");
+    }
+
     /**
      * 导出用户预约模考列表
      */

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

@@ -121,7 +121,7 @@ certificate:
 
 liveGotoURL: http://
 
-enCodeVersion: develop
+enCodeVersion: trial
 
 oldStudySys:
     syncPath: http://gdxypx.xy.com/System/BussinessApi/PostUserStudyRecords
@@ -136,7 +136,7 @@ oldStudySys:
     updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
 
 officialPush:
-    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    infoPath: closehttps://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
@@ -165,6 +165,7 @@ oldOrder:
     checkOrderBrokerage: http://gdxypx.xy.com/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:5030/common/platform/pay
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
+    updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://gdxypx.xy.com

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://test.jqbao.net/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:6030/common/platform/pay
     refundPayHandle: http://192.168.1.222:6030/common/platform/pay/handle
+    updateRemark: http://test.jqbao.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://test.jqbao.net

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://www.xyyxt.net/WitSystem/BussinessApi/CommissionRate
     refundPay: https://cloud.xyyxt.net/common/platform/pay
     refundPayHandle: https://cloud.xyyxt.net/common/platform/pay/handle
+    updateRemark: http://www.xyyxt.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://test.jqbao.net

+ 3 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -65,9 +65,9 @@ public class QuestionController extends BaseController {
     @ApiOperation("查询用户拥有题库商品")
     @GetMapping("/listGoodsUserQuestion")
     public TableDataInfo<GoodsUserQuestionVo> listGoodsUserQuestionVo(GoodsQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<GoodsUserQuestionVo> list = iQuestionService.listGoodsUserQuestionVo(bo);
         for (GoodsUserQuestionVo g : list) {
             UserExamRecordQueryBo userExamRecordQueryBo = new UserExamRecordQueryBo();
@@ -88,9 +88,9 @@ public class QuestionController extends BaseController {
     @ApiOperation("查询用户拥有免费题库商品")
     @GetMapping("/listFreeGoodsList")
     public TableDataInfo<GoodsUserQuestionVo> listFreeGoodsList(GoodsQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<GoodsUserQuestionVo> list = iQuestionService.listUserFreeGoodsList(bo);
         for (GoodsUserQuestionVo g : list) {
             UserExamRecordQueryBo userExamRecordQueryBo = new UserExamRecordQueryBo();
@@ -110,9 +110,9 @@ public class QuestionController extends BaseController {
     @ApiOperation("查询用户拥有免费+自购题库商品")
     @GetMapping("/listUserFreeUnionBuyGoodsList")
     public TableDataInfo<GoodsUserQuestionVo> listUserFreeUnionBuyGoodsList(GoodsQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<GoodsUserQuestionVo> list = iQuestionService.listUserFreeUnionBuyGoodsList(bo);
         if (!CollectionUtils.isEmpty(list)){
             for (GoodsUserQuestionVo g : list) {

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/base/ProfileTpController.java

@@ -126,10 +126,10 @@ public class ProfileTpController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:profile:list')")
     @GetMapping("/listProfile")
     public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
         bo.setTypeStatus(1L);
+        startPage();
         List<UserProfileVo> list = iUserProfileService.queryList(bo);
         return getDataTable(list);
     }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/base/UserProfileStampController.java

@@ -114,11 +114,11 @@ public class UserProfileStampController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:profile:list')")
     @GetMapping("/listProfile")
     public TableDataInfo<UserProfileVo> list(UserProfileQueryBo bo) {
-        startPage();
         //2为承诺书审核
         bo.setTypeStatus(2L);
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserProfileVo> list = iUserProfileService.queryList(bo);
         return getDataTable(list);
     }

+ 6 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 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;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
@@ -368,4 +369,9 @@ public class CommonController extends BaseController {
         List<ActivityGoodsPriceVo> list = iDistributionActivityGoodsService.getGoodsList(bo);
         return getDataTable(list);
     }
+
+    @RequestMapping("/token_offline")
+    public void loginAuthFailOffLine() {
+        throw new CustomException("用户验证错误",409);
+    }
 }

+ 7 - 8
zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java

@@ -1,24 +1,23 @@
 package com.zhongzheng.controller.course;
 
-import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
-import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.course.bo.*;
 import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.*;
 import com.zhongzheng.modules.goods.vo.GoodsUserVo;
-import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
@@ -47,9 +46,9 @@ public class CourseController extends BaseController {
     @ApiOperation("查询商品下的课程列表")
     @GetMapping("/courseList")
     public TableDataInfo<CourseUserVo> courseList(CourseQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<CourseUserVo> list = iCourseService.courseList(bo);
         return getDataTable(list);
     }
@@ -69,9 +68,9 @@ public class CourseController extends BaseController {
     @ApiOperation("查询用户拥有的商品")
     @GetMapping("/goodsList")
     public TableDataInfo<GoodsUserVo> goodsList(CourseQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<GoodsUserVo> list = iCourseService.goodsList(bo);
         return getDataTable(list);
     }
@@ -90,9 +89,9 @@ public class CourseController extends BaseController {
     @ApiOperation("查询课程目录结构列表")
     @GetMapping("/menuList")
     public TableDataInfo<CourseUserMenuVo> menuList(CourseMenuQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<CourseUserMenuVo> list = iCourseMenuService.menuList(bo);
         return getDataTable(list);
     }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java

@@ -133,9 +133,9 @@ public class ExamApplyController extends BaseController {
     @ApiOperation("查询报考数据列表")
     @GetMapping("/list")
     public TableDataInfo<UserSubscribeVo> listSubscribe(UserSubscribeQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserSubscribeVo> list = iUserSubscribeService.listSubscribe(bo);
         return getDataTable(list);
     }

+ 4 - 4
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -259,9 +259,9 @@ public class GoodsController extends BaseController {
     @ApiOperation("查询用户拥有直播商品")
     @GetMapping("/listGoodsUserLive")
     public TableDataInfo<OrderGoodsVo> listGoodsUserQuestionVo(GoodsQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<OrderGoodsVo> list = iOrderGoodsService.listGoodsUserLive(bo);
         return getDataTable(list);
     }
@@ -272,9 +272,9 @@ public class GoodsController extends BaseController {
     @ApiOperation("查询用户拥有视频+直播商品")
     @GetMapping("/listUserVideoLive")
     public TableDataInfo<OrderGoodsVo> listUserVideoLive(GoodsQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<OrderGoodsVo> list = iOrderGoodsService.listUserVideoLive(bo);
         return getDataTable(list);
     }
@@ -295,8 +295,8 @@ public class GoodsController extends BaseController {
     @ApiOperation("获取直播提醒列表")
     @GetMapping("/getLiveList")
     public TableDataInfo<CourseLiveVo> liveList() {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        startPage();
         List<CourseLiveVo> list = iOrderGoodsService.getLiveList(loginUser.getUser().getUserId());
         return getDataTable(list);
     }
@@ -330,9 +330,9 @@ public class GoodsController extends BaseController {
     @ApiOperation("获取用户所有购买商品")
     @PostMapping("/user/all")
     public TableDataInfo<GoodsListAllVo> getUserGoodsListAll(@RequestBody UserGoodsListAllBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<GoodsListAllVo> result = iGoodsService.getUserGoodsListAll(bo);
         return getDataTable(result);
     }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/inform/InformUserController.java

@@ -53,9 +53,9 @@ public class InformUserController extends BaseController {
     @ApiOperation("查询通知学员列表")
     @GetMapping("/list")
     public TableDataInfo<InformUserVo> list(InformUserQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         bo.setStatus(1);
         List<InformUserVo> list = iInformUserService.queryList(bo);
         return getDataTable(list);

+ 2 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/mock/MockApplyController.java

@@ -33,7 +33,7 @@ import java.util.List;
 
 /**
  * 模考安排Controller
- * 
+ *
  * @author ruoyi
  * @date 2022-05-24
  */
@@ -122,9 +122,9 @@ public class MockApplyController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:apply:list')")
     @GetMapping("/listApply")
     public TableDataInfo<MockApplyVo> listApply(MockApplyQueryBo bo){
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<MockApplyVo> list = iMockApplyService.queryApplyList(bo);
         return getDataTable(list);
     }

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

@@ -51,9 +51,9 @@ public class OrderController extends BaseController {
     @ApiOperation("查询订单列表")
     @GetMapping("/list")
     public TableDataInfo<OrderListVo> list(OrderQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<OrderListVo> list = iOrderService.selectListApp(bo);
         return getDataTable(list);
     }

+ 3 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/plan/UserPlanController.java

@@ -37,7 +37,7 @@ import io.swagger.annotations.ApiOperation;
 
 /**
  * 学习计划Controller
- * 
+ *
  * @author ruoyi
  * @date 2021-12-08
  */
@@ -57,13 +57,13 @@ public class UserPlanController extends BaseController {
     @ApiOperation("查询学习计划列表")
     @GetMapping("/list")
     public TableDataInfo<UserPlanVo> list(UserPlanQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserPlanVo> list = iUserPlanService.queryList(bo);
         return getDataTable(list);
     }
-    
+
 
     /**
      * 获取学习计划详细信息

+ 2 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserBankRecordController.java

@@ -57,9 +57,9 @@ public class UserBankRecordController extends BaseController {
     @ApiOperation("视频商品查询用户的做题历史列表")
     @GetMapping("/list")
     public TableDataInfo<UserBankRecordVo> list(UserBankRecordQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserBankRecordVo> list = iUserBankRecordService.queryList(bo);
         return getDataTable(list);
     }
@@ -70,9 +70,9 @@ public class UserBankRecordController extends BaseController {
     @ApiOperation("视频商品查询用户的做题历史列表")
     @GetMapping("/bankList")
     public TableDataInfo<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserBankRecordVo> list = iUserBankRecordService.getUserBankList(bo);
         return getDataTable(list);
     }

+ 25 - 5
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -1,25 +1,24 @@
 package com.zhongzheng.controller.user;
 
 import cn.hutool.core.lang.Validator;
-import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 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.enums.BusinessType;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
-import com.zhongzheng.controller.alioss.OssController;
 import com.zhongzheng.framework.web.service.WxLoginService;
 import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.system.domain.SysTenant;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.UserWxFollow;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
+import com.zhongzheng.modules.user.service.IUserLoginKeyService;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserVisitLogService;
 import com.zhongzheng.modules.user.service.IUserWxFollowService;
-import com.zhongzheng.modules.user.vo.RanKingUser;
 import com.zhongzheng.modules.user.vo.UserVo;
 import com.zhongzheng.modules.wx.bo.WxLoginBody;
 import io.swagger.annotations.Api;
@@ -56,6 +55,10 @@ public class UserController extends BaseController {
 
     private final WxLoginService wxLoginService;
 
+    private final ISysTenantService sysTenantService;
+
+    private final IUserLoginKeyService iUserLoginKeyService;
+
     private static Logger log = LoggerFactory.getLogger(UserController.class);
     /**
      * 修改客户端用户
@@ -119,6 +122,12 @@ public class UserController extends BaseController {
             vo.setUserFollowWx(1);
         }
         vo.setNull();
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        if (StringUtils.isNotBlank(tenantId)){
+            SysTenant tenant = sysTenantService.getById(Long.valueOf(tenantId));
+            vo.setEduPhone(tenant.getEduPhone());
+        }
+
         bo.setUserId(loginUser.getUser().getUserId());
         iUserVisitLogService.insertByAddBo(bo);
         return AjaxResult.success(vo);
@@ -185,4 +194,15 @@ public class UserController extends BaseController {
         UserVo userVo = iUserService.queryById(loginUser.getUser().getUserId());
         return AjaxResult.success("成功",userVo.getGzhOpenId());
     }
+
+    @ApiOperation("把其他用户踢下线")
+    @Log(title = "把其他用户踢下线", businessType = BusinessType.UPDATE)
+    @PostMapping("/offline")
+    public AjaxResult<Void> offline(){
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        UserLoginKeyEditBo editBo = new UserLoginKeyEditBo();
+        editBo.setUserId(loginUser.getUser().getUserId());
+        editBo.setUserKey(loginUser.getToken());
+        return toAjax(iUserLoginKeyService.offline(editBo) ? 1 : 0);
+    }
 }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserNoteController.java

@@ -54,9 +54,9 @@ public class UserNoteController extends BaseController {
     @ApiOperation("查询用户笔记记录列表")
     @GetMapping("/listDate")
     public TableDataInfo<UserDateNoteVo> listDate(UserNoteQueryBo bo) {
-        startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
         List<UserDateNoteVo> list = iUserNoteService.listDate(bo);
         return getDataTable(list);
     }

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

@@ -142,6 +142,14 @@ public class UserStudyRecordController extends BaseController {
         return AjaxResult.success(iUserStudyRecordService.menuAllListWithExam(bo));
     }
 
+    @ApiOperation("查询商品所有子目录带试卷结构列表")
+    @GetMapping("/goodsAllListWithExam")
+    public AjaxResult<List<ClassPeriodVo>> goodsAllListWithExam(UserStudyRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iUserStudyRecordService.goodsAllListWithExam(bo));
+    }
+
     @ApiOperation("查询用户每天学习记录列表")
     @GetMapping("/listUserRecord")
     public TableDataInfo<SectionStudyRecordVo> listUserRecord(UserStudyRecordQueryBo bo) {

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

@@ -166,6 +166,7 @@ oldOrder:
     checkOrderBrokerage: http://gdxypx.xy.com/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:5030/common/platform/pay
     refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
+    updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://gdxypx.xy.com

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

@@ -163,6 +163,7 @@ oldOrder:
     checkOrderBrokerage: http://test.jqbao.net/WitSystem/BussinessApi/CommissionRate
     refundPay: http://192.168.1.222:6030/common/platform/pay
     refundPayHandle: http://192.168.1.222:6030/common/platform/pay/handle
+    updateRemark: http://test.jqbao.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://test.jqbao.net

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

@@ -175,6 +175,7 @@ oldOrder:
     checkOrderBrokerage: http://www.xyyxt.net/WitSystem/BussinessApi/CommissionRate
     refundPay: https://cloud.xyyxt.net/common/platform/pay
     refundPayHandle: https://cloud.xyyxt.net/common/platform/pay/handle
+    updateRemark: http://www.xyyxt.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
 
 oldSys:
     host: http://test.jqbao.net

+ 5 - 0
zhongzheng-common/pom.xml

@@ -237,6 +237,11 @@
             <groupId>io.undertow</groupId>
             <artifactId>undertow-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.7</version>
+        </dependency>
 
     </dependencies>
 

+ 49 - 6
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java

@@ -1,21 +1,19 @@
 package com.zhongzheng.common.utils;
 
+import cn.hutool.core.lang.Validator;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
-import cn.hutool.core.lang.Validator;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
-
 /**
  * 时间工具类
  *
@@ -123,6 +121,26 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, "yyyy/MM/dd");
     }
 
+    public static String timestampToDateFormatMonth(Long times){
+        if(Validator.isEmpty(times)){
+            return "";
+        }
+        long t = times.longValue();
+        t = t * 1000;
+        Date date = new Date(t);
+        return DateFormatUtils.format(date, "MM月dd号");
+    }
+
+    public static String timestampToDateFormatMonthTwo(Long times){
+        if(Validator.isEmpty(times)){
+            return "";
+        }
+        long t = times.longValue();
+        t = t * 1000;
+        Date date = new Date(t);
+        return DateFormatUtils.format(date, "MM.dd");
+    }
+
     public static String timestampToDateFormat(Long times,String patternStr){
         if(Validator.isEmpty(times)){
             return "";
@@ -133,6 +151,31 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, patternStr);
     }
 
+    /**
+     * 将秒转为时分秒格式【01:01:01】
+     * @param second 需要转化的秒数
+     * @return
+     */
+    public static String secondConvertHourMinSecond(Long second) {
+        String str = "";
+        if (second == null || second < 0) {
+            return str;
+        }
+
+        // 得到小时
+        long h = second / 3600;
+        str = h > 0 ? ((h < 10 ? ("0" + h) : h) + "时") : "";
+
+        // 得到分钟
+        long m = (second % 3600) / 60;
+        str += m > 0? (m < 10 ? ("0" + m) : m) + "分":"";
+
+        //得到剩余秒
+        long s = second % 60;
+        str += s > 0?(s < 10 ? ("0" + s) : s)+"秒":"";
+        return str;
+    }
+
     public static String timestampToDate(Long times){
         if(Validator.isEmpty(times)){
             return "";

+ 46 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/JavaMailUtils.java

@@ -0,0 +1,46 @@
+package com.zhongzheng.common.utils;
+
+
+import javax.mail.Authenticator;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import java.util.Properties;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月19日 10:11
+ */
+public class JavaMailUtils {
+
+    public static Session createsession(String postAccount,String postPassword,String STMPserver,String post) {
+        // SMTP服务器地址
+        String smtp = STMPserver;
+
+        // 邮箱账号和密码(授权密码)
+        String userName = postAccount;
+        String password = postPassword;
+
+        // SMTP服务器的连接信息
+        Properties props = new Properties();
+        props.put("mail.smtp.host", smtp); // SMTP主机号
+        props.put("mail.smtp.port", post); // 主机端口号
+        props.put("mail.smtp.auth", "true"); // 是否需要认证
+        props.put("mail.smtp.starttls.enable", "true"); // 启用TLS加密
+        props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+
+        // 创建Session
+        // 参数1:SMTP服务器的连接信息
+        // 参数2:用户认证对象(Authenticator接口的匿名实现类)
+        Session session = Session.getInstance(props, new Authenticator() {
+            @Override
+            protected PasswordAuthentication getPasswordAuthentication() {
+                return new PasswordAuthentication(userName, password);
+            }
+        });
+
+        // 开启调试模式
+        session.setDebug(true);
+
+        return session;
+    }
+}

+ 147 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/FileUtils.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.exception.CustomException;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.MediaType;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
@@ -22,8 +23,11 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.MessageDigest;
 import java.util.Comparator;
+import java.util.List;
 import java.util.UUID;
 import java.util.stream.Stream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
 
 /**
  * 文件处理工具类
@@ -32,6 +36,8 @@ import java.util.stream.Stream;
  */
 public class FileUtils extends org.apache.commons.io.FileUtils
 {
+
+    private static final byte[] buf = new byte[1024];
     public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
 
     /**
@@ -297,4 +303,145 @@ public class FileUtils extends org.apache.commons.io.FileUtils
             throw new CustomException(e.getMessage());
         }
     }
+
+    /**
+     * 压缩成ZIP 方法1
+     *
+     * @param zipFileName       压缩文件夹路径
+     * @param sourceFileName    要压缩的文件路径
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static Boolean toZip(String zipFileName, String sourceFileName, boolean KeepDirStructure) {
+        Boolean result = true;
+        long start = System.currentTimeMillis();//开始
+        ZipOutputStream zos = null;
+        try {
+            FileOutputStream fileOutputStream = new FileOutputStream(zipFileName);
+            zos = new ZipOutputStream(fileOutputStream);
+            File sourceFile = new File(sourceFileName);
+            compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();//结束
+            System.out.println("压缩完成,耗时:" + (end - start) + " 毫秒");
+        } catch (Exception e) {
+            result = false;
+            e.printStackTrace();
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) {
+                    e.getStackTrace();
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @Title: compress
+     * @Description: TODO
+     * @param filePaths 需要压缩的文件地址列表(绝对路径)
+     * @param zipFilePath 需要压缩到哪个zip文件(无需创建这样一个zip,只需要指定一个全路径)
+     * @param keepDirStructure 压缩后目录是否保持原目录结构
+     * @throws IOException
+     * @return int   压缩成功的文件个数
+     */
+    public static Boolean compressList(List<String> filePaths, String zipFilePath, Boolean keepDirStructure){
+        byte[] buf = new byte[1024];
+        File zipFile = new File(zipFilePath);
+        int fileCount = 0;//记录压缩了几个文件?
+        try {
+            //zip文件不存在,则创建文件,用于压缩
+            if(!zipFile.exists()){
+                zipFile.createNewFile();
+            }
+            ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));
+            for(int i = 0; i < filePaths.size(); i++){
+                String relativePath = filePaths.get(i);
+                if(StringUtils.isEmpty(relativePath)){
+                    continue;
+                }
+                File sourceFile = new File(relativePath);//绝对路径找到file
+                if(sourceFile == null || !sourceFile.exists()){
+                    continue;
+                }
+
+                FileInputStream fis = new FileInputStream(sourceFile);
+                if(keepDirStructure!=null && keepDirStructure){
+                    //保持目录结构
+                    zos.putNextEntry(new ZipEntry(relativePath));
+                }else{
+                    //直接放到压缩包的根目录
+                    zos.putNextEntry(new ZipEntry(sourceFile.getName()));
+                }
+                //System.out.println("压缩当前文件:"+sourceFile.getName());
+                int len;
+                while((len = fis.read(buf)) > 0){
+                    zos.write(buf, 0, len);
+                }
+                zos.closeEntry();
+                fis.close();
+                fileCount++;
+            }
+            zos.close();
+            //System.out.println("压缩完成");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return fileCount > 0;
+    }
+
+
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceFile       源文件
+     * @param zos              zip输出流
+     * @param name             压缩后的名称
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    public static void compress(File sourceFile, ZipOutputStream zos, String name,
+                                boolean KeepDirStructure) throws Exception {
+
+        if (sourceFile.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zos.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceFile);
+            while ((len = in.read(buf)) != -1) {
+                zos.write(buf, 0, len);
+            }
+            // Complete the entry
+            zos.closeEntry();
+            in.close();
+        } else {
+            File[] listFiles = sourceFile.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (KeepDirStructure) {
+                    // 空文件夹的处理
+                    zos.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+                    zos.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (KeepDirStructure) {
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
+                    } else {
+                        compress(file, zos, file.getName(), KeepDirStructure);
+                    }
+                }
+            }
+        }
+    }
+
 }

+ 49 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -30,7 +30,6 @@ import java.io.*;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -388,6 +387,55 @@ public class ExcelUtil<T>
         }
     }
 
+    public void exportEasyExcelStudy(List<Map<String, Object>> sheetsList,String path)
+    {
+        OutputStream out = null;
+        //     Workbook workbook = null;
+        try
+        {
+            Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.HSSF);
+            File desc = new File(path);
+            if (!desc.getParentFile().exists())
+            {
+                desc.getParentFile().mkdirs();
+            }
+            out = new FileOutputStream(path);
+            workbook.write(out);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
+
     /**
      * 对list数据源将其里面的数据导入到excel表单
      *

+ 11 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.http.HttpStatus;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.domain.model.TopLoginUser;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.framework.web.service.TopTokenService;
 import com.zhongzheng.modules.user.entity.ClientLoginSeller;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -55,10 +56,15 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             if(StringUtils.isNoneEmpty(wxToken)){
                 ClientLoginUser clientLoginUser = wxTokenService.getLoginUser(request);
                 if(clientLoginUser!=null){
-                    wxTokenService.verifyToken(clientLoginUser);
-                    UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(clientLoginUser, null,null);
-                    authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
-                    SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+                    if(Validator.isNull(clientLoginUser.getUser())){
+                        request.getRequestDispatcher("/app/common/token_offline").forward(request, response);
+                        return;
+                    }else{
+                        wxTokenService.verifyToken(clientLoginUser);
+                        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(clientLoginUser, null,null);
+                        authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+                        SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+                    }
                 }
             }else{
                 if(!enabledTenant){
@@ -88,6 +94,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             }
         }catch (Exception e){
             request.getRequestDispatcher("/filter/token_auth_fail").forward(request, response);
+            return;
         }
         chain.doFilter(request, response);
     }

+ 1 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java

@@ -3,7 +3,6 @@ package com.zhongzheng.framework.web.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -36,7 +35,6 @@ import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -471,6 +469,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
         tenant.setBillDay(bo.getBillDay());
         tenant.setAccountInformation(JSONArray.toJSONString(bo.getAccountList()));
         tenant.setInvoiceInformation(JSONObject.toJSONString(bo.getInvoiceBo()));
+        tenant.setEduPhone(bo.getEduPhone());
         return updateById(tenant);
     }
 

+ 137 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserLoginKeyServiceImpl.java

@@ -0,0 +1,137 @@
+package com.zhongzheng.framework.web.service;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
+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.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.Page;
+import com.zhongzheng.common.core.redis.RedisCache;
+import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
+import com.zhongzheng.modules.user.bo.UserLoginKeyEditBo;
+import com.zhongzheng.modules.user.bo.UserLoginKeyQueryBo;
+import com.zhongzheng.modules.user.domain.UserLoginKey;
+import com.zhongzheng.modules.user.mapper.UserLoginKeyMapper;
+import com.zhongzheng.modules.user.service.IUserLoginKeyService;
+import com.zhongzheng.modules.user.vo.UserLoginKeyVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 用户登录KEYService业务层处理
+ *
+ * @author hjl
+ * @date 2023-06-14
+ */
+@Service
+public class UserLoginKeyServiceImpl extends ServiceImpl<UserLoginKeyMapper, UserLoginKey> implements IUserLoginKeyService {
+
+    @Autowired
+    private RedisCache redisCache;
+
+    @Override
+    public UserLoginKeyVo queryById(Long id){
+        UserLoginKey db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, UserLoginKeyVo.class);
+    }
+
+    @Override
+    public Boolean queryByUserKey(String userKey) {
+        UserLoginKey loginKey = getOne(new LambdaQueryWrapper<UserLoginKey>()
+                .eq(UserLoginKey::getUserKey, userKey).last("limit 1"));
+        if(Validator.isNotEmpty(loginKey)&&loginKey.getStatus()==0){
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public List<UserLoginKeyVo> queryList(UserLoginKeyQueryBo bo) {
+        LambdaQueryWrapper<UserLoginKey> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getUserId() != null, UserLoginKey::getUserId, bo.getUserId());
+        lqw.eq(StrUtil.isNotBlank(bo.getUserKey()), UserLoginKey::getUserKey, bo.getUserKey());
+        lqw.eq(bo.getStatus() != null, UserLoginKey::getStatus, bo.getStatus());
+        lqw.eq(StrUtil.isNotBlank(bo.getIp()), UserLoginKey::getIp, bo.getIp());
+        lqw.eq(StrUtil.isNotBlank(bo.getBrowser()), UserLoginKey::getBrowser, bo.getBrowser());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<UserLoginKeyVo> entity2Vo(Collection<UserLoginKey> collection) {
+        List<UserLoginKeyVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, UserLoginKeyVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<UserLoginKey> page = (Page<UserLoginKey>)collection;
+            Page<UserLoginKeyVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(UserLoginKeyAddBo bo) {
+        UserLoginKey add = BeanUtil.toBean(bo, UserLoginKey.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        return this.save(add);
+    }
+
+    @Override
+    public Boolean updateByEditBo(UserLoginKeyEditBo bo) {
+        UserLoginKey update = BeanUtil.toBean(bo, UserLoginKey.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(UserLoginKey entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+
+    @Override
+    public Boolean offline(UserLoginKeyEditBo bo) {
+        if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getUserKey())){
+            throw new CustomException("参数错误");
+        }
+        LambdaUpdateWrapper<UserLoginKey> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+        objectLambdaUpdateWrapper.eq(UserLoginKey::getUserId, bo.getUserId());
+        objectLambdaUpdateWrapper.ne(UserLoginKey::getUserKey, bo.getUserKey());
+        objectLambdaUpdateWrapper.set(UserLoginKey::getStatus, 0);
+        this.update(null, objectLambdaUpdateWrapper);
+        String key = "LockAppAction_"+"bank"+"-"+bo.getUserId();
+        String key2 = "LockAppAction_"+"jxjy"+"-"+bo.getUserId();
+        redisCache.deleteObject(key);
+        redisCache.deleteObject(key2);
+        return true;
+    }
+}

+ 5 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -965,7 +965,7 @@ public class WxLoginService implements IWxLoginService {
         JSONObject obj = new JSONObject();
         obj.put("page", "pages5/mockExam/examApply");
         obj.put("scene",String.format("tid=%s",activityId));
-        obj.put("env_version",enCodeVersion);
+        obj.put("env_version","trial");
         String result = HttpUtils.sendPost(url, obj);
         if (result.contains("errcode")){
             List<String> codes = Arrays.asList("40001", "42001");
@@ -1277,6 +1277,10 @@ public class WxLoginService implements IWxLoginService {
             throw new CustomException("您尚未注册,请前往小程序注册");
         }
         if(Validator.isNotEmpty(loginBody.getGzhOpenid())){
+            DistributionSeller seller2 = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>().ne(DistributionSeller::getSellerId,loginBody.getSellerId()).eq(DistributionSeller::getGzhOpenId,loginBody.getGzhOpenid()));
+            if (Validator.isNotEmpty(seller2)) {
+                throw new CustomException("该微信已绑定其他用户");
+            }
             seller.setGzhOpenId(loginBody.getGzhOpenid());
         }
         if(Validator.isNotEmpty(loginBody.getUnionId())){

+ 23 - 14
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxTokenService.java

@@ -5,18 +5,14 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.http.useragent.UserAgent;
 import cn.hutool.http.useragent.UserAgentUtil;
 import com.zhongzheng.common.constant.Constants;
-import com.zhongzheng.common.core.domain.model.LoginUser;
-import com.zhongzheng.common.exception.CustomException;
-import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
-import com.zhongzheng.common.utils.MessageUtils;
-import com.zhongzheng.framework.manager.AsyncManager;
-import com.zhongzheng.framework.manager.factory.AsyncFactory;
-import com.zhongzheng.modules.user.domain.User;
-import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.AddressUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
+import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
+import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
+import com.zhongzheng.modules.user.service.IUserLoginKeyService;
 import com.zhongzheng.modules.user.service.IUserService;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.Jwts;
@@ -24,9 +20,6 @@ import io.jsonwebtoken.SignatureAlgorithm;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -67,6 +60,9 @@ public class WxTokenService
     @Autowired
     private IUserService iUserService;
 
+    @Autowired
+    private IUserLoginKeyService iUserLoginKeyService;
+
     @Resource
     private AuthenticationManager authenticationManager;
 
@@ -75,8 +71,7 @@ public class WxTokenService
      *
      * @return 用户信息
      */
-    public ClientLoginUser getLoginUser(HttpServletRequest request)
-    {
+    public ClientLoginUser getLoginUser(HttpServletRequest request) {
         //测试用户
         String test_token = request.getHeader("X-Auth-Token");
         if("test".equals(test_token)){
@@ -89,6 +84,10 @@ public class WxTokenService
             Claims claims = parseToken(token);
             // 解析对应的权限以及用户信息
             String uuid = (String) claims.get(Constants.WX_LOGIN_USER_KEY);
+            if(!iUserLoginKeyService.queryByUserKey(uuid)){
+                ClientLoginUser errorUser =  new ClientLoginUser();
+                return errorUser;
+            }
             String userKey = getTokenKey(uuid);
             ClientLoginUser user = redisCache.getCacheObject(userKey);
             return user;
@@ -142,7 +141,17 @@ public class WxTokenService
         refreshToken(loginUser);
         Map<String, Object> claims = new HashMap<>();
         claims.put(Constants.WX_LOGIN_USER_KEY, token);
-        return createToken(claims);
+        String secret = createToken(claims);
+        if(Validator.isNotEmpty(token)){
+            UserLoginKeyAddBo addBo = new UserLoginKeyAddBo();
+            addBo.setUserId(loginUser.getUser().getUserId());
+            addBo.setUserKey(token);
+            addBo.setIp(loginUser.getIpaddr());
+            addBo.setBrowser(loginUser.getBrowser());
+            addBo.setSecret(secret);
+            iUserLoginKeyService.insertByAddBo(addBo);
+        }
+        return secret;
     }
 
     /**

+ 2 - 0
zhongzheng-generator/src/main/java/com/zhongzheng/generator/controller/FilterController.java

@@ -15,4 +15,6 @@ public class FilterController {
     public void loginAuthFail(HttpServletRequest request) {
         throw new AccessDeniedException("用户验证错误");
     }
+
+
 }

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

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -30,7 +31,11 @@ public interface OssService {
 
     void zipPeopleDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream);
 
+    void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo);
+
     void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut, String dir);
 
     void zipWisdomDownload(List<FileBean> list, ZipOutputStream outStream);
+
+    InputStream getStreamByObject(String filePath) throws Exception;
 }

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
 import org.apache.commons.io.IOUtils;
 import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
@@ -337,6 +338,7 @@ public class OssServiceImpl implements OssService {
         }
     }
 
+    @Override
     public InputStream getStreamByObject(String filePath) throws Exception {
             OSSObject ossObject = ossClient.getObject(ALIYUN_OSS_BUCKET_NAME, filePath);
             return ossObject.getObjectContent();
@@ -418,6 +420,25 @@ public class OssServiceImpl implements OssService {
         zipFile(listInfo, outStream,vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
     }
 
+    @Override
+    public void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo) {
+        //学时照片
+        List<String> list = iUserStudyRecordPhotoService.selectGradePhotoWeek(vo.getUserId(),vo.getGradeId(),weekDataVo.getSearchWeekStartTime(),weekDataVo.getSearchWeekEndTime());
+        zipFile(list, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"学习照片");  //
+        //个人资料
+        List<String> listInfo = new ArrayList<>();
+        if(Validator.isNotEmpty(vo.getOneInchPhotosOss())){
+            listInfo.add(vo.getOneInchPhotosOss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg1Oss())){
+            listInfo.add(vo.getIdCardImg1Oss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg2Oss())){
+            listInfo.add(vo.getIdCardImg2Oss());
+        }
+        zipFile(listInfo, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
+    }
+
     @Override
     public void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut,String dir) {
         zipFile(fileList, zipOut,dir);

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

@@ -85,6 +85,8 @@ public interface IQuestionService extends IService<Question> {
 
 	Map<String,Object> importWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId);
 
+	Map<String,Object> importJJWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId);
+
     boolean batchDelQuestion(QuestionBatchDelBo bo);
 
     List<BankGoodsExamVo> getBankGoodsExamList(Long goodsId);

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

@@ -1019,7 +1019,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
 
     private String dealTxt(String txt) {
         if(Validator.isEmpty(txt)){
-            return null;
+            return "";
         }
         txt = txt.trim();
         if (txt.startsWith("\\t")) {
@@ -1887,6 +1887,366 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return result;
     }
 
+    @Override
+    public Map<String, Object> importJJWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId) {
+        Map<String,Object> result = new HashMap<>();
+        List<QuestionAddBo> list = new ArrayList<>();
+        String errorLog = ""; //错误提示
+        String buffer = "";
+        String importNo = ServletUtils.getEncoded("IMPORT");
+        Long sort = 1L;
+        if(Validator.isEmpty(file)){
+            throw new CustomException("请选择文件");
+        }
+        try {
+            Long nowTime = DateUtils.getNowTime();
+            String path = file.getOriginalFilename();
+            if (path.endsWith(".doc")) {
+                throw new CustomException("不支持doc格式");
+            } else if (path.endsWith("docx")) {
+                InputStream is = file.getInputStream();
+                XWPFDocument doc = new XWPFDocument(is);
+                List<XWPFParagraph> paragraphList = doc.getParagraphs();
+                int type = -1;  //题目类型
+                int aType = -1;  //答案题目类型
+                boolean isOption = false; //是否判断题
+                List<QuestionChildAddBo> optionsList = new ArrayList<>(); //题目选项
+                String content = ""; //每行正文
+                String qContent = ""; //题目正文
+                String answerQuestion = null; //答案
+                String analysisContent = ""; //解析文本
+                int index = 1; //题目序列号
+                List<QuestionBusinessAddBo> businessList = new ArrayList<>();
+                QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
+                questionBusinessAddBo.setEducationTypeId(eduId);
+                questionBusinessAddBo.setProjectId(projectId);
+                questionBusinessAddBo.setBusinessId(businessId);
+                questionBusinessAddBo.setSubjectId(subjectId);
+                businessList.add(questionBusinessAddBo);
+
+                List<QuestionAddBo> list1 = new ArrayList<>(); //单选列表
+                List<QuestionAddBo> list2 = new ArrayList<>(); //多选列表
+                List<QuestionAddBo> list3 = new ArrayList<>(); //简答列表
+                List<QuestionAddBo> list4 = new ArrayList<>(); //判断列表
+                Map<String,QuestionAddBo> allQues = new LinkedHashMap<>();
+                Integer nowPart = -1;//0正文 1选项A 2选项B 3选项C 4选项D 5选项E 6选项F
+                String strContent = "";
+                String imgUrl = "";
+                boolean hasQuestion = false;
+                boolean hasRightTag = false;
+                boolean hasError = false;
+                boolean answerStatus = false;
+                int cIndex = 1;
+                int nIndex = 2;
+                List<String> alKeyList  = new ArrayList<>();
+                alKeyList.add("案例(一)");
+                alKeyList.add("案例(二)");
+                alKeyList.add("案例(三)");
+                alKeyList.add("案例(四)");
+                alKeyList.add("案例(五)");
+                alKeyList.add("案例(六)");
+                alKeyList.add("案例(七)");
+                alKeyList.add("案例(八)");
+                alKeyList.add("案例(九)");
+                alKeyList.add("案例(十)");
+                String indexKey = null;
+                for (XWPFParagraph paragraph : paragraphList) {
+                    content = paragraph.getText();
+                    List<XWPFRun> runs = paragraph.getRuns();
+                    imgUrl = null;
+                //    System.out.println(content);
+                    for (XWPFRun run : runs) {
+                        Node node = run.getCTR().getDomNode();
+
+                        // drawing 一个绘画的图片
+                        Node drawingNode = getChildNode(node, "w:drawing");
+                        if (drawingNode == null && content == null) {
+                            imgUrl = null;
+                            continue;
+                        }
+
+                        //上传图片
+                        if (Validator.isNotEmpty(drawingNode)) {
+                            // 绘画图片的宽和高
+                            Node extentNode = getChildNode(drawingNode, "wp:extent");
+                            NamedNodeMap extentAttrs = extentNode.getAttributes();
+                            int wPx = ToolsUtils.emuToPx(Double.valueOf(extentAttrs.getNamedItem("cx").getNodeValue()));
+                            //            System.out.println("宽:".concat(extentAttrs.getNamedItem("cx").getNodeValue()).concat("emu"));
+                            //            System.out.println("高:".concat(extentAttrs.getNamedItem("cy").getNodeValue()).concat("emu"));
+                            int HPx = ToolsUtils.emuToPx(Double.valueOf(extentAttrs.getNamedItem("cy").getNodeValue()));
+
+                            // 绘画图片具体引用
+                            Node blipNode = getChildNode(drawingNode, "a:blip");
+                            NamedNodeMap blipAttrs = blipNode.getAttributes();
+                            String rid = blipAttrs.getNamedItem("r:embed").getNodeValue();
+                            //            System.out.println("word中图片ID:".concat(rid));
+
+                            // 获取图片信息
+                            PackagePart part = doc.getPartById(rid);
+                            String ossPath = null;
+                            try {
+                                ossPath = ossService.uploadInputStream(part.getInputStream(), 8);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            imgUrl =  ossPath + "?x-oss-process=image/resize,w_" + wPx + ",h_" + HPx;
+                            if(type==5){
+                                //正文图片
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                cAddBo.setContent(cAddBo.getContent()+"<br />" +"<p><img src=\"" + ossHost + "/" + imgUrl + "\"></p>");
+                            }
+                        }
+                    }
+                    content = dealTxt(content);
+                //   System.out.println("新行开始"+content);
+                    if (content.startsWith("#")) { //导入结束
+                        break;
+                    }
+                    if(content.indexOf("单项选择题")>0&&!answerStatus){
+                        type = 1;
+                        continue;
+                    }
+                    if(content.indexOf("多项选择题")>0&&!answerStatus){
+                        type = 2;
+                        continue;
+                    }
+                    if(content.indexOf("案例分析题")>0&&!answerStatus){
+                        type = 5;
+                        continue;
+                    }
+                    //单选,多选
+                    if((type==1||type==2)&&!answerStatus){
+                        if(content.startsWith(cIndex+".")||content.startsWith(nIndex+".")){
+                            if(content.startsWith(nIndex+".")){
+                                indexKey =nIndex+".";
+                                //上一道结束
+                                cIndex++;
+                                nIndex++;
+                            }else{
+                                indexKey =cIndex+".";
+                            }
+                            QuestionAddBo addBo = new QuestionAddBo();
+                            qContent = content.replace(indexKey, "");
+                            addBo.setContent(qContent);
+                            addBo.setType(type);
+                            addBo.setOptionsList(new ArrayList<>());
+                            allQues.put(indexKey,addBo);
+                        }
+                        //第一个选项
+                        if(content.startsWith("A.")) {
+                            String[] strArr = content.split("\t");
+                            if(strArr.length==2){ //AB一起
+                                String str1 = strArr[0];
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(1L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(str1.replace("A.", ""));
+                                cAddBo.getOptionsList().add(bo1);
+
+                                String str2 = strArr[1];
+                                QuestionChildAddBo bo2;
+                                bo2 = new QuestionChildAddBo();
+                                bo2.setOptionsId(2L);
+                                bo2.setImgUrl(imgUrl);
+                                bo2.setContent(str2.replace("B.", ""));
+                                QuestionAddBo cAddBo2 = allQues.get(indexKey);
+                                cAddBo2.getOptionsList().add(bo2);
+                            }else{
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(1L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(content.replace("A.", ""));
+                                cAddBo.getOptionsList().add(bo1);
+                            }
+
+                        }
+                        //第二个选项
+                        if (content.startsWith("B.")) {
+                            QuestionChildAddBo bo1;
+                            bo1 = new QuestionChildAddBo();
+                            bo1.setOptionsId(2L);
+                            bo1.setImgUrl(imgUrl);
+                            bo1.setContent(content.replace("B.", ""));
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.getOptionsList().add(bo1);
+                        }
+                        //第三个选项
+                        if (content.startsWith("C.")) {
+                            String[] strArr = content.split("\t");
+                            if(strArr.length==2){
+                                String str1 = strArr[0];
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(3L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(str1.replace("C.", ""));
+                                cAddBo.getOptionsList().add(bo1);
+
+                                String str2 = strArr[1];
+                                QuestionChildAddBo bo2;
+                                bo2 = new QuestionChildAddBo();
+                                bo2.setOptionsId(4L);
+                                bo2.setImgUrl(imgUrl);
+                                bo2.setContent(str2.replace("D.", ""));
+                                QuestionAddBo cAddBo2 = allQues.get(indexKey);
+                                cAddBo2.getOptionsList().add(bo2);
+                            }else{
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(3L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(content.replace("C.", ""));
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                cAddBo.getOptionsList().add(bo1);
+                            }
+
+                        }
+                        //第四个选项
+                        if (content.startsWith("D.")) {
+                            QuestionChildAddBo bo1;
+                            bo1 = new QuestionChildAddBo();
+                            bo1.setOptionsId(4L);
+                            bo1.setImgUrl(imgUrl);
+                            bo1.setContent(content.replace("D.", ""));
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.getOptionsList().add(bo1);
+                        }
+                        //第五个选项
+                        if (content.startsWith("E.")) {
+                            String[] strArr = content.split("\t");
+                            if(strArr.length==2){
+                                String str1 = strArr[0];
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(5L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(str1.replace("E.", ""));
+                                cAddBo.getOptionsList().add(bo1);
+
+                                String str2 = strArr[1];
+                                QuestionChildAddBo bo2;
+                                bo2 = new QuestionChildAddBo();
+                                bo2.setOptionsId(6L);
+                                bo2.setImgUrl(imgUrl);
+                                bo2.setContent(str2.replace("F.", ""));
+                                QuestionAddBo cAddBo2 = allQues.get(indexKey);
+                                cAddBo2.getOptionsList().add(bo2);
+                            }else{
+                                QuestionChildAddBo bo1;
+                                bo1 = new QuestionChildAddBo();
+                                bo1.setOptionsId(5L);
+                                bo1.setImgUrl(imgUrl);
+                                bo1.setContent(content.replace("E.", ""));
+                                QuestionAddBo cAddBo = allQues.get(indexKey);
+                                cAddBo.getOptionsList().add(bo1);
+                            }
+
+                        }
+                        //第六个选项
+                        if (content.startsWith("F.")) {
+                            QuestionChildAddBo bo1;
+                            bo1 = new QuestionChildAddBo();
+                            bo1.setOptionsId(6L);
+                            bo1.setImgUrl(imgUrl);
+                            bo1.setContent(content.replace("F.", ""));
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.getOptionsList().add(bo1);
+                        }
+                    }
+
+                    //问答
+                    if(type==5&&!answerStatus){
+                        if(alKeyList.contains(content)){
+                            indexKey = content;
+                            QuestionAddBo addBo = new QuestionAddBo();
+                            addBo.setType(type);
+                            addBo.setContent("");
+                            allQues.put(indexKey,addBo);
+                        }else{
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.setContent(cAddBo.getContent()+ content+"<br />");
+                        }
+                    }
+                    if(content.startsWith("参考答案及解析")){
+                        answerStatus = true;
+                        type = -1;
+                    }
+                    if(content.indexOf("单项选择题")>0&&answerStatus){
+                        aType = 1;
+                        continue;
+                    }
+                    if(content.indexOf("多项选择题")>0&&answerStatus){
+                        aType = 2;
+                        continue;
+                    }
+                    if(content.indexOf("案例分析题")>0&&answerStatus){
+                        aType = 5;
+                        continue;
+                    }
+                    if(aType>0){
+                        String[] strArr = content.split("\\.");
+                        if(aType==1&&strArr.length==2){
+                            System.out.println(strArr);
+                            indexKey = strArr[0]+".";
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            answerQuestion = dealImportAnswer(strArr[1]);
+                            cAddBo.setAnswerQuestion(answerQuestion);
+                            cAddBo.setAnalysisContent("");
+                        }
+                        else if(aType==1){
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.setAnalysisContent(cAddBo.getAnalysisContent()+content+"<br />");
+                        }
+                        if(aType==2&&strArr.length==2){
+                            indexKey = strArr[0]+".";
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            answerQuestion = dealImportAnswer(strArr[1]);
+                            cAddBo.setAnswerQuestion(answerQuestion);
+                            cAddBo.setAnalysisContent("");
+                        }
+                        else if(aType==2){
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.setAnalysisContent(cAddBo.getAnalysisContent()+content+"<br />");
+                        }
+                        if(aType==5&&alKeyList.contains(content)){
+                            indexKey = content;
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.setAnalysisContent("");
+                        }
+                        else if(aType==5){
+                            QuestionAddBo cAddBo = allQues.get(indexKey);
+                            cAddBo.setAnalysisContent(cAddBo.getAnalysisContent()+content+"<br />");
+                        }
+
+                    }
+
+                }
+                //遍历正文
+                int importSort = 1;
+                for (String key : allQues.keySet()) {
+                    QuestionAddBo addBo = allQues.get(key);
+                    list.add(addBo);
+                    importSort++;
+                }
+
+
+            } else {
+                throw new CustomException("请导入word文件!");
+            }
+        } catch (IOException e) {
+            System.out.println("此文件不是word文件!" + e.getMessage() + e.toString() + e.getLocalizedMessage());
+        }
+        result.put("list",list);
+        result.put("errorLog",errorLog);
+        return result;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean batchDelQuestion(QuestionBatchDelBo bo) {

+ 23 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -494,13 +494,13 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         String keyValue = bo.getKeyValue();
         if (Validator.isNotEmpty(keyValue)) {
             Map<String, String> maps = JSONObject.parseObject(keyValue, Map.class);
-            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post;
+            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post,telphone;
             LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
             objectLambdaUpdateWrapper.eq(User::getUserId, bo.getUserId());
+            UserVo user = iUserService.queryById(bo.getUserId());
             if (maps.containsKey("idcard")) {
                 idcard = JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(idcard)){
-                    UserVo user = iUserService.queryById(bo.getUserId());
                     if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getIdCard())){ //身份证为空是覆盖
                         User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
                                 .eq(User::getIdCard, EncryptHandler.encrypt(idcard)).last("limit 1"));
@@ -508,15 +508,31 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                             throw new CustomException("身份证号码已存在,创建失败");
                         }
                         objectLambdaUpdateWrapper.set(User::getIdCard, idcard);
-                        if (maps.containsKey("name")) {
-                            name = JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue();
-                            if(Validator.isNotEmpty(name)){
-                                objectLambdaUpdateWrapper.set(User::getRealname, name);
-                            }
+                    }
+                }
+            }
+            if (maps.containsKey("telphone")) {
+                telphone = JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(telphone)){
+                    if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getTelphone())){ //手机号码为空是覆盖
+                        User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
+                                .eq(User::getTelphone, EncryptHandler.encrypt(telphone)).last("limit 1"));
+                        if(Validator.isNotEmpty(user2)){
+                            throw new CustomException("手机号码已存在,创建失败");
                         }
+                        objectLambdaUpdateWrapper.set(User::getTelphone, telphone);
                     }
                 }
             }
+            if (maps.containsKey("name")) {
+                name = JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(name)){
+                    if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getRealname())) { //姓名为空是覆盖
+                        objectLambdaUpdateWrapper.set(User::getRealname, name);
+                    }
+
+                }
+            }
             if (maps.containsKey("recent_photos")) {
                 recent_photos = JSONObject.parseObject(String.valueOf(maps.get("recent_photos")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(recent_photos)){

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

@@ -114,4 +114,7 @@ public class CourseQueryBo extends BaseEntity {
 
 	@ApiModelProperty("手机号码")
 	private List<CourseProgressQueryBo> telphoneList;
+
+	@ApiModelProperty("1未开始 2未完成 3已完成")
+	private Integer studyStatus;
 }

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

@@ -54,7 +54,16 @@ public class CourseBusinessServiceImpl extends ServiceImpl<CourseBusinessMapper,
         if (Validator.isEmpty(courseBusinessVos)||courseBusinessVos.size()<1){
             throw new IllegalArgumentException("请输入正确业务ID");
         }
-        return BeanUtil.toBean(courseBusinessVos.get(0), CourseBusinessVo.class);
+        CourseBusinessVo vo = courseBusinessVos.get(0);
+        CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
+        queryBo.setId(id);
+        String fullName = queryFullName(queryBo);
+        if(Validator.isNotEmpty(fullName)){
+            if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")||fullName.equals("考前培训七大员施工现场专业人员")){
+                vo.setGoodsLearningOrder(2);
+            }
+        }
+        return BeanUtil.toBean(vo, CourseBusinessVo.class);
     }
 
     @Override

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

@@ -3,8 +3,6 @@ package com.zhongzheng.modules.course.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 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.CollectionUtils;
@@ -24,13 +22,11 @@ import com.zhongzheng.modules.course.service.ICoursePhotoLogService;
 import com.zhongzheng.modules.course.service.ICourseService;
 import com.zhongzheng.modules.course.vo.CourseUserVo;
 import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.exam.domain.ExamApply;
 import com.zhongzheng.modules.exam.domain.ExamApplyUser;
 import com.zhongzheng.modules.exam.domain.ExamBefore;
 import com.zhongzheng.modules.exam.domain.ExamBeforeApply;
-import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
-import com.zhongzheng.modules.exam.service.IExamApplyUserService;
-import com.zhongzheng.modules.exam.service.IExamBeforeApplyService;
-import com.zhongzheng.modules.exam.service.IExamBeforeService;
+import com.zhongzheng.modules.exam.service.*;
 import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import com.zhongzheng.modules.goods.bo.GoodsBatchDelBo;
 import com.zhongzheng.modules.goods.domain.GoodsCourse;
@@ -110,6 +106,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
     @Autowired
     private IExamApplyGoodsService iExamApplyGoodsService;
 
+    @Autowired
+    private IExamApplyService iExamApplyService;
+
     @Autowired
     private IExamApplyUserService iExamApplyUserService;
 
@@ -450,6 +449,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             if(Validator.isEmpty(classGradeVo)){
                 continue;
             }
+            String fullName = goodsUserVo.getEducationName()+goodsUserVo.getBusinessName()+goodsUserVo.getProjectName();
+            goodsUserVo.setErJianErZao(false);
+            if(Validator.isNotEmpty(fullName)){
+                if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")){
+                    goodsUserVo.setErJianErZao(true);
+                }
+            }
+
             goodsUserVo.setGradeId(classGradeVo.getGradeId());
             goodsUserVo.setLearningStatus(classGradeVo.getLearningStatus());
             goodsUserVo.setLearningTimeStart(classGradeVo.getLearningTimeStart());
@@ -467,6 +474,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             goodsUserVo.setLearnStatus(classGradeVo.getLearnStatus());
             goodsUserVo.setPeriodPlush(classGradeVo.getPeriodPlush());
             goodsUserVo.setOfficialName(classGradeVo.getOfficialName());
+            goodsUserVo.setPeriodWaitTime(classGradeVo.getPeriodWaitTime());
             Long secLong = 0L;
             Long studyLong = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
@@ -487,19 +495,34 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
                 List<ExamApplyGoodsVo> examApplyGoodsVos = new ArrayList<>();
                 List<ExamApplyGoodsVo> examApplyGoodsVos2 = new ArrayList<>();
                 examApplyGoodsVoList.forEach(examApplyGoodsVo -> {
-                    LambdaQueryWrapper<ExamApplyUser> lqw = Wrappers.lambdaQuery();
-                    lqw.eq(ExamApplyUser::getApplyId, examApplyGoodsVo.getApplyId());
-                    List<ExamApplyUser> examApplyUserList = iExamApplyUserService.list(lqw);
-                    if (examApplyUserList != null && examApplyUserList.size() > 0) {
-                        ArrayList<Long> userIds = new ArrayList<>();
-                        examApplyUserList.forEach(examApplyUser -> {
-                            userIds.add(examApplyUser.getUserId());
-                        });
-                        if (userIds.contains(bo.getUserId())) {
-                            examApplyGoodsVos.add(examApplyGoodsVo);
-                        }
-                    }else {
-                        examApplyGoodsVos2.add(examApplyGoodsVo);
+                    ExamApply examApply = iExamApplyService.getById(examApplyGoodsVo.getApplyId());
+                    switch (examApply.getApplyNature()){
+                        case 1: //普通场
+                            LambdaQueryWrapper<ExamApplyUser> lqw = Wrappers.lambdaQuery();
+                            lqw.eq(ExamApplyUser::getApplyId, examApplyGoodsVo.getApplyId());
+                            List<ExamApplyUser> examApplyUserList = iExamApplyUserService.list(lqw);
+                            if (examApplyUserList != null && examApplyUserList.size() > 0) {
+                                ArrayList<Long> userIds = new ArrayList<>();
+                                examApplyUserList.forEach(examApplyUser -> {
+                                    userIds.add(examApplyUser.getUserId());
+                                });
+                                if (userIds.contains(bo.getUserId())) {
+                                    examApplyGoodsVos.add(examApplyGoodsVo);
+                                }
+                            }else {
+                                examApplyGoodsVos2.add(examApplyGoodsVo);
+                            }
+                            break;
+                        case 2://专场
+                            List<ExamApplyUser> applyUsers = iExamApplyUserService
+                                    .list(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, examApply.getApplyId()));
+                            if (CollectionUtils.isNotEmpty(applyUsers) &&
+                                    applyUsers.stream().anyMatch(x -> x.getUserId().equals(bo.getUserId()))){
+                                examApplyGoodsVos.add(examApplyGoodsVo);
+                            }
+                            break;
+                        default:
+                            break;
                     }
                 });
                 examApplyGoodsVos.addAll(examApplyGoodsVos2);

+ 10 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyAddBo.java

@@ -2,10 +2,9 @@ package com.zhongzheng.modules.exam.bo;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
-import java.util.Date;
 
+import java.util.List;
 
 
 /**
@@ -68,6 +67,15 @@ public class ExamApplyAddBo {
     /** 是否需要签署承诺书 1是,0否 */
     @ApiModelProperty("编码")
     private Integer reportStatus;
+    /** 考场性质:1普通场,2专场 */
+    @ApiModelProperty("考场性质:1普通场,2专场 ")
+    private Integer applyNature;
+
+    @ApiModelProperty("专场学员资料地址 ")
+    private String natureUrl;
+
+    @ApiModelProperty("专场预约学员")
+    private List<ExamApplyUserImportBo> applyUsers;
 
 
 }

+ 10 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyEditBo.java

@@ -2,9 +2,9 @@ package com.zhongzheng.modules.exam.bo;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
-import java.util.Date;
+
+import java.util.List;
 
 
 /**
@@ -74,5 +74,13 @@ public class ExamApplyEditBo {
     @ApiModelProperty("编码")
     private Integer reportStatus;
 
+    @ApiModelProperty("考场性质:1普通场,2专场 ")
+    private Integer applyNature;
+
+    @ApiModelProperty("专场学员资料地址 ")
+    private String natureUrl;
+
+    @ApiModelProperty("专场学员")
+    private List<ExamApplyUserImportBo> applyUsers;
 
 }

+ 6 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyQueryBo.java

@@ -1,17 +1,13 @@
 package com.zhongzheng.modules.exam.bo;
 
 import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
 import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.zhongzheng.common.core.domain.BaseEntity;
 
 /**
  * 考试安排分页查询对象 exam_apply
@@ -55,10 +51,10 @@ public class ExamApplyQueryBo extends BaseEntity {
 	private Integer applyStatus;
 	/** 开始日期 */
 	@ApiModelProperty("开始日期")
-	private Long applyStartTime;
+	private String applyStartTime;
 	/** 结束日期 */
 	@ApiModelProperty("结束日期")
-	private Long applyEndTime;
+	private String applyEndTime;
 	/** 1 启用 0未启用 -1删除 2已过期 */
 	@ApiModelProperty("1 启用 0未启用 -1删除 2已过期")
 	private List<Integer> status;
@@ -116,4 +112,7 @@ public class ExamApplyQueryBo extends BaseEntity {
 
 	@ApiModelProperty("关键词")
 	private String searchKey;
+
+	@ApiModelProperty("数据IDs")
+	private List<Long> ids;
 }

+ 118 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyRoomQueryBo.java

@@ -0,0 +1,118 @@
+package com.zhongzheng.modules.exam.bo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 考试安排分页查询对象 exam_apply
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("考试安排分页查询对象")
+public class ExamApplyRoomQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** 考试Id */
+	@ApiModelProperty("考试Id")
+	private Long applyId;
+	/** 考试封面 */
+	@ApiModelProperty("考试封面")
+	private String applyUrl;
+	/** 考试标题 */
+	@ApiModelProperty("考试标题")
+	private String applyName;
+	/** 考试简介 */
+	@ApiModelProperty("考试简介")
+	private String applyIntroduce;
+	/** 1非补考学员 2补考学员 3都有 */
+	@ApiModelProperty("1非补考学员 2补考学员")
+	private Integer applyStatus;
+	/** 开始日期 */
+	@ApiModelProperty("开始日期")
+	private String applyStartTime;
+	/** 结束日期 */
+	@ApiModelProperty("结束日期")
+	private String applyEndTime;
+	/** 1 启用 0未启用 -1删除 2已过期 */
+	@ApiModelProperty("1 启用 0未启用 -1删除 2已过期")
+	private List<Integer> status;
+
+	/** 商品类型 1视频2题库 3补考 4前培  */
+	@ApiModelProperty("商品类型 1视频2题库 3补考 4前培 ")
+	private Integer goodsType;
+
+	/** 教育类型id */
+	@ApiModelProperty("教育类型id")
+	private Long educationTypeId;
+
+	/** 教育类型id */
+	@ApiModelProperty("1考试地点 2考培地点 ")
+	private Long addressStatus;
+
+	/** 业务层次id */
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
+
+	/** 项目ID */
+	@ApiModelProperty("项目ID")
+	private Long projectId;
+
+	/** 用户ID */
+	@ApiModelProperty("用户ID")
+	private Long userId;
+
+	/** 商品Id */
+	@ApiModelProperty("商品Id")
+	private Long goodsId;
+
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
+
+	/** 考试地点 */
+	@Excel(name = "*考试地点")
+	private String applySiteAddress;
+
+	@ApiModelProperty("考试开始时间")
+	private Long startTime;
+
+	@ApiModelProperty("考试 结束时间")
+	private Long endTime;
+
+	@ApiModelProperty("考试地址Id")
+	private Long applySiteId;
+
+	@ApiModelProperty("考试日期")
+	private Long examTime;
+
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
+
+	@ApiModelProperty("关键词")
+	private String searchKey;
+
+	@ApiModelProperty("数据IDs")
+	private List<Long> ids;
+}

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplySendmailBo.java

@@ -0,0 +1,39 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 考试安排添加对象 exam_apply
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+@ApiModel("考试安排添加对象")
+public class ExamApplySendmailBo {
+
+    @ApiModelProperty("ids")
+    private List<Long> ids;
+
+    @ApiModelProperty("邮件标题")
+    private String mailName;
+
+    @ApiModelProperty("发送人地址")
+    private List<String> mailAttrList;
+
+    @ApiModelProperty("附件地址")
+    private String mailUrl;
+
+    @ApiModelProperty("附件标题")
+    private String mailUrlName;
+
+    @ApiModelProperty("内容")
+    private String mailText;
+
+
+}

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyUserImportBo.java

@@ -0,0 +1,26 @@
+package com.zhongzheng.modules.exam.bo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 考试安排添加对象 exam_apply
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+@ApiModel("考试安排添加对象")
+public class ExamApplyUserImportBo implements Serializable {
+
+    @Excel(name = "姓名")
+    private String userName;
+
+    @Excel(name = "身份证号")
+    private String idCard;
+
+}

+ 9 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamApply.java

@@ -1,14 +1,14 @@
 package com.zhongzheng.modules.exam.domain;
 
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
+
 import java.io.Serializable;
-import java.util.Date;
-import java.math.BigDecimal;
-import com.zhongzheng.common.annotation.Excel;
 
 /**
  * 考试安排对象 exam_apply
@@ -47,22 +47,20 @@ private static final long serialVersionUID=1L;
     private Long updateTime;
     /** 1 启用 0未启用 -1删除 2已过期 */
     private Integer status;
-
     /** 商品类型 1视频2题库 3补考 4前培  */
     private Integer goodsType;
-
     /** 教育类型id */
     private Long educationTypeId;
-
     /** 业务层次id */
     private Long businessId;
-
     /** 项目ID */
     private Long projectId;
-
     /** 编码 */
     private String code;
-    
     /** 是否需要签署承诺书 1是,0否 */
     private Integer reportStatus;
+    /** 考场性质:1普通场,2专场 */
+    private Integer applyNature;
+    /** 专场学员资料地址 */
+    private String natureUrl;
 }

+ 7 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamApplySiteTime.java

@@ -1,14 +1,14 @@
 package com.zhongzheng.modules.exam.domain;
 
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
+
 import java.io.Serializable;
-import java.util.Date;
-import java.math.BigDecimal;
-import com.zhongzheng.common.annotation.Excel;
 
 /**
  * 考试安排地点绑定时间对象 exam_apply_site_time
@@ -41,4 +41,6 @@ private static final long serialVersionUID=1L;
     /** 更新时间 */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
+    /** 是否发送邮件:0未发送 1已发送 */
+    private Integer sendmail;
 }

+ 8 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -1,10 +1,12 @@
 package com.zhongzheng.modules.exam.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
+import com.zhongzheng.modules.exam.bo.ExamApplyRoomQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
 import com.zhongzheng.modules.exam.domain.ExamApply;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.exam.vo.*;
+import com.zhongzheng.modules.user.vo.UserStudyRecordExport;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -69,5 +71,9 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
 
     Long sitePeopleNum(ExamApplyQueryBo bo);
 
-    String siteTimeJson(ExamApplyQueryBo bo);
+    List<String> siteTimeJson(ExamApplyQueryBo bo);
+
+    List<ExamApplyPlaceVo> getPlaceList(ExamApplyRoomQueryBo bo);
+
+    List<UserStudyRecordExport> getUserStudyRecord(@Param("orderGoodsId") Long orderGoodsId,@Param("userId") Long userId);
 }

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java

@@ -74,4 +74,14 @@ public interface IExamApplyService extends IService<ExamApply> {
 	 * @return java.util.List<com.zhongzheng.modules.goods.vo.GoodsVo>
 	 */
 	TableDataInfo<GoodsVo> getRecommendGoodsList(ExamRecommendGoodsQueryBo bo);
+
+	boolean saveExamApply(ExamApplyAddBo addBo);
+
+	boolean editExamApply(ExamApplyEditBo editBo);
+
+    List<ExamApplyPlaceVo> getPlaceList(ExamApplyRoomQueryBo bo);
+
+    String getSendmailUrl(List<Long> ids);
+
+    Boolean sendmail(ExamApplySendmailBo bo);
 }

+ 20 - 24
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyGoodsServiceImpl.java

@@ -1,29 +1,25 @@
 package com.zhongzheng.modules.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.course.domain.CourseChapterSection;
-import com.zhongzheng.modules.exam.domain.ExamApply;
-import com.zhongzheng.modules.exam.domain.ExamApplyUser;
-import com.zhongzheng.modules.exam.service.IExamApplyService;
-import com.zhongzheng.modules.exam.service.IExamApplyUserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
+import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.exam.bo.ExamApplyGoodsAddBo;
-import com.zhongzheng.modules.exam.bo.ExamApplyGoodsQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamApplyGoodsEditBo;
+import com.zhongzheng.modules.exam.bo.ExamApplyGoodsQueryBo;
+import com.zhongzheng.modules.exam.domain.ExamApply;
 import com.zhongzheng.modules.exam.domain.ExamApplyGoods;
 import com.zhongzheng.modules.exam.mapper.ExamApplyGoodsMapper;
-import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
+import com.zhongzheng.modules.exam.service.IExamApplyService;
+import com.zhongzheng.modules.exam.service.IExamApplyUserService;
+import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -141,17 +137,17 @@ public class ExamApplyGoodsServiceImpl extends ServiceImpl<ExamApplyGoodsMapper,
             coll.add(add);
         }
         saveBatch(coll);
-        iExamApplyUserService.remove(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, bo.getApplyId()));
-        Collection<ExamApplyUser> coll2 = new HashSet<>();
-        for(Long userId : bo.getUserId()){
-            ExamApplyUser add = new ExamApplyUser();
-            add.setApplyId(bo.getApplyId());
-            add.setUserId(userId);
-            add.setCreateTime(DateUtils.getNowTime());
-            add.setUpdateTime(DateUtils.getNowTime());
-            coll2.add(add);
-        }
-        iExamApplyUserService.saveBatch(coll2);
+//        iExamApplyUserService.remove(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, bo.getApplyId()));
+//        Collection<ExamApplyUser> coll2 = new HashSet<>();
+//        for(Long userId : bo.getUserId()){
+//            ExamApplyUser add = new ExamApplyUser();
+//            add.setApplyId(bo.getApplyId());
+//            add.setUserId(userId);
+//            add.setCreateTime(DateUtils.getNowTime());
+//            add.setUpdateTime(DateUtils.getNowTime());
+//            coll2.add(add);
+//        }
+//        iExamApplyUserService.saveBatch(coll2);
         return true;
     }
 

+ 573 - 66
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -2,45 +2,74 @@ package com.zhongzheng.modules.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.Page;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.JavaMailUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.file.FileUtils;
+import com.zhongzheng.common.utils.poi.EasyPoiUtil;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.modules.activity.domain.ActivityRecommend;
-import com.zhongzheng.modules.activity.domain.ActivityRecommendGoods;
 import com.zhongzheng.modules.activity.service.IActivityRecommendGoodsService;
 import com.zhongzheng.modules.activity.service.IActivityRecommendService;
-import com.zhongzheng.modules.activity.vo.ActivityRecommendGoodsVo;
+import com.zhongzheng.modules.alioss.bo.OssRequest;
+import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.bank.domain.Exam;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.service.IExamService;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
-import com.zhongzheng.modules.course.domain.Course;
 import com.zhongzheng.modules.exam.bo.*;
-import com.zhongzheng.modules.exam.domain.ExamBefore;
+import com.zhongzheng.modules.exam.domain.ExamApply;
+import com.zhongzheng.modules.exam.domain.ExamApplySite;
+import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
+import com.zhongzheng.modules.exam.domain.ExamApplyUser;
+import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
+import com.zhongzheng.modules.exam.service.IExamApplyService;
+import com.zhongzheng.modules.exam.service.IExamApplySiteService;
+import com.zhongzheng.modules.exam.service.IExamApplySiteTimeService;
+import com.zhongzheng.modules.exam.service.IExamApplyUserService;
 import com.zhongzheng.modules.exam.vo.*;
-import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
-import com.zhongzheng.modules.user.vo.CalendarStudyVo;
-import io.swagger.annotations.ApiModelProperty;
+import com.zhongzheng.modules.system.domain.SysConfig;
+import com.zhongzheng.modules.system.domain.SysTenant;
+import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
+import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.domain.UserSubscribe;
+import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.service.IUserSubscribeService;
+import com.zhongzheng.modules.user.vo.UserStudyRecordExport;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.entity.ContentType;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.github.pagehelper.Page;
-import com.zhongzheng.modules.exam.domain.ExamApply;
-import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
-import com.zhongzheng.modules.exam.service.IExamApplyService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.activation.DataHandler;
+import javax.mail.*;
+import javax.mail.internet.*;
+import javax.mail.util.ByteArrayDataSource;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 考试安排Service业务层处理
@@ -61,17 +90,33 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     private IActivityRecommendGoodsService iActivityRecommendGoodsService;
     @Autowired
     private IGoodsService iGoodsService;
+    @Autowired
+    private IUserService iUserService;
+    @Autowired
+    private ISysTenantService sysTenantService;
+    @Autowired
+    private IExamApplyUserService iExamApplyUserService;
+    @Autowired
+    private IExamApplySiteService iExamApplySiteService;
+    @Autowired
+    private IUserSubscribeService iUserSubscribeService;
+    @Autowired
+    private IExamApplySiteTimeService iExamApplySiteTimeService;
+    @Autowired
+    private OssService ossService;
+    @Autowired
+    private ISysConfigService iSysConfigService;
 
     @Override
-    public ExamApplyVo queryById(Long applyId){
+    public ExamApplyVo queryById(Long applyId) {
         ExamApplyVo examApplyVo = baseMapper.selectByApply(applyId);
         List<ExamNumberGoodsVo> examNumberGoodsVos = baseMapper.examNumberGoodsVos(applyId);
-        List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(applyId,1L);
+        List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(applyId, 1L);
         for (ExamApplySiteVo examApplySiteVo : examApplySite) {
             List<ExamApplySiteTimeVo> examApplySiteTime = baseMapper.addressTimeExam(examApplySiteVo.getId());
             examApplySiteVo.setExamApplySiteTime(examApplySiteTime);
         }
-        List<ExamApplySiteVo> examApplySiteTrain = baseMapper.addressExam(applyId,2L);
+        List<ExamApplySiteVo> examApplySiteTrain = baseMapper.addressExam(applyId, 2L);
         for (ExamApplySiteVo examApplySiteVo : examApplySiteTrain) {
             List<ExamApplySiteTimeVo> examApplySiteTime = baseMapper.addressTimeExam(examApplySiteVo.getId());
             examApplySiteVo.setExamApplySiteTime(examApplySiteTime);
@@ -79,6 +124,17 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         examApplyVo.setExamNumberGoods(examNumberGoodsVos);
         examApplyVo.setExamApplySite(examApplySite);
         examApplyVo.setExamApplySiteTrain(examApplySiteTrain);
+        List<ExamApplyUser> applyUsers = iExamApplyUserService.list(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, applyId));
+        if (CollectionUtils.isNotEmpty(applyUsers)) {
+            List<ExamApplyUserImportBo> collect = applyUsers.stream().map(item -> {
+                User user = iUserService.getById(item.getUserId());
+                ExamApplyUserImportBo bo = new ExamApplyUserImportBo();
+                bo.setUserName(user.getRealname());
+                bo.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
+                return bo;
+            }).collect(Collectors.toList());
+            examApplyVo.setApplyUsers(collect);
+        }
         return examApplyVo;
     }
 
@@ -90,7 +146,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
             Calendar calendar = Calendar.getInstance();
             calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
             calendar.setTimeInMillis(System.currentTimeMillis());
-            if ((examApplyVo.getApplyEndTime()) < calendar.getTimeInMillis()/1000){
+            if ((examApplyVo.getApplyEndTime()) < calendar.getTimeInMillis() / 1000) {
                 ExamApply update = new ExamApply();
                 update.setApplyId(examApplyVo.getApplyId());
                 update.setStatus(2);
@@ -103,19 +159,19 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     }
 
     /**
-    * 实体类转化成视图对象
-    *
-    * @param collection 实体类集合
-    * @return
-    */
+     * 实体类转化成视图对象
+     *
+     * @param collection 实体类集合
+     * @return
+     */
     private List<ExamApplyVo> entity2Vo(Collection<ExamApply> collection) {
         List<ExamApplyVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, ExamApplyVo.class))
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
-            Page<ExamApply> page = (Page<ExamApply>)collection;
+            Page<ExamApply> page = (Page<ExamApply>) collection;
             Page<ExamApplyVo> pageVo = new Page<>();
-            BeanUtil.copyProperties(page,pageVo);
+            BeanUtil.copyProperties(page, pageVo);
             pageVo.addAll(voList);
             voList = pageVo;
         }
@@ -129,21 +185,72 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         add.setCode(ServletUtils.getEncoded("KSAP"));
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        return this.save(add);
+        this.save(add);
+
+        if (StringUtils.isNotBlank(bo.getNatureUrl())) {
+            try {
+                InputStream inputStream = ossService.getStreamByObject(bo.getNatureUrl());
+                //学员资料解析
+                List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(createMultipartFile(inputStream), 0, 1, ExamApplyUserImportBo.class);
+                //专场预约学员
+                List<ExamApplyUser> applyUserList = applyUsers.stream().filter(x -> {
+                    int count = iUserService.count(new LambdaQueryWrapper<User>()
+                            .eq(User::getIdCard, EncryptHandler.encrypt(x.getIdCard())));
+                    return count > 0;
+                }).map(item -> {
+                    User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                            .eq(User::getIdCard, EncryptHandler.encrypt(item.getIdCard())));
+                    ExamApplyUser applyUser = new ExamApplyUser();
+                    applyUser.setApplyId(add.getApplyId());
+                    applyUser.setUserId(user.getUserId());
+                    applyUser.setCreateTime(DateUtils.getNowTime());
+                    applyUser.setUpdateTime(DateUtils.getNowTime());
+                    return applyUser;
+                }).collect(Collectors.toList());
+
+                iExamApplyUserService.saveBatch(applyUserList);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return true;
+    }
+
+
+    private MultipartFile createMultipartFile(InputStream inputStream) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int len;
+        byte[] dataBytes;
+        while ((len = inputStream.read(buffer)) != -1) {
+            baos.write(buffer, 0, len);
+        }
+        baos.flush();
+        byte[] bytes = baos.toByteArray();
+
+        MultipartFile multipartFile = new MockMultipartFile(
+                "file",
+                "filename",
+                ContentType.APPLICATION_OCTET_STREAM.toString(),
+                new ByteArrayInputStream(bytes)
+        );
+
+        return multipartFile;
+
     }
 
     @Override
     public Boolean updateByEditBo(ExamApplyEditBo bo) {
         ExamApply update = BeanUtil.toBean(bo, ExamApply.class);
-        if (bo.getStatus() == 1){
+        if (bo.getStatus() == 1) {
             //判断是否有设置商品
             Long contGoodsId = baseMapper.countGoods(bo.getApplyId());
-            if (contGoodsId < 1){
+            if (contGoodsId < 1) {
                 throw new CustomException("请先设置适用商品");
             }
             //判断是否有设置考试地点和时间
-            List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(),1L);
-            if (CollectionUtils.isEmpty(examApplySite)){
+            List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(), 1L);
+            if (CollectionUtils.isEmpty(examApplySite)) {
                 throw new CustomException("请先设置考试地点和时间");
             }
             //考试计划内的商品是否被其他计划使用
@@ -161,16 +268,48 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                 throw new RuntimeException(goodsName+"已被其他进行中的考试计划使用,请修改,再启用");
             }*/
         }
-        if(bo.getStatus()==-1){
+        if (bo.getStatus() == -1) {
             ExamApplyQueryBo queryBo = new ExamApplyQueryBo();
             queryBo.setApplyId(bo.getApplyId());
-            if(countApplySubscribe(queryBo)>0){
+            if (countApplySubscribe(queryBo) > 0) {
                 throw new RuntimeException("该考试计划存在预约数据,无法删除");
             }
         }
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
-        return this.updateById(update);
+        this.updateById(update);
+
+        if (ObjectUtils.isNotNull(update.getApplyNature()) && update.getApplyNature() == 2) {
+            //专场预约学员
+            iExamApplyUserService.remove(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, update.getApplyId()));
+            if (StringUtils.isNotBlank(bo.getNatureUrl())) {
+                try {
+                    InputStream inputStream = ossService.getStreamByObject(bo.getNatureUrl());
+                    //学员资料解析
+                    List<ExamApplyUserImportBo> applyUsers = EasyPoiUtil.importExcel(createMultipartFile(inputStream), 0, 1, ExamApplyUserImportBo.class);
+                    //专场预约学员
+                    List<ExamApplyUser> applyUserList = applyUsers.stream().filter(x -> {
+                        int count = iUserService.count(new LambdaQueryWrapper<User>()
+                                .eq(User::getIdCard, EncryptHandler.encrypt(x.getIdCard())));
+                        return count > 0;
+                    }).map(item -> {
+                        User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                                .eq(User::getIdCard, EncryptHandler.encrypt(item.getIdCard())));
+                        ExamApplyUser applyUser = new ExamApplyUser();
+                        applyUser.setApplyId(update.getApplyId());
+                        applyUser.setUserId(user.getUserId());
+                        applyUser.setCreateTime(DateUtils.getNowTime());
+                        applyUser.setUpdateTime(DateUtils.getNowTime());
+                        return applyUser;
+                    }).collect(Collectors.toList());
+
+                    iExamApplyUserService.saveBatch(applyUserList);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return true;
     }
 
     /**
@@ -178,16 +317,16 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
      *
      * @param entity 实体类数据
      */
-    private void validEntityBeforeSave(ExamApply entity){
+    private void validEntityBeforeSave(ExamApply entity) {
         //TODO 做一些数据校验,如唯一约束
-        if(checkNameUnique(entity)){
+        if (checkNameUnique(entity)) {
             throw new CustomException("名称重复");
         }
     }
 
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return this.removeByIds(ids);
@@ -201,10 +340,26 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
 
     @Override
     public List<ExamApplySiteVo> getSiteInfo(ExamApplyQueryBo bo) {
-        List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(),bo.getAddressStatus());
+        List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(), bo.getAddressStatus());
         for (ExamApplySiteVo examApplySiteVo : examApplySite) {
             List<ExamApplySiteTimeVo> examApplySiteTime = baseMapper.addressTimeExam(examApplySiteVo.getId());
-            examApplySiteVo.setExamApplySiteTime(examApplySiteTime);
+            Map<Long, List<ExamApplySiteTimeVo>> map = examApplySiteTime.stream().collect(Collectors.groupingBy(ExamApplySiteTimeVo::getApplySiteId));
+            List<ExamApplySiteTimeVo> result = new ArrayList<>();
+            map.forEach((k,v) -> {
+                ExamApplySiteTimeVo vo = new ExamApplySiteTimeVo();
+                vo.setId(v.get(0).getId());
+                vo.setExamTime(v.get(0).getExamTime());
+                vo.setApplySiteId(v.get(0).getApplySiteId());
+                List<String> collect = v.stream().map(x -> x.getSiteTime()).collect(Collectors.toList());
+                List<ExamApplySiteTimeTwoVo> timeTwoVoList = new ArrayList<>();
+                collect.forEach(item -> {
+                    List<ExamApplySiteTimeTwoVo> timeTwoVos = JSONArray.parseArray(item, ExamApplySiteTimeTwoVo.class);
+                    timeTwoVoList.addAll(timeTwoVos);
+                });
+                vo.setSiteTime(JSONArray.toJSONString(timeTwoVoList));
+                result.add(vo);
+            });
+            examApplySiteVo.setExamApplySiteTime(result);
         }
         return examApplySite;
     }
@@ -218,7 +373,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         //初始化需要得到的数组
         Long[] array = new Long[examNumberGoodsVos.size()];
         //使用for循环得到数组
-        for(int i = 0; i < examNumberGoodsVos.size();i++){
+        for (int i = 0; i < examNumberGoodsVos.size(); i++) {
             array[i] = examNumberGoodsVos.get(i).getGoodsId();
         }
         examApplyVo.setExamNumberGoods(examNumberGoodsVos);
@@ -230,22 +385,22 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     public ExamUserApplyVo subscribe(ExamApplyQueryBo bo) {
         //查询学时通过情况
         Integer countGradePeriod = baseMapper.countGradePeriod(bo);
-        if (countGradePeriod < 1){
+        if (countGradePeriod < 1) {
             throw new CustomException("学时审核未通过,不可以报名参加考试");
         }
         //查询考试通过情况
         Integer countSubscribe = baseMapper.countSubscribe(bo);
-        if (countSubscribe > 0){
+        if (countSubscribe > 0) {
             throw new CustomException("考试已通过,不需要重考");
         }
         //查询是否已预约考试
         Integer countHaveSubscribe = baseMapper.countHaveSubscribe(bo);
-        if (countHaveSubscribe > 0){
+        if (countHaveSubscribe > 0) {
             throw new CustomException("您所报考的专业,已经预约成功,您可在“我的-我的考试预约”中查询详情");
         }
         //查询是否有考试计划
         ExamUserApplyVo examUserApplyVo = baseMapper.selectExamUserApplyVo(bo);
-        if (examUserApplyVo == null){
+        if (examUserApplyVo == null) {
             throw new CustomException("商品无考试计划,无需预约考试");
         }
         return examUserApplyVo;
@@ -255,20 +410,20 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     public Long subscribeNext(ExamApplyQueryBo bo) {
         //查看是否有无考试记录
         Integer countHaveSubscribeNext = baseMapper.countHaveSubscribeNext(bo);
-        if (bo.getApplyStatus().equals(2) && countHaveSubscribeNext < 1){
+        if (bo.getApplyStatus().equals(2) && countHaveSubscribeNext < 1) {
             throw new CustomException("系统检索到您不符合【补考学员】的报名条件,请重新选择!");
         }
-        if (bo.getApplyStatus().equals(1) && countHaveSubscribeNext > 0){
+        if (bo.getApplyStatus().equals(1) && countHaveSubscribeNext > 0) {
             throw new CustomException("系统检索到您不符合【非补考学员】的报名条件,请重新选择!");
         }
         //查询剩余考试次数
         Integer residueSubscribeNext = baseMapper.residueSubscribeNext(bo);
-        if (residueSubscribeNext == null || residueSubscribeNext < 1){
+        if (residueSubscribeNext == null || residueSubscribeNext < 1) {
             return 3L;
         }
         //查询有无考培
         Integer beforeSubscribeNext = baseMapper.beforeSubscribeNext(bo);
-        if (beforeSubscribeNext > 0){
+        if (beforeSubscribeNext > 0) {
             return 1L;
         }
         return 2L;
@@ -277,7 +432,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     @Override
     public List<ExamUserApplySiteVo> subscribeApplySite(ExamApplyQueryBo bo) {
         //查看地址
-        List<ExamUserApplySiteVo> examUserApplySiteVos= baseMapper.subscribeApplySite(bo);
+        List<ExamUserApplySiteVo> examUserApplySiteVos = baseMapper.subscribeApplySite(bo);
         //获得详细地址查看是否满员
         for (ExamUserApplySiteVo examUserApplySiteVo : examUserApplySiteVos) {
             List<ExamUserApplySiteTimeVo> examApplySiteTime = baseMapper.subscribeApplySiteTime(examUserApplySiteVo.getId());
@@ -285,8 +440,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                 List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONObject.parseArray(examUserApplySiteTimeVo.getSiteTime(), ExamApplySiteTimeTwoVo.class);
                 for (ExamApplySiteTimeTwoVo examApplySiteTimeTwoVo : examApplySiteTimeTwoVos) {
                     examApplySiteTimeTwoVo.setRegistration(baseMapper.registration(examUserApplySiteVo.getApplyId(), examUserApplySiteTimeVo.getExamTime()
-                            ,examUserApplySiteVo.getSiteAddress(),examApplySiteTimeTwoVo.getStartTime(),examApplySiteTimeTwoVo.getEndTime()));
-                    examApplySiteTimeTwoVo.setStatus(baseMapper.userStatus(bo.getUserId(),examUserApplySiteTimeVo.getExamTime(),examApplySiteTimeTwoVo.getStartTime(),examApplySiteTimeTwoVo.getEndTime()));
+                            , examUserApplySiteVo.getSiteAddress(), examApplySiteTimeTwoVo.getStartTime(), examApplySiteTimeTwoVo.getEndTime()));
+                    examApplySiteTimeTwoVo.setStatus(baseMapper.userStatus(bo.getUserId(), examUserApplySiteTimeVo.getExamTime(), examApplySiteTimeTwoVo.getStartTime(), examApplySiteTimeTwoVo.getEndTime()));
                 }
                 examUserApplySiteTimeVo.setExamApplySiteTimeTwoVo(examApplySiteTimeTwoVos);
             }
@@ -298,7 +453,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     @Override
     public List<ExamUserApplySiteVo> subscribeApplySiteTrain(ExamApplyQueryBo bo) {
         //查看地址
-        List<ExamUserApplySiteVo> examUserApplySiteVos= baseMapper.subscribeApplySiteTrain(bo);
+        List<ExamUserApplySiteVo> examUserApplySiteVos = baseMapper.subscribeApplySiteTrain(bo);
         //获得详细地址查看是否满员
         for (ExamUserApplySiteVo examUserApplySiteVo : examUserApplySiteVos) {
             List<ExamUserApplySiteTimeVo> examApplySiteTime = baseMapper.subscribeApplySiteTime(examUserApplySiteVo.getId());
@@ -306,8 +461,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                 List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONObject.parseArray(examUserApplySiteTimeVo.getSiteTime(), ExamApplySiteTimeTwoVo.class);
                 for (ExamApplySiteTimeTwoVo examApplySiteTimeTwoVo : examApplySiteTimeTwoVos) {
                     examApplySiteTimeTwoVo.setRegistration(baseMapper.registrationTrain(examUserApplySiteVo.getApplyId(), examUserApplySiteTimeVo.getExamTime()
-                            ,examUserApplySiteVo.getSiteAddress(),examApplySiteTimeTwoVo.getStartTime(),examApplySiteTimeTwoVo.getEndTime()));
-                    examApplySiteTimeTwoVo.setStatus(baseMapper.userStatusTrain(bo.getUserId(),examUserApplySiteTimeVo.getExamTime(),examApplySiteTimeTwoVo.getStartTime(),examApplySiteTimeTwoVo.getEndTime()));
+                            , examUserApplySiteVo.getSiteAddress(), examApplySiteTimeTwoVo.getStartTime(), examApplySiteTimeTwoVo.getEndTime()));
+                    examApplySiteTimeTwoVo.setStatus(baseMapper.userStatusTrain(bo.getUserId(), examUserApplySiteTimeVo.getExamTime(), examApplySiteTimeTwoVo.getStartTime(), examApplySiteTimeTwoVo.getEndTime()));
                 }
                 examUserApplySiteTimeVo.setExamApplySiteTimeTwoVo(examApplySiteTimeTwoVos);
             }
@@ -325,7 +480,7 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     public TableDataInfo<GoodsVo> getRecommendGoodsList(ExamRecommendGoodsQueryBo bo) {
         TableDataInfo tableDataInfo = new TableDataInfo();
         Exam exam = iExamService.getById(bo.getExamId());
-        if (ObjectUtils.isNull(exam)){
+        if (ObjectUtils.isNull(exam)) {
 //            throw new CustomException("获取试卷信息失败");
             return new TableDataInfo<>();
         }
@@ -333,23 +488,23 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         QuestionBusiness business = iQuestionBusinessService.getOne(new LambdaQueryWrapper<QuestionBusiness>()
                 .eq(QuestionBusiness::getMajorId, bo.getExamId())
                 .eq(QuestionBusiness::getType, 2));
-        if (ObjectUtils.isNull(business)){
+        if (ObjectUtils.isNull(business)) {
             throw new CustomException("获取试卷业务层次信息失败");
         }
-        Integer platform = ObjectUtils.isNull(bo.getPlatform())?1:bo.getPlatform();
+        Integer platform = ObjectUtils.isNull(bo.getPlatform()) ? 1 : bo.getPlatform();
         //获取推荐位信息
         List<ActivityRecommend> list = iActivityRecommendService.list(new LambdaQueryWrapper<ActivityRecommend>()
                 .eq(ActivityRecommend::getEducationTypeId, business.getEducationTypeId())
                 .eq(ActivityRecommend::getBusinessId, business.getBusinessId())
-                .eq(ActivityRecommend::getPlatform,platform)
+                .eq(ActivityRecommend::getPlatform, platform)
                 .eq(ActivityRecommend::getType, 1)
-                .eq(ActivityRecommend::getStatus,1));
-        if (CollectionUtils.isEmpty(list)){
+                .eq(ActivityRecommend::getStatus, 1));
+        if (CollectionUtils.isEmpty(list)) {
             return tableDataInfo;
         }
         ActivityRecommend activityRecommend = list.stream().findFirst().get();
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<GoodsVo> page =
-                iActivityRecommendGoodsService.getGoodsListByPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(bo.getPageNum(), bo.getPageSize()),activityRecommend.getRecommendId());
+                iActivityRecommendGoodsService.getGoodsListByPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(bo.getPageNum(), bo.getPageSize()), activityRecommend.getRecommendId());
 
 //        if (CollectionUtils.isEmpty(page.getRecords())){
 //            return tableDataInfo;
@@ -361,15 +516,367 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         return tableDataInfo;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveExamApply(ExamApplyAddBo bo) {
+        ExamApply add = BeanUtil.toBean(bo, ExamApply.class);
+        validEntityBeforeSave(add);
+        add.setCode(ServletUtils.getEncoded("KSAP"));
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        this.save(add);
+        if (CollectionUtils.isNotEmpty(bo.getApplyUsers())) {
+            //专场预约学员
+            List<ExamApplyUser> applyUserList = bo.getApplyUsers().stream().filter(x -> {
+                int count = iUserService.count(new LambdaQueryWrapper<User>()
+                        .eq(User::getIdCard, EncryptHandler.encrypt(x.getIdCard())));
+                return count > 0;
+            }).map(item -> {
+                User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                        .eq(User::getIdCard, EncryptHandler.encrypt(item.getIdCard())));
+                ExamApplyUser applyUser = new ExamApplyUser();
+                applyUser.setApplyId(add.getApplyId());
+                applyUser.setUserId(user.getUserId());
+                applyUser.setCreateTime(DateUtils.getNowTime());
+                applyUser.setUpdateTime(DateUtils.getNowTime());
+                return applyUser;
+            }).collect(Collectors.toList());
+
+            iExamApplyUserService.saveBatch(applyUserList);
+        }
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean editExamApply(ExamApplyEditBo bo) {
+        ExamApply update = BeanUtil.toBean(bo, ExamApply.class);
+        if (bo.getStatus() == 1) {
+            //判断是否有设置商品
+            Long contGoodsId = baseMapper.countGoods(bo.getApplyId());
+            if (contGoodsId < 1) {
+                throw new CustomException("请先设置适用商品");
+            }
+            //判断是否有设置考试地点和时间
+            List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(), 1L);
+            if (CollectionUtils.isEmpty(examApplySite)) {
+                throw new CustomException("请先设置考试地点和时间");
+            }
+        }
+        if (bo.getStatus() == -1) {
+            ExamApplyQueryBo queryBo = new ExamApplyQueryBo();
+            queryBo.setApplyId(bo.getApplyId());
+            if (countApplySubscribe(queryBo) > 0) {
+                throw new RuntimeException("该考试计划存在预约数据,无法删除");
+            }
+        }
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        this.updateById(update);
+
+        if (update.getApplyNature() == 2) {
+            //专场预约学员
+            iExamApplyUserService.remove(new LambdaQueryWrapper<ExamApplyUser>().eq(ExamApplyUser::getApplyId, update.getApplyId()));
+            if (CollectionUtils.isNotEmpty(bo.getApplyUsers())) {
+                //专场预约学员
+                List<ExamApplyUser> applyUserList = bo.getApplyUsers().stream().filter(x -> {
+                    int count = iUserService.count(new LambdaQueryWrapper<User>()
+                            .eq(User::getIdCard, EncryptHandler.encrypt(x.getIdCard())));
+                    return count > 0;
+                }).map(item -> {
+                    User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                            .eq(User::getIdCard, EncryptHandler.encrypt(item.getIdCard())));
+                    ExamApplyUser applyUser = new ExamApplyUser();
+                    applyUser.setApplyId(update.getApplyId());
+                    applyUser.setUserId(user.getUserId());
+                    applyUser.setCreateTime(DateUtils.getNowTime());
+                    applyUser.setUpdateTime(DateUtils.getNowTime());
+                    return applyUser;
+                }).collect(Collectors.toList());
+                iExamApplyUserService.saveBatch(applyUserList);
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public List<ExamApplyPlaceVo> getPlaceList(ExamApplyRoomQueryBo bo) {
+        List<ExamApplyPlaceVo> voList = baseMapper.getPlaceList(bo);
+        if (CollectionUtils.isEmpty(voList)) {
+            return new ArrayList<>();
+        }
+        voList.forEach(item -> {
+            List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONArray.parseArray(item.getSiteTime(), ExamApplySiteTimeTwoVo.class);
+            if (ObjectUtils.isNotNull(examApplySiteTimeTwoVos)) {
+                ExamApplySiteTimeTwoVo timeTwoVo = examApplySiteTimeTwoVos.stream().findFirst().orElse(null);
+                ExamApplySite applySite = iExamApplySiteService.getById(item.getApplySiteId());
+                //预约人数
+                int count = iUserSubscribeService.count(new LambdaQueryWrapper<UserSubscribe>()
+                        .eq(UserSubscribe::getApplyId, item.getApplyId())
+                        .eq(ObjectUtils.isNotNull(applySite),UserSubscribe::getSiteId, applySite.getSiteId())
+                        .eq(UserSubscribe::getSubscribeStatus, 1)
+                        .eq(UserSubscribe::getApplySiteStartTime, timeTwoVo.getStartTime())
+                        .eq(UserSubscribe::getApplySiteEndTime, timeTwoVo.getEndTime()));
+                item.setPeople(count);
+                item.setMayNum(timeTwoVo.getNum());
+                if (ObjectUtils.isNotNull(item.getApplyDate())) {
+                    String time = DateUtils.timestampToDateFormatMonth(item.getApplyDate());
+                    String format = String.format("%s(%s-%s)", time, timeTwoVo.getStartTime(), timeTwoVo.getEndTime());
+                    item.setApplyTime(format);
+                }
+            }
+        });
+        return voList;
+    }
+
+    @Override
+    public String getSendmailUrl(List<Long> ids) {
+        List<ExamApplySiteTime> siteTimes = iExamApplySiteTimeService.listByIds(ids);
+        if (CollectionUtils.isEmpty(siteTimes)) {
+            return null;
+        }
+        Map<Long, List<ExamApplySiteTime>> map = siteTimes.stream().collect(Collectors.groupingBy(ExamApplySiteTime::getExamTime));
+        String zhiyuan = System.getProperty("user.dir");
+        String path = zhiyuan + "/zhongzheng-admin/src/main/resources/学习记录";
+        File file = new File(path);
+        if (file.exists()) {
+            file.mkdirs();
+        }
+        map.forEach((k, v) -> {
+            if (CollectionUtils.isEmpty(v)) {
+                return;
+            }
+            //月份文件夹
+            String month = DateUtils.timestampToDateFormatMonthTwo(k);
+            String secondPath = path + "/" + month;
+            File secondFile = new File(secondPath);
+            if (secondFile.exists()) {
+                secondFile.mkdirs();
+            }
+            //时间文件夹
+            Map<String, List<ExamApplySiteTime>> timeMap = v.stream().filter(x -> StringUtils.isNotBlank(x.getSiteTime())).collect(Collectors.groupingBy(item -> {
+                List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONArray.parseArray(item.getSiteTime(), ExamApplySiteTimeTwoVo.class);
+                ExamApplySiteTimeTwoVo timeTwoVo = examApplySiteTimeTwoVos.stream().findFirst().orElse(null);
+                return timeTwoVo.getStartTime();
+            }));
+            timeMap.forEach((x, y) -> {
+                if (CollectionUtils.isEmpty(y)) {
+                    return;
+                }
+                String timePath = secondPath + "/" + x.replace(":", ".");
+                File timeFile = new File(timePath);
+                if (timeFile.exists()) {
+                    timeFile.mkdirs();
+                }
+                Set<Long> applyIds = new HashSet<>();
+                Set<Long> siteIds = new HashSet<>();
+                Set<String> startTimeList = new HashSet<>();
+                Set<String> endTimeList = new HashSet<>();
+                for (ExamApplySiteTime itme : y) {
+                    applyIds.add(itme.getApplyId());
+                    ExamApplySite site = iExamApplySiteService.getById(itme.getApplySiteId());
+                    siteIds.add(site.getSiteId());
+                    List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONArray.parseArray(itme.getSiteTime(), ExamApplySiteTimeTwoVo.class);
+                    ExamApplySiteTimeTwoVo timeTwoVo = examApplySiteTimeTwoVos.stream().findFirst().orElse(null);
+                    startTimeList.add(timeTwoVo.getStartTime());
+                    endTimeList.add(timeTwoVo.getEndTime());
+                }
+
+                //查询预约学员
+                List<UserSubscribe> userSubscribeList = iUserSubscribeService
+                        .list(new LambdaQueryWrapper<UserSubscribe>()
+                                .in(UserSubscribe::getApplyId, applyIds)
+                                .in(UserSubscribe::getSiteId, siteIds)
+                                .in(UserSubscribe::getApplySiteStartTime, startTimeList)
+                                .in(UserSubscribe::getApplySiteEndTime, endTimeList)
+                                .eq(UserSubscribe::getSubscribeStatus, 1));
+                if (CollectionUtils.isEmpty(userSubscribeList)) {
+                    return;
+                }
+                Map<Integer, List<UserSubscribe>> userMap = userSubscribeList.stream().collect(Collectors.groupingBy(UserSubscribe::getStudentType));
+                userMap.forEach((m, i) -> {
+                    switch (m) {
+                        case 1://新考人员
+                            String userPath = timePath + "/新考";
+                            File userFile = new File(userPath);
+                            if (userFile.exists()) {
+                                userFile.mkdirs();
+                            }
+                            //查询学员学时记录
+                            userStudyRecord(userPath, i);
+                            break;
+                        case 2://补考人员
+                            String userPathTwo = timePath + "/补考";
+                            File userTwoFile = new File(userPathTwo);
+                            if (userTwoFile.exists()) {
+                                userTwoFile.mkdirs();
+                            }
+                            //查询学员学时记录
+                            userStudyRecord(userPathTwo, i);
+                            break;
+                        default:
+                            break;
+                    }
+                });
+            });
+        });
+        String zipPath = zhiyuan + "/zhongzheng-admin/src/main/resources/xuexizip" + "/" + DateUtils.getNowTime() + ".zip";
+        File desc = new File(zipPath);
+        if (!desc.getParentFile().exists()) {
+            desc.getParentFile().mkdirs();
+        }
+        if (FileUtils.toZip(zipPath, path, true)) {
+            //压缩成功删除文件
+            Path pathStr = Paths.get(path);
+            try (Stream<Path> walk = Files.walk(pathStr)) {
+                walk.sorted(Comparator.reverseOrder())
+                        .forEach(FileUtils::deleteDirectoryStream);
+
+                //上传oss
+                OssRequest ossRequest = new OssRequest();
+                ossRequest.setGradeId(0L);
+                ossRequest.setUserId(0L);
+                ossRequest.setImageStatus(6);
+                File file1 = new File(zipPath);
+                ossRequest.setFile(FileUtils.getMultipartFile(file1));
+                String upload = ossService.upload(ossRequest);
+
+                //删除压缩包
+                Path zipPathStr = Paths.get(zipPath);
+                Stream<Path> zipWalk = Files.walk(zipPathStr);
+                zipWalk.sorted(Comparator.reverseOrder())
+                        .forEach(FileUtils::deleteDirectoryStream);
+                return upload;
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("学员学习资料上传oss失败:" + e.getMessage());
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Boolean sendmail(ExamApplySendmailBo bo) {
+        if (CollectionUtils.isEmpty(bo.getMailAttrList())) {
+            throw new CustomException("收件箱地址为空!");
+        }
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        SysConfig mailConfig = iSysConfigService.getSysConfigByKeyTenant("home.mail", Long.valueOf(tenantId));
+        if (ObjectUtils.isNull(mailConfig)) {
+            throw new CustomException("请先完成邮箱配置!");
+        }
+        JSONObject jsonObject = JSONObject.parseObject(mailConfig.getConfigValue());
+        String postAccount = jsonObject.get("postAccount").toString();
+        String postPassword = jsonObject.get("postPassword").toString();
+        String STMPserver = jsonObject.get("STMPserver").toString();
+        String post = jsonObject.get("post").toString();
+
+        List<String> mailAttrsList = bo.getMailAttrList();
+        try {
+            // 1.创建Session
+            Session session = JavaMailUtils.createsession(postAccount, postPassword, STMPserver, post);
+            // 2.创建邮件对象(Message抽象类的子类对象)
+            MimeMessage msg = new MimeMessage(session); // 传入session
+            msg.setFrom(new InternetAddress(postAccount)); // 发件人
+            msg.setRecipient(Message.RecipientType.TO, new InternetAddress(mailAttrsList.get(0))); // 收件人
+            if (mailAttrsList.size() > 1){
+                InternetAddress[] addresses = new InternetAddress[mailAttrsList.size() - 1];
+                for (int i = 0; i < mailAttrsList.size(); i++) {
+                    if (i == 0) {
+                        continue;
+                    }
+                    addresses[i-1] = new InternetAddress(mailAttrsList.get(i));
+                }
+                msg.setRecipients(Message.RecipientType.CC,addresses); //抄送人
+            }
+            msg.setSubject(bo.getMailName(),"utf-8"); // 标题
+
+            // 3.邮件内容"复合"对象
+            Multipart multipart = new MimeMultipart();
+            // 正文
+            BodyPart textPart = new MimeBodyPart();
+            // 参数1:正文内容
+            // 参数2:内容类型;字符编码集
+            textPart.setContent(bo.getMailText(), "text/html;charset=utf-8");
+
+            // 附件
+            BodyPart imagePart = new MimeBodyPart();
+            String filename = bo.getMailUrlName();
+            String fileNameNew= MimeUtility.encodeText(filename,"utf-8",null);
+            imagePart.setFileName(fileNameNew); // 设置附件文件的显示名称
+            InputStream in = ossService.getStreamByObject(bo.getMailUrl());
+
+            imagePart.setDataHandler(
+                    new DataHandler(
+                            new ByteArrayDataSource(
+                                    IOUtils.toByteArray(in),
+                                    "application/octet-stream")));
+
+            // 添加至邮件内容
+            multipart.addBodyPart(textPart); // 添加正文
+            multipart.addBodyPart(imagePart); // 添加附件
+            // 设置邮件内容
+            msg.setContent(multipart);
+            // 3.发送
+            Transport.send(msg);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CustomException("邮件发送失败!请检查邮箱配置");
+        }
+        iExamApplySiteTimeService.update(new LambdaUpdateWrapper<ExamApplySiteTime>()
+                .in(ExamApplySiteTime::getId, bo.getIds())
+                .set(ExamApplySiteTime::getSendmail, 1));
+
+        return true;
+    }
+
+    private void userStudyRecord(String userPath, List<UserSubscribe> list) {
+        Map<Long, List<UserSubscribe>> map = list.stream().collect(Collectors.groupingBy(UserSubscribe::getUserId));
+        map.forEach((k, v) -> {
+            User user = iUserService.getById(k);
+            if (ObjectUtils.isNull(user)) {
+                return;
+            }
+            SysTenant tenant = sysTenantService.getById(user.getTenantId());
+            Set<Long> orderGoodsIds = v.stream().map(UserSubscribe::getOrderGoodsId).collect(Collectors.toSet());
+            List<UserStudyRecordExport> recordExports = new ArrayList<>();
+            for (Long orderGoodsId : orderGoodsIds) {
+                //学习记录
+                recordExports = baseMapper.getUserStudyRecord(orderGoodsId, k);
+                if (CollectionUtils.isEmpty(recordExports)) {
+                    continue;
+                }
+                recordExports.forEach(item -> {
+                    item.setUserName(user.getRealname());
+                    item.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
+                    item.setCompanyName(tenant.getTenantName());
+                    item.setSectionTime(DateUtils.secondConvertHourMinSecond(item.getDurationTime()));
+                    if (item.getStatus() == 1) {
+                        //已学完
+                        item.setStudyTime(DateUtils.secondConvertHourMinSecond(item.getDurationTime()));
+                        item.setFinish("已完成");
+                    } else {
+                        item.setFinish("未完成");
+                    }
+                    item.setStudyStartTime(DateUtils.timestampToDateFormat(item.getStartTime(), "yyyy/MM/dd HH:mm:ss"));
+                    item.setStudyEndTime(DateUtils.timestampToDateFormat(item.getEndTime(), "yyyy/MM/dd HH:mm:ss"));
+                });
+            }
+            ExcelUtil<UserStudyRecordExport> util = new ExcelUtil<UserStudyRecordExport>(UserStudyRecordExport.class);
+            String path = userPath + "/" + user.getRealname() + ".xlsx";
+            util.exportEasyExcelStudy(util.exportEasyData(recordExports), path);
+        });
+    }
+
     private boolean checkNameUnique(ExamApply entity) {
         ExamApply info = getOne(new LambdaQueryWrapper<ExamApply>()
-                .eq(ExamApply::getApplyName,entity.getApplyName()).ne(ExamApply::getStatus,-1).last("limit 1"));
+                .eq(ExamApply::getApplyName, entity.getApplyName()).ne(ExamApply::getStatus, -1).last("limit 1"));
         if (Validator.isNotNull(info)) {
-            if(Validator.isNotEmpty(entity.getApplyId())){
-                if(entity.getApplyId().longValue() != info.getApplyId().longValue()){
+            if (Validator.isNotEmpty(entity.getApplyId())) {
+                if (entity.getApplyId().longValue() != info.getApplyId().longValue()) {
                     return true;
                 }
-            }else{
+            } else {
                 return true;
             }
         }

+ 22 - 20
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplySiteServiceImpl.java

@@ -1,28 +1,25 @@
 package com.zhongzheng.modules.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeAddBo;
-import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
-import com.zhongzheng.modules.exam.service.IExamApplySiteTimeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
-import com.zhongzheng.modules.exam.bo.ExamApplySiteAddBo;
-import com.zhongzheng.modules.exam.bo.ExamApplySiteQueryBo;
-import com.zhongzheng.modules.exam.bo.ExamApplySiteEditBo;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.domain.ExamApplySite;
+import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
 import com.zhongzheng.modules.exam.mapper.ExamApplySiteMapper;
-import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
 import com.zhongzheng.modules.exam.service.IExamApplySiteService;
+import com.zhongzheng.modules.exam.service.IExamApplySiteTimeService;
+import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -114,6 +111,7 @@ public class ExamApplySiteServiceImpl extends ServiceImpl<ExamApplySiteMapper, E
         lqw.eq( ExamApplySite::getApplyId,bo.get(0).getApplyId());
         lqw.eq( ExamApplySite::getStatus,bo.get(0).getStatus());
         this.remove(lqw);
+        examApplySiteTimeService.remove(new LambdaQueryWrapper<ExamApplySiteTime>().eq(ExamApplySiteTime::getApplyId,bo.get(0).getApplyId()));
         //增加地点
         for (ExamApplySiteAddBo examApplySiteAddBo : bo) {
             ExamApplySite add = BeanUtil.toBean(examApplySiteAddBo, ExamApplySite.class);
@@ -122,13 +120,17 @@ public class ExamApplySiteServiceImpl extends ServiceImpl<ExamApplySiteMapper, E
             add.setUpdateTime(DateUtils.getNowTime());
             this.save(add);
             for (ExamApplySiteTimeAddBo examApplySiteTimeAddBo : examApplySiteAddBo.getExamApplySiteTime()) {
-                ExamApplySiteTime examApplySiteTime = BeanUtil.toBean(examApplySiteTimeAddBo, ExamApplySiteTime.class);
-                examApplySiteTime.setApplySiteId(add.getId());
-                examApplySiteTime.setApplyId(add.getApplyId());
-                examApplySiteTime.setSiteTime(JSONUtil.toJsonStr(examApplySiteTimeAddBo.getExamApplySiteTimeTwo()));
-                examApplySiteTime.setCreateTime(DateUtils.getNowTime());
-                examApplySiteTime.setUpdateTime(DateUtils.getNowTime());
-                examApplySiteTimeService.save(examApplySiteTime);
+                if (CollectionUtils.isNotEmpty(examApplySiteTimeAddBo.getExamApplySiteTimeTwo())){
+                    for (ExamApplySiteTimeTwoAddBo examApplySiteTimeTwoAddBo : examApplySiteTimeAddBo.getExamApplySiteTimeTwo()) {
+                        ExamApplySiteTime examApplySiteTime = BeanUtil.toBean(examApplySiteTimeAddBo, ExamApplySiteTime.class);
+                        examApplySiteTime.setApplySiteId(add.getId());
+                        examApplySiteTime.setApplyId(add.getApplyId());
+                        examApplySiteTime.setSiteTime(JSONUtil.toJsonStr(Arrays.asList(examApplySiteTimeTwoAddBo)));
+                        examApplySiteTime.setCreateTime(DateUtils.getNowTime());
+                        examApplySiteTime.setUpdateTime(DateUtils.getNowTime());
+                        examApplySiteTimeService.save(examApplySiteTime);
+                    }
+                }
             }
         }
         return true;

+ 57 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyPlaceVo.java

@@ -0,0 +1,57 @@
+package com.zhongzheng.modules.exam.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 考试安排视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+@ApiModel("考场返回对象")
+public class ExamApplyPlaceVo {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long applyId;
+
+	@ApiModelProperty("考试日期")
+	private Long applyDate;
+
+	@ApiModelProperty("考试地点ID")
+	private Long applySiteId;
+
+	@ApiModelProperty("考试时间段")
+	private String applyTime;
+
+	private String siteTime;
+
+	@ApiModelProperty("报名开始时间")
+	private Long applyStartTime;
+
+	@ApiModelProperty("报名结束时间")
+	private Long applyEndTime;
+
+	@ApiModelProperty("已报人数")
+	private Integer people;
+
+	@ApiModelProperty("可报人数")
+	private Long mayNum;
+
+	@ApiModelProperty("1非补考学员 2补考学员 ")
+	private String applyStatus;
+
+	@ApiModelProperty("考场性质:1普通场,2专场")
+	private Integer applyNature;
+
+	@ApiModelProperty("是否发送邮件:0未发送 1已发送")
+	private Integer sendmail;
+}

+ 11 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyVo.java

@@ -1,11 +1,11 @@
 package com.zhongzheng.modules.exam.vo;
 
 import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.exam.bo.ExamApplyUserImportBo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.util.Date;
+
 import java.util.List;
 
 
@@ -103,4 +103,13 @@ public class ExamApplyVo {
 
 	@ApiModelProperty("智慧考场数量")
 	private Integer wisdomNum;
+
+	@ApiModelProperty("考场性质:1普通场,2专场")
+	private Integer applyNature;
+
+	@ApiModelProperty("专场学员资料地址 ")
+	private String natureUrl;
+
+	@ApiModelProperty("专场预约学员")
+	private List<ExamApplyUserImportBo> applyUsers;
 }

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

@@ -391,4 +391,9 @@ public class GoodsUserVo {
 	private String externalLink;
 	@ApiModelProperty("是否外链商品:0否 1是")
 	private Integer externalLinkStatus;
+	@Excel(name = "学时变为待审核时间")
+	@ApiModelProperty("学时变为待审核时间")
+	private Long periodWaitTime;
+	@ApiModelProperty("是否是二建二造")
+	private Boolean erJianErZao;
 }

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

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.grade.bo;
 
 import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -286,5 +287,15 @@ public class ClassGradeUserQueryBo extends BaseEntity {
 	@ApiModelProperty("学习记录同步到老系统时间")
 	private Long toOldTime;
 
+	@ApiModelProperty("月份")
+	private Integer month;
+
+	@ApiModelProperty("周查询开始时间")
+	private Long searchWeekStartTime;
+
+	@ApiModelProperty("周查询结束时间")
+	private Long searchWeekEndTime;
+
+	private List<WeekDataVo> weekList;
 
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java

@@ -83,4 +83,9 @@ public class UserPeriodQueryBo extends BaseEntity {
 	private List<Long> chapterIds;
 	@ApiModelProperty("节IDs")
 	private List<Long> sectionIds;
+	@ApiModelProperty("周查询开始时间")
+	private Long searchWeekStartTime;
+
+	@ApiModelProperty("周查询结束时间")
+	private Long searchWeekEndTime;
 }

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

@@ -28,6 +28,10 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
 
     List<ClassPeriodStudentVo> listUserPeriod(ClassGradeUserQueryBo bo);
 
+    List<ClassPeriodStudentVo> listUserWeekPeriod(ClassGradeUserQueryBo bo);
+
+    Long listUserWeekStudyTime(ClassGradeUserQueryBo bo);
+
     List<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo);
 
     List<ClassPeriodStudentVo> listUserPeriodExport(ClassGradeUserQueryBo bo);

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -62,6 +62,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	Map<String,Object> exportPo(ClassGradeUserQueryBo bo);
 
+	Map<String,Object> exportWeekPo(ClassGradeUserQueryBo bo);
+
 
 	/**
 	 * 根据编辑业务对象修改学员记录
@@ -84,12 +86,18 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	List<ClassPeriodStudentVo> listUserPeriodRecord(ClassGradeUserQueryBo bo);
 
+	List<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo);
+
 	List<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo);
 
 	List<UserPeriodExportVo> listUserStudyRecord(ClassGradeUserQueryBo bo);
 
+	List<UserPeriodExportVo> listUserStudyRecordWeek(ClassGradeUserQueryBo bo);
+
 	List<UserPeriodExportV2Vo> listUserStudyRecordV2(ClassGradeUserQueryBo bo);
 
+	List<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo);
+
     List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo);
 
 	List<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo);

+ 545 - 13
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -56,9 +56,12 @@ import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordPhotoMapper;
 import com.zhongzheng.modules.user.service.IUserBankRecordService;
+import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.vo.*;
+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.stereotype.Service;
@@ -138,6 +141,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private ICourseEducationTypeService iCourseEducationTypeService;
 
+    @Autowired
+    private IUserService iUserService;
 
     @Value("${aliyun.oss.endpoint}")
     private String ALIYUN_OSS_ENDPOINT;
@@ -160,6 +165,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private ISysOldOrgService sysOldOrgService;
 
+    private static final Logger log = LoggerFactory.getLogger(ClassGradeUserServiceImpl.class);
+
     @Override
     public ClassGradeUserVo queryById(Long id) {
         ClassGradeUser db = this.baseMapper.selectById(id);
@@ -519,6 +526,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
      */
     @Override
     public String pushOfficialInfo(ClassGradeUserQueryBo bo) {
+        log.info("报名信息推送"+JSON.toJSONString(bo));
         //暂时先关闭信息推送入口
 //        if (true){
 //            return "";
@@ -582,6 +590,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         String respone = "";
         try {
             respone = HttpUtils.postFormBody(OFFICIALPUSH_INFOPATH, params);
+           if(Validator.isEmpty(respone)){
+               return "响应信息空";
+           }
             String[] split = respone.split("\\|");
             if (split.length < 2) {
                 return "推送接口返回数据错误";
@@ -606,11 +617,13 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 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("请求错误");
+        //    throw new CustomException("请求错误");
+            return null;
         }
     }
 
@@ -795,8 +808,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
             subjectStudyRecordQueryBo.setUserId(classPeriodStudentVo.getUserId());
             subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
-
-            if (Validator.isNotEmpty(bo.getUserPhoto()) && bo.getUserPhoto() == 1) {
+            User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, classPeriodStudentVo.getUserId()));
+            /*if (Validator.isNotEmpty(bo.getUserPhoto()) && bo.getUserPhoto() == 1) {
                 //解析身份证和一寸照
                 if (Validator.isNotEmpty(classPeriodStudentVo.getKeyValue())) {
                     JSONObject keyJSON = null;
@@ -827,6 +840,18 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         e.printStackTrace();
                     }
                 }
+            }*/
+            if(Validator.isNotEmpty(user.getOneInchPhotos())){
+                classPeriodStudentVo.setOneInchPhotos(ALIYUN_OSS_ENDPOINT + "/" + user.getOneInchPhotos());
+                classPeriodStudentVo.setOneInchPhotosOss(user.getOneInchPhotos());
+            }
+            if(Validator.isNotEmpty(user.getIdCardImg1())){
+                classPeriodStudentVo.setIdCardImg1(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg1());
+                classPeriodStudentVo.setIdCardImg1Oss(user.getIdCardImg1());
+            }
+            if(Validator.isNotEmpty(user.getIdCardImg2())){
+                classPeriodStudentVo.setIdCardImg2(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg2());
+                classPeriodStudentVo.setIdCardImg2Oss(user.getIdCardImg2());
             }
             ClassPeriodStudentExportVo addItem = BeanUtil.toBean(classPeriodStudentVo, ClassPeriodStudentExportVo.class);
 
@@ -843,6 +868,105 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return fillList(exportList);
     }
 
+    @Override
+    public Map<String, Object> exportWeekPo(ClassGradeUserQueryBo bo) {
+        Map<String, Object> totalRs = new HashMap<>();
+        List<ClassPeriodStudentExportWeekAllVo> totalList = new ArrayList<>();
+        Map<String, List<ClassPeriodStudentExportVo>> weekRs = new HashMap<>();
+        for(WeekDataVo weekDataVo : bo.getWeekList() ){
+            bo.setSearchWeekStartTime(weekDataVo.getSearchWeekStartTime());
+            bo.setSearchWeekEndTime(weekDataVo.getSearchWeekEndTime());
+            //查询班级学员信息
+            List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.listUserPeriodExport(bo);
+            List<ClassPeriodStudentExportVo> exportList = new ArrayList<>();
+            //查找学员学习记录
+            for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
+                Long secLong = 0L;
+                Long studyLong = 0L;
+
+                SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
+                subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
+                subjectStudyRecordQueryBo.setUserId(classPeriodStudentVo.getUserId());
+                subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
+                User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, classPeriodStudentVo.getUserId()));
+                if(Validator.isNotEmpty(user.getOneInchPhotos())){
+                    classPeriodStudentVo.setOneInchPhotos(ALIYUN_OSS_ENDPOINT + "/" + user.getOneInchPhotos());
+                    classPeriodStudentVo.setOneInchPhotosOss(user.getOneInchPhotos());
+                }
+                if(Validator.isNotEmpty(user.getIdCardImg1())){
+                    classPeriodStudentVo.setIdCardImg1(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg1());
+                    classPeriodStudentVo.setIdCardImg1Oss(user.getIdCardImg1());
+                }
+                if(Validator.isNotEmpty(user.getIdCardImg2())){
+                    classPeriodStudentVo.setIdCardImg2(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg2());
+                    classPeriodStudentVo.setIdCardImg2Oss(user.getIdCardImg2());
+                }
+                ClassPeriodStudentExportVo addItem = BeanUtil.toBean(classPeriodStudentVo, ClassPeriodStudentExportVo.class);
+
+                addItem.setStudyTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getServiceStartTime()) + "-" + DateUtils.timestampToDate(classPeriodStudentVo.getServiceEndTime()));
+                addItem.setClassTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getClassStartTime()) + "-" + DateUtils.timestampToDate(classPeriodStudentVo.getClassEndTime()));
+
+                ClassGradeUserQueryBo classGradeUserQueryBo1 = new ClassGradeUserQueryBo();
+                classGradeUserQueryBo1.setUserId(classPeriodStudentVo.getUserId());
+                classGradeUserQueryBo1.setGradeId(classPeriodStudentVo.getGradeId());
+                classGradeUserQueryBo1.setGoodsId(classPeriodStudentVo.getGoodsId());
+                classGradeUserQueryBo1.setSearchWeekStartTime(weekDataVo.getSearchWeekStartTime());
+                classGradeUserQueryBo1.setSearchWeekEndTime(weekDataVo.getSearchWeekEndTime());
+                addItem.setPeriodVoList(listUserStudyRecordWeek(classGradeUserQueryBo1));
+                exportList.add(addItem);
+            }
+            weekRs.put(weekDataVo.getWeekCxt(),exportList);
+            Map<String, Object> rs =  fillListWeek(exportList);
+            List<ClassPeriodStudentExportWeekAllVo> list = (List<ClassPeriodStudentExportWeekAllVo>)rs.get("list");
+            ClassPeriodStudentExportWeekAllVo titleVo = new ClassPeriodStudentExportWeekAllVo();
+            titleVo.setWeekTime(weekDataVo.getWeekCxt());
+            totalList.add(titleVo);
+            totalList.addAll(list);
+
+        }
+        String filename = FileUtils.encodingZipFilename("用户压缩数据");
+        String zipFile = FileUtils.getZipAbsoluteFile(filename);
+        try {
+            ZipOutputStream outStream = new ZipOutputStream(new FileOutputStream(zipFile));
+            //生成ZIP
+            for(WeekDataVo weekDataVo : bo.getWeekList() ){
+                List<ClassPeriodStudentExportVo> exportList = weekRs.get(weekDataVo.getWeekCxt());
+                for (ClassPeriodStudentExportVo vo : exportList) {
+                    ossService.zipPeopleWeekDownload(vo, outStream,weekDataVo);
+                }
+            }
+            outStream.close();
+        } catch (IOException e) {
+            System.out.println(e.getMessage() + "压缩");
+        }
+        totalRs.put("list",totalList);
+        totalRs.put("zip", AjaxResult.success(filename));
+        return totalRs;
+    }
+
+    //填充满列表的用户信息
+    private Map<String, Object> fillListWeek(List<ClassPeriodStudentExportVo> list) {
+        List<ClassPeriodStudentExportWeekAllVo> newList = new ArrayList<>();
+        Map<String, Object> rs = new HashMap<>();
+            for (ClassPeriodStudentExportVo vo : list) {
+                for (UserPeriodExportVo cVo : vo.getPeriodVoList()) {
+                    ClassPeriodStudentExportWeekAllVo item = BeanUtil.toBean(vo, ClassPeriodStudentExportWeekAllVo.class);
+                    item.setId(cVo.getId());
+                    item.setModuleName(cVo.getModuleName());
+                    item.setChapterName(cVo.getChapterName());
+                    item.setSectionName(cVo.getSectionName());
+                    item.setDurationTime(Validator.isEmpty(cVo.getDurationTime())?new BigDecimal(0):((new BigDecimal(cVo.getDurationTime()).divide(new BigDecimal(3600),2,BigDecimal.ROUND_DOWN))));
+                    item.setStudyTimeTxt(cVo.getStudyTimeTxt());
+                    item.setStudyTimeLongTxt(cVo.getStudyTimeLongTxt());
+                    item.setStudyStatusTxt(cVo.getStudyStatusTxt());
+                    item.setScore(cVo.getScore());
+                    newList.add(item);
+                }
+            }
+        rs.put("list", newList);
+        return rs;
+    }
+
     //填充满列表的用户信息
     private Map<String, Object> fillList(List<ClassPeriodStudentExportVo> list) {
         List<ClassPeriodStudentExportAllVo> newList = new ArrayList<>();
@@ -858,7 +982,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     item.setModuleName(cVo.getModuleName());
                     item.setChapterName(cVo.getChapterName());
                     item.setSectionName(cVo.getSectionName());
-                    item.setDurationTime(cVo.getDurationTime());
+                    item.setDurationTime(Validator.isEmpty(cVo.getDurationTime())?new BigDecimal(0):((new BigDecimal(cVo.getDurationTime()).divide(new BigDecimal(3600),2,BigDecimal.ROUND_DOWN))));
                     item.setStudyTimeTxt(cVo.getStudyTimeTxt());
                     item.setStudyTimeLongTxt(cVo.getStudyTimeLongTxt());
                     item.setStudyStatusTxt(cVo.getStudyStatusTxt());
@@ -882,6 +1006,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         List<UserBankRecordVo> recordList = iUserBankRecordService.queryList(recordQueryBo);
         //录入学时记录
         UserPeriodExportV2Vo userPeriodExportVo = new UserPeriodExportV2Vo();
+        userPeriodExportVo.setId(index);
+        userPeriodExportVo.setSectionName(sectionName);
         List<UserPeriodItemExportVo> studyList = new ArrayList<>();
         for(UserBankRecordVo vo : recordList){
             UserPeriodItemExportVo exportVo = new UserPeriodItemExportVo();
@@ -1226,6 +1352,53 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return classPeriodStudentVos;
     }
 
+    @Override
+    public List<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo) {
+        //查询班级学员信息
+        List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.listUserWeekPeriod(bo);
+        //查找学员学习记录
+        for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
+            //总的审核状态按照策划规则
+            ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
+            classGradeUserQueryBo.setGradeId(classPeriodStudentVo.getGradeId());
+            classGradeUserQueryBo.setUserId(classPeriodStudentVo.getUserId());
+            classGradeUserQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
+            Long studyTime =  baseMapper.listUserWeekStudyTime(classGradeUserQueryBo);
+            classPeriodStudentVo.setStudyTime(studyTime);
+            //    List<ClassPeriodUserVo> classPeriodUserVos1 = baseMapper.listPeriod(classGradeUserQueryBo);
+            //    ClassPeriodUserVo classPeriodUserVos = classPeriodUserVos1.get(0);
+            //    classPeriodUserVos.setPending(classPeriodStudentVo.getSecAllNum()-classPeriodUserVos.getPass()-classPeriodUserVos.getCheat());
+            //    classPeriodUserVos.setExamPending(classPeriodUserVos.getExamNum()-classPeriodUserVos.getExamPass()-classPeriodUserVos.getExamCheat());
+            //當前班級學員審核狀態 -1不可审核 0待審  1未通过 2通过
+            Integer gradePeriodStatus = 0; //班级里的审核状态字段,保持一致 0 未通过 1通过 2待审核 -1 不可审核
+
+            classPeriodStudentVo.setAllStatus(changePeriodStatus(classPeriodStudentVo.getPeriodStatus()));
+
+            //    classPeriodStudentVo.setWaitRebuildNum(classPeriodUserVos.getCheat()+classPeriodUserVos.getExamCheat());
+            /*if (!CollectionUtils.isEmpty(baseMapper.selectStart(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGoodsId(), classPeriodStudentVo.getGradeId()))) {
+                //查找开始学习时间
+                classPeriodStudentVo.setStartTime(baseMapper.selectStart(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGoodsId(), classPeriodStudentVo.getGradeId()).get(0));
+            }*/
+            //取学时所有拍照最新的一张
+            String recentPhoto = userStudyRecordPhotoMapper.selectGradeRecentOnePhoto(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGradeId());
+            if (Validator.isNotEmpty(recentPhoto)) {
+                classPeriodStudentVo.setIdCardImg1(recentPhoto);
+            }
+            if (Validator.isNotEmpty(bo.getUserPhoto()) && bo.getUserPhoto() == 1) {
+                //解析身份证和一寸照
+                if (Validator.isNotEmpty(classPeriodStudentVo.getKeyValue())) {
+                    JSONObject keyJSON = null;
+                    try {
+                        classPeriodStudentVo.setKeyValue(null);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+        return classPeriodStudentVos;
+    }
+
     @Override
     public List<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo) {
         //查询班级学员信息
@@ -1469,6 +1642,237 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return studyList;
     }
 
+    @Override
+    public List<UserPeriodExportVo> listUserStudyRecordWeek(ClassGradeUserQueryBo bo) {
+        //学习记录
+        ClassGradeUserQueryBo cGQB = new ClassGradeUserQueryBo();
+        cGQB.setGoodsId(bo.getGoodsId());
+        cGQB.setUserId(bo.getUserId());
+        cGQB.setGradeId(bo.getGradeId());
+        List<ClassPeriodVo> list = listPeriodAudit(cGQB);
+        String moduleName = "";
+        String chapterName = "";
+        String sectionName = "";
+        List<UserPeriodExportVo> studyList = new ArrayList<>();
+        long i = 0;
+        Long gradeId = bo.getGradeId();
+        Long userId = bo.getUserId();
+        Long goodsId = bo.getGoodsId();
+        for (ClassPeriodVo classPeriodVo : list) {
+            //为模块搜索下面的章 和节 并搜索学时记录
+            if (classPeriodVo.getType() == 1) {
+                moduleName = classPeriodVo.getTypeName();
+                List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, gradeId);
+                for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
+                    if (classPeriodChapterVo.getType() == 2) {
+                        chapterName = classPeriodChapterVo.getTypeName();
+                        List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                        classPeriodSectionVos.addAll(baseMapper.listperiodExam(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, classPeriodVo.getId()));
+                        for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                            i++;
+                            if (classPeriodSectionVo.getType() == 3) {
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                                userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
+                                userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                                userPeriodQueryBo.setGoodsId(goodsId);
+                                userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                                userPeriodQueryBo.setChapterId(classPeriodChapterVo.getId());
+                                userPeriodQueryBo.setModuleId(classPeriodVo.getId());
+                                userPeriodQueryBo.setGradeId(gradeId);
+                                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    int numIndex = userPeriodStatusVos.size() - 1;
+                                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                                    classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                                    classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                                    classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                                    classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                                    classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                                    classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                                    classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                                    classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                                    classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                                }
+                                classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                                classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
+                                classPeriodSectionVo.setGoodsId(goodsId);
+                                classPeriodSectionVo.setGradeId(gradeId);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                                }
+                            } else {
+                                //章卷
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                                userPeriodQueryBo.setExamId(classPeriodSectionVo.getId());
+                                userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                                userPeriodQueryBo.setGoodsId(goodsId);
+                                userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                                userPeriodQueryBo.setChapterId(classPeriodChapterVo.getId());
+                                userPeriodQueryBo.setModuleId(classPeriodVo.getId());
+                                userPeriodQueryBo.setGradeId(gradeId);
+                                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    int numIndex = userPeriodStatusVos.size() - 1;
+                                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                                    classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                                    classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                                    classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                                    classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                                    classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                                    classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                                    classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                                    classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                                    classPeriodChapterVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                                }
+                                classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                                classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
+                                classPeriodSectionVo.setGoodsId(goodsId);
+                                classPeriodSectionVo.setGradeId(gradeId);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, classPeriodChapterVo.getPerformance(), true));
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //为章搜索节记录和学时记录
+            if (classPeriodVo.getType() == 2) {
+                moduleName = "";
+                chapterName = classPeriodVo.getTypeName();
+                List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                    userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
+                    userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                    userPeriodQueryBo.setGoodsId(goodsId);
+                    userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                    userPeriodQueryBo.setChapterId(classPeriodVo.getId());
+                    userPeriodQueryBo.setModuleId(0L);
+                    userPeriodQueryBo.setGradeId(gradeId);
+                    userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        int numIndex = userPeriodStatusVos.size() - 1;
+                        UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                        classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                        classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                        classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                        classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                        classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                        classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                        classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                        classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                        classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                    }
+                    classPeriodSectionVo.setModuleId(0L);
+                    classPeriodSectionVo.setChapterId(classPeriodVo.getId());
+                    classPeriodSectionVo.setGoodsId(goodsId);
+                    classPeriodSectionVo.setGradeId(gradeId);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                    }
+                }
+                List<ClassPeriodSectionVo> classPeriodSectionVos1 = baseMapper.listPeriodSectionExam(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos1) {
+                    //章卷
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                    userPeriodQueryBo.setExamId(classPeriodSectionVo.getId());
+                    userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                    userPeriodQueryBo.setGoodsId(bo.getGoodsId());
+                    userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                    userPeriodQueryBo.setChapterId(classPeriodVo.getId());
+                    userPeriodQueryBo.setModuleId(0L);
+                    userPeriodQueryBo.setGradeId(bo.getGradeId());
+                    userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        int numIndex = userPeriodStatusVos.size() - 1;
+                        UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                        classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                        classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                        classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                        classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                        classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                        classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                        classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                        classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                        classPeriodVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                    }
+                    classPeriodSectionVo.setModuleId(0L);
+                    classPeriodSectionVo.setChapterId(classPeriodVo.getId());
+                    classPeriodSectionVo.setGoodsId(goodsId);
+                    classPeriodSectionVo.setGradeId(gradeId);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, classPeriodVo.getPerformance(), true));
+                    }
+                }
+                classPeriodSectionVos.addAll(classPeriodSectionVos1);
+                classPeriodVo.setClassPeriodSectionList(classPeriodSectionVos);
+            }
+            //为节搜索学时记录
+            if (classPeriodVo.getType() == 3) {
+                i++;
+                sectionName = classPeriodVo.getTypeName();
+                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                userPeriodQueryBo.setSectionId(classPeriodVo.getId());
+                userPeriodQueryBo.setCourseId(classPeriodVo.getCourseId());
+                userPeriodQueryBo.setGoodsId(bo.getGoodsId());
+                userPeriodQueryBo.setUserId(classPeriodVo.getUserId());
+                userPeriodQueryBo.setChapterId(0L);
+                userPeriodQueryBo.setModuleId(0L);
+                userPeriodQueryBo.setGradeId(bo.getGradeId());
+                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                    int numIndex = userPeriodStatusVos.size() - 1;
+                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                    classPeriodVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                    classPeriodVo.setStatus(userPeriodStatusVo.getStatus());
+                    classPeriodVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                    classPeriodVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                    classPeriodVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                    classPeriodVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                    classPeriodVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                    classPeriodVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                    classPeriodVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                    classPeriodVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                    classPeriodVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                }
+                classPeriodVo.setModuleId(0L);
+                classPeriodVo.setChapterId(0L);
+                classPeriodVo.setGoodsId(bo.getGoodsId());
+                classPeriodVo.setGradeId(bo.getGradeId());
+                ClassPeriodSectionVo classPeriodSectionVo = BeanUtil.toBean(classPeriodVo, ClassPeriodSectionVo.class);
+                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                }
+            }
+        }
+        return studyList;
+    }
+
     /**
      * 学习记录第二版
      * @param bo
@@ -1589,6 +1993,134 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return studyList;
     }
 
+    @Override
+    public List<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo) {
+        //查找最外层课程目录 模块 章 节
+        List<ClassPeriodVo> classPeriodVos = baseMapper.listPeriodAudit(bo);
+        classPeriodVos.addAll(baseMapper.listPeriodAuditSection(bo));
+        Collections.sort(classPeriodVos);
+        String moduleName = "";
+        String chapterName = "";
+        String sectionName = "";
+        List<UserPeriodExportV2Vo> studyList = new ArrayList<>();
+        long i = 0;
+        Long gradeId = bo.getGradeId();
+        Long userId = bo.getUserId();
+        Long goodsId = bo.getGoodsId();
+        Long courseId = bo.getCourseId();
+        for (ClassPeriodVo classPeriodVo : classPeriodVos) {
+            //为模块搜索下面的章 和节 并搜索学时记录
+            if (classPeriodVo.getType() == 1) {
+                moduleName = classPeriodVo.getTypeName();
+                List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, gradeId);
+                for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
+                    if (classPeriodChapterVo.getType() == 2) {
+                        chapterName = classPeriodChapterVo.getTypeName();
+                        List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                        List<ClassPeriodSectionVo> examList = baseMapper.listperiodExam(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, classPeriodVo.getId());
+                        if(examList.size()>0){
+                            classPeriodSectionVos.addAll(examList);
+                        }
+                        for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                            i++;
+                            if (classPeriodSectionVo.getType() == 3) {
+                                //节
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                UserStudyRecordQueryBo recordQueryBo = new UserStudyRecordQueryBo();
+                                recordQueryBo.setSectionId(classPeriodSectionVo.getId());
+                                recordQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                                recordQueryBo.setGoodsId(goodsId);
+                                recordQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                                recordQueryBo.setChapterId(classPeriodChapterVo.getId());
+                                recordQueryBo.setModuleId(classPeriodVo.getId());
+                                recordQueryBo.setGradeId(gradeId);
+                                recordQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                recordQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                studyList.add(mergeDataV2(i, moduleName, chapterName, sectionName,classPeriodSectionVo, recordQueryBo));
+                            } else {
+                                //章卷
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                                classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
+                                classPeriodSectionVo.setGoodsId(goodsId);
+                                classPeriodSectionVo.setGradeId(gradeId);
+                                classPeriodSectionVo.setUserId(classPeriodSectionVo.getUserId());
+                                classPeriodSectionVo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                classPeriodSectionVo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                studyList.add(mergeEamDataV2(i, moduleName, chapterName, sectionName, classPeriodSectionVo));
+                            }
+                        }
+                    }
+                }
+            }
+            //为章搜索节记录和学时记录
+            if (classPeriodVo.getType() == 2) {
+                moduleName = "";
+                chapterName = classPeriodVo.getTypeName();
+                List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    UserStudyRecordQueryBo recordQueryBo = new UserStudyRecordQueryBo();
+                    recordQueryBo.setSectionId(classPeriodSectionVo.getId());
+                    recordQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                    recordQueryBo.setGoodsId(goodsId);
+                    recordQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                    recordQueryBo.setChapterId(classPeriodVo.getId());
+                    recordQueryBo.setModuleId(classPeriodVo.getId());
+                    recordQueryBo.setGradeId(gradeId);
+                    recordQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    recordQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    studyList.add(mergeDataV2(i, moduleName, chapterName, sectionName,classPeriodSectionVo, recordQueryBo));
+                }
+                List<ClassPeriodSectionVo> classPeriodSectionVos1 = baseMapper.listPeriodSectionExam(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos1) {
+                    //章卷
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                    classPeriodSectionVo.setChapterId(classPeriodVo.getId());
+                    classPeriodSectionVo.setGoodsId(goodsId);
+                    classPeriodSectionVo.setGradeId(gradeId);
+                    classPeriodSectionVo.setUserId(classPeriodSectionVo.getUserId());
+                    classPeriodSectionVo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    classPeriodSectionVo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    studyList.add(mergeEamDataV2(i, moduleName, chapterName, sectionName, classPeriodSectionVo));
+                }
+                classPeriodSectionVos.addAll(classPeriodSectionVos1);
+                classPeriodVo.setClassPeriodSectionList(classPeriodSectionVos);
+            }
+            //为节搜索学时记录
+            if (classPeriodVo.getType() == 3) {
+                i++;
+                sectionName = classPeriodVo.getTypeName();
+                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                userPeriodQueryBo.setSectionId(classPeriodVo.getId());
+                userPeriodQueryBo.setCourseId(classPeriodVo.getCourseId());
+                userPeriodQueryBo.setGoodsId(bo.getGoodsId());
+                userPeriodQueryBo.setUserId(classPeriodVo.getUserId());
+                userPeriodQueryBo.setChapterId(0L);
+                userPeriodQueryBo.setModuleId(0L);
+                userPeriodQueryBo.setGradeId(bo.getGradeId());
+                UserStudyRecordQueryBo recordQueryBo = BeanUtil.toBean(userPeriodQueryBo, UserStudyRecordQueryBo.class);
+                recordQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                recordQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+
+                ClassPeriodSectionVo classPeriodSectionVo = BeanUtil.toBean(userPeriodQueryBo, ClassPeriodSectionVo.class);
+                classPeriodSectionVo.setSectionType(classPeriodVo.getSectionType());
+                classPeriodSectionVo.setRealDuration(classPeriodVo.getRealDuration());
+                classPeriodSectionVo.setDurationTime(classPeriodVo.getDurationTime());
+                classPeriodSectionVo.setRealLiveStartTime(classPeriodVo.getRealLiveStartTime());
+                classPeriodSectionVo.setRealLiveEndTime(classPeriodVo.getRealLiveEndTime());
+                System.out.println("EER");
+                System.out.println(classPeriodSectionVo);
+                studyList.add(mergeDataV2(i, moduleName, chapterName, sectionName,classPeriodSectionVo, recordQueryBo));
+            }
+        }
+        return studyList;
+    }
+
     @Override
     public List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo) {
         //班级学员信息
@@ -1687,10 +2219,10 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     if(Validator.isNotEmpty(photoList)&&photoList.size()>0){
                                         classPeriodSectionVo.setStudyStartTime(photoList.get(0).getCreateTime());
                                     }
-                                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                    if((startTotalTime==0L&&Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime()))||(Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&(startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()))){
                                         startTotalTime = classPeriodSectionVo.getStudyStartTime();
                                     }
-                                    if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                                    if((endTotalTime==0L&&(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())))||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
                                         endTotalTime = classPeriodSectionVo.getStudyEndTime();
                                     }
                                     classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
@@ -1702,7 +2234,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
                                         ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
                                     }
-                                    if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                    if((ChapterStartTime==0L&&Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime()))||((Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()))){
                                         ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
                                     }
                                 }
@@ -1738,7 +2270,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                                     classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                                     classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
-                                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                    if((startTotalTime==0L&&Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime()))||(Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue())){
                                         startTotalTime = classPeriodSectionVo.getStudyStartTime();
                                     }
                                     if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
@@ -1753,7 +2285,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
                                         ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
                                     }
-                                    if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                    if((Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&ChapterStartTime==0L)||(Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue())){
                                         ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
                                     }
                                 }
@@ -1838,7 +2370,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         if(Validator.isNotEmpty(photoList)&&photoList.size()>0){
                             classPeriodSectionVo.setStudyStartTime(photoList.get(0).getCreateTime());
                         }
-                        if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                        if((startTotalTime==0L&&Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime()))||(Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue())){
                             startTotalTime = classPeriodSectionVo.getStudyStartTime();
                         }
                         if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
@@ -1890,10 +2422,10 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                         classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                         classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
-                        if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                        if((startTotalTime==0L&&Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime()))||(Validator.isNotEmpty(classPeriodSectionVo.getStudyStartTime())&&startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue())){
                             startTotalTime = classPeriodSectionVo.getStudyStartTime();
                         }
-                        if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                        if((Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime==0L)||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
                             endTotalTime = classPeriodSectionVo.getStudyEndTime();
                         }
                         classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
@@ -1948,7 +2480,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     if(photoList.size()>0){
                         classPeriodVo.setStudyStartTime(photoList.get(0).getCreateTime());
                     }
-                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodVo.getStudyStartTime().longValue()){
+                    if((Validator.isNotEmpty(classPeriodVo.getStudyStartTime())&&startTotalTime==0L)||(Validator.isNotEmpty(classPeriodVo.getStudyStartTime())&&startTotalTime.longValue()>classPeriodVo.getStudyStartTime().longValue())){
                         startTotalTime = classPeriodVo.getStudyStartTime();
                     }
                     if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodVo.getStudyEndTime().longValue())){

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodChapterVo.java

@@ -133,6 +133,12 @@ public class ClassPeriodChapterVo implements Comparable<ClassPeriodChapterVo> {
 	@ApiModelProperty("审核人")
 	private String auditUserName;
 
+	@ApiModelProperty("做题类型  1测试 2考试")
+	private Integer doType;
+
+	@ApiModelProperty("模塊ID")
+	private Long moduleId;
+
 	@Override
 	public int compareTo(ClassPeriodChapterVo o) {
 		return this.getSort() - o.getSort();

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodSectionVo.java

@@ -175,6 +175,13 @@ public class ClassPeriodSectionVo implements Comparable<ClassPeriodSectionVo> {
 	private Long preStartTime;
 	@ApiModelProperty("上一次结束")
 	private Long preEndTime;
+	@ApiModelProperty("做题类型  1测试 2考试")
+	private Integer doType;
+	@ApiModelProperty("周查询开始时间")
+	private Long searchWeekStartTime;
+
+	@ApiModelProperty("周查询结束时间")
+	private Long searchWeekEndTime;
 	@Override
 	public int compareTo(ClassPeriodSectionVo o) {
 		return this.getSort() - o.getSort();

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportAllVo.java

@@ -20,7 +20,6 @@ import java.util.List;
 @ExcelTarget("classPeriodStudentExportVo")
 public class ClassPeriodStudentExportAllVo {
 	private static final long serialVersionUID = 1L;
-
 	/** 学员编码 */
 	@Excel(name = "学员编码")
 	@ApiModelProperty("学员编码")
@@ -73,9 +72,9 @@ public class ClassPeriodStudentExportAllVo {
 	@Excel(name = "节标题")
 	@ApiModelProperty("节标题")
 	private String sectionName;
-	@Excel(name = "节时长()")
-	@ApiModelProperty("节时长()")
-	private Long durationTime;
+	@Excel(name = "节时长(小时)")
+	@ApiModelProperty("节时长(小时)")
+	private BigDecimal durationTime;
 	@Excel(name = "学习/做题时间")
 	@ApiModelProperty("学习/做题时间")
 	private String studyTimeTxt;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportVo.java

@@ -46,6 +46,8 @@ public class ClassPeriodStudentExportVo {
 	@Excel(name = "身份证人像照")
 	@ApiModelProperty("身份证人像照")
 	private String idCardImg1;
+	@ApiModelProperty("国徽")
+	private String idCardImg2;
 	/** 商品ID */
 	@Excel(name = "商品名称")
 	@ApiModelProperty("商品名称")

+ 92 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportWeekAllVo.java

@@ -0,0 +1,92 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+/**
+ * 学员记录视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Data
+@ExcelTarget("classPeriodStudentExportVo")
+public class ClassPeriodStudentExportWeekAllVo {
+	private static final long serialVersionUID = 1L;
+	/** 学员编码 */
+	@Excel(name = "周时间")
+	@ApiModelProperty("周时间")
+	private String weekTime;
+	/** 学员编码 */
+	@Excel(name = "学员编码")
+	@ApiModelProperty("学员编码")
+	private String studentCode;
+	/** 学员编码 */
+	@Excel(name = "学员姓名")
+	@ApiModelProperty("学员姓名")
+	private String realName;
+	/** 学员编码 */
+	@Excel(name = "学员身份证")
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+	/** 学员编码 */
+	@Excel(name = "学员电话")
+	@ApiModelProperty("学员电话")
+	private String telPhone;
+	/** 一寸照片 */
+	@Excel(name = "一寸照片")
+	@ApiModelProperty("一寸照片")
+	private String oneInchPhotos;
+	/** 身份证人像照 */
+	@Excel(name = "身份证人像照")
+	@ApiModelProperty("身份证人像照")
+	private String idCardImg1;
+	/** 商品ID */
+	@Excel(name = "商品名称")
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+	/** 学时 */
+	@Excel(name = "学时")
+	@ApiModelProperty("学时")
+	private BigDecimal classHours;
+	@Excel(name = "服务有效期")
+	private String studyTimeStr;
+	@Excel(name = "所在班级")
+	private String className;
+	@Excel(name = "班级有效期")
+	private String classTimeStr;
+
+	@Excel(name = "序号")
+	@ApiModelProperty("序号")
+	private Long id;
+
+	@Excel(name = "模块标题")
+	@ApiModelProperty("模块标题")
+	private String moduleName;
+	@Excel(name = "章标题")
+	@ApiModelProperty("章标题")
+	private String chapterName;
+	@Excel(name = "节标题")
+	@ApiModelProperty("节标题")
+	private String sectionName;
+	@Excel(name = "节时长(小时)")
+	@ApiModelProperty("节时长(小时)")
+	private BigDecimal durationTime;
+	@Excel(name = "学习/做题时间")
+	@ApiModelProperty("学习/做题时间")
+	private String studyTimeTxt;
+	@Excel(name = "学习/做题时长")
+	@ApiModelProperty("学习/做题时长")
+	private String studyTimeLongTxt;
+	@Excel(name = "学习/做题状态")
+	@ApiModelProperty("学习/做题状态")
+	private String studyStatusTxt;
+	@Excel(name = "测试成绩")
+	@ApiModelProperty("测试成绩")
+	private BigDecimal score;
+}

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

@@ -221,4 +221,6 @@ public class ClassPeriodStudentVo {
 	private Long recordEndTime;
 	@ApiModelProperty("最近在线时间")
 	private Long onLineTime;
+	@ApiModelProperty("学习的总时长(秒)")
+	private Long studyTime;
 }

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

@@ -209,6 +209,12 @@ public class ClassPeriodVo implements Comparable<ClassPeriodVo> {
 
 	@ApiModelProperty("试卷ID")
 	private Long examId;
+	@ApiModelProperty("题卷类型 1章卷 2节卷 3模块卷")
+	private Integer examType;
+	/** 做卷类型  1测试 2考试 */
+	@Excel(name = "做卷类型  1测试 2考试")
+	@ApiModelProperty("做题类型  1测试 2考试")
+	private Integer doType;
 	@Override
 	public int compareTo(ClassPeriodVo o) {
 		if(o.getCourseSort()==this.getCourseSort()){

+ 29 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/WeekDataVo.java

@@ -0,0 +1,29 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 【请填写功能名称】视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+public class WeekDataVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private String  weekCxt;
+
+	@ApiModelProperty("周查询开始时间")
+	private Long searchWeekStartTime;
+
+	@ApiModelProperty("周查询结束时间")
+	private Long searchWeekEndTime;
+}

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

@@ -542,6 +542,14 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     public List<OrderGoodsVo> listUserVideoLive(GoodsQueryBo bo) {
         List<OrderGoodsVo> list = this.baseMapper.listUserVideoLive(bo);
         for(OrderGoodsVo goodsVo : list){
+            String fullName = goodsVo.getEducationName()+goodsVo.getBusinessName()+goodsVo.getProjectName();
+            goodsVo.setErJianErZao(false);
+            if(Validator.isNotEmpty(fullName)){
+                if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")){
+                    goodsVo.setErJianErZao(true);
+                }
+            }
+
             Long secLong = 0L;
             Long studyLong = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
@@ -573,6 +581,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
                 goodsVo.setLearningStatus(classGradeVo.getLearningStatus());
                 goodsVo.setInterfaceAccountId(classGradeVo.getInterfaceAccountId());
                 goodsVo.setLearnStatus(classGradeVo.getLearnStatus());
+                goodsVo.setPeriodWaitTime(classGradeVo.getPeriodWaitTime());
 
                 LambdaQueryWrapper<UserSubscribe> lq = Wrappers.lambdaQuery();
                 lq.eq(UserSubscribe::getOrderGoodsId, goodsVo.getOrderGoodsId());

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -79,8 +78,8 @@ import com.zhongzheng.modules.top.financial.service.ITopCostTpItemService;
 import com.zhongzheng.modules.top.financial.service.ITopCostTpService;
 import com.zhongzheng.modules.top.financial.vo.TopCostTpItemVo;
 import com.zhongzheng.modules.top.financial.vo.TopCostTpVo;
-import com.zhongzheng.modules.top.goods.bo.TopOldOrderGoodsAddBo;
-import com.zhongzheng.modules.top.goods.domain.*;
+import com.zhongzheng.modules.top.goods.domain.TopOldOrderCheck;
+import com.zhongzheng.modules.top.goods.domain.TopOldOrderCheckLog;
 import com.zhongzheng.modules.top.goods.service.ITopOldOrderCheckLogService;
 import com.zhongzheng.modules.top.goods.service.ITopOldOrderCheckService;
 import com.zhongzheng.modules.user.domain.User;
@@ -2312,7 +2311,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             map.forEach((k, v) -> {
                 ClassGradeSortBo sortBo = new ClassGradeSortBo();
                 sortBo.setKey(k);
-                Map<String, List<ClassGrade>> collect = v.stream().collect(Collectors.groupingBy(ClassGrade::getOfficialName));
+                Map<String, List<ClassGrade>> collect = v.stream().filter(x -> StringUtils.isNotBlank(x.getOfficialName())).collect(Collectors.groupingBy(ClassGrade::getOfficialName));
                 sortBo.setSize(collect.keySet().size());
                 sortList.add(sortBo);
             });

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

@@ -336,4 +336,9 @@ public class OrderGoodsVo {
 
 	@ApiModelProperty("是否外链商品:0否 1是")
 	private String distributionLinkCode;
+	@Excel(name = "学时变为待审核时间")
+	@ApiModelProperty("学时变为待审核时间")
+	private Long periodWaitTime;
+	@ApiModelProperty("是否是二建二造")
+	private Boolean erJianErZao;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/service/impl/TopNuoMplatformLogServiceImpl.java

@@ -194,6 +194,7 @@ public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLo
             snList.add(vo.getInvoiceSerialNum());
             if(snList.size()==10||i==(list.size()-1)){
                 String result = nuonuoService.queryInvoiceResult(snList);
+                System.out.println(result);
                 JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
                 String code = String.valueOf(jsonObject.get("code"));
                 JSONArray josnList = jsonObject.getJSONArray("result");
@@ -249,6 +250,7 @@ public class TopNuoMplatformLogServiceImpl extends ServiceImpl<TopNuoMplatformLo
                                 objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushTime, DateUtils.getNowTime());
                                 respone = HttpUtils.postFormBody(UpdateInvoice_PATH, params);
                                 objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushResult, respone);
+                                System.out.println("结果"+respone);
                                 if (!respone.contains("\"Status\":true")) {
                                     objectLambdaUpdateWrapper.set(TopNuoMplatformLog::getPushStatus, -1);
                                     this.update(null, objectLambdaUpdateWrapper);

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/sdk/vo/TopNuoMplatformLogVo.java

@@ -64,4 +64,5 @@ public class TopNuoMplatformLogVo {
 	@Excel(name = "失败原因")
 	@ApiModelProperty("失败原因")
 	private String failCause;
+	private String xmlUrl;
 }

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

@@ -43,4 +43,7 @@ public class SysTopTenantAddBo {
     @ApiModelProperty("发票信息")
     private SysTopTenantInvoiceBo invoiceBo;
 
+    @ApiModelProperty("教务电话")
+    private String eduPhone;
+
 }

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

@@ -46,4 +46,7 @@ public class SysTopTenantEditBo {
     @ApiModelProperty("发票信息")
     private SysTopTenantInvoiceBo invoiceBo;
 
+    @ApiModelProperty("教务电话")
+    private String eduPhone;
+
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java

@@ -101,4 +101,11 @@ private static final long serialVersionUID=1L;
     /** 发票信息JSON */
     private String invoiceInformation;
 
+    /** 教务电话 */
+    private String eduPhone;
+    /** 邮箱账号 */
+    private String postAccount;
+    /** 邮箱密码 */
+    private String postPassword;
+
 }

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

@@ -65,4 +65,7 @@ public class SysTenantVo {
 	@ApiModelProperty("发票信息")
 	private SysTopTenantInvoiceBo invoiceBo;
 
+	@ApiModelProperty("教务电话")
+	private String eduPhone;
+
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/tencentcloud/service/impl/FaceOcrServiceImpl.java

@@ -92,7 +92,7 @@ public class FaceOcrServiceImpl implements IFaceOcrService {
             CompareFaceRequest faceRequest = new CompareFaceRequest();
             faceRequest.setImageA(bo.getImageA()); //学习拍照
             faceRequest.setUrlB(oneInchPhotos); //一寸近照
-            faceRequest.setQualityControl(4L);
+            faceRequest.setQualityControl(2L);
             CompareFaceResponse response = iaiClient.CompareFace(faceRequest);
             return response.getScore().intValue();
         }catch (TencentCloudSDKException e){

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

@@ -188,4 +188,7 @@ public class TopOldOrderAddBo {
 
     @ApiModelProperty("是否需要完单标识:0不需要,1需要")
     private Integer finishSign;
+
+    @ApiModelProperty("财务备注")
+    private String financeRemark;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderEditBo.java

@@ -194,4 +194,8 @@ public class TopOldOrderEditBo {
     /** 分成审核状态 1正常 2待审核 3审核中  4审核不通过 5审核通过待支付 6已支付 */
     @ApiModelProperty("分成审核状态 1正常 2待审核 3审核中  4审核不通过 5审核通过待支付 6已支付")
     private Integer divideStatus;
+
+    /** 业务员备注 */
+    @ApiModelProperty("财务备注")
+    private String financeRemark;
 }

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderQueryBo.java

@@ -116,5 +116,31 @@ public class TopOldOrderQueryBo extends BaseEntity {
 	@ApiModelProperty("C端订单过滤时间")
 	private Long filtrationTime = 1685449126L;
 
+	@ApiModelProperty("订单来源")
+	private String orderOrg;
+
+	@ApiModelProperty("审核开始时间")
+	private Long checkStartTime;
+
+	@ApiModelProperty("审核结束时间")
+	private Long checkEndTime;
+
+	@ApiModelProperty("学员姓名")
+	private String userName;
+
+	@ApiModelProperty("月份时间(时间戳)")
+	private List<Long> monthTime;
+	/** 业务员名称 */
+	@ApiModelProperty("业务员名称")
+	private String createUsername;
+	/** 业务员名称ID */
+	@ApiModelProperty("业务员名称ID")
+	private Long createSysUserId;
+	/** 业务号 */
+	@ApiModelProperty("业务号")
+	private String createNo;
+	@ApiModelProperty("账单类型 (1月份 2季度 3半年 4年度)")
+	private Integer billType;
+
 
 }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/domain/TopOldOrder.java

@@ -1,7 +1,6 @@
 package com.zhongzheng.modules.top.goods.domain;
 
 import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
@@ -152,4 +151,7 @@ private static final long serialVersionUID=1L;
     private String purchaseOrg;
     /** 是否需要完单标识:0不需要,1需要 */
     private Integer finishSign;
+
+    /** 业务员备注 */
+    private String financeRemark;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopOldOrderMapper.java

@@ -29,6 +29,7 @@ public interface TopOldOrderMapper extends BaseMapper<TopOldOrder> {
 
     List<TopOldOrderVo> queryReceiveList(TopOldOrderQueryBo bo);
 
+    Long queryReceiveUnSum(TopOldOrderQueryBo bo);
 
     List<TopOldOrderVo> queryDivSellerList(TopOldOrderQueryBo bo);
 

+ 4 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopOldOrderService.java

@@ -9,12 +9,11 @@ import com.zhongzheng.modules.top.goods.domain.TopOldOrder;
 import com.zhongzheng.modules.top.goods.vo.TopOldOrderGoodsListVo;
 import com.zhongzheng.modules.top.goods.vo.TopOldOrderVo;
 import com.zhongzheng.modules.top.goods.vo.TopOrderStatisticsVo;
+import com.zhongzheng.modules.top.goods.vo.TopRefundOrderDetailVo;
 import com.zhongzheng.modules.top.order.bo.PayOrderCallBackBo;
-import com.zhongzheng.modules.top.order.bo.TopOrderRecNoteAddBo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCommissionExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
-import com.zhongzheng.modules.top.goods.vo.TopRefundOrderDetailVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderSellerExportVo;
 
 import java.util.Collection;
@@ -89,7 +88,7 @@ public interface ITopOldOrderService extends IService<TopOldOrder> {
 
 	boolean finishOrder(TopFinishOrderBo bo);
 
-	TopOrderStatisticsVo statisticsOrder();
+	TopOrderStatisticsVo statisticsOrder(TopOldOrderQueryBo bo);
 
 
 	List<TopOldOrderCompanyExportVo> tenantListExport(TopDivideLogQueryBo bo);
@@ -133,4 +132,6 @@ public interface ITopOldOrderService extends IService<TopOldOrder> {
 	boolean editOrderBrokerage(OrderBrokerageBo bo);
 
 	void informRemindOrderCheck(String result);
+
+	boolean updateFinanceRemark(TopUpdateRemarkBo bo);
 }

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

@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.core.domain.entity.SysUser;
@@ -23,37 +22,30 @@ import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
-import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.course.domain.CourseSubject;
 import com.zhongzheng.modules.course.service.ICourseSubjectService;
-import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.inform.bo.InformSysUserAddBo;
-import com.zhongzheng.modules.inform.bo.InformUserAddBo;
-import com.zhongzheng.modules.inform.domain.InformRemindRelevance;
-import com.zhongzheng.modules.inform.service.IInformRemindRelevanceService;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformSysUserService;
 import com.zhongzheng.modules.inform.vo.InformRemindVo;
 import com.zhongzheng.modules.order.domain.*;
 import com.zhongzheng.modules.order.service.*;
+import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.sdk.domain.TopNuoMplatformLog;
 import com.zhongzheng.modules.sdk.service.ITopNuoMplatformLogService;
 import com.zhongzheng.modules.system.bo.SysTenantBadBillConfigBo;
-import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
-import com.zhongzheng.modules.top.financial.bo.TopDivideLogQueryBo;
 import com.zhongzheng.modules.system.vo.SysTenantAccountVo;
 import com.zhongzheng.modules.top.financial.bo.*;
 import com.zhongzheng.modules.top.financial.domain.*;
-import com.zhongzheng.modules.top.financial.domain.TopCostTp;
 import com.zhongzheng.modules.top.financial.service.*;
 import com.zhongzheng.modules.top.financial.vo.*;
 import com.zhongzheng.modules.top.goods.bo.*;
@@ -62,32 +54,25 @@ import com.zhongzheng.modules.top.goods.mapper.TopOldOrderMapper;
 import com.zhongzheng.modules.top.goods.service.*;
 import com.zhongzheng.modules.top.goods.vo.*;
 import com.zhongzheng.modules.top.order.bo.PayOrderCallBackBo;
-import com.zhongzheng.modules.top.order.bo.TopOrderRecNoteAddBo;
 import com.zhongzheng.modules.top.order.domain.TopOrderBankPay;
 import com.zhongzheng.modules.top.order.service.ITopOrderBankPayService;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCommissionExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
+import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderSellerExportVo;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
 import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
 import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserRoleService;
-import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
 import com.zhongzheng.modules.top.user.service.ITopSysUserService;
 import com.zhongzheng.modules.user.domain.User;
-import com.zhongzheng.modules.user.domain.UserSubscribe;
 import com.zhongzheng.modules.user.service.IUserService;
-import com.zhongzheng.modules.user.vo.UserSubscribeVo;
-import com.zhongzheng.modules.user.vo.UserVo;
-import net.sf.jsqlparser.statement.select.Top;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -245,6 +230,9 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
     @Value("${oldOrder.refundPayHandle}")
     private String REFUND_PAY_HANDLE;
 
+    @Value("${oldOrder.updateRemark}")
+    private String UPDATE_REMARK;
+
 
     @Override
     public TopOldOrderVo queryById(String orderSn) {
@@ -955,6 +943,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
             if (CollectionUtils.isNotEmpty(list)) {
                 list.forEach(item -> {
                     item.setUserCount(1);
+                    item.setCheckStatusStr(item.getCheckStr(item.getCheckStatus()));
                     //专业
                     if (StringUtils.isNotBlank(item.getSubjectIds())) {
                         List<CourseSubject> subjectList = courseSubjectService.listByIds(Arrays.asList(item.getSubjectIds().split(",")));
@@ -1038,10 +1027,12 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         //数据处理
         for (TopOldOrderGoodsListVo item : list) {
             item.setUserCount(userCount);
+            item.setCheckStatusStr(item.getCheckStr(item.getCheckStatus()));
         }
         return list;
     }
 
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean checkOrder(TopOldOrderCheckBo bo) {
@@ -1779,6 +1770,53 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
 
     }
 
+    @Override
+    public boolean updateFinanceRemark(TopUpdateRemarkBo bo) {
+        //查询视图 v_top_order
+        List<TopOldOrderVo> orderVos = baseMapper.queryByOrderSns(bo.getOrderSnList());
+        if (CollectionUtils.isEmpty(orderVos)) {
+            throw new CustomException("订单号有误!");
+        }
+        Map<Integer, List<TopOldOrderVo>> map = orderVos.stream().collect(Collectors.groupingBy(TopOldOrderVo::getOrderFrom));
+        List<String> oldOrderSn = new ArrayList<>();
+        map.forEach((k, v) -> {
+            if (k == 1) {
+                //新系统订单
+                orderService.update(new LambdaUpdateWrapper<Order>()
+                        .set(Order::getRemark, bo.getRemark())
+                        .in(Order::getOrderSn, v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList())));
+            } else {
+                update(new LambdaUpdateWrapper<TopOldOrder>()
+                        .set(TopOldOrder::getFinanceRemark, bo.getRemark())
+                        .in(TopOldOrder::getOrderSn, v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList())));
+
+                oldOrderSn.addAll(v.stream().map(TopOldOrderVo::getOrderSn).collect(Collectors.toList()));
+            }
+        });
+
+        if (CollectionUtils.isNotEmpty(oldOrderSn)){
+            //修改备注
+            Map<String, String> params = new HashMap<>();
+            Long nowTime = DateUtils.getNowTime();
+            String sign = ToolsUtils.EncoderByMd5( nowTime.toString() + "pubilc2022");
+            params.put("stamp", nowTime.toString());
+            params.put("sign", sign);
+            params.put("orderSn", oldOrderSn.stream().collect(Collectors.joining(",")));
+            params.put("remark", bo.getRemark());
+            String respone = "";
+            try {
+                respone = HttpUtils.postFormBody(UPDATE_REMARK, params);
+                if (!respone.contains("\"Status\":true")) {
+                    throw new CustomException("旧系统修改备注接口请求错误!");
+                }
+            } catch (IOException e) {
+                log.error("旧系统修改备注接口请求错误" + respone);
+                throw new CustomException("旧系统修改备注接口请求错误");
+            }
+        }
+        return true;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean orderRefundApply(TopOrderRefundApplyBo bo) {
@@ -2668,11 +2706,25 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
     }
 
     @Override
-    public TopOrderStatisticsVo statisticsOrder() {
+    public TopOrderStatisticsVo statisticsOrder(TopOldOrderQueryBo bo) {
+        //查询视图 v_top_order
+        if (ObjectUtils.isNotNull(bo.getEducationTypeId())) {
+            TopCourseEducationType educationType = topCourseEducationTypeService.getById(bo.getEducationTypeId());
+            if (StringUtils.isNotBlank(educationType.getSchemeName())) {
+                bo.setBusinessFullName(educationType.getSchemeName() + educationType.getEducationName());
+            } else {
+                bo.setBusinessFullName(educationType.getEducationName());
+            }
+        }
+        if (ObjectUtils.isNotNull(bo.getBusinessId())) {
+            String name = topCourseBusinessService.getBusinessFullName(bo.getBusinessId());
+            bo.setBusinessFullName(name);
+        }
+
         TopOrderStatisticsVo vo = new TopOrderStatisticsVo();
         //订单统计
         //查询视图 v_top_order
-        List<TopOldOrderVo> vos = baseMapper.queryListAll();
+        List<TopOldOrderVo> vos = baseMapper.queryList(bo);
         if (CollectionUtils.isEmpty(vos)) {
             return vo;
         }
@@ -2684,19 +2736,24 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         BigDecimal practical = received.subtract(refunded);
         BigDecimal cost = vos.stream().filter(x -> ObjectUtils.isNotNull(x.getOrderCost())).map(TopOldOrderVo::getOrderCost).reduce(BigDecimal.ZERO, BigDecimal::add);
         //订单学员数
-        Integer orderUserNum = 0;
+        Set<String> userCard = new HashSet<>();
         for (TopOldOrderVo orderVo : vos) {
-            if (orderVo.getOrderFrom() == 2) {
-                //业务系统B端订单
+            if (orderVo.getOrderFrom() != 1) {
+                //旧系统订单
                 List<TopOldOrderGoods> list = topOrderGoodsService
-                        .list(new LambdaQueryWrapper<TopOldOrderGoods>().eq(TopOldOrderGoods::getOrderSn, orderVo.getOrderSn()).eq(TopOldOrderGoods::getStatus, 1));
+                        .list(new LambdaQueryWrapper<TopOldOrderGoods>()
+                                .eq(TopOldOrderGoods::getOrderSn, orderVo.getOrderSn())
+                                .eq(TopOldOrderGoods::getStatus, 1)
+                                .ne(TopOldOrderGoods::getCheckStatus,-1));
                 if (CollectionUtils.isNotEmpty(list)) {
-                    Set<String> collect = list.stream().map(TopOldOrderGoods::getUserCard).collect(Collectors.toSet());
-                    orderUserNum += collect.size();
+                    list.forEach(x -> userCard.add(x.getUserCard()));
                 }
             } else {
-                //C端  一单一人
-                orderUserNum += 1;
+                //新系统订单
+                User user = userService.getById(orderVo.getUserId());
+                if (ObjectUtils.isNotNull(user)){
+                    userCard.add(user.getIdCard());
+                }
             }
         }
         Integer orderNum = vos.size();
@@ -2707,7 +2764,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         vo.setOrderUncollectedTotal(uncollected);
         vo.setPracticalPriceTotal(practical);
         vo.setOrderCostTotal(cost);
-        vo.setOrderUserNum(orderUserNum);
+        vo.setOrderUserNum(userCard.size());
         vo.setOrderNum(orderNum);
         return vo;
     }
@@ -3687,18 +3744,72 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
             throw new CustomException("参数缺少");
         }
         if (bo.getTotalType() == 1) {
-            List<TopOldOrderVo> vos = baseMapper.queryListAll();
-//        BigDecimal price = vos.stream().filter(x -> ObjectUtils.isNotNull(x.getOrderPrice())).map(TopOldOrderVo::getOrderPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
-//        BigDecimal received = vos.stream().filter(x -> ObjectUtils.isNotNull(x.getOrderReceived())).map(TopOldOrderVo::getOrderReceived).reduce(BigDecimal.ZERO, BigDecimal::add);
-            BigDecimal uncollected = vos.stream().filter(x -> ObjectUtils.isNotNull(x.getOrderUncollected()) && x.getCheckStatus() == 1).map(TopOldOrderVo::getOrderUncollected).reduce(BigDecimal.ZERO, BigDecimal::add);
-/*        map.put("orderPriceTotal", price);
-        map.put("orderReceivedTotal", received);*/
+            String badBillJson = topConfigService.selectConfigByKeyNoCache("bad_bill");
+            Calendar c = Calendar.getInstance();
+            c.add(Calendar.YEAR, -1);
+            Long year1 = c.getTimeInMillis() / 1000;
+            c.add(Calendar.YEAR, -1);
+            Long year2 = c.getTimeInMillis() / 1000;
+            c.add(Calendar.YEAR, -1);
+            Long year3 = c.getTimeInMillis() / 1000;
+            c.add(Calendar.YEAR, -1);
+            Long year4 = c.getTimeInMillis() / 1000;
+            c.add(Calendar.YEAR, -1);
+            Long year5 = c.getTimeInMillis() / 1000;
+            c.add(Calendar.YEAR, -50);
+            Long year50 = c.getTimeInMillis() / 1000;
+            if (Validator.isEmpty(badBillJson)) {
+                bo.setBadBill(null);
+            } else {
+                List<TopBadBillTimeBo> badBillList = new ArrayList<>();
+                List<SysTenantBadBillConfigBo> configList = JSONArray.parseArray(badBillJson, SysTenantBadBillConfigBo.class);
+                for (SysTenantBadBillConfigBo configBo : configList) {
+                    if (configBo.getYearType() == 1) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year50);
+                        timeBo.setEndTime(year1);
+                        badBillList.add(timeBo);
+                    }
+                    if (configBo.getYearType() == 2) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year2);
+                        timeBo.setEndTime(year1);
+                        badBillList.add(timeBo);
+                    }
+                    if (configBo.getYearType() == 3) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year3);
+                        timeBo.setEndTime(year2);
+                        badBillList.add(timeBo);
+                    }
+                    if (configBo.getYearType() == 4) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year4);
+                        timeBo.setEndTime(year3);
+                        badBillList.add(timeBo);
+                    }
+                    if (configBo.getYearType() == 5) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year5);
+                        timeBo.setEndTime(year4);
+                        badBillList.add(timeBo);
+                    }
+                    if (configBo.getYearType() == 6) {
+                        TopBadBillTimeBo timeBo = new TopBadBillTimeBo();
+                        timeBo.setStartTime(year50);
+                        timeBo.setEndTime(year5);
+                        badBillList.add(timeBo);
+                    }
+                }
+                bo.setBadBillList(badBillList);
+            }
+            Long uncollected= baseMapper.queryReceiveUnSum(bo);
             map.put("orderUncollectedTotal", uncollected); //未收账款
 
         }
         if (bo.getTotalType() == 2) {
             //机构分成
-            TopDivideLogQueryBo queryBo1 = new TopDivideLogQueryBo();
+            TopDivideLogQueryBo queryBo1 = BeanUtil.toBean(bo,TopDivideLogQueryBo.class);
             queryBo1.setDivideType(1);
             TopDivideLogVo vo1 = iTopDivideLogService.getSumMoney(queryBo1);
             map.put("unDeductMoneyTotal", Validator.isEmpty(vo1) ? 0 : vo1.getUnDeductMoneyTotal());
@@ -3708,7 +3819,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         }
         if (bo.getTotalType() == 3) {
             //3业务员提成
-            TopDivideLogQueryBo queryBo1 = new TopDivideLogQueryBo();
+            TopDivideLogQueryBo queryBo1 = BeanUtil.toBean(bo,TopDivideLogQueryBo.class);
             queryBo1.setDivideType(2);
             TopDivideLogVo vo1 = iTopDivideLogService.getSumMoney(queryBo1);
             map.put("unDeductMoneyTotal", Validator.isEmpty(vo1) ? 0 : vo1.getUnDeductMoneyTotal());
@@ -3718,7 +3829,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         }
         if (bo.getTotalType() == 4) {
             //4佣金结算
-            TopDivideLogQueryBo queryBo1 = new TopDivideLogQueryBo();
+            TopDivideLogQueryBo queryBo1 = BeanUtil.toBean(bo,TopDivideLogQueryBo.class);
             queryBo1.setDivideType(3);
             TopDivideLogVo vo1 = iTopDivideLogService.getSumMoney(queryBo1);
             map.put("unPayMoneyTotal", Validator.isEmpty(vo1) ? 0 : vo1.getUnPayMoneyTotal());

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderGoodsListVo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.top.goods.vo;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -35,17 +36,21 @@ public class TopOldOrderGoodsListVo {
 	private BigDecimal goodsPrice;
 	/** 商品成交价格 */
 	@ApiModelProperty("商品成交价格")
+	@Excel(name = "单价")
 	private BigDecimal goodsRealPrice;
 	/** 专业名称 */
 	@ApiModelProperty("专业名称")
+	@Excel(name = "专业")
 	private String majorName;
 	/** 商品名称 */
 	@ApiModelProperty("商品名称")
+	@Excel(name = "课程")
 	private String goodsName;
 	@ApiModelProperty("商品类型")
 	private Integer goodsType;
 	/** 业务名称 */
 	@ApiModelProperty("业务名称")
+	@Excel(name = "业务")
 	private String businessName;
 	@ApiModelProperty("业务全称")
 	private String businessFullName;
@@ -53,14 +58,18 @@ public class TopOldOrderGoodsListVo {
 	private String subjectIds;
 	/** 学习状态:0未开始,1学习中,2已结束 */
 	@ApiModelProperty("学习状态:0未开始,1学习中,2已结束")
+	@Excel(name = "学习状态")
 	private String studyStatus;
 	@ApiModelProperty("学员ID")
 	private String userId;
 	@ApiModelProperty("学员名称")
+	@Excel(name = "姓名")
 	private String userName;
 	@ApiModelProperty("学员身份证")
+	@Excel(name = "身份证")
 	private String userCard;
 	@ApiModelProperty("学员手机号码")
+	@Excel(name = "手机号码")
 	private String userPhone;
 	@ApiModelProperty("学员数量")
 	private Integer userCount;
@@ -69,4 +78,34 @@ public class TopOldOrderGoodsListVo {
 
 	private Long signId;
 
+	@Excel(name = "开通状态")
+	private String checkStatusStr;
+
+	public String getCheckStr(Integer checkStatus) {
+		String str = "";
+		if (ObjectUtil.isNull(checkStatus)){
+			return str;
+		}
+		switch (checkStatus){
+			case 0:
+				str = "待审核";
+				break;
+			case 1:
+				str = "已通过";
+				break;
+			case 2:
+				str = "未通过";
+				break;
+			case 3:
+				str = "已撤销";
+				break;
+			case -1:
+				str = "已更换新的学员";
+				break;
+			default :
+				break;
+		}
+		return str;
+	}
+
 }

+ 25 - 33
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderVo.java

@@ -5,9 +5,11 @@ import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
@@ -37,89 +39,72 @@ public class TopOldOrderVo {
 	@ApiModelProperty("订单标准价格")
 	private BigDecimal orderPrice;
 	/** 支付订单号 */
-	@Excel(name = "支付订单号")
 	@ApiModelProperty("支付订单号")
 	private String orderGeneral;
 	/** 订单状态 -2 超时关闭,-1手动关闭,0待支付,1已支付 3部分已退款 4完全退款 */
-	@Excel(name = "订单状态 -2 超时关闭,-1手动关闭,0待支付,1已支付 3部分已退款 4完全退款")
 	@ApiModelProperty("订单状态 -2 超时关闭,-1手动关闭,0待支付,1已支付 3部分已退款 4完全退款")
 	private Integer orderStatus;
 	/** 支付时间 */
-	@Excel(name = "支付时间")
 	@ApiModelProperty("支付时间")
 	private Long payTime;
 	/** 支付平台  */
-	@Excel(name = "支付平台 ")
 	@ApiModelProperty("支付平台 ")
 	private Integer payType;
 	/** 微信流水号 */
-	@Excel(name = "微信流水号")
 	@ApiModelProperty("微信流水号")
 	private String transid;
 	/** 关闭时间 */
-	@Excel(name = "关闭时间")
 	@ApiModelProperty("关闭时间")
 	private Long cancelTime;
 	/** 订单完成时间 */
-	@Excel(name = "订单完成时间")
 	@ApiModelProperty("订单完成时间")
 	private Long finishTime;
 	/** 订单类型   1线上,2线下 */
-	@Excel(name = "订单类型   1线下,2线上")
 	@ApiModelProperty("订单类型   1线下,2线上")
 	private Integer orderType;
 	/** 支付价格(成交价) */
-	@Excel(name = "支付价格(成交价)")
+	@Excel(name = "金额")
 	@ApiModelProperty("支付价格(成交价)")
 	private BigDecimal payPrice;
 	/** 订单来源 1新系统C端订单,2旧系统C端订单,3旧系统B端订单  */
-	@Excel(name = "订单来源 1新系统C端订单,2旧系统C端订单,3旧系统B端订单 ")
 	@ApiModelProperty("订单来源 1新系统C端订单,2旧系统C端订单,3旧系统B端订单 ")
 	private Integer orderFrom;
 	/** 底单:1新系统,2旧系统  */
 	@ApiModelProperty("底单:1新系统,2旧系统")
 	private Integer orderBase;
 	/** 业务员名称 */
-	@Excel(name = "业务员名称")
+	@Excel(name = "业务员")
 	@ApiModelProperty("业务员名称")
 	private String createUsername;
 	/** 1有效 0无效 */
-	@Excel(name = "1有效 0无效")
 	@ApiModelProperty("1有效 0无效")
 	private Integer status;
 	/** 业务员名称ID */
-	@Excel(name = "业务员名称ID")
 	@ApiModelProperty("业务员名称ID")
 	private Long createSysUserId;
 	/** 业务号 */
-	@Excel(name = "业务号")
 	@ApiModelProperty("业务号")
+	@Excel(name = "业务编员")
 	private String createNo;
 	/** 录单订单编号 */
-	@Excel(name = "录单订单编号")
 	@ApiModelProperty("录单订单编号")
 	private String inputOrderSn;
 	/** 支付状态 0未收费,1部分付款  2完全付款 3免费 */
-	@Excel(name = "支付状态 0未收费,1部分付款  2完全付款 3免费")
 	@ApiModelProperty("支付状态 0未收费,1部分付款  2完全付款 3免费")
 	private Integer payStatus;
 	/** 审核状态:0待审核,1已通过,2未通过,3已撤销 */
-	@Excel(name = "审核状态:0待审核,1已通过,2未通过,3已撤销")
 	@ApiModelProperty("审核状态:0待审核,1已通过,2未通过,3已撤销")
 	private Integer checkStatus;
 	/** 审核意见 */
 	@ApiModelProperty("审核意见")
 	private String checkReason;
 	/** 退款状态:0待审核,1未通过,2未退款,3已完成 */
-	@Excel(name = "退款状态:0待审核,1正常,2未退款,3已完成,4未通过")
 	@ApiModelProperty("退款状态:0待审核,1正常,2未退款,3已完成,4未通过")
 	private Integer refundStatus;
 	/** 账款状态:0未结清,1已结清 */
-	@Excel(name = "账款状态:0未结清,1已结清")
 	@ApiModelProperty("账款状态:0未结清,1已结清")
 	private Integer creditStatus;
 	/** 发票状态:0未开票,1已开票 */
-	@Excel(name = "发票状态:0未开票,1已开票")
 	@ApiModelProperty("发票状态:0未开票,1已开票")
 	private Integer invoiceStatus;
 	/** 完单状态:0未完单,1已完单 */
@@ -134,34 +119,44 @@ public class TopOldOrderVo {
 	@ApiModelProperty("成本(元)")
 	private BigDecimal orderCost;
 	/** 退款(元) */
-	@Excel(name = "退款" , readConverterExp = "元=")
 	@ApiModelProperty("退款(元)")
 	private BigDecimal orderRefund;
 	/** 已退(元) */
-	@Excel(name = "已退" , readConverterExp = "元=")
+	@Excel(name = "退款")
 	@ApiModelProperty("已退(元)")
 	private BigDecimal orderRefunded;
 	/** 未收账款(元) */
-	@Excel(name = "未收账款" , readConverterExp = "元=")
+	@Excel(name = "未收")
 	@ApiModelProperty("未收账款(元)")
 	private BigDecimal orderUncollected;
 	/** 实收账款(元) */
-	@Excel(name = "已收账款" , readConverterExp = "元=")
+	@Excel(name = "已收")
 	@ApiModelProperty("已收账款(元)")
 	private BigDecimal orderReceived;
-	@Excel(name = "实际账款" , readConverterExp = "元=")
+
 	@ApiModelProperty("实际账款(元)")
 	private BigDecimal orderPractical;
 	/** 备注 */
-	@Excel(name = "备注")
-	@ApiModelProperty("备注")
+	@Excel(name = "业务员备注")
+	@ApiModelProperty("业务员备注")
 	private String remark;
+	/** 备注 */
+	@Excel(name = "财务备注")
+	@ApiModelProperty("财务备注")
+	private String financeRemark;
+
+	public String getOrderBusiness() {
+		if (CollectionUtils.isEmpty(this.businessNames)){
+			return "";
+		}
+		return this.businessNames.stream().collect(Collectors.joining(","));
+	}
+
 	/** 业务分类 */
-	@Excel(name = "业务分类")
+	@Excel(name = "业务类")
 	@ApiModelProperty("业务分类")
 	private String orderBusiness;
 	/** 成本设置 */
-	@Excel(name = "成本设置")
 	@ApiModelProperty("成本设置")
 	private String costJson;
 	/** 订单来源系统名称 */
@@ -212,19 +207,15 @@ public class TopOldOrderVo {
 	@ApiModelProperty("下单时间")
 	private Long buyTime;
 	/** 分成模式 1机构分成 2业务员分成 */
-	@Excel(name = "分成模式 1机构分成 2业务员分成")
 	@ApiModelProperty("分成模式 1机构分成 2业务员分成")
 	private Integer divideModel;
 	/** 机构分成钱 */
-	@Excel(name = "机构分成钱")
 	@ApiModelProperty("机构分成钱")
 	private BigDecimal divideCompanyMoney;
 	/** 业务员分成钱 */
-	@Excel(name = "业务员分成钱")
 	@ApiModelProperty("业务员分成钱")
 	private BigDecimal divideSellerMoney;
 	/** 分成审核状态 1正常 2待审核 3审核中  4审核不通过 5审核通过待支付 6已支付 */
-	@Excel(name = "分成审核状态 1正常 2待审核 3审核中  4审核不通过 5审核通过待支付 6已支付")
 	@ApiModelProperty("分成审核状态 1正常 2待审核 3审核中  4审核不通过 5审核通过待支付 6已支付")
 	private Integer divideStatus;
 
@@ -275,6 +266,7 @@ public class TopOldOrderVo {
 	private boolean badBill;
 
 	@ApiModelProperty("下单企业")
+	@Excel(name = "客户名称")
 	private String purchaseOrg;
 
 	@ApiModelProperty("审核标识:0审核,1不审核")

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно