|
|
|
|
@ -1,11 +1,10 @@ |
|
|
|
|
/** |
|
|
|
|
* Author: Tom Shuo |
|
|
|
|
*/ |
|
|
|
|
package org.springblade.desk.quality.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
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.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
@ -18,8 +17,8 @@ import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.EqualsAndHashCode; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.boot.file.BladeFileUtil; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
@ -27,12 +26,12 @@ import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.WebUtil; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.device.pojo.entity.EquipmentEntity; |
|
|
|
|
import org.springblade.desk.device.service.IEquipmentService; |
|
|
|
|
import org.springblade.desk.quality.constant.QAModuleConst; |
|
|
|
|
import org.springblade.desk.quality.excel.IotThicknessExcel; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.IotHardness; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.IotThickness; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.IotThicknessVO; |
|
|
|
|
import org.springblade.desk.quality.service.IIotThicknessService; |
|
|
|
|
@ -42,7 +41,6 @@ import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
import java.net.InetAddress; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
@ -120,51 +118,32 @@ public class IotThicknessController extends BladeController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/queryChyData") |
|
|
|
|
public R queryChyData(@RequestBody JSONObject data) throws Exception { |
|
|
|
|
InetAddress inetAddress = InetAddress.getLocalHost(); |
|
|
|
|
String ip = inetAddress.getHostAddress(); |
|
|
|
|
// ip = "192.168.134.115";
|
|
|
|
|
|
|
|
|
|
QueryWrapper<EquipmentEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("DEVICE_IP",ip); |
|
|
|
|
EquipmentEntity card = equipmentService.getOne(qw); |
|
|
|
|
public R queryChyData(@RequestBody JSONObject data) { |
|
|
|
|
String ip = WebUtil.getIP(); |
|
|
|
|
List<EquipmentEntity> list = equipmentService.list(Wrappers.lambdaQuery(EquipmentEntity.class).eq(EquipmentEntity::getDeviceIp, ip)); |
|
|
|
|
//根据ip查询设备
|
|
|
|
|
if (card == null) { |
|
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
|
return R.fail(-2, "ip未找到对应的测量仪设备!" + ip); |
|
|
|
|
} |
|
|
|
|
String deviceCode = card.getDeviceCode(); |
|
|
|
|
String deviceCode = list.get(0).getDeviceCode(); |
|
|
|
|
log.info("找到设备,设备编码: {}", deviceCode); |
|
|
|
|
|
|
|
|
|
Date startTime = data.getDate("startTime"); |
|
|
|
|
Date endTime = data.getDate("endTime"); |
|
|
|
|
Boolean allData = data.getBoolean("allData"); |
|
|
|
|
|
|
|
|
|
List<IotThickness> qcHardnessIotList = new ArrayList<>(); |
|
|
|
|
LambdaQueryWrapper<IotThickness> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(IotThickness::getEquipmentCode, deviceCode); |
|
|
|
|
if (allData) { |
|
|
|
|
// sb.append(" and not_use = 0");
|
|
|
|
|
QueryWrapper<IotThickness> qwhard = new QueryWrapper<>(); |
|
|
|
|
// qwhard.eq("EQUIPMENT_CODE","LG020029");
|
|
|
|
|
qwhard.eq("EQUIPMENT_CODE",card.getDeviceCode()); |
|
|
|
|
qwhard.eq("FLAG_READ",0); |
|
|
|
|
if(startTime != null && endTime != null){ |
|
|
|
|
qwhard.between("CREATE_TIME", startTime, endTime); |
|
|
|
|
} |
|
|
|
|
qwhard.orderByDesc("CREATE_TIME"); |
|
|
|
|
qcHardnessIotList = service.list(qwhard); |
|
|
|
|
wrapper.eq(IotThickness::getFlagRead, 0); |
|
|
|
|
}else { |
|
|
|
|
// sb.append(" and not_use = 1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<IotThickness> qwhard = new QueryWrapper<>(); |
|
|
|
|
// qwhard.eq("EQUIPMENT_CODE","LG020029");
|
|
|
|
|
qwhard.eq("EQUIPMENT_CODE",card.getDeviceCode()); |
|
|
|
|
qwhard.eq("FLAG_READ",1); |
|
|
|
|
if(startTime != null && endTime != null){ |
|
|
|
|
qwhard.between("CREATE_TIME", startTime, endTime); |
|
|
|
|
wrapper.eq(IotThickness::getFlagRead, 1); |
|
|
|
|
} |
|
|
|
|
qwhard.orderByDesc("CREATE_TIME"); |
|
|
|
|
qcHardnessIotList = service.list(qwhard); |
|
|
|
|
if(startTime != null && endTime != null){ |
|
|
|
|
wrapper.between(IotThickness::getCreateTime, startTime, endTime); |
|
|
|
|
} |
|
|
|
|
wrapper.orderByDesc(IotThickness::getCreateTime); |
|
|
|
|
List<IotThickness> qcHardnessIotList = service.list(wrapper); |
|
|
|
|
|
|
|
|
|
List<JSONObject> resultList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
@ -190,8 +169,6 @@ public class IotThicknessController extends BladeController { |
|
|
|
|
} |
|
|
|
|
service.updateById(iot); |
|
|
|
|
} |
|
|
|
|
// 查到数据后,重置标记(返回null,前端下次请求不带标记)
|
|
|
|
|
// timeMarker = null;
|
|
|
|
|
} else { |
|
|
|
|
log.info("设备[{}]未查询到新数据", deviceCode); |
|
|
|
|
} |
|
|
|
|
|