diff --git a/ruoyi-admin/src/main/java/org/dromara/web/controller/HomeController.java b/ruoyi-admin/src/main/java/org/dromara/web/controller/HomeController.java index 9999bd6..50ef4a5 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/controller/HomeController.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/controller/HomeController.java @@ -30,7 +30,7 @@ public class HomeController { */ @GetMapping("order/{id}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) { - return R.ok(tpOrderService.queryById(id)); + return R.ok(tpOrderService.selectById(id)); } /** diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 0661aab..7132cd6 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -47,26 +47,26 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) -# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: sjzx0618 -# password: 2b1%Hk3#1Uolol + url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + username: sjzx0618 + password: 2b1%Hk3#1Uolol - url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true - username: root - password: root +# url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# username: root +# password: root # 从库数据源 slave: lazy: false type: ${spring.datasource.type} driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: sjzx0618 -# password: 2b1%Hk3#1Uolol + url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + username: sjzx0618 + password: 2b1%Hk3#1Uolol - url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true - username: hmsj - password: s4xjHffmwG58RADk +# url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# username: root +# password: root hikari: # 最大连接池数量 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 7c24b88..ed0ef69 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -54,22 +54,22 @@ spring: # username: sjzx0618 # password: 2b1%Hk3#1Uolol - url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true - username: hmsj - password: s4xjHffmwG58RADk + url: jdbc:mysql://localhost:13306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + username: root + password: root # 从库数据源 slave: lazy: false type: ${spring.datasource.type} driverClassName: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: sjzx0618 -# password: 2b1%Hk3#1Uolol + url: jdbc:mysql://123.60.57.176:3306/sjzxerp20250618?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + username: sjzx0618 + password: 2b1%Hk3#1Uolol - url: jdbc:mysql://erp9.52o.site:13308/hmsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true - username: hmsj - password: s4xjHffmwG58RADk +# url: jdbc:mysql://localhost:3306/new_xgt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# username: root +# password: root hikari: # 最大连接池数量 maxPoolSize: 20 diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/TpOrder.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/TpOrder.java index 5aed123..52eb291 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/TpOrder.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/TpOrder.java @@ -243,7 +243,7 @@ public class TpOrder { /** * 集材社订单ID */ - private Long jcOrderId; + private Long jcsOrderId; /** * 接待客服名称 diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/bo/TpOrderBo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/bo/TpOrderBo.java index 57a4544..5776827 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/bo/TpOrderBo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/bo/TpOrderBo.java @@ -324,6 +324,6 @@ public class TpOrderBo extends BaseEntity { /** * 集材社订单ID */ - private Long jcOrderId; + private Long jcsOrderId; } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderSumVo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderSumVo.java index 37bb4ab..29a2c8e 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderSumVo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderSumVo.java @@ -67,4 +67,9 @@ public class CustomerOrderSumVo implements Serializable { * 实际已到款 */ private BigDecimal sjydk; + + /** + * 优惠券总额 + */ + private BigDecimal yhqze; } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderVo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderVo.java index 79a36af..699cb9c 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderVo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/CustomerOrderVo.java @@ -267,4 +267,14 @@ public class CustomerOrderVo implements Serializable { */ private String byThree; + /** + * 抵扣金 + */ + private BigDecimal coupon; + + /** + * 集材社订单ID + */ + private Long jcsOrderId; + } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderSumVo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderSumVo.java index 4def4d5..2ac7231 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderSumVo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderSumVo.java @@ -48,4 +48,9 @@ public class SkillOrderSumVo implements Serializable { * 已传模型 */ private Long ycmx; + + /** + * 优惠券总额 + */ + private BigDecimal yhqze; } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderVo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderVo.java index 50cbd29..f045b97 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderVo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/SkillOrderVo.java @@ -209,4 +209,14 @@ public class SkillOrderVo implements Serializable { */ private String byThree; + /** + * 抵扣金 + */ + private BigDecimal coupon; + + /** + * 集材社订单ID + */ + private Long jcsOrderId; + } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/TpOrderVo.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/TpOrderVo.java index b0ae4a7..f985781 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/TpOrderVo.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/domain/vo/TpOrderVo.java @@ -330,6 +330,6 @@ public class TpOrderVo implements Serializable { /** * 集材社订单ID */ - private Long jcOrderId; + private Long jcsOrderId; } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/ITpOrderService.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/ITpOrderService.java index 947dff1..b65f1f1 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/ITpOrderService.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/ITpOrderService.java @@ -1,6 +1,7 @@ package org.dromara.work.service; import com.github.yulichang.base.MPJBaseService; +import jakarta.validation.constraints.NotNull; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.system.domain.bo.SysDeptBo; @@ -206,4 +207,11 @@ public interface ITpOrderService extends MPJBaseService { * @return */ Boolean updateInfoByBo(TpOrderBo bo); + + /** + * 查询订单信息 + * @param id + * @return + */ + TpOrderVo selectById(@NotNull(message = "主键不能为空") Long id); } diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java index 3d42056..d3ce12c 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java @@ -148,9 +148,9 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl wrapper = buildQueryRankingMPJWrapper(bo) .selectAs("count(1)",OrderRankingSumVo::getTotalOrderNum) .selectAs("sum(price)",OrderRankingSumVo::getTotalPerformance) - .selectAs("sum(pay_price - kfpay)",OrderRankingSumVo::getTotalPaidAmount) - .selectAs("concat(round(sum(pay_price - kfpay)/sum(price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate) + .selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingSumVo::getTotalPaidAmount) + .selectAs("concat(round(sum((pay_price + coupon) - kfpay)/sum(price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate) .leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getSid) .leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId) .eq(TpOrder::getIsDel,1); @@ -241,8 +241,8 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl wrapper = buildQueryRankingMPJWrapper(bo) .selectAs("count(1)",OrderRankingSumVo::getTotalOrderNum) .selectAs("sum(js_price)",OrderRankingSumVo::getTotalPerformance) - .selectAs("sum(js_pay_price)",OrderRankingSumVo::getTotalPaidAmount) - .selectAs("concat(round(sum(js_pay_price)/sum(js_price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate) + .selectAs("sum(js_pay_price + coupon)",OrderRankingSumVo::getTotalPaidAmount) + .selectAs("concat(round(sum(js_pay_price + coupon)/sum(js_price) * 100),'%')",OrderRankingSumVo::getTotalCompletionRate) .leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getBid) .leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId) .eq(TpOrder::getIsDel,1) diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpOrderServiceImpl.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpOrderServiceImpl.java index 7875fdb..9786ccf 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpOrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpOrderServiceImpl.java @@ -113,6 +113,31 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl wrapper = new MPJLambdaWrapper<>(); + wrapper.selectAll(TpOrder.class); + wrapper.selectAs(TpClient::getName,TpOrderVo::getCname); + wrapper.selectAs("s.nick_name",TpOrderVo::getSname) + .selectAs("f.nick_name",TpOrderVo::getFname) + .selectAs("b.nick_name",TpOrderVo::getBname) + .selectAs(TpWechat::getCode,TpOrderVo::getWname) + .leftJoin(SysUser.class,"s",SysUser::getUserId,TpOrder::getSid) + .leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid) + .leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid) + .leftJoin(TpClient.class,TpClient::getId,TpOrder::getKid) + .leftJoin(TpClientStaff.class,TpClientStaff::getId,TpOrder::getSkid) + .leftJoin(TpWechat.class,TpWechat::getId,TpOrder::getWid); + wrapper.eq(id != null, TpOrder::getId, id); + return baseMapper.selectJoinOne(TpOrderVo.class,wrapper); + } + /** * 回收站导出订单 * @@ -273,10 +298,10 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl 0){ - order.setGpay(getGjPayPrice(order.getPrice(),newPayPrice,order.getGjPrice())); + order.setGpay(getGjPayPrice(order.getPrice(),newPayPrice.add(order.getCoupon()),order.getGjPrice())); } BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),newPayPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice())); order.setJsPayPrice(getJsPay(jsPayPrice)); @@ -835,12 +860,12 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl 0) { order.setPayState(2); order.setDjPrice(payPrice); - order.setEndPrice(order.getPrice().subtract(payPrice)); + order.setEndPrice(order.getPrice().subtract(payPrice.add(order.getCoupon()))); }else if (payPrice.compareTo(BigDecimal.ZERO) == 0) { order.setState(1); order.setPayState(1); order.setDjPrice(payPrice); - order.setEndPrice(order.getPrice().subtract(payPrice)); + order.setEndPrice(order.getPrice().subtract(payPrice.add(order.getCoupon()))); } if(type.equals(1)){ if(order.getKhpay().subtract(order.getCdPrice()).subtract(price).compareTo(BigDecimal.ZERO) < 0){ @@ -874,7 +899,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl 0){ - order.setGpay(getGjPayPrice(order.getPrice(),payPrice,order.getGjPrice())); + order.setGpay(getGjPayPrice(order.getPrice(),payPrice.add(order.getCoupon()),order.getGjPrice())); } BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),payPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice())); order.setJsPayPrice(getJsPay(jsPayPrice)); @@ -968,7 +993,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl lqw = buildQueryMPJWrapperKF(bo); - lqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getPayPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getCdPrice,TpOrder::getKfpay) + lqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getPayPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getCdPrice,TpOrder::getKfpay,TpOrder::getCoupon) .leftJoin(SysUser.class,"s",SysUser::getUserId,TpOrder::getSid) .leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid) .leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid) @@ -1033,17 +1058,19 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl new BigDecimal(String.valueOf(f.getGjPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal gjydk = list.stream().map(f -> new BigDecimal(String.valueOf(f.getGpay()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze = list.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); + vo.setYhqze(yhqze); vo.setGjyj(gjyj); vo.setGjydk(gjydk); vo.setZyjSum(zyjSum); vo.setYdkSum(ydkSum); - vo.setWdkSum(zyjSum.subtract(ydkSum)); + vo.setWdkSum(zyjSum.subtract(ydkSum.add(yhqze))); // 检查 zyjSum 是否为零 if (zyjSum.compareTo(BigDecimal.ZERO) == 0) { vo.setDkl("0%"); } else { - BigDecimal dkl = ydkSum.divide(zyjSum, 2, RoundingMode.HALF_UP); + BigDecimal dkl = (ydkSum.add(yhqze)).divide(zyjSum, 2, RoundingMode.HALF_UP); vo.setDkl(dkl.multiply(BigDecimal.valueOf(100)) + "%"); } // 检查 orderCount 是否为零 @@ -1084,37 +1111,40 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl lqw = new LambdaQueryWrapper() - .select(TpOrder::getPrice,TpOrder::getPayPrice) + .select(TpOrder::getPrice,TpOrder::getPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getSid,loginUser.getUserId()) .ge(TpOrder::getAddTime,year); List list = baseMapper.selectList(lqw); BigDecimal ywcYSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkYSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze = list.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcYSum(String.valueOf(ywcYSum)); - indexSumVo.setYdkYSum(String.valueOf(ydkYSum)); + indexSumVo.setYdkYSum(String.valueOf(ydkYSum.add(yhqze))); LambdaQueryWrapper lqw1 = new LambdaQueryWrapper() - .select(TpOrder::getPrice,TpOrder::getPayPrice) + .select(TpOrder::getPrice,TpOrder::getPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getSid,loginUser.getUserId()) .ge(TpOrder::getAddTime,month+"-01"); List list1 = baseMapper.selectList(lqw1); BigDecimal ywcMSum = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkMSum = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze1 = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcMSum(String.valueOf(ywcMSum)); - indexSumVo.setYdkMSum(String.valueOf(ydkMSum)); + indexSumVo.setYdkMSum(String.valueOf(ydkMSum.add(yhqze1))); LambdaQueryWrapper lqw2 = new LambdaQueryWrapper() - .select(TpOrder::getPrice,TpOrder::getPayPrice) + .select(TpOrder::getPrice,TpOrder::getPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getSid,loginUser.getUserId()) .ge(TpOrder::getAddTime,day); List list2 = baseMapper.selectList(lqw2); BigDecimal ywcDSum = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkDSum = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze2 = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcDSum(String.valueOf(ywcDSum)); - indexSumVo.setYdkDSum(String.valueOf(ydkDSum)); + indexSumVo.setYdkDSum(String.valueOf(ydkDSum.add(yhqze2))); return indexSumVo; } @@ -1135,42 +1165,45 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl lqw = new LambdaQueryWrapper() - .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice) + .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getBid,loginUser.getUserId()) .between(TpOrder::getAddTime,year+"-01-01 00:00:00",endDay); List list = baseMapper.selectList(lqw); BigDecimal ywcYSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkYSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze = list.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcYSum(String.valueOf(ywcYSum)); - indexSumVo.setYdkYSum(String.valueOf(ydkYSum)); + indexSumVo.setYdkYSum(String.valueOf(ydkYSum.add(yhqze))); // indexSumVo.setYwcYSum(getMinMultipleOfOneThousand(ywcYSum.intValue())+"以上"); // indexSumVo.setYdkYSum(getMinMultipleOfOneThousand(ydkYSum.intValue())+"以上"); LambdaQueryWrapper lqw1 = new LambdaQueryWrapper() - .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice) + .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getBid,loginUser.getUserId()) .between(TpOrder::getAddTime,month+"-01 00:00:00",endDay); List list1 = baseMapper.selectList(lqw1); BigDecimal ywcMSum = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkMSum = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze1 = list1.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcMSum(String.valueOf(ywcMSum)); - indexSumVo.setYdkMSum(String.valueOf(ydkMSum)); + indexSumVo.setYdkMSum(String.valueOf(ydkMSum.add(yhqze1))); // indexSumVo.setYwcMSum(getMinMultipleOfOneThousand(ywcMSum.intValue())+"以上"); // indexSumVo.setYdkMSum(getMinMultipleOfOneThousand(ydkMSum.intValue())+"以上"); LambdaQueryWrapper lqw2 = new LambdaQueryWrapper() - .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice) + .select(TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getCoupon) .eq(TpOrder::getIsDel,1) .eq(TpOrder::getBid,loginUser.getUserId()) .between(TpOrder::getAddTime,yesterday+" 00:00:00",endDay); List list2 = baseMapper.selectList(lqw2); BigDecimal ywcDSum = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkDSum = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqze2 = list2.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); indexSumVo.setYwcDSum(String.valueOf(ywcDSum)); - indexSumVo.setYdkDSum(String.valueOf(ydkDSum)); + indexSumVo.setYdkDSum(String.valueOf(ydkDSum.add(yhqze2))); // indexSumVo.setYwcDSum(getMinMultipleOfOneThousand(ywcDSum.intValue())+"以上"); // indexSumVo.setYdkDSum(getMinMultipleOfOneThousand(ydkDSum.intValue())+"以上"); @@ -1200,7 +1233,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl olqw = buildQueryMPJWrapper(bo); - olqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getGjPrice,TpOrder::getJsPrice,TpOrder::getJsPayPrice) + olqw.select(TpOrder::getId,TpOrder::getPrice,TpOrder::getGjPrice,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getCoupon) .leftJoin(SysUser.class,"s",SysUser::getUserId,TpOrder::getSid) .leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid) .leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid) @@ -1209,14 +1242,16 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl list = baseMapper.selectJoinList(TpOrderVo.class,olqw); BigDecimal zyjSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getPrice().subtract(f.getGjPrice())))).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal ydkSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getJsPayPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal yhqzeSum = list.stream().map(f -> new BigDecimal(String.valueOf(f.getCoupon()))).reduce(BigDecimal.ZERO, BigDecimal::add); vo.setZyjSum(zyjSum); vo.setYdkSum(ydkSum); + vo.setYhqze(yhqzeSum); // 检查 zyjSum 是否为零 if (zyjSum.compareTo(BigDecimal.ZERO) == 0) { vo.setDkl("0%"); } else { - BigDecimal dkl = ydkSum.divide(zyjSum, 2, RoundingMode.HALF_UP); + BigDecimal dkl = (ydkSum.add(yhqzeSum)).divide(zyjSum, 2, RoundingMode.HALF_UP); vo.setDkl(dkl.multiply(BigDecimal.valueOf(100)) + "%"); } //List结果集取订单ID diff --git a/ruoyi-modules/ruoyi-work/src/main/resources/mapper/work/TpOrderMapper.xml b/ruoyi-modules/ruoyi-work/src/main/resources/mapper/work/TpOrderMapper.xml index 95839f0..e273948 100644 --- a/ruoyi-modules/ruoyi-work/src/main/resources/mapper/work/TpOrderMapper.xml +++ b/ruoyi-modules/ruoyi-work/src/main/resources/mapper/work/TpOrderMapper.xml @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND o.dept_id = d.dept_id ) AS total_sales, - (SELECT SUM(o.pay_price) + (SELECT SUM(o.pay_price + o.coupon) FROM tp_order AS o WHERE o.is_del = 1 @@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND o.dept_id_js = d.dept_id ) AS total_sales, - (SELECT SUM(o.js_pay_price) + (SELECT SUM(o.js_pay_price + o.coupon) FROM tp_order AS o WHERE o.is_del = 1