Bladeren bron

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

wangjun 4 jaren geleden
bovenliggende
commit
bd23286fe8

+ 27 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/config/MultipartConfig.java

@ -0,0 +1,27 @@
package com.yihu.jw.gateway.config;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.MultipartConfigElement;
import java.io.*;
/**
 * Created by liub on 2020/9/10.
 */
@Configuration
public class MultipartConfig {
    @Bean
    MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        String location = "/data/apps/temp";
        File tmpFile = new File(location);
        if (!tmpFile.exists()) {
            tmpFile.mkdirs();
        }
        factory.setLocation(location);
        return factory.createMultipartConfig();
    }
}

+ 2 - 1
gateway/ag-basic/src/main/resources/application.yml

@ -1,6 +1,7 @@
server:
server:
  port: ${server.ag-basic-port}
  port: ${server.ag-basic-port}
  tomcat:
    basedir: /data/apps/temp
spring:
spring:
  datasource:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.jdbc.Driver

+ 6 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/config/MultipartConfig.java

@ -6,22 +6,22 @@ import org.springframework.context.annotation.Configuration;
import javax.servlet.MultipartConfigElement;
import javax.servlet.MultipartConfigElement;
import java.io.*;
import java.io.*;
/**
/**
 * Created by liub on 2020/9/8.
 * Created by liub on 2020/9/11.
 */
 */
@Configuration
@Configuration
public class MultipartConfig {
public class MultipartConfig {
    @Bean
    @Bean
    MultipartConfigElement multipartConfigElement() {
    MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        MultipartConfigFactory factory = new MultipartConfigFactory();
        File tmpFile = new File("/data/apps/temp");
        String location = "/data/apps/temp2";
        File tmpFile = new File(location);
        if (!tmpFile.exists()) {
        if (!tmpFile.exists()) {
            tmpFile.mkdirs();
            tmpFile.mkdirs();
        }
        }
        factory.setLocation("/data/apps/temp");
        factory.setLocation(location);
        return factory.createMultipartConfig();
        return factory.createMultipartConfig();
    }
    }
}
}

+ 2 - 1
svr/svr-base/src/main/resources/application.yml

@ -1,7 +1,8 @@
#通用的配置不用区分环境变量.
#通用的配置不用区分环境变量.
server:
server:
  port: ${server.svr-base-port}
  port: ${server.svr-base-port}
  tomcat:
      basedir: /data/apps/temp2
express:
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_code: JKZL

+ 3 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -447,6 +447,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            @RequestParam(value = "diseaseCondition",required = false) Integer diseaseCondition,
            @RequestParam(value = "diseaseCondition",required = false) Integer diseaseCondition,
            @ApiParam(name = "type", value = "1高血压 2糖尿病", defaultValue = "")
            @ApiParam(name = "type", value = "1高血压 2糖尿病", defaultValue = "")
            @RequestParam(value = "type",required = false) String type,
            @RequestParam(value = "type",required = false) String type,
            @ApiParam(name="deviceType",value="设备类型 对应设备字典库的DEVICE_TYPE值",required = true)
            @RequestParam(value="deviceType",required = true) String deviceType,
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @RequestParam(value="page",required = false) Integer page,
            @RequestParam(value="page",required = false) Integer page,
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
@ -458,7 +460,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            if(pageSize==null){
            if(pageSize==null){
                pageSize = 10;
                pageSize = 10;
            }
            }
            return monitorPlatformService.findDeviceLocations(diseaseCondition,page,pageSize,type);
            return monitorPlatformService.findDeviceLocations(diseaseCondition,page,pageSize,type,deviceType);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");
            return MixEnvelop.getError("操作失败");

+ 5 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java

@ -50,11 +50,11 @@ public class IotHospitalService extends BaseJpaService<IotHospitalDO, IotHospita
            sql += "and h.level = '" + level + "' ";
            sql += "and h.level = '" + level + "' ";
        }
        }
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and h.saas_id in ("+orgUserService.getUserOrg(orgList)+")";
        }
