Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2024-11-26 15:01:48 +08:00
10 changed files with 92 additions and 30 deletions

View File

@@ -97,7 +97,7 @@ public class TbConCheckServiceImpl implements TbConCheckService {
flow.setConsId(consInfo.getId()); flow.setConsId(consInfo.getId());
flow.setShopId(consInfo.getShopId()); flow.setShopId(consInfo.getShopId());
flow.setConName(consInfo.getConName()); flow.setConName(consInfo.getConName());
flow.setAmount(resources.getLpNum()); flow.setAmount(resources.getLpNum().abs());
flow.setBalance(resources.getStockNumber()); flow.setBalance(resources.getStockNumber());
flow.setOperator(SecurityUtils.getCurrentUserNickName()); flow.setOperator(SecurityUtils.getCurrentUserNickName());
flow.setCreateTime(new Timestamp(System.currentTimeMillis())); flow.setCreateTime(new Timestamp(System.currentTimeMillis()));
@@ -113,8 +113,8 @@ public class TbConCheckServiceImpl implements TbConCheckService {
conCheck.setPrice(consInfo.getPrice()); conCheck.setPrice(consInfo.getPrice());
conCheck.setAcStockNumber(resources.getStockNumber()); conCheck.setAcStockNumber(resources.getStockNumber());
conCheck.setStockNumber(resources.getStockNumber()); conCheck.setStockNumber(resources.getStockNumber());
conCheck.setLpNum(resources.getLpNum());
conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum())); conCheck.setLpAmount(consInfo.getPrice().multiply(resources.getLpNum()));
conCheck.setLpNum(resources.getLpNum());
conCheck.setCreateTime(new Timestamp(System.currentTimeMillis())); conCheck.setCreateTime(new Timestamp(System.currentTimeMillis()));
conCheck.setRemark(resources.getRemark()); conCheck.setRemark(resources.getRemark());
return tbConCheckMapper.toDto(tbConCheckRepository.save(conCheck)); return tbConCheckMapper.toDto(tbConCheckRepository.save(conCheck));

View File

@@ -94,4 +94,11 @@ public class TbShopTableBookingController {
List<ShopTableBookingDTO> list = tbShopTableBookingService.findShopTableList(params); List<ShopTableBookingDTO> list = tbShopTableBookingService.findShopTableList(params);
return ResponseEntity.ok().body(list); return ResponseEntity.ok().body(list);
} }
@GetMapping("summary")
@ApiOperation("根据电话号码统计历史预订信息")
public ResponseEntity summary(@RequestBody String[] phoneNos) {
Map<String, Object> data = tbShopTableBookingService.summary(phoneNos);
return ResponseEntity.ok().body(data);
}
} }

View File

@@ -3,6 +3,10 @@ package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.mybatis.entity.TbShopTableBooking; import cn.ysk.cashier.mybatis.entity.TbShopTableBooking;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 店铺台桌预订 * 店铺台桌预订
@@ -13,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> { public interface TbShopTableBookingMapper extends BaseMapper<TbShopTableBooking> {
List<Map<String,Object>> summaryByPhoneNos(@Param("phoneNoList") List<String> phoneNoList);
} }

View File

@@ -36,4 +36,6 @@ public interface TbShopTableBookingService extends IService<TbShopTableBooking>
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params); List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
Map<String, Object> summary(String[] phoneNos);
} }

View File

