|
|
|
|
@ -1,29 +1,34 @@
|
|
|
|
|
package com.biutag.supervision.job; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
|
import cn.hutool.core.stream.CollectorUtil; |
|
|
|
|
import cn.hutool.core.util.*; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.biutag.supervision.constants.enums.ComfortStatus; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.RpcApplyTypeEnum; |
|
|
|
|
import com.biutag.supervision.mapper.DwdAsjZfbaAjjbxxMapper; |
|
|
|
|
import com.biutag.supervision.mapper.DwdAsjZfbaWfrwfxxMapper; |
|
|
|
|
import com.biutag.supervision.mapper.RpcInfringerResultMapper; |
|
|
|
|
import com.biutag.supervision.mapper.SupDepartMapper; |
|
|
|
|
import com.biutag.supervision.mapper.*; |
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
|
import com.biutag.supervision.util.CommonUtil; |
|
|
|
|
import com.biutag.supervision.util.TimeUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.biutag.supervision.util.TimeUtil.SECONDS_OF_A_DAY; |
|
|
|
|
|
|
|
|
|
@ -38,6 +43,8 @@ public class Job {
|
|
|
|
|
|
|
|
|
|
private final BusinessDepartService businessDepartService; |
|
|
|
|
|
|
|
|
|
private final SupExternalDepartService externalDepartService; |
|
|
|
|
|
|
|
|
|
// 更新办理超时
|
|
|
|
|
@Scheduled(fixedRate = 600000) |
|
|
|
|
public void updateHandleTimeout() { |
|
|
|
|
@ -248,4 +255,48 @@ public class Job {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ZhkshDutyScheduleDcMapper zhkshDutyScheduleDcMapper; |
|
|
|
|
private SupRotaMapper supRotaMapper; |
|
|
|
|
//每天一次 00:20:00
|
|
|
|
|
//值班人员
|
|
|
|
|
@Scheduled(cron = "0 20 00 * * ?") |
|
|
|
|
public void operator(){ |
|
|
|
|
log.info("operator--------------------"); |
|
|
|
|
log.info("值班人员抓取中---------------------"); |
|
|
|
|
//1、值班人员数据获取
|
|
|
|
|
LocalDate startTime = LocalDate.now(); |
|
|
|
|
LocalDate endTime = startTime.plusMonths(1); |
|
|
|
|
List<ZhkshDutyScheduleDc> zhkshDutyScheduleDcs = zhkshDutyScheduleDcMapper.selectList(startTime,endTime); |
|
|
|
|
if(CollectionUtil.isEmpty(zhkshDutyScheduleDcs)){ |
|
|
|
|
log.warn("无值班人员"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//获取库中已有的值班数据(符合时间条件)
|
|
|
|
|
List<SupRota> rotas= supRotaMapper.selectList(new LambdaQueryWrapper<SupRota>().between(SupRota::getStartTime,startTime,endTime)); |
|
|
|
|
//剔除已录入过的数据
|
|
|
|
|
if(CollectionUtil.isNotEmpty(rotas)){ |
|
|
|
|
List<String> rotaIds = rotas.stream().map(SupRota::getScheduleId).toList(); |
|
|
|
|
zhkshDutyScheduleDcs=zhkshDutyScheduleDcs.stream().filter(x-> !rotaIds.contains(x.getScheduleId())).toList(); |
|
|
|
|
} |
|
|
|
|
List<SupRota> supRotaList = CommonUtil.copyBeanList(zhkshDutyScheduleDcs,SupRota.class); |
|
|
|
|
//2、值班人员数据处理
|
|
|
|
|
supRotaList.forEach(s->{ |
|
|
|
|
//获取数字督察一体系统对应的id
|
|
|
|
|
List<SupExternalDepart> supExternalDeparts= externalDepartService.list( |
|
|
|
|
new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
|
.eq(SupExternalDepart::getExternalId,s.getDeptCode()) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtil.isEmpty(supExternalDeparts)){ |
|
|
|
|
log.info("值班人员对应的值班单位不存在"); |
|
|
|
|
}else{ |
|
|
|
|
SupExternalDepart depart = supExternalDeparts.get(0); |
|
|
|
|
s.setDeptCode(depart.getInternalId()); |
|
|
|
|
s.setDeptName(depart.getInternalName()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
//3、值班人员转存
|
|
|
|
|
supRotaMapper.insert(supRotaList); |
|
|
|
|
log.info("值班数据录入完成"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|