Browse Source

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

叶仕杰 5 years ago
parent
commit
939b852db4

+ 8 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -9,6 +9,7 @@ import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -46,7 +47,13 @@ public class IotSystemDictController extends EnvelopRestEndpoint {
            @ApiParam(name = "parentCode", value = "父类字典id", defaultValue = "402803f271b9583b0171b95b34e10001")
            @RequestParam(value = "parentCode", required = true) String parentCode) throws Exception {
        try {
            List<JSONObject> doList = iotSystemDictService.getListByParentCode("'"+parentCode.replace(",","','")+"'");
            List<JSONObject> doList = null;
            if(StringUtils.isNoneBlank(parentCode)){
                doList = iotSystemDictService.getListByParentCode("'"+parentCode.replace(",","','")+"'");
            }else{
                doList= iotSystemDictService.getListByParentCode();
            }
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
        }catch (Exception e){
            e.printStackTrace();

+ 23 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -27,6 +27,29 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    private MonitorPlatformService monitorPlatformService;
    @RequestMapping(value = "/areaDict",method = RequestMethod.GET)
    @ApiOperation("地区字典")
    public MixEnvelop areaDict(){
        try {
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.areaDict());
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @RequestMapping(value = "/hospitalDict",method = RequestMethod.GET)
    @ApiOperation("医院字典")
    public MixEnvelop hospitalDict(@ApiParam(name="town",value="地区",defaultValue = "")
                               @RequestParam(value="town",required = false) String town){
        try {
            return MixEnvelop.getSuccess("查询成功",monitorPlatformService.hospitalDict(town));
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @RequestMapping(value = "/smartDeviceDistribution",method = RequestMethod.GET)
    @ApiOperation("智能设备发放")
    public MixEnvelop smartDeviceDistribution(@ApiParam(name="type",value="设备类型")

+ 6 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -229,8 +229,12 @@ public class IotProductController extends EnvelopRestEndpoint {
    public MixEnvelop<JSONObject, JSONObject> findListByCategoryCode(@ApiParam(name = "categoryCode", value = "分类code", defaultValue = "1")
                                                              @RequestParam(value = "categoryCode", required = true)String categoryCode) {
        try {
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, iotProductBaseInfoService.findListByCategoryCode("'"+categoryCode.replace(",","','")+"'"));
        }catch (Exception e){
            if(StringUtils.isBlank(categoryCode)){
                return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, iotProductBaseInfoService.findListByCategoryCode());
            }else {
                return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, iotProductBaseInfoService.findListByCategoryCode("'"+categoryCode.replace(",","','")+"'"));
            }
       }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -95,4 +95,10 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
        List<JSONObject> list = myJdbcTemplate.queryJson(sql,new Object[]{});
        return list;
    }
    public List<JSONObject> getListByParentCode(){
        String sql = "SELECT code,value from iot_system_dict WHERE dict_name = 'DEVICE_TYPE' and del = 1 ORDER BY sort";
        List<JSONObject> list = myJdbcTemplate.queryJson(sql,new Object[]{});
        return list;
    }
}

+ 48 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -344,7 +344,7 @@ public class MonitorPlatformService  {
                sql+= " date_format(time,'%Y') ";
                break;
            case "day":
                sql+= " date_format(time,'%j') ";
                sql+= " date_format(time,'%%Y-%m-%d') ";
                break;
            case "week":
                sql+= " date_format(time,'%u') ";
@ -364,6 +364,37 @@ public class MonitorPlatformService  {
        return myJdbcTemplate.queryJson(sql.toString(),new Object[]{});
    }
    /**
     * 地区字典
     */
    public JSONArray areaDict(){
        String url = "/wlyygc/iot_monitoring/areaDict";
        Map<String, Object> params = new HashMap<>();
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
            return json.getJSONArray("data");
        }
        return new JSONArray();
    }
    /**
     * 医院字典
     */
    public JSONArray hospitalDict(String town){
        String url = "/wlyygc/iot_monitoring/hospitalDict";
        Map<String, Object> params = new HashMap<>();
        params.put("town",town);
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
            return json.getJSONArray("data");
        }
        return new JSONArray();
    }
    /**
     * 智能设备发放
     */
@ -375,7 +406,22 @@ public class MonitorPlatformService  {
        String response = sendGet(url,params);
        JSONObject json = JSONObject.parseObject(response);
        if(json.getInteger("status")==200){
            return json.getJSONArray("data");
            JSONArray jsonArray = json.getJSONArray("data");
            for (int i=0;i<jsonArray.size();i++){
                JSONObject jo = jsonArray.getJSONObject(i);
                String tmp = jo.getString("type");
                if("1".equals(tmp)){
                    jo.put("typeName","血糖仪");
                }else if("2".equals(tmp)){
                    jo.put("typeName","血压计");
                }else if("3".equals(tmp)){
                    jo.put("typeName","智能药盒");
                }else if("4".equals(tmp)){
                    jo.put("typeName","智能手表");
                }
            }
            return jsonArray;
        }
        return new JSONArray();

+ 5 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java

@ -368,6 +368,11 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        List<JSONObject> list = myJdbcTemplate.queryJson(sql,new Object[]{});
        return list;
    }
    public List<JSONObject> findListByCategoryCode(){
        String sql = "SELECT id,name,category_code from iot_product_base_info WHERE  del = 1 ORDER BY category_code";
        List<JSONObject> list = myJdbcTemplate.queryJson(sql,new Object[]{});
        return list;
    }
    /**
     * 获取所有产品信息