//        //数据权限过滤
//        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
//        if(!orgList.contains(userAgent.commonHospital)){
//            sql += " and h.saas_id in ("+orgUserService.getUserOrg(orgList)+")";
//        }
        if(page != null && pageSize != null){
        if(page != null && pageSize != null){
            Long count = Long.valueOf(jdbcTemplate.queryForList(sql).size());
            Long count = Long.valueOf(jdbcTemplate.queryForList(sql).size());

+ 49 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java

@ -4,19 +4,21 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
import com.yihu.iot.util.excel.EntityUtils;
import com.yihu.iot.util.excel.EntityUtils;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.jw.datainput.Data;
import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import iot.device.LocationDataVO;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
@Service
public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, IotEquipmentDetailDao> {
public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, IotEquipmentDetailDao> {
@ -168,4 +170,47 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
       return list;
       return list;
    }
    }
    public List<LocationDataVO> getEquipmentLocation(Integer page, Integer size){
        List<Map<String, Object>> jsonArray = new ArrayList<>();
        List<LocationDataVO> result = new ArrayList<>();
        String sql = "SELECT  " +
                "id AS id,  " +
                "device_code AS deviceSn, " +
                "applicant_name AS name, " +
                "device_name AS equimentName, " +
                "latitude AS lat, " +
                "longitude AS lon, " +
                "create_time AS createTime " +
                "FROM " +
                "iot_equipmet_detail LIMIT "+(page-1)*size+","+size;
        jsonArray = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> jsobj:jsonArray){
            LocationDataVO locationDataVO = new LocationDataVO();
            GeoPoint geoPoint = new GeoPoint(Double.valueOf(jsobj.get("lat").toString()),Double.valueOf(jsobj.get("lon").toString()));
            locationDataVO.setId((String) jsobj.get("id"));
            locationDataVO.setIdCard(null);
            locationDataVO.setCategoryCode("5");
            locationDataVO.setDeviceSn((String) jsobj.get("deviceSn"));
            locationDataVO.setLocation(geoPoint);
            locationDataVO.setDeviceTime(null);
            locationDataVO.setLabel(null);
            locationDataVO.setDiseaseCondition(5);
            locationDataVO.setCreateTime(jsobj.get("createTime").toString());
            locationDataVO.setName((String) jsobj.get("name"));
            locationDataVO.setCode(null);
            locationDataVO.setEquimentName((String) jsobj.get("equimentName"));
            result.add(locationDataVO);
        }
        return result;
    }
    public Integer getEquipmentCount(){
        String sql = "SELECT count(1) totalCount FROM iot_equipmet_detail ";
        Integer totalCount = jdbcTemplate.queryForObject(sql,Integer.class);
        return totalCount;
    }
}
}

+ 41 - 10
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -70,7 +70,7 @@ public class MonitorPlatformService  {
     * @param diseaseCondition
     * @param diseaseCondition
     * @return
     * @return
     */
     */
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type) throws IOException {
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type,String deviceType) throws IOException {
        MixEnvelop<LocationDataVO, LocationDataVO> envelop = new MixEnvelop<>();
        MixEnvelop<LocationDataVO, LocationDataVO> envelop = new MixEnvelop<>();
        MixEnvelop<LocationDataVO, LocationDataVO> envelopTmp = null;
        MixEnvelop<LocationDataVO, LocationDataVO> envelopTmp = null;
        JSONArray jsonArray = new JSONArray();
        JSONArray jsonArray = new JSONArray();
@ -103,6 +103,9 @@ public class MonitorPlatformService  {
            envelop.setTotalCount(total);
            envelop.setTotalCount(total);
            return envelop;
            return envelop;
        }else {
        }else {
            List<LocationDataVO> euipmentList = new ArrayList<>();
            int totalEqCount=0;
            int totalCount=0;
            //查找全部
            //查找全部
            if(diseaseCondition!=null){
            if(diseaseCondition!=null){
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
@ -112,15 +115,43 @@ public class MonitorPlatformService  {
                json.put("value",diseaseCondition);
                json.put("value",diseaseCondition);
                jsonArray.add(json);
                jsonArray.add(json);
            }
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("filter",jsonArray);
            jsonObject.put("page",page);
            jsonObject.put("size",size);
            List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
            List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList);
            //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
            envelop.getDetailModelList().addAll(list2);
            envelop.setTotalCount(iotPatientDeviceService.getESCount(jsonObject.toString()));
            //小屋总数
            if(deviceType.contains("5")){
               totalEqCount = iotEqtDetailService.getEquipmentCount();
            }
            String[] categoryCodes= deviceType.split(",");
            if(categoryCodes.length==1&&"5".equals(deviceType)){
                euipmentList = iotEqtDetailService.getEquipmentLocation(page,size);
                envelop.getDetailModelList().addAll(euipmentList);
            }
            else{
                if(deviceType.contains("5")){
                    euipmentList = iotEqtDetailService.getEquipmentLocation(page,size);
                    envelop.getDetailModelList().addAll(euipmentList);
                }
                for (String categoryCode:categoryCodes){
                     if(!"5".equals(categoryCode)){
                         JSONObject json = new JSONObject();
                         json.put("andOr","and");
                         json.put("field","categoryCode");
                         json.put("condition","=");
                         json.put("value",Integer.parseInt(categoryCode));
                         jsonArray.add(json);
                         JSONObject jsonObject = new JSONObject();
                         jsonObject.put("filter",jsonArray);
                         jsonObject.put("page",page);
                         jsonObject.put("size",size);
                         List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
                         List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList);
                         //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
                         envelop.getDetailModelList().addAll(list2);
                         totalCount += iotPatientDeviceService.getESCount(jsonObject.toString());
                         jsonArray.remove(json);
                     }
                }
            }
            envelop.setTotalCount(totalCount>totalEqCount?totalCount:totalEqCount);
            return envelop;
            return envelop;
        }
        }
    }
    }