设备登记界面查询调整
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.csdevice.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
@@ -25,5 +26,10 @@ public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliver
|
||||
|
||||
Page<CsEquipmentDeliveryVO> page(Page<CsEquipmentDeliveryPO> returnpage, @Param("ew") QueryWrapper<CsEquipmentDeliveryPO> queryWrapper);
|
||||
|
||||
//获取符合条件的设备列表
|
||||
List<CsEquipmentDeliveryVO> getList(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
||||
|
||||
//获取符合条件的设备数量
|
||||
int getCounts(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
||||
|
||||
}
|
||||
@@ -87,5 +87,34 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="CsEquipmentDeliveryVO">
|
||||
select
|
||||
*
|
||||
from
|
||||
cs_equipment_delivery
|
||||
where
|
||||
process = #{queryParam.process}
|
||||
<if test="queryParam.runStatus != null and queryParam.runStatus !=''">
|
||||
and run_status = #{queryParam.runStatus}
|
||||
</if>
|
||||
<if test="queryParam.searchValue != null and queryParam.searchValue !=''">
|
||||
and (name like concat('%',#{queryParam.searchValue},'%') or ndid like concat('%',#{queryParam.searchValue},'%'))
|
||||
</if>
|
||||
limit #{queryParam.pageNum},#{queryParam.pageSize}
|
||||
</select>
|
||||
|
||||
<select id="getCounts" resultType="int">
|
||||
select
|
||||
count(1)
|
||||
from
|
||||
cs_equipment_delivery
|
||||
where
|
||||
process = #{queryParam.process}
|
||||
<if test="queryParam.runStatus != null and queryParam.runStatus !=''">
|
||||
and run_status = #{queryParam.runStatus}
|
||||
</if>
|
||||
<if test="queryParam.searchValue != null and queryParam.searchValue !=''">
|
||||
and (name like concat('%',#{queryParam.searchValue},'%') or ndid like concat('%',#{queryParam.searchValue},'%'))
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,9 +6,9 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -35,7 +35,6 @@ import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csdevice.util.QRCodeUtil;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.csdevice.utils.StringUtil;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
@@ -46,7 +45,6 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -292,71 +290,109 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//部门根据名称模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("cs_equipment_delivery.name", queryParam.getSearchValue())
|
||||
.or().like("cs_equipment_delivery.ndid", queryParam.getSearchValue())
|
||||
.or().like("cs_equipment_delivery.mac", queryParam.getSearchValue()));
|
||||
Page<CsEquipmentDeliveryVO> page = new Page<> ();
|
||||
page.setCurrent(queryParam.getPageNum());
|
||||
page.setSize(queryParam.getPageSize());
|
||||
queryParam.setPageNum((queryParam.getPageNum()-1)*queryParam.getPageSize());
|
||||
int total = this.baseMapper.getCounts(queryParam);
|
||||
if (total > 0) {
|
||||
List<CsEquipmentDeliveryVO> recordList = this.baseMapper.getList(queryParam);
|
||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : recordList){
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||
csEquipmentDeliveryVO.setStatus(5);
|
||||
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||
csEquipmentDeliveryVO.setStatus(6);
|
||||
}
|
||||
//判断装置是否已经连接上mqtt服务器
|
||||
String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (mqttClient) {
|
||||
csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||
} else {
|
||||
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||
}
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//默认根据创建时间排序
|
||||
queryWrapper.orderBy(true, false, "create_time");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevType()) && !Objects.isNull(queryParam.getDevType())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_type", queryParam.getDevType());
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevModel()) && !Objects.isNull(queryParam.getDevModel())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
||||
}
|
||||
if (!Objects.isNull(queryParam.getStatus())){
|
||||
queryWrapper.eq("cs_equipment_delivery.status", queryParam.getStatus());
|
||||
} else {
|
||||
queryWrapper.in("cs_equipment_delivery.status", Arrays.asList(1,2,3));
|
||||
}
|
||||
if (!Objects.isNull(queryParam.getRunStatus())){
|
||||
queryWrapper.eq("cs_equipment_delivery.run_status", queryParam.getRunStatus());
|
||||
} else {
|
||||
queryWrapper.in("cs_equipment_delivery.run_status", Arrays.asList(1,2));
|
||||
}
|
||||
if (!Objects.isNull(queryParam.getProcess())){
|
||||
queryWrapper.eq("cs_equipment_delivery.process", queryParam.getProcess());
|
||||
}
|
||||
Page<CsEquipmentDeliveryVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
page.getRecords().forEach(item->{
|
||||
if (!Objects.isNull(item.getQrPath())){
|
||||
item.setQrPath(item.getQrPath());
|
||||
}
|
||||
});
|
||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||
csEquipmentDeliveryVO.setStatus(5);
|
||||
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||
csEquipmentDeliveryVO.setStatus(6);
|
||||
}
|
||||
//判断装置是否已经连接上mqtt服务器
|
||||
String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (mqttClient) {
|
||||
csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||
} else {
|
||||
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
||||
recordList = recordList.stream()
|
||||
.filter(item -> queryParam.getConnectStatus() == 0
|
||||
? "未连接".equals(item.getConnectStatus())
|
||||
: "已连接".equals(item.getConnectStatus()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
||||
page.setRecords(recordList);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||
// QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
||||
// if (ObjectUtil.isNotNull(queryParam)) {
|
||||
// //查询参数不为空,进行条件填充
|
||||
// if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
// //部门根据名称模糊查询
|
||||
// queryWrapper
|
||||
// .and(param -> param.like("cs_equipment_delivery.name", queryParam.getSearchValue())
|
||||
// .or().like("cs_equipment_delivery.ndid", queryParam.getSearchValue())
|
||||
// .or().like("cs_equipment_delivery.mac", queryParam.getSearchValue()));
|
||||
// }
|
||||
// //排序
|
||||
// if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
// queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
// } else {
|
||||
// //默认根据创建时间排序
|
||||
// queryWrapper.orderBy(true, false, "create_time");
|
||||
// }
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(queryParam.getDevType()) && !Objects.isNull(queryParam.getDevType())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.dev_type", queryParam.getDevType());
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(queryParam.getDevModel()) && !Objects.isNull(queryParam.getDevModel())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
||||
// }
|
||||
// if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
||||
// }
|
||||
// if (!Objects.isNull(queryParam.getStatus())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.status", queryParam.getStatus());
|
||||
// } else {
|
||||
// queryWrapper.in("cs_equipment_delivery.status", Arrays.asList(1,2,3));
|
||||
// }
|
||||
// if (!Objects.isNull(queryParam.getRunStatus())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.run_status", queryParam.getRunStatus());
|
||||
// } else {
|
||||
// queryWrapper.in("cs_equipment_delivery.run_status", Arrays.asList(1,2));
|
||||
// }
|
||||
// if (!Objects.isNull(queryParam.getProcess())){
|
||||
// queryWrapper.eq("cs_equipment_delivery.process", queryParam.getProcess());
|
||||
// }
|
||||
// Page<CsEquipmentDeliveryVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
// page.getRecords().forEach(item->{
|
||||
// if (!Objects.isNull(item.getQrPath())){
|
||||
// item.setQrPath(item.getQrPath());
|
||||
// }
|
||||
// });
|
||||
// //新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||
// for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||
// if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||
// csEquipmentDeliveryVO.setStatus(5);
|
||||
// } else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||
// csEquipmentDeliveryVO.setStatus(6);
|
||||
// }
|
||||
// //判断装置是否已经连接上mqtt服务器
|
||||
// String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||
// boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
// if (mqttClient) {
|
||||
// csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||
// } else {
|
||||
// csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||
// }
|
||||
// }
|
||||
// return page;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||
|
||||
Reference in New Issue
Block a user