JSK 解决预订单限制日期为0时,不会出现预定时间的问题
This commit is contained in:
parent
9afb8a0949
commit
923f62c64f
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.allocation.api;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.bonus.canteen.core.allocation.canteen.mapper.AllocStallMapper;
|
||||
import com.bonus.common.houqin.constant.LeConstants;
|
||||
import com.bonus.canteen.core.allocation.alloc.model.AllocMetadata;
|
||||
import com.bonus.canteen.core.allocation.alloc.service.AllocMetadataService;
|
||||
|
|
@ -16,6 +17,7 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
|
@ -28,6 +30,9 @@ public class GlobalMetadataApi {
|
|||
@Lazy
|
||||
private AllocMetadataService allocMetadataService;
|
||||
|
||||
@Resource
|
||||
private AllocStallMapper allocStallMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private AllocStallApi allocStallApi;
|
||||
|
|
@ -116,7 +121,12 @@ public class GlobalMetadataApi {
|
|||
}
|
||||
|
||||
public <T> T getAvailableModel(MetadataModelTypeEnum modelTypeEnum, T t, Long canteenId, Long stallId) {
|
||||
List<AllocMetadata> metadataList = this.getAvailableList(modelTypeEnum, canteenId, stallId);
|
||||
List<AllocMetadata> metadataList =new ArrayList<>();
|
||||
if("order".equals(modelTypeEnum.getKey())){
|
||||
metadataList=allocStallMapper.queryAvailableOrder(modelTypeEnum.getKey(),canteenId,stallId);
|
||||
}else{
|
||||
metadataList = this.getAvailableList(modelTypeEnum, canteenId, stallId);
|
||||
}
|
||||
return MetadataUtil.transferToPayModel(metadataList, t);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.canteen.core.allocation.canteen.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.allocation.alloc.model.AllocMetadata;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocStall;
|
||||
import com.bonus.canteen.core.allocation.canteen.vo.AllocCanteenStallVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -16,4 +17,6 @@ public interface AllocStallMapper extends BaseMapper<AllocStall> {
|
|||
List<AllocCanteenStallVO.StallVO> listAllCanteenStall(@Param("canteenId") Long canteenId);
|
||||
|
||||
String getStallNameByIdSet(@Param("stallIdSet") Set<Long> stallIdSet);
|
||||
|
||||
List<AllocMetadata> queryAvailableOrder(@Param("modelType") String modelType,@Param("canteenId") Long canteenId, @Param("stallId") Long stallId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -62,6 +63,8 @@ public class AllocStallServiceImpl extends ServiceImpl<AllocStallMapper, AllocSt
|
|||
@Override
|
||||
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO) {
|
||||
AllocCanteenOrderDTO allocCanteenOrderDTO = this.allocOrderMetadataApi.queryAvailableOrder(queryDTO.getCanteenId(), queryDTO.getStallId());
|
||||
System.out.println("ifReserveSkipHoliday="+allocCanteenOrderDTO.getIfReserveSkipHoliday()+";reserveLimitDayNum="+allocCanteenOrderDTO.getReserveLimitDay()+"" +
|
||||
";ifAllowReserveToday="+allocCanteenOrderDTO.getIfAllowReserveToday());
|
||||
String ifReserveSkipHoliday="1";
|
||||
if(allocCanteenOrderDTO.getIfReserveSkipHoliday()!=null&&!"".equals(allocCanteenOrderDTO.getIfReserveSkipHoliday())){
|
||||
ifReserveSkipHoliday= allocCanteenOrderDTO.getIfReserveSkipHoliday();
|
||||
|
|
@ -88,9 +91,11 @@ public class AllocStallServiceImpl extends ServiceImpl<AllocStallMapper, AllocSt
|
|||
private List<LocalDate> listMatchData(String skipFlagStr, Integer limitNum, String ifAllowReserveToday) {
|
||||
log.info(String.format("查询日期,是否调过节假日:%s,天数:%d", skipFlagStr, limitNum));
|
||||
List<LocalDate> reserveDateList = new ArrayList();
|
||||
try{
|
||||
LocalDate startDate;
|
||||
if ("1".equals(ifAllowReserveToday)) {
|
||||
log.info("允许预定当天");
|
||||
limitNum=limitNum+1;
|
||||
startDate = LocalDate.now();
|
||||
} else {
|
||||
log.info("不允许预定当天");
|
||||
|
|
@ -122,6 +127,9 @@ public class AllocStallServiceImpl extends ServiceImpl<AllocStallMapper, AllocSt
|
|||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return reserveDateList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,9 +235,11 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
|
|||
, (Long) LeNumUtil.reduceField(reserveMealDTO.getReserveMealList(), OrderReserveMealDTO::getCanteenId
|
||||
, (Object)null), (Long)LeNumUtil.reduceField(reserveMealDTO.getReserveMealList()
|
||||
, OrderReserveMealDTO::getStallId, (Object)null), headerDTO.getOpenid(), custInfo, reserveMealDTO);
|
||||
|
||||
OrderSavePO orderSavePO = this.packageOrderInfo(reserveMealDTO, reserveMealDTO.getReserveMealList(), payDTO);
|
||||
this.reserveMealOrderPlaceCheck(orderSavePO.getOrderInfoList(), orderSavePO.getOrderDetailList()
|
||||
, orderSavePO.getOrderDeliveryList());
|
||||
|
||||
if (LeConstants.COMMON_NO.equals(reserveMealDTO.getIfTrial())) {
|
||||
this.orderPlaceBusiness.orderHandlerLock(orderSavePO.getMacOrderId(), OrderCacheConstants.MOBILE_PAY_INTERVAL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,22 @@
|
|||
#{stallId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="queryAvailableOrder" resultType="com.bonus.canteen.core.allocation.alloc.model.AllocMetadata">
|
||||
select metadata_id as metadataId,
|
||||
area_id as areaId,
|
||||
canteen_id as canteenId,
|
||||
stall_id as stallId,
|
||||
if_active as ifActive,
|
||||
model_type as modelType,
|
||||
model_key as modelKey,
|
||||
model_value as modelValue,
|
||||
model_key_remark as modelKeyRemark,
|
||||
crby as crby,
|
||||
crtime as crtime,
|
||||
upby as upby,
|
||||
uptime as uptime,
|
||||
model_item as modelItem
|
||||
from alloc_metadata where canteen_id=#{canteenId} and stall_id=#{stallId} and model_type=#{modelType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue