虫情设备图片数据获取修改

This commit is contained in:
mi9688
2024-11-20 17:34:35 +08:00
parent bfafd4bb80
commit 393c942da2
34 changed files with 489 additions and 235 deletions

View File

@ -60,8 +60,8 @@ public class DevLinkBaseService {
//TODO 属性值历史数据,是否需要
Object list = JSONUtil.parseObj(p).get("list");
// System.err.print("name:"+name);
System.err.print("key:"+key);
System.err.println("------------value:"+value);
// System.err.print("key:"+key);
// System.err.println("------------value:"+value);
//建立属性-值映射关系
propertiesMap.put(key,value);
// saveRealData(key,value,realData);

View File

@ -54,7 +54,7 @@ public class DevLinkMetDataService extends DevLinkBaseService {
} catch (ParseException e) {
throw new ServiceException("时间格式转换失败!");
}
System.err.println(build);
System.err.println("气象设备实时数据:"+build);
return build;
}

View File

@ -56,7 +56,7 @@ public class DevLinkMiaoQingDataService extends DevLinkBaseService {
} catch (ParseException e) {
throw new ServiceException("时间格式转换失败!");
}
System.err.println(miaoqing);
System.err.println("苗情设备光伏板实时数据:"+miaoqing);
return miaoqing;
}

View File

@ -69,7 +69,7 @@ public class DevLinkMoistureDataService extends DevLinkBaseService {
} catch (ParseException e) {
throw new ServiceException("时间格式转换失败!");
}
System.err.println(build);
System.err.println("墒情设备实时数据:"+build);
return build;
}

View File

