he2802 2 anos atrás
pai
commit
820bf382a6
35 arquivos alterados com 542 adições e 62 exclusões
  1. 44 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  2. 8 1
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java
  3. 3 3
      zhongzheng-admin/src/main/resources/application-dev.yml
  4. 3 3
      zhongzheng-admin/src/main/resources/application-pre.yml
  5. 3 3
      zhongzheng-admin/src/main/resources/application-prod.yml
  6. 3 3
      zhongzheng-admin/src/main/resources/application-trial.yml
  7. 6 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java
  8. 4 2
      zhongzheng-api/src/main/resources/application-dev.yml
  9. 3 3
      zhongzheng-api/src/main/resources/application-pre.yml
  10. 3 3
      zhongzheng-api/src/main/resources/application-prod.yml
  11. 3 3
      zhongzheng-api/src/main/resources/application-trial.yml
  12. 1 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java
  13. 6 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java
  14. 0 6
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java
  15. 10 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionWatchPerServiceImpl.java
  16. 8 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseTopicServiceImpl.java
  17. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java
  18. 345 8
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  19. 17 11
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  20. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java
  21. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java
  22. 21 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java
  23. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantAddBo.java
  24. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantEditBo.java
  25. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantQueryBo.java
  26. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java
  27. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysOperLogServiceImpl.java
  28. 3 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java
  29. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/SubjectStudyRecordVo.java
  30. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java
  31. 3 0
      zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml
  32. 2 2
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml
  33. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml
  34. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/system/SysTenantMapper.xml
  35. 11 2
      zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

+ 44 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -1,7 +1,10 @@
 package com.zhongzheng.controller.common;
 
 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.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.annotation.Log;
@@ -36,6 +39,7 @@ import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.system.bo.SysTenantAdminBo;
+import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
@@ -390,6 +394,7 @@ public class CommonController
     }
 
 
+
     @ApiOperation("decodeTel")
     @GetMapping("common/free/decodeTel")
     public AjaxResult<String> decodeTel(String key) {
@@ -404,4 +409,43 @@ public class CommonController
     public AjaxResult payCashCallBack(@RequestBody DistributionCashWithdrawalPayBo bo) {
         return AjaxResult.success("成功", iDistributionCashWithdrawalService.payCashCallBack(bo) ? 1 : 0);
     }
+
+    /**
+     * 获取企业ID
+     */
+    @ApiOperation("获取企业ID")
+    @GetMapping("common/free/findTenantId")
+    public AjaxResult<String> findTenantId(SysTenantQueryBo bo) {
+        Long tenantId = iSysTenantService.findTenantId(bo);
+        if(Validator.isNotEmpty(tenantId)){
+            return AjaxResult.success("成功",tenantId.toString());
+        }else{
+            if(Validator.isNotEmpty(bo.getHostH5())&&bo.getHostH5().equals("120.79.166.78:19012")){
+                return AjaxResult.success("成功","867735392558919680");
+            }
+            if(Validator.isNotEmpty(bo.getHostLive())&&bo.getHostLive().equals("120.79.166.78:19012")){
+                return AjaxResult.success("成功","867735392558919680");
+            }
+            if(Validator.isNotEmpty(bo.getHostPc())&&bo.getHostPc().equals("120.79.166.78:19012")){
+                return AjaxResult.success("成功","867735392558919680");
+            }
+            if(Validator.isNotEmpty(bo.getHostAdmin())&&bo.getHostAdmin().equals("120.79.166.78:19012")){
+                return AjaxResult.success("成功","867735392558919680");
+            }
+            return AjaxResult.error(511,"失败",null);
+        }
+    }
+
+    /**
+     * 获取企业ID
+     */
+    @ApiOperation("获取系统配置")
+    @GetMapping("common/free/config")
+    public AjaxResult<Map<String,Object>> findConfig(SysTenantQueryBo bo) {
+        Map<String,Object> map = new HashMap<>();
+        String jsonStr = configService.selectConfigByKey("home.header");
+        JSONObject objectJson = JSON.parseObject(jsonStr);
+        map.put("companyName",String.valueOf(objectJson.get("companyName")));
+        return AjaxResult.success(map);
+    }
 }

+ 8 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -403,7 +403,7 @@ public class ScheduleController extends BaseController {
         //茂名市建设培训学校 680980002459417532
         //肇庆市建筑业协会 480813706424615769
 //        List<String> tenantIds = Arrays.asList("972001468256950403", "680980002459417532", "480813706424615769");
-        List<String> tenantIds = Arrays.asList("393436084591672437");
+        List<String> tenantIds = Arrays.asList("24330002165216496");
         tenantIds.forEach(tenantId -> {
             iScheduleService.synchronizationGoodsByTenantId(tenantId);
         });
@@ -417,4 +417,11 @@ public class ScheduleController extends BaseController {
         return AjaxResult.success();
     }
 
+    @ApiOperation("同步一建商品(山西)")
+    @GetMapping("/goods/copy/one")
+    public AjaxResult goodsCopyOne(){
+        iScheduleService.goodsCopyOne();
+        return AjaxResult.success();
+    }
+
 }

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

@@ -153,7 +153,7 @@ wisdomExamRoom:
 certificate:
     host: http://192.168.1.38:8000/
 
