增加设备接口

This commit is contained in:
zy 2025-11-18 15:09:00 +08:00
parent cb690481ce
commit 218ad62bce
10 changed files with 86 additions and 7 deletions

View File

@ -2,11 +2,15 @@ package org.jeecg.modules.appmana.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.entity.SurvConfig;
import org.jeecg.common.vo.dict.DictVo;
import org.jeecg.modules.appmana.service.ISurvConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -38,7 +42,7 @@ import org.jeecg.common.system.util.JwtUtil;
public class SurvConfigController extends JeecgController<SurvConfig, ISurvConfigService> {
@Autowired
private ISurvConfigService survConfigService;
/**
* 分页列表查询
*
@ -58,6 +62,16 @@ public class SurvConfigController extends JeecgController<SurvConfig, ISurvConfi
QueryWrapper<SurvConfig> queryWrapper = QueryGenerator.initQueryWrapper(survConfig, req.getParameterMap());
Page<SurvConfig> page = new Page<SurvConfig>(pageNo, pageSize);
IPage<SurvConfig> pageList = survConfigService.page(page, queryWrapper);
//补充字典
if(!pageList.getRecords().isEmpty()){
List<String> types = pageList.getRecords().stream().map(SurvConfig::getConfigType).collect(Collectors.toList());
List<DictVo> maps = survConfigService.getDictByCode("apply_config_type");
// maps.stream().collect(Collectors.toMap())
for (SurvConfig record : pageList.getRecords()) {
}
}
return Result.OK(pageList);
}

View File

@ -3,6 +3,10 @@ package org.jeecg.modules.appmana.mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.entity.SurvConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.common.vo.dict.DictVo;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @Description: 业务参数配置表
@ -16,4 +20,6 @@ public interface SurvConfigMapper extends BaseMapper<SurvConfig> {
SurvConfig getOneByTypeWithTenant(@Param("tenantId") String tenantId, @Param("type") String type);
List<DictVo> getDictByCode(String applyConfigType);
}

View File

@ -2,14 +2,21 @@
<!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.SurvConfigMapper">
<select id="getValueByKey" resultType="java.lang.String">
select CONFIG_VALUE from surv_config where CONFIG_KEY = #{key}
<select id="getValueByKey" resultType="java.lang.String">
select CONFIG_VALUE from surv_config where CONFIG_KEY = #{key}
</select>
<select id="getOneByTypeWithTenant" resultType="org.jeecg.common.entity.SurvConfig">
<select id="getOneByTypeWithTenant" resultType="org.jeecg.common.entity.SurvConfig">
select *
from surv_config
where CONFIG_TYPE = #{type}
AND TENANT_ID = #{tenantId} limit 1
</select>
</select>
<select id="getDictByCode" resultType="org.jeecg.common.vo.dict.DictVo">
select s.item_value as "value",s.item_text as "text" from sys_dict_item s
where dict_id = (select id from sys_dict where dict_code = #{code})
and s.status = 1
order by s.sort_order asc, s.create_time DESC;
</select>
</mapper>

View File

@ -11,6 +11,7 @@
<result property="maintainPerson" column="MAINTAIN_PERSON" jdbcType="VARCHAR"/>
<result property="maintainData1" column="MAINTAIN_DATA1" jdbcType="VARCHAR"/>
<result property="maintainData2" column="MAINTAIN_DATA2" jdbcType="VARCHAR"/>
<result property="maintainData3" column="MAINTAIN_DATA3" jdbcType="VARCHAR"/>
<result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
<result property="reVision" column="RE_VISION" jdbcType="INTEGER"/>
<result property="createdBy" column="CREATED_BY" jdbcType="VARCHAR"/>
@ -22,7 +23,7 @@
<association property="omName" select="getOmname" column="ITEM_ID"/>
</resultMap>
<sql id="basesql">ID,STATION_CODE,ITEM_ID,MAINTAIN_TIME,MAINTAIN_NOTE,MAINTAIN_PERSON,MAINTAIN_DATA1,MAINTAIN_DATA2,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME</sql>
<sql id="basesql">ID,STATION_CODE,ITEM_ID,MAINTAIN_TIME,MAINTAIN_NOTE,MAINTAIN_PERSON,MAINTAIN_DATA1,MAINTAIN_DATA2,MAINTAIN_DATA3,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME</sql>
<select id="getStationName" resultType="String">
select STATION_NAME from surv_station_info where STATION_CODE = #{STATION_CODE}

View File

@ -3,8 +3,12 @@ package org.jeecg.modules.appmana.service;
import org.jeecg.common.constant.IotConstants;
import org.jeecg.common.entity.SurvConfig;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.vo.dict.DictVo;
import org.springframework.cache.annotation.Cacheable;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @Description: 业务参数配置表
* @Author: jeecg-boot
@ -22,4 +26,6 @@ public interface ISurvConfigService extends IService<SurvConfig> {
SurvConfig getConfigById(String survConfigId);
long getOfflineConfig(String tenantId,String deployType);
List<DictVo> getDictByCode(String applyConfigType);
}

View File

@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.IotConstants;
import org.jeecg.common.constant.PollutionConstants;
import org.jeecg.common.entity.SurvConfig;
import org.jeecg.common.vo.dict.DictVo;
import org.jeecg.modules.appmana.mapper.SurvConfigMapper;
import org.jeecg.modules.appmana.service.ISurvConfigService;
import org.springframework.cache.annotation.Cacheable;
@ -11,6 +12,10 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @Description: 业务参数配置表
* @Author: jeecg-boot
@ -84,4 +89,9 @@ public class SurvConfigServiceImpl extends ServiceImpl<SurvConfigMapper, SurvCon
return defaultTime;
//}
}
@Override
public List<DictVo> getDictByCode(String applyConfigType) {
return baseMapper.getDictByCode(applyConfigType);
}
}

View File

@ -68,4 +68,26 @@ public class SurvDeviceDeployController {
return R.ok(deploys);
}
/**
* 设备列表
*
* @return
*/
@ApiOperation(value="设备列表", notes="设备列表")
@GetMapping(value = "/deviceList")
@ApiLogin
public R<List<SurvDeviceDeploy>> deviceList(@RequestParam(name = "stationCode")String stationCode) {
List<String> deployTypes = new ArrayList<>();
deployTypes.add(PollutionConstants.CAMERA);
deployTypes.add(PollutionConstants.AIR_SURV);
deployTypes.add(PollutionConstants.SOIL_SURV);
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes);
return R.ok(deploys);
}
}

