Commit 0478a6a5 authored by zhangqingle's avatar zhangqingle

修改BUG

parent b6a2997f
...@@ -463,6 +463,17 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -463,6 +463,17 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" where business_id=#{businessId}", " where business_id=#{businessId}",
"</script>"}) "</script>"})
int updateAtChapter(BLessonPerson bLessonPerson); int updateAtChapter(BLessonPerson bLessonPerson);
/**
* 根据课程Id 查询人员id
* @param lessonId
* @return
*/
@Select("select business_id from b_lesson_person where 1=1 " +
" and del_flag = 0 and flag = 1 " +
" and lesson_id = #{lessonId} ")
List<String> queryPersonId(String lessonId);
} }
package org.rcisoft.business.blesson.dao; package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO; import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blesson.dto.*; import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.*; import org.rcisoft.business.blesson.entity.*;
...@@ -1160,5 +1159,12 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1160,5 +1159,12 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" </script>") " </script>")
int isInViewRange(@Param("curUser") CurUser curUser, @Param("lessonId") String lessonId, @Param("departs") List<String> departs); int isInViewRange(@Param("curUser") CurUser curUser, @Param("lessonId") String lessonId, @Param("departs") List<String> departs);
@Select("<script>" +
" select business_id, lesson_name " +
" from b_lesson where 1 = 1 " +
" and del_flag = 0 and flag = 1 " +
" AND #{param.nowDate} between SUBDATE(train_start_date,interval #{param.timeValue} ${param.valueTypeStr}) and SUBDATE(SUBDATE(train_start_date,interval #{param.timeValue} ${param.valueTypeStr}),interval -60 second)</script>")
@ResultMap(value = "MessageResultMap")
List<BLesson> selectLessonAtMessageTask(@Param("param") FindLessonAtMessageTaskDTO param);
} }
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FindLessonAtMessageTaskDTO {
private String corpId;
private String timeValue;
private String valueTypeStr;
private Date nowDate;
}
...@@ -270,6 +270,10 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -270,6 +270,10 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private Date signStartDate; private Date signStartDate;
@Transient
@ApiModelProperty(value = "学员id集合")
List<String> personList;
public void initModel(){ public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); // this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......
...@@ -1380,6 +1380,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1380,6 +1380,9 @@ public class BLessonServiceImpl implements BLessonService {
List<StudentTrackingRspDTO> studentTrackingRspDTOList = bLessonPersonRepository.userManageLesson(userLessonDTO,trainTypeSelStr); List<StudentTrackingRspDTO> studentTrackingRspDTOList = bLessonPersonRepository.userManageLesson(userLessonDTO,trainTypeSelStr);
Date now = new Date(); Date now = new Date();
studentTrackingRspDTOList.forEach(studentTrackingRspDTO -> { studentTrackingRspDTOList.forEach(studentTrackingRspDTO -> {
if (studentTrackingRspDTO.getTrainStartDate() == null || studentTrackingRspDTO.getTrainOverDate() == null || studentTrackingRspDTO.getTrainSignTime() == null){
return;
}
Long time = Long.parseLong(studentTrackingRspDTO.getTrainSignTime()) * 60 * 1000; Long time = Long.parseLong(studentTrackingRspDTO.getTrainSignTime()) * 60 * 1000;
Date signStart = new Date(studentTrackingRspDTO.getTrainStartDate().getTime() - time); Date signStart = new Date(studentTrackingRspDTO.getTrainStartDate().getTime() - time);
if (now.before(signStart)){ if (now.before(signStart)){
......
...@@ -40,5 +40,17 @@ public interface BMessageRepository extends BaseMapper<BMessage> { ...@@ -40,5 +40,17 @@ public interface BMessageRepository extends BaseMapper<BMessage> {
"#{item.name},#{item.timeValue},#{item.valueType},#{item.corpId},#{item.sort})" + "#{item.name},#{item.timeValue},#{item.valueType},#{item.corpId},#{item.sort})" +
"</foreach></script>") "</foreach></script>")
int insertList(List<BMessage> bMessageList); int insertList(List<BMessage> bMessageList);
/**
* 查询 bMessage
*
*/
@Select("<script>select * from b_message where 1=1 "
+ " and del_flag = 0 "
+ " and name = #{name} "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BMessage> queryByNameAndCorp(@Param("name") String name);
} }
...@@ -3,23 +3,63 @@ package org.rcisoft.core.task; ...@@ -3,23 +3,63 @@ package org.rcisoft.core.task;
//通知定时任务 //通知定时任务
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.FindLessonAtMessageTaskDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.bmessage.dao.BMessageRepository;
import org.rcisoft.business.bmessage.entity.BMessage;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
public class messageTask { public class messageTask {
@Autowired
BMessageRepository bMessageRepository;
@Autowired
BLessonRepository bLessonRepository;
@Scheduled(cron = "0 0/1 * * * ?") @Autowired
MTNotificationApiRequestClient mtNotificationApiRequestClient;
// @Scheduled(cron = "0/20 * * * * ?")
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void work() throws Exception { public void work() throws Exception {
Date nowDate = new Date();
//判断是否开启 //判断是否开启
List<BMessage> bMessagePXJJKSList = bMessageRepository.queryByNameAndCorp("PXJJKS");
//判断是否在设定时间内 //判断是否在设定时间内
if (bMessagePXJJKSList != null && bMessagePXJJKSList.size() > 0){
bMessagePXJJKSList.forEach(bMessage -> {
if (bMessage != null && "1".equals(bMessage.getFlag())){
String valueTypeStr = "MINUTE";
if ("2".equals(bMessage.getValueType())){
valueTypeStr = "HOUR";
}
if ("3".equals(bMessage.getValueType())){
valueTypeStr = "DAY";
}
FindLessonAtMessageTaskDTO param = new FindLessonAtMessageTaskDTO(bMessage.getCorpId(),bMessage.getTimeValue(),valueTypeStr,nowDate);
List<BLesson> bLessonList = bLessonRepository.selectLessonAtMessageTask(param);
if (bLessonList != null && bLessonList.size() > 0){
bLessonList.forEach(bLesson -> {
// MTNotificationSendReqDTO mtNotificationSendReqDTO = new MTNotificationSendReqDTO();
});
}
}
});
}
//在时间内发送通知 //在时间内发送通知
} }
} }
...@@ -196,4 +196,13 @@ ...@@ -196,4 +196,13 @@
<!--<resultMap id="SupperChildListResultMap" type="org.rcisoft.business.blesson.entity.BLesson" extends="BaseResultMap">--> <!--<resultMap id="SupperChildListResultMap" type="org.rcisoft.business.blesson.entity.BLesson" extends="BaseResultMap">-->
<!--<association column="business_id" property="labelList" select="org.rcisoft.business.blesson.dao.BLessonRepository.queryLabelByLessonId"></association>--> <!--<association column="business_id" property="labelList" select="org.rcisoft.business.blesson.dao.BLessonRepository.queryLabelByLessonId"></association>-->
<!--</resultMap>--> <!--</resultMap>-->
<resultMap id="MessageResultMap" type="org.rcisoft.business.blesson.entity.BLesson">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="lesson_name" jdbcType="VARCHAR" property="lessonName"/>
<collection property="personList" ofType="string"
javaType="java.util.ArrayList" select="org.rcisoft.business.blesson.dao.BLessonPersonRepository.queryPersonId"
column="business_id">
</collection>
</resultMap>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment