初始化单位,统计 关于客坐费没有规格问题

This commit is contained in:
wangw 2024-10-11 09:44:18 +08:00
parent 70d26b5c78
commit 846cbef3da
3 changed files with 33 additions and 59 deletions

View File

@ -1,18 +1,3 @@
/*
* 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.controller.shop;
import cn.ysk.cashier.annotation.Log;
@ -30,11 +15,6 @@ import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/unit管理")
@ -59,7 +39,7 @@ public class TbShopUnitController {
@PostMapping
@Log("新增单位:#resources.name")
@ApiOperation("新增/shop/unit")
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources){
return new ResponseEntity<>(tbShopUnitService.create(resources),HttpStatus.CREATED);
}

View File

@ -8,9 +8,6 @@ import cn.ysk.cashier.enums.PayTypeEnum;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
import cn.ysk.cashier.repository.ShopUserDutyDetailRepository;
import cn.ysk.cashier.repository.ShopUserDutyRepository;
import cn.ysk.cashier.repository.TbTokenRepository;
import cn.ysk.cashier.repository.order.TbOrderDetailRepository;
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
import cn.ysk.cashier.repository.shop.TbShopTableRepository;
@ -45,10 +42,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
@Slf4j
public class SummaryServiceImpl implements SummaryService {
@Resource
private ShopUserDutyRepository shopUserDutyRepository;
@Resource
private ShopUserDutyDetailRepository shopUserDutyDetailRepository;
@Resource
private TbShopUserRepository tbShopUserRepository;
@Resource
@ -56,9 +49,6 @@ public class SummaryServiceImpl implements SummaryService {
@Resource
private TbOrderDetailRepository detailRepository;
@Resource
private TbTokenRepository tbTokenRepository;
@Autowired
private TbShopUserFlowMapper tbShopUserFlowMapper;
@Resource
@ -186,7 +176,7 @@ public class SummaryServiceImpl implements SummaryService {
payCountVos.add(new TbOrderPayCountVo("https://cashier-oss.oss-cn-beijing.aliyuncs.com/static/vipIn.png","充值","1",BigDecimal.ZERO));
// payCountVos.add(new TbOrderPayCountVo("","会员支付","1",BigDecimal.ZERO));
return payCountVos;
};
}
@ -278,8 +268,8 @@ public class SummaryServiceImpl implements SummaryService {
@Override
public Map<String, Object> selectSummaryPayType(Integer shopId, Integer day) {
Long startTime;
Long endTime;
long startTime;
long endTime;
if (day == 7) {
startTime = DateUtil.getSevenDaysAgoInMilliseconds();
endTime = DateUtil.getTodayEndTimestamp();
@ -361,13 +351,13 @@ public class SummaryServiceImpl implements SummaryService {
List<TbOrderSalesCountByDayV2Vo> products = detailRepository.queryTbOrderSalesCountByProduct(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
for (TbOrderSalesCountByDayV2Vo product : products) {
if(product.getTypeEnum().equals("sku")){
if("sku".equals(product.getTypeEnum())){
List<TbOrderSalesCountByDayV2Vo> skus = detailRepository.queryTbOrderSalesCountBySku(Integer.valueOf(summaryDto.getShopId()), product.getProductId(), summaryDto.getStartTime(), summaryDto.getEndTime());
product.setSkus(skus);
}
}
for (TbOrderSalesCountByDayV2Vo product : products) {
if(product.getTypeEnum().equals("sku")){
if("sku".equals(product.getTypeEnum())){
for (TbOrderSalesCountByDayV2Vo skus : product.getSkus()) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("商品分类", product.getCateName());

View File

@ -15,38 +15,34 @@
*/
package cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.exception.NewBadRequestException;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
import cn.ysk.cashier.service.shop.TbShopUnitService;
import cn.ysk.cashier.dto.shop.TbShopUnitDto;
import cn.ysk.cashier.dto.shop.TbShopUnitQueryCriteria;
import cn.ysk.cashier.exception.NewBadRequestException;
import cn.ysk.cashier.mapper.shop.TbShopUnitMapper;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
import cn.ysk.cashier.service.shop.TbShopUnitService;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.persistence.criteria.Predicate;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-01-02
**/
@Service
@RequiredArgsConstructor
public class TbShopUnitServiceImpl implements TbShopUnitService {
@ -55,8 +51,16 @@ public class TbShopUnitServiceImpl implements TbShopUnitService {
private final TbShopUnitMapper tbShopUnitMapper;
@Override
public Map<String,Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable){
Page<TbShopUnit> page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
public Map<String, Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable) {
Page<TbShopUnit> page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
Predicate predicate = QueryHelp.getPredicate(root, null, criteriaBuilder);
predicate = criteriaBuilder.or(predicate, criteriaBuilder.equal(root.get("shopId"), 1));
predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(root.get("shopId"), criteria.getShopId()));
if(StringUtils.isNotBlank(criteria.getName())){
predicate = criteriaBuilder.and(predicate, criteriaBuilder.like(root.get("name"), criteria.getName()));
}
return predicate;
}, pageable);
return PageUtil.toPage(page.map(tbShopUnitMapper::toDto));
}