@ -80,7 +80,7 @@ public class DevLinkPhotovoltaicDataService extends DevLinkBaseService {
throw new ServiceException("时间格式转换失败!");
}
System.err.println(photovoltaic);
System.err.println("光伏设备实时数据:"+photovoltaic);
return photovoltaic;
}
public static void main(String[] args) {

View File

@ -29,7 +29,7 @@ public class RenKeAuthorizationService {
//判断token是否过期
String cacheToken = stringRedisTemplate.opsForValue().get("renke:user:token");
if (!Objects.isNull(cacheToken)){
System.err.println("缓存中获取token:"+cacheToken);
// System.err.println("缓存中获取token:"+cacheToken);
return cacheToken;
}
//获取token

View File

@ -40,10 +40,12 @@ public class RenkeDeviceDataService {
.form("deviceAddrs", deviceAddrs)
.execute();
String respBodyStr = response.body();
if(StringUtils.isBlank(respBodyStr)) {
throw new RuntimeException("获取设备实时数据失败!");
}
JSONObject respBody = JSONUtil.parseObj(respBodyStr);
// System.err.println(respBodyStr);
if(!respBody.get("code") .toString().equals("1000")){
throw new ServiceException("获取设备实时数据失败!");
}
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
JSONObject jsonObject = JSONUtil.parseObj(realtimeDataList.get(0));
JSONObject jsonObject1 = JSONUtil.parseObj(jsonObject.get("data"));
@ -52,27 +54,42 @@ public class RenkeDeviceDataService {
//反序列化封装基础数据
deviceRealtimedataWorms = JSONUtil.toBean(jsonObject1, DeviceRealtimedataWorms.class);
//获取虫情设备关键数据
HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataList")
HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy?deviceAddr="+deviceAddrs)
.header("token", token)
.form("deviceAddrs", deviceAddrs)
//开始时间是5分钟前
.form("beginTime", DateTimeCalculationUtils.format(DateTimeCalculationUtils.minus(5, ChronoUnit.MINUTES)))
.form("endTime", DateUtils.getNowDate())
.form("pages", 1)
.form("limit", 10)
// .form( "deviceAddr", deviceAddrs)
// //开始时间是5分钟前
// .form("beginTime", DateTimeCalculationUtils.format(DateTimeCalculationUtils.minus(5, ChronoUnit.MINUTES)))
// .form("endTime", DateUtils.getNowDate())
// .form("pages", 1)
// .form("limit", 10)
.execute();
String respBodyStr1 = response.body();
if(StringUtils.isBlank(respBodyStr1)) {
// HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataList")
// .header("token", token)
// .form( "deviceAddr", deviceAddrs)
// //开始时间是5分钟前
// .form("beginTime", DateTimeCalculationUtils.format(DateTimeCalculationUtils.minus(5, ChronoUnit.MINUTES)))
// .form("endTime", DateUtils.getNowDate())
// .form("pages", 1)
// .form("limit", 10)
// .execute();
String respBodyStr1 = response1.body();
JSONObject respBody1 = JSONUtil.parseObj(respBodyStr1);
// System.err.println(respBodyStr1);
if(!respBody1.get("code") .toString().equals("1000")) {
throw new RuntimeException("获取设备实时数据失败!");
}
JSONObject jsonObject2 = JSONUtil.parseObj(respBodyStr1);
JSONObject jsonObject3 = JSONUtil.parseObj(jsonObject2.get("data"));
JSONArray jsonArray = JSONUtil.parseArray(jsonObject3.get("rows"));
JSONObject jsonObject4 = JSONUtil.parseObj(jsonArray.get(0));
System.err.println(respBody1);
JSONArray jsonArray = JSONUtil.parseArray(respBody1.get("data"));
JSONObject entries = JSONUtil.parseObj(jsonArray.get(0));
//获取拍照图片
Object imagesUrl = jsonObject4.get("imagesUrl");
Object imagesUrl = entries .get("imagesUrl");
//获取虫情分析后的图片地址
Object analyseCoordUrl = jsonObject4.get("analyseCoordUrl");
Object analyseCoordUrl = entries .get("analyseCoordUrl");
deviceRealtimedataWorms.setPestPhotos(analyseCoordUrl.toString());
deviceRealtimedataWorms.setCamera(imagesUrl.toString());
@ -86,14 +103,21 @@ public class RenkeDeviceDataService {
} catch (ParseException e) {
throw new ServiceException("时间格式转换失败!");
}
System.err.println("设备实时数据:"+deviceRealtimedataWorms);
System.err.println("虫情设备实时数据:"+deviceRealtimedataWorms);
return deviceRealtimedataWorms;
}
public static void main(String[] args) {
RenkeDeviceDataService renkeDeviceDataService = new RenkeDeviceDataService();
renkeDeviceDataService.setData("1017240042");
// RenkeDeviceDataService renkeDeviceDataService = new RenkeDeviceDataService();
// renkeDeviceDataService.setData("1017240042");
HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy?deviceAddr="+"1017240042")
.header("token", "834991732092248683")
.execute();
String respBodyStr1 = response1.body();
JSONObject respBody1 = JSONUtil.parseObj(respBodyStr1);
System.err.println(respBodyStr1);
}
}

View File

@ -13,7 +13,7 @@ import cn.hutool.json.JSONObject;
public class TianqiApi {
/**
* 获取用户所有设备信息
* 获取未来天气预测
*/
public static JSONObject QitianApi() {
@ -28,6 +28,22 @@ public class TianqiApi {
}
return null;
}
/**
* 获取天气实况
*/
public static JSONObject weatherNow() {
String url = UrlConstant.ShishiApi + "?key=" +
UrlConstant.PrivateKey +
"&location=YBMUBR41ZWVC&language=zh-Hans&unit=c";//指定URL
HttpResponse execute = HttpUtil.createGet(url).execute();
if (execute.getStatus() == HttpStatus.HTTP_OK) {
JSONObject jsonObject = new JSONObject(execute.body());
// System.out.println("jsonObject = " + jsonObject);
return jsonObject;
}
return null;
}
@ -56,20 +72,6 @@ public class TianqiApi {
}
public static void main(String[] args) {
// String url="https://api.seniverse.com/v3/location/search.json?key="+UrlConstant.PrivateKey+"&q=绥滨";
// HttpResponse execute = HttpUtil.createGet(url).execute();
// if (execute.getStatus() == HttpStatus.HTTP_OK) {
// JSONObject jsonObject = new JSONObject(execute.body());
// System.out.println("jsonObject = " + jsonObject);
// }
String url = UrlConstant.QitianApi + "?key=" +
UrlConstant.PrivateKey +
"&location=YBMUBR41ZWVC&language=zh-Hans&unit=c";//指定URL
HttpResponse execute = HttpUtil.createGet(url).execute();
if (execute.getStatus() == HttpStatus.HTTP_OK) {
JSONObject jsonObject = new JSONObject(execute.body());
System.out.println("jsonObject = " + jsonObject);
}
TianqiApi.weatherNow();
}
}

View File

@ -14,6 +14,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service
@ -35,45 +36,65 @@ public class YingshiyunService {
String body = StrUtil.format("appKey={}&appSecret={}", appKey, appSecret);
HttpResponse response = HttpRequest.post(AUTH_URL)
.body(body).execute();
JSONObject jsonObject = JSONUtil.parseObj(response.body());
String accessToken = JSONUtil.parseObj(jsonObject.get("data")).get("accessToken").toString();
stringRedisTemplate.opsForValue().set("yingshiyun:user:accessToken",accessToken, 60*60*24*6);
// System.err.println(jsonObject);
if( !jsonObject.get("code").toString().equals("200")){
throw new RuntimeException("获取萤石云token失败");
}
JSONObject data = JSONUtil.parseObj(jsonObject.get("data"));
String accessToken = data.get("accessToken").toString();
stringRedisTemplate.opsForValue().set("yingshiyun:user:accessToken",accessToken, 60*60*24*6, TimeUnit.MILLISECONDS);
return accessToken;
}
//获取视频播放地址
public String getVideoPlayUrl(String deviceSerial){
public Map<String,Object> getVideoPlayUrl(String deviceSerial){
String accessToken = getAuth();
// System.err.println(accessToken);
String VIDEO_PLAY_URL = "https://open.ys7.com/api/lapp/v2/live/address/get";
String body = StrUtil.format("accessToken={}&deviceSerial={}",accessToken ,deviceSerial );
String body = StrUtil.format("accessToken={}&deviceSerial={}&protocol={}",accessToken ,deviceSerial,"2");
HttpResponse response = HttpRequest.post(VIDEO_PLAY_URL)
.form(body).execute();
.body(body).execute();
JSONObject jsonObject = JSONUtil.parseObj(response.body());
String videoPlayUrl = JSONUtil.parseObj(jsonObject.get("data")).get("url").toString();
String expireTime = JSONUtil.parseObj(jsonObject.get("data")).get("expireTime").toString();
Map<String, Object> resp= new HashMap<>();
resp.put("videoPlayUrl",videoPlayUrl);
resp.put("expireTime",expireTime);
resp.put("deviceSerial",deviceSerial);
return videoPlayUrl;
Map<String,Object> map = new HashMap<>();
if(!jsonObject.get("code").toString().equals("200")){
return map;
}
// System.err.println(jsonObject);
JSONObject data = JSONUtil.parseObj(jsonObject.get("data"));
// System.err.println(data);
String playUrl = data.get("url").toString();
map.put("playUrl",playUrl);
map.put("accessToken",accessToken);
return map;
}
public static void main(String[] args) {
YingshiyunService yingshiyunService = new YingshiyunService();
yingshiyunService.getAuth();
long timeStamp = 1731571309231L;
Date date = new Date(timeStamp);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
sdf.setTimeZone(java.util.TimeZone.getTimeZone("Asia/Shanghai"));
String formattedDate = sdf.format(date);
System.out.println(formattedDate);
// 鉴权请求
String AUTH_URL = "https://open.ys7.com/api/lapp/token/get";
String appKey = "b21f910dc7044d668e7625a3c0392e62";
String appSecret = "b4beff5f8f6694dd6993c8c5b618417b";
// 构建请求体参数
String body = StrUtil.format("appKey={}&appSecret={}", appKey, appSecret);
HttpResponse response = HttpRequest.post(AUTH_URL)
.body(body).execute();
JSONObject jsonObject = JSONUtil.parseObj(response.body());
System.err.println(jsonObject);
if( !jsonObject.get("code").toString().equals("200")){
throw new RuntimeException("获取萤石云token失败");
}
JSONObject data = JSONUtil.parseObj(jsonObject.get("data"));
String accessToken = data.get("accessToken").toString();
System.err.println(accessToken);
}
}

View File

@ -17,96 +17,109 @@ import com.fastbee.common.core.domain.BaseEntity;
* 监控站设备基础信息对象 iot_device_information_monitor
*
* @author kerwincui
* @date 2024-11-18
* @date 2024-11-20
*/
@ApiModel(value = "DeviceInformationMonitor",description = "监控站设备基础信息 iot_device_information_monitor")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("iot_device_information_monitor")
@TableName ("iot_device_information_monitor")
public class DeviceInformationMonitor extends BaseEntity
{
private static final long serialVersionUID = 1L;
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 名称 */
@Excel(name = "名称")
@ApiModelProperty("名称")
@Excel(name = "名称")
@ApiModelProperty("名称")
private String name;
/** 设备编码 */
@Excel(name = "设备编码")
@ApiModelProperty("设备编码")
@Excel(name = "设备编码")
@ApiModelProperty("设备编码")
private String deviceEncoding;
/** 类型 */
@Excel(name = "类型")
@ApiModelProperty("类型")
@Excel(name = "类型")
@ApiModelProperty("类型")
private String type;
/** 经度 */
@Excel(name = "经度")
@ApiModelProperty("经度")
@Excel(name = "经度")
@ApiModelProperty("经度")
private String longitude;
/** 纬度 */
@Excel(name = "纬度")
@ApiModelProperty("纬度")
@Excel(name = "纬度")
@ApiModelProperty("纬度")
private String latitude;
/** 安装位置 */
@Excel(name = "安装位置")
@ApiModelProperty("安装位置")
@Excel(name = "安装位置")
@ApiModelProperty("安装位置")
private String installationLocation;
/** 设备品牌 */
@Excel(name = "设备品牌")
@ApiModelProperty("设备品牌")
@Excel(name = "设备品牌")
@ApiModelProperty("设备品牌")
private String deviceBrand;
/** 设备型号 */
@Excel(name = "设备型号")
@ApiModelProperty("设备型号")
@Excel(name = "设备型号")
@ApiModelProperty("设备型号")
private String deviceType;
/** 项目的名称 */
@Excel(name = "项目的名称")
@ApiModelProperty("项目的名称")
@Excel(name = "项目的名称")
@ApiModelProperty("项目的名称")
private String nameProject;
/** 建设年度 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "建设年度", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("建设年度")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "建设年度", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("建设年度")
private Date constructionYear;
/** 所属乡镇 */
@Excel(name = "所属乡镇")
@ApiModelProperty("所属乡镇")
@Excel(name = "所属乡镇")
@ApiModelProperty("所属乡镇")
private String affiliationTownship;
/** 管理负责人 */
@Excel(name = "管理负责人")
@ApiModelProperty("管理负责人")
@Excel(name = "管理负责人")
@ApiModelProperty("管理负责人")
private String managementLeader;
/** 管理负责人电话 */
@Excel(name = "管理负责人电话")
@ApiModelProperty("管理负责人电话")
@Excel(name = "管理负责人电话")
@ApiModelProperty("管理负责人电话")
private String managementLeaderTelephone;
/** 管理单位 */
@Excel(name = "管理单位")
@ApiModelProperty("管理单位")
@Excel(name = "管理单位")
@ApiModelProperty("管理单位")
private String managementUnit;
/** 备注信息 */
@Excel(name = "备注信息")
@ApiModelProperty("备注信息")
@Excel(name = "备注信息")
@ApiModelProperty("备注信息")
private String remarksInformation;
/** 删除标志0代表存在2代表删除 */
private Integer delFlag;
//------------------------------------------------------------------------------------业务字段---------------
/** 监控播放地址 */
@Excel(name = "监控播放地址")
@ApiModelProperty("监控播放地址")
private String playUrl;
/** accessToken */
@Excel(name = "accessToken")
@ApiModelProperty("accessToken")
private String accessToken;
}

View File

@ -0,0 +1,57 @@
package com.fastbee.deviceInfo.manager;
import com.fastbee.deviceInfo.domain.*;
import com.fastbee.deviceInfo.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class DeviceInformationManager {
@Autowired
private DeviceInformationMeteorologyMapper meteorologyMapper;
@Autowired
private DeviceInformationMiaoqingMapper miaoqingMapper;
@Autowired
private DeviceInformationMoistureMapper moistureMapper;
@Autowired
private DeviceInformationMonitorMapper monitorMapper;
@Autowired
private DeviceInformationTargetpestsMapper targetpestsMapper;
@Autowired
private DeviceInformationWormsMapper wormsMapper;
/**
* 获取所有设备
*/
public Map<String,Object> getAllDeviceCount() {
List<DeviceInformationMeteorology> meteorologieList = meteorologyMapper.selectDeviceInformationMeteorologyList(null);
List<DeviceInformationMiaoqing> miaoqingList = miaoqingMapper.selectDeviceInformationMiaoqingList(null);
List<DeviceInformationMoisture> moistureList= moistureMapper.selectDeviceInformationMoistureList(null);
List<DeviceInformationMonitor> monitorList = monitorMapper.selectDeviceInformationMonitorList(null);
List<DeviceInformationTargetpests> targetpestList= targetpestsMapper.selectDeviceInformationTargetpestsList(null);
List<DeviceInformationWorms> wormList = wormsMapper.selectDeviceInformationWormsList(null);
Map<String,Object> resp =new HashMap<>();
resp.put("meteorologieTotal",meteorologieList.size());
resp.put("miaoqingTotal",miaoqingList.size());
resp.put("moistureTotal",moistureList.size());
resp.put("monitorTotal",monitorList.size());
resp.put("targetpestTotal",targetpestList.size());
resp.put("wormTotal",wormList.size());
resp.put("photovoltaicTotal",miaoqingList.size());
return resp;
}
}

View File

@ -26,10 +26,11 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="playUrl" column="play_url" />
</resultMap>
<sql id="selectDeviceInformationMonitorVo">
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by from iot_device_information_monitor
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by, play_url from iot_device_information_monitor
</sql>
<select id="selectDeviceInformationMonitorList" parameterType="DeviceInformationMonitor" resultMap="DeviceInformationMonitorResult">
@ -50,6 +51,7 @@
<if test="managementLeaderTelephone != null and managementLeaderTelephone != ''"> and management_leader_telephone = #{managementLeaderTelephone}</if>
<if test="managementUnit != null and managementUnit != ''"> and management_unit = #{managementUnit}</if>
<if test="remarksInformation != null and remarksInformation != ''"> and remarks_information = #{remarksInformation}</if>
<if test="playUrl != null and playUrl != ''"> and play_url = #{playUrl}</if>
</where>
</select>
@ -81,6 +83,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="playUrl != null">play_url,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -103,6 +106,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="playUrl != null">#{playUrl},</if>
</trim>
</insert>
@ -129,6 +133,7 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="playUrl != null">play_url = #{playUrl},</if>
</trim>
where id = #{id}
</update>

View File

@ -1,5 +1,6 @@
package com.fastbee.iot.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -19,6 +20,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "AlertLog", description = "设备告警日志实体 iot_alert_log")
@TableName("iot_alert_log")
public class AlertLog extends BaseEntity
{
private static final long serialVersionUID = 1L;

View File

@ -1,5 +1,6 @@
package com.fastbee.iot.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.iot.domain.AlertLog;
import com.fastbee.iot.model.DeviceAlertCount;
import com.fastbee.iot.model.AlertCountVO;
@ -16,7 +17,7 @@ import java.util.List;
* @date 2022-01-13
*/
@Repository
public interface AlertLogMapper
public interface AlertLogMapper extends BaseMapper<AlertLog>
{
/**
* 查询设备告警

View File

@ -153,6 +153,11 @@ public class Project extends BaseEntity
@ApiModelProperty("行政区域村代码")
private String villageCode;
/** 项目lei */
@Excel(name = "项目lei")
@ApiModelProperty("项目lei")
private Long type;
//业务字段---------------------------------------------------------------------------
/**
* 系统账号名称

View File

@ -17,6 +17,7 @@ import com.fastbee.common.utils.json.JsonStrUtil;
import com.fastbee.iot.model.RegisterUserInput;
import com.fastbee.iot.model.RegisterUserOutput;
import com.fastbee.iot.service.IToolService;
import com.fastbee.common.constant.ProjectTypeConstant;
import com.fastbee.project.domain.Project;
import com.fastbee.project.domain.vo.ProjectLoginBaseInfo;
import com.fastbee.project.mapper.ProjectMapper;
@ -168,9 +169,26 @@ public class ProjectServiceImpl implements IProjectService
// 添加管理员角色,给基本权限
SysDept sysDept = deptService.selectDeptById(100L);
List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), sysDept.getDeptUserId());
Long[] menuIdList = sysMenuList.stream().map(SysMenu::getMenuId)
.filter(menuId-> menuId!=3469L&&menuId!=3L&&menuId!=2L &&menuId!=3468L&&menuId!=102L)
Long[] menuIdList = sysMenuList.stream()
//过滤掉不该有的菜单
.filter(this::baseMenuFilter)
.map(SysMenu::getMenuId)
.toArray(Long[]::new);
//根据项目类型过滤菜单
if (!Objects.nonNull(project.getType())||ProjectTypeConstant.isValidProjectType(project.getType())) {
throw new ServiceException("项目类型不能为空或者非法!");
}
if (Objects.equals(project.getType(),ProjectTypeConstant.WATER)) {
List<Long> menuList=Arrays.asList(menuIdList);
menuIdList = menuList.stream().filter(this::waterMenuFilter).toArray(Long[]::new);
}
if (Objects.equals(project.getType(),ProjectTypeConstant.AGRICULTURE)) {
List<Long> menuList=Arrays.asList(menuIdList);
menuIdList = menuList.stream().filter(this::agriculturalMenuFilter).toArray(Long[]::new);
}
SysRole sysRole = new SysRole();
sysRole.setRoleName("管理员");
sysRole.setRoleKey("manager");
@ -209,8 +227,37 @@ public class ProjectServiceImpl implements IProjectService
if(!updatedSysDept){
throw new ServiceException("机构与项目关联失败!");
}
return 1;
}
/**
* 判断菜单是否为非法持有菜单
* @param sysMenu 菜单
* @return 是否为非法菜单
*/
private boolean baseMenuFilter(SysMenu sysMenu) {
Long menuId = sysMenu.getMenuId();
boolean base = menuId != 3469L//项目管理
&& menuId != 3L//系统工具
&& menuId!= 2L//系统监控
&& menuId != 3468L//图例管理
&& menuId != 102L;//菜单管理
return base;
}
//农业项目过滤菜单
private boolean agriculturalMenuFilter(Long menuId){
return menuId != 3353L;//项目管理
}
//水利项目过滤菜单
private boolean waterMenuFilter(Long menuId){
return menuId != 3474L;//项目管理
}
/**
* 解析项目行政区划信息

View File

@ -36,10 +36,11 @@
<result property="countyCode" column="county_code" />
<result property="townCode" column="town_code" />
<result property="villageCode" column="village_code" />
<result property="type" column="type" />
</resultMap>
<sql id="selectProjectVo">
select id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name, owner_id, parent_id, dept_id, administrative_area_code, dept_name, level, province_code, city_code, county_code, town_code, village_code from project
select id, project_name, sys_show_name, central_coordinates, scope, administrative_area, owner, logo, image, video_introduction, remark, p_params, introduce, del_flag, create_time, create_by, update_time, remarks, tenant_id, tenant_name, owner_id, parent_id, dept_id, administrative_area_code, dept_name, level, province_code, city_code, county_code, town_code, village_code, type from project
</sql>
<select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
@ -70,6 +71,7 @@
<if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if>
<if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if>
<if test="villageCode != null and villageCode != ''"> and village_code = #{villageCode}</if>
<if test="type != null "> and type = #{type}</if>
</where>
</select>
@ -111,6 +113,7 @@
<if test="countyCode != null">county_code,</if>
<if test="townCode != null">town_code,</if>
<if test="villageCode != null">village_code,</if>
<if test="type != null">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectName != null and projectName != ''">#{projectName},</if>
@ -143,6 +146,7 @@
<if test="countyCode != null">#{countyCode},</if>
<if test="townCode != null">#{townCode},</if>
<if test="villageCode != null">#{villageCode},</if>
<if test="type != null">#{type},</if>
</trim>
</insert>
@ -179,6 +183,7 @@
<if test="countyCode != null">county_code = #{countyCode},</if>
<if test="townCode != null">town_code = #{townCode},</if>
<if test="villageCode != null">village_code = #{villageCode},</if>
<if test="type != null">type = #{type},</if>
</trim>
where id = #{id}
</update>