商品分组-时段 跨日的展示 次日
This commit is contained in:
parent
1cfc94b22a
commit
5732e6974f
|
|
@ -1,24 +1,10 @@
|
||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.dto.product;
|
package cn.ysk.cashier.dto.product;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -68,4 +54,15 @@ public class TbProductGroupDto implements Serializable {
|
||||||
private String saleStartTime;
|
private String saleStartTime;
|
||||||
|
|
||||||
private String saleEndTime;
|
private String saleEndTime;
|
||||||
|
|
||||||
|
public void upSaleEndTime() {
|
||||||
|
if (useTime != null && useTime == 1) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||||
|
LocalTime startTime = LocalTime.parse(saleStartTime, formatter);
|
||||||
|
LocalTime endTime = LocalTime.parse(saleEndTime, formatter);
|
||||||
|
if (endTime.isBefore(startTime)) {
|
||||||
|
saleEndTime = "次日 " + saleEndTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,8 +58,11 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||||
PageRequest sort = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("sort"));
|
PageRequest sort = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("sort"));
|
||||||
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
|
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
|
||||||
QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort);
|
QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort);
|
||||||
|
Page<TbProductGroupDto> map = page.map(tbProductGroupMapper::toDto);
|
||||||
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
|
map.getContent().forEach(s->{
|
||||||
|
s.upSaleEndTime();
|
||||||
|
});
|
||||||
|
return PageUtil.toPage(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue