Compare commits
9 Commits
a367a286ce
...
0549a077b2
| Author | SHA1 | Date | |
|---|---|---|---|
| 0549a077b2 | |||
| 45965fb426 | |||
| 034a8c4650 | |||
| 4cd71ad35a | |||
| 64830203f3 | |||
| c542f18938 | |||
| cc40a8a7f0 | |||
| f10bafce52 | |||
| 3e42b534e0 |
@@ -15,8 +15,11 @@ import com.czg.resp.CzgResult;
|
|||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.task.DistributionTask;
|
import com.czg.task.DistributionTask;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
|
import com.czg.utils.FunUtils;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.NestedExceptionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -27,6 +30,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/distribution")
|
@RequestMapping("/user/distribution")
|
||||||
public class UDistributionController {
|
public class UDistributionController {
|
||||||
@@ -103,6 +107,20 @@ public class UDistributionController {
|
|||||||
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员中心-获取邀请码
|
||||||
|
*/
|
||||||
|
@GetMapping("/autoGetInviteCode")
|
||||||
|
public CzgResult<String> autoGetInviteCode(@RequestParam Long shopId, @RequestParam Long shopUserId) {
|
||||||
|
try {
|
||||||
|
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
||||||
|
} catch (Exception e) {
|
||||||
|
String rootMsg = NestedExceptionUtils.getMostSpecificCause(e).getMessage();
|
||||||
|
log.error("获取邀请码失败用户:{},:{}", shopUserId, rootMsg);
|
||||||
|
return CzgResult.success("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-实名认证
|
* 分销员中心-实名认证
|
||||||
*/
|
*/
|
||||||
@@ -115,6 +133,19 @@ public class UDistributionController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员中心-无感-绑定邀请人
|
||||||
|
*/
|
||||||
|
@PostMapping("/autoBindInviteUser")
|
||||||
|
public CzgResult<Map<String, Object>> autoBindInviteUser(@RequestBody MkDistributionUserDTO param) {
|
||||||
|
AssertUtil.isNull(param.getId(), "店铺用户ID不能为空");
|
||||||
|
AssertUtil.isNull(param.getShopId(), "店铺ID不能为空");
|
||||||
|
AssertUtil.isNull(param.getInviteCode(), "邀请码不能为空");
|
||||||
|
FunUtils.asyncSafeRunVoid(() -> distributionUserService.bindInviteUser(param), "无感绑定上级");
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-绑定邀请人
|
* 分销员中心-绑定邀请人
|
||||||
*/
|
*/
|
||||||
@@ -172,9 +203,6 @@ public class UDistributionController {
|
|||||||
/**
|
/**
|
||||||
* 收益明细
|
* 收益明细
|
||||||
*
|
*
|
||||||
* @param startTime
|
|
||||||
* @param endTime
|
|
||||||
* @param shopId
|
|
||||||
* @param status pending待入账 success已入账
|
* @param status pending待入账 success已入账
|
||||||
*/
|
*/
|
||||||
@GetMapping("/distributionFlow")
|
@GetMapping("/distributionFlow")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.czg.resp.CzgRespCode;
|
|||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||||
|
import org.springframework.core.NestedExceptionUtils;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
@@ -164,20 +165,23 @@ public class CzgControllerAdvice {
|
|||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public CzgResult<Object> errorHandler(Exception ex) {
|
public CzgResult<Object> errorHandler(Exception ex) {
|
||||||
log.error("系统未处理异常", ex);
|
log.error("系统未处理异常", ex);
|
||||||
Throwable rootCause = ex;
|
String rootMsg = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
|
||||||
while (rootCause.getCause() != null && !(rootCause instanceof CzgException)) {
|
return CzgResult.failure(CzgRespCode.FAILURE.getCode(), rootMsg);
|
||||||
rootCause = rootCause.getCause();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 如果根因是CzgException,直接抛出/返回该异常
|
// Throwable rootCause = ex;
|
||||||
if (rootCause instanceof CzgException exception) {
|
// while (rootCause.getCause() != null && !(rootCause instanceof CzgException)) {
|
||||||
return CzgResult.failure(exception.getCode(), exception.getMsg());
|
// rootCause = rootCause.getCause();
|
||||||
}else if (rootCause instanceof ValidateException exception) {
|
// }
|
||||||
return CzgResult.failure(exception.getStatus(), exception.getMessage());
|
//
|
||||||
}
|
// // 2. 如果根因是CzgException,直接抛出/返回该异常
|
||||||
|
// if (rootCause instanceof CzgException exception) {
|
||||||
|
// return CzgResult.failure(exception.getCode(), exception.getMsg());
|
||||||
|
// }else if (rootCause instanceof ValidateException exception) {
|
||||||
|
// return CzgResult.failure(exception.getStatus(), exception.getMessage());
|
||||||
|
// }
|
||||||
|
|
||||||
// 3. 非业务异常,按原有逻辑处理
|
// 3. 非业务异常,按原有逻辑处理
|
||||||
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统错误,请联系管理员");
|
// return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统错误,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setErrorLog(Exception ex) {
|
private void setErrorLog(Exception ex) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
userConfig.setIsShare(true);
|
userConfig.setIsShare(true);
|
||||||
// config2.setTimeout(2000);
|
// config2.setTimeout(2000);
|
||||||
userConfig.setTokenStyle("simple-uuid");
|
userConfig.setTokenStyle("simple-uuid");
|
||||||
MyStpLogic.CLIENT_LOGIC.setConfig(userConfig);
|
MyStpLogic.USER_LOGIC.setConfig(userConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
@@ -62,18 +62,15 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
// 重置根路径,防止satoken切割根路径导致匹配不到路径
|
// 重置根路径,防止satoken切割根路径导致匹配不到路径
|
||||||
ApplicationInfo.routePrefix = "";
|
ApplicationInfo.routePrefix = "";
|
||||||
|
|
||||||
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**", "/user/home/**", "/user/dict/**", "/user/openId")
|
SaRouter
|
||||||
.notMatch("/pay/**")
|
.match("/user/**")
|
||||||
.notMatch("/notify/**")
|
.notMatch("/user/login", "/user/geo/**", "/user/home/**", "/user/dict/**", "/user/openId")
|
||||||
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
|
.check(r -> MyStpLogic.USER_LOGIC.checkLogin())
|
||||||
.setHit(true)
|
.setHit(true)
|
||||||
// .match("/**")
|
// .match("/**")
|
||||||
.notMatch("/user/**")
|
|
||||||
.notMatch("/pay/**")
|
|
||||||
.notMatch("/notify/**")
|
.notMatch("/notify/**")
|
||||||
.notMatch("/admin/auth/**")
|
.notMatch("/admin/auth/**")
|
||||||
.notMatch("/admin/shopMsgPush/subscribe/**")
|
.notMatch("/admin/shopMsgPush/subscribe/**")
|
||||||
.notMatch("/admin/coupon/grant")
|
|
||||||
.check(r -> {
|
.check(r -> {
|
||||||
ServletRequestAttributes attributes =
|
ServletRequestAttributes attributes =
|
||||||
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.util.function.Consumer;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Getter
|
@Getter
|
||||||
public class MyStpLogic {
|
public class MyStpLogic {
|
||||||
public static final StpLogic CLIENT_LOGIC = new StpLogic("client");
|
public static final StpLogic USER_LOGIC = new StpLogic("user");
|
||||||
public static final StpLogic ADMIN_LOGIC = new StpLogic("admin");
|
public static final StpLogic ADMIN_LOGIC = new StpLogic("admin");
|
||||||
|
|
||||||
public Object isPC() {
|
public Object isPC() {
|
||||||
@@ -42,7 +42,7 @@ public class MyStpLogic {
|
|||||||
private StpLogic getLogic() {
|
private StpLogic getLogic() {
|
||||||
boolean hit = SaRouter.match("/user/**").isHit();
|
boolean hit = SaRouter.match("/user/**").isHit();
|
||||||
if (hit) {
|
if (hit) {
|
||||||
return CLIENT_LOGIC;
|
return USER_LOGIC;
|
||||||
}
|
}
|
||||||
return ADMIN_LOGIC;
|
return ADMIN_LOGIC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||||||
/**
|
/**
|
||||||
* 分销员中心-获取邀请码
|
* 分销员中心-获取邀请码
|
||||||
*/
|
*/
|
||||||
String getInviteCode(Long shopId, Long shopUserId);
|
String getInviteCode(Long shopId, Long shopUserId) throws CzgException, ValidateException ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-实名认证
|
* 分销员中心-实名认证
|
||||||
|
|||||||
@@ -58,8 +58,13 @@ public class LtPayOtherDTO {
|
|||||||
* 对应的记录Id 支付回调向该内容进行回填
|
* 对应的记录Id 支付回调向该内容进行回填
|
||||||
* 积分商品为 mk_points_goods_record 主键id
|
* 积分商品为 mk_points_goods_record 主键id
|
||||||
* 团购商品为 gb_order_detail 主键id
|
* 团购商品为 gb_order_detail 主键id
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
private Long recordId;
|
private Long recordId;
|
||||||
|
/**
|
||||||
|
* 霸王餐充值为 订单id 会员充值为 活动id
|
||||||
|
*/
|
||||||
|
private Long relatedId;
|
||||||
|
|
||||||
public void checkPayInfo(){
|
public void checkPayInfo(){
|
||||||
AssertUtil.isBlank(payType, "支付方式不能为空");
|
AssertUtil.isBlank(payType, "支付方式不能为空");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.czg.utils;
|
|||||||
import cn.hutool.core.lang.func.Func0;
|
import cn.hutool.core.lang.func.Func0;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.NestedExceptionUtils;
|
||||||
import org.springframework.transaction.support.TransactionSynchronization;
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
|
|
||||||
@@ -27,11 +28,17 @@ public class FunUtils {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void asyncSafeRunVoid(Runnable func, String... msg) {
|
||||||
|
ThreadUtil.execAsync(() -> safeRunVoid(func, msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void safeRunVoid(Runnable func, String... msg) {
|
public static void safeRunVoid(Runnable func, String... msg) {
|
||||||
try {
|
try {
|
||||||
func.run();
|
func.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn(msg.length > 0 ? msg[0] : "方法执行失败: {}", e.getMessage());
|
String message = NestedExceptionUtils.getMostSpecificCause(e).getMessage();
|
||||||
|
log.warn((msg.length > 0 ? msg[0] : "方法执行失败") + ": " + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +50,6 @@ public class FunUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void asyncSafeRunVoid(Runnable func, String... msg) {
|
|
||||||
ThreadUtil.execAsync(() -> safeRunVoid(func, msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在事务提交后执行方法
|
* 在事务提交后执行方法
|
||||||
* 异步 执行
|
* 异步 执行
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
and a.table_code is not null
|
and a.table_code is not null
|
||||||
</if>
|
</if>
|
||||||
group by a.id
|
group by a.id
|
||||||
ORDER BY a.create_time
|
ORDER BY a.area_id,a.id
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -198,18 +198,18 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String getInviteCode(Long shopId, Long shopUserId) {
|
public String getInviteCode(Long shopId, Long shopUserId) throws CzgException, ValidateException {
|
||||||
ShopUser shopUser = shopUserService.getById(shopUserId);
|
ShopUser shopUser = shopUserService.getById(shopUserId);
|
||||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||||
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
||||||
if (mkDistributionConfigVO == null || mkDistributionConfigVO.getIsEnable() == 0) {
|
if (mkDistributionConfigVO == null || mkDistributionConfigVO.getIsEnable() == 0) {
|
||||||
throw new CzgException("店铺分销功能未开启");
|
throw new CzgException("店铺分销功能未开启");
|
||||||
}
|
}
|
||||||
|
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(shopUser.getId(), shopId);
|
||||||
|
if (mkDistributionUser == null) {
|
||||||
if (!"auto".equals(mkDistributionConfigVO.getOpenType())) {
|
if (!"auto".equals(mkDistributionConfigVO.getOpenType())) {
|
||||||
throw new CzgException("该店铺不可自行成为分销员");
|
throw new CzgException("该店铺不可自行成为分销员");
|
||||||
}
|
}
|
||||||
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(shopUser.getId(), shopId);
|
|
||||||
if (mkDistributionUser == null) {
|
|
||||||
mkDistributionUser = new MkDistributionUser();
|
mkDistributionUser = new MkDistributionUser();
|
||||||
mkDistributionUser.setId(shopUser.getId());
|
mkDistributionUser.setId(shopUser.getId());
|
||||||
mkDistributionUser.setShopId(shopId);
|
mkDistributionUser.setShopId(shopId);
|
||||||
|
|||||||
@@ -1066,10 +1066,27 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
// 分销奖励
|
// 分销奖励
|
||||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||||
}
|
}
|
||||||
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
} else if (PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||||
boolean isFree = PayTypeConstants.SourceType.FREE.equals(payment.getSourceType());
|
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||||
|
if (shopUser == null) {
|
||||||
|
log.error("霸王餐回调失败,会员不存在,会员id:{}", payment.getSourceId());
|
||||||
|
} else {
|
||||||
|
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getId, payment.getRelatedId()));
|
||||||
|
if (orderInfo == null) {
|
||||||
|
log.error("霸王餐支付,订单不存在,支付记录Id,{}", payment.getId());
|
||||||
|
} else {
|
||||||
|
//增加余额
|
||||||
|
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||||
|
.setId(shopUser.getId()).setType(1)
|
||||||
|
.setBizEnum(ShopUserFlowBizEnum.FREE_IN)
|
||||||
|
.setRelationId(orderInfo.getId())
|
||||||
|
.setMoney(BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
||||||
|
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||||
|
upOrderInfo(orderInfo, BigDecimal.ZERO, LocalDateTime.now(), null, PayEnums.FREE_PAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType())) {
|
||||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||||
OrderInfo orderInfo;
|
|
||||||
if (shopUser == null) {
|
if (shopUser == null) {
|
||||||
log.error("会员充值失败,会员不存在,会员id:{}", payment.getSourceId());
|
log.error("会员充值失败,会员不存在,会员id:{}", payment.getSourceId());
|
||||||
} else {
|
} else {
|
||||||
@@ -1081,43 +1098,23 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
} else {
|
} else {
|
||||||
bizEnum = ShopUserFlowBizEnum.CASH_IN;
|
bizEnum = ShopUserFlowBizEnum.CASH_IN;
|
||||||
}
|
}
|
||||||
if (isFree) {
|
|
||||||
orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getId, payment.getRelatedId()));
|
|
||||||
if (orderInfo == null) {
|
|
||||||
log.error("霸王餐支付,订单不存在,支付记录Id,{}", payment.getId());
|
|
||||||
} else {
|
|
||||||
//增加余额
|
|
||||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
|
||||||
.setId(shopUser.getId())
|
|
||||||
.setType(1)
|
|
||||||
.setBizEnum(ShopUserFlowBizEnum.FREE_IN)
|
|
||||||
.setRelationId(orderInfo.getId())
|
|
||||||
.setMoney(BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
|
||||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
|
||||||
upOrderInfo(orderInfo, BigDecimal.ZERO,
|
|
||||||
LocalDateTime.now(), null, PayEnums.FREE_PAY);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//充值并支付 ↓
|
//充值并支付 ↓
|
||||||
orderInfo = orderInfoService.getOne(new QueryWrapper()
|
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper()
|
||||||
.eq(OrderInfo::getPayOrderId, payment.getId())
|
.eq(OrderInfo::getPayOrderId, payment.getId())
|
||||||
.eq(OrderInfo::getPayType, PayEnums.VIP_PAY.getValue()));
|
.eq(OrderInfo::getPayType, PayEnums.VIP_PAY.getValue()));
|
||||||
if (orderInfo != null) {
|
if (orderInfo != null) {
|
||||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||||
.setId(shopUser.getId())
|
.setId(shopUser.getId()).setType(0)
|
||||||
.setType(0)
|
|
||||||
.setBizEnum(ShopUserFlowBizEnum.ORDER_PAY)
|
.setBizEnum(ShopUserFlowBizEnum.ORDER_PAY)
|
||||||
.setRelationId(orderInfo.getId())
|
.setRelationId(orderInfo.getId())
|
||||||
.setMoney(orderInfo.getOrderAmount());
|
.setMoney(orderInfo.getOrderAmount());
|
||||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||||
upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
upOrderInfo(orderInfo, orderInfo.getOrderAmount(), LocalDateTime.now(), null, PayEnums.VIP_PAY);
|
||||||
LocalDateTime.now(), null, PayEnums.VIP_PAY);
|
|
||||||
}
|
}
|
||||||
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
||||||
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
||||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||||
//购买会员
|
//购买会员
|
||||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
AssertUtil.isBlank(param.getPayType(), "支付方式不能为空");
|
AssertUtil.isBlank(param.getPayType(), "支付方式不能为空");
|
||||||
String payOrderNo = "LT" + IdUtil.getSnowflakeNextId();
|
String payOrderNo = "LT" + IdUtil.getSnowflakeNextId();
|
||||||
initPayment(OrderPayment.pay(param.getShopId(), param.getRecordId(), payType, payOrderNo,
|
initPayment(OrderPayment.pay(param.getShopId(), param.getRecordId(), payType, payOrderNo,
|
||||||
param.getPrice(), "", null));
|
param.getPrice(), "", param.getRelatedId()));
|
||||||
return pay(param.getShopId(), CzgPayEnum.LT_PAY,
|
return pay(param.getShopId(), CzgPayEnum.LT_PAY,
|
||||||
CzgPayBaseReq.ltPayReq(payOrderNo, detail, param.getPrice().multiply(MONEY_RATE).longValue(),
|
CzgPayBaseReq.ltPayReq(payOrderNo, detail, param.getPrice().multiply(MONEY_RATE).longValue(),
|
||||||
param.getPayType(), param.getOpenId(), param.getIp()));
|
param.getPayType(), param.getOpenId(), param.getIp()));
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
.setRecordId(shopUser.getId())
|
.setRecordId(shopUser.getId())
|
||||||
.setPrice(memberOrder.getAmount())
|
.setPrice(memberOrder.getAmount())
|
||||||
.setIp(clientIp);
|
.setIp(clientIp);
|
||||||
|
payParam1.setRelatedId(memberOrder.getId());
|
||||||
return payService.ltPayOther(payParam1, PayTypeConstants.SourceType.MEMBER_PAY, "会员充值");
|
return payService.ltPayOther(payParam1, PayTypeConstants.SourceType.MEMBER_PAY, "会员充值");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +191,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
.setRecordId(shopUser.getId())
|
.setRecordId(shopUser.getId())
|
||||||
.setPrice(payParam.getAmount())
|
.setPrice(payParam.getAmount())
|
||||||
.setIp(clintIp);
|
.setIp(clintIp);
|
||||||
|
payParam1.setRelatedId(isFree ? payParam.getOrderId() : payParam.getRechargeDetailId());
|
||||||
return payService.ltPayOther(payParam1, payType, "会员充值");
|
return payService.ltPayOther(payParam1, payType, "会员充值");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +218,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
.setRecordId(shopUser.getId())
|
.setRecordId(shopUser.getId())
|
||||||
.setPrice(amount)
|
.setPrice(amount)
|
||||||
.setIp(clientIp);
|
.setIp(clientIp);
|
||||||
|
payParam.setRelatedId(isFree ? rechargeDTO.getOrderId() : rechargeDTO.getRechargeDetailId());
|
||||||
return payService.ltPayOther(payParam, payType, "会员充值");
|
return payService.ltPayOther(payParam, payType, "会员充值");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user