|  | @ -0,0 +1,51 @@
 | 
												
													
														
															|  | 
 |  | package com.yihu.jw.service.channel;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.iot.dao.device.IotDeviceQualityInspectionPlanDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.iot.dao.message.IotMessageDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.iot.message.IotMessageDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.util.DateUtil;
 | 
												
													
														
															|  | 
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | 
 |  | import org.springframework.stereotype.Component;
 | 
												
													
														
															|  | 
 |  | import org.springframework.transaction.annotation.Transactional;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import javax.xml.ws.Action;
 | 
												
													
														
															|  | 
 |  | import java.util.Date;
 | 
												
													
														
															|  | 
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | /**
 | 
												
													
														
															|  | 
 |  |  * @author HZY
 | 
												
													
														
															|  | 
 |  |  * @vsrsion 1.0
 | 
												
													
														
															|  | 
 |  |  * Created at 2020/5/7
 | 
												
													
														
															|  | 
 |  |  */
 | 
												
													
														
															|  | 
 |  | @Component
 | 
												
													
														
															|  | 
 |  | @Transactional
 | 
												
													
														
															|  | 
 |  | public class DeviceQualityPlanService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private IotMessageDao iotMessageDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private IotDeviceQualityInspectionPlanDao iotDeviceQualityInspectionPlanDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void autoPush() {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<IotDeviceQualityInspectionPlanDO> listAll = iotDeviceQualityInspectionPlanDao.findListAll();
 | 
												
													
														
															|  | 
 |  |         listAll.forEach(one->{
 | 
												
													
														
															|  | 
 |  |             Date remindTime = one.getRemindTime();
 | 
												
													
														
															|  | 
 |  |             String system = DateUtil.dateToStrShort(DateUtil.getNowDate());
 | 
												
													
														
															|  | 
 |  |             String remind = DateUtil.dateToStrShort(remindTime);
 | 
												
													
														
															|  | 
 |  |             if (system.equalsIgnoreCase(remind)){
 | 
												
													
														
															|  | 
 |  |                 IotMessageDO iotMessageDO = new IotMessageDO();
 | 
												
													
														
															|  | 
 |  |                 iotMessageDO.setTitle("设备质检提醒");
 | 
												
													
														
															|  | 
 |  |                 iotMessageDO.setContent("订单:"+one.getPurchaseId()+".将于"+remind+",进行质检,请及时维护");
 | 
												
													
														
															|  | 
 |  |                 iotMessageDO.setRead("0");
 | 
												
													
														
															|  | 
 |  |                 iotMessageDO.setDel("0");
 | 
												
													
														
															|  | 
 |  |                 iotMessageDO.setTitle("4");
 | 
												
													
														
															|  | 
 |  |                 iotMessageDao.save(iotMessageDO);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         });
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | }
 |