package com.ibeetl.admin.console.api; import com.alibaba.fastjson.JSON; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.ibeetl.admin.console.model.*; import com.ibeetl.admin.console.service.CuserConsoleService; import com.ibeetl.admin.console.service.XzxCityPartnerService; import com.ibeetl.admin.console.service.XzxElectronicFenceService; import com.ibeetl.admin.console.service.XzxPartnerFenceService; import com.ibeetl.admin.console.util.PreventManyCommit; import com.ibeetl.admin.core.entity.XzxCityPartner; import com.ibeetl.admin.core.entity.XzxElectronicFence; import com.fasterxml.jackson.core.type.TypeReference; import com.ibeetl.admin.core.entity.XzxPartnerFence; import com.ibeetl.admin.core.web.JsonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import java.text.SimpleDateFormat; import java.util.*; @RestController @Api(value = "电子围栏接口类") public class ElectronicFenceApi { private static final String MODEL = "/admin/front/fence"; @Autowired XzxElectronicFenceService service; @Autowired XzxPartnerFenceService pfService; @Value("${gaode.fence.url}") String FENCE_URL; @Autowired XzxCityPartnerService cityPartnerService; @Autowired CuserConsoleService cuserConsoleService; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /** * 新增电子围栏 * @param model * @return */ @PostMapping(MODEL + "/addElectronicFenceApi.json") @ResponseBody @ApiOperation(value="电子围栏管理-新增电子围栏", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "fenceName", value = "名称", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "fenceType", value = "电子围栏类型,1:POI围栏,2:行政区围栏,3:圆形围栏,4:多边形围栏", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "keyword", value = "关键字:城市或区域名称", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "latitude", value = "纬度", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "longitude", value = "经度", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "partnerIds", value = "合伙人Id(多个用逗号','隔开)", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "radius", value = "半径", required = true, dataType = "Integer"), @ApiImplicitParam(paramType="query", name = "prohibit", value = "是否启用", required = true, dataType = "Integer"), @ApiImplicitParam(paramType="query", name = "longLatiArrList", value = "围栏类型为多边形时,传入", required = true, dataType = "List") }) public JsonResult addElectronicFenceApi(@RequestBody XzxElectronicFenceModel model){ String partnerIds = model.getPartnerIds(); boolean flag = false; if(null!=partnerIds&&!"".equals(partnerIds)){ flag = true; } if(!flag){ return JsonResult.failMessage("必须填写关联合伙人!"); } model.setDelFlag(0); model.setCreateTime(sdf.format(new Date())); // ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); XzxElectronicFence info = objectMapper.convertValue(model, XzxElectronicFence.class); if(null!=model.getFenceName()&&!"".equals(model.getFenceName())){ model.setFenceName(model.getFenceName().trim()); //是否有重名电子围栏 XzxElectronicFence oldInfo =service.queryElectronic(model); if(null!=oldInfo){ return JsonResult.failMessage("已经有相同的围栏名称,添加失败!"); }else{ String longiLatiStr = ""; String longiLatiStr2 = ""; if(model.getFenceType().equals("4")){ List longLatiArrList = model.getLongLatiArrList(); if(null!=longLatiArrList&&longLatiArrList.size()>0){ ObjectMapper mapper = new ObjectMapper(); List LongiLati = mapper.convertValue(longLatiArrList, new TypeReference>() { }); Gson gson = new Gson(); String str = gson.toJson(LongiLati); info.setLonglatiarr(str); for (LongiLatiModel lola:LongiLati) { if(null!=longiLatiStr&&!"".equals(longiLatiStr)){ longiLatiStr = longiLatiStr+";"+lola.getLongitude()+","+lola.getLatitude(); longiLatiStr2 = longiLatiStr2+"|"+lola.getLongitude()+","+lola.getLatitude(); }else{ longiLatiStr =lola.getLongitude()+","+lola.getLatitude(); longiLatiStr2 =lola.getLongitude()+","+lola.getLatitude(); } } } } info.setDelFlag(0); if(null!=info.getKeyword()&&!"".equals(info.getKeyword())){ AreaModel areaModel = new AreaModel(); areaModel.setName(info.getKeyword()); AreaModel map = cityPartnerService.queryAreaLongiLati(areaModel); info.setTownCode(map.getCode()); info.setLongitude(map.getLongitude()); info.setLatitude(map.getLatitude()); } XzxPartnerFence pfInfo = new XzxPartnerFence(); XzxPartnerFenceModel pfInfo1 = new XzxPartnerFenceModel(); if(null!=partnerIds&&!"".equals(partnerIds)){ //List pfInfoList = new ArrayList<>(); String partnerId = partnerIds; //for (String partnerId:partnerArr) { if(null!=info.getKeyword()&&!"".equals(info.getKeyword())){ //校验该合伙人是否能创建电子围栏 String townId = service.queryAreaTownId(info.getKeyword()); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ return JsonResult.failMessage("该合伙人不能创建该地区的电子围栏"); }else{ //判断是否有在该区域建行政区 if(model.getFenceType().equals("2")){ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),null); if(townList.size()>0){ return JsonResult.failMessage(info.getKeyword()+" 已经建立行政区围栏,不能在该区域内创建其他围栏"); } } } }else{ return JsonResult.failMessage("该合伙人不应属于该区域,无法创建电子围栏"); } }else{ String keyword=""; String[] keywordList = new String[20]; if(null!=longiLatiStr2&&!"".equals(longiLatiStr2)){ String location =info.getLonglatiarr(); XzxCityPartner partner = cityPartnerService.queryById(partnerId); keyword = service.queryLongiLatiForTownName(partner.getPartnerKey(),location,longiLatiStr2); keywordList = keyword.split(","); }else{ XzxCityPartner partner = cityPartnerService.queryById(partnerId); String location = model.getLongitude()+","+model.getLatitude(); keyword = service.queryLongiLatiForTownName(partner.getPartnerKey(),location,null); } if(null!=keyword&&!"".equals(keyword)){ if(keywordList.length>0){ for (String keywords:keywordList) { String[] obj = keywords.split("_"); String keyword1 = obj[1]; int num = Integer.parseInt(obj[0]); String townId = service.queryAreaTownId(keyword1); AreaModel areaModel1 = new AreaModel(); areaModel1.setName(keyword1); AreaModel map1 = cityPartnerService.queryAreaLongiLati(areaModel1); info.setTownCode(map1.getCode()); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ String[] ll2= longiLatiStr.split(";"); String errorAddress = ll2[num]; return JsonResult.failMessage("该合伙人不应属于该区域,无法在经纬度为:"+errorAddress+" 创建电子围栏"); }else{ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),null); if(townList.size()>0){ String[] ll2= longiLatiStr.split(";"); String errorAddress = ll2[num]; return JsonResult.failMessage(keyword + " 已经建立行政区围栏,不能在:"+errorAddress+"该区域内创建其他围栏"); } } }else{ return JsonResult.failMessage("区域为空,不能创建电子围栏"); } } }else{ String townId = service.queryAreaTownId(keyword); AreaModel areaModel1 = new AreaModel(); areaModel1.setName(keyword); AreaModel map1 = cityPartnerService.queryAreaLongiLati(areaModel1); info.setTownCode(map1.getCode()); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ return JsonResult.failMessage("该合伙人不应属于该区域,无法创建电子围栏"); }else{ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),null); if(townList.size()>0){ return JsonResult.failMessage(keyword + " 已经建立行政区围栏,不能在该区域内创建其他围栏"); } } }else{ return JsonResult.failMessage("区域为空,不能创建电子围栏"); } } }else{ return JsonResult.failMessage("找不到该区域,不能创建电子围栏"); } } pfInfo.setFenceId(info.getId()+""); pfInfo.setPartnerId(partnerId); pfInfo1.setPartnerId(partnerId); if(model.getFenceType().equals("2")){ //判断行政区是否有其他围栏 List idsOD = service.queryODByArea(info.getTownCode()); if(idsOD.size()>0){ return JsonResult.failMessage(info.getKeyword()+"已经建立围栏,不能在该区域内创建行政区围栏!"); } }else{ String resultJson = service.createGDFence(info,pfInfo1,FENCE_URL,longiLatiStr); System.out.println("==高德返回"+resultJson); Map maps = (Map) JSON.parse(resultJson); String errmsg = maps.get("errmsg").toString(); String str2=maps.get("data").toString(); Map maps2 = (Map)JSON.parse(str2); String statusGaode = maps2.get("status").toString(); String gid=""; if(statusGaode.equals("0")){ gid = maps2.get("gid").toString(); } if(null!=gid&&!"".equals(gid)){ info.setGid(gid); service.update(info); }else{ return JsonResult.failMessage("高德创建电子围栏失败!"); } } }else{ return JsonResult.failMessage("新增电子围栏失败"); } info.setLonglatiarr(longiLatiStr); boolean bool = service.save(info); if(!bool){ return JsonResult.failMessage("新增电子围栏失败"); }else{ //是否关联合伙人 //修改关联表 pfInfo.setFenceId(info.getId()+""); pfInfo.setDelFlag(0); pfInfo.setCreateTime(sdf.format(new Date())); pfService.save(pfInfo); //pfService.saveAllPfInfo(pfInfoList); return JsonResult.success("添加成功!"); } } }else{ return JsonResult.failMessage("电子围栏名称不能为空!"); } } @PostMapping(MODEL + "/queryElectronicFence.do") @ResponseBody @ApiOperation(value="电子围栏管理-按电子围栏查看(城市合伙人查看)", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "id", value = "围栏ID", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "page", value = "页码", required = true, dataType = "int"), @ApiImplicitParam(paramType="query", name = "limit", value = "每页条数", required = true, dataType = "int"), @ApiImplicitParam(paramType="query", name = "fenceType", value = "电子围栏类型,1:POI围栏,2:行政区围栏,3:圆形围栏,4:多边形围栏", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "startTime", value = "开始时间", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "endTime", value = "结束时间", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "name", value = "姓名、手机号、围栏名称", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "provinceId", value = "省Id", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "cityId", value = "市Id", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "townshipId", value = "区Id", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "prohibit", value = "是否禁用(0:禁用,1:启用)", required = true, dataType = "Integer") }) public JsonResult> queryElectronicFence(@RequestBody XzxCityPartnerModel model){ Map map = pfService.queryElectronicFence(model); return JsonResult.success(map); } @PostMapping(MODEL + "/queryFenceList.do") @ResponseBody @ApiOperation(value="电子围栏管理-查询所有电子围栏", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "fenceType", value = "电子围栏类型,1:POI围栏,2:行政区围栏,3:圆形围栏,4:多边形围栏", required = true, dataType = "String") }) public JsonResult> queryFenceList(@RequestBody XzxElectronicFenceModel model){ List list = service.queryFenceList(model); return JsonResult.success(list); } /** * 删除 * @param model * @return */ @PostMapping(MODEL + "/delElectronicFence.json") @PreventManyCommit(time = 10) @ResponseBody @ApiOperation(value="电子围栏管理-删除电子围栏", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "id", value = "合伙人Id", required = true, dataType = "Integer") }) public JsonResult delElectronicFence(@RequestBody XzxElectronicFenceModel model){ XzxElectronicFence info = service.queryById(model.getId()); info.setDelFlag(1); service.update(info); XzxCityPartner partner= pfService.queryPartnerIds(model.getId()+""); if(null!=partner){ //删除高德围栏 String gid = info.getGid(); if(null!=gid&&!"".equals(gid)){ String url = "https://restapi.amap.com/v4/geofence/meta"; String resultJson = service.deleteGDFence(info,url,partner); } } //删除管理合伙人 pfService.deleteByFenceId(model.getId()+""); return JsonResult.success("删除成功"); } /** * 删除 * @param model * @return */ @PostMapping(MODEL + "/delPartner.json") @PreventManyCommit(time = 10) @ResponseBody @ApiOperation(value="电子围栏管理-删除合伙人", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "id", value = "合伙人Id", required = true, dataType = "Integer") }) public JsonResult delPartner(@RequestBody XzxCityPartnerModel model){ int count = cityPartnerService.queryElectronicFenceByPartner(model.getId()); if(count>0){ return JsonResult.failMessage("删除合伙人前,请先删除该合伙人的电子围栏!"); }else{ XzxCityPartner partner = cityPartnerService.queryById(model.getId()); partner.setDelFlag(1); if(partner.getPartnerType().equals("2")){ List partnerIds = cityPartnerService.queryPartnerByCurrent(); if(null!=partnerIds&&partnerIds.size()>0){ return JsonResult.failMessage("合伙人不能删除打包站!"); } cuserConsoleService.delCuserById(partner.getUserId(), partner.getMobilePhone(), "7"); }else{ cityPartnerService.deleteServiceByKey(partner); cityPartnerService.deleteUserByPartnerId(model.getId(),partner.getAccountNo()); } cityPartnerService.deletePartnerAccount(partner); cityPartnerService.update(partner); return JsonResult.success("删除成功"); } } /** * 新增电子围栏 * @param model * @return */ @PostMapping(MODEL + "/updateElectronicFenceApi.json") @ResponseBody @ApiOperation(value="电子围栏管理-编辑电子围栏", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "id", value = "主键id", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "fenceName", value = "名称", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "fenceType", value = "电子围栏类型,1:POI围栏,2:行政区围栏,3:圆形围栏,4:多边形围栏", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "keyword", value = "关键字:城市或区域名称", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "latitude", value = "纬度", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "longitude", value = "经度", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "partnerIds", value = "合伙人Id(多个用逗号','隔开)", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "radius", value = "半径", required = true, dataType = "Integer"), @ApiImplicitParam(paramType="query", name = "longLatiArrList", value = "围栏类型为多边形时,传入", required = true, dataType = "List") }) public JsonResult updateElectronicFenceApi(@RequestBody XzxElectronicFenceModel model){ // String partnerIds = model.getPartnerIds(); boolean flag = false; if(null!=partnerIds&&!"".equals(partnerIds)){ flag = true; } if(!flag){ return JsonResult.failMessage("必须填写关联合伙人!"); } ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); XzxElectronicFence info = objectMapper.convertValue(model, XzxElectronicFence.class); XzxElectronicFence oldInfo1 =service.queryById(info.getId()); info.setGid(oldInfo1.getGid()); //XzxElectronicFence oldInfo = service.queryById(info.getId()); if(null!=model.getFenceName()&&!"".equals(model.getFenceName())){ model.setFenceName(model.getFenceName().trim()); //是否有重名电子围栏 XzxElectronicFence oldInfo =service.queryElectronic(model); if(null!=oldInfo){ return JsonResult.failMessage("已经有相同的围栏名称,修改失败!"); }else{ String longiLatiStr = ""; String longiLatiStr2 = ""; if(model.getFenceType().equals("4")){ List longLatiArrList = model.getLongLatiArrList(); if(null!=longLatiArrList&&longLatiArrList.size()>0){ ObjectMapper mapper = new ObjectMapper(); List LongiLati = mapper.convertValue(longLatiArrList, new TypeReference>() { }); Gson gson = new Gson(); String str = gson.toJson(LongiLati); info.setLonglatiarr(str); for (LongiLatiModel lola:LongiLati) { if(null!=longiLatiStr&&!"".equals(longiLatiStr)){ longiLatiStr = longiLatiStr+";"+lola.getLongitude()+","+lola.getLatitude(); longiLatiStr2 = longiLatiStr2+"|"+lola.getLongitude()+","+lola.getLatitude(); }else{ longiLatiStr =lola.getLongitude()+","+lola.getLatitude(); longiLatiStr2 =lola.getLongitude()+","+lola.getLatitude(); } } } } if(model.getFenceType().equals("3")){ info.setKeyword(""); } info.setDelFlag(0); info.setCreateTime(sdf.format(new Date())); if(null!=info.getKeyword()&&!"".equals(info.getKeyword())){ AreaModel areaModel = new AreaModel(); areaModel.setName(info.getKeyword()); AreaModel map = cityPartnerService.queryAreaLongiLati(areaModel); info.setTownCode(map.getCode()); info.setLongitude(map.getLongitude()); info.setLatitude(map.getLatitude()); //该电子围栏是否包含该区域。 //String longgiLatiList = service.queryAreaLongiLatiList(city); } XzxPartnerFence pfInfo = new XzxPartnerFence(); XzxPartnerFenceModel pfInfo1 = new XzxPartnerFenceModel(); if(null!=partnerIds&&!"".equals(partnerIds)){ //List pfInfoList = new ArrayList<>(); String partnerId = partnerIds; //for (String partnerId:partnerArr) { if(null!=info.getKeyword()&&!"".equals(info.getKeyword())){ //校验该合伙人是否能创建电子围栏 String townId = service.queryAreaTownId(info.getKeyword()); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ return JsonResult.failMessage("该合伙人不能创建该地区的电子围栏"); }else{ //判断是否有在该区域建行政区 if(model.getFenceType().equals("2")){ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),info.getId()+""); if(townList.size()>0){ return JsonResult.failMessage("该区域不能创建电子围栏"); } } } }else{ return JsonResult.failMessage("该区域不能创建电子围栏"); } }else{ String keyword=""; String[] keywordList = new String[20]; if(null!=longiLatiStr2&&!"".equals(longiLatiStr2)){ String location =info.getLonglatiarr(); XzxCityPartner partner = cityPartnerService.queryById(partnerId); keyword = service.queryLongiLatiForTownName(partner.getPartnerKey(),location,longiLatiStr2); keywordList = keyword.split(","); }else{ XzxCityPartner partner = cityPartnerService.queryById(partnerId); String location = model.getLongitude()+","+model.getLatitude(); keyword = service.queryLongiLatiForTownName(partner.getPartnerKey(),location,null); } if(null!=keyword&&!"".equals(keyword)){ if(keywordList.length>0){ for (String keywords:keywordList) { String[] obj = keywords.split("_"); String keyword1 = obj[1]; int num = Integer.parseInt(obj[0]); String townId = service.queryAreaTownId(keyword1); AreaModel areaModel1 = new AreaModel(); areaModel1.setName(keyword1); AreaModel map1 = cityPartnerService.queryAreaLongiLati(areaModel1); info.setTownCode(map1.getCode()); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ String[] ll2= longiLatiStr.split(";"); String errorAddress = ll2[num]; return JsonResult.failMessage("该合伙人不应属于该区域,无法在经纬度为:"+errorAddress+" 创建电子围栏"); }else{ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),null); if(townList.size()>0){ String[] ll2= longiLatiStr.split(";"); String errorAddress = ll2[num]; return JsonResult.failMessage(keyword + " 已经建立行政区围栏,不能在:"+errorAddress+"该区域内创建其他围栏"); } } }else{ return JsonResult.failMessage("区域为空,不能创建电子围栏"); } } }else{ String townId = service.queryAreaTownId(keyword); if(null!=townId&&!"".equals(townId)){ boolean boolflag = service.queryPartnerAreaIds(partnerId,townId); if(!boolflag){ return JsonResult.failMessage("该合伙人不能创建该地区的电子围栏"); }else{ //判断是否有在该区域建行政区 List townList = service.queryTownListByArea(info.getTownCode(),info.getId()+""); if(townList.size()>0){ return JsonResult.failMessage("该区域不能修改电子围栏"); } } }else{ return JsonResult.failMessage("该区域不能创建电子围栏"); } } }else{ return JsonResult.failMessage("该区域不能创建电子围栏"); } } pfInfo.setFenceId(info.getId()+""); pfInfo.setPartnerId(partnerId); pfInfo1.setPartnerId(partnerId); if(oldInfo1.getGid()!=null&&!"".equals(oldInfo1.getGid())){ String gid = oldInfo1.getGid(); String resultJson = service.updateGDFence(info,pfInfo1,longiLatiStr,gid); System.out.println("==高德返回"+resultJson); Map maps = (Map) JSON.parse(resultJson); String str2=maps.get("data").toString(); Map maps2 = (Map)JSON.parse(str2); String statusGaode = maps2.get("status").toString(); if(statusGaode.equals("0")){ }else{ return JsonResult.failMessage("新增电子围栏失败"); } } }else{ return JsonResult.failMessage("新增电子围栏失败"); } info.setLonglatiarr(longiLatiStr); boolean bool = service.update(info); if(!bool){ return JsonResult.failMessage("修改电子围栏失败"); }else{ //修改关联表 //pfInfo.setPartnerId(); pfInfo.setFenceId(info.getId()+""); pfInfo.setDelFlag(0); pfInfo.setUpdateTime(sdf.format(new Date())); pfService.updateByFenceId(pfInfo); //pfService.saveAllPfInfo(pfInfoList); return JsonResult.success("修改成功!"); } } }else{ return JsonResult.failMessage("电子围栏名称不能为空!"); } } @PostMapping(MODEL + "/updateFenceProhibit.json") @ResponseBody @ApiOperation(value="后台电子围栏是否启用接口", notes="test: 仅0有正确返回") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name ="id", value = "合伙人Id", required = true, dataType = "String"), @ApiImplicitParam(paramType="query", name = "prohibit", value = "是否启用(0:禁用,1:启用)", required = true, dataType = "String") }) public JsonResult updateFenceProhibit(@RequestBody XzxElectronicFenceModel model){ XzxElectronicFence info=service.queryById(model.getId()); info.setProhibit(model.getProhibit()); info.setUpdateTime(sdf.format(new Date())); service.update(info); return JsonResult.success("修改成功"); } }