物联bug处理。
This commit is contained in:
parent
04104f23ee
commit
21ab1355a1
|
|
@ -195,6 +195,12 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
CameraInfo entity = baseMapper.getByDeviceId(cameraInfo);
|
||||
if(entity==null){
|
||||
//新增
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||
cameraInfo.setFtpPort(tumsConfig.getFtpPort());
|
||||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||
baseMapper.insert(cameraInfo);
|
||||
}else{
|
||||
//修改
|
||||
|
|
@ -350,6 +356,12 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
CameraInfo entity = baseMapper.getByDeviceId(cameraInfo);
|
||||
if(entity==null){
|
||||
//新增
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode();
|
||||
cameraInfo.setFtpIp(tumsConfig.getFtpIp());
|
||||
cameraInfo.setFtpPort(tumsConfig.getFtpPort());
|
||||
cameraInfo.setFtpUsername(tumsConfig.getFtpUsername());
|
||||
cameraInfo.setFtpPassword(tumsConfig.getFtpPassword());
|
||||
cameraInfo.setFtpUploadpath(tumsConfig.getFtpUploadpath());
|
||||
baseMapper.insert(cameraInfo);
|
||||
}else{
|
||||
//修改
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@ public class TqConfig implements Serializable {
|
|||
private String updateDate; //更新时间
|
||||
@TableField(exist = false)
|
||||
private String orgName; //机构名称
|
||||
private String sysFlag; //平台标识 0运维平台 1业务平台
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@
|
|||
auth_code as authCode,
|
||||
random_code as randomCode,
|
||||
notify_url as notifyUrl,
|
||||
update_date as updateDate
|
||||
update_date as updateDate,
|
||||
sys_flag as sysFlag
|
||||
from nu_iot_tq_config
|
||||
where org_code is null
|
||||
where sys_flag = '0'
|
||||
order by id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
|
@ -25,7 +26,8 @@
|
|||
a.notify_url as notifyUrl,
|
||||
a.org_code as orgCode,
|
||||
a.update_date as updateDate,
|
||||
b.depart_name as orgName
|
||||
b.depart_name as orgName,
|
||||
a.sys_flag as sysFlag
|
||||
from nu_iot_tq_config a
|
||||
left join sys_depart b on a.org_code = b.org_code
|
||||
order by a.id asc
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@ import com.nu.modules.weihu.service.DeviceMaintainService;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -64,4 +67,61 @@ public class DeviceMaintainController extends JeecgController<DeviceMaintain, De
|
|||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/remarksList")
|
||||
public Result<IPage<DeviceMaintain>> remarksList(DeviceMaintain deviceInfo,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceMaintain> page = new Page<DeviceMaintain>(pageNo, pageSize);
|
||||
IPage<DeviceMaintain> pageList = service.findRemarksPage(page, deviceInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DeviceMaintain deviceInfo) {
|
||||
String updateDate = DateUtils.formatDate("yyyy-MM-dd HH:mm:ss");
|
||||
deviceInfo.setUpdateDate(updateDate);
|
||||
service.save(deviceInfo);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.nu.modules.weihu.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.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
|
@ -22,6 +19,8 @@ public class DeviceMaintain implements Serializable {
|
|||
private String deviceId;//设备编码
|
||||
private String remark;//备注
|
||||
private String updateDate;//更新时间
|
||||
@TableLogic
|
||||
private String delFlag;//删除标记
|
||||
@TableField(exist = false)
|
||||
private String sn;//设备SN号
|
||||
@TableField(exist = false)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ public interface DeviceMaintainMapper extends BaseMapper<DeviceMaintain> {
|
|||
IPage<DeviceMaintain> findPage(Page<DeviceMaintain> page, @Param("params") DeviceMaintain deviceInfo);
|
||||
List<DeviceMaintain> queryDepartList(DeviceMaintain deviceInfo);
|
||||
List<DeviceMaintain> queryNuList(DeviceMaintain deviceInfo);
|
||||
IPage<DeviceMaintain> findRemarksPage(Page<DeviceMaintain> page, @Param("params") DeviceMaintain deviceInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@
|
|||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_iot_weihu_info b on a.mac = b.device_id
|
||||
left join nu_iot_weihu_info b on a.mac = b.device_id and b.id = (
|
||||
select id from nu_iot_weihu_info c where a.mac = c.device_id order by c.update_date desc limit 1
|
||||
)
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.sn = #{params.sn}
|
||||
|
|
@ -57,7 +59,9 @@
|
|||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tq_electricity_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id and b.id = (
|
||||
select id from nu_iot_weihu_info c where a.cid = c.device_id order by c.update_date desc limit 1
|
||||
)
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.cid = #{params.sn}
|
||||
|
|
@ -95,7 +99,9 @@
|
|||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tq_water_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id and b.id = (
|
||||
select id from nu_iot_weihu_info c where a.cid = c.device_id order by c.update_date desc limit 1
|
||||
)
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.cid = #{params.sn}
|
||||
|
|
@ -133,7 +139,9 @@
|
|||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
left join nu_iot_weihu_info b on a.sn = b.device_id
|
||||
left join nu_iot_weihu_info b on a.sn = b.device_id and b.id = (
|
||||
select id from nu_iot_weihu_info c where a.sn = c.device_id order by c.update_date desc limit 1
|
||||
)
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.sn = #{params.sn}
|
||||
|
|
@ -182,4 +190,93 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findRemarksPage" parameterType="com.nu.modules.weihu.entity.DeviceMaintain" resultType="com.nu.modules.weihu.entity.DeviceMaintain">
|
||||
select * from (
|
||||
select
|
||||
b.id,
|
||||
a.mac as deviceId,
|
||||
a.sn,
|
||||
b.type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName,
|
||||
b.del_flag as delFlag
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_iot_weihu_info b on a.mac = b.device_id
|
||||
<where>
|
||||
<if test="params.deviceId != null and params.deviceId != ''">
|
||||
AND b.device_id = #{params.deviceId}
|
||||
</if>
|
||||
<if test="params.delFlag != null and params.delFlag != ''">
|
||||
AND b.del_flag = #{params.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
b.id,
|
||||
a.cid as deviceId,
|
||||
a.cid as sn,
|
||||
b.type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName,
|
||||
b.del_flag as delFlag
|
||||
from nu_iot_tq_electricity_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
<where>
|
||||
<if test="params.deviceId != null and params.deviceId != ''">
|
||||
AND b.device_id = #{params.deviceId}
|
||||
</if>
|
||||
<if test="params.delFlag != null and params.delFlag != ''">
|
||||
AND b.del_flag = #{params.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
b.id,
|
||||
a.cid as deviceId,
|
||||
a.cid as sn,
|
||||
b.type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName,
|
||||
b.del_flag as delFlag
|
||||
from nu_iot_tq_water_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
<where>
|
||||
<if test="params.deviceId != null and params.deviceId != ''">
|
||||
AND b.device_id = #{params.deviceId}
|
||||
</if>
|
||||
<if test="params.delFlag != null and params.delFlag != ''">
|
||||
AND b.del_flag = #{params.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
b.id,
|
||||
a.sn as deviceId,
|
||||
a.sn as sn,
|
||||
b.type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName,
|
||||
b.del_flag as delFlag
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
left join nu_iot_weihu_info b on a.sn = b.device_id
|
||||
<where>
|
||||
<if test="params.deviceId != null and params.deviceId != ''">
|
||||
AND b.device_id = #{params.deviceId}
|
||||
</if>
|
||||
<if test="params.delFlag != null and params.delFlag != ''">
|
||||
AND b.del_flag = #{params.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
) t
|
||||
order by t.updateDate desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -12,4 +12,5 @@ public interface DeviceMaintainService extends IService<DeviceMaintain> {
|
|||
void saveSendOrg(DeviceMaintain deviceInfo);
|
||||
List<DeviceMaintain> queryDepartList(DeviceMaintain deviceInfo);
|
||||
List<DeviceMaintain> queryNuList(DeviceMaintain deviceInfo);
|
||||
IPage<DeviceMaintain> findRemarksPage(Page<DeviceMaintain> page, DeviceMaintain deviceInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,5 +127,10 @@ public class DeviceMaintainServiceImpl extends ServiceImpl<DeviceMaintainMapper,
|
|||
public List<DeviceMaintain> queryNuList(DeviceMaintain deviceInfo){
|
||||
return baseMapper.queryNuList(deviceInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceMaintain> findRemarksPage(Page<DeviceMaintain> page, DeviceMaintain deviceInfo){
|
||||
return baseMapper.findRemarksPage(page,deviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue