he2802 2 years ago
parent
commit
82f407a5b5
56 changed files with 1673 additions and 303 deletions
  1. 24 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  2. 55 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/EnterpriseController.java
  3. 7 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java
  4. 37 1
      zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java
  5. 7 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/LoginController.java
  6. 1 1
      zhongzheng-api/src/main/resources/application-dev.yml
  7. 93 6
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java
  8. 1 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java
  9. 320 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java
  10. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/IAliSmsService.java
  11. 32 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java
  12. 6 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMapper.java
  13. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java
  14. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionMapper.java
  15. 5 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionService.java
  16. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseService.java
  17. 3 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java
  18. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java
  19. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java
  20. 21 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyDetailBo.java
  21. 45 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyResultBo.java
  22. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamSite.java
  23. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java
  24. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java
  25. 47 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java
  26. 21 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyDetailVo.java
  27. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java
  28. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java
  29. 29 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  30. 11 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformServiceImpl.java
  31. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Order.java
  32. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderGoods.java
  33. 2 6
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsRefundServiceImpl.java
  34. 6 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java
  35. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java
  36. 454 237
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java
  37. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopOldOrderGoodsAddBo.java
  38. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/domain/TopOldOrderGoods.java
  39. 35 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java
  40. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopOldOrderGoodsListVo.java
  41. 3 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserAppTelphoneLoginBo.java
  42. 45 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserLiveAccountLoginBo.java
  43. 10 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserMapper.java
  44. 8 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java
  45. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java
  46. 70 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java
  47. 29 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserLiveAccountLoginVo.java
  48. 8 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml
  49. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml
  50. 10 1
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml
  51. 34 0
      zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml
  52. 7 0
      zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml
  53. 2 0
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml
  54. 2 0
      zhongzheng-system/src/main/resources/mapper/modules/top/TopOldOrderGoodsMapper.xml
  55. 42 0
      zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml
  56. 65 9
      zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

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

@@ -31,6 +31,10 @@ import com.zhongzheng.modules.distribution.service.IDistributionActivityGoodsSer
 import com.zhongzheng.modules.distribution.service.IDistributionCashWithdrawalService;
 import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
 import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
+import com.zhongzheng.modules.exam.bo.ExamApplyDetailBo;
+import com.zhongzheng.modules.exam.bo.ExamApplyResultBo;
+import com.zhongzheng.modules.exam.service.IExamApplyService;
+import com.zhongzheng.modules.exam.vo.ExamApplyDetailVo;
 import com.zhongzheng.modules.goods.bo.AlikeGoodsBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsStudyUrlBo;
@@ -133,6 +137,8 @@ public class CommonController extends BaseController {
     @Autowired
     private IOrderGoodsRefundService iOrderGoodsRefundService;
     @Autowired
+    private IExamApplyService iExamApplyService;
+    @Autowired
     private IClassGradeUserService iClassGradeUserService;
 
     /**
@@ -253,6 +259,24 @@ public class CommonController extends BaseController {
         return AjaxResult.success(voList);
     }
 
+    @ApiOperation("七大员新考结果")
+    @PostMapping("common/apply/result")
+    public AjaxResult examApplyResult(@RequestBody ExamApplyResultBo bo) {
+        if (!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(), bo.getSign())) {
+            return AjaxResult.error("签名错误");
+        }
+        iExamApplyService.examApplyResult(bo);
+        return AjaxResult.success();
+    }
+
+
+    @ApiOperation("获取某场考试信息")
+    @PostMapping("common/apply/detail")
+    public AjaxResult examApplyDetail(@RequestBody ExamApplyDetailBo bo) {
+        List<ExamApplyDetailVo> voList = iExamApplyService.examApplyDetail(bo);                                                                                                                                                                                                                                                                                                examApplyDetail(bo);
+        return AjaxResult.success(voList);
+    }
+
     @ApiOperation("旧系统获取商品学习中心路径")
     @PostMapping("common/get/goods/studyUrl")
     public AjaxResult getGoodsStudyUrl(@RequestBody GoodsStudyUrlBo bo) {

+ 55 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/EnterpriseController.java

@@ -0,0 +1,55 @@
+package com.zhongzheng.controller.common;
+
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
+import com.zhongzheng.modules.course.bo.CourseEducationTypeQueryBo;
+import com.zhongzheng.modules.course.service.ICourseBusinessService;
+import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
+import com.zhongzheng.modules.course.vo.CourseBusinessVo;
+import com.zhongzheng.modules.course.vo.CourseEducationTypeVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月28日 11:39
+ */
+@Api(value = "B端接口控制器", tags = {"B端接口控制器"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/enterprise/api")
+public class EnterpriseController {
+
+    private final ICourseEducationTypeService iCourseEducationTypeService;
+
+    private final ICourseBusinessService iCourseBusinessService;
+
+    /**
+     * 查询教育类型列表
+     */
+    @ApiOperation("查询教育类型列表")
+    @GetMapping("/education/list")
+    public AjaxResult<List<CourseEducationTypeVo>> getEducationList(CourseEducationTypeQueryBo bo) {
+        bo.setStatus(Arrays.asList(0,1));
+        return AjaxResult.success(iCourseEducationTypeService.queryList(bo));
+    }
+
+    /**
+     * 查询教育类型列表
+     */
+    @ApiOperation("查询教育类型列表")
+    @GetMapping("/business/list")
+    public AjaxResult<List<CourseBusinessVo>> getBusinessList(CourseBusinessQueryBo bo) {
+        bo.setStatus(Arrays.asList(0,1));
+        return AjaxResult.success(iCourseBusinessService.queryList(bo));
+    }
+
+}

+ 7 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -430,4 +430,11 @@ public class ScheduleController extends BaseController {
         iScheduleService.distributionRebate();
         return AjaxResult.success();
     }
+
+    @ApiOperation("七大员考场创建")
+    @GetMapping("/examApply")
+    public AjaxResult createExamApply(){
+        iScheduleService.createExamApply();
+        return AjaxResult.success();
+    }
 }

+ 37 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -13,6 +13,8 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.framework.web.service.WxLoginService;
 import com.zhongzheng.modules.activity.vo.ActivityGoodsPriceVo;
+import com.zhongzheng.modules.alisms.bo.SmsAddBo;
+import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.base.bo.ConfigQueryBo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.bo.CourseTopicGoodsQueryBo;
@@ -36,6 +38,9 @@ import com.zhongzheng.modules.order.domain.Printer;
 import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
+import com.zhongzheng.modules.user.bo.UserLiveAccountLoginBo;
+import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.UserLiveAccountLoginVo;
 import com.zhongzheng.modules.wx.bo.WxInfoBo;
 import com.zhongzheng.modules.wx.bo.WxInfoQuery;
 import com.zhongzheng.modules.wx.bo.WxServerBody;
@@ -48,7 +53,6 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -91,6 +95,10 @@ public class CommonController extends BaseController {
 
     private final IDistributionActivityGoodsService iDistributionActivityGoodsService;
 
+    private final IUserService iUserService;
+
+    private final IAliSmsService iSmsService;
+
     @PostMapping("/returnStream")
     public AjaxResult returnStream(MultipartFile file, HttpServletResponse response) throws IOException {
         ServletOutputStream out = null;
@@ -375,4 +383,32 @@ public class CommonController extends BaseController {
     public void loginAuthFailOffLine() {
         throw new CustomException("用户验证错误",409);
     }
+
+    @ApiOperation("直播短信统一登录")
+    @PostMapping("/live/sms_login")
+    public AjaxResult<UserLiveAccountLoginVo> sms_login(@RequestBody UserLiveAccountLoginBo bo) {
+        UserLiveAccountLoginVo vo = iUserService.smsLiveUnifyLogin(bo);
+        return AjaxResult.success(vo);
+    }
+
+    @ApiOperation("直播账号统一登录")
+    @PostMapping("/live/account_login")
+    public AjaxResult<UserLiveAccountLoginVo> account_login(@RequestBody UserLiveAccountLoginBo bo) {
+        UserLiveAccountLoginVo vo = iUserService.liveUnifyLogin(bo);
+        return AjaxResult.success(vo);
+    }
+
+    @ApiOperation("直播账号统一登录刷新")
+    @PostMapping("/live/account_login/refresh")
+    public AjaxResult<UserLiveAccountLoginVo> account_loginRefresh(@RequestBody UserLiveAccountLoginBo bo) {
+        UserLiveAccountLoginVo vo = iUserService.liveUnifyLoginRefresh(bo);
+        return AjaxResult.success(vo);
+    }
+
+    @ApiOperation("获取登录短信")
+    @PostMapping("/live/sms")
+    public AjaxResult liveSms(@RequestBody SmsAddBo bo) {
+        iSmsService.sendLiveSms(bo.getTel());
+        return AjaxResult.success();
+    }
 }

+ 7 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/LoginController.java

@@ -64,4 +64,11 @@ public class LoginController extends BaseController {
         Map<String,Object> map = iUserService.telphone_login(bo);
         return AjaxResult.success(map);
     }
+
+    @ApiOperation("用户账号自动登入")
+    @PostMapping("/automatic/account_login")
+    public AjaxResult automaticAccountLogin(@RequestBody UserAppTelphoneLoginBo bo) {
+        Map<String,Object> map = iUserService.automaticAccountLogin(bo);
+        return AjaxResult.success(map);
+    }
 }

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

@@ -121,7 +121,7 @@ certificate:
 
 
 
-liveGotoURL: http://120.79.166.78:19014/
+liveGotoURL: http://
 
 
 enCodeVersion: trial

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

@@ -7,12 +7,9 @@ import org.apache.commons.lang3.time.DateFormatUtils;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 时间工具类
@@ -123,6 +120,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, "yyyy/MM/dd");
     }
 
+    public static Date timeToDate(Long times){
+        long t = times.longValue();
+        t = t * 1000;
+        return new Date(t);
+    }
+
     public static String timestampToDateFormatMonth(Long times){
         if(Validator.isEmpty(times)){
             return "";
@@ -153,6 +156,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, patternStr);
     }
 
+
     /**
      * 将秒转为时分秒格式【01:01:01】
      * @param second 需要转化的秒数
@@ -405,8 +409,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
                 timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
             } else {
                 hour = minute / 60;
-                if (hour > 99)
+                if (hour > 99){
                     return "99:59:59";
+                }
                 minute = minute % 60;
                 second = time - hour * 3600 - minute * 60;
                 timeStr = unitFormat(hour) + ":" + unitFormat(minute) + ":" + unitFormat(second);
@@ -472,4 +477,86 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
                 return 7;
         }
     }
+
+
+    public static LocalDate[] getDateArray() {
+        // 创建一个长度为30的数组
+        LocalDate[] dates = new LocalDate[30];
+        // 获取今天的日期
+        LocalDate today = LocalDate.now();
+        // 用循环给数组赋值
+        for (int i = 0; i < dates.length; i++) {
+            // 用today.plusDays(i)得到第i天的日期
+            dates[i] = today.plusDays(i);
+        }
+        // 返回数组
+        return dates;
+    }
+
+    static List<String> holiday =new ArrayList<>();
+    static List<String> extraWorkDay =new ArrayList<>();
+    public static Boolean isWorkingDay(long time) {
+        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8"));
+        String formatTime = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        initHoliday();
+        initExtraWorkDay();
+        //是否加班日
+        if(extraWorkDay.contains(formatTime)){
+            return true;
+        }
+        //是否节假日
+        if(holiday.contains(formatTime)){
+            return false;
+        }
+        //如果是1-5表示周一到周五  是工作日
+        DayOfWeek week = dateTime.getDayOfWeek();
+        if(week==DayOfWeek.SATURDAY||week==DayOfWeek.SUNDAY){
+            return false;
+        }
+        return true;
+
+    }
+
+    /**
+     *  初始化节假日
+     */
+    public static void initHoliday(){
+        holiday.add("2023-06-22");
+        holiday.add("2023-06-23");
+        holiday.add("2023-09-29");
+        holiday.add("2023-09-30");
+        holiday.add("2023-10-01");
+        holiday.add("2023-10-02");
+        holiday.add("2023-10-03");
+        holiday.add("2023-10-04");
+        holiday.add("2023-10-05");
+        holiday.add("2023-10-06");
+    }
+    /**
+     *  初始化额外加班日
+     */
+    public static void initExtraWorkDay(){
+        extraWorkDay.add("2023-06-25");
+        extraWorkDay.add("2023-10-07");
+        extraWorkDay.add("2023-10-08");
+    }
+
+
+    /**
+     * 指定时间往前或往后推n天
+     *
+     * @param dateTime 指定时间
+     * @param x 指定天数
+     * @return
+     */
+    public static Long getDayBefore(Long dateTime, int x) {
+        Calendar c = Calendar.getInstance();
+        Date date = new Date(dateTime*1000);
+        c.setTime(date);
+        int day = c.get(Calendar.DATE);
+        c.set(Calendar.DATE, day - x);    //往前推几天
+        //c.set(Calendar.DATE, day + x);  往后推几天
+        return c.getTime().getTime()/1000;
+    }
+
 }

+ 1 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java

@@ -139,6 +139,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/common/merge/file").anonymous()
                 .antMatchers("/common/get/goods").anonymous()
                 .antMatchers("/common/get/goods/studyUrl").anonymous()
+                .antMatchers("/common/apply/detail").anonymous()
                 .antMatchers("/common/platform/pay").anonymous()
                 .antMatchers("/common/platform/pay/handle").anonymous()
                 .antMatchers("/common/alike/goods").anonymous()

+ 320 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.framework.web.service;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.codec.Base64;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.ObjectUtil;
@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
+import com.google.common.base.Splitter;
 import com.zhongzheng.common.constant.Constants;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.core.redis.RedisCache;
@@ -30,20 +32,30 @@ import com.zhongzheng.modules.collect.domain.CollectNote;
 import com.zhongzheng.modules.collect.mapper.CollectBankMapper;
 import com.zhongzheng.modules.collect.mapper.CollectCourseMapper;
 import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
+import com.zhongzheng.modules.course.domain.Course;
+import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.course.domain.CourseSubject;
+import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.service.ICourseService;
 import com.zhongzheng.modules.course.service.ICourseSubjectService;
+import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
-import com.zhongzheng.modules.inform.domain.InformRemind;
+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.bo.*;
-import com.zhongzheng.modules.user.domain.*;
+import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.domain.UserStudyLog;
+import com.zhongzheng.modules.user.domain.UserVisitLog;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.mapper.UserMapper;
 import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
 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 org.springframework.util.CollectionUtils;
@@ -115,6 +127,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private IUserLoginErrorService iUserLoginErrorService;
     @Autowired
     private  ISysConfigService configService;
+    @Autowired
+    private IGoodsService iGoodsService;
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
+    @Autowired
+    private ICourseService iCourseService;
+    @Autowired
+    private ICourseSectionService iCourseSectionService;
+    @Value("${liveGotoURL}")
+    private String liveGotoURL;
 
 
     @Override
@@ -1089,6 +1112,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         });
     }
 
