设备质保状态-定时任务
This commit is contained in:
parent
de9ad3337c
commit
e3fa535b95
|
|
@ -63,6 +63,9 @@ public class TicketScheduledTasks {
|
||||||
@Resource
|
@Resource
|
||||||
private ITicketEvaluateService ticketEvaluateService;
|
private ITicketEvaluateService ticketEvaluateService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工单评论邀请邮件
|
* 工单评论邀请邮件
|
||||||
* 每天午夜12点执行一次
|
* 每天午夜12点执行一次
|
||||||
|
|
@ -136,6 +139,19 @@ public class TicketScheduledTasks {
|
||||||
log.info("执行工单超时提醒完成");
|
log.info("执行工单超时提醒完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备质保状态
|
||||||
|
* 每天午夜5点执行一次
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 5 * * ?")
|
||||||
|
public void updateDeviceWarrantyState() {
|
||||||
|
log.info("开始执行更新设备质保状态");
|
||||||
|
deviceService.taskWarrantyStateNotOutsideWarranty();
|
||||||
|
deviceService.taskWarrantyStateNotOutsideWithinWarranty();
|
||||||
|
deviceService.taskWarrantyStateNotStarted();
|
||||||
|
log.info("执行更新设备质保状态完成");
|
||||||
|
}
|
||||||
|
|
||||||
private void emergencyRemind(TiketTimeoutDTO cfgTimeout) {
|
private void emergencyRemind(TiketTimeoutDTO cfgTimeout) {
|
||||||
log.info("获取状态为紧急且{}天未解决的工单", cfgTimeout.getEmergency());
|
log.info("获取状态为紧急且{}天未解决的工单", cfgTimeout.getEmergency());
|
||||||
List<Ticket> tickets = ticketService.getEmergencys(cfgTimeout.getEmergency());
|
List<Ticket> tickets = ticketService.getEmergencys(cfgTimeout.getEmergency());
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,10 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||||
void batchDelByIds(@Param("ids")List<Integer> ids);
|
void batchDelByIds(@Param("ids")List<Integer> ids);
|
||||||
|
|
||||||
Page<DeviceVO> searchDevice(SearchDeviceRequest request, List<Integer> companyIds, Page<?> page);
|
Page<DeviceVO> searchDevice(SearchDeviceRequest request, List<Integer> companyIds, Page<?> page);
|
||||||
|
|
||||||
|
void taskWarrantyStateNotStarted();
|
||||||
|
|
||||||
|
void taskWarrantyStateNotOutsideWarranty();
|
||||||
|
|
||||||
|
void taskWarrantyStateNotOutsideWithinWarranty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,11 @@ public interface IDeviceService extends IService<Device> {
|
||||||
void batchDelByIds(@Param("ids") List<Integer> ids);
|
void batchDelByIds(@Param("ids") List<Integer> ids);
|
||||||
|
|
||||||
Page<DeviceVO> searchDevice(SearchDeviceRequest request);
|
Page<DeviceVO> searchDevice(SearchDeviceRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
void taskWarrantyStateNotStarted();
|
||||||
|
|
||||||
|
void taskWarrantyStateNotOutsideWarranty();
|
||||||
|
|
||||||
|
void taskWarrantyStateNotOutsideWithinWarranty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||||
List<Integer> companyIds = AppUserUtil.getCompanyIds();
|
List<Integer> companyIds = AppUserUtil.getCompanyIds();
|
||||||
return baseMapper.searchDevice(request, companyIds, new Page<>(request.getPage(), request.getPageSize()));
|
return baseMapper.searchDevice(request, companyIds, new Page<>(request.getPage(), request.getPageSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void taskWarrantyStateNotStarted(){
|
||||||
|
baseMapper.taskWarrantyStateNotStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void taskWarrantyStateNotOutsideWarranty(){
|
||||||
|
baseMapper.taskWarrantyStateNotOutsideWarranty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void taskWarrantyStateNotOutsideWithinWarranty(){
|
||||||
|
baseMapper.taskWarrantyStateNotOutsideWithinWarranty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,24 @@
|
||||||
and d.shipment_date <= #{request.endTime}
|
and d.shipment_date <= #{request.endTime}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<!--定时任务-质保未开始-->
|
||||||
|
<update id="taskWarrantyStateNotStarted">
|
||||||
|
update device set warranty_state=(select b.id from dictionary a
|
||||||
|
join dictionary_item b on a.id=b.dictionary_id
|
||||||
|
where a.code='deviceWarrantyState' and b.`code`='NotStarted') where start_warranty_date>now();
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--定时任务-质保外-->
|
||||||
|
<update id="taskWarrantyStateNotOutsideWarranty">
|
||||||
|
update device set warranty_state=(select b.id from dictionary a
|
||||||
|
join dictionary_item b on a.id=b.dictionary_id
|
||||||
|
where a.code='deviceWarrantyState' and b.`code`='OutsideWarranty') where DATE_ADD(start_warranty_date, INTERVAL warranty_month MONTH) < now();
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--定时任务-质保内-->
|
||||||
|
<update id="taskWarrantyStateNotOutsideWithinWarranty">
|
||||||
|
update device set warranty_state=(select b.id from dictionary a
|
||||||
|
join dictionary_item b on a.id=b.dictionary_id
|
||||||
|
where a.code='deviceWarrantyState' and b.`code`='WithinWarranty') where start_warranty_date <= now() and DATE_ADD(start_warranty_date, INTERVAL warranty_month MONTH) >= now() ;
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue