Преглед на файлове

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

mengkang преди 5 години
родител
ревизия
8f7745a3b2

+ 2 - 2
svr/svr-iot-job/pom.xml

@ -67,11 +67,11 @@
            <version>2.4</version>
        </dependency>
        <dependency>
        <!--<dependency>
            <groupId>com.yihu.iot</groupId>
            <artifactId>svr-iot</artifactId>
            <version>2.0.0</version>
        </dependency>
        </dependency>-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>

+ 13 - 32
svr/svr-iot-job/src/main/java/com/yihu/jw/event/ApplicationEvent.java

@ -1,6 +1,8 @@
package com.yihu.jw.event;
import com.yihu.jw.job.QuartzHelper;
import com.yihu.jw.job.wlw.InventoryWarningJob;
import com.yihu.jw.util.SystemConf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -8,6 +10,8 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;
import java.util.HashMap;
/**
 * Created by zdm on 2017/3/10.
 */
@ -21,41 +25,18 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
    @Override
    public void onApplicationEvent(ContextRefreshedEvent ContextRefreshedEvent) {
        try {
//=================中山医院发布启动======================================================
//            //互联网医院处方状态更新job
//            if (!quartzHelper.isExistJob("prescriptionStatus_update_job")) {
//                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescriptionStatus_update_job");
//                quartzHelper.addJob(PrescriptionStatusUpdateJob.class, trigger, "prescriptionStatus_update_job", new HashMap<String, Object>());
//                logger.info("prescriptionStatus_update_job  job success");
//            } else {
//                logger.info("prescriptionStatus_update_job  job exist");
//            }
//
//            //门诊过期
//            if (!quartzHelper.isExistJob("prescription_overdue_job")) {
//                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_overdue_job");
//                quartzHelper.addJob(PrescriptionOverdueJob.class, trigger, "prescription_overdue_job", new HashMap<String, Object>());
//                logger.info("prescription_overdue_job  job success");
//            } else {
//                logger.info("prescription_overdue_job  job exist");
//            }
//
//
//            //互联网医院 监管平台上报
//            if (!quartzHelper.isExistJob("data_upload_job")) {
//                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("data_upload_job");
//                quartzHelper.addJob(DataUploadJob.class, trigger, "data_upload_job", new HashMap<String, Object>());
//                logger.info("data_upload_job  job success");
//            } else {
//                logger.info("data_upload_job  job exist");
//            }
//=================中山医院发布启动======================================================
            //设备库存预警提醒
            if (!quartzHelper.isExistJob("device_inventory_warning_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("device_inventory_warning_job");
                quartzHelper.addJob(InventoryWarningJob.class, trigger, "device_inventory_warning_job", new HashMap<String, Object>());
                logger.info("device_inventory_warning_job  job success");
            } else {
                logger.info("device_inventory_warning_job  job exist");
            }
        } catch (Exception e) {
            logger.info("followup_plan_remind job start failed");
            logger.info(" job start failed");
        }
    }
}

+ 16 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/repository/message/IotMessageDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.repository.message;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author suhaiwen
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
public interface IotMessageDao extends PagingAndSortingRepository<IotMessageDO,String>,
        JpaSpecificationExecutor<IotMessageDO> {
}

+ 2 - 2
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/DeviceQualityPlanService.java

