增加接口
This commit is contained in:
parent
6a12ca2fb6
commit
0fbf18ab21
|
|
@ -5,11 +5,16 @@ import java.util.Date;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.constant.enums.PollutionEnum;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.entity.ScEquZhibiao;
|
import org.jeecg.common.entity.ScEquZhibiao;
|
||||||
|
import org.jeecg.common.vo.PolutionVo;
|
||||||
import org.jeecg.modules.appmana.service.IScEquZhibiaoService;
|
import org.jeecg.modules.appmana.service.IScEquZhibiaoService;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
|
@ -203,4 +208,26 @@ public class ScEquZhibiaoController extends JeecgController<ScEquZhibiao, IScEqu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("13.获取污染物字典属性")
|
||||||
|
@ApiOperationSupport(order = 13)
|
||||||
|
@GetMapping("/getPollutionDict")
|
||||||
|
public Result getPollutionDict() {
|
||||||
|
PollutionEnum[] values = PollutionEnum.values();
|
||||||
|
JSONArray jarrs = new JSONArray();
|
||||||
|
for (PollutionEnum e : values) {
|
||||||
|
PolutionVo pvo = new PolutionVo();
|
||||||
|
pvo.setCode(e.getCode());
|
||||||
|
pvo.setDescription(e.getDescription());
|
||||||
|
pvo.setUnit(e.getUnit());
|
||||||
|
pvo.setIcon(e.getIcon());
|
||||||
|
pvo.setColor(e.getColor());
|
||||||
|
// JSONObject job =new JSONObject();
|
||||||
|
// job.put(e.getCode(),pvo);
|
||||||
|
// jarrs.add(job);
|
||||||
|
jarrs.add(JSONObject.parseObject(JSONObject.toJSONString(pvo)));
|
||||||
|
|
||||||
|
}
|
||||||
|
return Result.ok(jarrs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package org.jeecg.modules.appmana.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.entity.SurvCityCode;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvCityCodeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市编码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-06
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "99. 城市编码 id")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appmana/fCityCode")
|
||||||
|
@Slf4j
|
||||||
|
public class SurvCityCodeController extends JeecgController<SurvCityCode, SurvCityCodeService> {
|
||||||
|
@Autowired
|
||||||
|
private SurvCityCodeService fCityCodeService;
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "城市编码-分页列表查询")
|
||||||
|
@ApiOperation(value = "01. 分页查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<SurvCityCode>> queryPageList(SurvCityCode survCityCode,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<SurvCityCode> queryWrapper = QueryGenerator.initQueryWrapper(survCityCode, req.getParameterMap());
|
||||||
|
Page<SurvCityCode> page = new Page<SurvCityCode>(pageNo, pageSize);
|
||||||
|
IPage<SurvCityCode> pageList = fCityCodeService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "城市编码-添加")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@ApiOperation(value = "02. 添加", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody SurvCityCode survCityCode, HttpServletRequest request) {
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
fCityCodeService.save(survCityCode);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "城市编码-编辑")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@ApiOperation(value = "03. 编辑", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:edit")
|
||||||
|
@PostMapping(value = "/edit")
|
||||||
|
public Result<String> edit(@RequestBody SurvCityCode survCityCode, HttpServletRequest request) {
|
||||||
|
//创建、更新时间不能编辑
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
fCityCodeService.updateById(survCityCode);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "城市编码-通过id删除")
|
||||||
|
@ApiOperation(value = "04.通过id删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
fCityCodeService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "城市编码-批量删除")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@ApiOperation(value = "04. 批量删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.fCityCodeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "城市编码-通过id查询")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@ApiOperation(value = "05. 通过id查询", notes = "")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<SurvCityCode> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
SurvCityCode survCityCode = fCityCodeService.getById(id);
|
||||||
|
if (survCityCode == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(survCityCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@ApiOperation(value = "06. 导出excel", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:exportXls")
|
||||||
|
@GetMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, SurvCityCode survCityCode) {
|
||||||
|
return super.exportXls(request, survCityCode, SurvCityCode.class, "城市编码");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 7)
|
||||||
|
@ApiOperation(value = "07. 导入excel", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_city_code:importExcel")
|
||||||
|
@PostMapping(value = "/importExcel")
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, SurvCityCode.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|
@ -95,34 +96,9 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
||||||
@RequiresPermissions("appmana:surv_device_deploy:add")
|
@RequiresPermissions("appmana:surv_device_deploy:add")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<String> add(@RequestBody SurvDeviceDeploy survDeviceDeploy, HttpServletRequest request) {
|
public Result<String> add(@RequestBody SurvDeviceDeploy survDeviceDeploy, HttpServletRequest request) {
|
||||||
//处理设备链接保存
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
if(StringUtils.isNotBlank(survDeviceDeploy.getXyId())&&survDeviceDeploy.getProtocolDetail()!=null){
|
survDeviceDeploy.setCreatedBy(username);
|
||||||
String username = JwtUtil.getUserNameByToken(request);
|
survDeviceDeployService.saveDeploy(survDeviceDeploy);
|
||||||
ScCont contEnt = new ScCont();
|
|
||||||
contEnt.setEquId(survDeviceDeploy.getDeployCode());
|
|
||||||
contEnt.setXyId(survDeviceDeploy.getXyId());
|
|
||||||
contEnt.setCreateId(username);
|
|
||||||
contEnt.setCreateTime(new Date());
|
|
||||||
scContService.save(contEnt);
|
|
||||||
|
|
||||||
|
|
||||||
List<ScContExe> saveList = new ArrayList<>();
|
|
||||||
for (String key : survDeviceDeploy.getProtocolDetail().keySet()) {
|
|
||||||
ScContExe contExe = new ScContExe();
|
|
||||||
contExe.setCreateId(username);
|
|
||||||
contExe.setCreateTime(contEnt.getCreateTime());
|
|
||||||
contExe.setCode(key);
|
|
||||||
contExe.setValue(survDeviceDeploy.getProtocolDetail().getString(key));
|
|
||||||
contExe.setContId(contEnt.getId());
|
|
||||||
saveList.add(contExe);
|
|
||||||
}
|
|
||||||
if(saveList.size()>0) {
|
|
||||||
scContExeService.saveBatch(saveList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
survDeviceDeploy.setCreateTime(new Date());
|
|
||||||
survDeviceDeployService.save(survDeviceDeploy);
|
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,56 +113,10 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
||||||
@RequiresPermissions("appmana:surv_device_deploy:edit")
|
@RequiresPermissions("appmana:surv_device_deploy:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody SurvDeviceDeploy survDeviceDeploy, HttpServletRequest request) {
|
public Result<String> edit(@RequestBody SurvDeviceDeploy survDeviceDeploy, HttpServletRequest request) {
|
||||||
//处理设备连接修改
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
if(StringUtils.isNotBlank(survDeviceDeploy.getXyId())&&survDeviceDeploy.getProtocolDetail()!=null){
|
survDeviceDeploy.setCreatedBy(username);
|
||||||
//step 1:删除现有的协议
|
|
||||||
List<ScCont> contList = scContService.list(Wrappers.<ScCont>lambdaQuery().eq(ScCont::getEquId,survDeviceDeploy.getDeployCode()));
|
|
||||||
if(contList.size()>0){
|
|
||||||
scContService.removeById(contList.get(0).getId());
|
|
||||||
scContExeService.remove(Wrappers.<ScContExe>lambdaQuery().eq(ScContExe::getContId,contList.get(0).getId()));
|
|
||||||
}
|
|
||||||
//step 2:重新建立连接
|
|
||||||
|
|
||||||
String username = JwtUtil.getUserNameByToken(request);
|
survDeviceDeployService.updateDeploy(survDeviceDeploy);
|
||||||
ScCont contEnt = new ScCont();
|
|
||||||
contEnt.setEquId(survDeviceDeploy.getDeployCode());
|
|
||||||
contEnt.setXyId(survDeviceDeploy.getXyId());
|
|
||||||
contEnt.setCreateId(username);
|
|
||||||
contEnt.setCreateTime(new Date());
|
|
||||||
scContService.save(contEnt);
|
|
||||||
|
|
||||||
|
|
||||||
List<ScContExe> saveList = new ArrayList<>();
|
|
||||||
for (String key : survDeviceDeploy.getProtocolDetail().keySet()) {
|
|
||||||
ScContExe contExe = new ScContExe();
|
|
||||||
contExe.setCreateId(username);
|
|
||||||
contExe.setCreateTime(contEnt.getCreateTime());
|
|
||||||
contExe.setCode(key);
|
|
||||||
contExe.setValue(survDeviceDeploy.getProtocolDetail().getString(key));
|
|
||||||
contExe.setContId(contEnt.getId());
|
|
||||||
saveList.add(contExe);
|
|
||||||
}
|
|
||||||
if(saveList.size()>0) {
|
|
||||||
scContExeService.saveBatch(saveList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
survDeviceDeploy.setCreateTime(null);
|
|
||||||
survDeviceDeploy.setUpdatedTime(null);
|
|
||||||
String username = JwtUtil.getUserNameByToken(request);
|
|
||||||
survDeviceDeploy.setUpdatedBy(username);
|
|
||||||
|
|
||||||
|
|
||||||
//假如有水设备操作
|
|
||||||
// if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())&&StringUtils.isNotBlank(survDeviceDeploy.getValveStatus1())){
|
|
||||||
// String deployCodeNum = survDeviceDeploy.getDeployCode().substring(CommonConstant.XZP_WATER.length());//xzp-water-01获取到01
|
|
||||||
// StringBuilder sbuilder = new StringBuilder("AA");
|
|
||||||
// sbuilder.append(deployCodeNum).append("080101").append(survDeviceDeploy.getValveStatus1()).append("0055");
|
|
||||||
// survDeviceDeploy.setSendInfo(sbuilder.toString());
|
|
||||||
// log.warn("操作水设备"+survDeviceDeploy.getDeployCode()+",指令:"+sbuilder.toString());
|
|
||||||
// }
|
|
||||||
survDeviceDeployService.updateById(survDeviceDeploy);
|
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,4 +274,17 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "设备重新初始化")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@ApiOperation(value = "04. 设备重新初始化", notes = "")
|
||||||
|
@PostMapping(value = "/initDevice")
|
||||||
|
public Result<String> initDevice(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
boolean b = survDeviceDeployService.initDevice(Arrays.asList(ids.split(",")));
|
||||||
|
if(b){
|
||||||
|
return Result.OK("初始化成功!");
|
||||||
|
}else{
|
||||||
|
return Result.error("初始化失败,请联系管理员!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
package org.jeecg.modules.appmana.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.entity.SurvDictCity;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.common.util.TreeUtil;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictCityService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市列表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-09-01
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "99. 城市列表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appmana/fDictCity")
|
||||||
|
@Slf4j
|
||||||
|
public class SurvDictCityController extends JeecgController<SurvDictCity, SurvDictCityService> {
|
||||||
|
@Autowired
|
||||||
|
private SurvDictCityService fDictCityService;
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "城市列表-分页列表查询")
|
||||||
|
@ApiOperation(value = "01. 分页查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<SurvDictCity>> getTree(SurvDictCity survDictCity,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<SurvDictCity> queryWrapper = QueryGenerator.initQueryWrapper(survDictCity, req.getParameterMap());
|
||||||
|
Page<SurvDictCity> page = new Page<SurvDictCity>(pageNo, pageSize);
|
||||||
|
IPage<SurvDictCity> pageList = fDictCityService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONArray tree = null;
|
||||||
|
|
||||||
|
@ApiOperation(value = "01. 城市树", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/tree")
|
||||||
|
public Result getTree() {
|
||||||
|
if (tree == null) {
|
||||||
|
List<SurvDictCity> list = fDictCityService.list();
|
||||||
|
JSONArray array = JSONArray.parseArray(JSON.toJSONString(list));
|
||||||
|
tree = TreeUtil.getTree(array, "0", "id", "parentId");
|
||||||
|
}
|
||||||
|
return Result.OK(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "城市列表-添加")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@ApiOperation(value = "02. 添加", notes = "")
|
||||||
|
@RequiresPermissions("/farmdict/:f_dict_city:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody SurvDictCity survDictCity, HttpServletRequest request) {
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictCity.setCreateBy(username);
|
||||||
|
survDictCity.setCreateTime(new Date());
|
||||||
|
fDictCityService.save(survDictCity);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "城市列表-编辑")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@ApiOperation(value = "03. 编辑", notes = "")
|
||||||
|
@RequiresPermissions("/farmdict/:f_dict_city:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody SurvDictCity survDictCity, HttpServletRequest request) {
|
||||||
|
//创建、更新时间不能编辑
|
||||||
|
survDictCity.setCreateTime(null);
|
||||||
|
survDictCity.setUpdateTime(null);
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictCity.setUpdateBy(username);
|
||||||
|
fDictCityService.updateById(survDictCity);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "城市列表-批量删除")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@ApiOperation(value = "04. 批量删除", notes = "")
|
||||||
|
@RequiresPermissions("/farmdict/:f_dict_city:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.fDictCityService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "城市列表-通过id查询")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@ApiOperation(value = "05. 通过id查询", notes = "")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<SurvDictCity> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
SurvDictCity survDictCity = fDictCityService.getById(id);
|
||||||
|
if (survDictCity == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(survDictCity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@ApiOperation(value = "06. 导出excel", notes = "")
|
||||||
|
@RequiresPermissions("/farmdict/:f_dict_city:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, SurvDictCity survDictCity) {
|
||||||
|
return super.exportXls(request, survDictCity, SurvDictCity.class, "城市列表");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 7)
|
||||||
|
@ApiOperation(value = "07. 导入excel", notes = "")
|
||||||
|
@RequiresPermissions("/farmdict/:f_dict_city:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, SurvDictCity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,213 @@
|
||||||
|
package org.jeecg.modules.appmana.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
|
||||||
|
import org.jeecg.common.util.TreeUtil;
|
||||||
|
import org.jeecg.common.vo.iot.common.VODeviceCategoryTree;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictDeviceCateService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备种类字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "99. 设备种类字典 id")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appmana/fDictDeviceCate")
|
||||||
|
@Slf4j
|
||||||
|
public class SurvDictDeviceCateController extends JeecgController<SurvDictDeviceCate, SurvDictDeviceCateService> {
|
||||||
|
@Autowired
|
||||||
|
private SurvDictDeviceCateService fDictDeviceCateService;
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "设备种类字典-分页列表查询")
|
||||||
|
@ApiOperation(value = "01. 分页查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<SurvDictDeviceCate>> queryPageList(SurvDictDeviceCate survDictDeviceCate,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<SurvDictDeviceCate> queryWrapper = QueryGenerator.initQueryWrapper(survDictDeviceCate, req.getParameterMap());
|
||||||
|
Page<SurvDictDeviceCate> page = new Page<SurvDictDeviceCate>(pageNo, pageSize);
|
||||||
|
IPage<SurvDictDeviceCate> pageList = fDictDeviceCateService.page(page, queryWrapper);
|
||||||
|
if(!pageList.getRecords().isEmpty()){
|
||||||
|
List<String> cates = new ArrayList<>();
|
||||||
|
pageList.getRecords().forEach(item->cates.add(item.getParentId()));
|
||||||
|
Map<String, SurvDictDeviceCate> map = new HashMap<>();
|
||||||
|
List<SurvDictDeviceCate> cates1 = fDictDeviceCateService.listByIds(cates);
|
||||||
|
if(!cates1.isEmpty()){
|
||||||
|
for (SurvDictDeviceCate cate : cates1) {
|
||||||
|
map.put(cate.getId(),cate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SurvDictDeviceCate record : pageList.getRecords()) {
|
||||||
|
SurvDictDeviceCate cate = map.get(record.getId());
|
||||||
|
record.setParentName(cate!=null?cate.getCateName():"其他");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "01. 获取树", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/tree1")
|
||||||
|
public Result<List<VODeviceCategoryTree>> queryPageList() {
|
||||||
|
List<SurvDictDeviceCate> list = fDictDeviceCateService.list();
|
||||||
|
return Result.OK(getTree(list, "0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "设备种类字典-添加")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@ApiOperation(value = "02. 添加", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_cate:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody SurvDictDeviceCate survDictDeviceCate, HttpServletRequest request) {
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictDeviceCate.setCreateBy(username);
|
||||||
|
survDictDeviceCate.setCreateTime(new Date());
|
||||||
|
fDictDeviceCateService.save(survDictDeviceCate);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "设备种类字典-编辑")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@ApiOperation(value = "03. 编辑", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_cate:edit")
|
||||||
|
@PostMapping(value = "/edit")
|
||||||
|
public Result<String> edit(@RequestBody SurvDictDeviceCate survDictDeviceCate, HttpServletRequest request) {
|
||||||
|
//创建、更新时间不能编辑
|
||||||
|
survDictDeviceCate.setCreateTime(null);
|
||||||
|
survDictDeviceCate.setUpdateTime(null);
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictDeviceCate.setUpdateBy(username);
|
||||||
|
Assert.isTrue(!survDictDeviceCate.getParentId().equals(survDictDeviceCate.getId()), "不能选择本身为上级");
|
||||||
|
fDictDeviceCateService.updateById(survDictDeviceCate);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "设备种类字典-通过id删除")
|
||||||
|
@ApiOperation(value = "04.通过id删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_cate:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
fDictDeviceCateService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "设备种类字典-批量删除")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@ApiOperation(value = "04. 批量删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_cate:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.fDictDeviceCateService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "设备种类字典-通过id查询")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@ApiOperation(value = "05. 通过id查询", notes = "")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<SurvDictDeviceCate> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
SurvDictDeviceCate survDictDeviceCate = fDictDeviceCateService.getById(id);
|
||||||
|
if (survDictDeviceCate == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(survDictDeviceCate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @ApiOperationSupport(order = 6)
|
||||||
|
// @ApiOperation(value="06. 导出excel", notes="")
|
||||||
|
// @RequiresPermissions("farm:f_dict_device_cate:exportXls")
|
||||||
|
// @GetMapping(value = "/exportXls")
|
||||||
|
// public ModelAndView exportXls(HttpServletRequest request, FDictDeviceCate fDictDeviceCate) {
|
||||||
|
// return super.exportXls(request, fDictDeviceCate, FDictDeviceCate.class, "设备种类字典");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @ApiOperationSupport(order = 7)
|
||||||
|
// @ApiOperation(value="07. 导入excel", notes="")
|
||||||
|
// @RequiresPermissions("farm:f_dict_device_cate:importExcel")
|
||||||
|
// @PostMapping(value = "/importExcel")
|
||||||
|
// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
// return super.importExcel(request, response, FDictDeviceCate.class);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "06. 列表查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/catelist")
|
||||||
|
public Result<List<SurvDictDeviceCate>> queryList(SurvDictDeviceCate survDictDeviceCate,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(survDictDeviceCate);
|
||||||
|
wrapper.last("ORDER BY CONVERT ( CATE_NAME USING gbk ) ASC");
|
||||||
|
List<SurvDictDeviceCate> list = fDictDeviceCateService.list(wrapper);
|
||||||
|
return Result.OK(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "07. 树结构查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/tree")
|
||||||
|
public Result queryTreeList(SurvDictDeviceCate survDictDeviceCate,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
|
||||||
|
List<SurvDictDeviceCate> list = fDictDeviceCateService.listAll(survDictDeviceCate);
|
||||||
|
JSONArray array = JSONArray.parseArray(JSON.toJSONString(list, SerializerFeature.WriteDateUseDateFormat));
|
||||||
|
JSONArray tree = TreeUtil.getTree(array, "0", "id", "parentId");
|
||||||
|
return Result.OK(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<VODeviceCategoryTree> getTree(List<SurvDictDeviceCate> src, String pid) {
|
||||||
|
List<VODeviceCategoryTree> res = new ArrayList<>();
|
||||||
|
for (SurvDictDeviceCate f : src) {
|
||||||
|
if (f.getParentId().equals(pid)) {
|
||||||
|
VODeviceCategoryTree vo = new VODeviceCategoryTree();
|
||||||
|
BeanUtils.copyProperties(f, vo);
|
||||||
|
res.add(vo);
|
||||||
|
List<VODeviceCategoryTree> tree = getTree(src, f.getParentId());
|
||||||
|
vo.setChildren(tree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
package org.jeecg.modules.appmana.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceDetail;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictDeviceCateService;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictDeviceDetailService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备明细字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "99. 设备明细字典 id")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/appmana/fDictDeviceDetail")
|
||||||
|
@Slf4j
|
||||||
|
public class SurvDictDeviceDetailController extends JeecgController<SurvDictDeviceDetail, SurvDictDeviceDetailService> {
|
||||||
|
@Autowired
|
||||||
|
private SurvDictDeviceDetailService fDictDeviceDetailService;
|
||||||
|
@Autowired
|
||||||
|
private SurvDictDeviceCateService dictDeviceCateService;
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "设备明细字典-分页列表查询")
|
||||||
|
@ApiOperation(value = "01. 分页查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<SurvDictDeviceDetail>> queryPageList(SurvDictDeviceDetail survDictDeviceDetail,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
if (StringUtils.isNotBlank(survDictDeviceDetail.getDeviceName())) {
|
||||||
|
survDictDeviceDetail.setDeviceName("*" + survDictDeviceDetail.getDeviceName() + "*");
|
||||||
|
}
|
||||||
|
QueryWrapper<SurvDictDeviceDetail> queryWrapper = QueryGenerator.initQueryWrapper(survDictDeviceDetail, req.getParameterMap());
|
||||||
|
Page<SurvDictDeviceDetail> page = new Page<SurvDictDeviceDetail>(pageNo, pageSize);
|
||||||
|
IPage<SurvDictDeviceDetail> pageList = fDictDeviceDetailService.page(page, queryWrapper);
|
||||||
|
if(!pageList.getRecords().isEmpty()){
|
||||||
|
List<String> cates = new ArrayList<>();
|
||||||
|
pageList.getRecords().forEach(item->cates.add(item.getCateId()));
|
||||||
|
Map<String, SurvDictDeviceCate> map = new HashMap<>();
|
||||||
|
List<SurvDictDeviceCate> cates1 = dictDeviceCateService.listByIds(cates);
|
||||||
|
if(!cates1.isEmpty()){
|
||||||
|
for (SurvDictDeviceCate survDictDeviceCate : cates1) {
|
||||||
|
map.put(survDictDeviceCate.getId(), survDictDeviceCate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SurvDictDeviceDetail record : pageList.getRecords()) {
|
||||||
|
SurvDictDeviceCate cate = map.get(record.getCateId());
|
||||||
|
record.setCateName(cate!=null?cate.getCateName():"其他");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "设备明细字典-添加")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@ApiOperation(value = "02. 添加", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody SurvDictDeviceDetail survDictDeviceDetail, HttpServletRequest request) {
|
||||||
|
SurvDictDeviceCate cate = dictDeviceCateService.getById(survDictDeviceDetail.getCateId());
|
||||||
|
Assert.notNull(cate, "无效的设备类型");
|
||||||
|
if (StringUtils.isNotBlank(cate.getParentId())) {
|
||||||
|
survDictDeviceDetail.setCateBigId(cate.getParentId());
|
||||||
|
}
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictDeviceDetail.setCreateBy(username);
|
||||||
|
survDictDeviceDetail.setCreateTime(new Date());
|
||||||
|
fDictDeviceDetailService.save(survDictDeviceDetail);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "设备明细字典-编辑")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@ApiOperation(value = "03. 编辑", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:edit")
|
||||||
|
@PostMapping(value = "/edit")
|
||||||
|
public Result<String> edit(@RequestBody SurvDictDeviceDetail survDictDeviceDetail, HttpServletRequest request) {
|
||||||
|
SurvDictDeviceCate cate = dictDeviceCateService.getById(survDictDeviceDetail.getCateId());
|
||||||
|
Assert.notNull(cate, "无效的设备类型");
|
||||||
|
if (StringUtils.isNotBlank(cate.getParentId())) {
|
||||||
|
survDictDeviceDetail.setCateBigId(cate.getParentId());
|
||||||
|
}
|
||||||
|
//创建、更新时间不能编辑
|
||||||
|
survDictDeviceDetail.setCreateTime(null);
|
||||||
|
survDictDeviceDetail.setUpdateTime(null);
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
survDictDeviceDetail.setUpdateBy(username);
|
||||||
|
fDictDeviceDetailService.updateById(survDictDeviceDetail);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "设备明细字典-通过id删除")
|
||||||
|
@ApiOperation(value = "04.通过id删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
fDictDeviceDetailService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AutoLog(value = "设备明细字典-批量删除")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@ApiOperation(value = "04. 批量删除", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.fDictDeviceDetailService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//@AutoLog(value = "设备明细字典-通过id查询")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@ApiOperation(value = "05. 通过id查询", notes = "")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<SurvDictDeviceDetail> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
SurvDictDeviceDetail survDictDeviceDetail = fDictDeviceDetailService.getById(id);
|
||||||
|
if (survDictDeviceDetail == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(survDictDeviceDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@ApiOperation(value = "06. 导出excel", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:exportXls")
|
||||||
|
@GetMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, SurvDictDeviceDetail survDictDeviceDetail) {
|
||||||
|
return super.exportXls(request, survDictDeviceDetail, SurvDictDeviceDetail.class, "设备明细字典");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperationSupport(order = 7)
|
||||||
|
@ApiOperation(value = "07. 导入excel", notes = "")
|
||||||
|
@RequiresPermissions("farm:f_dict_device_detail:importExcel")
|
||||||
|
@PostMapping(value = "/importExcel")
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, SurvDictDeviceDetail.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "08. 列表查询", notes = "")
|
||||||
|
@ApiOperationSupport(order = 8)
|
||||||
|
@GetMapping(value = "/getDeviceData")
|
||||||
|
public Result<List<SurvDictDeviceDetail>> getDeviceData(SurvDictDeviceDetail survDictDeviceDetail,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<SurvDictDeviceDetail> queryWrapper = QueryGenerator.initQueryWrapper(survDictDeviceDetail, req.getParameterMap());
|
||||||
|
List<SurvDictDeviceDetail> deviceList = fDictDeviceDetailService.list(queryWrapper);
|
||||||
|
return Result.OK(deviceList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.common.entity.SurvCityCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市编码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-06
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvCityCodeMapper extends BaseMapper<SurvCityCode> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.appmana.mapper;
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.jeecg.common.entity.SurvConfig;
|
import org.jeecg.common.entity.SurvConfig;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
|
@ -12,4 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
public interface SurvConfigMapper extends BaseMapper<SurvConfig> {
|
public interface SurvConfigMapper extends BaseMapper<SurvConfig> {
|
||||||
|
|
||||||
String getValueByKey(String key);
|
String getValueByKey(String key);
|
||||||
|
|
||||||
|
|
||||||
|
SurvConfig getOneByTypeWithTenant(@Param("tenantId") String tenantId, @Param("type") String type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.common.entity.SurvDictCity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市列表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-09-01
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictCityMapper extends BaseMapper<SurvDictCity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备种类字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictDeviceCateMapper extends BaseMapper<SurvDictDeviceCate> {
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
|
List<SurvDictDeviceCate> listAll(SurvDictDeviceCate survDictDeviceCate);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备明细字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictDeviceDetailMapper extends BaseMapper<SurvDictDeviceDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.common.entity.SurvDictEle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: f_iot_dict_ele
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictEleMapper extends BaseMapper<SurvDictEle> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvDictCityMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvCityCodeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -5,4 +5,11 @@
|
||||||
<select id="getValueByKey" resultType="java.lang.String">
|
<select id="getValueByKey" resultType="java.lang.String">
|
||||||
select CONFIG_VALUE from surv_config where CONFIG_KEY = #{key}
|
select CONFIG_VALUE from surv_config where CONFIG_KEY = #{key}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getOneByTypeWithTenant" resultType="org.jeecg.common.entity.SurvConfig">
|
||||||
|
select *
|
||||||
|
from surv_config
|
||||||
|
where CONFIG_TYPE = #{type}
|
||||||
|
AND TENANT_ID = #{tenantId} limit 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -32,6 +32,12 @@
|
||||||
<result property="mapIcon" column="MAP_ICON" jdbcType="VARCHAR"/>
|
<result property="mapIcon" column="MAP_ICON" jdbcType="VARCHAR"/>
|
||||||
<result property="deviceIotUrl" column="DEVICE_IOT_URL" jdbcType="VARCHAR"/>
|
<result property="deviceIotUrl" column="DEVICE_IOT_URL" jdbcType="VARCHAR"/>
|
||||||
<result property="deviceReverseIotUrl" column="DEVICE_REVERSE_IOT_URL" jdbcType="VARCHAR"/>
|
<result property="deviceReverseIotUrl" column="DEVICE_REVERSE_IOT_URL" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deviceLonglat" column="DEVICE_LONGLAT" jdbcType="VARCHAR"/>
|
||||||
|
<result property="protocolCode" column="PROTOCOL_CODE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="protocolType" column="PROTOCOL_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deployCate" column="DEPLOY_CATE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deploySecondaryType" column="DEPLOY_SECONDARY_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="cateId" column="CATE_ID" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="extMap" type="org.jeecg.common.entity.SurvDeviceDeploy" extends="baseResultMap">
|
<resultMap id="extMap" type="org.jeecg.common.entity.SurvDeviceDeploy" extends="baseResultMap">
|
||||||
|
|
@ -42,7 +48,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="basesql" >
|
<sql id="basesql" >
|
||||||
ID,DEPLOY_CODE,STATION_CODE,RUN_STATUS,POWER_STATUS,LASTSYNC_TIME,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC,DEVICE_URL,SORT_NO,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,DEPLOY_TYPE,DEVICE_LATITUDE,DEVICE_LONGITUDE,GROUP_ID,IZ_BAOJING,IP_ADDR,PORT,SEND_INFO,MAP_ICON,DEVICE_IOT_URL,DEVICE_REVERSE_IOT_URL
|
ID,DEPLOY_CODE,STATION_CODE,RUN_STATUS,POWER_STATUS,LASTSYNC_TIME,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC,DEVICE_URL,SORT_NO,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,DEPLOY_TYPE,DEVICE_LATITUDE,DEVICE_LONGITUDE,GROUP_ID,IZ_BAOJING,IP_ADDR,PORT,SEND_INFO,MAP_ICON,DEVICE_IOT_URL,DEVICE_REVERSE_IOT_URL,DEVICE_LONGLAT,PROTOCOL_CODE,PROTOCOL_TYPE,DEPLOY_CATE,DEPLOY_SECONDARY_TYPE,CATE_ID
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvDictDeviceCateMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.jeecg.common.entity.SurvDictDeviceCate" id="FDictDeviceCateMap">
|
||||||
|
<result property="id" column="ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="cateName" column="CATE_NAME" jdbcType="VARCHAR"/>
|
||||||
|
<result property="catePic" column="CATE_PIC" jdbcType="VARCHAR"/>
|
||||||
|
<result property="parentId" column="PARENT_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="cateRemark" column="CATE_REMARK" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deployCate" column="DEPLOY_CATE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deployType" column="DEPLOY_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deploySecondaryType" column="DEPLOY_SECONDARY_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="isEnable" column="IS_ENABLE" jdbcType="INTEGER"/>
|
||||||
|
<result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="reVision" column="RE_VISION" jdbcType="INTEGER"/>
|
||||||
|
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="isDel" column="IS_DEL" jdbcType="INTEGER"/>
|
||||||
|
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="listAll" resultMap="FDictDeviceCateMap">
|
||||||
|
select *
|
||||||
|
from surv_dict_device_cate
|
||||||
|
ORDER BY CONVERT(CATE_NAME USING gbk) ASC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvDictDeviceDetailMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.common.entity.SurvDictEle">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.jeecg.modules.appmana.o.vo.common;
|
||||||
|
|
||||||
|
import org.springframework.http.client.ClientHttpResponse;
|
||||||
|
import org.springframework.web.client.ResponseErrorHandler;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class CustomResponseErrorHandler implements ResponseErrorHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||||
|
// 返回false表示不将所有状态码都视为错误
|
||||||
|
int statusCode = response.getStatusCode().value();
|
||||||
|
//只在500级别的异常时才抛出
|
||||||
|
return statusCode >= 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleError(ClientHttpResponse response) {
|
||||||
|
// 可以在这里处理500错误,但不抛出异常
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.o.vo.common;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HttpResponseVo {
|
||||||
|
private boolean isOk;
|
||||||
|
private JSONObject data;
|
||||||
|
private JSONArray arrData;
|
||||||
|
private HttpHeaders responseHeaders;
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package org.jeecg.modules.appmana.service;
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
import org.jeecg.common.entity.SurvConfig;
|
import org.jeecg.common.entity.SurvConfig;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 业务参数配置表
|
* @Description: 业务参数配置表
|
||||||
|
|
@ -12,4 +14,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
public interface ISurvConfigService extends IService<SurvConfig> {
|
public interface ISurvConfigService extends IService<SurvConfig> {
|
||||||
|
|
||||||
String getValueByKey(String key);
|
String getValueByKey(String key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SurvConfig getOneByTypeWithTenant(String tenantId, String type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,10 @@ public interface ISurvDeviceDeployService extends IService<SurvDeviceDeploy> {
|
||||||
SurvDeviceDeploy getOneByCode(String deployCode);
|
SurvDeviceDeploy getOneByCode(String deployCode);
|
||||||
|
|
||||||
List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployType);
|
List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployType);
|
||||||
|
|
||||||
|
boolean initDevice(List<String> ids);
|
||||||
|
|
||||||
|
void saveDeploy(SurvDeviceDeploy survDeviceDeploy);
|
||||||
|
|
||||||
|
void updateDeploy(SurvDeviceDeploy survDeviceDeploy);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.entity.SurvCityCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市编码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-06
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvCityCodeService extends IService<SurvCityCode> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.entity.SurvDictCity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市列表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-09-01
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictCityService extends IService<SurvDictCity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备种类字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictDeviceCateService extends IService<SurvDictDeviceCate> {
|
||||||
|
|
||||||
|
List<SurvDictDeviceCate> listAll(SurvDictDeviceCate survDictDeviceCate);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备明细字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictDeviceDetailService extends IService<SurvDictDeviceDetail> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.entity.SurvDictEle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: f_iot_dict_ele
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SurvDictEleService extends IService<SurvDictEle> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.modules.appmana.service.impl;
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
import org.jeecg.common.entity.ScEquZhibiao;
|
import org.jeecg.common.entity.ScEquZhibiao;
|
||||||
|
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||||
import org.jeecg.modules.appmana.mapper.ScEquZhibiaoMapper;
|
import org.jeecg.modules.appmana.mapper.ScEquZhibiaoMapper;
|
||||||
import org.jeecg.modules.appmana.service.IScEquZhibiaoService;
|
import org.jeecg.modules.appmana.service.IScEquZhibiaoService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -27,4 +28,10 @@ public class ScEquZhibiaoServiceImpl extends ServiceImpl<ScEquZhibiaoMapper, ScE
|
||||||
public Integer getALlZhiBiaoCount() {
|
public Integer getALlZhiBiaoCount() {
|
||||||
return baseMapper.getALlZhiBiaoCount();
|
return baseMapper.getALlZhiBiaoCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearDevice(SurvDeviceDeploy deploy) {
|
||||||
|
lambdaUpdate()
|
||||||
|
.eq(ScEquZhibiao::getEquId, deploy.getId())
|
||||||
|
.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.entity.SurvCityCode;
|
||||||
|
import org.jeecg.modules.appmana.mapper.SurvCityCodeMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvCityCodeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市编码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-06
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvCityCodeServiceImpl extends ServiceImpl<SurvCityCodeMapper, SurvCityCode> implements SurvCityCodeService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package org.jeecg.modules.appmana.service.impl;
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
import org.jeecg.common.entity.SurvConfig;
|
import org.jeecg.common.entity.SurvConfig;
|
||||||
import org.jeecg.modules.appmana.mapper.SurvConfigMapper;
|
import org.jeecg.modules.appmana.mapper.SurvConfigMapper;
|
||||||
import org.jeecg.modules.appmana.service.ISurvConfigService;
|
import org.jeecg.modules.appmana.service.ISurvConfigService;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
@ -20,4 +23,13 @@ public class SurvConfigServiceImpl extends ServiceImpl<SurvConfigMapper, SurvCon
|
||||||
public String getValueByKey(String key) {
|
public String getValueByKey(String key) {
|
||||||
return baseMapper.getValueByKey(key);
|
return baseMapper.getValueByKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Cacheable(value = IotConstants.IOT_SURVCONFIG_CACHE, key = "#tenantId+':'+#type", unless = "#result == null ")
|
||||||
|
public SurvConfig getOneByTypeWithTenant(String tenantId, String type) {
|
||||||
|
if(StringUtils.isBlank(tenantId)){
|
||||||
|
tenantId = "0";
|
||||||
|
}
|
||||||
|
return baseMapper.getOneByTypeWithTenant(tenantId, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,36 @@
|
||||||
package org.jeecg.modules.appmana.service.impl;
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
|
import org.jeecg.common.constant.enums.DeviceDeployEnum;
|
||||||
|
import org.jeecg.common.entity.*;
|
||||||
|
import org.jeecg.common.constant.enums.IotManufacturerEnum;
|
||||||
|
import org.jeecg.common.iot.renke.DataItem;
|
||||||
|
import org.jeecg.common.iot.renke.RegisterItem;
|
||||||
|
import org.jeecg.common.iot.renke.RenkeDataRealTimeDetail;
|
||||||
|
import org.jeecg.common.iot.renke.RenkeDataRealTimePack;
|
||||||
|
import org.jeecg.common.iot.xph.XphDeviceQueryDataVo;
|
||||||
|
import org.jeecg.common.iot.xph.XphdeviceQueryDetailVo;
|
||||||
import org.jeecg.modules.appmana.mapper.SurvDeviceDeployMapper;
|
import org.jeecg.modules.appmana.mapper.SurvDeviceDeployMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.IScContExeService;
|
||||||
|
import org.jeecg.modules.appmana.service.IScContService;
|
||||||
import org.jeecg.modules.appmana.service.ISurvDeviceDeployService;
|
import org.jeecg.modules.appmana.service.ISurvDeviceDeployService;
|
||||||
|
import org.jeecg.modules.appmana.utils.SdrkUtils;
|
||||||
|
import org.jeecg.modules.appmana.utils.XphUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: surv_device_deploy
|
* @Description: surv_device_deploy
|
||||||
|
|
@ -18,8 +39,25 @@ import java.util.List;
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMapper, SurvDeviceDeploy> implements ISurvDeviceDeployService {
|
public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMapper, SurvDeviceDeploy> implements ISurvDeviceDeployService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScEquZhibiaoServiceImpl fScEquZhibiaoService;
|
||||||
|
@Autowired
|
||||||
|
private XphUtils xphUtils;
|
||||||
|
@Autowired
|
||||||
|
private SurvDictEleServiceImpl eleService;
|
||||||
|
@Autowired
|
||||||
|
private IScContService scContService;
|
||||||
|
@Autowired
|
||||||
|
private SurvDictDeviceCateServiceImpl dictDeviceCateService;
|
||||||
|
@Autowired
|
||||||
|
private SurvDictDictDeviceDetailServiceImpl detailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IScContExeService scContExeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<SurvDeviceDeploy> pages(IPage<SurvDeviceDeploy> page, SurvDeviceDeploy survDeviceDeploy) {
|
public IPage<SurvDeviceDeploy> pages(IPage<SurvDeviceDeploy> page, SurvDeviceDeploy survDeviceDeploy) {
|
||||||
return baseMapper.pages(page,survDeviceDeploy);
|
return baseMapper.pages(page,survDeviceDeploy);
|
||||||
|
|
@ -39,4 +77,317 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
||||||
public List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployType) {
|
public List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployType) {
|
||||||
return baseMapper.getDeviceListByStations(stationCode,deployType);
|
return baseMapper.getDeviceListByStations(stationCode,deployType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean initDevice(List<String> ids) {
|
||||||
|
boolean b =false;
|
||||||
|
if(ids!=null && !ids.isEmpty()){
|
||||||
|
List<SurvDeviceDeploy> deploys = listByIds(ids);
|
||||||
|
if(!deploys.isEmpty()){
|
||||||
|
for (SurvDeviceDeploy deploy : deploys) {
|
||||||
|
//删除旧的指标
|
||||||
|
fScEquZhibiaoService.clearDevice(deploy);
|
||||||
|
//重新初始化
|
||||||
|
b= initDeploy(deploy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveDeploy(SurvDeviceDeploy survDeviceDeploy) {
|
||||||
|
SurvDictDeviceCate dictDeviceCate = dictDeviceCateService.getById(survDeviceDeploy.getCateId());
|
||||||
|
Assert.notNull(dictDeviceCate, "无效的设备类型");
|
||||||
|
Assert.notEmpty(dictDeviceCate.getParentId(), "只能选择子项类型");
|
||||||
|
SurvDictDeviceDetail dictDeviceDetail = detailService.getById(survDeviceDeploy.getDeviceCode());
|
||||||
|
Assert.notNull(dictDeviceDetail, "无效的设备厂家");
|
||||||
|
//处理设备链接保存
|
||||||
|
if(StringUtils.isNotBlank(survDeviceDeploy.getXyId())&&survDeviceDeploy.getProtocolDetail()!=null){
|
||||||
|
|
||||||
|
ScCont contEnt = new ScCont();
|
||||||
|
contEnt.setEquId(survDeviceDeploy.getDeployCode());
|
||||||
|
contEnt.setXyId(survDeviceDeploy.getXyId());
|
||||||
|
contEnt.setCreateId(survDeviceDeploy.getCreatedBy());
|
||||||
|
contEnt.setCreateTime(new Date());
|
||||||
|
scContService.save(contEnt);
|
||||||
|
|
||||||
|
|
||||||
|
List<ScContExe> saveList = new ArrayList<>();
|
||||||
|
for (String key : survDeviceDeploy.getProtocolDetail().keySet()) {
|
||||||
|
ScContExe contExe = new ScContExe();
|
||||||
|
contExe.setCreateId(survDeviceDeploy.getCreatedBy());
|
||||||
|
contExe.setCreateTime(contEnt.getCreateTime());
|
||||||
|
contExe.setCode(key);
|
||||||
|
contExe.setValue(survDeviceDeploy.getProtocolDetail().getString(key));
|
||||||
|
contExe.setContId(contEnt.getId());
|
||||||
|
saveList.add(contExe);
|
||||||
|
}
|
||||||
|
if(saveList.size()>0) {
|
||||||
|
scContExeService.saveBatch(saveList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
survDeviceDeploy.setCreateTime(new Date());
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(survDeviceDeploy.getDeviceLonglat())) {
|
||||||
|
String[] ss = survDeviceDeploy.getDeviceLonglat().split(",");
|
||||||
|
survDeviceDeploy.setDeviceLongitude(ss[0]);
|
||||||
|
survDeviceDeploy.setDeviceLatitude(ss[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(survDeviceDeploy.getDeployPic())){
|
||||||
|
survDeviceDeploy.setDeployPic(dictDeviceDetail.getDefaultDeployPic());
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(survDeviceDeploy.getMapIcon())){
|
||||||
|
survDeviceDeploy.setMapIcon(dictDeviceDetail.getDefaultMapIcon());
|
||||||
|
}
|
||||||
|
|
||||||
|
survDeviceDeploy.setDeployType(dictDeviceCate.getDeployType());
|
||||||
|
survDeviceDeploy.setDeploySecondaryType(dictDeviceCate.getDeploySecondaryType());
|
||||||
|
survDeviceDeploy.setDeployCate(dictDeviceCate.getDeployCate());
|
||||||
|
survDeviceDeploy.setProtocolCode(dictDeviceDetail.getDeviceProtocol());
|
||||||
|
survDeviceDeploy.setProtocolType(dictDeviceDetail.getProtocolType());
|
||||||
|
|
||||||
|
save(survDeviceDeploy);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeploy(SurvDeviceDeploy survDeviceDeploy) {
|
||||||
|
SurvDictDeviceCate dictDeviceCate = dictDeviceCateService.getById(survDeviceDeploy.getCateId());
|
||||||
|
Assert.notNull(dictDeviceCate, "无效的设备类型");
|
||||||
|
Assert.notEmpty(dictDeviceCate.getParentId(), "只能选择子项类型");
|
||||||
|
SurvDictDeviceDetail dictDeviceDetail = detailService.getById(survDeviceDeploy.getDeviceCode());
|
||||||
|
Assert.notNull(dictDeviceDetail, "无效的设备厂家");
|
||||||
|
//处理设备连接修改
|
||||||
|
if(StringUtils.isNotBlank(survDeviceDeploy.getXyId())&&survDeviceDeploy.getProtocolDetail()!=null){
|
||||||
|
//step 1:删除现有的协议
|
||||||
|
List<ScCont> contList = scContService.list(Wrappers.<ScCont>lambdaQuery().eq(ScCont::getEquId,survDeviceDeploy.getDeployCode()));
|
||||||
|
if(contList.size()>0){
|
||||||
|
scContService.removeById(contList.get(0).getId());
|
||||||
|
scContExeService.remove(Wrappers.<ScContExe>lambdaQuery().eq(ScContExe::getContId,contList.get(0).getId()));
|
||||||
|
}
|
||||||
|
//step 2:重新建立连接
|
||||||
|
|
||||||
|
|
||||||
|
ScCont contEnt = new ScCont();
|
||||||
|
contEnt.setEquId(survDeviceDeploy.getDeployCode());
|
||||||
|
contEnt.setXyId(survDeviceDeploy.getXyId());
|
||||||
|
contEnt.setCreateId(survDeviceDeploy.getCreatedBy());
|
||||||
|
contEnt.setCreateTime(new Date());
|
||||||
|
scContService.save(contEnt);
|
||||||
|
|
||||||
|
|
||||||
|
List<ScContExe> saveList = new ArrayList<>();
|
||||||
|
for (String key : survDeviceDeploy.getProtocolDetail().keySet()) {
|
||||||
|
ScContExe contExe = new ScContExe();
|
||||||
|
contExe.setCreateId(survDeviceDeploy.getCreatedBy());
|
||||||
|
contExe.setCreateTime(contEnt.getCreateTime());
|
||||||
|
contExe.setCode(key);
|
||||||
|
contExe.setValue(survDeviceDeploy.getProtocolDetail().getString(key));
|
||||||
|
contExe.setContId(contEnt.getId());
|
||||||
|
saveList.add(contExe);
|
||||||
|
}
|
||||||
|
if(saveList.size()>0) {
|
||||||
|
scContExeService.saveBatch(saveList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
survDeviceDeploy.setCreateTime(null);
|
||||||
|
survDeviceDeploy.setUpdatedTime(null);
|
||||||
|
|
||||||
|
|
||||||
|
//假如有水设备操作
|
||||||
|
// if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())&&StringUtils.isNotBlank(survDeviceDeploy.getValveStatus1())){
|
||||||
|
// String deployCodeNum = survDeviceDeploy.getDeployCode().substring(CommonConstant.XZP_WATER.length());//xzp-water-01获取到01
|
||||||
|
// StringBuilder sbuilder = new StringBuilder("AA");
|
||||||
|
// sbuilder.append(deployCodeNum).append("080101").append(survDeviceDeploy.getValveStatus1()).append("0055");
|
||||||
|
// survDeviceDeploy.setSendInfo(sbuilder.toString());
|
||||||
|
// log.warn("操作水设备"+survDeviceDeploy.getDeployCode()+",指令:"+sbuilder.toString());
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(survDeviceDeploy.getDeviceLonglat())) {
|
||||||
|
String[] ss = survDeviceDeploy.getDeviceLonglat().split(",");
|
||||||
|
survDeviceDeploy.setDeviceLongitude(ss[0]);
|
||||||
|
survDeviceDeploy.setDeviceLatitude(ss[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(survDeviceDeploy.getDeployPic())){
|
||||||
|
survDeviceDeploy.setDeployPic(dictDeviceDetail.getDefaultDeployPic());
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(survDeviceDeploy.getMapIcon())){
|
||||||
|
survDeviceDeploy.setMapIcon(dictDeviceDetail.getDefaultMapIcon());
|
||||||
|
}
|
||||||
|
|
||||||
|
survDeviceDeploy.setDeployType(dictDeviceCate.getDeployType());
|
||||||
|
survDeviceDeploy.setDeploySecondaryType(dictDeviceCate.getDeploySecondaryType());
|
||||||
|
survDeviceDeploy.setDeployCate(dictDeviceCate.getDeployCate());
|
||||||
|
survDeviceDeploy.setProtocolCode(dictDeviceDetail.getDeviceProtocol());
|
||||||
|
survDeviceDeploy.setProtocolType(dictDeviceDetail.getProtocolType());
|
||||||
|
|
||||||
|
updateById(survDeviceDeploy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean initDeploy(SurvDeviceDeploy deploy) {
|
||||||
|
boolean result = false;
|
||||||
|
if(deploy!=null){
|
||||||
|
switch (deploy.getProtocolCode()){
|
||||||
|
case IotConstants.xph_v1:
|
||||||
|
case IotConstants.xph_v2:
|
||||||
|
result = initXph(deploy);
|
||||||
|
break;
|
||||||
|
case IotConstants.renke_standard:
|
||||||
|
result = initRenke(deploy);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠初始化逻辑
|
||||||
|
* @param deploy
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean initXph(SurvDeviceDeploy deploy){
|
||||||
|
if(DeviceDeployEnum.SURV_AIR.getType().equals(deploy.getDeployType()) || DeviceDeployEnum.SURV_SOIL.getType().equals(deploy.getDeployType())){//处理空气 土壤设备
|
||||||
|
//拉取最新的设备数据,遍历处理监测项
|
||||||
|
XphDeviceQueryDataVo xphDeviceQueryDataVo = xphUtils.getV1DeviceNewestData(deploy);
|
||||||
|
if(xphDeviceQueryDataVo!=null){
|
||||||
|
if(xphDeviceQueryDataVo.getEntity()!=null && !xphDeviceQueryDataVo.getEntity().isEmpty()){
|
||||||
|
List<ScEquZhibiao> saveList = new ArrayList<>();
|
||||||
|
int sorts = 1;
|
||||||
|
for (XphdeviceQueryDetailVo xphdeviceQueryDetailVo : xphDeviceQueryDataVo.getEntity()) {
|
||||||
|
SurvDictEle fIotDictEle = eleService.getDictByIndex(xphdeviceQueryDetailVo.getPid(),IotManufacturerEnum.XPH.getCode());
|
||||||
|
if(fIotDictEle!=null){
|
||||||
|
if(deploy.getDeployType()!=null && deploy.getDeployType().equals(fIotDictEle.getEleType())) {
|
||||||
|
if (fIotDictEle.getColumnName() != null) {
|
||||||
|
String numberStr = getStringNum(xphdeviceQueryDetailVo.getEName());
|
||||||
|
ScEquZhibiao fScEquZhibiao = new ScEquZhibiao();
|
||||||
|
String entityName = fIotDictEle.getColumnName();
|
||||||
|
if (!xphdeviceQueryDetailVo.getEName().contains(".") && StringUtils.isNotBlank(numberStr)) {//不包含点,如如pm2.5 包含有数字,则去对应
|
||||||
|
int numbers = Integer.parseInt(numberStr);
|
||||||
|
if (numbers > 1 && numbers <= 4) {//不超过4,因为字段只预留了4个
|
||||||
|
entityName = entityName + numbers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fScEquZhibiao.setCreateId("自动");
|
||||||
|
fScEquZhibiao.setEquId(deploy.getId());
|
||||||
|
fScEquZhibiao.setCode(xphdeviceQueryDetailVo.getEKey());
|
||||||
|
fScEquZhibiao.setName(xphdeviceQueryDetailVo.getEName());
|
||||||
|
fScEquZhibiao.setEntityField(entityName);
|
||||||
|
fScEquZhibiao.setValLow(null);
|
||||||
|
fScEquZhibiao.setValHeight(null);
|
||||||
|
fScEquZhibiao.setNuit(xphdeviceQueryDetailVo.getEUnit());
|
||||||
|
fScEquZhibiao.setChemicalName(null);
|
||||||
|
fScEquZhibiao.setZhibiaoType("1");//1=显示,0隐藏
|
||||||
|
fScEquZhibiao.setSortNo(sorts);
|
||||||
|
fScEquZhibiao.setEleKey(xphdeviceQueryDetailVo.getPid());
|
||||||
|
saveList.add(fScEquZhibiao);
|
||||||
|
sorts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log.error("新普惠自动设备配置未能匹配监测项:{}-{}",xphdeviceQueryDetailVo.getPid(),xphdeviceQueryDetailVo.getEName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
log.warn("新普惠自动初始化设备:{}=====>{}条:",deploy.getDeployDes(),saveList.size());
|
||||||
|
if(!saveList.isEmpty()){
|
||||||
|
boolean b = fScEquZhibiaoService.saveBatch(saveList);
|
||||||
|
log.warn("保存入库--------{}",b);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科设备初始化
|
||||||
|
*/
|
||||||
|
private boolean initRenke(SurvDeviceDeploy deploy) {
|
||||||
|
List<ScEquZhibiao> saveList = new ArrayList<>();
|
||||||
|
int sorts = 1;
|
||||||
|
if(DeviceDeployEnum.SURV_AIR.getType().equals(deploy.getDeployType()) || DeviceDeployEnum.SURV_SOIL.getType().equals(deploy.getDeployType())){
|
||||||
|
RenkeDataRealTimePack renkeDataRealTimePack = SdrkUtils.getDeviceData(deploy);
|
||||||
|
if(renkeDataRealTimePack!=null){
|
||||||
|
if(renkeDataRealTimePack.getData()!=null){
|
||||||
|
for (RenkeDataRealTimeDetail datum : renkeDataRealTimePack.getData()) {
|
||||||
|
if(datum.getDataItem()!=null){
|
||||||
|
if(!datum.getDataItem().isEmpty()){
|
||||||
|
for (DataItem dataItem : datum.getDataItem()) {
|
||||||
|
if(dataItem.getRegisterItem()!=null && !dataItem.getRegisterItem().isEmpty()){
|
||||||
|
for (RegisterItem registerItem : dataItem.getRegisterItem()) {
|
||||||
|
SurvDictEle fIotDictEle = eleService.getDictByIndex(registerItem.getRegisterName(), IotManufacturerEnum.RenKe.getCode());
|
||||||
|
if(fIotDictEle!=null){
|
||||||
|
if(deploy.getDeployType()!=null && deploy.getDeployType().equals(fIotDictEle.getEleType())) {
|
||||||
|
if (fIotDictEle.getColumnName() != null) {
|
||||||
|
String numberStr = getStringNum(registerItem.getRegisterName());
|
||||||
|
ScEquZhibiao fScEquZhibiao = new ScEquZhibiao();
|
||||||
|
String entityName = fIotDictEle.getColumnName();
|
||||||
|
if (!registerItem.getRegisterName().contains(".") && StringUtils.isNotBlank(numberStr)) {//不包含点,如如pm2.5 包含有数字,则去对应
|
||||||
|
int numbers = Integer.parseInt(numberStr);
|
||||||
|
if (numbers > 1 && numbers <= 4) {//不超过4,因为字段只预留了4个
|
||||||
|
entityName = entityName + numbers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fScEquZhibiao.setCreateId("自动");
|
||||||
|
fScEquZhibiao.setEquId(deploy.getId());
|
||||||
|
fScEquZhibiao.setCode(registerItem.getRegisterName());//因仁科设备没有字典值字段,所以用中文
|
||||||
|
fScEquZhibiao.setName(registerItem.getRegisterName());
|
||||||
|
fScEquZhibiao.setEntityField(entityName);
|
||||||
|
fScEquZhibiao.setValLow(null);
|
||||||
|
fScEquZhibiao.setValHeight(null);
|
||||||
|
fScEquZhibiao.setNuit(registerItem.getUnit());
|
||||||
|
fScEquZhibiao.setChemicalName(null);
|
||||||
|
fScEquZhibiao.setZhibiaoType("1");//1=显示,0隐藏
|
||||||
|
fScEquZhibiao.setSortNo(sorts);
|
||||||
|
fScEquZhibiao.setEleKey(fIotDictEle.getTransKey());
|
||||||
|
saveList.add(fScEquZhibiao);
|
||||||
|
sorts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log.error("仁科自动设备配置未能匹配监测项:{}",registerItem.getRegisterName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.warn("仁科自动初始化设备:{}=====>{}条:",deploy.getDeployDes(),saveList.size());
|
||||||
|
if(!saveList.isEmpty()){
|
||||||
|
boolean b = fScEquZhibiaoService.saveBatch(saveList);
|
||||||
|
log.warn("仁科保存入库--------{}",b);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取数字
|
||||||
|
*/
|
||||||
|
private String getStringNum(String input){
|
||||||
|
String pattern = "\\d+(\\.\\d+)?";
|
||||||
|
|
||||||
|
Pattern p = Pattern.compile(pattern);
|
||||||
|
Matcher m = p.matcher(input);
|
||||||
|
String matchStr = "";
|
||||||
|
while (m.find()) {
|
||||||
|
matchStr = m.group();
|
||||||
|
}
|
||||||
|
return matchStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.entity.SurvDictCity;
|
||||||
|
import org.jeecg.modules.appmana.mapper.SurvDictCityMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictCityService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市列表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-09-01
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvDictCityServiceImpl extends ServiceImpl<SurvDictCityMapper, SurvDictCity> implements SurvDictCityService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
import org.jeecg.modules.appmana.mapper.SurvDictDeviceCateMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictDeviceCateService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备种类字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvDictDeviceCateServiceImpl extends ServiceImpl<SurvDictDeviceCateMapper, SurvDictDeviceCate> implements SurvDictDeviceCateService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SurvDictDeviceCate> listAll(SurvDictDeviceCate survDictDeviceCate) {
|
||||||
|
List<SurvDictDeviceCate> list = baseMapper.listAll(survDictDeviceCate);
|
||||||
|
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
List<String> cates = new ArrayList<>();
|
||||||
|
list.forEach(item->cates.add(item.getParentId()));
|
||||||
|
Map<String, SurvDictDeviceCate> map = new HashMap<>();
|
||||||
|
List<SurvDictDeviceCate> cates1 = listByIds(cates);
|
||||||
|
if(!cates1.isEmpty()){
|
||||||
|
for (SurvDictDeviceCate cate : cates1) {
|
||||||
|
map.put(cate.getId(),cate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SurvDictDeviceCate record : list) {
|
||||||
|
SurvDictDeviceCate cate = map.get(record.getId());
|
||||||
|
record.setParentName(cate!=null?cate.getCateName():"其他");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceDetail;
|
||||||
|
import org.jeecg.modules.appmana.mapper.SurvDictDeviceDetailMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictDeviceDetailService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备明细字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvDictDictDeviceDetailServiceImpl extends ServiceImpl<SurvDictDeviceDetailMapper, SurvDictDeviceDetail> implements SurvDictDeviceDetailService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
|
import org.jeecg.common.entity.SurvDictEle;
|
||||||
|
import org.jeecg.modules.appmana.mapper.SurvDictEleMapper;
|
||||||
|
import org.jeecg.modules.appmana.service.SurvDictEleService;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: f_iot_dict_ele
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-26
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SurvDictEleServiceImpl extends ServiceImpl<SurvDictEleMapper, SurvDictEle> implements SurvDictEleService {
|
||||||
|
@Cacheable(value = IotConstants.iot_ele_cache, key = "#maCode+':'+#eNum", unless = "#result == null ")
|
||||||
|
public SurvDictEle getDictByIndex(String eNum, String maCode) {
|
||||||
|
SurvDictEle survDictEle = lambdaQuery()
|
||||||
|
.eq(SurvDictEle::getTransKey, eNum)
|
||||||
|
.eq(SurvDictEle::getMaCode, maCode)
|
||||||
|
.last("limit 1").one();
|
||||||
|
return survDictEle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,482 @@
|
||||||
|
package org.jeecg.modules.appmana.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.jeecg.modules.appmana.o.vo.common.CustomResponseErrorHandler;
|
||||||
|
import org.jeecg.modules.appmana.o.vo.common.HttpResponseVo;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class HttpRequestUtils {
|
||||||
|
|
||||||
|
|
||||||
|
public static String fetchPage(String url) throws Exception {
|
||||||
|
// 创建 URL 对象
|
||||||
|
URL targetUrl = new URL(url);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) targetUrl.openConnection();
|
||||||
|
|
||||||
|
// 设置请求方法
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
|
||||||
|
// 获取响应代码
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) { // 200
|
||||||
|
// 读取响应内容
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
|
String inputLine;
|
||||||
|
StringBuilder response = new StringBuilder();
|
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
response.append(inputLine);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
// 返回页面内容
|
||||||
|
return response.toString();
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Failed to fetch page. Response code: " + responseCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常规的post请求,可自由传入Header 和 参数,headerMap 和 requestMap都可为空
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo postRequest(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
if (requestMap != null) {
|
||||||
|
for (String s : requestMap.keySet()) {
|
||||||
|
param.put(s, requestMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(param, headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity(url, httpEntity, JSONObject.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常规的post请求,可自由传入Header 和 参数,headerMap 和 requestMap都可为空
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo postArrRequest(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
if (requestMap != null) {
|
||||||
|
for (String s : requestMap.keySet()) {
|
||||||
|
param.put(s, requestMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(param, headers);
|
||||||
|
ResponseEntity<JSONArray> responseEntity = restTemplate.postForEntity(url, httpEntity, JSONArray.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setArrData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回结果为body的String格式,未使用封装
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String postStringRequest(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
if (requestMap != null) {
|
||||||
|
for (String s : requestMap.keySet()) {
|
||||||
|
param.put(s, requestMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(param, headers);
|
||||||
|
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
return responseEntity.getBody();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回结果为body的泛型,未使用封装
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> postListRequest(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
if (requestMap != null) {
|
||||||
|
for (String s : requestMap.keySet()) {
|
||||||
|
param.put(s, requestMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(param, headers);
|
||||||
|
ResponseEntity<List> responseEntity = restTemplate.postForEntity(url, httpEntity, List.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
return responseEntity.getBody();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get风格的Post请求,参数拼接在url后面,如www.baidu.com?a=b&c=d
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo postWithGetStyleRequest(String url, JSONObject requestMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
// MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
||||||
|
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
|
||||||
|
HttpEntity<JSONObject> httpEntity = new HttpEntity<JSONObject>(requestMap, headers);
|
||||||
|
url = url + "?";
|
||||||
|
for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
url = url + key + "=" + value + "&";
|
||||||
|
}
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity(url, httpEntity, JSONObject.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义的post请求,可接收MultiValueMap 类型
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo CustomPostRequest(String url, MultiValueMap<String, Object> requestMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
|
||||||
|
headers.setContentType(type);
|
||||||
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(requestMap, headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity(url, httpEntity, JSONObject.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通的Get请求,参数传入Map
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param paramMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo getRequest(String url, Map<String, Object> paramMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.getForEntity(url, JSONObject.class, paramMap);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特殊的Gzip的Get请求,应对某些接口需要的Gzip情况,否则会报错
|
||||||
|
* 参数需要直接拼接好放入url中, 否则会出现接口不识别参数的情况
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo getGzipRequest(String url, Map<String, String> headerMap) {
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
try {
|
||||||
|
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(HttpClients.createDefault());
|
||||||
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
|
||||||
|
if (headerMap != null) {
|
||||||
|
restTemplate.setInterceptors(Collections.singletonList((request, body, execution) -> {
|
||||||
|
HttpHeaders headers = request.getHeaders();
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.set(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
return execution.execute(request, body);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.getForEntity(url, JSONObject.class);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get 请求,可自由传入Header,headerMap、requestMap 可为空不穿
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo getExchange(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestMap == null) {
|
||||||
|
requestMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
HttpEntity httpEntity = new HttpEntity<>(headers);
|
||||||
|
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class, requestMap);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
} else {
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get 请求,可自由传入Header,headerMap、requestMap 可为空不穿
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HttpResponseVo getArrExchange(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestMap == null) {
|
||||||
|
requestMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
HttpEntity httpEntity = new HttpEntity<>(headers);
|
||||||
|
ResponseEntity<JSONArray> responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONArray.class, requestMap);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
if (statusCode == HttpStatus.OK) {
|
||||||
|
httpResponseVo.setOk(true);
|
||||||
|
httpResponseVo.setArrData(responseEntity.getBody());
|
||||||
|
httpResponseVo.setResponseHeaders(headers1);
|
||||||
|
return httpResponseVo;
|
||||||
|
} else {
|
||||||
|
httpResponseVo.setOk(false);
|
||||||
|
return httpResponseVo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get 请求,可自由传入Header,headerMap、requestMap 可为空不穿
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param requestMap
|
||||||
|
* @param headerMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static byte[] getExchangeImg(String url, Map<String, Object> requestMap, Map<String, String> headerMap) {
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
HttpResponseVo httpResponseVo = new HttpResponseVo();
|
||||||
|
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
|
||||||
|
if (headerMap != null) {
|
||||||
|
for (String s : headerMap.keySet()) {
|
||||||
|
headers.add(s, headerMap.get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestMap == null) {
|
||||||
|
requestMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
HttpEntity httpEntity = new HttpEntity<>(headers);
|
||||||
|
ResponseEntity<byte[]> responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, byte[].class, requestMap);
|
||||||
|
HttpStatus statusCode = responseEntity.getStatusCode(); //状态码
|
||||||
|
HttpHeaders headers1 = responseEntity.getHeaders();//获取到头信息
|
||||||
|
return responseEntity.getBody();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
package org.jeecg.modules.appmana.utils;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
|
import org.jeecg.common.entity.SurvConfig;
|
||||||
|
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||||
|
import org.jeecg.common.iot.renke.RenkeDataRealTimePack;
|
||||||
|
import org.jeecg.common.util.CommonToolUtils;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.common.vo.iot.common.VOIotAccess;
|
||||||
|
import org.jeecg.modules.appmana.o.vo.common.HttpResponseVo;
|
||||||
|
import org.jeecg.modules.appmana.service.IScEquZhibiaoService;
|
||||||
|
import org.jeecg.modules.appmana.service.ISurvConfigService;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 山东仁科工具类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class SdrkUtils {
|
||||||
|
//redis token目录
|
||||||
|
private static String token_key = "tool_token:token:";
|
||||||
|
//redis token过期目录
|
||||||
|
private static String token_expire = "tool_token:expire:";
|
||||||
|
static RedisTemplate redisTemplate = SpringContextUtils.getBean(StringRedisTemplate.class);
|
||||||
|
static ISurvConfigService configService = SpringContextUtils.getBean(ISurvConfigService.class);
|
||||||
|
static IScEquZhibiaoService scEquZhibiaoService = SpringContextUtils.getBean(IScEquZhibiaoService.class);
|
||||||
|
|
||||||
|
private static String domain = "http://www.0531yun.com";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取 token
|
||||||
|
* @param clientId 应用appKey,
|
||||||
|
* @param appSecret 应用appSecret,
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getToken(String clientId, String appSecret){
|
||||||
|
String getTokenPath = domain+"/api/getToken?loginName={loginName}&password={password}";
|
||||||
|
//检查缓存中是否有token
|
||||||
|
String token = getAppToken(IotConstants.APPLICATION_RenKe,clientId);
|
||||||
|
if(StringUtils.isNotBlank(token)){
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
//缓存中没有token的逻辑
|
||||||
|
log.error("{}:缓存失效重新获取仁科Token",clientId);
|
||||||
|
Map<String,String> headerMap = new HashMap<>();
|
||||||
|
Map<String,Object> requestMap = new HashMap<>();
|
||||||
|
requestMap.put("loginName",clientId);
|
||||||
|
requestMap.put("password",appSecret);
|
||||||
|
HttpResponseVo httpClient = HttpRequestUtils.getExchange(getTokenPath,requestMap,headerMap);
|
||||||
|
if(httpClient.isOk()){
|
||||||
|
JSONObject resposeJson = httpClient.getData();
|
||||||
|
JSONObject results = resposeJson.getJSONObject("data");
|
||||||
|
if(results!=null){
|
||||||
|
String renkeToken = results.getString("token");
|
||||||
|
if(StringUtils.isNotBlank(renkeToken)){//正常获取到token,返回并刷新缓存
|
||||||
|
String newToken = renkeToken;
|
||||||
|
Long expTime = results.getLong("expiration");
|
||||||
|
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String newExpireTime =sdf.format(LocalDateTime.now().plusSeconds(expTime));
|
||||||
|
setAppToken(IotConstants.APPLICATION_RenKe,clientId,newToken,newExpireTime);
|
||||||
|
return renkeToken;
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("仁科token获取失败:"+resposeJson.get("msg"));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("仁科token-fatal1");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("仁科token-fatal2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type token的类型,比如想要保存百度的token,即为baidu
|
||||||
|
* @param appkey 应用appKey,
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getAppToken(String type, String appkey){
|
||||||
|
String appType = ":"+type+":";
|
||||||
|
String curRedisKey = token_key + appkey + appType ;
|
||||||
|
String curRedisExpireKey =token_expire + appkey +appType;
|
||||||
|
//检查缓存中是否有token
|
||||||
|
if (Boolean.TRUE.equals(redisTemplate.hasKey(curRedisKey))) {
|
||||||
|
String token = CommonToolUtils.getString(redisTemplate.opsForValue().get(curRedisKey),"");
|
||||||
|
String expires = CommonToolUtils.getString(redisTemplate.opsForValue().get(curRedisExpireKey),"");
|
||||||
|
if(StringUtils.isNotBlank(token)&&StringUtils.isNotBlank(expires)){
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
LocalDateTime expireTime = LocalDateTime.parse(expires, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
Long curStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();//国内时区的时间戳
|
||||||
|
boolean b = nowTime.compareTo(expireTime)<0;
|
||||||
|
if(b){//未过期
|
||||||
|
log.warn("{}:找到仁科有效的缓存,直接返回Token",type);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type token的类型,比如想要保存百度的token,即为baidu
|
||||||
|
* @param appkey 应用appKey,
|
||||||
|
* @param token 应用Token
|
||||||
|
* @param expireTime token过期时间,需要毫秒时间戳
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean setAppToken(String type, String appkey, String token, String expireTime){
|
||||||
|
if(StringUtils.isBlank(type) || StringUtils.isBlank(appkey) || StringUtils.isBlank(token) || StringUtils.isBlank(expireTime)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String appType = ":"+type+":";
|
||||||
|
String curRedisKey = token_key + appkey + appType;
|
||||||
|
String curRedisExpireKey =token_expire + appkey + appType;
|
||||||
|
redisTemplate.opsForValue().set(curRedisKey, token);
|
||||||
|
redisTemplate.opsForValue().set(curRedisExpireKey, expireTime);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VOIotAccess getAccess(SurvDeviceDeploy deploy){
|
||||||
|
VOIotAccess voIotAccess = null;
|
||||||
|
//优先使用设备配置的密钥
|
||||||
|
SurvConfig survConfig = null;
|
||||||
|
// if(StringUtils.isNotBlank(deploy.getSurvConfigId())){
|
||||||
|
// survConfig = configService.getConfigById(deploy.getSurvConfigId());
|
||||||
|
// }else{
|
||||||
|
survConfig = configService.getOneByTypeWithTenant(deploy.getTenantId(), IotConstants.renke_access);
|
||||||
|
// }
|
||||||
|
if(survConfig!=null){
|
||||||
|
voIotAccess = new VOIotAccess();
|
||||||
|
voIotAccess.setAppSecret(survConfig.getConfigValue());
|
||||||
|
voIotAccess.setAppId(survConfig.getConfigKey());
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return voIotAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RenkeDataRealTimePack getDeviceData(SurvDeviceDeploy deploy){
|
||||||
|
VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
if(voIotAccess==null){
|
||||||
|
log.warn("=========设备:{},仁科密钥未配置========",deploy.getId());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = getToken(voIotAccess.getAppId(),voIotAccess.getAppSecret());
|
||||||
|
String url = domain + "/api/data/getRealTimeDataByDeviceAddr?deviceAddrs={deviceAddrs}";
|
||||||
|
Map<String,String> headerMap = new HashMap<>();
|
||||||
|
headerMap.put("authorization",token);
|
||||||
|
Map<String,Object> requestMap = new HashMap<>();
|
||||||
|
requestMap.put("deviceAddrs",deploy.getDeployCode());
|
||||||
|
HttpResponseVo result = HttpRequestUtils.getExchange(url,requestMap,headerMap);
|
||||||
|
log.warn("===============实时数据返回:{}===========",result);
|
||||||
|
if(result !=null) {
|
||||||
|
RenkeDataRealTimePack renkeDataRealTimePack = JSONUtil.toBean(JSONUtil.toJsonStr(result.getData()), RenkeDataRealTimePack.class);
|
||||||
|
return renkeDataRealTimePack;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,301 @@
|
||||||
|
package org.jeecg.modules.appmana.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jeecg.common.constant.IotConstants;
|
||||||
|
import org.jeecg.common.entity.SurvConfig;
|
||||||
|
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||||
|
import org.jeecg.common.iot.xph.*;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.common.vo.iot.common.VOIotAccess;
|
||||||
|
import org.jeecg.modules.appmana.o.vo.common.HttpResponseVo;
|
||||||
|
import org.jeecg.modules.appmana.service.impl.SurvConfigServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class XphUtils {
|
||||||
|
|
||||||
|
//redis token目录
|
||||||
|
private String token_key = "tool_token:token:";
|
||||||
|
//redis token过期目录
|
||||||
|
private String token_expire = "tool_token:expire:";
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private SurvConfigServiceImpl configService;
|
||||||
|
|
||||||
|
private static Map<String, VOIotAccess> tokenMap;
|
||||||
|
private String domain = "https://iot.whxph.com:44300/XPHapiv2";
|
||||||
|
private String v1domain = "http://47.105.215.208:8005/";
|
||||||
|
/**
|
||||||
|
* 获取 新普惠token
|
||||||
|
*
|
||||||
|
* @param appkey 应用appKey,
|
||||||
|
* @param appSecret 应用appSecret,
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getXphToken(String appkey, String appSecret) {
|
||||||
|
String url = domain + "/login";
|
||||||
|
//检查缓存中是否有token
|
||||||
|
String token = getAppToken(IotConstants.APPLICATION_XinPH, appkey);
|
||||||
|
if (StringUtils.isNotBlank(token)) {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
//缓存中没有token的逻辑
|
||||||
|
log.error("{}:缓存失效重新获取Token", appkey);
|
||||||
|
Map<String, Object> job = new HashMap<>();
|
||||||
|
job.put("username", appkey);
|
||||||
|
job.put("password", appSecret);
|
||||||
|
JSONObject resposeJson = HttpRequestUtils.postRequest(url, job, null).getData();
|
||||||
|
String xphToken = resposeJson.getString("token");
|
||||||
|
if (StringUtils.isNotBlank(xphToken)) {//正常获取到token,返回并刷新缓存
|
||||||
|
String newToken = resposeJson.getString("token");
|
||||||
|
Long expTime = resposeJson.getLong("expiration");
|
||||||
|
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String newExpireTime = sdf.format(LocalDateTime.now().plusSeconds(expTime));
|
||||||
|
setAppToken(IotConstants.APPLICATION_XinPH, appkey, newToken, newExpireTime);
|
||||||
|
return xphToken;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("token获取失败:" + resposeJson.getString("msg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type token的类型,比如想要保存百度的token,即为baidu
|
||||||
|
* @param appkey 应用appKey,
|
||||||
|
* @param token 应用Token
|
||||||
|
* @param expireTime token过期时间,需要毫秒时间戳
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean setAppToken(String type, String appkey, String token, String expireTime) {
|
||||||
|
if (StringUtils.isBlank(type) || StringUtils.isBlank(appkey) || StringUtils.isBlank(token) || StringUtils.isBlank(expireTime)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String appType = type + ":";
|
||||||
|
String curRedisKey = token_key + appkey + appType;
|
||||||
|
String curRedisExpireKey = token_expire + appkey + appType;
|
||||||
|
redisTemplate.opsForValue().set(curRedisKey, token);
|
||||||
|
redisTemplate.opsForValue().set(curRedisExpireKey, expireTime);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type token的类型,比如想要保存百度的token,即为baidu
|
||||||
|
* @param appkey 应用appKey,
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getAppToken(String type, String appkey) {
|
||||||
|
String appType = type + ":";
|
||||||
|
String curRedisKey = token_key + appkey + appType;
|
||||||
|
String curRedisExpireKey = token_expire + appkey + appType;
|
||||||
|
//检查缓存中是否有token
|
||||||
|
if (Boolean.TRUE.equals(redisTemplate.hasKey(curRedisKey))) {
|
||||||
|
String token = oConvertUtils.getString(redisTemplate.opsForValue().get(curRedisKey), "");
|
||||||
|
String expires = oConvertUtils.getString(redisTemplate.opsForValue().get(curRedisExpireKey), "");
|
||||||
|
if (StringUtils.isNotBlank(token) && StringUtils.isNotBlank(expires)) {
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
LocalDateTime expireTime = LocalDateTime.parse(expires, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
Long curStamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();//国内时区的时间戳
|
||||||
|
boolean b = nowTime.compareTo(expireTime) < 0;
|
||||||
|
if (b) {//未过期
|
||||||
|
log.warn("{}:找到有效的缓存,直接返回Token", type);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VOIotAccess getAccess(SurvDeviceDeploy deploy) {
|
||||||
|
if (tokenMap == null) {
|
||||||
|
tokenMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
VOIotAccess voIotAccess = tokenMap.get(deploy.getTenantId());
|
||||||
|
if (voIotAccess == null) {
|
||||||
|
SurvConfig survConfig = configService.getOneByTypeWithTenant(deploy.getTenantId(), IotConstants.xph_access);
|
||||||
|
if (survConfig != null) {
|
||||||
|
voIotAccess = new VOIotAccess();
|
||||||
|
voIotAccess.setAppSecret(survConfig.getConfigValue());
|
||||||
|
voIotAccess.setAppId(survConfig.getConfigKey());
|
||||||
|
tokenMap.put(deploy.getTenantId(), voIotAccess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tokenMap == null) {
|
||||||
|
log.error("------------------新普惠设备密钥未正确配置--------------------");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return voIotAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠发送设备指令
|
||||||
|
*/
|
||||||
|
public boolean sendCmd(SurvDeviceDeploy deploy, String relayNum, String relayState) {
|
||||||
|
try {
|
||||||
|
VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
String token = getXphToken(voIotAccess.getAppId(), voIotAccess.getAppSecret());
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("token", token);
|
||||||
|
String deviceApiUrl = domain + "/relay";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("deviceId", deploy.getDeployCode());
|
||||||
|
paramMap.put("relayNum", relayNum);
|
||||||
|
paramMap.put("relayState", relayState);
|
||||||
|
String result = HttpRequestUtils.postStringRequest(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn("新普惠控制回执:{}", JSONObject.toJSONString(result));
|
||||||
|
if (StringUtils.isNotBlank(result)) {
|
||||||
|
|
||||||
|
if ("true".equals(result)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备信息
|
||||||
|
*/
|
||||||
|
public XphDeviceInfoVo getDeviceInfo(SurvDeviceDeploy deploy) {
|
||||||
|
try {
|
||||||
|
VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
String token = getXphToken(voIotAccess.getAppId(), voIotAccess.getAppSecret());
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("token", token);
|
||||||
|
String deviceApiUrl = domain + "/device/{deviceId}";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("deviceId", deploy.getDeployCode());
|
||||||
|
HttpResponseVo httpResponseVo = HttpRequestUtils.getExchange(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn("========同步回执=================:" + JSON.toJSONString(httpResponseVo.getData()));
|
||||||
|
if (httpResponseVo.isOk()) {
|
||||||
|
XphDeviceInfoVo xphDeviceInfoVo = JSONObject.toJavaObject(httpResponseVo.getData(), XphDeviceInfoVo.class);
|
||||||
|
return xphDeviceInfoVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备最新一条数据
|
||||||
|
*/
|
||||||
|
public XphDeviceNewestDataVo getDeviceNewestData(SurvDeviceDeploy deploy) {
|
||||||
|
try {
|
||||||
|
VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
String token = getXphToken(voIotAccess.getAppId(), voIotAccess.getAppSecret());
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("token", token);
|
||||||
|
String deviceApiUrl = domain + "/screen/datas?deviceId={deviceId}";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("deviceId", deploy.getDeployCode());
|
||||||
|
HttpResponseVo httpResponseVo = HttpRequestUtils.getExchange(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn(deviceApiUrl + "========新普惠设备最新数据回执=================" + JSON.toJSONString(httpResponseVo.getData()));
|
||||||
|
if (httpResponseVo.isOk()) {
|
||||||
|
XphDeviceNewestDataVo xphDeviceInfoVo = JSONObject.toJavaObject(httpResponseVo.getData(), XphDeviceNewestDataVo.class);
|
||||||
|
return xphDeviceInfoVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备元素列表
|
||||||
|
*/
|
||||||
|
public XphDeviceEleVo getDeviceEleList() {
|
||||||
|
XphDeviceEleVo xphDeviceEleVo =new XphDeviceEleVo();
|
||||||
|
try {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
String deviceApiUrl = domain + "/element";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
HttpResponseVo httpResponseVo = HttpRequestUtils.getArrExchange(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn(deviceApiUrl + "========新普惠设备最新数据回执=================" + JSON.toJSONString(httpResponseVo.getArrData()));
|
||||||
|
if (httpResponseVo.isOk()) {
|
||||||
|
List<XphDeviceEleDetailVo> eles = new ArrayList<>();
|
||||||
|
if(httpResponseVo.getArrData()!=null){
|
||||||
|
for (Object arrDatum : httpResponseVo.getArrData()) {
|
||||||
|
XphDeviceEleDetailVo eleDetailVo = JSONObject.parseObject(JSONObject.toJSONString(arrDatum),XphDeviceEleDetailVo.class);
|
||||||
|
eles.add(eleDetailVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xphDeviceEleVo.setList(eles);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return xphDeviceEleVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备继电器状态
|
||||||
|
*/
|
||||||
|
public List<String> getDeviceRelayStatus(SurvDeviceDeploy deploy) {
|
||||||
|
try {
|
||||||
|
VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
String token = getXphToken(voIotAccess.getAppId(), voIotAccess.getAppSecret());
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("token", token);
|
||||||
|
String deviceApiUrl = domain + "/relatedcontrol/valve";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("deviceId", deploy.getDeployCode());
|
||||||
|
List<String> list = HttpRequestUtils.postListRequest(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn(deviceApiUrl + "========新普惠设备实时继电器状态回执=================" + JSON.toJSONString(list));
|
||||||
|
if (list != null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XphDeviceQueryDataVo getV1DeviceNewestData(SurvDeviceDeploy deploy) {
|
||||||
|
try {
|
||||||
|
// VOIotAccess voIotAccess = getAccess(deploy);
|
||||||
|
// String token = getXphToken(voIotAccess.getAppId(), voIotAccess.getAppSecret());
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
// headers.put("token", token);
|
||||||
|
String deviceApiUrl = v1domain + "/intfa/queryData/dz/{deviceId}";
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("deviceId", deploy.getDeployCode());
|
||||||
|
HttpResponseVo httpResponseVo = HttpRequestUtils.getExchange(deviceApiUrl, paramMap, headers);
|
||||||
|
log.warn(deviceApiUrl + "========新普惠V1设备最新数据回执=================" + JSON.toJSONString(httpResponseVo.getData()));
|
||||||
|
if (httpResponseVo.isOk()) {
|
||||||
|
XphDeviceQueryDataVo xphDeviceQueryDataVo = JSONObject.toJavaObject(httpResponseVo.getData(), XphDeviceQueryDataVo.class);
|
||||||
|
return xphDeviceQueryDataVo;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,6 +31,12 @@
|
||||||
<result property="mapIcon" column="MAP_ICON" jdbcType="VARCHAR"/>
|
<result property="mapIcon" column="MAP_ICON" jdbcType="VARCHAR"/>
|
||||||
<result property="deviceIotUrl" column="DEVICE_IOT_URL" jdbcType="VARCHAR"/>
|
<result property="deviceIotUrl" column="DEVICE_IOT_URL" jdbcType="VARCHAR"/>
|
||||||
<result property="deviceReverseIotUrl" column="DEVICE_REVERSE_IOT_URL" jdbcType="VARCHAR"/>
|
<result property="deviceReverseIotUrl" column="DEVICE_REVERSE_IOT_URL" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deviceLonglat" column="DEVICE_LONGLAT" jdbcType="VARCHAR"/>
|
||||||
|
<result property="protocolCode" column="PROTOCOL_CODE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="protocolType" column="PROTOCOL_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deployCate" column="DEPLOY_CATE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deploySecondaryType" column="DEPLOY_SECONDARY_TYPE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="cateId" column="CATE_ID" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="adResultMap" type="org.jeecg.common.entity.SurvDeviceDeploy" extends="baseResultMap">
|
<resultMap id="adResultMap" type="org.jeecg.common.entity.SurvDeviceDeploy" extends="baseResultMap">
|
||||||
<association property="stationName" javaType="java.lang.String" select="getStationName" column="STATION_CODE"></association>
|
<association property="stationName" javaType="java.lang.String" select="getStationName" column="STATION_CODE"></association>
|
||||||
|
|
@ -51,7 +57,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<sql id="baseSql" >
|
<sql id="baseSql" >
|
||||||
ID,DEPLOY_CODE,STATION_CODE,RUN_STATUS,POWER_STATUS,LASTSYNC_TIME,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC,DEVICE_URL,SORT_NO,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,DEPLOY_TYPE,DEVICE_LATITUDE,DEVICE_LONGITUDE,GROUP_ID,IZ_BAOJING,IP_ADDR,PORT,SEND_INFO,MAP_ICON,DEVICE_IOT_URL,DEVICE_REVERSE_IOT_URL
|
ID,DEPLOY_CODE,STATION_CODE,RUN_STATUS,POWER_STATUS,LASTSYNC_TIME,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC,DEVICE_URL,SORT_NO,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,DEPLOY_TYPE,DEVICE_LATITUDE,DEVICE_LONGITUDE,GROUP_ID,IZ_BAOJING,IP_ADDR,PORT,SEND_INFO,MAP_ICON,DEVICE_IOT_URL,DEVICE_REVERSE_IOT_URL,DEVICE_LONGLAT,PROTOCOL_CODE,PROTOCOL_TYPE,DEPLOY_CATE,DEPLOY_SECONDARY_TYPE,CATE_ID
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getCameraGroupByStation" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
<select id="getCameraGroupByStation" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,252 @@
|
||||||
|
package org.jeecg.common.constant;
|
||||||
|
|
||||||
|
public interface IotConstants {
|
||||||
|
/**
|
||||||
|
* 空气数据
|
||||||
|
*/
|
||||||
|
String AIR_DATA = "air";
|
||||||
|
/**
|
||||||
|
* 土壤数据
|
||||||
|
*/
|
||||||
|
String SOIL_DATA = "soil";
|
||||||
|
/**
|
||||||
|
* 水质数据
|
||||||
|
*/
|
||||||
|
String WATER_DATA = "water";
|
||||||
|
/**
|
||||||
|
* 水肥机数据
|
||||||
|
*/
|
||||||
|
String FERTILIZER_DATA = "fertilizer";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头类型:病虫害
|
||||||
|
*/
|
||||||
|
String PEST_CAM = "3";
|
||||||
|
/**
|
||||||
|
* 摄像头类型:苗情
|
||||||
|
*/
|
||||||
|
String SEED_CAM = "4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 萤石云访问
|
||||||
|
*/
|
||||||
|
String ysyAcess = "ysy_access";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 涂鸦访问
|
||||||
|
*/
|
||||||
|
String tuya_access = "tuya_access";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠访问
|
||||||
|
*/
|
||||||
|
String xph_access = "xph_access";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云飞访问
|
||||||
|
*/
|
||||||
|
String yf_access = "yf_access";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 欧柯奇密钥
|
||||||
|
*/
|
||||||
|
String okq_access = "okq_access";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关村数字乡村
|
||||||
|
*/
|
||||||
|
String gcszxc_access = "gcszxc_access";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 繁易访问
|
||||||
|
*/
|
||||||
|
String flexem_access = "flexem_access";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1天原始数据
|
||||||
|
*/
|
||||||
|
String day_origins = "dayOrigins";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1天小时数据
|
||||||
|
*/
|
||||||
|
String day_hours = "dayhours";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7天日数据
|
||||||
|
*/
|
||||||
|
String seven_days = "sevenDays";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7天小时数据
|
||||||
|
*/
|
||||||
|
String seven_day_hours = "sevenDayHours";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1月日数据
|
||||||
|
*/
|
||||||
|
String month_days = "monthDays";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1年月数据
|
||||||
|
*/
|
||||||
|
String year_months = "yearMonth";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年度数据
|
||||||
|
*/
|
||||||
|
String years = "years";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据量模式
|
||||||
|
*/
|
||||||
|
String cus_dataNum = "cusDataNum";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_XinPH = "XinPuHui";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 涂鸦应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_TuYa = "TuYa";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 萤石云标准
|
||||||
|
*/
|
||||||
|
String ysy_standard = "ysy_standard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠v1
|
||||||
|
*/
|
||||||
|
String xph_v1 = "xph_v1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠v2
|
||||||
|
*/
|
||||||
|
String xph_v2 = "xph_v2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 欧柯奇v1
|
||||||
|
*/
|
||||||
|
String okq_v1 = "okq_v1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 欧柯奇v1
|
||||||
|
*/
|
||||||
|
String okq_v2 = "okq_v2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博云标准
|
||||||
|
*/
|
||||||
|
String by_standard = "by_standard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云飞标准
|
||||||
|
*/
|
||||||
|
String yf_standard = "yf_standard";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关村数字乡村协议
|
||||||
|
*/
|
||||||
|
String gcszxc_standard = "gcszxc_standard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义监测项名称配置
|
||||||
|
*/
|
||||||
|
String surv_itemname = "surv_itemname";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 曲沃山东芯谷网络协议
|
||||||
|
*/
|
||||||
|
String qwxgwl_standard = "qwxgwl_standard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 曲沃山东芯谷网络密钥
|
||||||
|
*/
|
||||||
|
String qwxgwl_access = "qwxgwl_access";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蓝海虚拟设备协议
|
||||||
|
*/
|
||||||
|
String lhviot_standard = "lhviot_standard";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备判断离线时长
|
||||||
|
*/
|
||||||
|
String device_offline_time = "device_offline_time";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物联网字典缓存头
|
||||||
|
*/
|
||||||
|
String iot_ele_cache = "iot_ele_cache";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物联网厂家配置缓存
|
||||||
|
*/
|
||||||
|
String iot_protocol_cache = "iot_protocol_cache";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测类设备
|
||||||
|
*/
|
||||||
|
String device_cate_surv = "surv";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控类设备
|
||||||
|
*/
|
||||||
|
String device_cate_monitor = "monitor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防治类设备
|
||||||
|
*/
|
||||||
|
String device_cate_guard = "guard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制类设备
|
||||||
|
*/
|
||||||
|
String device_cate_control = "control";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物联网配置缓存头
|
||||||
|
*/
|
||||||
|
String IOT_SURVCONFIG_CACHE = "surv:config:params";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科协议
|
||||||
|
*/
|
||||||
|
String renke_standard = "RenKe_standard";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_RenKe = "RenKe";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科应用
|
||||||
|
*/
|
||||||
|
String renke_access = "RenKe_access";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mqtt接收逻辑缓存
|
||||||
|
*/
|
||||||
|
String mqtt_receive_logic="mqtt_receive_logic:";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mqtt设备状态缓存
|
||||||
|
*/
|
||||||
|
String mqtt_device_status="mqtt_device_status:";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.jeecg.common.constant;
|
||||||
|
|
||||||
|
public interface ToolConstant {
|
||||||
|
|
||||||
|
/**POST请求*/
|
||||||
|
String HTTP_POST = "POST";
|
||||||
|
|
||||||
|
/**PUT请求*/
|
||||||
|
String HTTP_PUT = "PUT";
|
||||||
|
|
||||||
|
/**PATCH请求*/
|
||||||
|
String HTTP_PATCH = "PATCH";
|
||||||
|
|
||||||
|
/**未知的*/
|
||||||
|
String UNKNOWN = "unknown";
|
||||||
|
|
||||||
|
/**字符串http*/
|
||||||
|
String STR_HTTP = "http";
|
||||||
|
|
||||||
|
/**String 类型的空值*/
|
||||||
|
String STRING_NULL = "null";
|
||||||
|
|
||||||
|
/**前端vue3版本Header参数名*/
|
||||||
|
String VERSION="X-Version";
|
||||||
|
|
||||||
|
/**存储在线程变量里的动态表名*/
|
||||||
|
String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME";
|
||||||
|
/**
|
||||||
|
* http:// http协议
|
||||||
|
*/
|
||||||
|
String HTTP_PROTOCOL = "http://";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https:// https协议
|
||||||
|
*/
|
||||||
|
String HTTPS_PROTOCOL = "https://";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 萤石云应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_YsYun = "YingShiYun";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新普惠应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_XinPH = "XinPuHui";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云飞应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_YunF = "YunFei";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 欧克奇应用
|
||||||
|
*/
|
||||||
|
String APPLICATION_Okq = "OuKeqi";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
package org.jeecg.common.constant.enums;
|
||||||
|
|
||||||
|
public enum DeviceDeployEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气象监测设备
|
||||||
|
*/
|
||||||
|
SURV_AIR("air", "空气监测设备", "surv"),
|
||||||
|
/**
|
||||||
|
* 土壤监测设备
|
||||||
|
*/
|
||||||
|
SURV_SOIL("soil", "土壤监测设备", "surv"),
|
||||||
|
/**
|
||||||
|
* 面源水污染监测
|
||||||
|
*/
|
||||||
|
WATER_ORIENT("water_orient", "面源水污染监测", "surv"),
|
||||||
|
/**
|
||||||
|
* 畜禽水污染监测
|
||||||
|
*/
|
||||||
|
WATER_LIVE("water_live", "畜禽水污染监测", "surv"),
|
||||||
|
/**
|
||||||
|
* 水质监测
|
||||||
|
*/
|
||||||
|
WATER_QULITY("6_water", "水质监测", "surv"),
|
||||||
|
/**
|
||||||
|
* 恶臭设备
|
||||||
|
*/
|
||||||
|
STINK("stink", "恶臭设备", "surv"),
|
||||||
|
/**
|
||||||
|
* 虫情监测
|
||||||
|
*/
|
||||||
|
BUG_SURV("7_bugsurv", "虫情监测", "surv"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孢子监测
|
||||||
|
*/
|
||||||
|
SPORE_SURV("8_sporesurv", "孢子监测", "surv"),
|
||||||
|
|
||||||
|
CAMERA("camera", "摄像头", "surv"),
|
||||||
|
|
||||||
|
PEST_LIGHT("9_pestlight", "杀虫灯", "guard"),
|
||||||
|
|
||||||
|
CONTROL_CAB("control_cab", "温室控制柜", "control"),
|
||||||
|
|
||||||
|
INTEGRATED_MACHINE("integrated_machine", "水肥一体机", "control"),
|
||||||
|
|
||||||
|
|
||||||
|
INTEGRATED_CONTROL("integrated_control", "灌溉控制器", "control"),
|
||||||
|
|
||||||
|
SURV("surv", "物联网设备", "out"),
|
||||||
|
|
||||||
|
OTHER("other", "其他", "other");
|
||||||
|
|
||||||
|
DeviceDeployEnum(String type, String note, String cate) {
|
||||||
|
this.type = type;
|
||||||
|
this.note = note;
|
||||||
|
this.cate = cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型代号
|
||||||
|
*/
|
||||||
|
String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型说明
|
||||||
|
*/
|
||||||
|
String note;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
String cate;
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCate() {
|
||||||
|
return cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCate(String cate) {
|
||||||
|
this.cate = cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据type获取枚举
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static DeviceDeployEnum valueOfType(String type) {
|
||||||
|
for (DeviceDeployEnum e : DeviceDeployEnum.values()) {
|
||||||
|
if (e.getType().equals(type)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.jeecg.common.constant.enums;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物联网厂家枚举
|
||||||
|
*/
|
||||||
|
public enum IotManufacturerEnum {
|
||||||
|
XPH("xph","武汉新普惠科技有限公司"),
|
||||||
|
OKQ("okq","郑州欧柯奇仪器制造有限公司"),
|
||||||
|
YunFei("yf","河南云飞科技发展有限公司"),
|
||||||
|
BoYun("by","南通博云物联网技术有限公司"),
|
||||||
|
Flexem("flexem","上海繁易信息科技股份有限公司"),
|
||||||
|
YouRen("YouRen","山东有人物联网股份有限公司"),
|
||||||
|
TuYa("TuYa","杭州涂鸦信息技术有限公司"),
|
||||||
|
RenKe("RenKe","山东仁科测控技术有限公司"),
|
||||||
|
OTHER("other","其他")
|
||||||
|
;
|
||||||
|
|
||||||
|
IotManufacturerEnum(String code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据type获取枚举
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static IotManufacturerEnum valueOfCode(String code) {
|
||||||
|
for (IotManufacturerEnum e : IotManufacturerEnum.values()) {
|
||||||
|
if (e.getCode().equals(code)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OTHER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,10 +4,8 @@ import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
@ -81,9 +79,21 @@ public class ScEquZhibiao implements Serializable {
|
||||||
@ApiModelProperty(value = "化学式")
|
@ApiModelProperty(value = "化学式")
|
||||||
private String chemicalName;
|
private String chemicalName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "化学式")
|
@ApiModelProperty(value = "大屏显示")
|
||||||
private String zhibiaoType;
|
private String zhibiaoType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private String sortNo;
|
private Integer sortNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储字段
|
||||||
|
*/
|
||||||
|
@Excel(name = "存储字段", width = 15)
|
||||||
|
@ApiModelProperty(value = "存储字段")
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String entityField;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典key")
|
||||||
|
private String eleKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package org.jeecg.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 城市编码
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-06
|
||||||
|
* @Version: V1.06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("surv_weather_city_code")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "城市编码", description = "城市编码")
|
||||||
|
public class SurvCityCode implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* locationId
|
||||||
|
*/
|
||||||
|
@Excel(name = "locationId", width = 15)
|
||||||
|
@ApiModelProperty(value = "locationId")
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String locationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* locationNameEn
|
||||||
|
*/
|
||||||
|
@Excel(name = "locationNameEn", width = 15)
|
||||||
|
@ApiModelProperty(value = "locationNameEn")
|
||||||
|
private String locationNameEn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* locationNameZh
|
||||||
|
*/
|
||||||
|
@Excel(name = "locationNameZh", width = 15)
|
||||||
|
@ApiModelProperty(value = "locationNameZh")
|
||||||
|
private String locationNameZh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iso31661
|
||||||
|
*/
|
||||||
|
@Excel(name = "iso31661", width = 15)
|
||||||
|
@ApiModelProperty(value = "iso31661")
|
||||||
|
private String iso31661;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* countryRegionEn
|
||||||
|
*/
|
||||||
|
@Excel(name = "countryRegionEn", width = 15)
|
||||||
|
@ApiModelProperty(value = "countryRegionEn")
|
||||||
|
private String countryRegionEn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* countryRegionZh
|
||||||
|
*/
|
||||||
|
@Excel(name = "countryRegionZh", width = 15)
|
||||||
|
@ApiModelProperty(value = "countryRegionZh")
|
||||||
|
private String countryRegionZh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adm1NameEn
|
||||||
|
*/
|
||||||
|
@Excel(name = "adm1NameEn", width = 15)
|
||||||
|
@ApiModelProperty(value = "adm1NameEn")
|
||||||
|
private String adm1NameEn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adm1NameZh
|
||||||
|
*/
|
||||||
|
@Excel(name = "adm1NameZh", width = 15)
|
||||||
|
@ApiModelProperty(value = "adm1NameZh")
|
||||||
|
private String adm1NameZh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adm2NameEn
|
||||||
|
*/
|
||||||
|
@Excel(name = "adm2NameEn", width = 15)
|
||||||
|
@ApiModelProperty(value = "adm2NameEn")
|
||||||
|
private String adm2NameEn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adm2NameZh
|
||||||
|
*/
|
||||||
|
@Excel(name = "adm2NameZh", width = 15)
|
||||||
|
@ApiModelProperty(value = "adm2NameZh")
|
||||||
|
private String adm2NameZh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timezone
|
||||||
|
*/
|
||||||
|
@Excel(name = "timezone", width = 15)
|
||||||
|
@ApiModelProperty(value = "timezone")
|
||||||
|
private String timezone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* latitude
|
||||||
|
*/
|
||||||
|
@Excel(name = "latitude", width = 15)
|
||||||
|
@ApiModelProperty(value = "latitude")
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* longitude
|
||||||
|
*/
|
||||||
|
@Excel(name = "longitude", width = 15)
|
||||||
|
@ApiModelProperty(value = "longitude")
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adCode
|
||||||
|
*/
|
||||||
|
@Excel(name = "adCode", width = 15)
|
||||||
|
@ApiModelProperty(value = "adCode")
|
||||||
|
private String adCode;
|
||||||
|
}
|
||||||
|
|
@ -38,6 +38,7 @@ public class SurvDeviceDeploy implements Serializable {
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@ApiModelProperty(value = "主键")
|
@ApiModelProperty(value = "主键")
|
||||||
private java.lang.String id;
|
private java.lang.String id;
|
||||||
|
|
||||||
/**租户号*/
|
/**租户号*/
|
||||||
@Excel(name = "租户号", width = 15)
|
@Excel(name = "租户号", width = 15)
|
||||||
@ApiModelProperty(value = "租户号")
|
@ApiModelProperty(value = "租户号")
|
||||||
|
|
@ -125,6 +126,17 @@ public class SurvDeviceDeploy implements Serializable {
|
||||||
@ApiModelProperty(value = "部署类型,surv=监测设备部署,camera=摄像头设备部署,pestlight=杀虫灯")
|
@ApiModelProperty(value = "部署类型,surv=监测设备部署,camera=摄像头设备部署,pestlight=杀虫灯")
|
||||||
private String deployType;
|
private String deployType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次级部署类型;字典值,根据deployType确定
|
||||||
|
*/
|
||||||
|
@Excel(name = "次级部署类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "次级部署类型")
|
||||||
|
private java.lang.String deploySecondaryType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备类型")
|
||||||
|
private java.lang.String cateId;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty("分组ID")
|
@ApiModelProperty("分组ID")
|
||||||
private String groupId;
|
private String groupId;
|
||||||
|
|
||||||
|
|
@ -159,6 +171,22 @@ public class SurvDeviceDeploy implements Serializable {
|
||||||
@ApiModelProperty(value = "部署图片")
|
@ApiModelProperty(value = "部署图片")
|
||||||
private java.lang.String deviceReverseIotUrl;
|
private java.lang.String deviceReverseIotUrl;
|
||||||
|
|
||||||
|
@Excel(name = "协议编号", width = 15)
|
||||||
|
@ApiModelProperty(value = "协议编号,用于识别对接方式")
|
||||||
|
private String protocolCode;
|
||||||
|
|
||||||
|
@Excel(name = "协议类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "协议类型,http=http,mqtt=mqtt")
|
||||||
|
private String protocolType;
|
||||||
|
|
||||||
|
@Excel(name = "部署类型大类", width = 15)
|
||||||
|
@ApiModelProperty(value = "部署类型大类,如monitor=监控设备,surv=监测设备,control=控制设备")
|
||||||
|
private String deployCate;
|
||||||
|
|
||||||
|
@Excel(name = "设备经纬度", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备经纬度")
|
||||||
|
private String deviceLonglat;
|
||||||
|
|
||||||
@ApiModelProperty("1#球阀状态")
|
@ApiModelProperty("1#球阀状态")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String valveStatus1;
|
private String valveStatus1;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
package org.jeecg.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 字典-全国城市
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-09-02
|
||||||
|
* @Version: V1.06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("surv_dict_city")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "字典-全国城市", description = "字典-全国城市")
|
||||||
|
public class SurvDictCity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "城市ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "城市名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "城市名称")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "父ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "父ID")
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缩写首字母
|
||||||
|
*/
|
||||||
|
@Excel(name = "缩写首字母", width = 15)
|
||||||
|
@ApiModelProperty(value = "缩写首字母")
|
||||||
|
private String pinyin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 级别
|
||||||
|
*/
|
||||||
|
@Excel(name = "级别", width = 15)
|
||||||
|
@ApiModelProperty(value = "级别")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
@Excel(name = "经度", width = 15)
|
||||||
|
@ApiModelProperty(value = "经度")
|
||||||
|
private Double lng;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
@Excel(name = "纬度", width = 15)
|
||||||
|
@ApiModelProperty(value = "纬度")
|
||||||
|
private Double lat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
package org.jeecg.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备种类字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("surv_dict_device_cate")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "设备种类字典", description = "设备种类字典")
|
||||||
|
public class SurvDictDeviceCate implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备种类名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备种类名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备种类名称")
|
||||||
|
private String cateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 种类图片
|
||||||
|
*/
|
||||||
|
@Excel(name = "种类图片", width = 15)
|
||||||
|
@ApiModelProperty(value = "种类图片")
|
||||||
|
private String catePic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "父类ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "父类ID")
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@Excel(name = "备注", width = 15)
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String cateRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否启用", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否启用")
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署类型大类
|
||||||
|
*/
|
||||||
|
@Excel(name = "部署类型大类", width = 15)
|
||||||
|
@ApiModelProperty(value = "部署类型大类,如monitor=监控设备,surv=监测设备,control=控制设备")
|
||||||
|
private String deployCate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "部署类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "部署类型")
|
||||||
|
private String deployType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次级部署类型;字典值,根据deployType确定
|
||||||
|
*/
|
||||||
|
@Excel(name = "次级部署类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "次级部署类型")
|
||||||
|
private String deploySecondaryType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户号
|
||||||
|
*/
|
||||||
|
@Excel(name = "租户号", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁
|
||||||
|
*/
|
||||||
|
@Excel(name = "乐观锁", width = 15)
|
||||||
|
@ApiModelProperty(value = "乐观锁")
|
||||||
|
private Integer reVision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除
|
||||||
|
*/
|
||||||
|
@Excel(name = "逻辑删除", width = 15)
|
||||||
|
@ApiModelProperty(value = "逻辑删除")
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String parentName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,213 @@
|
||||||
|
package org.jeecg.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 设备明细字典
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-10-26
|
||||||
|
* @Version: V1.06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("surv_dict_device_detail")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "设备明细字典", description = "设备明细字典")
|
||||||
|
public class SurvDictDeviceDetail implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备种类ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备种类ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备种类ID")
|
||||||
|
private String cateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次级种类ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "次级种类ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "次级种类ID")
|
||||||
|
private String cateBigId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备型号
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备型号", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备型号")
|
||||||
|
private String deviceModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
@Excel(name = "生产厂家", width = 15)
|
||||||
|
@ApiModelProperty(value = "生产厂家")
|
||||||
|
private String deviceManufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对接协议
|
||||||
|
*/
|
||||||
|
@Excel(name = "对接协议", width = 15)
|
||||||
|
@ApiModelProperty(value = "对接协议")
|
||||||
|
private String deviceProtocol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "协议类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "协议类型")
|
||||||
|
private String protocolType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备图标
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备图标", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备图标")
|
||||||
|
private String deviceIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认部署图
|
||||||
|
*/
|
||||||
|
@Excel(name = "默认部署图", width = 15)
|
||||||
|
@ApiModelProperty(value = "默认部署图")
|
||||||
|
private String defaultDeployPic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认地图图标
|
||||||
|
*/
|
||||||
|
@Excel(name = "默认地图图标", width = 15)
|
||||||
|
@ApiModelProperty(value = "默认地图图标")
|
||||||
|
private String defaultMapIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测项(监测类设备填入);数组,存放监测项
|
||||||
|
*/
|
||||||
|
@Excel(name = "监测项(监测类设备填入);数组,存放监测项", width = 15)
|
||||||
|
@ApiModelProperty(value = "监测项(监测类设备填入);数组,存放监测项")
|
||||||
|
private String survItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备代号
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备代号", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备代号")
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备简称
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备简称", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备简称")
|
||||||
|
private String deviveShortName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否启用", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否启用")
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否原生支持抓拍")
|
||||||
|
private Integer isSupportCapture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持数据分析
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否支持数据分析", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否支持数据分析")
|
||||||
|
private Integer isSupportAnalysis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持坐标定位
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否支持数据分析", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否支持数据分析")
|
||||||
|
private Integer isSupportPosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备说明
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备说明", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备说明")
|
||||||
|
private String deviceDes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户号
|
||||||
|
*/
|
||||||
|
@Excel(name = "租户号", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁
|
||||||
|
*/
|
||||||
|
@Excel(name = "乐观锁", width = 15)
|
||||||
|
@ApiModelProperty(value = "乐观锁")
|
||||||
|
private Integer reVision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除
|
||||||
|
*/
|
||||||
|
@Excel(name = "逻辑删除", width = 15)
|
||||||
|
@ApiModelProperty(value = "逻辑删除")
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String cateName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package org.jeecg.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: f_iot_dict_ele
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-02-26
|
||||||
|
* @Version: V1.06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("surv_dict_ele")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="surv_dict_ele", description="surv_dict_ele")
|
||||||
|
public class SurvDictEle implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**主键*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**厂家编号*/
|
||||||
|
@Excel(name = "厂家编号", width = 15)
|
||||||
|
@ApiModelProperty(value = "厂家编号")
|
||||||
|
private String maCode;
|
||||||
|
|
||||||
|
/**pid*/
|
||||||
|
@Excel(name = "pid", width = 15)
|
||||||
|
@ApiModelProperty(value = "pid")
|
||||||
|
private String pid;
|
||||||
|
|
||||||
|
/**理论的唯一值,实际有问题不唯一*/
|
||||||
|
@Excel(name = "唯一值", width = 15)
|
||||||
|
@ApiModelProperty(value = "唯一值")
|
||||||
|
private String eleIndex;
|
||||||
|
|
||||||
|
/**与新普惠转换的唯一值*/
|
||||||
|
@Excel(name = "与新普惠转换的唯一值", width = 15)
|
||||||
|
@ApiModelProperty(value = "与新普惠转换的唯一值")
|
||||||
|
private String transKey;
|
||||||
|
|
||||||
|
/**元素的类型,air=空气数据,soil=土壤数据,irrigate=水肥机*/
|
||||||
|
@Excel(name = "元素的类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "元素的类型")
|
||||||
|
private String eleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段名称
|
||||||
|
*/
|
||||||
|
@TableField("COLUMN_NAME")
|
||||||
|
private String columnName;
|
||||||
|
|
||||||
|
/**名称*/
|
||||||
|
@Excel(name = "名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**英文名称*/
|
||||||
|
@Excel(name = "英文名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "英文名称")
|
||||||
|
private String nameEn;
|
||||||
|
|
||||||
|
/**单位*/
|
||||||
|
@Excel(name = "单位", width = 15)
|
||||||
|
@ApiModelProperty(value = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**最小值*/
|
||||||
|
@Excel(name = "最小值", width = 15)
|
||||||
|
@ApiModelProperty(value = "最小值")
|
||||||
|
private String min;
|
||||||
|
|
||||||
|
/**最大值*/
|
||||||
|
@Excel(name = "最大值", width = 15)
|
||||||
|
@ApiModelProperty(value = "最大值")
|
||||||
|
private String max;
|
||||||
|
|
||||||
|
/**分辨率*/
|
||||||
|
@Excel(name = "分辨率", width = 15)
|
||||||
|
@ApiModelProperty(value = "分辨率")
|
||||||
|
private String prec;
|
||||||
|
|
||||||
|
/**图标*/
|
||||||
|
@Excel(name = "图标", width = 15)
|
||||||
|
@ApiModelProperty(value = "图标")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**字典ID,可能为空*/
|
||||||
|
@Excel(name = "字典ID,可能为空", width = 15)
|
||||||
|
@ApiModelProperty(value = "字典ID,可能为空")
|
||||||
|
private String dictId;
|
||||||
|
|
||||||
|
/**租户号*/
|
||||||
|
@Excel(name = "租户号", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**乐观锁*/
|
||||||
|
@Excel(name = "乐观锁", width = 15)
|
||||||
|
@ApiModelProperty(value = "乐观锁")
|
||||||
|
private Integer reVision;
|
||||||
|
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**创建时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**逻辑删除*/
|
||||||
|
@Excel(name = "逻辑删除", width = 15)
|
||||||
|
@ApiModelProperty(value = "逻辑删除")
|
||||||
|
@TableLogic
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
/**更新时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2025 bejson.com
|
||||||
|
*/
|
||||||
|
package org.jeecg.common.iot.renke;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated: 2025-09-11 10:47:4
|
||||||
|
*
|
||||||
|
* @author bejson.com (i@bejson.com)
|
||||||
|
* @website http://www.bejson.com/java2pojo/
|
||||||
|
*/
|
||||||
|
public class DataItem {
|
||||||
|
|
||||||
|
private int nodeId;
|
||||||
|
private List<RegisterItem> registerItem;
|
||||||
|
public void setNodeId(int nodeId) {
|
||||||
|
this.nodeId = nodeId;
|
||||||
|
}
|
||||||
|
public int getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisterItem(List<RegisterItem> registerItem) {
|
||||||
|
this.registerItem = registerItem;
|
||||||
|
}
|
||||||
|
public List<RegisterItem> getRegisterItem() {
|
||||||
|
return registerItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2025 bejson.com
|
||||||
|
*/
|
||||||
|
package org.jeecg.common.iot.renke;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated: 2025-09-11 10:47:4
|
||||||
|
*
|
||||||
|
* @author bejson.com (i@bejson.com)
|
||||||
|
* @website http://www.bejson.com/java2pojo/
|
||||||
|
*/
|
||||||
|
public class RegisterItem {
|
||||||
|
|
||||||
|
private int registerId;
|
||||||
|
private String data;
|
||||||
|
private double value;
|
||||||
|
private int alarmLevel;
|
||||||
|
private String alarmColor;
|
||||||
|
private String alarmInfo;
|
||||||
|
private String unit;
|
||||||
|
private String registerName;
|
||||||
|
public void setRegisterId(int registerId) {
|
||||||
|
this.registerId = registerId;
|
||||||
|
}
|
||||||
|
public int getRegisterId() {
|
||||||
|
return registerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(String data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
public String getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(double value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
public double getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlarmLevel(int alarmLevel) {
|
||||||
|
this.alarmLevel = alarmLevel;
|
||||||
|
}
|
||||||
|
public int getAlarmLevel() {
|
||||||
|
return alarmLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlarmColor(String alarmColor) {
|
||||||
|
this.alarmColor = alarmColor;
|
||||||
|
}
|
||||||
|
public String getAlarmColor() {
|
||||||
|
return alarmColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlarmInfo(String alarmInfo) {
|
||||||
|
this.alarmInfo = alarmInfo;
|
||||||
|
}
|
||||||
|
public String getAlarmInfo() {
|
||||||
|
return alarmInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnit(String unit) {
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
public String getUnit() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisterName(String registerName) {
|
||||||
|
this.registerName = registerName;
|
||||||
|
}
|
||||||
|
public String getRegisterName() {
|
||||||
|
return registerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2025 bejson.com
|
||||||
|
*/
|
||||||
|
package org.jeecg.common.iot.renke;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated: 2025-09-11 10:47:4
|
||||||
|
*
|
||||||
|
* @author bejson.com (i@bejson.com)
|
||||||
|
* @website http://www.bejson.com/java2pojo/
|
||||||
|
*/
|
||||||
|
public class RelayStatusItems {
|
||||||
|
|
||||||
|
private int relayNo;
|
||||||
|
private int relayStatus;
|
||||||
|
public void setRelayNo(int relayNo) {
|
||||||
|
this.relayNo = relayNo;
|
||||||
|
}
|
||||||
|
public int getRelayNo() {
|
||||||
|
return relayNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelayStatus(int relayStatus) {
|
||||||
|
this.relayStatus = relayStatus;
|
||||||
|
}
|
||||||
|
public int getRelayStatus() {
|
||||||
|
return relayStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.jeecg.common.iot.renke;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RenKeResultPack {
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.jeecg.common.iot.renke; /**
|
||||||
|
* Copyright 2025 bejson.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated: 2025-09-11 10:47:4
|
||||||
|
*
|
||||||
|
* @author bejson.com (i@bejson.com)
|
||||||
|
* @website http://www.bejson.com/java2pojo/
|
||||||
|
*/
|
||||||
|
public class RenkeDataRealTimeDetail {
|
||||||
|
|
||||||
|
private String systemCode;
|
||||||
|
private long deviceAddr;
|
||||||
|
private String deviceName;
|
||||||
|
private int lat;
|
||||||
|
private int lng;
|
||||||
|
private String deviceStatus;
|
||||||
|
private String relayStatus;
|
||||||
|
private List<RelayStatusItems> relayStatusItems;
|
||||||
|
private List<DataItem> dataItem;
|
||||||
|
private long timeStamp;
|
||||||
|
public void setSystemCode(String systemCode) {
|
||||||
|
this.systemCode = systemCode;
|
||||||
|
}
|
||||||
|
public String getSystemCode() {
|
||||||
|
return systemCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceAddr(long deviceAddr) {
|
||||||
|
this.deviceAddr = deviceAddr;
|
||||||
|
}
|
||||||
|
public long getDeviceAddr() {
|
||||||
|
return deviceAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceName(String deviceName) {
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
}
|
||||||
|
public String getDeviceName() {
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLat(int lat) {
|
||||||
|
this.lat = lat;
|
||||||
|
}
|
||||||
|
public int getLat() {
|
||||||
|
return lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLng(int lng) {
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
|
public int getLng() {
|
||||||
|
return lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceStatus(String deviceStatus) {
|
||||||
|
this.deviceStatus = deviceStatus;
|
||||||
|
}
|
||||||
|
public String getDeviceStatus() {
|
||||||
|
return deviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelayStatus(String relayStatus) {
|
||||||
|
this.relayStatus = relayStatus;
|
||||||
|
}
|
||||||
|
public String getRelayStatus() {
|
||||||
|
return relayStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelayStatusItems(List<RelayStatusItems> relayStatusItems) {
|
||||||
|
this.relayStatusItems = relayStatusItems;
|
||||||
|
}
|
||||||
|
public List<RelayStatusItems> getRelayStatusItems() {
|
||||||
|
return relayStatusItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataItem(List<DataItem> dataItem) {
|
||||||
|
this.dataItem = dataItem;
|
||||||
|
}
|
||||||
|
public List<DataItem> getDataItem() {
|
||||||
|
return dataItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeStamp(long timeStamp) {
|
||||||
|
this.timeStamp = timeStamp;
|
||||||
|
}
|
||||||
|
public long getTimeStamp() {
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.jeecg.common.iot.renke;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RenkeDataRealTimePack extends RenKeResultPack {
|
||||||
|
private List<RenkeDataRealTimeDetail> data;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package org.jeecg.common.iot.renke.enums;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
public enum RkItemEnum {
|
||||||
|
|
||||||
|
/** 土壤温度 */
|
||||||
|
RK_SOIL_TEMP("土壤温度", "土壤温度","soil"),
|
||||||
|
/** 土壤水分 */
|
||||||
|
RK_SOIL_HUM("土壤水分", "土壤水分","soil"),
|
||||||
|
/**电导率*/
|
||||||
|
RK_SOIL_DDL("电导率", "电导率","soil"),
|
||||||
|
/**磷*/
|
||||||
|
RK_SOIL_P("磷", "磷","soil"),
|
||||||
|
/**氮*/
|
||||||
|
RK_SOIL_N("氮", "氮","soil"),
|
||||||
|
/**钾*/
|
||||||
|
RK_SOIL_K("钾", "钾","soil"),
|
||||||
|
/**虫情监测*/
|
||||||
|
OTHER("other", "其他","other");
|
||||||
|
|
||||||
|
RkItemEnum(String type, String note, String cate){
|
||||||
|
this.type = type;
|
||||||
|
this.note = note;
|
||||||
|
this.cate = cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型代号
|
||||||
|
*/
|
||||||
|
String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型说明
|
||||||
|
*/
|
||||||
|
String note;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
String cate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getCate() {
|
||||||
|
return cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCate(String cate) {
|
||||||
|
this.cate = cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据note获取枚举
|
||||||
|
*
|
||||||
|
* @param note
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static RkItemEnum valueOfNote(String note) {
|
||||||
|
for (RkItemEnum e : RkItemEnum.values()) {
|
||||||
|
if(StringUtils.isNotBlank(note)){
|
||||||
|
note = note.trim();
|
||||||
|
}
|
||||||
|
if (e.getNote().equals(note)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceEleDetailVo {
|
||||||
|
/*id*/
|
||||||
|
private String id;
|
||||||
|
/*检索值,和数据返回的eNum对应*/
|
||||||
|
private String index;
|
||||||
|
/*名称*/
|
||||||
|
private String name;
|
||||||
|
/*英文名称*/
|
||||||
|
private String nameEn;
|
||||||
|
/*单位*/
|
||||||
|
private String unit;
|
||||||
|
/*最小值*/
|
||||||
|
private String min;
|
||||||
|
/*最大值*/
|
||||||
|
private String max;
|
||||||
|
/*分辨率*/
|
||||||
|
private String prec;
|
||||||
|
/*图标*/
|
||||||
|
private String url;
|
||||||
|
/*字典id*/
|
||||||
|
private String dictId;
|
||||||
|
/*pid*/
|
||||||
|
private String pid;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceEleVo {
|
||||||
|
private List<XphDeviceEleDetailVo> list;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceInfoVo {
|
||||||
|
/*设备编号*/
|
||||||
|
private Integer id;
|
||||||
|
/*设备编号*/
|
||||||
|
private Integer facId;
|
||||||
|
/*设备创建时间*/
|
||||||
|
private String createTime;
|
||||||
|
/*设备备注信息*/
|
||||||
|
private String remark;
|
||||||
|
/*设备名称*/
|
||||||
|
private String facName;
|
||||||
|
/*设备类型,0-为兼容 XPH 协议的设备,1-为虫情相关的设备*/
|
||||||
|
private Integer facType;
|
||||||
|
/*16 路要素通道的索引,以'/'分隔,需要解析为包含 16 个索引的数组,索引对应的具体要素见附录*/
|
||||||
|
private String eleNum;
|
||||||
|
/*16 路要素通道的名称,以'/'分隔,'-'则表示使用附录要素列表中的默认名称*/
|
||||||
|
private String eleName;
|
||||||
|
/*32 路继电器通道的索引,以'/'分隔,需要解析为包含 32 个索引的数组,索引对应的具体继电器见附录*/
|
||||||
|
private String relayNum;
|
||||||
|
/*32 路继电器通道的名称,以'/'分隔,'-'则表示使用附录继电器列表中的默认名称*/
|
||||||
|
private String relayName;
|
||||||
|
/*经度,具体格式为百度地图经纬度拾取中的格式*/
|
||||||
|
private Integer longitude;
|
||||||
|
/*纬度,具体格式为百度地图经纬度拾取中的格式*/
|
||||||
|
private Integer latitude;
|
||||||
|
/*平台读取实时数据的间隔,单位分钟,默认为 1*/
|
||||||
|
private Integer readInterval;
|
||||||
|
/**/
|
||||||
|
private Integer address;
|
||||||
|
/*是否有网络摄像头,目前只支持海康及萤石云的摄像头*/
|
||||||
|
private Boolean photo;
|
||||||
|
/*创建该用户的管理员 ID,可忽略*/
|
||||||
|
private Integer creatorId;
|
||||||
|
/*是否有扩展的继电器,若为 false,以下三项可忽略*/
|
||||||
|
private Boolean relayExtend;
|
||||||
|
/*扩展继电器数量*/
|
||||||
|
private Integer relayExtendCount;
|
||||||
|
/*扩展继电器通道的索引,以'/'分隔,具体个数为扩展继电器数量*/
|
||||||
|
private String relayExtendNum;
|
||||||
|
/*扩展继电器通道的名称,以'/'分隔,具体个数为扩展继电器数量*/
|
||||||
|
private String relayExtendName;
|
||||||
|
/*设备图片地址*/
|
||||||
|
private String coverUrl;
|
||||||
|
/**/
|
||||||
|
private Boolean elementExtend;
|
||||||
|
/**/
|
||||||
|
private String elementExtendNum;
|
||||||
|
/**/
|
||||||
|
private String elementExtendName;
|
||||||
|
/**/
|
||||||
|
private String sim;
|
||||||
|
/**/
|
||||||
|
private String weight;
|
||||||
|
/**/
|
||||||
|
private String facDescribe;
|
||||||
|
/**/
|
||||||
|
private String deviceType;
|
||||||
|
/**/
|
||||||
|
private Integer parkId;
|
||||||
|
/**/
|
||||||
|
private Boolean online;
|
||||||
|
/**/
|
||||||
|
private String relaysRelation;
|
||||||
|
/**/
|
||||||
|
private String video;
|
||||||
|
/**/
|
||||||
|
private String elementIndexList;
|
||||||
|
/**/
|
||||||
|
private String elementNameList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceNewestDataDetailVo {
|
||||||
|
private String datetime;
|
||||||
|
private JSONObject currentData;
|
||||||
|
private List<XphDeviceNewestDataEleVo> eleLists;
|
||||||
|
private List<XphDeviceNewestDataRelVo> relLists;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceNewestDataEleVo {
|
||||||
|
/*单位*/
|
||||||
|
private String eUnit;
|
||||||
|
/*图标*/
|
||||||
|
private String eUrl;
|
||||||
|
/*传感器值*/
|
||||||
|
private String eValue;
|
||||||
|
/*序号*/
|
||||||
|
private String eKey;
|
||||||
|
/*元素名称*/
|
||||||
|
private String eName;
|
||||||
|
/*元素字典*/
|
||||||
|
private String eNum;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceNewestDataRelVo {
|
||||||
|
/*继电器状态,中文*/
|
||||||
|
private String value;
|
||||||
|
/*继电器编号,j+序号,如j13*/
|
||||||
|
private String key;
|
||||||
|
/*继电器名称*/
|
||||||
|
private String name;
|
||||||
|
/*继电器类型*/
|
||||||
|
private Integer index;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceNewestDataVo {
|
||||||
|
/**
|
||||||
|
* 设备数据
|
||||||
|
*/
|
||||||
|
private List<XphDeviceNewestDataDetailVo> list;
|
||||||
|
/**
|
||||||
|
* 数据量
|
||||||
|
*/
|
||||||
|
private Integer total;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphDeviceQueryDataVo {
|
||||||
|
@ApiModelProperty("返回状态,200=正常")
|
||||||
|
private String statusCode;
|
||||||
|
@ApiModelProperty("状态说明")
|
||||||
|
private String message;
|
||||||
|
@ApiModelProperty("设备数据")
|
||||||
|
private List<XphdeviceQueryDetailVo> entity;
|
||||||
|
@ApiModelProperty("部署编号")
|
||||||
|
private String deviceId;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String deviceRemark;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.jeecg.common.iot.xph;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XphdeviceQueryDetailVo {
|
||||||
|
@ApiModelProperty("数据时间")
|
||||||
|
private String datetime;
|
||||||
|
@ApiModelProperty("单位")
|
||||||
|
private String eUnit;
|
||||||
|
@ApiModelProperty("数据值")
|
||||||
|
private String eValue;
|
||||||
|
@ApiModelProperty("序号,无意义")
|
||||||
|
private String eKey;
|
||||||
|
@ApiModelProperty("数据名称")
|
||||||
|
private String eName;
|
||||||
|
@ApiModelProperty("元素号,字典值,不一定唯一")
|
||||||
|
private String eNum;
|
||||||
|
@ApiModelProperty("pid")
|
||||||
|
private String pid;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,308 @@
|
||||||
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
|
|
||||||
|
import org.jeecg.common.constant.ToolConstant;
|
||||||
|
import org.jeecg.common.vo.statistic.CommonStatisticResultVo;
|
||||||
|
import org.jeecg.common.vo.statistic.CommonStatisticVo;
|
||||||
|
import org.jeecg.common.vo.statistic.YearMonthVo;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class CommonToolUtils {
|
||||||
|
|
||||||
|
public static String getString(String s) {
|
||||||
|
return (getString(s, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getString(Object s, String defval) {
|
||||||
|
if (isEmpty(s)) {
|
||||||
|
return (defval);
|
||||||
|
}
|
||||||
|
return (s.toString().trim());
|
||||||
|
}
|
||||||
|
public static boolean isEmpty(Object object) {
|
||||||
|
if (object == null) {
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
if ("".equals(object)) {
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
if (ToolConstant.STRING_NULL.equals(object)) {
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 将公共统计组装为数组
|
||||||
|
*/
|
||||||
|
public static CommonStatisticResultVo constructStatistic(List<CommonStatisticVo> statisticVoList){
|
||||||
|
CommonStatisticResultVo vo = new CommonStatisticResultVo();
|
||||||
|
if(statisticVoList != null && !statisticVoList.isEmpty()){
|
||||||
|
List<String> dataList = new ArrayList<>();
|
||||||
|
List<String> timeList = new ArrayList<>();
|
||||||
|
for (CommonStatisticVo commonStatisticVo : statisticVoList) {
|
||||||
|
dataList.add(commonStatisticVo.getSummaryData());
|
||||||
|
timeList.add(commonStatisticVo.getSummaryTime());
|
||||||
|
}
|
||||||
|
vo.setDataList(dataList);
|
||||||
|
vo.setTimeList(timeList);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将实体对象转换为Map
|
||||||
|
* @param object 实体对象
|
||||||
|
* @param ignoreNull 是否忽略null值
|
||||||
|
* @return 转换后的Map
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> convertToMap(Object object, boolean ignoreNull) {
|
||||||
|
if (object == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
try {
|
||||||
|
Class<?> clazz = object.getClass();
|
||||||
|
// 获取所有字段,包括私有字段
|
||||||
|
Field[] fields = getAllFields(clazz);
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true); // 设置可访问私有字段
|
||||||
|
Object value = field.get(object);
|
||||||
|
|
||||||
|
if (!ignoreNull || value != null) {
|
||||||
|
map.put(field.getName(), value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException("转换实体到Map时发生错误", e);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类及其父类的所有字段
|
||||||
|
* @param clazz 类
|
||||||
|
* @return 字段数组
|
||||||
|
*/
|
||||||
|
private static Field[] getAllFields(Class<?> clazz) {
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
|
||||||
|
// 如果有父类,递归获取父类的字段
|
||||||
|
Class<?> superClass = clazz.getSuperclass();
|
||||||
|
if (superClass != null && superClass != Object.class) {
|
||||||
|
Field[] superFields = getAllFields(superClass);
|
||||||
|
Field[] combinedFields = new Field[fields.length + superFields.length];
|
||||||
|
System.arraycopy(fields, 0, combinedFields, 0, fields.length);
|
||||||
|
System.arraycopy(superFields, 0, combinedFields, fields.length, superFields.length);
|
||||||
|
return combinedFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成时间戳+2位随机数的字符串
|
||||||
|
* 格式:yyyyMMddHHmmssSSS + 2位随机数
|
||||||
|
* 示例:2023051512304598712 (17位时间戳 + 2位随机数 = 19位)
|
||||||
|
*
|
||||||
|
* @return 时间戳+随机数的字符串
|
||||||
|
*/
|
||||||
|
public static String generateTimestampRandom() {
|
||||||
|
// 获取当前时间戳(精确到毫秒)
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||||
|
String timestamp = sdf.format(new Date());
|
||||||
|
|
||||||
|
// 生成2位随机数
|
||||||
|
Random random = new Random();
|
||||||
|
int randomNum = random.nextInt(100); // 生成0-99的随机数
|
||||||
|
String randomStr = String.format("%02d", randomNum); // 格式化为2位数
|
||||||
|
|
||||||
|
return timestamp + randomStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载图片到指定目录,并返回图片文件名
|
||||||
|
* @param imageUrl 图片的URL地址
|
||||||
|
* @param saveDir 保存图片的本地目录
|
||||||
|
* @return 图片文件名(不包含路径),下载失败时返回null
|
||||||
|
*/
|
||||||
|
public static String downloadImage(String imageUrl, String saveDir) {
|
||||||
|
String fileName = null;
|
||||||
|
InputStream in = null;
|
||||||
|
FileOutputStream out = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取文件名
|
||||||
|
fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1);
|
||||||
|
// 如果URL后没有文件名,则生成一个随机文件名
|
||||||
|
if (fileName.isEmpty() || !fileName.contains(".")) {
|
||||||
|
fileName = "img_" + System.currentTimeMillis() + ".jpg";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建保存目录
|
||||||
|
File dir = new File(saveDir);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建连接
|
||||||
|
URL url = new URL(imageUrl);
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setConnectTimeout(10000);
|
||||||
|
conn.setReadTimeout(10000);
|
||||||
|
conn.setRequestMethod("GET");
|
||||||
|
conn.connect();
|
||||||
|
|
||||||
|
// 检查响应码
|
||||||
|
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
in = conn.getInputStream();
|
||||||
|
out = new FileOutputStream(new File(dir, fileName));
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int len;
|
||||||
|
while ((len = in.read(buffer)) != -1) {
|
||||||
|
out.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
out.flush();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fileName = null;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (in != null) in.close();
|
||||||
|
if (out != null) out.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对传入的 URL 字符串进行编码。
|
||||||
|
* 使用 java.net.URLEncoder.encode 方法,将 URL 中的非 ASCII 字符和特殊字符转换为百分号编码格式,
|
||||||
|
* 以确保 URL 在网络传输中的安全性和正确性。
|
||||||
|
*
|
||||||
|
* @param url 原始 URL 字符串
|
||||||
|
* @return 编码后的 URL 字符串,如果发生异常则返回 null
|
||||||
|
*/
|
||||||
|
public static String encodeUrl(String url) {
|
||||||
|
if (url == null) {
|
||||||
|
System.err.println("输入的 URL 不能为 null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 使用 UTF-8 编码方式进行 URL 编码
|
||||||
|
return URLEncoder.encode(url, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// 捕获不支持的编码异常并打印错误信息
|
||||||
|
System.err.println("不支持的编码格式:UTF-8");
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对传入的编码后的 URL 字符串进行解码。
|
||||||
|
* 使用 java.net.URLDecoder.decode 方法,将编码后的 URL 转换回原始格式,
|
||||||
|
* 使程序能够正确处理其中的中文、空格和特殊字符。
|
||||||
|
*
|
||||||
|
* @param url 编码后的 URL 字符串
|
||||||
|
* @return 解码后的原始 URL 字符串,如果发生异常则返回 null
|
||||||
|
*/
|
||||||
|
public static String decodeUrl(String url) {
|
||||||
|
if (url == null) {
|
||||||
|
System.err.println("输入的编码 URL 不能为 null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 使用 UTF-8 编码方式进行 URL 解码
|
||||||
|
return URLDecoder.decode(url, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// 捕获不支持的编码异常并打印错误信息
|
||||||
|
System.err.println("不支持的编码格式:UTF-8");
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取月份的第一天和最后一天,传入示例 2025-08
|
||||||
|
* @param yearMonth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static YearMonthVo getStartAndEnd(String yearMonth){
|
||||||
|
YearMonthVo yearMonthVo = new YearMonthVo();
|
||||||
|
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime month = LocalDateTime.parse(yearMonth+"-01 00:00:00",sdf);
|
||||||
|
YearMonth yearMonths = YearMonth.from(month);
|
||||||
|
// 获取月份的第一天
|
||||||
|
LocalDateTime firstDay = yearMonths.atDay(1).atTime(month.toLocalTime());
|
||||||
|
LocalDateTime lastDay = yearMonths.atEndOfMonth().atTime(month.toLocalTime());
|
||||||
|
yearMonthVo.setStartOfMonth(firstDay);
|
||||||
|
yearMonthVo.setEndOfMonth(lastDay);
|
||||||
|
return yearMonthVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YearMonthVo getStartAndEnd(LocalDateTime month){
|
||||||
|
YearMonthVo yearMonthVo = new YearMonthVo();
|
||||||
|
YearMonth yearMonths = YearMonth.from(month);
|
||||||
|
// 获取月份的第一天
|
||||||
|
LocalDateTime firstDay = yearMonths.atDay(1).atTime(month.toLocalTime());
|
||||||
|
LocalDateTime lastDay = yearMonths.atEndOfMonth().atTime(month.toLocalTime());
|
||||||
|
yearMonthVo.setStartOfMonth(firstDay);
|
||||||
|
yearMonthVo.setEndOfMonth(lastDay);
|
||||||
|
return yearMonthVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getStartOfMonth(LocalDateTime localDateTime) {
|
||||||
|
YearMonth yearMonths = YearMonth.from(localDateTime);
|
||||||
|
// 获取月份的第一天
|
||||||
|
LocalDateTime firstDay = yearMonths.atDay(1).atTime(localDateTime.toLocalTime());
|
||||||
|
return firstDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime getEndOfMonth(LocalDateTime localDateTime) {
|
||||||
|
YearMonth yearMonths = YearMonth.from(localDateTime);
|
||||||
|
// 获取月份的最后一天
|
||||||
|
LocalDateTime lastDay = yearMonths.atEndOfMonth().atTime(localDateTime.toLocalTime());
|
||||||
|
return lastDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Object> beanToMap(Object obj, boolean includeNullValues) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
Class<?> clazz = obj.getClass();
|
||||||
|
// 遍历所有字段,包括父类的字段
|
||||||
|
while (clazz != null) {
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object value = field.get(obj);
|
||||||
|
if (includeNullValues || value != null) {
|
||||||
|
map.put(field.getName(), value);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// 忽略无法访问的字段
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clazz = clazz.getSuperclass();
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.jeecg.common.util;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
public class TreeUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public static JSONArray getTree(JSONArray src, String pid, String idName, String pidName) {
|
||||||
|
JSONArray res = new JSONArray();
|
||||||
|
for (int i = 0, n = src.size(); i < n; i++) {
|
||||||
|
JSONObject o = src.getJSONObject(i);
|
||||||
|
if (o.getString(pidName).equals(pid)) {
|
||||||
|
// JSONObject vo = new JSONObject();
|
||||||
|
// BeanUtils.copyProperties(f, vo);
|
||||||
|
res.add(o);
|
||||||
|
JSONArray tree = getTree(src, o.getString(idName), idName, pidName);
|
||||||
|
o.put("children", tree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.common.vo.iot.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jeecg.common.entity.SurvDictDeviceCate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VODeviceCategoryTree extends SurvDictDeviceCate {
|
||||||
|
|
||||||
|
private List<VODeviceCategoryTree> children;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.jeecg.common.vo.iot.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VOIotAccess {
|
||||||
|
private String appId;
|
||||||
|
private String appSecret;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.jeecg.common.vo.statistic;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共统计实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommonStatisticResultVo {
|
||||||
|
@ApiModelProperty("纵轴数据")
|
||||||
|
private List<String> dataList = new ArrayList<>();
|
||||||
|
@ApiModelProperty("纵轴数据2")
|
||||||
|
private List<String> dataTwoList = new ArrayList<>();
|
||||||
|
@ApiModelProperty("纵轴数据量")
|
||||||
|
private List<String> countsList = new ArrayList<>();
|
||||||
|
@ApiModelProperty("同比增长量")
|
||||||
|
private List<String> tb = new ArrayList<>();
|
||||||
|
@ApiModelProperty("环比增长量")
|
||||||
|
private List<String> hb = new ArrayList<>();
|
||||||
|
@ApiModelProperty("横轴数据")
|
||||||
|
private List<String> timeList = new ArrayList<>();
|
||||||
|
@ApiModelProperty("横轴数据")
|
||||||
|
private List<String> timeList2 = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.jeecg.common.vo.statistic;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共统计实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommonStatisticVo {
|
||||||
|
@ApiModelProperty("纵轴数据")
|
||||||
|
private String summaryData;
|
||||||
|
@ApiModelProperty("横轴数据")
|
||||||
|
private String summaryTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.jeecg.common.vo.statistic;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class YearMonthVo {
|
||||||
|
private LocalDateTime startOfMonth;
|
||||||
|
private LocalDateTime endOfMonth;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue