Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

liweifan vor 2 Jahren
Ursprung
Commit
1f3a869321
16 geänderte Dateien mit 213 neuen und 101 gelöschten Zeilen
  1. 0 14
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentController.java
  2. 8 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/HelpCenterContentDao.java
  3. 2 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/SysNewsInformationDao.java
  4. 17 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/HelpCenterContentServiceImpl.java
  5. 2 2
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/SysNewsInformationServiceImpl.java
  6. 1 1
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/task/NoticeReleaseTask.java
  7. 14 3
      cooleshow-cms/src/main/resources/config/mybatis/HelpCenterContentMapper.xml
  8. 0 36
      cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  9. 0 2
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java
  10. 23 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/PracticeTeacherSearch.java
  11. 3 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java
  12. 6 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java
  13. 113 33
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  14. 10 3
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  15. 3 3
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseScheduleController.java
  16. 11 0
      toolset/utils/src/main/java/com/yonge/toolset/utils/date/DateUtil.java

+ 0 - 14
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentController.java

@@ -73,12 +73,6 @@ public class HelpCenterContentController extends BaseController {
 				return failed("未找到相关信息");
 			}
 
-			if (helpCenterContent.getCatalogId() ==2) {
-				if (helpCenterContent.getReleaseStatus() == 1) {
-					return failed("公告已发布不能修改");
-				}
-			}
-
 			if (helpCenterContent.getStatus() == 1) {
 				return failed("启用状态下,不能修改");
 			}
@@ -116,11 +110,6 @@ public class HelpCenterContentController extends BaseController {
 		if (helpCenterContent == null) {
 			return failed("未找到相关信息");
 		}
-		if (helpCenterContent.getCatalogId() ==2) {
-			if (helpCenterContent.getReleaseStatus() == 1) {
-				return failed("公告已发布不能修改");
-			}
-		}
 		if (helpCenterContent.getStatus() == 1) {
 			return failed("启用状态下,不能删除");
 		}
@@ -137,9 +126,6 @@ public class HelpCenterContentController extends BaseController {
 		if (helpCenterContent == null) {
 			return failed("未找到相关信息");
 		}
-		if (helpCenterContent.getCatalogId() == 2) {
-			return failed("公告不可禁用");
-		}
 		return succeed(helpCenterContentService.status(id));
 	}
 

+ 8 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/HelpCenterContentDao.java

@@ -35,4 +35,12 @@ public interface HelpCenterContentDao extends BaseDAO<Long, HelpCenterContent> {
      * @return
      */
     List<HelpCenterContent> selectNeedReleaseNotice();
+
+    /**
+     * 查看状态为启用的公告
+     *
+     * @param status
+     * @return
+     */
+    Integer selectByNoticeStatus(@Param("status") Integer status);
 }

+ 2 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/SysNewsInformationDao.java

@@ -79,4 +79,6 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	 * @return
 	 */
 	String selectAppVersionInfo(@Param("platform") String platform, @Param("version") String version);
+
+	Integer selectByStatus(Integer status);
 }

+ 17 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/HelpCenterContentServiceImpl.java

@@ -4,6 +4,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
+import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
+import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -45,6 +48,20 @@ public class HelpCenterContentServiceImpl extends BaseServiceImpl<Long, HelpCent
     @Override
 	@Transactional
     public boolean status(Long id) {
+		HelpCenterContent helpCenterContent = contentCenterDao.get(id);
+		if (helpCenterContent.getCatalogId() != 2) {
+			contentCenterDao.status(id);
+			return true;
+		}
+		if (helpCenterContent.getStatus().equals(NewsStatusEnum.SHOW.getCode())) {
+			contentCenterDao.status(id);
+			return true;
+		}
+		Integer count = contentCenterDao.selectByNoticeStatus(NewsStatusEnum.SHOW.getCode());
+
+		if (count >0) {
+			throw  new BizException("有正在启用的广告");
+		}
 
 		contentCenterDao.status(id);
 		return true;

+ 2 - 2
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -188,10 +188,10 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 			return true;
 		}
 
