Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79e4d479b8 | ||
|
|
5c6a417fbc |
@@ -40,7 +40,7 @@ public interface TbActivateMapper {
|
||||
* @param tbActivate 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivate tbActivate);
|
||||
Integer insert(TbActivate tbActivate);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
@@ -48,7 +48,7 @@ public interface TbActivateMapper {
|
||||
* @param entities List<TbActivate> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivate> entities);
|
||||
Integer insertBatch(@Param("entities") List<TbActivate> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
@@ -56,7 +56,7 @@ public interface TbActivateMapper {
|
||||
* @param tbActivate 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivate tbActivate);
|
||||
Integer update(TbActivate tbActivate);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
@@ -64,14 +64,14 @@ public interface TbActivateMapper {
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
Integer deleteById(Integer id);
|
||||
|
||||
TbActivate selectByAmount(@Param("shopId") String shopId, @Param("amount") BigDecimal amount);
|
||||
|
||||
TbActivate selectByAmountScope(@Param("shopId") String shopId,@Param("amount") BigDecimal amount);
|
||||
|
||||
int updateMemberPoints(@Param("memberId") Long memberId,@Param("points") Integer points);
|
||||
Integer updateMemberPoints(@Param("memberId") Long memberId,@Param("points") Integer points);
|
||||
|
||||
int insertMemberPointsLog(Map<String,Object> params);
|
||||
Integer insertMemberPointsLog(Map<String,Object> params);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbOrderInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||
@@ -14,6 +16,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPrintMachine;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallNumPrintDTO;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpPrintMachineMapper;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.print.PrinterHandler;
|
||||
import com.chaozhanggui.system.cashierservice.util.Utils;
|
||||
@@ -24,6 +27,8 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -31,14 +36,16 @@ public class PrintConsumer {
|
||||
private final TbOrderInfoMapper tbOrderInfoMapper;
|
||||
private final TbShopInfoMapper tbShopInfoMapper;
|
||||
private final TbOrderDetailMapper tbOrderDetailMapper;
|
||||
private final MPOrderDetailMapper mpOrderDetailMapper;
|
||||
private final MpPrintMachineMapper mpPrintMachineMapper;
|
||||
|
||||
private final PrinterHandler printerHandler;
|
||||
|
||||
public PrintConsumer(TbOrderInfoMapper tbOrderInfoMapper, TbShopInfoMapper tbShopInfoMapper, TbOrderDetailMapper tbOrderDetailMapper, MpPrintMachineMapper mpPrintMachineMapper, PrinterHandler printerHandler) {
|
||||
public PrintConsumer(TbOrderInfoMapper tbOrderInfoMapper, TbShopInfoMapper tbShopInfoMapper, TbOrderDetailMapper tbOrderDetailMapper, MPOrderDetailMapper mpOrderDetailMapper, MpPrintMachineMapper mpPrintMachineMapper, PrinterHandler printerHandler) {
|
||||
this.tbOrderInfoMapper = tbOrderInfoMapper;
|
||||
this.tbShopInfoMapper = tbShopInfoMapper;
|
||||
this.tbOrderDetailMapper = tbOrderDetailMapper;
|
||||
this.mpOrderDetailMapper = mpOrderDetailMapper;
|
||||
this.mpPrintMachineMapper = mpPrintMachineMapper;
|
||||
this.printerHandler = printerHandler;
|
||||
}
|
||||
@@ -65,10 +72,21 @@ public class PrintConsumer {
|
||||
for (Object orderDetail : orderDetailIds) {
|
||||
orderDetails.add(JSONObject.parseObject(orderDetail.toString(), TbOrderDetail.class));
|
||||
}
|
||||
if(CollUtil.isEmpty(orderDetails)){
|
||||
return;
|
||||
}
|
||||
List<Integer> ids = orderDetails.stream().map(TbOrderDetail::getId).collect(Collectors.toList());
|
||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(Wrappers.<TbOrderDetail>lambdaQuery().in(TbOrderDetail::getId, ids));
|
||||
if(CollUtil.isEmpty(detailList)){
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> isPrintMap = detailList.stream().collect(Collectors.toMap(TbOrderDetail::getId, TbOrderDetail::getIsPrint));
|
||||
for (TbOrderDetail detail : orderDetails) {
|
||||
detail.setIsPrint(isPrintMap.get(detail.getId()));
|
||||
}
|
||||
if (orderDetails.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 菜品票
|
||||
getPrintMachine(Integer.valueOf(orderInfo.getShopId()), "cash", "one", null).forEach(machine -> {
|
||||
log.info("打印机信息: {}", machine);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="updateMemberPoints" resultType="int">
|
||||
<select id="updateMemberPoints" resultType="integer">
|
||||
update tb_shop_user set last_points_change_time = now(),last_float_points = #{points},account_points = account_points + ${points} where id = #{memberId}
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user