View File

@ -11,6 +11,7 @@
<result property="maintainPerson" column="MAINTAIN_PERSON" jdbcType="VARCHAR"/>
<result property="maintainData1" column="MAINTAIN_DATA1" jdbcType="VARCHAR"/>
<result property="maintainData2" column="MAINTAIN_DATA2" jdbcType="VARCHAR"/>
<result property="maintainData3" column="MAINTAIN_DATA3" jdbcType="VARCHAR"/>
<result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
<result property="reVision" column="RE_VISION" jdbcType="INTEGER"/>
<result property="createdBy" column="CREATED_BY" jdbcType="VARCHAR"/>
@ -22,7 +23,7 @@
<association property="omName" select="getOmname" column="ITEM_ID"/>
</resultMap>
<sql id="basesql">ID,STATION_CODE,ITEM_ID,MAINTAIN_TIME,MAINTAIN_NOTE,MAINTAIN_PERSON,MAINTAIN_DATA1,MAINTAIN_DATA2,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME</sql>
<sql id="basesql">ID,STATION_CODE,ITEM_ID,MAINTAIN_TIME,MAINTAIN_NOTE,MAINTAIN_PERSON,MAINTAIN_DATA1,MAINTAIN_DATA2,MAINTAIN_DATA3,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME</sql>
<select id="getStationName" resultType="String">
select STATION_NAME from surv_station_info where STATION_CODE = #{STATION_CODE}

View File

@ -117,4 +117,7 @@ public class SurvConfig implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private java.util.Date updatedTime;
@TableField(exist = false)
private String configTypeName;
}

View File

@ -0,0 +1,9 @@
package org.jeecg.common.vo.dict;
import lombok.Data;
@Data
public class DictVo {
private String value;
private String text;
}