|
|
@@ -14,6 +14,8 @@ import com.zd.laboratory.mapper.LabTimedExhaustJoinsubMapper;
|
|
|
import com.zd.laboratory.mapper.LabTimedExhaustMapper;
|
|
|
import com.zd.laboratory.service.ILabTimedExhaustService;
|
|
|
import com.zd.model.constant.BaseConstants;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -47,6 +49,8 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(LabTimedExhaustServiceImpl.class);
|
|
|
+
|
|
|
/**
|
|
|
* 查询定时排风列表
|
|
|
*
|
|
|
@@ -144,6 +148,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
LabTimedExhaust labTimedExhaust = new LabTimedExhaust();
|
|
|
labTimedExhaust.setExhaustType(1);
|
|
|
List <LabTimedExhaust> timedExhaustList = labTimedExhaustMapper.selectLabTimedExhaustList(labTimedExhaust);
|
|
|
+ log.info("定时排风执行开始,查询执行任务为------------------"+timedExhaustList.size()+"条");
|
|
|
List<LabTimedExhaustVo> timedExhaustVoList = Optional.ofNullable(timedExhaustList).orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
.map(a->getTimedExhaustVo(a)).collect(Collectors.toList());
|
|
|
@@ -170,7 +175,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
dateStr = ""+dateInt;
|
|
|
}
|
|
|
Integer newDateInt = Integer.parseInt(year+""+monthStr+""+""+dateStr);
|
|
|
-
|
|
|
+ log.info("定时排风日期转换,获取年月日------------------"+newDateInt);
|
|
|
//todo 函数校验当日是否落选到时间区间 这里由于需求变动,在跳过节假日的时候,数据上报是不是节假日的日期时间段
|
|
|
Predicate<List <LabExecutionDateVo>> predicate = a->a.stream()
|
|
|
.map(b->{
|
|
|
@@ -184,6 +189,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
.filter(b-> StringUtils.isNotNull(b))
|
|
|
.collect(Collectors.toList()).size()>0;
|
|
|
|
|
|
+ log.info("定时排风过滤,把执行日期时间段匹配不到的数据过滤");
|
|
|
Function <List<LabTimedExhaustVo>,List<LabTimedExhaustVo>> consumer = a->a.stream()
|
|
|
.filter(b->{
|
|
|
if(StringUtils.isNotNull(b.getExecutionDateVoList()) && b.getExecutionDateVoList().size()>0){
|
|
|
@@ -213,6 +219,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
}
|
|
|
|
|
|
public void executionFun(final Long subId,List <LabExhaustPeriodVo> exhaustPeriodVoList,Calendar calendar){
|
|
|
+ log.info("执行过滤后的数据:"+JSON.toJSON(exhaustPeriodVoList)+"===实验室id:"+subId);
|
|
|
Predicate<LabExhaustPeriodVo> predicate = a->{
|
|
|
// Integer[] weekDays = { 7, 1, 2, 3, 4, 5, 6 };
|
|
|
int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
|
|
@@ -244,7 +251,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+ log.info("执行排风时段过滤");
|
|
|
Optional.ofNullable(exhaustPeriodVoList).orElseGet(Collections::emptyList)
|
|
|
.stream()
|
|
|
.filter(a->predicate.test(a))
|
|
|
@@ -278,6 +285,7 @@ public class LabTimedExhaustServiceImpl implements ILabTimedExhaustService {
|
|
|
}
|
|
|
|
|
|
public void executionTimer(final Long newBeginTime,final Long subId,final Integer type){
|
|
|
+ log.info("将最后的匹配到的实验室存入redis subId="+subId+",type="+type+",newBeginTime="+newBeginTime);
|
|
|
LabDealyNotifyVo labDealyNotifyVo = new LabDealyNotifyVo();
|
|
|
labDealyNotifyVo.setRandomNum(UUID.randomUUID().toString());
|
|
|
labDealyNotifyVo.setSubId(subId);
|