|
|
@@ -7,10 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@@ -26,34 +28,33 @@ public class SyncStatusHandler {
|
|
|
@XxlJob("syncStatusHandler")
|
|
|
public void syncStatusHandler() {
|
|
|
|
|
|
- // 获取当前时间
|
|
|
- LocalDateTime currentDateTime = LocalDateTime.now();
|
|
|
-
|
|
|
- // 减去一个小时
|
|
|
- LocalDateTime oneHourAgo = currentDateTime.minusHours(1);
|
|
|
-
|
|
|
// 设置日期时间格式
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
- // 格式化输出
|
|
|
- String startTime = oneHourAgo.format(formatter);
|
|
|
-
|
|
|
- String endTime = currentDateTime.format(formatter);
|
|
|
-
|
|
|
-
|
|
|
- List<InsAreaCompany> noSyncList = insAreaCompanyMapper.getNoSyncList(startTime, endTime);
|
|
|
+ HashMap<String,String> time = get24HourTime();
|
|
|
+ List<InsAreaCompany> noSyncList = insAreaCompanyMapper.getNoSyncList(time.get("startTime"), time.get("endTime"));
|
|
|
|
|
|
noSyncList.forEach(insAreaCompany -> {
|
|
|
insAreaCompany.setInsideOrderStatus(Integer.parseInt(insAreaCompany.getOrderstatus()));
|
|
|
if(insAreaCompany.getPayDate() == null || "".equals(insAreaCompany.getPayDate())){
|
|
|
- insAreaCompany.setInsidePayTime(startTime);
|
|
|
+ insAreaCompany.setInsidePayTime(time.get("startTime"));
|
|
|
}else{
|
|
|
insAreaCompany.setInsidePayTime(insAreaCompany.getPayDate().format(formatter));
|
|
|
}
|
|
|
insAreaCompanyMapper.updateById(insAreaCompany);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ private HashMap<String,String> get24HourTime(){
|
|
|
+ HashMap<String,String> components = new HashMap<>();
|
|
|
+ // 获取当前时间
|
|
|
+ LocalDateTime currentTime = LocalDateTime.now();
|
|
|
+ // 获取前24小时的时间
|
|
|
+ LocalDateTime previous24Hours = currentTime.minus(Duration.ofHours(24));
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime current = LocalDateTime.now();
|
|
|
+ components.put("startTime",previous24Hours.format(formatter));
|
|
|
+ components.put("endTime",current.format(formatter));
|
|
|
+ return components;
|
|
|
}
|
|
|
-
|
|
|
}
|