商品 可售时间 处理 商品级
This commit is contained in:
@@ -141,14 +141,14 @@ public class ProductService {
|
|||||||
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
||||||
//招牌菜
|
//招牌菜
|
||||||
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
||||||
concurrentMap.put("hots", handleDate(tbProducts,true));
|
concurrentMap.put("hots", handleDate(tbProducts,true,1));
|
||||||
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
||||||
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
||||||
//热销
|
//热销
|
||||||
TbProductGroup hot = new TbProductGroup();
|
TbProductGroup hot = new TbProductGroup();
|
||||||
hot.setName("热销");
|
hot.setName("热销");
|
||||||
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
||||||
hot.setProducts(handleDate(hots,true));
|
hot.setProducts(handleDate(hots,true,1));
|
||||||
//商品
|
//商品
|
||||||
groupList.parallelStream().forEach(g -> {
|
groupList.parallelStream().forEach(g -> {
|
||||||
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
||||||
@@ -156,7 +156,7 @@ public class ProductService {
|
|||||||
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
||||||
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
|
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
|
||||||
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
||||||
g.setProducts(handleDate(products,false));
|
g.setProducts(handleDate(products,false,g.getIsSale()));
|
||||||
} else {
|
} else {
|
||||||
g.setProducts(new ArrayList<>());
|
g.setProducts(new ArrayList<>());
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ public class ProductService {
|
|||||||
* @param check 是否校验可售
|
* @param check 是否校验可售
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<TbProduct> handleDate(List<TbProduct> products,boolean check){
|
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale){
|
||||||
if (!CollectionUtils.isEmpty(products)) {
|
if (!CollectionUtils.isEmpty(products)) {
|
||||||
products.parallelStream().forEach(it -> {
|
products.parallelStream().forEach(it -> {
|
||||||
if(check){
|
if(check){
|
||||||
@@ -360,6 +360,8 @@ public class ProductService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
it.setIsSale(isSale);
|
||||||
}
|
}
|
||||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||||
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
||||||
|
|||||||
Reference in New Issue
Block a user