+
+
     private Long findSubjectId(String subject){
         if(subject!=null){
             String key = "SUB_"+subject;
@@ -1212,6 +1237,299 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return this.updateById(update);
     }
 
+    @Override
+    public UserLiveAccountLoginVo liveUnifyLogin(UserLiveAccountLoginBo bo) {
+        if (bo.getType() != 1){
+            throw new CustomException("登录错误");
+        }
+        if(Validator.isEmpty(bo.getAccount())){
+            throw new CustomException("账号不能为空");
+        }
+
+        List<User> userList = baseMapper.getUserByTel(bo.getAccount());
+        if (CollectionUtils.isEmpty(userList)){
+            throw new CustomException("账号不存在!请检查");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        Long goodsId = Long.valueOf(split.get("gid"));
+
+        //获取对应商品
+        Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
+
+        User user = userList.stream().filter(item -> {
+            //判断用户是否购买商品
+            Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
+            return count > 0;
+        }).findFirst().orElse(null);
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录信息错误");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+        String password = null;
+        if(bo.getPwd().length()>20){
+            String rsaPrivate = null;
+            try {
+                InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
+                rsaPrivate = AES.getStringByInputStream_1(certStream);
+                certStream.close();
+                password = AES.decrypt(bo.getPwd(),rsaPrivate);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }else{
+            password = bo.getPwd();
+        }
+        if (!SecurityUtils.matchesPassword(password,user.getPassword()))
+        {
+            iUserLoginErrorService.saveErrorLog(bo.getAccount());
+            throw new BaseException("登录信息错误");
+        }
+        Long tenantId = user.getTenantId();
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+
+        String cid = split.get("cid");
+        String sid = split.get("sid");
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+    @Override
+    public Map<String, Object> automaticAccountLogin(UserAppTelphoneLoginBo bo) {
+        User user = baseMapper.getUserByAccount(bo.getUserAccount());
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("该账号不存在");
+        }
+        ClientLoginUser loginUser = new ClientLoginUser();
+        loginUser.setUser(user);
+        Map<String,Object> map = new HashMap<>();
+        map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
+        map.put("user_account",user.getUserAccount());
+        map.put("full_info",Validator.isEmpty(user.getIdCard())?false:true); //是否完善身份信息
+        return map;
+    }
+
+    @Override
+    public UserLiveAccountLoginVo smsLiveUnifyLogin(UserLiveAccountLoginBo bo) {
+        if(bo.getTel()==null){
+            throw new CustomException("手机号不能为空");
+        }
+        String key = Constants.LOGIN_SMS + bo.getTel();
+        String code =  redisCache.getCacheObjectNoTenant(key);
+        if(code==null){
+            throw new CustomException("验证码错误");
+        }
+        if(!code.equals(bo.getCode())){
+            throw new CustomException("验证码错误");
+        }
+        redisCache.deleteObject(key);
+
+        if (bo.getType() != 1){
+            throw new CustomException("登录错误");
+        }
+
+        List<User> userList = baseMapper.getUserByTel(bo.getTel());
+        if (CollectionUtils.isEmpty(userList)){
+            throw new CustomException("账号不存在!请检查");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        Long goodsId = Long.valueOf(split.get("gid"));
+
+        //获取对应商品
+        Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
+
+        User user = userList.stream().filter(item -> {
+            //判断用户是否购买商品
+            Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
+            return count > 0;
+        }).findFirst().orElse(null);
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录信息错误");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+
+        Long tenantId = user.getTenantId();
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+
+        String cid = split.get("cid");
+        String sid = split.get("sid");
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+    @Override
+    public UserLiveAccountLoginVo liveUnifyLoginRefresh(UserLiveAccountLoginBo bo) {
+        if(Validator.isEmpty(bo.getUser_account())){
+            throw new CustomException("账号不能为空");
+        }
+
+        User user = baseMapper.getUserByAccount(bo.getUser_account());
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录信息错误");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        Long goodsId = Long.valueOf(split.get("gid"));
+
+        //获取对应商品
+        Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
+
+        Long tenantId = user.getTenantId();
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+
+        String cid = split.get("cid");
+        String sid = split.get("sid");
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+
     @Override
     public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {
         if(Validator.isEmpty(bo.getAccount())){

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/IAliSmsService.java

@@ -3,8 +3,6 @@ package com.zhongzheng.modules.alisms.service;
 
 import com.zhongzheng.modules.alisms.vo.ResultBean;
 
-import javax.servlet.http.HttpServletRequest;
-
 public interface IAliSmsService {
     ResultBean sendSms(String tel,String param);
 
@@ -26,4 +24,6 @@ public interface IAliSmsService {
     Boolean sendSellerForgetSms(String tel);
 
     Boolean sendSellerLoginSms(String tel);
+
+    Boolean sendLiveSms(String tel);
 }

+ 32 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java

@@ -349,4 +349,36 @@ public class AliSmsServiceImpl implements IAliSmsService {
         }
         return false;
     }
+
+    @Override
+    public Boolean sendLiveSms(String tel) {
+        if(tel==null){
+            throw new CustomException("手机号码不能为空");
+        }
+        User user = iUserService.getUserByTelNotTenant(tel).stream().findFirst().orElse(null);
+        if(Validator.isEmpty(user)){
+            throw new CustomException("该手机号未注册");
+        }
+        ServletUtils.getResponse().setHeader("TenantId",user.getTenantId().toString());
+        String code = ToolsUtils.getSmsCode();
+        String key = Constants.LOGIN_SMS + tel;
+        redisCache.setCacheObjectTenant(key,code,5, TimeUnit.MINUTES);//5分钟
+        try{
+            Map<String,Object> param = new HashMap<>();
+            param.put("code",code);
+            SendSmsResponse response = SmsUtils.sendSms(tel,SIGNNAME,LOGINTEMPLATECODE, JSON.toJSONString(param),ACCESSKEYID,ACCESSKEYSECRET);
+            if(response.getBody().getMessage().equals("OK")){
+                SmsAddBo smsAddBo = new SmsAddBo();
+                smsAddBo.setCode(code);
+                smsAddBo.setTel(tel);
+                smsAddBo.setType(3L);
+                smsAddBo.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
+                iSmsService.insertByAddBo(smsAddBo);
+                return true;
+            }
+        }catch (Exception e){
+            throw new CustomException(e.getMessage());
+        }
+        return false;
+    }
 }

+ 6 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMapper.java

@@ -3,8 +3,6 @@ package com.zhongzheng.modules.course.mapper;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zhongzheng.common.core.domain.entity.SysRole;
-import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.domain.Course;
 import com.zhongzheng.modules.course.vo.CourseUserVo;
@@ -18,7 +16,6 @@ import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 课程Mapper接口
@@ -59,4 +56,10 @@ public interface CourseMapper extends BaseMapper<Course> {
 
     @InterceptorIgnore(tenantLine = "true")
     Course getCourseByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Course getCourseByNotTenant(@Param("cid") Long cid);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long getCourseByTenantTwo(@Param("courseName") String courseName,@Param("code") String code,@Param("tenantId") Long tenantId);
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java

@@ -19,7 +19,7 @@ import java.util.List;
  * @date 2021-10-11
  */
 public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapter> {
-    List<CourseModuleChapterVo> getListById(Long id);
+    List<CourseModuleChapterVo> getListById(@Param("id") Long id,@Param("tenantId") Long tenantId);
 
     List<CourseUserModuleChapterVo> chapterList(CourseMenuQueryBo bo);
 

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionMapper.java

@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseSection;
-import com.zhongzheng.modules.course.domain.CourseStreamingBusiness;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
-import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -30,4 +28,10 @@ public interface CourseSectionMapper extends BaseMapper<CourseSection> {
 
     @InterceptorIgnore(tenantLine = "true")
     CourseSection getSectionByTenant(@Param("code") String code,@Param("newTenantId") Long newTenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    CourseSection getSectionByNotTenant(@Param("sid") Long sid);
+
+    @InterceptorIgnore(tenantLine = "true")
+    CourseSection getSectionByTenantTwo(@Param("name") String name,@Param("code") String code,@Param("tenantId") Long tenantId);
 }

+ 5 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionService.java

@@ -2,7 +2,6 @@ package com.zhongzheng.modules.course.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.bank.vo.QuestionImport;
 import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
@@ -13,7 +12,6 @@ import com.zhongzheng.modules.course.vo.CourseSectionImport;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.goods.bo.GoodsBatchDelBo;
 import net.polyv.live.v1.entity.chat.LiveGetMessageListResponse;
-import org.apache.ibatis.annotations.Param;
 
 import java.io.IOException;
 import java.security.NoSuchAlgorithmException;
@@ -79,4 +77,9 @@ public interface ICourseSectionService extends IService<CourseSection> {
     boolean batchDelSection(GoodsBatchDelBo bo);
 
     CourseSection getSectionByTenant(String code, Long newTenantId);
+
+    CourseSection getSectionByNotTenant(Long sid);
+
+	CourseSection getSectionByTenantTwo(String name, String code, Long tenantId);
+
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseService.java

@@ -89,4 +89,9 @@ public interface ICourseService extends IService<Course> {
     Course getCourseByTenant(String code, Long newTenantId);
 
 	Boolean checkTime();
+
+    Course getCourseByNotTenant(Long cid);
+
+	Long getCourseByTenantTwo(String courseName, String code, Long tenantId);
+
 }

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

@@ -8,6 +8,7 @@ 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.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterEditBo;
@@ -45,7 +46,8 @@ public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChap
 
     @Override
     public List<CourseModuleChapterVo> getListById(Long id) {
-        return courseModuleChapterMapper.getListById(id);
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        return courseModuleChapterMapper.getListById(id, Long.valueOf(tenantId));
     }
 
 

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -659,6 +659,16 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
         return baseMapper.getSectionByTenant(code, newTenantId);
     }
 
+    @Override
+    public CourseSection getSectionByNotTenant(Long sid) {
+        return baseMapper.getSectionByNotTenant(sid);
+    }
+
+    @Override
+    public CourseSection getSectionByTenantTwo(String name, String code, Long tenantId) {
+        return baseMapper.getSectionByTenantTwo(name, code, tenantId);
+    }
+
     @Transactional(rollbackFor = Exception.class)
     public String insertByAddBoImport(CourseSectionAddBo bo, String errorLog, Integer no) {
         CourseSection add = BeanUtil.toBean(bo, CourseSection.class);

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

@@ -622,6 +622,16 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         return true;
     }
 
+    @Override
+    public Course getCourseByNotTenant(Long cid) {
+        return baseMapper.getCourseByNotTenant(cid);
+    }
+
+    @Override
+    public Long getCourseByTenantTwo(String courseName, String code, Long tenantId) {
+        return baseMapper.getCourseByTenantTwo(courseName, code, tenantId);
+    }
+
     private List<UserStudyRecordPhotoVo> entity2PhotoVo(Collection<UserStudyRecordPhoto> collection) {
         List<UserStudyRecordPhotoVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, UserStudyRecordPhotoVo.class))

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyDetailBo.java

@@ -0,0 +1,21 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月26日 15:13
+ */
+@Data
+public class ExamApplyDetailBo implements Serializable {
+
+    @ApiModelProperty("考试日期")
+    private Long examTime;
+    @ApiModelProperty("开始时间")
+    private String startTime;
+    @ApiModelProperty("结束时间")
+    private String endTime;
+}

+ 45 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamApplyResultBo.java

@@ -0,0 +1,45 @@
+package com.zhongzheng.modules.exam.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月20日 11:22
+ */
+@Data
+public class ExamApplyResultBo implements Serializable {
+
+    @ApiModelProperty("考生姓名")
+    private String userName;
+
+    @ApiModelProperty("考生身份证号")
+    private String idCard;
+
+    @ApiModelProperty("联系方式")
+    private String telphone;
+
+    @ApiModelProperty("岗位名称")
+    private String majorName;
+
+    @ApiModelProperty("考试状态:0 待登记 1正常 2缺考 3作弊 4替考")
+    private Integer applyStatus;
+
+    @ApiModelProperty("成绩")
+    private Long score;
+
+    @ApiModelProperty("证书编码")
+    private String certificateCode;
+
+    @ApiModelProperty("当前时间戳")
+    @NotBlank(message = "当前时间戳不能为空")
+    private Long stamp;
+
+    @ApiModelProperty("签名")
+    @NotBlank(message = "签名不能为空")
+    private String sign;
+
+}

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

@@ -44,4 +44,6 @@ private static final long serialVersionUID=1L;
     private Integer fromPlat;
     /** 智慧考场ID */
     private Long centerId;
+    /** 是否默认标签:1是 0否 */
+    private Integer sign;
 }

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

@@ -1,11 +1,14 @@
 package com.zhongzheng.modules.exam.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.exam.bo.ExamApplyDetailBo;
 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.zhongzheng.modules.exam.vo.*;
+import com.zhongzheng.modules.user.domain.UserSubscribe;
 import com.zhongzheng.modules.user.vo.UserStudyRecordExport;
 import org.apache.ibatis.annotations.Param;
 
@@ -76,4 +79,9 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
     List<ExamApplyPlaceVo> getPlaceList(ExamApplyRoomQueryBo bo);
 
     List<UserStudyRecordExport> getUserStudyRecord(@Param("orderGoodsId") Long orderGoodsId,@Param("userId") Long userId);
+
+    UserSubscribe getExamApplyByUser(@Param("userId") Long userId,@Param("majorName") String majorName);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<ExamApplyDetailVo> getExamUserInfo(ExamApplyDetailBo bo);
 }

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

@@ -84,4 +84,8 @@ public interface IExamApplyService extends IService<ExamApply> {
     String getSendmailUrl(List<Long> ids);
 
     Boolean sendmail(ExamApplySendmailBo bo);
+
+	void examApplyResult(ExamApplyResultBo bo);
+
+    List<ExamApplyDetailVo> examApplyDetail(ExamApplyDetailBo bo);
 }

+ 47 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -830,6 +830,53 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         return true;
     }
 
+    @Override
+    public void examApplyResult(ExamApplyResultBo bo) {
+        //获取用户
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getIdCard, EncryptHandler.encrypt(bo.getIdCard())).last("limit 1"));
+        if (ObjectUtils.isNull(user)){
+            throw new CustomException("用户信息获取有误!");
+        }
+        //获取考试
+        UserSubscribe subscribe = baseMapper.getExamApplyByUser(user.getUserId(),bo.getMajorName());
+        if (ObjectUtils.isNull(subscribe)){
+            throw new CustomException("用户考试信息获取有误!");
+        }
+
+        //考试状态
+        if (ObjectUtils.isNotNull(bo.getApplyStatus())){
+            subscribe.setSubscribeStatus(bo.getApplyStatus());
+        }
+
+        //成绩
+        if (ObjectUtils.isNotNull(bo.getScore())){
+            subscribe.setPerformance(bo.getScore());
+        }
+
+        //证书
+        if (StringUtils.isNotBlank(bo.getCertificateCode())){
+            subscribe.setCertificateCode(bo.getCertificateCode());
+        }
+        subscribe.setUpdateTime(DateUtils.getNowTime());
+        iUserSubscribeService.updateById(subscribe);
+    }
+
+    @Override
+    public List<ExamApplyDetailVo> examApplyDetail(ExamApplyDetailBo bo) {
+        List<ExamApplyDetailVo> vo = baseMapper.getExamUserInfo(bo);
+        if (CollectionUtils.isEmpty(vo)){
+            return new ArrayList<>();
+        }
+        //身份证处理
+        vo.forEach(item -> {
+            //身份证隐藏
+            String decrypt = EncryptHandler.decrypt(item.getIdCard());
+            String content = decrypt.replaceAll("(\\d{4})\\d{10}(\\w{4})", "$1****$2");
+            item.setIdCard(content);
+        });
+        return vo;
+    }
+
     private void userStudyRecord(String userPath, List<UserSubscribe> list) {
         Map<Long, List<UserSubscribe>> map = list.stream().collect(Collectors.groupingBy(UserSubscribe::getUserId));
         map.forEach((k, v) -> {

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyDetailVo.java

@@ -0,0 +1,21 @@
+package com.zhongzheng.modules.exam.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月26日 15:13
+ */
+@Data
+public class ExamApplyDetailVo implements Serializable {
+
+    @ApiModelProperty("学员姓名")
+    private String userName;
+    @ApiModelProperty("座位号")
+    private Integer seatNum;
+    @ApiModelProperty("身份证")
+    private String idCard;
+}

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

@@ -72,4 +72,7 @@ public interface GoodsMapper extends BaseMapper<Goods> {
 
     @InterceptorIgnore(tenantLine = "true")
     Goods getGoodsByIdNotTenant(Long goodsId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Goods getGoodsByTenantTwo(@Param("goodsName") String goodsName,@Param("code") String code,@Param("tenantId") Long tenantId);
 }

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

@@ -130,4 +130,6 @@ public interface IGoodsService extends IService<Goods> {
     List<GoodsVo> getAlikeGoods(AlikeGoodsBo bo);
 
 	Goods getGoodsByIdNotTenant(Long goodsId);
+
+    Goods getGoodsByTenantTwo(String goodsName, String code, Long tenantId);
 }

+ 29 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -8,7 +8,6 @@ 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;
@@ -65,7 +64,6 @@ import com.zhongzheng.modules.polyv.service.IPolyvVideoService;
 import com.zhongzheng.modules.system.bo.GoodsCopyEnum;
 import com.zhongzheng.modules.system.domain.SysConfig;
 import com.zhongzheng.modules.system.domain.SysGoodsCopyRecord;
-import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysGoodsCopyRecordService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
@@ -83,7 +81,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
@@ -574,6 +571,30 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             menuListAddBo.setMenuList(bo.getMenuList());
             iCourseMenuService.insertByGoodsAddBo(menuListAddBo);
         }
+
+        //七大员商品,默认绑定七大员学员资料模板
+        CourseEducationType educationType = iCourseEducationTypeService.getById(add.getEducationTypeId());
+        CourseBusiness business = iCourseBusinessService.getById(add.getBusinessId());
+        if (educationType.getEducationName().contains("考前培训") && business.getBusinessName().contains("七大员")){
+            //获取七大员学员资料模版
+            List<ProfileTpBusiness> tpBusinessList = iProfileTpBusinessService.list(new LambdaQueryWrapper<ProfileTpBusiness>()
+                    .eq(ProfileTpBusiness::getEducationTypeId, add.getEducationTypeId())
+                    .eq(ProfileTpBusiness::getProjectId, add.getProjectId())
+                    .eq(ProfileTpBusiness::getBusinessId, add.getBusinessId()));
+            if (CollectionUtils.isNotEmpty(tpBusinessList)){
+                List<ProfileTp> profileTpList = iProfileTpService.list(new LambdaQueryWrapper<ProfileTp>()
+                .in(ProfileTp::getProfileTpId,tpBusinessList.stream().map(ProfileTpBusiness::getProfileTpId).collect(Collectors.toList()))
+                .eq(ProfileTp::getStatus,1));
+                profileTpList.forEach(item -> {
+                    if (StringUtils.isNotBlank(item.getGoodsIds())){
+                        List<String> goodsIds = Arrays.asList(item.getGoodsIds().split(","));
+                        goodsIds.add(add.getGoodsId().toString());
+                        item.setGoodsIds(goodsIds.stream().collect(Collectors.joining(",")));
+                    }
+                });
+                iProfileTpService.updateBatchById(profileTpList);
+            }
+        }
         return result;
     }
 
@@ -4366,6 +4387,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getGoodsByIdNotTenant(goodsId);
     }
 
+    @Override
+    public Goods getGoodsByTenantTwo(String goodsName, String code, Long tenantId) {
+        return baseMapper.getGoodsByTenantTwo(goodsName,code,tenantId);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean updateGoodsRepair(UpdateGoodsRepairBo bo) {

+ 11 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformServiceImpl.java

@@ -2,9 +2,14 @@ package com.zhongzheng.modules.inform.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
+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.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
+import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
 import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
 import com.zhongzheng.modules.bank.mapper.QuestionChapterExamMapper;
@@ -22,30 +27,25 @@ import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.mapper.GoodsAttachedMapper;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.inform.bo.*;
+import com.zhongzheng.modules.inform.domain.Inform;
 import com.zhongzheng.modules.inform.domain.InformCourse;
 import com.zhongzheng.modules.inform.domain.InformExam;
 import com.zhongzheng.modules.inform.domain.InformUser;
+import com.zhongzheng.modules.inform.mapper.InformMapper;
 import com.zhongzheng.modules.inform.service.IInformCourseService;
 import com.zhongzheng.modules.inform.service.IInformExamService;
+import com.zhongzheng.modules.inform.service.IInformService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.CourseInformVo;
 import com.zhongzheng.modules.inform.vo.GoodsInformAttachedVo;
 import com.zhongzheng.modules.inform.vo.InformUserVo;
+import com.zhongzheng.modules.inform.vo.InformVo;
 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.github.pagehelper.Page;
-import com.zhongzheng.modules.inform.domain.Inform;
-import com.zhongzheng.modules.inform.mapper.InformMapper;
-import com.zhongzheng.modules.inform.vo.InformVo;
-import com.zhongzheng.modules.inform.service.IInformService;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -303,6 +303,7 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
 
     @Override
     public List<CourseInformVo> listGoodsCourse(GoodsQueryBo bo) {
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
         List<CourseInformVo> courseInformVos = baseMapper.listGoodsCourse(bo);
         for (CourseInformVo courseInformVo : courseInformVos) {
             CourseMenuQueryBo courseMenuQueryBo = new CourseMenuQueryBo();
@@ -310,7 +311,7 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
             List<CourseMenuVo> list = iCourseMenuService.selectList(courseMenuQueryBo);
             for (CourseMenuVo courseMenuVo : list) {
                 if (courseMenuVo.getType().equals(1)){
-                    List<CourseModuleChapterVo> listById = courseModuleChapterMapper.getListById(courseMenuVo.getMenuId());
+                    List<CourseModuleChapterVo> listById = courseModuleChapterMapper.getListById(courseMenuVo.getMenuId(),Long.valueOf(tenantId));
                     for (CourseModuleChapterVo courseModuleChapterVo : listById) {
                         courseModuleChapterVo.setCourseChapterSectionList(courseChapterSectionMapper.getInformById(courseModuleChapterVo.getChapterId()));
                     }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Order.java

@@ -141,7 +141,7 @@ private static final long serialVersionUID=1L;
     /** 审核状态:0待审核,1已通过,2未通过,3已撤销 */
     private Integer checkStatus;
     /** 退款状态:0待审核,1正常,2未退款,3已完成,4未通过 */
-    private Integer refundStatus;
+    private Integer orderRefundStatus;
     /** 账款状态:0未结清,1已结清 */
     private Integer creditStatus;
     /** 发票状态:0未开票,1已开票 */

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

@@ -37,6 +37,8 @@ private static final long serialVersionUID=1L;
     private String orderSn;
     /** 商品id */
     private Long goodsId;
+    /** 商品年份 */
+    private String goodsYear;
     /** 商品采集数据 */
     private String goodsInputData;
     /** 商品标准价格 */

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

@@ -18,7 +18,6 @@ import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
-import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.activity.domain.ActivityOrder;
@@ -35,7 +34,6 @@ import com.zhongzheng.modules.distribution.service.IDistributionRebateService;
 import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
 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.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
@@ -58,10 +56,8 @@ import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.order.vo.OrderShareGoodsVo;
 import com.zhongzheng.modules.order.vo.OrderShareToOldVo;
 import com.zhongzheng.modules.system.service.ISysUserService;
-import com.zhongzheng.modules.top.financial.bo.OrderRefundPayBo;
 import com.zhongzheng.modules.top.goods.domain.TopOldOrderCheck;
 import com.zhongzheng.modules.top.goods.domain.TopOldOrderCheckLog;
-import com.zhongzheng.modules.top.goods.domain.TopOldOrderRefund;
 import com.zhongzheng.modules.top.goods.service.ITopOldOrderCheckLogService;
 import com.zhongzheng.modules.top.goods.service.ITopOldOrderCheckService;
 import com.zhongzheng.modules.top.goods.service.ITopOldOrderRefundService;
@@ -283,7 +279,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
         this.save(add);
         //订单状态修改
         iOrderService.update(new LambdaUpdateWrapper<Order>()
-                        .set(Order::getRefundStatus,0)//待审核
+                        .set(Order::getOrderRefundStatus,0)//待审核
                         .set(Order::getOrderRefund,orderGoods.getGoodsReceived())
                         .eq(Order::getOrderSn,orderGoods.getOrderSn()));
         //修改订单状态
@@ -473,7 +469,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
             order.setUpdateTime(DateUtils.getNowTime());
             order.setOrderStatus(Order.REFUND_PART);
         }
-        order.setRefundStatus(3);//退款已完成
+        order.setOrderRefundStatus(3);//退款已完成
 
         //已退金额
         BigDecimal add = BigDecimal.ZERO;

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

@@ -494,7 +494,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             orderGoods.setCompany(bo.getOrderStudent().getCompany());
             //成交价
             orderGoods.setGoodsRealPrice(goods.getStandPrice());
-
+            orderGoods.setGoodsYear(goods.getYear().toString());
             orderGoods.setCreateTime(DateUtils.getNowTime());
             orderGoods.setUpdateTime(DateUtils.getNowTime());
 
@@ -632,7 +632,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             }
             //成交价
             orderGoods.setGoodsRealPrice(g.getGoodsRealPrice());
-
+            orderGoods.setGoodsYear(goods.getYear().toString());
             orderGoods.setCreateTime(DateUtils.getNowTime());
             orderGoods.setUpdateTime(DateUtils.getNowTime());
             orderGoods.setGoodsReceived(g.getGoodsReceived());
@@ -814,6 +814,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             body = "中正祥粤云-" + goods.getGoodsName();
             OrderGoods orderGoods = BeanUtil.toBean(g, OrderGoods.class);
             orderGoods.setOrderSn(out_trade_no);
+            orderGoods.setGoodsYear(goods.getYear().toString());
             if (g.getGoodsInputData() != null) {
                 orderGoods.setGoodsInputData(JSON.toJSONString(g.getGoodsInputData()));
             }
@@ -975,7 +976,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
     private void orderCostHandle(Order add,Integer type) {
         add.setCheckStatus(1);//C端订单不需要审核
-        add.setRefundStatus(1);
+        add.setOrderRefundStatus(1);
         add.setInvoiceStatus(0);
         add.setFinishStatus(type == 1? 1:0);
         add.setCreditStatus(0);
@@ -1221,6 +1222,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //成交价
             orderGoods.setStatus(1);
             orderGoods.setCreateTime(DateUtils.getNowTime());
+            orderGoods.setGoodsYear(goods.getYear().toString());
             orderGoods.setUpdateTime(DateUtils.getNowTime());
             if (StringUtils.isNotBlank(g.getDistributionCode())){
                 //分销订单
@@ -1405,6 +1407,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             orderGoods.setCompany(bo.getOrderStudent().getCompany());*/
             //成交价
             orderGoods.setStatus(1);
+            orderGoods.setGoodsYear(goods.getYear().toString());
             orderGoods.setGoodsRealPrice(goods.getStandPrice());
             orderGoods.setGoodsPrice(goods.getStandPrice());
             orderGoods.setCreateTime(DateUtils.getNowTime());

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

@@ -109,4 +109,7 @@ public interface IScheduleService extends IService<PolyvVideo> {
     void makeDivideSellerMonthBill();
 
     void makeDivideBrokerageMonthBill();
+
+    void createExamApply();
+
 }

File diff suppressed because it is too large
+ 454 - 237
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java


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

@@ -22,6 +22,9 @@ public class TopOldOrderGoodsAddBo {
     /** 商品id */
     @ApiModelProperty("商品id")
     private Long goodsId;
+    /** 商品年份 */
+    @ApiModelProperty("商品年份")
+    private String goodsYear;
     /** 商品标准价格 */
     @ApiModelProperty("商品标准价格")
     private BigDecimal goodsPrice;

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

@@ -33,6 +33,8 @@ private static final long serialVersionUID=1L;
     private String orderSn;
     /** 商品id */
     private Long goodsId;
+    /** 商品年份 */
+    private String goodsYear;
     /** 商品标准价格 */
     private BigDecimal goodsPrice;
     /** 商品成交价格 */

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

@@ -260,6 +260,16 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         if (ObjectUtils.isNotNull(orderVo.getOrderReceived()) && ObjectUtils.isNotNull(orderVo.getOrderRefunded())) {
             orderVo.setOrderPractical(orderVo.getOrderReceived().subtract(orderVo.getOrderRefunded()));
         }
+        TopOldOrderCheckLog checkLog = topOldOrderCheckLogService
+                .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                        .eq(TopOldOrderCheckLog::getOrderSn, orderSn)
+                        .eq(TopOldOrderCheckLog::getType, 1)//B端订单审核
+                        .eq(TopOldOrderCheckLog::getCheckSign, 1)
+                        .last("limit 1"));
+        if (ObjectUtils.isNotNull(checkLog)){
+            orderVo.setCheckReason(checkLog.getCheckReason());
+        }
+
         return orderVo;
     }
 
@@ -585,6 +595,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         edit.setCreateTime(DateUtils.getNowTime());
         edit.setUpdateTime(DateUtils.getNowTime());
         edit.setCheckStatus(0);
+        edit.setRefundStatus(order.getRefundStatus());
         //未收账款
         if (ObjectUtils.isNull(bo.getOrderReceived()) || bo.getOrderReceived().compareTo(new BigDecimal("0.00")) == 0) {
             edit.setOrderUncollected(bo.getPayPrice());
@@ -1028,6 +1039,24 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         for (TopOldOrderGoodsListVo item : list) {
             item.setUserCount(userCount);
             item.setCheckStatusStr(item.getCheckStr(item.getCheckStatus()));
+            //退款发起原因和审核意见
+            TopOldOrderRefund orderRefund = topOldOrderRefundService
+                    .getOne(new LambdaQueryWrapper<TopOldOrderRefund>()
+                    .eq(TopOldOrderRefund::getOrderGoodsId, item.getOrderGoodsId())
+                    .eq(TopOldOrderRefund::getStatus,1)
+                    .orderByDesc(TopOldOrderRefund::getCreateTime).last("limit 1"));
+            if (ObjectUtils.isNotNull(orderRefund)){
+                item.setRefundReason(orderRefund.getApplyReason());
+
+                List<TopOldOrderCheckLog> logList = topOldOrderCheckLogService
+                        .list(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                        .eq(TopOldOrderCheckLog::getRefundSn, orderRefund.getRefundSn())
+                        .eq(TopOldOrderCheckLog::getStatus, 1));
+                if (CollectionUtils.isNotEmpty(logList)){
+                    String collect = logList.stream().map(TopOldOrderCheckLog::getCheckReason).collect(Collectors.joining(","));
+                    item.setCheckReason(collect);
+                }
+            }
         }
         return list;
     }
@@ -1071,6 +1100,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                     brokerageFlag = true;
                 }
                 oldOrder.setCheckStatus(bo.getCheckStatus());
+                checkLog.setCheckStatus(1);
                 break;
             case 2://拒绝 恢复原本的佣金
                 if (StringUtils.isNotBlank(oldOrder.getCostJson())
@@ -1091,6 +1121,8 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 } else {
                     oldOrder.setCheckStatus(bo.getCheckStatus());
                 }
+                checkLog.setCheckStatus(-1);
+                checkLog.setCheckReason(bo.getCheckReason());
                 break;
             default:
                 break;
@@ -1106,6 +1138,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         }
 
         updateById(oldOrder);
+        topOldOrderCheckLogService.updateById(checkLog);
 
         if (bo.getCheckStatus() == 1 && oldOrder.getFinishSign() == 0 && oldOrder.getOrderUncollected().compareTo(BigDecimal.ZERO) == 0) {
             //订单审核通过,账款已结清,满足完单条件
@@ -2243,7 +2276,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                         .in(OrderGoods::getOrderGoodsId, orderGoodsIds));
 
                 orderService.update(new LambdaUpdateWrapper<Order>()
-                        .set(Order::getRefundStatus, 4) //未通过
+                        .set(Order::getOrderRefundStatus, 4) //未通过
                         .eq(Order::getOrderSn, refundList.get(0).getOrderSn()));
             }
 
@@ -2366,7 +2399,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
 
             if (periodStatus == 2) {
                 orderService.update(new LambdaUpdateWrapper<Order>()
-                        .set(Order::getRefundStatus, 2) //未退款
+                        .set(Order::getOrderRefundStatus, 2) //未退款
                         .eq(Order::getOrderSn, refundList.get(0).getOrderSn()));
             }
         }

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

@@ -31,6 +31,9 @@ public class TopOldOrderGoodsListVo {
 	/** 商品id */
 	@ApiModelProperty("商品id")
 	private Long goodsId;
+	/** 商品年份 */
+	@ApiModelProperty("商品年份")
+	private String goodsYear;
 	/** 商品标准价格 */
 	@ApiModelProperty("商品标准价格")
 	private BigDecimal goodsPrice;
@@ -75,6 +78,10 @@ public class TopOldOrderGoodsListVo {
 	private Integer userCount;
 	@ApiModelProperty("学员状态:0待审核,1已通过,2未通过,3已撤销,-1已取消")
 	private Integer checkStatus;
+	@ApiModelProperty("退款申请原因")
+	private String refundReason;
+	@ApiModelProperty("审核意见")
+	private String checkReason;
 
 	private Long signId;
 

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserAppTelphoneLoginBo.java

@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import javax.validation.constraints.NotNull;
-
 
 /**
  * 客户端用户编辑对象 user
@@ -18,7 +16,9 @@ import javax.validation.constraints.NotNull;
 public class UserAppTelphoneLoginBo {
 
     @ApiModelProperty("标识")
-    @NotNull(message = "标识不能为空")
     private String sign;
 
+    @ApiModelProperty("用户账号")
+    private String userAccount;
+
 }

+ 45 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserLiveAccountLoginBo.java

@@ -0,0 +1,45 @@
+package com.zhongzheng.modules.user.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+
+/**
+ * 客户端用户编辑对象 user
+ *
+ * @author ruoyi
+ * @date 2021-06-08
+ */
+@Data
+@ApiModel("客户端用户账号直播统一登录对象")
+public class UserLiveAccountLoginBo {
+    @ApiModelProperty("手机号/身份证")
+    @NotNull(message = "账号不能为空")
+    private String account;
+    @ApiModelProperty("密码")
+    @NotNull(message = "密码不能为空")
+    private String pwd;
+
+    @ApiModelProperty("手机号")
+    private String tel;
+    @ApiModelProperty("验证码")
+    private String code;
+
+    @ApiModelProperty("直播路径")
+    private String liveUrl;
+
+    @ApiModelProperty("用户账号")
+    private String user_account;
+
+    @ApiModelProperty("参数")
+    private String param;
+
+    @ApiModelProperty("路径类型:1,H5 2,PC")
+    private Integer urlType;
+
+    @ApiModelProperty("登录类型:1直播")
+    private Integer type;
+}

+ 10 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserMapper.java

@@ -1,14 +1,13 @@
 package com.zhongzheng.modules.user.mapper;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.user.bo.RanKingUserQuery;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.User;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.user.vo.RanKingUser;
 import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
-import com.zhongzheng.modules.user.vo.UserVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -64,4 +63,13 @@ public interface UserMapper extends BaseMapper<User> {
 
     @InterceptorIgnore(tenantLine = "true")
     void editUserInfo(UserQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<User> getUserByTel(@Param("account")String account);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long getUserOrderCount(@Param("userId")Long userId,@Param("tenantId") Long tenantId,@Param("code") String code,@Param("goodsName") String goodsName);
+
+    @InterceptorIgnore(tenantLine = "true")
+    User getUserByAccount(@Param("userAccount")String userAccount);
 }

+ 8 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -1,12 +1,9 @@
 package com.zhongzheng.modules.user.service;
 
-import com.zhongzheng.common.core.domain.entity.SysUser;
-import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.vo.*;
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.Collection;
@@ -129,4 +126,11 @@ public interface IUserService extends IService<User> {
 
 	void batchUpdateTelId();
 
+	UserLiveAccountLoginVo liveUnifyLogin(UserLiveAccountLoginBo bo);
+
+	Map<String, Object> automaticAccountLogin(UserAppTelphoneLoginBo bo);
+
+	UserLiveAccountLoginVo smsLiveUnifyLogin(UserLiveAccountLoginBo bo);
+
+	UserLiveAccountLoginVo liveUnifyLoginRefresh(UserLiveAccountLoginBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -1486,6 +1486,10 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
 
     @Override
     public List<SubjectStudyRecordVo> listSubject(SubjectStudyRecordQueryBo bo) {
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        if (StringUtils.isNotBlank(tenantId)){
+            bo.setTenantId(Long.valueOf(tenantId));
+        }
         List<SubjectStudyRecordVo> subjectStudyRecordVos = baseMapper.listSubject(bo);
         return subjectStudyRecordVos;
     }

+ 70 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -32,8 +32,13 @@ import com.zhongzheng.modules.course.mapper.CourseMapper;
 import com.zhongzheng.modules.course.service.IMajorService;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeJson;
+import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeTwoAddBo;
+import com.zhongzheng.modules.exam.domain.ExamApplySite;
+import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
 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.vo.ExamApplySiteTimeTwoVo;
 import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
 import com.zhongzheng.modules.exam.vo.ExamApplyVo;
@@ -112,6 +117,12 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
     @Autowired
     private IExamApplySiteService iExamApplySiteService;
 
+    @Autowired
+    private IExamApplyService iExamApplyService;
+
+    @Autowired
+    private IExamApplySiteTimeService iExamApplySiteTimeService;
+
     @Autowired
     private IMajorService majorService;
 
@@ -2000,6 +2011,36 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         if (System.currentTimeMillis()/1000 > time){
             throw new CustomException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
         }
+        //生成座位号
+        ExamApplySite applySite = iExamApplySiteService.getOne(new LambdaQueryWrapper<ExamApplySite>()
+                .eq(ExamApplySite::getApplyId, bo.getApplyId())
+                .eq(ExamApplySite::getSiteId, bo.getSiteId())
+                .last("limit 1"));
+        if (ObjectUtils.isNull(applySite)){
+            throw new CustomException("考试地点查询有误,请检查");
+        }
+        List<ExamApplySiteTime> siteTimeList = iExamApplySiteTimeService.list(new LambdaQueryWrapper<ExamApplySiteTime>()
+                .eq(ExamApplySiteTime::getApplyId, bo.getApplyId())
+                .eq(ExamApplySiteTime::getApplySiteId, applySite.getId())
+                .eq(ExamApplySiteTime::getExamTime, bo.getApplySiteExamTime()));
+        if (CollectionUtils.isEmpty(siteTimeList)){
+            throw new CustomException("考试时间查询有误,请检查");
+        }
+        ExamApplySiteTime examApplySiteTime = siteTimeList.stream().filter(item -> {
+            List<ExamApplySiteTimeTwoAddBo> siteTimeTwoAddBos = JSONArray.parseArray(item.getSiteTime(), ExamApplySiteTimeTwoAddBo.class);
+            ExamApplySiteTimeTwoAddBo twoAddBo = siteTimeTwoAddBos.get(0);
+            return twoAddBo.getStartTime().equals(bo.getApplySiteStartTime()) && twoAddBo.getEndTime().equals(bo.getApplySiteEndTime());
+        }).findFirst().orElse(null);
+        if (ObjectUtils.isNull(examApplySiteTime)){
+            throw new CustomException("预约考试时间不存在,请重新选择");
+        }
+        //考场人数
+        List<ExamApplySiteTimeTwoAddBo> siteTimeTwoAddBos = JSONArray.parseArray(examApplySiteTime.getSiteTime(), ExamApplySiteTimeTwoAddBo.class);
+        Long userNum = siteTimeTwoAddBos.get(0).getNum();
+
+        //生成座位号
+        Integer tNum = getSeatNumber(bo,userNum);
+        add.setSeatNumber(tNum.toString());
         //要求非必填考点
         if(Validator.isNotEmpty(bo.getApplySiteAddress())){
             ExamApplyQueryBo queryTimeBo = new ExamApplyQueryBo();
@@ -2052,6 +2093,35 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         return add.getSubscribeId();
     }
 
+    private Integer getSeatNumber(UserSubscribeAddBo bo,Long userNum) {
+        List<UserSubscribe> list = list(new LambdaQueryWrapper<UserSubscribe>().eq(UserSubscribe::getApplyId, bo.getApplyId())
+                .eq(UserSubscribe::getApplySiteStartTime, bo.getApplySiteStartTime())
+                .eq(UserSubscribe::getApplySiteEndTime, bo.getApplySiteEndTime())
+                .eq(UserSubscribe::getSubscribeStatus, 1)
+                .eq(UserSubscribe::getSiteId, bo.getSiteId()));
+        if (CollectionUtils.isEmpty(list)){
+            return 1;
+        }
+        if (list.size() >= userNum){
+            throw new CustomException("本场考试已预约满,请选择其他场次!");
+        }
+        if (list.stream().allMatch(x -> ObjectUtils.isNull(x.getSeatNumber()))){
+            return 1;
+        }
+        Integer num = 0;
+        randomNum(list,num);
+        return num;
+    }
+
+    private void randomNum(List<UserSubscribe> list, Integer num) {
+        Random random = new Random();
+        Integer tNum = 1 + random.nextInt(50);
+        if (list.stream().anyMatch(x -> Integer.parseInt(x.getSeatNumber()) == tNum)){
+            randomNum(list,num);
+        }
+        num = tNum;
+    }
+
     private String drawReport(String imageStr, UserSubscribeSignReportBo bo){
         Font font = new Font("宋体", Font.BOLD, 48);// 添加字体的属性设置 微软雅黑
         String imgName = null;

+ 29 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserLiveAccountLoginVo.java

@@ -0,0 +1,29 @@
+package com.zhongzheng.modules.user.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 客户端用户编辑对象 user
+ *
+ * @author ruoyi
+ * @date 2021-06-08
+ */
+@Data
+@ApiModel("客户端用户账号直播统一登录对象")
+public class UserLiveAccountLoginVo {
+
+    @ApiModelProperty("手机号/身份证")
+    private String user_account;
+
+    @ApiModelProperty("手机号")
+    private String tel;
+
+    @ApiModelProperty("跳转路径")
+    private String url;
+
+    @ApiModelProperty("机构ID")
+    private Long tenantId;
+}

+ 8 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -770,4 +770,12 @@
     <select id="getCourseByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.Course">
         select * from course where code = #{code} and tenant_id = #{newTenantId}
     </select>
+
+    <select id="getCourseByNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.Course">
+        select * from course where course_id = #{cid}
+    </select>
+
+    <select id="getCourseByTenantTwo" parameterType="map" resultType="java.lang.Long">
+        select * from course where course_name = #{courseName} and code = #{code} and tenant_id = #{tenantId}
+    </select>
 </mapper>

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

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             cmc.id,
             cmc.module_id,
                (SELECT
-                    count(ccs.section_id) from course_chapter_section ccs where ccs.chapter_id = cc.chapter_id) as section_num
+                    count(ccs.section_id) from course_chapter_section ccs where ccs.chapter_id = cc.chapter_id AND ccs.tenant_id = #{tenantId}) as section_num
         FROM
             course_module_chapter cmc
                 LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id

+ 10 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml

@@ -252,6 +252,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="getSectionByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseSection">
-        SELECT * from course_section where code = #{code} and teacher_id = #{newTenantId}
+        SELECT * from course_section where code = #{code} and tenant_id = #{newTenantId}
     </select>
+
+    <select id="getSectionByNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.CourseSection">
+        SELECT * from course_section where section_id = #{sid}
+    </select>
+
+    <select id="getSectionByTenantTwo" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseSection">
+        SELECT * from course_section where `name` = #{name} and code = #{code} and tenant_id = #{tenantId}
+    </select>
+
 </mapper>

+ 34 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -523,4 +523,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             chapter_id,
             section_id
     </select>
+
+
+    <select id="getExamApplyByUser" parameterType="map" resultType="com.zhongzheng.modules.user.domain.UserSubscribe">
+        SELECT
+            *
+        FROM
+            user_subscribe us
+                LEFT JOIN goods g ON us.goods_id = g.goods_id
+                LEFT JOIN major m ON g.major_id = m.id
+        WHERE
+            us.user_id = #{userId}
+          AND INSTR( m.category_name, #{majorName} ) > 0
+          AND us.subscribe_status = 1
+        ORDER BY
+            us.create_time DESC
+            LIMIT 1
+    </select>
+
+    <select id="getExamUserInfo" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyDetailBo" resultType="com.zhongzheng.modules.exam.vo.ExamApplyDetailVo">
+        SELECT
+            us.seat_number as seatNum,
+            u.realname as userName,
+            u.id_card as idCard
+        FROM
+            user_subscribe us
+                LEFT JOIN `user` u ON us.user_id = u.user_id
+                AND u.tenant_id = 867735392558919680
+        WHERE
+            us.subscribe_status = 1
+          AND us.apply_site_exam_time = #{examTime}
+          AND us.apply_site_start_time = #{startTime}
+          AND us.apply_site_end_time = #{endTime}
+          AND us.tenant_id = 867735392558919680
+    </select>
 </mapper>

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

@@ -785,6 +785,13 @@
         FROM `goods`
         WHERE goods_id = #{goodsId}
     </select>
+
+    <select id="getGoodsByTenantTwo" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
+        SELECT *
+        FROM `goods`
+        WHERE goods_name = #{goodsName} and code = #{code} and tenant_id = #{tenantId}
+    </select>
+
     <update id="updateByTenant" parameterType="com.zhongzheng.modules.goods.domain.Goods">
         UPDATE goods
         SET `year`                  = #{year},

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

@@ -800,6 +800,7 @@
         <result property="goodsPrice" column="goods_price"/>
         <result property="goodsRealPrice" column="goods_real_price"/>
         <result property="checkStatus" column="check_status"/>
+        <result property="goodsYear" column="goods_year"/>
     </resultMap>
 
     <select id="listByOrderSn" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderGoodsQuery" resultMap="getlist">
@@ -816,6 +817,7 @@
             CONCAT( cb.business_name, cpt.project_name ) AS business_name,
             og.goods_price,
             og.goods_real_price,
+            og.goods_year,
             1 as check_status
         FROM
             order_goods og

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/top/TopOldOrderGoodsMapper.xml

@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="goodsRealPrice" column="goods_real_price"/>
         <result property="signId" column="sign_id"/>
         <result property="checkStatus" column="check_status"/>
+        <result property="goodsYear" column="goods_year"/>
     </resultMap>
 
     <select id="getListByQuery" parameterType="com.zhongzheng.modules.top.goods.bo.TopOldOrderGoodsQuery" resultMap="getlist">
@@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             business_name,
             goods_price,
             goods_real_price,
+            goods_year,
             sign_id,
             check_status
         FROM

+ 42 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -463,4 +463,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             user_id = #{userId}
     </select>
 
+    <select id="getUserByTel" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
+        SELECT
+            *
+        FROM
+            `user`
+        WHERE
+            status = 1
+            AND(id_card = #{account,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+            OR telphone = #{account,typeHandler=com.zhongzheng.common.type.EncryptHandler})
+    </select>
+
+    <select id="getUserByAccount" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
+        SELECT
+            *
+        FROM
+            `user`
+        WHERE
+            status = 1
+          AND user_account = #{userAccount}
+    </select>
+
+    <select id="getUserOrderCount" parameterType="map" resultType="java.lang.Long">
+        SELECT
+            COUNT(o.order_sn)
+        FROM
+            `order` o
+                INNER JOIN order_goods og ON o.order_sn = og.order_sn
+                AND og.tenant_id = #{tenantId}
+                INNER JOIN goods g ON og.goods_id = g.goods_id
+                AND g.tenant_id = #{tenantId}
+        WHERE
+            o.`status` = 1
+            AND o.user_id = #{userId}
+            AND g.`code` = #{code}
+            AND g.goods_name = #{goodsName}
+            AND og.refund_status != 2
+	        AND og.pay_status IN ( 2, 3, 4 )
+	        AND g.`status` = 1
+	        AND og.`status` = 1
+	        AND o.tenant_id = #{tenantId}
+    </select>
+
 </mapper>

+ 65 - 9
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -265,18 +265,61 @@
         r.subject_id,
         r.course_id,
         r.course_name,
-        (SELECT subject_name FROM course_subject s where s.id = r.subject_id) as subject_name,
-        (CASE WHEN (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in (1,2,3))> 0 THEN
+        (SELECT subject_name FROM course_subject s where s.id = r.subject_id
+        <if test="tenantId != null and tenantId !=''">
+            and s.tenant_id=#{tenantId}
+        </if>
+            ) as subject_name,
+        (CASE WHEN (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in (1,2,3)
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>)> 0 THEN
         '1' ELSE '0' END) as begin_status,
-        (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in (1)) as module_num,
+        (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in (1)
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>) as module_num,
         (SELECT COUNT(id)+(SELECT COUNT(p.id) FROM course_module_chapter p LEFT JOIN course_menu m on m.menu_id =
-        p.module_id where m.course_id = r.course_id and m.type in (1)) FROM course_menu m where m.course_id = r.course_id
+        p.module_id
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>
+        where m.course_id = r.course_id and m.type in (1)
+        <if test="tenantId != null and tenantId !=''">
+            and p.tenant_id=#{tenantId}
+        </if>) FROM course_menu m where m.course_id = r.course_id
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>
         and m.type in (2)) as chapter_num,
         (SELECT COUNT(id)+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_module_chapter p on
-        n.chapter_id = p.chapter_id LEFT JOIN course_menu m on m.menu_id = p.module_id where m.course_id = r.course_id
-        and m.type in (1))+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_menu m on m.menu_id =
-        n.chapter_id where m.course_id = r.course_id and m.type in (2)) FROM course_menu m where m.course_id =
-        r.course_id and m.type in (3)) as section_num,
+        n.chapter_id = p.chapter_id
+        <if test="tenantId != null and tenantId !=''">
+            and p.tenant_id=#{tenantId}
+        </if>
+            LEFT JOIN course_menu m on m.menu_id = p.module_id
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>
+        where m.course_id = r.course_id
+        and m.type in (1)
+        <if test="tenantId != null and tenantId !=''">
+            and n.tenant_id=#{tenantId}
+        </if>
+            )+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_menu m on m.menu_id =
+        n.chapter_id
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>
+            where m.course_id = r.course_id and m.type in (2)
+        <if test="tenantId != null and tenantId !=''">
+            and n.tenant_id=#{tenantId}
+        </if>) FROM course_menu m where m.course_id =
+        r.course_id and m.type in (3)
+        <if test="tenantId != null and tenantId !=''">
+            and m.tenant_id=#{tenantId}
+        </if>
+            ) as section_num,
         (select COUNT(DISTINCT course_id,module_id,chapter_id,section_id) FROM user_study_record c where 1=1
         AND c.course_id = r.course_id
         and c.current_status=1
@@ -286,6 +329,9 @@
         <if test="orderGoodsId != null and orderGoodsId !=''">
             and c.order_goods_id=#{orderGoodsId}
         </if>
+        <if test="tenantId != null and tenantId !=''">
+            and c.tenant_id=#{tenantId}
+        </if>
         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
@@ -295,10 +341,20 @@
         <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
+        <if test="tenantId != null and tenantId !=''">
+            and c.tenant_id=#{tenantId}
+        </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
+        <if test="tenantId != null and tenantId !=''">
+            and cs.tenant_id=#{tenantId}
+        </if>
+        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
+        <if test="tenantId != null and tenantId !=''">
+            and c.tenant_id=#{tenantId}
+        </if>
         where 1=1
         <if test="goodsId != null and goodsId !=''">
             and c.goods_id =#{goodsId}

Some files were not shown because too many files changed in this diff