فهرست منبع

物联网修改

LAPTOP-KB9HII50\70708 1 سال پیش
والد
کامیت
efde233ed0

+ 12 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java

@ -59,8 +59,11 @@ public class ThirdDataInputController {
    public Envelop deviceRegistration(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                                      @RequestBody String jsonData){
        try{
            logger.info("jsonData="+jsonData);
            if(StringUtils.isNotBlank(jsonData)){
                jsonData = jsonData.replace("jsonData=","");
                if(jsonData.indexOf("&accesstoken")>0){
                    jsonData = jsonData.substring(0,jsonData.indexOf("&accesstoken"));
                }
                String decodedString = URLDecoder.decode(jsonData, "UTF-8");
                if (!decodedString.equals(jsonData)) {
                    jsonData = decodedString;
@ -82,6 +85,10 @@ public class ThirdDataInputController {
                                    @RequestBody String jsonData){
        try{
            if(StringUtils.isNotBlank(jsonData)){
                jsonData = jsonData.replace("jsonData=","");
                if(jsonData.indexOf("&accesstoken")>0){
                    jsonData = jsonData.substring(0,jsonData.indexOf("&accesstoken"));
                }
                String decodedString = URLDecoder.decode(jsonData, "UTF-8");
                if (!decodedString.equals(jsonData)) {
                    jsonData = decodedString;
@ -102,6 +109,10 @@ public class ThirdDataInputController {
                                    @RequestBody String jsonData){
        try{
            if(StringUtils.isNotBlank(jsonData)){
                jsonData = jsonData.replace("jsonData=","");
                if(jsonData.indexOf("&accesstoken")>0){
                    jsonData = jsonData.substring(0,jsonData.indexOf("&accesstoken"));
                }
                String decodedString = URLDecoder.decode(jsonData, "UTF-8");
                if (!decodedString.equals(jsonData)) {
                    jsonData = decodedString;

+ 6 - 6
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -97,19 +97,19 @@ public class DataInputService {
        if(StringUtils.isBlank(categoryName)){
            throw new ServiceException("设备类型名称不能为空");
        }
        int count = iotDeviceService.countByDeviceSn(deviceSn);
        if(count > 0){
            throw new ServiceException("设备唯一码已存在,请检查是否已经上传过,或者换一个编码");
        }
        String result = "";
        try {
            IotDeviceDO iotDeviceDO = new IotDeviceDO();
            IotDeviceDO iotDeviceDO = iotDeviceService.findByDeviceSn(deviceSn);
            if(iotDeviceDO==null){
                iotDeviceDO = new IotDeviceDO();
                iotDeviceDO.setCreateTime(new Date());
            }
            iotDeviceDO.setDeviceSn(deviceSn);
            iotDeviceDO.setCategoryCode(categoryCode);
            iotDeviceDO.setCategoryName(categoryName);
            iotDeviceDO.setDel(1);
            iotDeviceDO.setStatus("1");
            iotDeviceDO.setCreateTime(new Date());
            iotDeviceDO.setUpdateTime(new Date());
            iotDeviceDO.setDeviceSource("4");
            iotDeviceDO.setHospital(hospital);
            iotDeviceDO.setHospitalName(hospitalName);