@ -1,11 +1,11 @@
package com.yihu.jw.service.device;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.iot.service.device.IotDeviceQualityInspectionPlanService;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.repository.message.IotMessageDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,7 +26,7 @@ public class DeviceQualityPlanService {
    private static Logger logger = LoggerFactory.getLogger(DeviceQualityPlanService.class);
    @Autowired
    private  IotMessageDao iotMessageDao;
    private IotMessageDao iotMessageDao;
    @Autowired
    private  IotDeviceQualityInspectionPlanService iotDeviceQualityInspectionPlanService;

+ 4 - 4
svr/svr-iot-job/src/main/java/com/yihu/jw/service/device/InventoryWarningService.java

@ -1,7 +1,7 @@
package com.yihu.jw.service.device;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.repository.message.IotMessageDao;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -28,9 +28,9 @@ public class InventoryWarningService {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> map : list){
            Integer inventoryCount = map.get("inventoryCount") == null ? 0: Integer.parseInt(map.get("inventoryCount") + "");
            Integer inventoryFloor = map.get("inventory_floor") == null ? 0: Integer.parseInt(map.get("inventory_floor") + "");
            Integer inventoryUpper = map.get("inventory_upper") == null ? 0: Integer.parseInt(map.get("inventory_upper") + "");
            if(inventoryCount < inventoryFloor || inventoryCount > inventoryUpper){
            Integer inventoryFloor = map.get("inventory_floor") == null ? null: Integer.parseInt(map.get("inventory_floor") + "");
            Integer inventoryUpper = map.get("inventory_upper") == null ? null: Integer.parseInt(map.get("inventory_upper") + "");
            if(inventoryUpper != null && (inventoryCount < inventoryFloor || inventoryCount > inventoryUpper)){
                IotMessageDO iotMessageDO = new IotMessageDO();
                iotMessageDO.setTitle("库存预警提醒");
                iotMessageDO.setContent("您的库存" + map.get("name") + "设备已达到预警数量,当前数量为:" + inventoryCount + "台,请及时维护库存。");

+ 15 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -6,6 +6,7 @@ import com.yihu.jw.internet.service.DataGeneratorService;
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
import com.yihu.jw.job.*;
import com.yihu.jw.job.wlw.DeviceQualityPlanJob;
import com.yihu.jw.job.wlw.InventoryWarningJob;
import com.yihu.jw.job.wlw.SimBalanceJob;
import com.yihu.jw.job.wlw.SimSetMealJob;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -26,6 +27,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
/**
 * 任务启动
 *
@ -323,4 +326,16 @@ public class JobController extends BaseController {
    public String testImg(String path) {
      return write(200, ykyyInternetService.testImg(path));
    }
    @RequestMapping(value = "/deviceInventoryWarning", method = RequestMethod.GET)
    @ApiOperation("设备库存预警提醒")
    public String deviceInventoryWarning() {
        try {
            quartzHelper.startNow(InventoryWarningJob.class, UUID.randomUUID().toString(), null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
}

+ 5 - 6
svr/svr-iot-job/src/main/resources/banner.txt

@ -1,6 +1,5 @@
                               _           _                                  _             _                             _   _             _             _           _
  ___  __   __  _ __          (_)  _ __   | |_    ___   _ __   _ __     ___  | |_          | |__     ___    ___   _ __   (_) | |_    __ _  | |           (_)   ___   | |__
 / __| \ \ / / | '__|  _____  | | | '_ \  | __|  / _ \ | '__| | '_ \   / _ \ | __|  _____  | '_ \   / _ \  / __| | '_ \  | | | __|  / _` | | |  _____    | |  / _ \  | '_ \
 \__ \  \ V /  | |    |_____| | | | | | | | |_  |  __/ | |    | | | | |  __/ | |_  |_____| | | | | | (_) | \__ \ | |_) | | | | |_  | (_| | | | |_____|   | | | (_) | | |_) |
 |___/   \_/   |_|            |_| |_| |_|  \__|  \___| |_|    |_| |_|  \___|  \__|         |_| |_|  \___/  |___/ | .__/  |_|  \__|  \__,_| |_|          _/ |  \___/  |_.__/
                                                                                                                 |_|                                   |__/
 ____  _     ____        _  ____  _____         _  ____  ____
/ ___\/ \ |\/  __\      / \/  _ \/__ __\       / |/  _ \/  _ \
|    \| | //|  \/|_____ | || / \|  / \_____    | || / \|| | //
\___ || \// |    /\____\| || \_/|  | |\____\/\_| || \_/|| |_\\
\____/\__/  \_/\_\      \_/\____/  \_/      \____/\____/\____/

+ 9 - 0
svr/svr-iot-job/src/main/resources/bootstrap.yml

@ -22,6 +22,15 @@ spring:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: iottest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.109:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwOracleTest

+ 2 - 0
svr/svr-iot-job/src/main/resources/system.properties

@ -21,3 +21,5 @@ data_common_upload_job=0 0 0 * * ?
data_device_quality_plan_job=0 0 0 * * ?
#SIM卡每月套餐扣费  每月1号凌晨0点0分0秒扣费
data_sim_set_meal_job=0 0 0 1 * ?
#设备库存预警提醒时间
device_inventory_warning_job = 0 0 7 * * ?