LAPTOP-KB9HII50\70708 hai 1 ano
pai
achega
a23ffb57f7

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

@ -554,6 +554,8 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @GetMapping(value = "findLocationPage")
    @ApiOperation(value = "新的物联网大屏地理搜索")
    public Envelop findLocationPage(
            @ApiParam(name = "name", value = "居民姓名或sn码")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "deviceCommon", value = "设备通用名编码")
            @RequestParam(value = "deviceCommon", required = false) String deviceCommon,
            @ApiParam(name = "useCode", value = "用途")
@ -576,7 +578,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
            if (pageSize == null) {
                pageSize = 10;
            }
            return monitorPlatformService.findLocationPage(deviceCommon, page, pageSize, useCode, combinationMethod, networkTransmission, town);
            return monitorPlatformService.findLocationPage(name,deviceCommon, page, pageSize, useCode, combinationMethod, networkTransmission, town);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError("操作失败");

+ 0 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/common/PermissionService.java

@ -1,7 +1,5 @@
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.common.BaseLoginLogDao;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import org.apache.commons.lang3.StringUtils;
@ -92,7 +90,6 @@ public class PermissionService {
        String accessToken = this.extractToken(getRequest());
        String sql = "select * from "+getDbName()+".base_login_log a WHERE a.token=? ORDER BY a.create_time desc LIMIT 1";
        logger.info("sql+"+sql);
        List<BaseLoginLogDO> list = jdbcTemplate.query(sql,new Object[]{accessToken},new BeanPropertyRowMapper<>(BaseLoginLogDO.class));
        if(list!=null&&list.size()>0){
            return list.get(0);

+ 25 - 23
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -10,6 +10,7 @@ import com.yihu.iot.dao.statistics.IotStatisticsStockDao;
import com.yihu.iot.service.analyzer.WlyyIotTzDict;
import com.yihu.iot.service.analyzer.WlyyIotTzDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.iot.service.common.PermissionService;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.iot.service.equipment.IotEqtDetailService;
import com.yihu.iot.service.platform.IotInterfaceLogService;
@ -94,6 +95,8 @@ public class MonitorPlatformService {
    private IotStatisticsCommonDao iotStatisticsCommonDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    @Value("${spring.profiles}")
    private String springProfiles;
    /**
     * 新的物联网大屏地理搜索
@ -106,7 +109,7 @@ public class MonitorPlatformService {
     * @param town 地理区划
     * @return
     */
    public PageEnvelop<IotLocationDataVO> findLocationPage(String deviceCommon, Integer page, Integer size,
    public PageEnvelop<IotLocationDataVO> findLocationPage(String name,String deviceCommon, Integer page, Integer size,
                   String use, String combinationMethod, String networkTransmission, String town) {
        String countSql = "select count(*) ";
        String sql = "select * ";
@ -128,6 +131,9 @@ public class MonitorPlatformService {
            deviceCommon = deviceCommon.replace(",","','");
            fileter += " and device_common in ('"+deviceCommon+"')";
        }
        if(!StringUtils.isEmpty(name)){
            fileter += " and (name like '%"+name+"%' or device_sn like '%"+name+"%')";
        }
        String limit = " limit "+(page-1)*size+","+size;
        Long totalCount = jdbcTemplate.queryForObject(countSql+fileter, Long.class);
@ -138,6 +144,8 @@ public class MonitorPlatformService {
            JSONObject location = JSONObject.parseObject(map.get("location").toString());
            GeoPoint geoPoint = new GeoPoint(Double.parseDouble(location.get("lat").toString()), Double.parseDouble(location.get("lon").toString()));
            locationDataVO.setId(map.get("id").toString());
            locationDataVO.setName(map.get("name")+"");
            locationDataVO.setDeviceName(map.get("device_name")+"");
            locationDataVO.setIdCard(map.get("idcard")+"");
            locationDataVO.setCategoryCode(map.get("category_code")+"");
            locationDataVO.setDeviceSn(map.get("device_sn")+"");
@ -152,7 +160,7 @@ public class MonitorPlatformService {
            locationDataVO.setCreateTime(map.get("create_time")+"");
            locationDataVO.setPatient(map.get("patient")+"");
            locationDataVO.setDeviceCommon(map.get("device_common")+"");
            locationDataVO.setUseCode(map.get("useCode")+"");
            locationDataVO.setUseCode(map.get("use_code")+"");
            locationDataVO.setCombinationMethod(map.get("xombination_method")+"");
            locationDataVO.setTown(map.get("town")+"");
            locationDataVO.setNetworkTransmission(map.get("network_transmission")+"");
@ -1353,7 +1361,12 @@ public class MonitorPlatformService {
            String sql = "select sum(total) total,sum(useing) useing,SUM(stock) stock,SUM(iot_count) iot_count,SUM(lost_count) lost_count, " +
                    "SUM(intervene_count) intervene_count,SUM(issue_count) issue_count,SUM(binding_count) binding_count,SUM(disease_patient_count) disease_patient_count, " +
                    "SUM(disease_patient_device_count) disease_patient_device_count,SUM(disease_patient_use_count) disease_patient_use_count, " +
                    "SUM(fault_count) fault_count from iot_statistics_stock WHERE parent_type = '"+type+"' and town = '"+town+"'";
                    "SUM(fault_count) fault_count from iot_statistics_stock WHERE town = '"+town+"' ";
            if("0".equals(type)){
                sql += " and parent_type = '0' ";
            }else {
                sql += " and type = '"+type+"' ";
            }
            List<IotStatisticsStockDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(IotStatisticsStockDO.class));
            if(list.size()>0){
                stockDO = list.get(0);
@ -1912,29 +1925,18 @@ public class MonitorPlatformService {
        return object;
    }
    @Autowired
    private PermissionService permissionService;
    public JSONArray getSearchTags() {
        String sql = "select id,`value` from xmiot.iot_system_dict where dict_name='DEVICE' and (value='终端一体机' or value ='体征监测设备') and del=1;";
        String sql = "SELECT dict_code code,dict_value name from "+permissionService.getDbName()+".wlyy_hospital_sys_dict WHERE dict_name = 'Device_common_name' and hospital='1' ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        JSONArray result = new JSONArray();
        for (Map<String, Object> map : list) {
            sql = "select `code`,`value` from xmiot.iot_system_dict where dict_name='DEVICE_TYPE' AND del=1 AND code!=10 AND code!=11  AND parent_code='" + map.get("id").toString() + "'";
            StringBuffer buffer = new StringBuffer();
            List<Map<String, Object>> reList = jdbcTemplate.queryForList(sql);
            for (Map<String, Object> reMap : reList) {
                JSONObject tmp = new JSONObject();
                tmp.put("name", reMap.get("value").toString());
                tmp.put("code", reMap.get("code").toString());
                buffer.append("," + reMap.get("code").toString());
                result.add(tmp);
            }
            //组合一体机 单体征测量仪 数据
//            if (org.apache.commons.lang3.StringUtils.isNoneBlank(buffer.toString())) {
//                buffer.deleteCharAt(0);
//                JSONObject tmp = new JSONObject();
//                tmp.put("name", map.get("value").toString());
//                tmp.put("code", buffer.toString());
//                result.add(tmp);
//            }
            JSONObject tmp = new JSONObject();
            tmp.put("name", map.get("name").toString());
            tmp.put("code", map.get("code").toString());
            result.add(tmp);
        }
        return result;
    }
@ -2062,7 +2064,7 @@ public class MonitorPlatformService {
                    JSONObject location = new JSONObject();
                    location.put("lat", Double.valueOf(json.get("lat")));
                    location.put("lon", Double.valueOf(json.get("lng")));
                    String insertSql = "INSERT INTO device.wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" +
                    String insertSql = "INSERT INTO wlyy_patient_device_location(patient,idcard,disease_condition,device_sn,\n" +
                            "device_name,category_code,device_time,create_time,location)\n" +
                            "VALUES('" + map.get("code").toString() + "','" + map.get("idcard").toString() + "','" + map.get("disease_condition").toString() + "','" + map.get("device_sn").toString() + "','" + map.get("device_name") + "',\n" +
                            "'" + map.get("category_code").toString() + "','" + map.get("create_time") + "','" + map.get("create_time").toString() + "','" + location.toJSONString() + "')\n";