Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -94,4 +94,11 @@ public class TbShopTableBookingController {
|
||||
List<ShopTableBookingDTO> list = tbShopTableBookingService.findShopTableList(params);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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<TbShopTableBooking> {
|
||||
|
||||
List<Map<String,Object>> summaryByPhoneNos(@Param("phoneNoList") List<String> phoneNoList);
|
||||
|
||||
}
|
||||
@@ -36,4 +36,6 @@ public interface TbShopTableBookingService extends IService<TbShopTableBooking>
|
||||
|
||||
List<ShopTableBookingDTO> findShopTableList(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> summary(String[] phoneNos);
|
||||
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
|
||||
private LambdaQueryWrapper<TbCreditBuyer> getWrapper(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
String keywords = mapProxy.getStr("keywords");
|
||||
String repaymentStatus = mapProxy.getStr("repaymentStatus");
|
||||
TbCreditBuyer param = BeanUtil.toBean(params, TbCreditBuyer.class);
|
||||
|
||||
LambdaQueryWrapper<TbCreditBuyer> wrapper = Wrappers.lambdaQuery();
|
||||
@@ -55,6 +56,16 @@ public class TbCreditBuyerServiceImpl extends ServiceImpl<TbCreditBuyerMapper, T
|
||||
if (StrUtil.isNotEmpty(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.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);
|
||||
|
||||
@@ -211,7 +211,8 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl<TbPadProductCat
|
||||
BeanUtil.copyProperties(dto, entity);
|
||||
entity.setCreateTime(new Date());
|
||||
super.save(entity);
|
||||
for (Long productId : productIdList) {
|
||||
Set<Long> 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 ServiceImpl<TbPadProductCat
|
||||
BeanUtil.copyProperties(dto, entity, "createTime");
|
||||
entity.setUpdateTime(new Date());
|
||||
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();
|
||||
subEntity.setProductId(productId);
|
||||
subEntity.setPadProductCategoryId(entity.getId());
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
||||
setCouponInfo(coupons, tbUserCouponVo, orderAmount, week, now, formatter);
|
||||
}
|
||||
JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
|
||||
tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString());
|
||||
tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").getAsString());
|
||||
if (tbUserCouponVo.getType().equals(1)) {
|
||||
tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean());
|
||||
} else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) {
|
||||
|
||||
@@ -262,4 +262,19 @@ public class TbShopTableBookingServiceImpl extends ServiceImpl<TbShopTableBookin
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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<Object> 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<Object> 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<String, Object> 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<String> 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<String> 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
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user