Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 years ago
parent
commit
bce770d0be

+ 5 - 2
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -442,8 +442,11 @@ public class ElasticsearchUtil {
    public List findDateQuotaLevel0(String startDate, String endDate, String area, int level, String index, String timeLevel, String interval, String lowLevel,String areaLevel) throws Exception {
        //时间格式转换  yyyy-MM-dd转成 2017-07-17T00:00:00+0800
        if (StringUtils.isBlank(areaLevel)){
            areaLevel="6";
        areaLevel="6";
        String sqlArea = " select area_level from wlyy_job_config_new where id='"+index+"' ";
        List<String> areaLevels = jdbcTemplate.queryForList(sqlArea,String.class);
        if (areaLevels.size()>0){
            areaLevel = areaLevels.get(0);
        }
        if (StringUtils.isNotEmpty(startDate)) {
            if (startDate.length() > 10) {

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDetailDao.java

@ -20,13 +20,13 @@ public interface DeviceDetailDao extends PagingAndSortingRepository<DeviceDetail
    @Query("select a from DeviceDetail a where a.deviceCode = ?1 and a.manufacturerCode = ?2")
    DeviceDetail findByDeviceCodeAndManufacturerCode(String deviceCode,String manufacturerCode);
    @Query("select a from DeviceDetail a where a.sim = ?2")
    @Query("select a from DeviceDetail a where a.sim = ?1")
    List<DeviceDetail> findBySim(String sim);
    @Query("select a from DeviceDetail a where a.iccid = ?2")
    @Query("select a from DeviceDetail a where a.iccid = ?1")
    List<DeviceDetail> findByIccid(String iccid);
    @Query("select a from DeviceDetail a where a.imsi = ?2")
    @Query("select a from DeviceDetail a where a.imsi = ?1")
    List<DeviceDetail> findByImsi(String sim);
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java

@ -376,7 +376,7 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("deviceImport.xls"));
            OutputStream os = response.getOutputStream();
            deviceManageService.write(os, null);
            deviceManageService.write(os, new ArrayList());
        } catch (Exception ex) {
            ex.printStackTrace();
        }

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.config.YsConfig;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.util.DeviceUtil;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -47,6 +48,8 @@ public class YsDeviceService {
    private HttpClientUtil httpClientUtil;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private DeviceUtil deviceUtil;
    /**
     * 获取萤石设备assesToken
@ -224,10 +227,12 @@ public class YsDeviceService {
                case 0:
                    result.put(ResponseContant.resultFlag,ResponseContant.success);
                    result.put(ResponseContant.resultMsg,tmp);
                    deviceUtil.updateOnLineStatus(deviceSerial,1);
                    break;
                case 1:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备不在线");
                    deviceUtil.updateOnLineStatus(deviceSerial,0);
                    break;
                case 2:
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
@ -253,7 +258,6 @@ public class YsDeviceService {
                    result.put(ResponseContant.resultFlag,ResponseContant.fail);
                    result.put(ResponseContant.resultMsg,"设备接入限制");
                    break;
            }
        }
        else {

+ 0 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -553,15 +553,6 @@ public class StatisticsService {
        String areaLevel = null;
        for(String ind:indexes){
            //总量
            if (ind.equals("41")||ind.equals("46")){//指标统计最小单位
                areaLevel="4";
            }
            if (ind.equals("45")){
                areaLevel="2";
            }
            if (ind.equals("52")){
                areaLevel="2";
            }
            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, ind, SaveModel.timeLevel_DDL,areaLevel);
            res.put("index_"+ind+"_total",saveModel.getResult2().longValue());
            if(StringUtils.isNotBlank(type)){

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/DeviceUtil.java

@ -0,0 +1,24 @@
package com.yihu.jw.care.util;
import com.yihu.jw.care.dao.device.DeviceDetailDao;
import com.yihu.jw.entity.care.device.DeviceDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * Created by Bing on 2021/10/8.
 */
@Component
public class DeviceUtil {
    @Autowired
    private DeviceDetailDao deviceDetailDao;
    public void updateOnLineStatus(String deviceSn,Integer status) {
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(deviceSn);
        if (deviceDetail != null) {
            deviceDetail.setContactStatus(status);
            deviceDetailDao.save(deviceDetail);
        }
    }
}

File diff suppressed because it is too large
+ 31 - 10
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java