-liveGotoURL: http://120.79.166.78:19014/
+liveGotoURL: http://
 
 enCodeVersion: develop
 
@@ -168,8 +168,8 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
 

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

@@ -128,7 +128,7 @@ wisdomExamRoom:
 certificate:
     host: http://192.168.1.38:8000/
 
-liveGotoURL: http://120.79.166.78:19010/
+liveGotoURL: http://
 
 enCodeVersion: trial
 
@@ -143,8 +143,8 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
 

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

@@ -128,7 +128,7 @@ wisdomExamRoom:
 certificate:
     host: https://m.xyyxt.net/
 
-liveGotoURL: https://web.xyyxt.net/
+liveGotoURL: https://
 
 enCodeVersion: release
 
@@ -143,8 +143,8 @@ oldStudySys:
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
 

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

@@ -128,7 +128,7 @@ wisdomExamRoom:
 certificate:
     host: https://m.xyyxt.net/
 
-liveGotoURL: https://web.xyyxt.net/
+liveGotoURL: https://
 
 enCodeVersion: release
 
@@ -143,7 +143,7 @@ oldStudySys:
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6

+ 6 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.controller.user;
 
 import cn.hutool.core.lang.Validator;
+import com.alibaba.fastjson.JSON;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
@@ -9,6 +10,7 @@ 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.user.bo.*;
@@ -23,6 +25,8 @@ import com.zhongzheng.modules.wx.bo.WxLoginBody;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -51,6 +55,8 @@ public class UserController extends BaseController {
     private final IUserVisitLogService iUserVisitLogService;
 
     private final WxLoginService wxLoginService;
+
+    private static Logger log = LoggerFactory.getLogger(UserController.class);
     /**
      * 修改客户端用户
      */

+ 4 - 2
zhongzheng-api/src/main/resources/application-dev.yml

@@ -155,8 +155,10 @@ certificate:
     host: http://192.168.1.38:8000/
 
 
+
 liveGotoURL: http://120.79.166.78:19014/
 
+
 enCodeVersion: trial
 
 oldStudySys:
@@ -170,7 +172,7 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246

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

@@ -128,7 +128,7 @@ wisdomExamRoom:
 certificate:
     host: http://192.168.1.38:8000/
 
-liveGotoURL: http://120.79.166.78:19010/
+liveGotoURL: http://
 
 enCodeVersion: trial
 
@@ -143,7 +143,7 @@ oldStudySys:
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246

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

@@ -140,7 +140,7 @@ wisdomExamRoom:
 certificate:
     host: https://m.xyyxt.net/
 
-liveGotoURL: https://web.xyyxt.net/
+liveGotoURL: https://
 
 enCodeVersion: release
 
@@ -155,7 +155,7 @@ oldStudySys:
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6

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

@@ -140,7 +140,7 @@ wisdomExamRoom:
 certificate:
     host: https://m.xyyxt.net/
 
-liveGotoURL: https://web.xyyxt.net/
+liveGotoURL: https://
 
 enCodeVersion: release
 
@@ -155,7 +155,7 @@ oldStudySys:
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
 
 officialPush:
-    infoPath: http://jypt.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: http://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6

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

@@ -197,7 +197,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     }
 
     private Long createTenantId(){
-        String randomNumeric = RandomStringUtils.randomNumeric(18);
+        String randomNumeric = RandomStringUtils.randomNumeric(15);
         int count = count(new LambdaQueryWrapper<SysTenant>()
                 .eq(SysTenant::getTenantId, Long.valueOf(randomNumeric)));
         if (count == 0){

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

@@ -1239,6 +1239,9 @@ public class WxLoginService implements IWxLoginService {
 
     //公众号获取用户信息
     public User bindWxGzhUnionIdUser(WxLoginBody loginBody) {
+        if(Validator.isEmpty(loginBody.getCode())){
+            throw new CustomException("code不能为空");
+        }
         initData();
         String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
         String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
@@ -1262,7 +1265,9 @@ public class WxLoginService implements IWxLoginService {
         }
         if (Validator.isEmpty(user.getGzhOpenId())) {
             user.setGzhOpenId(openId);
-            user.setUnionId(unionId);
+            if(Validator.isNotEmpty(unionId)&&!unionId.equals("null")){
+                user.setUnionId(unionId);
+            }
             iUserService.updateById(user);
         }
         return user;

+ 0 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -85,12 +85,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     @Override
     public List<ExamVo> getList(ExamQueryBo bo) {
         List<ExamVo> list = examMapper.getList(bo);
-        if (ObjectUtils.isNotNull(bo.getExclude()) && bo.getExclude() == 1){
-            //排除随机练习和每日一练试卷类型
-            List<String> paperNames = Arrays.asList("每日一练", "随机练习");
-            list = list.stream().filter(x -> StringUtils.isBlank(x.getPaperName())
-                     || !paperNames.contains(x.getPaperName())).collect(Collectors.toList());
-        }
         return list;
     }
 

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

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CheckSectionWatchVo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerAddBo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerBo;
@@ -20,6 +21,7 @@ import com.zhongzheng.modules.course.service.ICourseSectionWatchPerService;
 import com.zhongzheng.modules.course.vo.CourseSectionWatchPerVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.wx.service.IWxLoginService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -44,12 +46,16 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
     @Autowired
     private ICourseSectionService courseSectionService;
 
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
     @Value("${liveGotoURL}")
     private String liveGotoURL;
 
     @Override
     public CourseSectionWatchPerVo getSectionWatchPer(SectionWatchPerBo bo) {
         CourseSectionWatchPerVo vo = new CourseSectionWatchPerVo();
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
         //获取课程节信息
         CourseSection section = courseSectionService.getById(bo.getSectionId());
 //        String url = "";
@@ -58,9 +64,12 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
         String format = String.format("cid=%s&gid=%s&sid=%s", bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
 
         String s = Base64.encode(format);
+
 //        String s = DigestUtils.md5Hex(format);
 //        String url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,live,section.getLiveUrl(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
-        String url = String.format("%s%s%s?a=1&%s", liveGotoURL,live,section.getLiveUrl(), s);
+        // https://web.xyyxt.net/
+        String domainPc =  iSysTenantService.getById(tenantId).getHostPc();
+        String url = String.format("%s%s/%s%s?a=1&%s",liveGotoURL, domainPc,live,section.getLiveUrl(), s);
 //        //生成微信小程序码
 //        switch (bo.getSectionType()){
 //            case 2://直播 living-room/

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

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.*;
 import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseTopicMapper;
@@ -18,6 +19,7 @@ import com.zhongzheng.modules.course.vo.CourseTopicGoodsVo;
 import com.zhongzheng.modules.course.vo.CourseTopicVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.wx.service.IWxLoginService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -55,6 +57,9 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
     @Autowired
     private IWxLoginService wxLoginService;
 
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
     @Value("${liveGotoURL}")
     private String liveGotoURL;
 
@@ -66,6 +71,7 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
 
     @Override
     public List<CourseTopicVo> queryList(CourseTopicQueryBo bo) {
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
         LambdaQueryWrapper<CourseTopic> lqw = Wrappers.lambdaQuery();
         lqw.eq(bo.getEducationId() != null, CourseTopic::getEducationId, bo.getEducationId());
         lqw.like(StrUtil.isNotBlank(bo.getEducationName()), CourseTopic::getEducationName, bo.getEducationName());
@@ -81,7 +87,8 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
             //小程序二维码和PC链接
             String enCode = wxLoginService.getTopicEnCode(item.getTopicId());
             item.setEnCode(enCode);
-            String url = String.format("%s%s?topicId=%s", liveGotoURL,"goodsTopic",item.getTopicId());
+            String domainPc =  iSysTenantService.getById(tenantId).getHostPc();
+            String url = String.format("%s%s/%s?topicId=%s", liveGotoURL,domainPc,"goodsTopic",item.getTopicId());
             item.setEnCodePC(url);
         });
         return courseTopicVos;

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

@@ -111,6 +111,8 @@ public interface IGoodsService extends IService<Goods> {
 
 	boolean goodsBatchCopyIncrementTenant(GoodsBatchCopyTenantBo bo);
 
+	boolean goodsCopyOne(GoodsBatchCopyTenantBo bo);
+
 	boolean goodsBatchCopyDisposeTenant();
 
     List<GoodsVo> getShareList(Long time);

+ 345 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1256,16 +1256,16 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     public String getGoodsStudyUrl(GoodsStudyUrlBo bo) {
         String url = "";
         //中正学堂PC域名和H5域名 https://zzyxt.gdzzkj.net/  h.gdzzkj.net
-        String domain = "http://192.168.1.222:6002/";
-        String domainH5 = "http://120.79.166.78:19006";
-//        String domain = "https://zzyxt.gdzzkj.net/";
-//        String domainH5 = "https://h.gdzzkj.net";
+//        String domain = "http://192.168.1.222:6002/";
+//        String domainH5 = "http://120.79.166.78:19006";
+        String domain = "https://zzyxt.gdzzkj.net/";
+        String domainH5 = "https://h.gdzzkj.net";
         Long tenantId = 867735392558919680L; //祥粤云
         if (ObjectUtils.isNotNull(bo.getTenantId()) && bo.getTenantId().equals(tenantId)){
-//            domain = "https://web.xyyxt.net/";
-//            domainH5 = "https://h.xyyxt.net";
-            domain = "http://192.168.1.222:6002/";
-            domainH5 = "http://120.79.166.78:19006";
+            domain = "https://web.xyyxt.net/";
+            domainH5 = "https://h.xyyxt.net";
+//            domain = "http://192.168.1.222:6002/";
+//            domainH5 = "http://120.79.166.78:19006";
         }
         Goods goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
         if (ObjectUtils.isNull(goods)) {
@@ -1685,6 +1685,343 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return true;
     }
 
+    public boolean goodsCopyOne(GoodsBatchCopyTenantBo bo){
+
+        log.info("一建商品复制开始:"+ DateUtils.getTime());
+            //获取商品信息
+            List<Goods> goodsList = list(new LambdaQueryWrapper<Goods>()
+                    .in(CollectionUtils.isNotEmpty(bo.getGoodsIds()), Goods::getGoodsId, bo.getGoodsIds()));
+            if (CollectionUtils.isEmpty(goodsList)){
+                return true;
+            }
+            Long tenantId = 867735392558919680L;
+            Long newTenantId = bo.getTenantId();
+            List<GoodsSpecAttributeRelation> newRelationList = new ArrayList<>();
+            List<SysGoodsCopyRecord> recordList = new ArrayList<>();
+            for (Goods goods : goodsList) {
+                Long oldGoodsId = goods.getGoodsId();
+                //判断商品是否存在
+                Long newGoodsId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
+//            Goods newGoods = this.baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
+                if (ObjectUtils.isNull(newGoodsId)){
+                    //不存在(新增)
+                    goods.setGoodsId(null);
+                    goods.setTenantId(newTenantId);
+                }else {
+                    //修改
+                    goods.setGoodsId(newGoodsId);
+                    goods.setTenantId(newTenantId);
+                }
+
+                //供应方ID
+                if (ObjectUtil.isNotNull(goods.getSupplyId())){
+                    PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
+                    if (ObjectUtils.isNotNull(supply)){
+                        Long oldSupplyId = supply.getSupplyId();
+                        //新机构是否存在
+                        Long newSupplyId = getNewIdByTenant(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId);
+                        if (ObjectUtil.isNotNull(newSupplyId)){
+                            goods.setSupplyId(newSupplyId);
+                        }else {
+                            supply.setSupplyId(null);
+                            supply.setTenantId(newTenantId);
+                            //服务类型ID
+                            if (ObjectUtil.isNotNull(supply.getServerId())){
+                                PayServe payServe = iPayServeService.getById(supply.getServerId());
+                                Long oldServeId = payServe.getServeId();
+                                if (ObjectUtils.isNotNull(payServe)){
+                                    Long newPayServerId = getNewIdByTenant(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType(),newTenantId);
+                                    if (ObjectUtils.isNotNull(newPayServerId)){
+                                        supply.setServerId(newPayServerId);
+                                    }else {
+                                        //新增服务
+                                        payServe.setServeId(null);
+                                        payServe.setTenantId(newTenantId);
+                                        iPayServeService.save(payServe);
+                                        supply.setServerId(payServe.getServeId());
+                                        addSysGoodsRecord(oldServeId,payServe.getServeId(),GoodsCopyEnum.PAY_SERVE.getType(),newTenantId,recordList);
+                                    }
+                                }
+                            }
+                            iPaySupplyService.save(supply);
+                            goods.setSupplyId(supply.getSupplyId());
+                            addSysGoodsRecord(oldSupplyId,supply.getSupplyId(),GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId,recordList);
+                        }
+                    }
+                }
+
+                //教育类型
+                if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
+                    goods.setEducationTypeId(getNewEducationTypeId(goods.getEducationTypeId(),newTenantId,recordList));
+                }
+
+                //业务层次
+                if (ObjectUtil.isNotNull(goods.getBusinessId())){
+                    goods.setBusinessId(getNewBusinessId(goods.getBusinessId(),newTenantId,recordList));
+                }
+
+                //所属院校
+                if (ObjectUtil.isNotNull(goods.getSchoolId())){
+                    School school = iSchoolService.getById(goods.getSchoolId());
+                    if (ObjectUtil.isNotNull(school)){
+                        Long oid = school.getId();
+                        School newSchool = iSchoolService.getSchoolByTenant(school.getEncoder(),newTenantId);
+                        if (ObjectUtil.isNotNull(newSchool)){
+                            goods.setSchoolId(newSchool.getId());
+                        }else {
+                            school.setId(null);
+                            school.setTenantId(newTenantId);
+                            iSchoolService.save(school);
+                            goods.setSchoolId(school.getId());
+                            addSysGoodsRecord(oid,school.getId(),GoodsCopyEnum.SCHOOL.getType(),newTenantId,recordList);
+                        }
+                    }
+                }
+
+                //所属专业
+                if (ObjectUtil.isNotNull(goods.getMajorId())){
+                    goods.setMajorId(getNewMajorId(goods.getMajorId(),newTenantId,recordList));
+                }
+
+                //项目
+                if (ObjectUtil.isNotNull(goods.getProjectId())){
+                    goods.setProjectId(getNewProjectTypeId(goods.getProjectId().longValue(),newTenantId,recordList).intValue());
+                }
+
+                //讲义
+                if (ObjectUtil.isNotNull(goods.getHandoutsId())){
+                    CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
+                    if (ObjectUtil.isNotNull(courseHandouts)){
+                        Long oid = courseHandouts.getHandoutsId();
+                        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId);
+//                    CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
+                        if (ObjectUtil.isNotNull(newId)){
+                            goods.setHandoutsId(newId);
+                        }else {
+                            //讲义业务层次
+                            List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
+                                    .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
+                                            .eq(CourseHandoutsBusiness::getHandoutsId, courseHandouts.getHandoutsId()));
+                            courseHandouts.setHandoutsId(null);
+                            courseHandouts.setTenantId(newTenantId);
+                            iCourseHandoutsService.save(courseHandouts);
+                            addSysGoodsRecord(oid,courseHandouts.getHandoutsId(),GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId,recordList);
+                            goods.setHandoutsId(courseHandouts.getHandoutsId());
+                            if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
+                                List<CourseHandoutsBusiness> collect = handoutsBusinessList.stream().map(business -> {
+                                    business.setId(null);
+                                    business.setTenantId(newTenantId);
+                                    //项目
+                                    business.setEducationId(getNewEducationTypeId(business.getEducationId(), newTenantId,recordList));
+                                    //业务
+                                    business.setBusinessId(getNewBusinessId(business.getBusinessId(), newTenantId,recordList));
+                                    //科目
+                                    business.setSubjectId(getNewSubjectId(business.getSubjectId(), newTenantId,recordList));
+                                    //讲义
+                                    business.setHandoutsId(courseHandouts.getHandoutsId());
+                                    return business;
+                                }).collect(Collectors.toList());
+                                iCourseHandoutsBusinessService.saveBatch(collect);
+                            }
+                        }
+                    }
+                }
+
+                //科目ID,拼接
+                if (StringUtils.isNotBlank(goods.getSubjectIds())){
+                    List<Long> subIds = new ArrayList<>();
+                    List<Long> ids = Arrays.asList(goods.getSubjectIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
+                    ids.forEach(item -> {
+                        Long newSubjectId = getNewSubjectId(item, newTenantId,recordList);
+                        if (ObjectUtils.isNotNull(newSubjectId)){
+                            subIds.add(newSubjectId);
+                        }
+                    });
+                    if (CollectionUtils.isNotEmpty(subIds)){
+                        goods.setSubjectIds(subIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
+                    }
+                }
+
+                //证书类型
+                if (ObjectUtils.isNotNull(goods.getCertificateTypeId())){
+                    goods.setCertificateTypeId(getNewCertificateTypeId(goods.getCertificateTypeId(),newTenantId,recordList));
+                }
+
+                //证书
+                if (ObjectUtils.isNotNull(goods.getCertificateId())){
+                    goods.setCertificateId(getNewCertificateId(goods.getCertificateId(),newTenantId,recordList));
+                }
+
+                //证书模板
+                if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
+                    goods.setCertificateTpId(getNewCertificateTpId(goods.getCertificateTpId(),newTenantId,recordList));
+                }
+
+                //规格模板
+                if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
+                    Long oldSpecTemplateId = goods.getSpecTemplateId();
+                    Long newSpecTemplateId = getNewIdByTenant(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
+                    GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
+//                GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
+                    if (ObjectUtils.isNotNull(newSpecTemplateId)){
+                        //更新
+                        List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplateId,newTenantId);
+                        if (CollectionUtils.isNotEmpty(specIds)){
+                            //删除关联信息
+                            List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
+                            if (CollectionUtils.isNotEmpty(specAttrIds)){
+                                goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
+                                iSysGoodsCopyRecordService.deleteByTenantId(specAttrIds,GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
+                                goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplateId,newTenantId);
+                            }
+                            goodsSpecService.deleteByIdsTenant(specIds);
+                            iSysGoodsCopyRecordService.deleteByTenantId(specIds,GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId);
+                        }
+                    }else {
+                        //新增
+                        specTemplate.setEducationTypeId(getNewEducationTypeId(specTemplate.getEducationTypeId(),newTenantId,recordList));
+                        specTemplate.setBusinessId(getNewBusinessId(specTemplate.getBusinessId(), newTenantId,recordList));
+                        specTemplate.setSpecTemplateId(null);
+                        specTemplate.setTenantId(newTenantId);
+                        goodsSpecTemplateService.save(specTemplate);
+                        newSpecTemplateId = specTemplate.getSpecTemplateId();
+                        addSysGoodsRecord(oldSpecTemplateId,newSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId,recordList);
+                    }
+
+                    //新增关联
+                    List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
+                            .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
+                    if (CollectionUtils.isNotEmpty(specList)){
+                        for (GoodsSpec item : specList) {
+                            Long oldSpecId = item.getSpecId();
+                            item.setSpecId(null);
+                            item.setSpecTemplateId(newSpecTemplateId);
+                            item.setTenantId(newTenantId);
+                            goodsSpecService.save(item);
+                            addSysGoodsRecord(oldSpecId,item.getSpecId(),GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId,recordList);
+                            List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
+                                    .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
+                                            .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
+                            if (CollectionUtils.isNotEmpty(specAttributeList)){
+                                List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
+                                    attrItem.setOId(attrItem.getSpecAttributeId());
+                                    attrItem.setSpecAttributeId(null);
+                                    attrItem.setSpecId(item.getSpecId());
+                                    attrItem.setTenantId(newTenantId);
+                                    return attrItem;
+                                }).collect(Collectors.toList());
+                                goodsSpecAttributeService.saveBatch(collect);
+                                for (GoodsSpecAttribute attr : collect) {
+                                    addSysGoodsRecord(attr.getOId(),attr.getSpecAttributeId(),GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId,recordList);
+                                }
+                            }
+                        }
+                    }
+                    //模板属性值关联
+                    List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
+                            .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
+                                    .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
+                    if (CollectionUtils.isNotEmpty(relationList)){
+                        newRelationList.addAll(relationList);
+                    }
+                    goods.setSpecTemplateId(newSpecTemplateId);
+                }
+
+                if (ObjectUtils.isNull(goods.getGoodsId())){
+                    //新增
+                    save(goods);
+                    addSysGoodsRecord(oldGoodsId,goods.getGoodsId(),GoodsCopyEnum.GOODS.getType(),newTenantId,recordList);
+                }else {
+                    //修改
+                    baseMapper.updateByTenant(goods);
+                }
+                newGoodsId = goods.getGoodsId();
+
+                //商品课程
+                List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
+                disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
+                //课程双师
+                disposeGoodsCourseTeacher(oldGoodsId,newGoodsId,newTenantId);
+                //商品试卷
+                disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
+
+                //处理商品试卷
+                if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
+                    for (CourseMenuExam menuExam : newCourseMenuExamList) {
+                        menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId,recordList));
+                    }
+                    iCourseMenuExamService.saveBatch(newCourseMenuExamList);
+                }
+            }
+
+            if (CollectionUtils.isNotEmpty(recordList)){
+                //保存记录
+//                iSysGoodsCopyRecordService.saveBatch(recordList);
+            }
+
+            //规格模板商品重新绑定
+            if (CollectionUtils.isNotEmpty(newRelationList)){
+                for (GoodsSpecAttributeRelation relation : newRelationList) {
+                    relation.setId(null);
+                    relation.setTenantId(newTenantId);
+                    //模板ID
+                    if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
+                        GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
+                        Long newId = getNewIdByTenant(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
+//                    GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
+                        if (ObjectUtils.isNotNull(newId)){
+                            relation.setSpecTemplateId(newId);
+                        }else {
+                            relation.setSpecTemplateId(null);
+                        }
+                    }
+
+                    //商品ID
+                    if (ObjectUtils.isNotNull(relation.getGoodsId())){
+                        Goods goods = getById(relation.getGoodsId());
+                        Long newId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
+//                    Goods newGoods = baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
+                        if (ObjectUtils.isNotNull(newId)){
+                            relation.setGoodsId(newId);
+                        }else {
+                            relation.setGoodsId(null);
+                        }
+                    }
+
+                    //规格属性IDS
+                    if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
+                        List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
+                        log.info("规格属性ids:"+JSONArray.toJSONString(ids));
+                        List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
+                        if (CollectionUtils.isNotEmpty(specAttributeList)){
+                            List<Long> newIds = new ArrayList<>();
+                            specAttributeList.forEach(item -> {
+                                Long newId = getNewIdByTenant(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
+//                            GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
+                                if (ObjectUtils.isNotNull(newId)){
+                                    newIds.add(newId);
+                                }else {
+                                    GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
+                                    if (ObjectUtils.isNotNull(newSpecAttribute)){
+                                        newIds.add(newSpecAttribute.getSpecAttributeId());
+                                    }
+                                }
+                            });
+                            if (CollectionUtils.isNotEmpty(newIds)){
+                                relation.setSpecAttributeIds(newIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
+                            }
+                        }
+                    }
+                }
+
+                goodsSpecAttributeRelationService.saveBatch(newRelationList);
+            }
+            log.info("一建商品复制完成:"+ DateUtils.getTime());
+
+        return true;
+    }
+
+
     private void disposeGoodsCourseTeacher(Long oldGoodsId, Long newGoodsId, Long newTenantId) {
         //双师关联
         goodsCourseTeacherService.deleteByIdTeanant(newGoodsId,newTenantId);

+ 17 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -17,6 +17,7 @@ import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.core.redis.RedisLockEntity;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
@@ -45,6 +46,7 @@ import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
+import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserBankRecordQueryBo;
@@ -635,17 +637,17 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Override
     public String pushOfficialPeriod(ClassGradeUserQueryBo bo) {
         //企业ID
-//        String tenant = ServletUtils.getRequest().getHeader("TenantId");
-//        SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
-//                .eq(SysOldOrg::getTenantId, tenant)
-//                .last("limit 1")).stream().findFirst().orElse(null);
-//        //共享班级关闭学时推送入口
-//        if (org.getShareClass() == 1){
-//            return "";
-//        }
-        if (true){
+        String tenant = ServletUtils.getRequest().getHeader("TenantId");
+        SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
+                .eq(SysOldOrg::getTenantId, tenant)
+                .last("limit 1")).stream().findFirst().orElse(null);
+        //共享班级关闭学时推送入口
+        if (org.getShareClass() == 1){
             return "";
         }
+//        if (true){
+//            return "";
+//        }
 
         ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
         if (Validator.isEmpty(userVo)) {
@@ -880,7 +882,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             exportVo.setStudyStartTime(vo.getCreateTime());
             exportVo.setStudyEndTime(vo.getUpdateTime());
             exportVo.setSectionType(4);
-            exportVo.setStatus(vo.getStatus());
+            exportVo.setStatus(vo.getReportStatus());
             exportVo.setScore(vo.getPerformance());
             exportVo.setRightRate(vo.getRightRate());
             studyList.add(exportVo);
@@ -1589,6 +1591,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         for (ClassPeriodUserVo classPeriodUserVo : classPeriodUserVos) {
             Long secLong = 0L;
             Long studyLong = 0L;
+            Long finishSectionDuration = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
             subjectStudyRecordQueryBo.setGoodsId(classPeriodUserVo.getGoodsId());
             subjectStudyRecordQueryBo.setUserId(bo.getUserId());
@@ -1598,7 +1601,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
                 secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
                 studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
-
+                finishSectionDuration = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordTime().toString())).longValue();
             }
             //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
             //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
@@ -1606,6 +1609,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             classPeriodUserVo.setSecAllNum(secLong);
             //学习节数
             classPeriodUserVo.setStuAllNum(studyLong);
+            //已学习秒数
+            classPeriodUserVo.setFinishSectionDuration(finishSectionDuration);
             classPeriodUserVo.setPending(classPeriodUserVo.getSecAllNum() - classPeriodUserVo.getPass() - classPeriodUserVo.getCheat());
             classPeriodUserVo.setExamPending(classPeriodUserVo.getExamNum() - classPeriodUserVo.getExamPass() - classPeriodUserVo.getExamCheat());
             //當前班級學員審核狀態 -1不可审核 0待審  1未通过 2通过
@@ -1646,6 +1651,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         classPeriodSectionVos.addAll(baseMapper.listperiodExam(classPeriodChapterVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), classPeriodVo.getId()));
                         for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
                             if (classPeriodSectionVo.getType() == 3) {
+                                //节
                                 UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
                                 userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
                                 userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());

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

