This commit is contained in:
李京通 2025-07-29 16:50:12 +08:00
parent a68fa7ae4e
commit 3c1c7bff7c
1 changed files with 25 additions and 11 deletions

View File

@ -18,6 +18,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -258,10 +260,10 @@ public class StandardTask {
requestDataListDTO.setGatewaySN(deviceInfo.getGeminiSn()); requestDataListDTO.setGatewaySN(deviceInfo.getGeminiSn());
} }
requestDataListDTO.setPassTime(StringKit.toString(h.getPassTime())); requestDataListDTO.setPassTime(StringKit.toString(h.getPassTime()));
if (h.getPlatePic()!=null){ if (h.getPlatePic() != null) {
requestDataListDTO.setPlatePicBase64(Base64Util.getBase64ByUrl(h.getPlatePic())); requestDataListDTO.setPlatePicBase64(Base64Util.getBase64ByUrl(h.getPlatePic()));
} }
if (h.getGlobalPic()!=null){ if (h.getGlobalPic() != null) {
requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getGlobalPic())); requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getGlobalPic()));
} }
requestDataListDTO.setPlateNo(h.getPlateNo()); requestDataListDTO.setPlateNo(h.getPlateNo());
@ -338,16 +340,16 @@ public class StandardTask {
requestDataListDTO.setDeviceSN(h.getGbsChannelNo()); requestDataListDTO.setDeviceSN(h.getGbsChannelNo());
requestDataListDTO.setValidType(Integer.valueOf(h.getDirection())); requestDataListDTO.setValidType(Integer.valueOf(h.getDirection()));
requestDataListDTO.setPassTime(StringKit.toString(h.getPassTime())); requestDataListDTO.setPassTime(StringKit.toString(h.getPassTime()));
if (h.getPersonPic()!=null){ if (h.getPersonPic() != null) {
requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getPersonPic())); requestDataListDTO.setGlobalPicBase64(Base64Util.getBase64ByUrl(h.getPersonPic()));
} }
requestDataListDTO.setPersonPic(h.getPersonPic()); requestDataListDTO.setPersonPic(h.getPersonPic());
requestDataListDTO.setGlobalPic(h.getPersonPic()); requestDataListDTO.setGlobalPic(h.getPersonPic());
requestDataListDTO.setCardNo(h.getCardno()); requestDataListDTO.setCardNo(h.getCardno());
requestDataListDTO.setDeviceSN(h.getGbsChannelNo()); requestDataListDTO.setDeviceSN(h.getGbsChannelNo());
if (h.getOpenResult().contains("成功")){ if (h.getOpenResult().contains("成功")) {
requestDataListDTO.setValidResult((short) 1); requestDataListDTO.setValidResult((short) 1);
}else { } else {
requestDataListDTO.setValidResult((short) 0); requestDataListDTO.setValidResult((short) 0);
} }
requestDataListDTO.setUserName(h.getUserName()); requestDataListDTO.setUserName(h.getUserName());
@ -438,7 +440,6 @@ public class StandardTask {
// } // }
public boolean sendHighThrowMq(HighThrowDto bean) { public boolean sendHighThrowMq(HighThrowDto bean) {
try { try {
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean)); rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
@ -497,9 +498,9 @@ public class StandardTask {
dataListDTO.setDeviceType(h.getDeviceType()); dataListDTO.setDeviceType(h.getDeviceType());
dataListDTO.setDeviceSN(h.getDeviceSN()); dataListDTO.setDeviceSN(h.getDeviceSN());
dataListDTO.setHeartbeatTime(h.getHeartbeatTime()); dataListDTO.setHeartbeatTime(h.getHeartbeatTime());
if (h.getIsOnline() == null){ if (h.getIsOnline() == null) {
dataListDTO.setIsOnline(0); dataListDTO.setIsOnline(0);
}else { } else {
dataListDTO.setIsOnline(h.getIsOnline()); dataListDTO.setIsOnline(h.getIsOnline());
} }
dataListDTO.setIsOpenAccount(h.getIsOpenAccount()); dataListDTO.setIsOpenAccount(h.getIsOpenAccount());
@ -588,17 +589,20 @@ public class StandardTask {
} }
/** /**
* 推送电表设备用电信息 * 推送电表设备用电信息
*/ */
// @Scheduled(cron = "0/5 * * * * ? ") // @Scheduled(cron = "0/5 * * * * ? ")
@Scheduled(cron = "0 30 2 * * ?") @Scheduled(cron = "0 30 2 * * ?")
public void DevicePowerInfoRecord() { public void DevicePowerInfoRecord() {
LocalDateTime now = LocalDateTime.now();
// 昨天
LocalDateTime yesterday = now.minusDays(1);
// 转成yyyy-MM-dd HH:mm:ss格式
String format = yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<DevicePowerInfo> lists = devicePowerInfoService.list(new QueryWrapper<DevicePowerInfo>() List<DevicePowerInfo> lists = devicePowerInfoService.list(new QueryWrapper<DevicePowerInfo>()
.eq("is_send", "0") .eq("is_send", "0")
.like("use_date", format)
.last("limit 100") .last("limit 100")
); );
@ -641,4 +645,14 @@ public class StandardTask {
} }
} }
public static void main(String[] args) {
LocalDateTime now = LocalDateTime.now();
// 昨天
LocalDateTime yesterday = now.minusDays(1);
// 转成yyyy-MM-dd HH:mm:ss格式
String format = yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(format);
System.out.println(yesterday);
}
} }