|
@@ -22,6 +22,7 @@ import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
import com.chelvc.cloud.vehicle.server.service.GoodsService;
|
|
import com.chelvc.cloud.vehicle.server.service.GoodsService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
import com.chelvc.cloud.vehicle.server.service.OmsCartItemService;
|
|
import com.chelvc.cloud.vehicle.server.service.OmsCartItemService;
|
|
|
|
+import com.chelvc.cloud.vehicle.server.task.DateUtil;
|
|
import com.chelvc.framework.base.context.SessionContextHolder;
|
|
import com.chelvc.framework.base.context.SessionContextHolder;
|
|
import com.chelvc.framework.common.model.Pagination;
|
|
import com.chelvc.framework.common.model.Pagination;
|
|
import com.chelvc.framework.common.util.AssertUtils;
|
|
import com.chelvc.framework.common.util.AssertUtils;
|
|
@@ -34,10 +35,13 @@ import lombok.NonNull;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.time.DayOfWeek;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -437,17 +441,12 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
/**
|
|
/**
|
|
* 每天定时更新商家得营业状态
|
|
* 每天定时更新商家得营业状态
|
|
*/
|
|
*/
|
|
-// @Scheduled(cron = "5 * * * * ?")
|
|
|
|
|
|
+ @Scheduled(cron = "1 * * * * ?")
|
|
public void batchMerchantBusinessStatus() {
|
|
public void batchMerchantBusinessStatus() {
|
|
List<Merchant> merchantList = this.lambdaQuery().list();
|
|
List<Merchant> merchantList = this.lambdaQuery().list();
|
|
//星期一至星期六: 09:00~18:00
|
|
//星期一至星期六: 09:00~18:00
|
|
merchantList.forEach(item -> {
|
|
merchantList.forEach(item -> {
|
|
- String opening = "10:00:00,18:00:00";
|
|
|
|
- String[] openStr = opening.split(",");
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
|
|
|
- LocalTime time1 = LocalTime.parse(openStr[0], formatter);
|
|
|
|
- LocalTime time2 = LocalTime.parse(openStr[1], formatter);
|
|
|
|
- if (time1.isAfter(LocalTime.now()) && time2.isAfter(LocalTime.now())) {
|
|
|
|
|
|
+ if (!DateUtil.timeQuantum(item.getOpening())) {
|
|
this.baseMapper.updateMerchantBusinessStatus(item.getId(), "0", "0");
|
|
this.baseMapper.updateMerchantBusinessStatus(item.getId(), "0", "0");
|
|
} else {
|
|
} else {
|
|
this.baseMapper.updateMerchantBusinessStatus(item.getId(), "1", "0");
|
|
this.baseMapper.updateMerchantBusinessStatus(item.getId(), "1", "0");
|