Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangw 2025-03-19 14:43:56 +08:00
commit 953099c104
6 changed files with 228 additions and 7 deletions

View File

@ -43,7 +43,7 @@ public class MemberPointsController {
* 001-会员积分账户信息
*/
@GetMapping("userPoints")
public CzgResult<MemberPoints> getMemberPoints(@RequestParam("userId") Long shopUserId) {
public CzgResult<MemberPoints> getMemberPoints(@RequestParam Long shopUserId) {
MemberPoints data = memberPointsService.getMemberPoints(shopUserId);
return CzgResult.success(data);
}
@ -55,7 +55,7 @@ public class MemberPointsController {
* @param orderAmount 订单金额
*/
@GetMapping("calcUsablePoints")
public CzgResult<OrderDeductionPointsDTO> getMemberUsablePoints(@RequestParam("userId") Long shopUserId, @RequestParam BigDecimal orderAmount) {
public CzgResult<OrderDeductionPointsDTO> getMemberUsablePoints(@RequestParam Long shopUserId, @RequestParam BigDecimal orderAmount) {
OrderDeductionPointsDTO usablePoints = memberPointsService.getMemberUsablePoints(shopUserId, orderAmount);
return CzgResult.success(usablePoints);
}
@ -68,7 +68,7 @@ public class MemberPointsController {
* @param deductionAmount 抵扣金额
*/
@GetMapping("calcUsedPoints")
public CzgResult<Integer> calcUsedPoints(@RequestParam("userId") Long shopUserId, @RequestParam BigDecimal orderAmount, @RequestParam BigDecimal deductionAmount) {
public CzgResult<Integer> calcUsedPoints(@RequestParam Long shopUserId, @RequestParam BigDecimal orderAmount, @RequestParam BigDecimal deductionAmount) {
int points = memberPointsService.calcUsedPoints(shopUserId, orderAmount, deductionAmount);
return CzgResult.success(points);
}
@ -77,7 +77,7 @@ public class MemberPointsController {
* 003-根据积分计算可抵扣金额
*/
@GetMapping("calcDeductionAmount")
public CzgResult<BigDecimal> calcDeductionAmount(@RequestParam("userId") Long shopUserId, @RequestParam BigDecimal orderAmount, @RequestParam Integer points) {
public CzgResult<BigDecimal> calcDeductionAmount(@RequestParam Long shopUserId, @RequestParam BigDecimal orderAmount, @RequestParam Integer points) {
BigDecimal deductionAmount = memberPointsService.calcDeductionAmount(shopUserId, orderAmount, points);
return CzgResult.success(deductionAmount);
}

View File

@ -0,0 +1,53 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2po.mysql.rds.aliyuncs.com:3306/czg_cashier_test?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: account-server
qos-port: 22223
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
threads: 20
port: 10103
name: dubbo
serialization: hessian2
seata:
application-id: account-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@ -0,0 +1,56 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2po.mysql.rds.aliyuncs.com:3306/czg_cashier_test?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: order-server
qos-port: 22233
qos-enable: true
logger: log4j2
environment: test
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
port: 10203
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: order-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@ -0,0 +1,50 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2po.mysql.rds.aliyuncs.com:3306/czg_cashier_test?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22243
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
port: 10303
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: product-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@ -0,0 +1,53 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2po.mysql.rds.aliyuncs.com:3306/czg_cashier_test?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
lettuce:
pool:
min-idle: 0
max-idle: 8
max-wait: -1ms
max-active: 16
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
dubbo:
application:
name: system-server
qos-port: 22253
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
port: 10403
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: system-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -690,14 +691,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.where(OrderInfo::getId).eq(orderInfo.getId());
if (payOrderId != null) {
updateChain.set(OrderInfo::getPayOrderId, payOrderId);
orderInfo.setPayOrderId(payOrderId);
}
if (orderInfo.getCreditBuyerId() != null) {
updateChain.set(OrderInfo::getCreditBuyerId, orderInfo.getCreditBuyerId());
}
if (ObjectUtil.isNotNull(payType)) {
updateChain.set(OrderInfo::getPayType, payType.getValue());
orderInfo.setPayType(payType.getValue());
}
boolean update = updateChain.update();
if (update) {
orderInfo.setPayAmount(payAmount);
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
orderInfo.setPaidTime(payTime);
}
updateChain.update();
if (orderInfo.getUserId() != null) {
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
if (shopUser == null) {
@ -718,8 +726,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
}
}
if ((orderInfo.getPayType() != null && orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue()))
|| (payType != null && !payType.equals(PayEnums.VIP_PAY))) {
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
if ((orderInfo.getPayType() != null && !ArrayUtil.contains(payTypes, orderInfo.getPayType()))
|| (payType != null && !ArrayUtil.contains(payTypes, payType))) {
//下单赠送积分
pointsService.consumeAwardPoints(shopUser.getId(), orderInfo);
}