ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -179,12 +179,36 @@ orderGoodsVO.setGoodsName(goods.getName()); orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); orderGoodsVO.setNum(order.getNum()); // 获取积分兑换比例配置 R<SysConfig> sysConfigR = sysConfigClient.getInfo(6L); if (sysConfigR == null || sysConfigR.getData() == null) { throw new ServiceException("获取积分兑换比例配置失败"); } String configValue = sysConfigR.getData().getConfigValue(); if (StringUtils.isBlank(configValue)) { throw new ServiceException("积分兑换比例配置值为空"); } // 使用BigDecimal处理比例,避免精度问题 BigDecimal ratio = new BigDecimal(configValue.trim()); if (ratio.compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("积分兑换比例必须大于0"); } if (null != goodsSeckill) { orderGoodsVO.setSellingPrice(goodsSeckill.getSellingPrice()); orderGoodsVO.setIntegral(goodsSeckill.getIntegral()); if(Objects.nonNull(goodsSeckill.getSellingPrice())){ orderGoodsVO.setIntegral(goodsSeckill.getSellingPrice().multiply(ratio).intValue()); } else { orderGoodsVO.setSellingPrice(goods.getSellingPrice()); orderGoodsVO.setIntegral(goodsSeckill.getIntegral()); } orderGoodsVO.setSellingPrice(goodsSeckill.getSellingPrice()); } else { if(Objects.nonNull(goods.getSellingPrice())){ orderGoodsVO.setIntegral(goods.getSellingPrice().multiply(ratio).intValue()); }else { orderGoodsVO.setIntegral(goods.getIntegral()); } orderGoodsVO.setSellingPrice(goods.getSellingPrice()); } @@ -786,7 +810,30 @@ confirmOrderVo.setResidualPoint(appUser.getAvailablePoint()); //插入价格 confirmOrderVo.setCash(good.getSellingPrice()); confirmOrderVo.setPoint(good.getIntegral()); // 获取积分兑换比例配置 R<SysConfig> sysConfigR = sysConfigClient.getInfo(6L); if (sysConfigR == null || sysConfigR.getData() == null) { throw new ServiceException("获取积分兑换比例配置失败"); } String configValue = sysConfigR.getData().getConfigValue(); if (StringUtils.isBlank(configValue)) { throw new ServiceException("积分兑换比例配置值为空"); } try { // 使用BigDecimal处理比例,避免精度问题 BigDecimal ratio = new BigDecimal(configValue.trim()); if (ratio.compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("积分兑换比例必须大于0"); } // 计算积分并四舍五入取整 int point = good.getSellingPrice().multiply(ratio).intValue(); confirmOrderVo.setPoint(point); } catch (NumberFormatException e) { throw new RuntimeException("积分兑换比例配置值格式错误", e); } catch (ArithmeticException e) { throw new RuntimeException("积分计算结果溢出", e); } //是否在秒杀活动中 GetSeckillActivityInfo info = new GetSeckillActivityInfo(); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TServiceController.java
@@ -147,7 +147,7 @@ } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); Map<String,String> res = wechatPayService.unifiedOrder(code, site.getAnnualServiceFee()+"", "服务费缴纳", "/other/wx/serviceCallback"); Map<String,String> res = wechatPayService.unifiedOrder(code, site.getAnnualServiceFee()+"", site.getCode()+"服务费缴纳", "/other/wx/serviceCallback"); ServicePay servicePay = new ServicePay(); servicePay.setUserId(data.getUserId()); servicePay.setAmount(site.getAnnualServiceFee()); @@ -213,7 +213,7 @@ servicePayService.save(servicePay); return wechatPayService.unifiedOrderApplet(servicePay.getId()+"",code, site.getAnnualServiceFee()+"", "服务费缴纳",data.getOpenId(), "/other/wx/serviceCallback"); return wechatPayService.unifiedOrderApplet(servicePay.getId()+"",code, site.getAnnualServiceFee()+"", site.getCode()+"服务费缴纳",data.getOpenId(), "/other/wx/serviceCallback"); } public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { // 将 BufferedImage 转换为字节数组 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -108,16 +108,18 @@ list = new ArrayList<>(uniqueGoodsMap.values()); for (GoodsVO goods : list) { //计算所需价格和积分 Price price = getPrice( goods.getGoodsId()); if(null != price){ //秒杀活动 goods.setSellingPrice(price.getCash()); goods.setIntegral(price.getPoint()); goods.setStartTime(price.getStartTime()); goods.setEndTime(price.getEndTime()); goods.setPurchaseLimit(price.getPurchaseLimit()); } Integer point = getPoint(goods.getSellingPrice()); goods.setIntegral(point); // //计算所需价格和积分 // Price price = getPrice( goods.getGoodsId()); // if(null != price){ // //秒杀活动 // goods.setSellingPrice(price.getCash()); // goods.setIntegral(price.getPoint()); // goods.setStartTime(price.getStartTime()); // goods.setEndTime(price.getEndTime()); // goods.setPurchaseLimit(price.getPurchaseLimit()); // } } //手动排序 if(StringUtils.isNotEmpty(search.getOrderByColumn())){ @@ -214,15 +216,17 @@ goodsVO.setGoodsName(goods.getName()); //计算所需价格和积分 Price price = getPrice( goods.getId()); if(null != price){ //秒杀活动 goodsVO.setSellingPrice(price.getCash()); goodsVO.setIntegral(price.getPoint()); goodsVO.setStartTime(price.getStartTime()); goodsVO.setEndTime(price.getEndTime()); goodsVO.setPurchaseLimit(price.getPurchaseLimit()); } // Price price = getPrice( goods.getId()); // if(null != price){ // //秒杀活动 // goodsVO.setSellingPrice(price.getCash()); // goodsVO.setIntegral(price.getPoint()); // goodsVO.setStartTime(price.getStartTime()); // goodsVO.setEndTime(price.getEndTime()); // goodsVO.setPurchaseLimit(price.getPurchaseLimit()); // } Integer point = getPoint(goodsVO.getSellingPrice()); goodsVO.setIntegral(point); //已售数量 Integer data = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); goodsVO.setSaleNum(data);