LAPTOP-KB9HII50\70708 2 years ago
parent
commit
8692537610

+ 20 - 3
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/event/ApplicationEvent.java

@ -5,9 +5,7 @@ import com.yihu.jw.care.job.QuartzHelper;
import com.yihu.jw.care.job.birthday.BirthdayWishesNotPushJob;
import com.yihu.jw.care.job.consult.FinishConsultJob;
import com.yihu.jw.care.job.data.SaveDataPushJob;
import com.yihu.jw.care.job.device.DeviceLostAssociationJob;
import com.yihu.jw.care.job.device.PatientSosContactsJob;
import com.yihu.jw.care.job.device.PressureGlucoseNotJob;
import com.yihu.jw.care.job.device.*;
import com.yihu.jw.care.job.message.DoctorSendUnreadJob;
import com.yihu.jw.care.job.message.PatientSendUnreadJob;
import com.yihu.jw.care.job.order.CancelPayOrderJob;
@ -193,6 +191,25 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("DAILY_WATER_JOB success");
            }
            //#人脸库每天晚上3点跑一次
            if (!quartzHelper.isExistJob("DEVICE_DATA_FACE_JOB")){
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("DEVICE_DATA_FACE_JOB");
                quartzHelper.addJob(UpdPatientFaceJob.class, trigger, "DEVICE_DATA_FACE_JOB", new HashMap<String, Object>());
                logger.info("DEVICE_DATA_FACE_JOB success");
            }else {
                logger.info("DEVICE_DATA_FACE_JOB success");
            }
            //#人脸记录每30分钟跑一次
            if (!quartzHelper.isExistJob("SYN_FACE_RECORD_JOB")){
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("SYN_FACE_RECORD_JOB");
                quartzHelper.addJob(SynPatientFaceRecordsJob.class, trigger, "SYN_FACE_RECORD_JOB", new HashMap<String, Object>());
                logger.info("SYN_FACE_RECORD_JOB success");
            }else {
                logger.info("SYN_FACE_RECORD_JOB success");
            }
        } catch (Exception e) {
            logger.info(" job start failed");
        }

+ 27 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/SynPatientFaceRecordsJob.java

@ -0,0 +1,27 @@
package com.yihu.jw.care.job.device;
import com.yihu.jw.care.service.device.DeviceFaceService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 同步人脸记录数据 每30分钟跑一次
 * Created by yeshijie on 2022/6/2.
 */
@DisallowConcurrentExecution
public class SynPatientFaceRecordsJob implements Job {
    @Autowired
    private DeviceFaceService deviceFaceService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            deviceFaceService.deviceFace(2);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 28 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/UpdPatientFaceJob.java

@ -0,0 +1,28 @@
package com.yihu.jw.care.job.device;
import com.yihu.jw.care.service.device.DeviceFaceService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 更新人脸库数据 每天更新一次
 * Created by yeshijie on 2022/6/2.
 */
@DisallowConcurrentExecution
public class UpdPatientFaceJob implements Job {
    @Autowired
    private DeviceFaceService deviceFaceService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            deviceFaceService.deviceFace(1);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 44 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/DeviceFaceService.java

@ -0,0 +1,44 @@
package com.yihu.jw.care.service.device;
import com.yihu.jw.util.http.HttpClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2022/6/2.
 */
@Service
public class DeviceFaceService {
    private static Logger logger = LoggerFactory.getLogger(DeviceFaceService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    private static final String deviceUrl = "http://127.0.0.1:9112/";
    private static final String updPatientFaceUrl = "netDevTest/updPatientFace";
    private static final String synPatientFaceRecords = "netDevTest/synPatientFaceRecords";
    /**
     * 请求设备工程人脸数据
     * @param type 1人脸库 2人脸记录
     */
    public void deviceFace(Integer type){
        try {
            String url = deviceUrl;
            if(type==1){
                url += updPatientFaceUrl;
            }else if(type==2){
                url += synPatientFaceRecords;
            }else {
                return;
            }
            String response = httpClientUtil.get(url,"utf-8");
            logger.info("请求设备工程人脸数据:type="+type+",response"+response);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 5 - 1
svr/svr-cloud-job/src/main/resources/system.properties

@ -31,4 +31,8 @@ BLOOD_PRESSURE_GLUCOSE_NOT_MEASURED= 0 0 10 * * ?
#\u751F\u65E5\u795D\u798F\u672A\u53D1\u751F\u8BB0\u5F55
BIRTHDAY_WISHES_NOT_PUSH_JOB= 0 0 3 * * ?
#\u667A\u6167\u6C34\u8868\u5DE5\u5355\u89E6\u53D1
DAILY_WATER_JOB= 0 15 * * * ?
DAILY_WATER_JOB= 0 15 * * * ?
#\u4EBA\u8138\u5E93\u6BCF\u5929\u665A\u4E0A3\u70B9\u8DD1\u4E00\u6B21
DEVICE_DATA_FACE_JOB= 0 0 3 * * ? *
#\u4EBA\u8138\u8BB0\u5F55\u6BCF30\u5206\u949F\u8DD1\u4E00\u6B21
SYN_FACE_RECORD_JOB= 0 0/30 * * * ? *