Sfoglia il codice sorgente

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

zouxuan 3 anni fa
parent
commit
eb87b4da26

+ 8 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -256,11 +256,16 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         if (record.getId() == null) {
             throw new Exception("订单未找到");
         }
-        if (cloudTeacherOrderDao.updateOrderStatusOK(record.getId()) <= 0) {
-            throw new Exception("更新订单状态失败");
-        }
+        // cloudTeacherOrderDao.updateOrderStatusOK(record.getId()
         List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderDao.findByPlatformOrderId(record.getId());
+        Date startTime = DateUtil.trunc(new Date());
+        Date endTime = new Date();
         for (CloudTeacherOrder cto : cloudTeacherOrders) {
+            endTime = calcCloudTeacherOrderTime(cto, startTime, endTime);
+            cto.setStartTime(startTime);
+            cto.setEndTime(endTime);
+            cto.setStatus(2);
+            cloudTeacherOrderDao.update(cto);
             studentService.updateMembershipEndTime(cto.getStudentId(), cto.getEndTime());
         }
 

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantCloudCourseRecordServiceImpl.java

@@ -2,6 +2,8 @@ package com.ym.mec.biz.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.TenantCloudCourseRecordDao;
 import com.ym.mec.biz.dal.entity.TenantCloudCourseRecord;
 import com.ym.mec.biz.dal.vo.TenantCloudCourseRecordVo;
@@ -10,6 +12,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -24,10 +27,15 @@ import java.util.Map;
 @Service("tenantCloudCourseRecordService")
 public class TenantCloudCourseRecordServiceImpl extends ServiceImpl<TenantCloudCourseRecordDao, TenantCloudCourseRecord> implements TenantCloudCourseRecordService {
 
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
     private final static Logger logger = LoggerFactory.getLogger(TenantCloudCourseRecordServiceImpl.class);
 
     @Override
     public PageInfo<TenantCloudCourseRecordVo> queryPage(Map<String, Object> param) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        param.put("tenantId", sysUser.getTenantId());
+
         Page<TenantCloudCourseRecordVo> pageInfo = PageUtil.getPageInfo(param);
         pageInfo.setAsc("a.created_time_");
         return PageUtil.pageInfo(baseMapper.queryPage(pageInfo, param));

+ 12 - 8
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -118,7 +118,7 @@
         where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
 
-    <select id="findByPlatformOrderId"  resultMap="CloudTeacherOrderDto" parameterType="map">
+    <select id="findByPlatformOrderId" resultMap="CloudTeacherOrder">
         select * from cloud_teacher_order where platform_order_id_ = #{platformOrderId}
     </select>
 
@@ -126,11 +126,11 @@
         update cloud_teacher_order set status_ = 2,
        `start_time_` = CURRENT_DATE(),
        `end_time_` = case
-         when type_ = 1 then date_add(CURRENT_DATE(), interval (`time_`) day)
-         when type_ = 2 then date_add(CURRENT_DATE(), interval (`time_`) month)
-         when type_ = 3 then date_add(CURRENT_DATE(), interval (`time_` * 3) month)
-         when type_ = 4 then date_add(CURRENT_DATE(), interval (`time_` * 6) month)
-         when type_ = 5 then date_add(CURRENT_DATE(), interval (`time_` * 12) month)
+         when type_ = 1 then concat(date_add(CURRENT_DATE(), interval `time_` day) , ' 00:00:00')
+         when type_ = 2 then concat(date_add(CURRENT_DATE(), interval `time_` month) , ' 00:00:00')
+         when type_ = 3 then concat(date_add(CURRENT_DATE(), interval `time_` * 3 month) , ' 00:00:00')
+         when type_ = 4 then concat(date_add(CURRENT_DATE(), interval `time_` * 6 month) , ' 00:00:00')
+         when type_ = 5 then concat(date_add(CURRENT_DATE(), interval `time_` year) , ' 00:00:00')
         end
         where platform_order_id_ = #{platformOrderId}
     </update>
@@ -375,7 +375,9 @@
         LEFT JOIN student_registration sr ON cto.student_id_ = sr.user_id_
         <where>
             cto.status_ = 2 AND tor.order_no_ is not null AND tor.order_type_ = 'CLOUD_TEACHER'
-            AND sr.music_group_id_ = #{musicGroupId}
+            <if test="musicGroupId != null and musicGroupId != ''">
+                AND sr.music_group_id_ = #{musicGroupId}
+            </if>
             <if test="queryCondition != null and queryCondition != ''">
                 AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
             </if>
@@ -418,7 +420,9 @@
         LEFT JOIN student_registration sr ON cto.student_id_ = sr.user_id_
         <where>
             cto.status_ = 2 AND tor.order_no_ is not null AND tor.order_type_ = 'CLOUD_TEACHER'
-            AND sr.music_group_id_ = #{musicGroupId}
+            <if test="musicGroupId != null and musicGroupId != ''">
+                AND sr.music_group_id_ = #{musicGroupId}
+            </if>
             <if test="queryCondition != null and queryCondition != ''">
                 AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
             </if>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SysCouponMapper.xml

@@ -113,7 +113,7 @@
         <set>
             stock_count_ = stock_count_ - #{param.exchangeNum},
             consume_num_ =consume_num_ + #{param.exchangeNum},
-            <if test="warningStatus != null">
+            <if test="param.warningStatus != null">
                 warning_status_ = #{param.warningStatus},
             </if>
             update_time_ = NOW()

+ 9 - 11
mec-biz/src/main/resources/config/mybatis/TenantCloudCourseRecordMapper.xml

@@ -32,17 +32,15 @@
         b.status_ as `status`,
         a.deduct_state_ as deductState,
         a.amount_ as amount
-        from
-        tenant_info as t
-        join tenant_cloud_course_record as a
-        on t.id_ = a.tenant_id_
-        left join course_schedule as b
-        on a.course_id_ = b.id_
-        left join sys_user as s
-        on b.teacher_id_ = s.id_
-        left join organization as o
-        on o.id_ = b.organ_id_
-        <where>
+        from tenant_info as t
+        join tenant_cloud_course_record as a  on t.id_ = a.tenant_id_
+        left join course_schedule as b        on a.course_id_ = b.id_
+        left join sys_user as s               on b.teacher_id_ = s.id_
+        left join organization as o           on o.id_ = b.organ_id_
+        <where> 1 = 1
+            <if test="param.tenantId != null ">
+                AND t.id_ = #{param.tenantId}
+            </if>
             <if test="param.search != null ">
                 AND (
                 b.`id_` LIKE CONCAT('%', #{param.search},'%')