@@ -135,4 +135,7 @@ public class ClassPeriodUserVo {
 
 	@ApiModelProperty("订单商品ID")
 	private Long orderGoodsId;
+
+	@ApiModelProperty("已完成总视频秒数")
+	private Long finishSectionDuration;
 }

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

@@ -100,4 +100,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
 
     void goodsDispose();
 
+    void goodsCopyOne();
+
 }

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

@@ -321,6 +321,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Override
     public String updateGoodsSend(UserQueryBo bo) {
         InformRemindVo informRemindVo = informRemindService.queryByName("商品购买成功无需填写资料");
+        if(Validator.isEmpty(informRemindVo)){
+            return null;
+        }
         //查找购买后没发送消息的商品,发送购买消息
         List<OrderGoodsVo> orderGoodsVo = iOrderGoodsService.selectOrderGoods();
         InformRemindVo informRemindTwoVo = informRemindService.queryByName("商品购买成功需填写资料");
@@ -1061,6 +1064,24 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         iGoodsService.goodsBatchCopyDisposeTenant();
     }
 
+    @Override
+    public void goodsCopyOne() {
+        List<Goods> list = iGoodsService.list(new LambdaQueryWrapper<Goods>()
+                .eq(Goods::getEducationTypeId, 3)
+                .eq(Goods::getBusinessId, 6)
+                .eq(Goods::getProjectId, 5)
+                .eq(Goods::getStatus, 1));
+        if (CollectionUtils.isEmpty(list)){
+            return;
+        }
+        List<Long> goodsIds = list.stream().filter(item -> !item.getGoodsName().contains("测试") && !"一建考前冲刺班【建筑】".equals(item.getGoodsName())).map(Goods::getGoodsId).collect(Collectors.toList());
+        GoodsBatchCopyTenantBo bo = new GoodsBatchCopyTenantBo();
+        bo.setTenantId(297336025408380161L);
+        bo.setGoodsIds(goodsIds);
+        //执行复制
+        iGoodsService.goodsCopyOne(bo);
+    }
+
     @Override
     public void closeTimeOutOrder() {
         OrderQueryBo bo = new OrderQueryBo();

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

@@ -109,6 +109,11 @@ public class SysTenantAddBo {
     /** 直播域名 */
     @ApiModelProperty("直播域名")
     private String hostLive;
+
     @ApiModelProperty("业务员h5域名")
     private String hostH5Seller;
+
+    @ApiModelProperty("后台域名")
+    private String hostAdmin;
+
 }

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

@@ -106,6 +106,11 @@ public class SysTenantEditBo {
     @ApiModelProperty("直播域名")
     private String hostLive;
 
+
     @ApiModelProperty("业务员h5域名")
     private String hostH5Seller;
+
+    @ApiModelProperty("后台域名")
+    private String hostAdmin;
+
 }

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

@@ -115,7 +115,12 @@ public class SysTenantQueryBo extends BaseEntity {
 	@ApiModelProperty("直播域名")
 	private String hostLive;
 
+
 	@ApiModelProperty("业务员h5域名")
 	private String hostH5Seller;
 
+	@ApiModelProperty("后台域名")
+	private String hostAdmin;
+
+
 }

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

@@ -78,6 +78,8 @@ private static final long serialVersionUID=1L;
     private String hostH5;
     /** 直播域名 */
     private String hostLive;
+    /** 后台域名 */
+    private String hostAdmin;
 
     private String hostH5Seller;
 

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

@@ -31,7 +31,7 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
     @Override
     public void insertOperlog(SysOperLog operLog) {
         operLog.setOperTime(new Date());
-        save(operLog);
+    //    save(operLog);
     }
 
     /**

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -53,6 +53,8 @@ import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelBasicInfoResponse;
 import net.polyv.live.v1.entity.channel.viewdata.LiveListChannelViewlogResponse;
+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;
@@ -73,7 +75,7 @@ import java.util.stream.Collectors;
  */
 @Service
 public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMapper, UserStudyRecord> implements IUserStudyRecordService {
-
+    private static final Logger log = LoggerFactory.getLogger(UserStudyRecordServiceImpl.class);
     @Autowired
     private UserStudyRecordMapper userStudyRecordMapper;
 

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

@@ -63,6 +63,9 @@ public class SubjectStudyRecordVo {
     @ApiModelProperty("已学节数")
     private Long recordNum;
 
+    @ApiModelProperty("已学节数秒数")
+    private Long recordTime;
+
     /** 科目節模塊學習返回 */
     @ApiModelProperty("科目節模塊學習返回")
     private List<SectionStudyRecordVo> sectionStudyRecordVo;

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

@@ -258,7 +258,7 @@ public class WxPayServiceImpl implements IWxPayService {
     @Override
     public Map<String, String> paymentPc(String out_trade_no, String openid, String body, BigDecimal price) {
         initData();
-        WxSmallConfig config = new WxSmallConfig(appid, mchid, key);
+        WxSmallConfig config = new WxSmallConfig(gzhAppid, mchid, key);
         BigDecimal unit = new BigDecimal(100);
         price = price.multiply(unit);
         try {
@@ -276,7 +276,7 @@ public class WxPayServiceImpl implements IWxPayService {
             String TenantId = ServletUtils.getRequest().getHeader("TenantId");
             data.put("attach", TenantId);
             Map<String, String> resp = wxpay.unifiedOrder(data);
-            System.out.println(resp);
+            log.error("PC支付:"+JSON.toJSONString(resp));
             Map<String, String> result = new HashMap<>();
             String code_url = resp.get("code_url");
             if (Validator.isEmpty(code_url)) {

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml

@@ -147,6 +147,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="key != null and key != ''">
             AND (e.exam_name  like concat('%', #{key}, '%') or e.prefix_name  like concat('%', #{key}, '%') or e.code = #{key})
         </if>
+        <if test="exclude != null and exclude == 1">
+            AND ep.paper_name NOT IN('每日一练','随机练习')
+        </if>
         ORDER BY e.exam_id DESC
     </select>
 

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

@@ -996,7 +996,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN course_business cb ON g.business_id = cb.id
         WHERE
             cb.alias_name = #{aliasName} AND cg.class_status = 0 AND cg.`status` = 1 AND g.goods_status = 1 AND cb.`status` = 1 AND g.`status` = 1
---             AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = cg.tenant_id AND sog.share_class = 1) > 0
+            AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = cg.tenant_id AND sog.share_class = 1) > 0
         <if test="subIds != null and subIds.size()!=0 ">
             AND (
             <foreach collection="subIds" item="id" index="index">
@@ -1021,7 +1021,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN course_education_type cet ON cpt.education_id = cet.id AND cet.tenant_id = #{tenantId}
         WHERE
         cb.alias_name = #{aliasName} AND g.`status` = 1 AND g.tenant_id = #{tenantId} AND g.goods_status = 1 AND cet.education_name = #{educationName}
---         AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = g.tenant_id AND sog.share_class = 1) > 0
+        AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = g.tenant_id AND sog.share_class = 1) > 0
         <if test="subIds != null and subIds.size()!=0 ">
             AND (
             <foreach collection="subIds" item="id" index="index">

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

@@ -973,6 +973,7 @@
         LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id  = ubr.chapter_id
         WHERE 1=1
         AND ubr.current_status = 1
+        AND ubr.report_status = 1
         <if test="moduleId != null and moduleId !='' ">
             AND ubr.module_id=#{moduleId}
         </if>

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/system/SysTenantMapper.xml

@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="findTenantId" parameterType="com.zhongzheng.modules.system.bo.SysTenantQueryBo" resultType="long">
         select tenant_id
-        from sys_tenant where (host_pc = #{hostPc} or host_h5 = #{hostH5} or host_live = #{hostLive} or host_h5_seller = #{hostH5Seller})
+        from sys_tenant where (host_pc = #{hostPc} or host_h5 = #{hostH5} or host_live = #{hostLive} or host_h5_seller = #{hostH5Seller} or host_admin = #{hostAdmin})
     </select>
 
 

+ 11 - 2
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -59,6 +59,7 @@
         <result property="chapterNum" column="chapter_num"/>
         <result property="sectionNum" column="section_num"/>
         <result property="recordNum" column="record_num"/>
+        <result property="recordTime" column="record_time"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.SectionStudyRecordVo" id="SectionStudyRecordVoResult">
@@ -285,7 +286,16 @@
         <if test="orderGoodsId != null and orderGoodsId !=''">
             and c.order_goods_id=#{orderGoodsId}
         </if>
-        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId}) as record_num
+        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId}) as record_num,
+        (SELECT IFNULL(SUM(cs.duration_time),0) from (select DISTINCT c.section_id,c.course_id FROM user_study_record c where 1=1
+        and c.current_status=1
+        <if test="gradeId != null and gradeId !=''">
+            and c.grade_id=#{gradeId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId !=''">
+            and c.order_goods_id=#{orderGoodsId}
+        </if>
+        and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId})cc LEFT JOIN  course_section cs on cc.section_id = cs.section_id WHERE  cc.course_id = r.course_id) as record_time
         FROM
         course r
         LEFT JOIN goods_course c ON c.course_id = r.course_id
@@ -691,7 +701,6 @@
         COUNT( 1 )
         FROM
         user_period up
-        LEFT JOIN user_period_status ups on up.id = ups.period_id
         WHERE
         1 =1
         <choose>