diff --git a/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/utils/Drawing2D.java b/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/utils/Drawing2D.java index 9cf7531c5..1e400faa2 100644 --- a/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/utils/Drawing2D.java +++ b/pjcloud-hardware/pjcloud-hardware-api/src/main/java/com/bsd/pjcloud/hard/api/utils/Drawing2D.java @@ -30,7 +30,7 @@ public class Drawing2D { private final int horizontalPadding = 20; - private final String fontFamily = "SimSun"; + private final String fontFamily = "黑体"; /** * end ****************** config ****************** end @@ -134,13 +134,13 @@ public class Drawing2D { public Drawing2D setTitleTextStyle() { graphics.setColor(Color.BLACK); - graphics.setFont(new Font(fontFamily, Font.BOLD, 24)); + graphics.setFont(new Font(fontFamily, Font.PLAIN, 26)); return this; } public Drawing2D setDefaultStyle() { graphics.setColor(Color.BLACK); - graphics.setFont(new Font(fontFamily, Font.PLAIN, 20)); + graphics.setFont(new Font(fontFamily, Font.PLAIN, 22)); return this; } diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/HardOrderService.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/HardOrderService.java index e05fa847f..8483dc39d 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/HardOrderService.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/HardOrderService.java @@ -9,7 +9,6 @@ import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto; import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto; import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity; import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo; -import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo; import jakarta.validation.Valid; import java.util.List; @@ -28,24 +27,16 @@ public interface HardOrderService extends IService { /** * 创建app订单 - * - * @param dto 父订单id - * @return */ Long appCreateOrder(@Valid HardAppCreateOrderDto dto); /** - * 快速扣款 - * - * @param order 订单详情 + * 快速扣款,离线订单使用 */ void fastReduceBalance(HardOrderEntity order); /** * 计算额外金额 - * - * @param price 购物车总价 - * @return */ Integer computeExtraPrice(Integer price); @@ -61,16 +52,16 @@ public interface HardOrderService extends IService { /** * 扣减库存 - * - * @param isReduce true 扣件库存 false增加库存 */ void fastenerInventory(HardOrderEntity order, YesNoEnum isReduce); /** * 核销硬件二维码 - * - * @param dto - * @return */ Boolean handCancelCode(HandCancelCodeDto dto); + + /** + * 创建订单后发送mq消息 + */ + void createOrderAfterSendMqMsg(Long orderId); } \ No newline at end of file diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApiServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApiServiceImpl.java index eafe02594..07644f2c3 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApiServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/HardApiServiceImpl.java @@ -31,7 +31,10 @@ public class HardApiServiceImpl implements HardApiService { UserInfo user = userService.getByUserId(userId).getData(); if (ObjectUtil.isEmpty(user)) return null; // 查询钱包 - WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY; + // WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY; + // 默认都使用饭卡钱包 + WalletTypeEnum walletType = WalletTypeEnum.EAT; + WalletManageEntity wallet = remoteWalletService.getWallet(userId, walletType).getData(); if (ObjectUtil.isEmpty(wallet)) return null; SysUser sysUser = user.getSysUser(); diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java index edf39b7e5..103cbee5f 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java @@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -165,8 +166,14 @@ public class HardCarServiceImpl extends ServiceImpl ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> { Integer price = getSupermarket(spu); - int itemTotalPrice = v.getProductCount() * price; - supermarketTotalPrice.addAndGet(itemTotalPrice); + if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { + int itemTotalPrice = v.getProductCount() * price; + supermarketTotalPrice.addAndGet(itemTotalPrice); + } else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) { + // 向上取整 + int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue(); + supermarketTotalPrice.addAndGet(itemTotalPrice); + } }); } yield supermarketTotalPrice.get(); @@ -245,7 +252,7 @@ public class HardCarServiceImpl extends ServiceImpl list = carList.stream().map(v -> { SupermarketSpuUpdateStockReqDTO.Item item = new SupermarketSpuUpdateStockReqDTO.Item(); item.setId(v.getProductId()); - double weight = BigDecimal.valueOf(v.getProductCount()).multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue(); - item.setIncrCount(weight); + if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { + // 按数量 + double count = BigDecimal.valueOf(v.getProductCount()).multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue(); + item.setIncrCount(count); + } else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) { + // 按重量 + double weight = v.getProductWeight().multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue(); + item.setIncrCount(weight); + } return item; }).toList(); dto.setItems(list); @@ -490,6 +504,34 @@ public class HardOrderServiceImpl extends ServiceImpl { + Boolean isPrint = hardInvoiceService.printByOrder(orderdetail); + if (isPrint) { + log.info("|{}|发送mq消息成功,超市打印发票order|{}|", TAG, JSON.toJSONString(orderId)); + } + } + } + } catch (Exception e) { + log.info("|{}|发送mq消息成功,意外的错误error|{}|", TAG, e.getMessage()); + } + } + // 二维码类型的订单是否被核销 true被核销 false未核销 private boolean validateCodeIsCancel(HardOrderTypeEnum orderType, Long orderId) { Boolean flag = switch (orderType) { diff --git a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/resources/mapper/SmErpSpuMapper.xml b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/resources/mapper/SmErpSpuMapper.xml index 315eac3ac..cb3c1a7cb 100644 --- a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/resources/mapper/SmErpSpuMapper.xml +++ b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/resources/mapper/SmErpSpuMapper.xml @@ -95,6 +95,6 @@ AND es.product_nature = #{supermarketSpuQueryDTO.productNature} - ORDER BY es.sort DESC + ORDER BY es.sort DESC,es.id DESC \ No newline at end of file