feat(work): 新增订单修改功能并增加抵扣金和集材社订单ID字段
- 在 ITpOrderService 接口中新增 updateInfoByBo 方法用于修改订单信息 - 在 TpOrder、TpOrderBo、TpOrderVo 类中添加 coupon(抵扣金)和 jcOrderId(集材社订单ID)字段 - 更新 TpOrderServiceImpl 中的订单修改逻辑,考虑抵扣金因素
This commit is contained in:
@@ -30,7 +30,7 @@ public class HomeController {
|
||||
*/
|
||||
@GetMapping("order/{id}")
|
||||
public R<TpOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
return R.ok(tpOrderService.queryById(id));
|
||||
return R.ok(tpOrderService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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:
|
||||
# 最大连接池数量
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -243,7 +243,7 @@ public class TpOrder {
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
private Long jcsOrderId;
|
||||
|
||||
/**
|
||||
* 接待客服名称
|
||||
|
||||
@@ -324,6 +324,6 @@ public class TpOrderBo extends BaseEntity {
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
private Long jcsOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -67,4 +67,9 @@ public class CustomerOrderSumVo implements Serializable {
|
||||
* 实际已到款
|
||||
*/
|
||||
private BigDecimal sjydk;
|
||||
|
||||
/**
|
||||
* 优惠券总额
|
||||
*/
|
||||
private BigDecimal yhqze;
|
||||
}
|
||||
|
||||
@@ -267,4 +267,14 @@ public class CustomerOrderVo implements Serializable {
|
||||
*/
|
||||
private String byThree;
|
||||
|
||||
/**
|
||||
* 抵扣金
|
||||
*/
|
||||
private BigDecimal coupon;
|
||||
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcsOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -48,4 +48,9 @@ public class SkillOrderSumVo implements Serializable {
|
||||
* 已传模型
|
||||
*/
|
||||
private Long ycmx;
|
||||
|
||||
/**
|
||||
* 优惠券总额
|
||||
*/
|
||||
private BigDecimal yhqze;
|
||||
}
|
||||
|
||||
@@ -209,4 +209,14 @@ public class SkillOrderVo implements Serializable {
|
||||
*/
|
||||
private String byThree;
|
||||
|
||||
/**
|
||||
* 抵扣金
|
||||
*/
|
||||
private BigDecimal coupon;
|
||||
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcsOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -330,6 +330,6 @@ public class TpOrderVo implements Serializable {
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
private Long jcsOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -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<TpOrder> {
|
||||
* @return
|
||||
*/
|
||||
Boolean updateInfoByBo(TpOrderBo bo);
|
||||
|
||||
/**
|
||||
* 查询订单信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
TpOrderVo selectById(@NotNull(message = "主键不能为空") Long id);
|
||||
}
|
||||
|
||||
@@ -148,9 +148,9 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
.selectAs(SysDept::getDeptName,OrderRankingVo::getDeptName)
|
||||
.selectAs("count(1)",OrderRankingVo::getOrderNum)
|
||||
.selectAs("sum(price)",OrderRankingVo::getTotalPerformance)
|
||||
.selectAs("sum(pay_price - kfpay)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum((pay_price + coupon) - kfpay)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(end_price)",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(pay_price)/(SELECT CASE WHEN m.gongsi = 0 THEN m.geren ELSE m.gongsi END AS result_field FROM tp_month m WHERE m.sid = t.sid AND m.`month` = '" + bo.getMonth() + "') * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round(sum(pay_price + coupon)/(SELECT CASE WHEN m.gongsi = 0 THEN m.geren ELSE m.gongsi END AS result_field FROM tp_month m WHERE m.sid = t.sid AND m.`month` = '" + bo.getMonth() + "') * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round(sum(end_price)/sum(price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getSid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
@@ -184,10 +184,10 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
.selectAs(SysDept::getDeptName,OrderRankingVo::getDeptName)
|
||||
.selectAs("count(1)",OrderRankingVo::getOrderNum)
|
||||
.selectAs("sum(js_price)",OrderRankingVo::getTotalPerformance)
|
||||
.selectAs("sum(js_pay_price)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(js_price) - sum(js_pay_price)",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price)/sum(js_price) * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round((sum(js_price) - sum(js_pay_price))/sum(js_price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.selectAs("sum(js_pay_price + coupon)",OrderRankingVo::getCompletionAmount)
|
||||
.selectAs("sum(js_price) - sum(js_pay_price + coupon)",OrderRankingVo::getUnpaidAmount)
|
||||
.selectAs("concat(round(sum(js_pay_price + coupon)/sum(js_price) * 100),'%')",OrderRankingVo::getTargetCompletionRate)
|
||||
.selectAs("concat(round((sum(js_price) - sum(js_pay_price + coupon))/sum(js_price) * 100),'%')",OrderRankingVo::getDeadOrderRate)
|
||||
.leftJoin(SysUser.class,SysUser::getUserId,TpOrder::getBid)
|
||||
.leftJoin(SysDept.class,SysDept::getDeptId,SysUser::getDeptId)
|
||||
.eq(TpOrder::getIsDel,1)
|
||||
@@ -217,8 +217,8 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper, TpO
|
||||
MPJLambdaWrapper<TpOrder> 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<TpOrderMapper, TpO
|
||||
MPJLambdaWrapper<TpOrder> 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)
|
||||
|
||||
@@ -113,6 +113,31 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
return baseMapper.selectJoinOne(TpOrderVo.class,wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TpOrderVo selectById(Long id) {
|
||||
MPJLambdaWrapper<TpOrder> 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<TpOrderMapper,TpOrder
|
||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||
}else {
|
||||
if (loginUser.getIdentity() == 3 || loginUser.getIdentity() == 1){
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getKfpay,TpOrder::getState,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getDtTime,TpOrder::getSid,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||
}else {
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getRemark,TpOrder::getType,TpOrder::getAddTime,TpOrder::getNum,TpOrder::getJsRemark,TpOrder::getPrice,TpOrder::getPayState,TpOrder::getPayPrice,TpOrder::getEndPrice,TpOrder::getGjPrice,TpOrder::getGpay,TpOrder::getIsCd,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
||||
wrapper.selectAs(TpClientStaff::getName,CustomerOrderVo::getCname);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +309,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
.selectAs("f.nick_name",CustomerOrderVo::getFname)
|
||||
.selectAs("b.nick_name",CustomerOrderVo::getBname)
|
||||
.selectAs(TpWechat::getCode,CustomerOrderVo::getWname)
|
||||
.selectAs("concat(round(t.pay_price/t.price * 100),'%')",CustomerOrderVo::getBili)
|
||||
.selectAs("concat(round((t.pay_price + t.coupon)/t.price * 100),'%')",CustomerOrderVo::getBili)
|
||||
.leftJoin(SysUser.class,"s",SysUser::getUserId,TpOrder::getSid)
|
||||
.leftJoin(SysUser.class,"f",SysUser::getUserId,TpOrder::getFid)
|
||||
.leftJoin(SysUser.class,"b",SysUser::getUserId,TpOrder::getBid)
|
||||
@@ -319,7 +344,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
if(LoginHelper.isSuperAdmin()){
|
||||
wrapper.selectAll(TpOrder.class);
|
||||
}else {
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree);
|
||||
wrapper.select(TpOrder::getId,TpOrder::getOrderId,TpOrder::getType,TpOrder::getNum,TpOrder::getAddTime,TpOrder::getRemark,TpOrder::getJsRemark,TpOrder::getPayState,TpOrder::getJsPrice,TpOrder::getJsPayPrice,TpOrder::getState,TpOrder::getDtTime,TpOrder::getByOne,TpOrder::getByTwo,TpOrder::getByThree,TpOrder::getCoupon,TpOrder::getJcsOrderId);
|
||||
}
|
||||
wrapper.selectAs("s.nick_name",SkillOrderVo::getSname)
|
||||
.selectAs("f.nick_name",SkillOrderVo::getFname)
|
||||
@@ -785,7 +810,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
}
|
||||
|
||||
if(order.getGjPrice() != null || order.getGjPrice().compareTo(BigDecimal.ZERO) > 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<TpOrderMapper,TpOrder
|
||||
} else if (payPrice.compareTo(BigDecimal.ZERO) > 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<TpOrderMapper,TpOrder
|
||||
}
|
||||
|
||||
if(order.getGjPrice() != null || order.getGjPrice().compareTo(BigDecimal.ZERO) > 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<TpOrderMapper,TpOrder
|
||||
}
|
||||
order.setGjPrice(price);
|
||||
order.setJsPrice(order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice(),price));
|
||||
order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice().add(order.getCoupon()),price));
|
||||
BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getCdPrice()).subtract(price));
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice));
|
||||
}else{
|
||||
@@ -1004,7 +1029,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
vo.setOrderCount(orderCount);
|
||||
|
||||
MPJLambdaWrapper<TpOrder> 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<TpOrderMapper,TpOrder
|
||||
}
|
||||
BigDecimal gjyj = list.stream().map(f -> 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<TpOrderMapper,TpOrder
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<TpOrder> lqw = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrder> lqw1 = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrder> lqw2 = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrderMapper,TpOrder
|
||||
|
||||
IndexSumVo indexSumVo = new IndexSumVo();
|
||||
LambdaQueryWrapper<TpOrder> lqw = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrder> lqw1 = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrder> lqw2 = new LambdaQueryWrapper<TpOrder>()
|
||||
.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<TpOrder> 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<TpOrderMapper,TpOrder
|
||||
vo.setOrderCount(orderCount);
|
||||
|
||||
MPJLambdaWrapper<TpOrder> 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<TpOrderMapper,TpOrder
|
||||
List<TpOrderVo> 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
|
||||
|
||||
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND o.dept_id = d.dept_id
|
||||
</if>
|
||||
) 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
|
||||
<if test="bo.startTime != null and bo.endTime != null">
|
||||
@@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND o.dept_id_js = d.dept_id
|
||||
</if>
|
||||
) 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
|
||||
<if test="bo.startTime != null and bo.endTime != null">
|
||||
|
||||
Reference in New Issue
Block a user