diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java index d4358b77..67fcd93e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java @@ -97,7 +97,7 @@ public class TbConCheckServiceImpl implements TbConCheckService { flow.setConsId(consInfo.getId()); flow.setShopId(consInfo.getShopId()); flow.setConName(consInfo.getConName()); - flow.setAmount(resources.getLpNum()); + flow.setAmount(resources.getLpNum().abs()); flow.setBalance(resources.getStockNumber()); flow.setOperator(SecurityUtils.getCurrentUserNickName()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); @@ -113,8 +113,8 @@ public class TbConCheckServiceImpl implements TbConCheckService { conCheck.setPrice(consInfo.getPrice()); conCheck.setAcStockNumber(resources.getStockNumber()); conCheck.setStockNumber(resources.getStockNumber()); - conCheck.setLpNum(resources.getLpNum()); conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum())); + conCheck.setLpNum(resources.getLpNum()); conCheck.setCreateTime(new Timestamp(System.currentTimeMillis())); conCheck.setRemark(resources.getRemark()); return tbConCheckMapper.toDto(tbConCheckRepository.save(conCheck)); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/booking/TbShopTableBookingController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/booking/TbShopTableBookingController.java index 7edc9167..24f7f493 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/booking/TbShopTableBookingController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/booking/TbShopTableBookingController.java @@ -94,4 +94,11 @@ public class TbShopTableBookingController { List list = tbShopTableBookingService.findShopTableList(params); return ResponseEntity.ok().body(list); } + + @GetMapping("summary") + @ApiOperation("根据电话号码统计历史预订信息") + public ResponseEntity summary(@RequestBody String[] phoneNos) { + Map data = tbShopTableBookingService.summary(phoneNos); + return ResponseEntity.ok().body(data); + } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopTableBookingMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopTableBookingMapper.java index c7f465e4..835e5d96 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopTableBookingMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopTableBookingMapper.java @@ -3,6 +3,10 @@ package cn.ysk.cashier.mybatis.mapper; import cn.ysk.cashier.mybatis.entity.TbShopTableBooking; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * 店铺台桌预订 @@ -12,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface TbShopTableBookingMapper extends BaseMapper { + + List> summaryByPhoneNos(@Param("phoneNoList") List phoneNoList); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopTableBookingService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopTableBookingService.java index 03c2d7e8..762757bb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopTableBookingService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopTableBookingService.java @@ -36,4 +36,6 @@ public interface TbShopTableBookingService extends IService List findShopTableList(Map params); + Map summary(String[] phoneNos); + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCreditBuyerServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCreditBuyerServiceImpl.java index 10c96535..4858bbab 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCreditBuyerServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCreditBuyerServiceImpl.java @@ -45,6 +45,7 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl getWrapper(Map params) { MapProxy mapProxy = MapProxy.create(params); String keywords = mapProxy.getStr("keywords"); + String repaymentStatus = mapProxy.getStr("repaymentStatus"); TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); @@ -55,6 +56,16 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl i.like(TbCreditBuyer::getDebtor, keywords).or().like(TbCreditBuyer::getMobile, keywords)); } + if (StrUtil.isNotEmpty(repaymentStatus)) { + if ("unpaid".equals(repaymentStatus)) { + wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'unpaid'),0)"); + wrapper.apply("0 = ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)"); + }else if ("partial".equals(repaymentStatus)) { + wrapper.apply("0 < ifnull((select x.count from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status = 'partial'),0)"); + }else if ("paid".equals(repaymentStatus)) { + wrapper.apply("0 = ifnull((select sum(x.count) from view_credit_buyer_order_count x where x.credit_buyer_id = tb_credit_buyer.id and x.status in ('unpaid','partial')),0)"); + } + } wrapper.eq(TbCreditBuyer::getDelFlag, 0); wrapper.select(TbCreditBuyer::getId, TbCreditBuyer::getShopId, TbCreditBuyer::getStatus, TbCreditBuyer::getDebtor, TbCreditBuyer::getMobile, TbCreditBuyer::getPosition, TbCreditBuyer::getCreditAmount, TbCreditBuyer::getRepaymentMethod, TbCreditBuyer::getPaymentMethod, TbCreditBuyer::getRemark, TbCreditBuyer::getDelFlag, TbCreditBuyer::getOwedAmount, TbCreditBuyer::getAccumulateAmount, TbCreditBuyer::getShopName, TbCreditBuyer::getResponsiblePerson, TbCreditBuyer::getAccountBalance); wrapper.orderByDesc(TbCreditBuyer::getStatus); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java index 85aa89cd..b8277c10 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java @@ -211,7 +211,8 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl productIdSet = productIdList.stream().collect(Collectors.toSet()); + for (Long productId : productIdSet) { TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); subEntity.setProductId(productId); subEntity.setPadProductCategoryId(entity.getId()); @@ -269,8 +270,9 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpllambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); + tbPadProductCategoryDetailMapper.delete(Wrappers.lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); + Set productIdSet = productIdList.stream().collect(Collectors.toSet()); + for (Long productId : productIdSet) { TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); subEntity.setProductId(productId); subEntity.setPadProductCategoryId(entity.getId()); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 5d2d448c..904706e5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -196,7 +196,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl summary(String[] phoneNos) { + List> list = baseMapper.summaryByPhoneNos(Arrays.asList(phoneNos)); + Map result = new HashMap<>(phoneNos.length); + Map fillData = new HashMap<>(2); + fillData.put("consumeOrders", 0); + fillData.put("cancelOrders", 0); + for (String phoneNo : phoneNos) { + fillData.put("phoneNumber", phoneNo); + Map data = list.stream().filter(item -> phoneNo.equals(item.get("phoneNumber"))).findFirst().orElse(fillData); + result.put(phoneNo, data); + } + return result; + } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BindServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BindServiceImpl.java index 46c89573..c6978cbd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BindServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BindServiceImpl.java @@ -52,15 +52,15 @@ public class BindServiceImpl implements BindService { String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000); JSONObject jsonObject = JSONObject.parseObject(result); if (jsonObject.getInteger("code").equals(1)) { - if (StringUtils.isNotBlank(shopId)) { - if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) { - Set articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId); - if (!articles.contains(params.get("article"))) { - articles.add(params.get("article")); - redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles); - } - } - } +// if (StringUtils.isNotBlank(shopId)) { +// if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) { +// Set articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId); +// if (!articles.contains(params.get("article"))) { +// articles.add(params.get("article")); +// redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles); +// } +// } +// } return jsonObject.getJSONObject("data"); } else { throw new BadRequestException(jsonObject.getString("msg")); @@ -69,7 +69,7 @@ public class BindServiceImpl implements BindService { @Override public JSONObject industry(BindingDto bindingDto) { - if (StringUtils.isNotBlank(bindingDto.getArticle())) { +// if (StringUtils.isNotBlank(bindingDto.getArticle())) { Map params = new HashMap<>(); params.put("name", bindingDto.getArticle()); params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage()); @@ -80,20 +80,21 @@ public class BindServiceImpl implements BindService { } else { throw new BadRequestException(jsonObject.getString("msg")); } - } else { - Set set = new HashSet<>(); - JSONObject jsonObject = new JSONObject(); - if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) { - TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null); - TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount()); - set.add(account.getArticle()); - redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set); - jsonObject.put("articles", set); - } else { - jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())); - } - return jsonObject; - } +// } +// else { +// Set set = new HashSet<>(); +// JSONObject jsonObject = new JSONObject(); +// if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) { +// TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null); +// TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount()); +// set.add(account.getArticle()); +// redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set); +// jsonObject.put("articles", set); +// } else { +// jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())); +// } +// return jsonObject; +// } } @Override diff --git a/eladmin-system/src/main/resources/mapper/plus/TbShopTableBookingMapper.xml b/eladmin-system/src/main/resources/mapper/plus/TbShopTableBookingMapper.xml new file mode 100644 index 00000000..6a94f86e --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbShopTableBookingMapper.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file