-		Integer count = sysNewsInformationDao.selectByVersionAndStatus(sysNewsInformationDto.getAttribute1(),NewsStatusEnum.SHOW.getCode());
+		Integer count = sysNewsInformationDao.selectByVersionAndStatus(null,NewsStatusEnum.SHOW.getCode());
 
 		if (count >0) {
-			throw  new BizException("有正在启用的告");
+			throw  new BizException("有正在启用的广告");
 		}
 		sysNewsInformationDao.updateStatus(id);
 		return true;

+ 1 - 1
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/task/NoticeReleaseTask.java

@@ -31,7 +31,7 @@ public class NoticeReleaseTask {
     /**
      * 公告发布轮询
      */
-    @GetMapping("/noticeRelease")
+    // @GetMapping("/noticeRelease")
     public HttpResponseResult noticeRelease(){
         // 查询将要发布的公告 (0 ~ 当前时间 + 5 min 的未发布的公告) 循环发布
         List<HelpCenterContent> helpCenterContents = helpCenterContentService.getNeedReleaseNotice();

+ 14 - 3
cooleshow-cms/src/main/resources/config/mybatis/HelpCenterContentMapper.xml

@@ -31,8 +31,8 @@
 				and content.title_ like '%' #{title} '%'
 			</if>
 			<if test="status!= null">
-				and ((content.status_ = #{status} and content.catalog_id_ = 1)
-					or (content.release_status_ = #{status} and content.catalog_id_ = 2))
+			and ((content.status_ = #{status} and content.catalog_id_ = 1)
+				or (content.status_ = #{status} and content.catalog_id_ = 2 and content.release_time_ &lt;= now()))
 			</if>
 			<if test="catalogType != null and catalogType != ''">
 				and content.catalog_type_ = #{catalogType}
@@ -228,7 +228,7 @@
 		left join sys_user su on su.id_ = t.user_id_
 	</insert>
 
-	<select id="selectNeedReleaseNotice" resultType="com.yonge.cooleshow.cms.dal.entity.HelpCenterContent">
+	<select id="selectNeedReleaseNotice"  resultMap="HelpCenterContentBlobs">
 		select
 		<include refid="Base_Column_List_union" />
 		from help_center_content content
@@ -239,4 +239,15 @@
 		and content.catalog_id_ = 2
 		and content.release_status_ = 0
 	</select>
+
+	<select id="selectByNoticeStatus" resultType="java.lang.Integer">
+		select count(1)
+		from help_center_content hcc
+		<where>
+			hcc.catalog_id_ = 2
+			<if test="status != null">
+				and hcc.status_ = #{status}
+			</if>
+		</where>
+	</select>
 </mapper>

+ 0 - 36
cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -107,62 +107,26 @@
 			<if test="status != null">
 				status_ = #{status, typeHandler=com.yonge.toolset.mybatis.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="title != null">
 				title_ = #{title},
-			</if>
-			<if test="updateTime != null">
 				update_time_ = NOW(),
-			</if>
-			<if test="content != null">
 				content_ = #{content},
-			</if>
-			<if test="coverImage != null">
 				cover_image_ = #{coverImage},
-			</if>
-			<if test="videoCoverImage != null">
 				video_cover_image_ = #{videoCoverImage},
-			</if>
-			<if test="type != null">
 				type_ = #{type},
-			</if>
 				online_time_ = #{onlineTime},
 				offline_time_ = #{offlineTime},
-			<if test="subType != null and subType != ''">
 				sub_type_ = #{subType},
-			</if>
-			<if test="linkUrl != null">
 				link_url_ = #{linkUrl},
-			</if>
-			<if test="hrefTarget != null">
 				href_target_ = #{hrefTarget},
-			</if>
-			<if test="order != null">
 				order_ = #{order},
-			</if>
-			<if test="memo != null">
 				memo_ = #{memo},
-			</if>
-			<if test="delFlag != null">
 				del_flag_ = #{delFlag},
-			</if>
-			<if test="attribute1 != null">
 				attribute1_ = #{attribute1},
-			</if>
-			<if test="attribute2 != null">
 				attribute2_ = #{attribute2},
-			</if>
-			<if test="subjectIdList != null">
 				subject_id_list_ = #{subjectIdList},
-			</if>
-			<if test="updateBy != null">
 				update_by_ = #{updateBy},
-			</if>
-			<if test="linkType != null">
 				link_type_ = #{linkType},
-			</if>
-			<if test="showTime != null">
 				show_time_ = #{showTime}
-			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>

+ 0 - 2
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java

@@ -9,7 +9,6 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.enums.OrdeerCacherEnmu;
 import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
-import com.yonge.cooleshow.util.DistributedLock;
 import com.yonge.cooleshow.sdk.adapay.PaymentSdk;
 import com.yonge.cooleshow.sdk.req.OrderPayReq;
 import com.yonge.cooleshow.sdk.res.OrderPayRes;
@@ -28,7 +27,6 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 import java.util.Map;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 /**

+ 23 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/PracticeTeacherSearch.java

@@ -4,6 +4,8 @@ import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 /**
  * @Author: cy
  * @Date: 2022/4/19
@@ -19,6 +21,27 @@ public class PracticeTeacherSearch extends QueryInfo {
     @ApiModelProperty(value = "排序字段(starGrade,expTime,subjectPrice) 排序规则(升序:ASC 降序:DESC)")
     private String sort;
 
+    @ApiModelProperty(value = "是否筛选未来30天老师")
+    private Boolean isScreen;
+
+    private List<Long> teacherIdList;
+
+    public Boolean getScreen() {
+        return isScreen;
+    }
+
+    public void setScreen(Boolean screen) {
+        isScreen = screen;
+    }
+
+    public List<Long> getTeacherIdList() {
+        return teacherIdList;
+    }
+
+    public void setTeacherIdList(List<Long> teacherIdList) {
+        this.teacherIdList = teacherIdList;
+    }
+
     @Override
     public String getSort() {
         return sort;

+ 3 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java

@@ -232,7 +232,9 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
     void sendTodayNotRepliedAndNotDecorateHomework();
 
     Map<String, String> selectRoomConfig();
-    void test();
+
+    List<Long> getTeacherId(Integer amount);
+
     void scheduleTask();
 }
 

+ 6 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -915,11 +915,11 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                             .set(CourseSchedule::getStatus, CourseScheduleEnum.CANCEL.getCode())
                     );
                     // 直播课成课失败通知
-                    SysUser user = sysUserFeignService.queryUserById(courseGroup.getTeacherId());
-                    Map<Long, String> receivers = new HashMap<>();
-                    receivers.put(user.getId(), user.getPhone());
                     // 发短信
                     try {
+                        SysUser user = sysUserFeignService.queryUserById(courseGroup.getTeacherId());
+                        Map<Long, String> receivers = new HashMap<>();
+                        receivers.put(user.getId(), user.getPhone());
                         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_LIVE_COMPLETION_FAIL,
                                                            receivers, null, 0, null, null,
                                                            courseGroup.getName());
@@ -929,6 +929,9 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
 
                     // 发推送
                     try {
+                        SysUser user = sysUserFeignService.queryUserById(courseGroup.getTeacherId());
+                        Map<Long, String> receivers = new HashMap<>();
+                        receivers.put(user.getId(), user.getPhone());
                         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.LIVE_COMPLETION_FAIL,
                                                            receivers, null, 0, null, ClientEnum.TEACHER.getCode(),
                                                            courseGroup.getName());

+ 113 - 33
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -781,7 +781,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      */
     @Override
     public IPage<PracticeTeacherVo> teacherList(IPage<PracticeTeacherVo> page, PracticeTeacherSearch search) {
-        return page.setRecords(baseMapper.teacherList(page, search));
+        if (search.getScreen() != null && search.getScreen()) {
+            search.setTeacherIdList(getTeacherId(30));
+            return page.setRecords(baseMapper.teacherList(page, search));
+        } else {
+            return page.setRecords(baseMapper.teacherList(page, search));
+        }
     }
 
     /**
@@ -1331,52 +1336,125 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         return sysConfig;
     }
 
-    public void test() {
-        //1.查询所有过审的老师
+    /**
+     * 获取未来30天有空老师id
+     *
+     * @param amount 未来天数
+     * @return
+     */
+    public List<Long> getTeacherId(Integer amount) {
+        if (amount == null) {
+            amount = 30;
+        }
+        //查询所有过审的老师时间配置
         List<TeacherFreeTime> teacherFreeTime = teacherFreeTimeDao.getTeacherFreeTime();
 
-        //2.根据配置是否跳过节假日分组
-        //跳过节假日
+        //老师配置-跳过节假日
         List<TeacherFreeTime> skipHoliday = teacherFreeTime.stream().filter(item -> item.getSkipHolidayFlag()).collect(Collectors.toList());
-        //不跳过节假日
+        //老师配置
         List<TeacherFreeTime> noSkipHoliday = teacherFreeTime.stream().filter(item -> !item.getSkipHolidayFlag()).collect(Collectors.toList());
 
-        //3.查询节假日
+        //查询节假日
         HolidaysFestivals holidays = holidaysFestivalsDao.queryByYear(Integer.parseInt(DateUtil.getYear(new Date())));
         String[] strs = holidays.getHolidaysFestivalsJson().split(",");
         List<String> holiday = Arrays.asList(strs);
 
-        //4.获取未来30天日期
-        List<String> futureDays = DateUtil.getFutureDays(30);
-        //5.获取未来30天日期(剔除节假日)
+        //未来30天日期
+        List<String> futureDays = DateUtil.getFutureDays(amount);
+        //未来30天日期-跳过节假日
         List<String> futureDaysNoVacation = futureDays.stream().filter(item -> !holiday.contains(item)).collect(Collectors.toList());
 
-        Map<Long, Object> map = new HashMap<>();
+        //查询所有老师未开始、进行中的课程
+        List<String> statusList = Lists.newArrayList(CourseScheduleEnum.NOT_START.getCode(), CourseScheduleEnum.ING.getCode());
 
+        List<Long> teacherIdList = new ArrayList<>();
+        getAllTimeConfig(skipHoliday, futureDaysNoVacation, teacherIdList);//跳过节假日配置
+        getAllTimeConfig(noSkipHoliday, futureDays, teacherIdList);//未跳过节假日配置
 
-        //6.遍历老师获取周1-7配置
-        for (TeacherFreeTime freeTimeConfig : skipHoliday) {//跳过节假日
-            String mondayConfig = freeTimeConfig.getMonday();
-            List<DateVo> mondayConfigList = JSONObject.parseArray(mondayConfig, DateVo.class);
-            List<DateChangeVo> rList = new ArrayList<>();//未来30天所有周一排课时间
+        return teacherIdList;
+    }
 
-            map.put(freeTimeConfig.getId(), rList);
-            for (String day : futureDaysNoVacation) {//遍历未来30天跳过节假日
-                String week = DateUtil.getWeek(day);
-                if (week.equals("monday")) {//当前时间为周一
-                    splicingDate(day, mondayConfigList, rList);
-                }
+    /**
+     * 获取未来30天有空老师id
+     *
+     * @param teacherFreeTime 老师配置
+     * @param futureDay       未来30天日期
+     * @param idList          未约满老师id集合
+     * @return
+     */
+    public List<Long> getAllTimeConfig(List<TeacherFreeTime> teacherFreeTime, List<String> futureDay, List<Long> idList) {
+        List<String> statusList = Lists.newArrayList(CourseScheduleEnum.NOT_START.getCode(), CourseScheduleEnum.ING.getCode());
+
+        for (TeacherFreeTime freeTimeConfig : teacherFreeTime) {//遍历老师配置
+            //根据老师id查询未开始、进行中的课程
+            List<CourseSchedule> scheduleList = this.list(Wrappers.<CourseSchedule>lambdaQuery()
+                    .eq(CourseSchedule::getTeacherId, freeTimeConfig.getTeacherId())
+                    .in(CourseSchedule::getStatus, statusList)
+                    .gt(CourseSchedule::getClassDate, DateUtil.getNowStr()));
+
+            if (CollectionUtils.isEmpty(scheduleList)) {//无人购课直接跳出本次循环
+                idList.add(freeTimeConfig.getTeacherId());
+                continue;
             }
-        }
-        System.out.println(map);
 
-        //7.遍历30天日期拼接配置 生成日历
+            //获取一周配置格式化
+            List<DateVo> monday = JSONObject.parseArray(freeTimeConfig.getMonday(), DateVo.class);
+            List<DateVo> tuesday = JSONObject.parseArray(freeTimeConfig.getTuesday(), DateVo.class);
+            List<DateVo> wednesday = JSONObject.parseArray(freeTimeConfig.getWednesday(), DateVo.class);
+            List<DateVo> thursday = JSONObject.parseArray(freeTimeConfig.getThursday(), DateVo.class);
+            List<DateVo> friday = JSONObject.parseArray(freeTimeConfig.getFriday(), DateVo.class);
+            List<DateVo> saturday = JSONObject.parseArray(freeTimeConfig.getSaturday(), DateVo.class);
+            List<DateVo> sunday = JSONObject.parseArray(freeTimeConfig.getSunday(), DateVo.class);
+
+            //存储未来30天所有时间
+            List<DateChangeVo> rList = new ArrayList<>();
+
+            for (String day : futureDay) {
+                switch (DateUtil.getWeek(day)) {
+                    case "monday":
+                        splicingDate(day, monday, rList);
+                        break;
+                    case "tuesday":
+                        splicingDate(day, tuesday, rList);
+                        break;
+                    case "wednesday":
+                        splicingDate(day, wednesday, rList);
+                        break;
+                    case "thursday":
+                        splicingDate(day, thursday, rList);
+                        break;
+                    case "friday":
+                        splicingDate(day, friday, rList);
+                        break;
+                    case "saturday":
+                        splicingDate(day, saturday, rList);
+                        break;
+                    case "sunday":
+                        splicingDate(day, sunday, rList);
+                        break;
+                }
+            }
 
-        //8.根据老师id查询未来课程时间
+            //记录冲突索引
+            List<Integer> indexList = new ArrayList<>();
 
-        //9.遍历7.8校验区间是否重合
+            for (int i = 0; i < rList.size(); i++) {//遍历未来30天所有时间
+                DateChangeVo dateChange = rList.get(i);
+                for (CourseSchedule schedule : scheduleList) {//遍历已排课时间
+                    //校验当前时间 与 排课时间是否冲突  记录冲突时间索引
+                    if (inInterSection(dateChange.getStartTime(), dateChange.getEndTime(), schedule.getStartTime(), schedule.getEndTime())) {
+                        indexList.add(i);
+                        continue;
+                    }
+                }
+            }
 
-        //10.记录没重合老师id
+            //冲突数<配置数 则有空档期 记录老师id
+            if (indexList.size() < rList.size()) {
+                idList.add(freeTimeConfig.getTeacherId());
+            }
+        }
+        return idList;
     }
 
     /**
@@ -1389,10 +1467,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      */
     public List<DateChangeVo> splicingDate(String day, List<DateVo> strDateList, List<DateChangeVo> rList) {
         for (DateVo vo : strDateList) {
-            DateChangeVo dateChange = new DateChangeVo();
-            dateChange.setStartTime(DateUtil.strToDate(day + " " + vo.getStartTime()));
-            dateChange.setEndTime(DateUtil.strToDate(day + " " + vo.getEndTime()));
-            rList.add(dateChange);
+            if (vo != null) {
+                DateChangeVo dateChange = new DateChangeVo();
+                dateChange.setStartTime(DateUtil.strToDate(day + " " + vo.getStartTime()));
+                dateChange.setEndTime(DateUtil.strToDate(day + " " + vo.getEndTime()));
+                rList.add(dateChange);
+            }
         }
         return rList;
     }
@@ -1403,7 +1483,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      * @Date: 2022/5/17
      */
     @Transactional(rollbackFor = Exception.class)
-    public void scheduleTask(){
+    public void scheduleTask() {
         baseMapper.updateStartTime();
         baseMapper.updateEndTime();
     }

+ 10 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -399,6 +399,12 @@
         AND p.subject_id_=#{param.subjectId}) sp ON t.user_id_=sp.teacherId
 
         WHERE t.user_id_ IN (SELECT teacher_id_ FROM teacher_free_time GROUP BY teacher_id_)
+        <if test="param.teacherIdList !=null">
+            AND t.user_id_ IN
+            <foreach collection="param.teacherIdList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="param.subjectId !=null">
             AND sp.subjectId=#{param.subjectId}
         </if>
@@ -628,7 +634,8 @@
     <select id="selectWeekNotStartCourseSchedule" resultType="java.lang.Integer">
         select count(1)
         from course_schedule cs
-        where cs.teacher_id_ = #{userId} and cs.status_ = 'NOT_START'
+        left join course_group cg on cs.course_group_id_ = cg.id_
+        where cs.teacher_id_ = #{userId} and cs.status_ = 'NOT_START' and cg.status_ = 'ING'
         and YEARWEEK(date_format(cs.class_date_,'%Y-%m-%d'),7) = YEARWEEK(now(),7)
     </select>
 
@@ -759,9 +766,9 @@
         )
     </select>
     <update id="updateStartTime">
-        UPDATE course_schedule SET status_='ING' WHERE <![CDATA[ start_time_ <= NOW() ]]> <![CDATA[ AND NOW() <= end_time_ ]]>
+        UPDATE course_schedule SET status_='ING' WHERE status_ != 'CANCEL' <![CDATA[ AND start_time_ <= NOW() ]]> <![CDATA[ AND NOW() <= end_time_ ]]>
     </update>
     <update id="updateEndTime">
-        UPDATE course_schedule SET status_='COMPLETE' WHERE <![CDATA[ end_time_ <= NOW() ]]>
+        UPDATE course_schedule SET status_='COMPLETE' WHERE status_ != 'CANCEL' <![CDATA[ AND end_time_ <= NOW() ]]>
     </update>
 </mapper>

+ 3 - 3
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseScheduleController.java

@@ -156,10 +156,10 @@ public class TeacherCourseScheduleController extends BaseController {
         return succeed(courseScheduleService.selectRoomConfig());
     }
 
+    //测试未约满课老师
     @GetMapping("/test")
-    public HttpResponseResult<Object> teset() {
-        courseScheduleService.test();
-        return succeed();
+    public HttpResponseResult<Object> test(Integer amount) {
+        return succeed(courseScheduleService.getTeacherId(amount));
     }
 }
 

+ 11 - 0
toolset/utils/src/main/java/com/yonge/toolset/utils/date/DateUtil.java

@@ -1411,6 +1411,17 @@ public class DateUtil {
 		return weeks[week_index];
 	}
 
+	/**
+	 * 获取当前日期
+	 * @return
+	 */
+	public static String getNowStr() {
+		Date currentTime = new Date();
+		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+		String dateStr = simpleDateFormat.format(currentTime);
+		return dateStr;
+	}
+
 	public static void main(String[] args) throws ParseException {
 		// DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 		DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");