@@ -45,6 +45,7 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
private LambdaQueryWrapper<TbCreditBuyer> getWrapper(Map<String, Object> params) { private LambdaQueryWrapper<TbCreditBuyer> getWrapper(Map<String, Object> params) {
MapProxy mapProxy = MapProxy.create(params); MapProxy mapProxy = MapProxy.create(params);
String keywords = mapProxy.getStr("keywords"); String keywords = mapProxy.getStr("keywords");
String repaymentStatus = mapProxy.getStr("repaymentStatus");
TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class); TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class);
LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery();
@@ -55,6 +56,16 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
if (StrUtil.isNotEmpty(keywords)) { if (StrUtil.isNotEmpty(keywords)) {
wrapper.nested(i -> i.like(TbCreditBuyer::getDebtor, keywords).or().like(TbCreditBuyer::getMobile, keywords)); wrapper.nested(i -> 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.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.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); wrapper.orderByDesc(TbCreditBuyer::getStatus);

View File

@@ -211,7 +211,8 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
BeanUtil.copyProperties(dto, entity); BeanUtil.copyProperties(dto, entity);
entity.setCreateTime(new Date()); entity.setCreateTime(new Date());
super.save(entity); super.save(entity);
for (Long productId : productIdList) { Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
for (Long productId : productIdSet) {
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
subEntity.setProductId(productId); subEntity.setProductId(productId);
subEntity.setPadProductCategoryId(entity.getId()); subEntity.setPadProductCategoryId(entity.getId());
@@ -269,8 +270,9 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
BeanUtil.copyProperties(dto, entity, "createTime"); BeanUtil.copyProperties(dto, entity, "createTime");
entity.setUpdateTime(new Date()); entity.setUpdateTime(new Date());
super.updateById(entity); super.updateById(entity);
for (Long productId : productIdList) { tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId()));
tbPadProductCategoryDetailMapper.delete(Wrappers.<TbPadProductCategoryDetail>lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); Set<Long> productIdSet = productIdList.stream().collect(Collectors.toSet());
for (Long productId : productIdSet) {
TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail();
subEntity.setProductId(productId); subEntity.setProductId(productId);
subEntity.setPadProductCategoryId(entity.getId()); subEntity.setPadProductCategoryId(entity.getId());

View File

@@ -196,7 +196,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
setCouponInfo(coupons, tbUserCouponVo, orderAmount, week, now, formatter); setCouponInfo(coupons, tbUserCouponVo, orderAmount, week, now, formatter);
} }
JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId()); JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString()); tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").getAsString());
if (tbUserCouponVo.getType().equals(1)) { if (tbUserCouponVo.getType().equals(1)) {
tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean()); tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean());
} else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) { } else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) {

View File

@@ -262,4 +262,19 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
} }
return result; return result;
} }
@Override
public Map<String, Object> summary(String[] phoneNos) {
List<Map<String, Object>> list = baseMapper.summaryByPhoneNos(Arrays.asList(phoneNos));
Map<String, Object> result = new HashMap<>(phoneNos.length);
Map<String, Object> fillData = new HashMap<>(2);
fillData.put("consumeOrders", 0);
fillData.put("cancelOrders", 0);
for (String phoneNo : phoneNos) {
fillData.put("phoneNumber", phoneNo);
Map<String, Object> data = list.stream().filter(item -> phoneNo.equals(item.get("phoneNumber"))).findFirst().orElse(fillData);
result.put(phoneNo, data);
}
return result;
}
} }

View File

@@ -52,15 +52,15 @@ public class BindServiceImpl implements BindService {
String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000); String result = HttpUtil.post(url + "cash/subinvoicing", params, 5000);
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject.getInteger("code").equals(1)) { if (jsonObject.getInteger("code").equals(1)) {
if (StringUtils.isNotBlank(shopId)) { // if (StringUtils.isNotBlank(shopId)) {
if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) { // if (redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + shopId)) {
Set<Object> articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId); // Set<Object> articles = redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + shopId);
if (!articles.contains(params.get("article"))) { // if (!articles.contains(params.get("article"))) {
articles.add(params.get("article")); // articles.add(params.get("article"));
redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles); // redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + shopId, articles);
} // }
} // }
} // }
return jsonObject.getJSONObject("data"); return jsonObject.getJSONObject("data");
} else { } else {
throw new BadRequestException(jsonObject.getString("msg")); throw new BadRequestException(jsonObject.getString("msg"));
@@ -69,7 +69,7 @@ public class BindServiceImpl implements BindService {
@Override @Override
public JSONObject industry(BindingDto bindingDto) { public JSONObject industry(BindingDto bindingDto) {
if (StringUtils.isNotBlank(bindingDto.getArticle())) { // if (StringUtils.isNotBlank(bindingDto.getArticle())) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("name", bindingDto.getArticle()); params.put("name", bindingDto.getArticle());
params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage()); params.put("page", bindingDto.getPage() == null ? 1 : bindingDto.getPage());
@@ -80,20 +80,21 @@ public class BindServiceImpl implements BindService {
} else { } else {
throw new BadRequestException(jsonObject.getString("msg")); throw new BadRequestException(jsonObject.getString("msg"));
} }
} else { // }
Set<String> set = new HashSet<>(); // else {
JSONObject jsonObject = new JSONObject(); // Set<String> set = new HashSet<>();
if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) { // JSONObject jsonObject = new JSONObject();
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null); // if (!redisUtils.hasKey(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())) {
TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount()); // TbShopInfo tbShopInfo = tbShopInfoRepository.findById(bindingDto.getShopId()).orElseGet(null);
set.add(account.getArticle()); // TbMerchantAccount account = accountRepository.findByAccount(tbShopInfo.getAccount());
redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set); // set.add(account.getArticle());
jsonObject.put("articles", set); // redisUtils.sSet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId(), set);
} else { // jsonObject.put("articles", set);
jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId())); // } else {
} // jsonObject.put("list", redisUtils.sGet(CacheKey.INVOICE_SD_TYPE + bindingDto.getShopId()));
return jsonObject; // }
} // return jsonObject;
// }
} }
@Override @Override

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbShopTableBookingMapper">
<select id="summaryByPhoneNos" resultType="java.util.Map">
select
x.phone_number as phoneNumber,
count( case when x.`status` = 10 then 1 end) AS consumeOrders,
count( case when x.`status` = -1 or x.`status` = 999 then 1 end) AS cancelOrders
from tb_shop_table_booking x
where x.phone_number in
<foreach item="phoneNumber" collection="phoneNoList" open="(" separator="," close=")">
#{phoneNumber, jdbcType=VARCHAR}
</foreach>
GROUP BY x.phone_number
</select>
</mapper>