feat:bug修改
This commit is contained in:
1 parent
557b7d637e
commit
a694547960
24 files changed
+195
-23
No files matched your search
+9
@@ -12,6 +12,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface TradeBrokerageRecordApi {
|
||||
|
||||
/**
|
||||
* 添加朋友圈分销【多级分佣】
|
||||
* 首次分销才有用
|
||||
* @param userId 会员编号
|
||||
* @param bizType 业务类型
|
||||
* @param list 请求参数列表
|
||||
*/
|
||||
void addRecentBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, @Valid List<BrokerageAddDTO> list);
|
||||
|
||||
/**
|
||||
* 增加佣金【多级分佣】
|
||||
*
|
||||
|
||||
+16
@@ -14,11 +14,17 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageAddDTO;
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageWechatTransferDTO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper;
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -27,6 +33,7 @@ import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
public class TradeBrokerageRecordApiImpl implements TradeBrokerageRecordApi {
|
||||
@@ -42,6 +49,15 @@ public class TradeBrokerageRecordApiImpl implements TradeBrokerageRecordApi {
|
||||
@Resource
|
||||
private PayTransferApi payTransferApi;
|
||||
|
||||
/**
|
||||
* 添加朋友圈分销【多级分佣】
|
||||
* 首次分销才有用
|
||||
*/
|
||||
@Override
|
||||
public void addRecentBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddDTO> list) {
|
||||
brokerageRecordService.addRecentBrokerage(userId, bizType, BeanUtils.toBean(list, BrokerageAddReqBO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddDTO> list) {
|
||||
brokerageRecordService.addBrokerage(userId, bizType, BeanUtils.toBean(list, BrokerageAddReqBO.class));
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class BrokerageCodeServiceImpl implements BrokerageCodeService {
|
||||
boolean isRepet = true;
|
||||
String code = null;
|
||||
while (isRepet) {
|
||||
code = RandomUtil.randomNumbers(8);
|
||||
code = RandomUtil.randomNumbers(6);
|
||||
BrokerageCodeDO brokerageCode = brokerageCodeMapper.selectOne(BrokerageCodeDO::getCode, code);
|
||||
isRepet = ObjectUtil.isNotEmpty(brokerageCode);
|
||||
}
|
||||
|
||||
+7
-3
@@ -51,6 +51,12 @@ public interface BrokerageRecordService {
|
||||
*/
|
||||
void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, @Valid List<BrokerageAddReqBO> list);
|
||||
|
||||
/**
|
||||
* 添加朋友圈分销【多级分佣】
|
||||
* 首次分销才有用
|
||||
*/
|
||||
void addRecentBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddReqBO> list);
|
||||
|
||||
/**
|
||||
* 增加佣金【只针对自己】
|
||||
*
|
||||
@@ -134,8 +140,7 @@ public interface BrokerageRecordService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 排行榜分页
|
||||
*/
|
||||
PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice(
|
||||
AppBrokerageUserRankPageReqVO pageReqVO);
|
||||
PageResult<AppBrokerageUserRankByPriceRespVO> getBrokerageUserChildSummaryPageByPrice(AppBrokerageUserRankPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取用户的排名(基于佣金总数)
|
||||
@@ -154,5 +159,4 @@ public interface BrokerageRecordService {
|
||||
* @return 用户佣金
|
||||
*/
|
||||
AppBrokerageProductPriceRespVO calculateProductBrokeragePrice(Long userId, Long spuId);
|
||||
|
||||
}
|
||||
+55
@@ -6,6 +6,7 @@ import cn.hutool.core.util.*;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
||||
@@ -105,6 +106,60 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService {
|
||||
bizType, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加朋友圈分销【多级分佣】
|
||||
* 首次分销才有用
|
||||
*
|
||||
* @param userId 会员编号
|
||||
* @param bizType 业务类型
|
||||
* @param list 请求参数列表
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addRecentBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddReqBO> list) {
|
||||
TradeConfigDO memberConfig = tradeConfigService.getTradeConfig();
|
||||
// 0 未启用分销功能
|
||||
if (memberConfig == null || !BooleanUtil.isTrue(memberConfig.getBrokerageEnabled())) {
|
||||
log.error("[addBrokerage][增加佣金失败:brokerageEnabled 未配置,userId({}) bizType({}) list({})", userId, bizType, list);
|
||||
return;
|
||||
}
|
||||
|
||||
// 1.1 获得一级推广人
|
||||
BrokerageUserDO firstUser = brokerageUserService.getBindBrokerageUser(userId);
|
||||
if (firstUser == null || !BooleanUtil.isTrue(firstUser.getBrokerageEnabled())) {
|
||||
return;
|
||||
}
|
||||
// 1.1.1查看一级分销员是否已经分销过
|
||||
Long firstSuccessCount = brokerageRecordMapper.selectCount(new LambdaQueryWrapperX<BrokerageRecordDO>()
|
||||
.eq(BrokerageRecordDO::getUserId, firstUser.getId())
|
||||
.eq(BrokerageRecordDO::getBizType, bizType.getType())
|
||||
.eq(BrokerageRecordDO::getSourceUserId, userId)
|
||||
);
|
||||
if (firstSuccessCount <= 0) {
|
||||
// 1.2 计算一级分佣
|
||||
addBrokerage(firstUser, list, memberConfig.getBrokerageFrozenDays(), memberConfig.getBrokerageFirstPercent(), bizType, 1);
|
||||
}
|
||||
|
||||
// 2.1 获得二级推广员
|
||||
if (firstUser.getBindUserId() == null) {
|
||||
return;
|
||||
}
|
||||
BrokerageUserDO secondUser = brokerageUserService.getBrokerageUser(firstUser.getBindUserId());
|
||||
if (secondUser == null || !BooleanUtil.isTrue(secondUser.getBrokerageEnabled())) {
|
||||
return;
|
||||
}
|
||||
// 2.1.1查看二级分销员是否已经分销过
|
||||
Long secondSuccessCount = brokerageRecordMapper.selectCount(new LambdaQueryWrapperX<BrokerageRecordDO>()
|
||||
.eq(BrokerageRecordDO::getUserId, secondUser.getId())
|
||||
.eq(BrokerageRecordDO::getBizType, bizType)
|
||||
.eq(BrokerageRecordDO::getSourceUserId, userId)
|
||||
);
|
||||
if (secondSuccessCount <= 0) {
|
||||
// 2.2 计算二级分佣
|
||||
addBrokerage(secondUser, list, memberConfig.getBrokerageFrozenDays(), memberConfig.getBrokerageSecondPercent(), bizType, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelBrokerage(BrokerageRecordBizTypeEnum bizType, String bizId) {
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ public class PosterPicGen {
|
||||
|
||||
private String title = "荷塘月色";
|
||||
|
||||
private String description = "来自缘分的相遇";
|
||||
private String description = "荷塘湖畔 相伴月色";
|
||||
|
||||
private String code = "";
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PosterPicGen {
|
||||
// 设置 code
|
||||
writeCenterText(new Font("Arial, sans-serif", Font.BOLD, 28), this.code, 270);
|
||||
// 设置 bottomDescription
|
||||
writeCenterText(new Font("PingFang SC, sans-serif", Font.PLAIN, 12), this.bottomDescription, 640);
|
||||
writeCenterText(new Font("PingFang SC, sans-serif", Font.PLAIN, 12), this.bottomDescription, 650);
|
||||
// 插入二维码
|
||||
if (ObjectUtil.isNotEmpty(this.qrCodeUrl)) {
|
||||
int qrWidth = 150;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 81 KiB |
+1
@@ -19,6 +19,7 @@ public enum MemberRecentTagEnum {
|
||||
NEW_PERSON("2", "新人"),
|
||||
HOME_RECOMMEND("3", "首页推荐"),
|
||||
VIP("4", "VIP用户"),
|
||||
GODDESS("4", "女神"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+10
@@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.controller.app.comauth.vo.CreateWechatAuthReqVo;
|
||||
import cn.iocoder.yudao.module.member.service.comauth.ComAuthService;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationBO;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationService;
|
||||
import cn.iocoder.yudao.module.member.service.opentype.BO.OpenTypeExtBO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
@@ -45,6 +48,8 @@ public class AppMemberUserController {
|
||||
private OpenTypeService openTypeService;
|
||||
@Resource
|
||||
private ComAuthService comAuthService;
|
||||
@Resource
|
||||
private LocationService locationService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@@ -57,6 +62,11 @@ public class AppMemberUserController {
|
||||
result.setMemberTagList(memberRecentTagList);
|
||||
// 获取用户会员信息
|
||||
OpenTypeExtBO vipExt = openTypeService.getExtByMemeberId(user.getId());
|
||||
// 获取用户最有一次定位
|
||||
LocationBO currentLocation = locationService.getCurrentUserLastLocation();
|
||||
if (ObjectUtil.isNotEmpty(currentLocation)) {
|
||||
result.setCurrentLocation(currentLocation);
|
||||
}
|
||||
result.setMemberVip(vipExt);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.user.vo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationBO;
|
||||
import cn.iocoder.yudao.module.member.service.opentype.BO.OpenTypeExtBO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberRecentTagDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -63,7 +65,10 @@ public class AppMemberUserInfoRespVO {
|
||||
|
||||
@Schema(description = "用户会员信息")
|
||||
private OpenTypeExtBO memberVip;
|
||||
|
||||
|
||||
@Schema(description = "当前位置")
|
||||
private LocationBO currentLocation;
|
||||
|
||||
@Schema(description = "微信号")
|
||||
private String wechatNum;
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class AppViewController {
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "2000");
|
||||
put("search-action", "SQUARE_NEW_TIME");
|
||||
put("label", "最近");
|
||||
put("label", "附近");
|
||||
}});
|
||||
// 男生
|
||||
if (SexEnum.isMale(currentUser.getSex())) {
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.member.service.location;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LocationBO {
|
||||
/**
|
||||
* 用户位置id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private Long memberId;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Double lon;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private Double lat;
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
private String district;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ public interface LocationService {
|
||||
/**
|
||||
* 获得当前用户位置记录
|
||||
*/
|
||||
LocationDO getCurrentUserLastLocation();
|
||||
LocationBO getCurrentUserLastLocation();
|
||||
|
||||
/**
|
||||
* 获得用户最后的位置记录列表
|
||||
|
||||
+3
-2
@@ -101,8 +101,8 @@ public class LocationServiceImpl implements LocationService {
|
||||
* 获得当前用户位置记录
|
||||
*/
|
||||
@Override
|
||||
public LocationDO getCurrentUserLastLocation() {
|
||||
return locationMapper.selectOne(new LambdaQueryWrapperX<LocationDO>()
|
||||
public LocationBO getCurrentUserLastLocation() {
|
||||
LocationDO location = locationMapper.selectOne(new LambdaQueryWrapperX<LocationDO>()
|
||||
.eq(LocationDO::getMemberId, getLoginUserId())
|
||||
.isNotNull(LocationDO::getProvince)
|
||||
.isNotNull(LocationDO::getCity)
|
||||
@@ -111,6 +111,7 @@ public class LocationServiceImpl implements LocationService {
|
||||
.orderByDesc(LocationDO::getId)
|
||||
.last(" LIMIT 1")
|
||||
);
|
||||
return BeanUtils.toBean(location, LocationBO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+27
-4
@@ -6,6 +6,9 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.api.thirdauth.ThirdAuthVo;
|
||||
import cn.iocoder.yudao.module.member.client.service.TxMapApi;
|
||||
import cn.iocoder.yudao.module.member.client.vo.txmap.geocoder.TxMapGeocoderReqVO;
|
||||
import cn.iocoder.yudao.module.member.client.vo.txmap.geocoder.TxMapGeocoderRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.*;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.config.MemberConfigDO;
|
||||
@@ -22,6 +25,7 @@ import cn.iocoder.yudao.module.member.enums.MemberRecentOperateEnum;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberRecentSceneEnum;
|
||||
import cn.iocoder.yudao.module.member.enums.tag.MemberRecentTagEnum;
|
||||
import cn.iocoder.yudao.module.member.service.config.MemberConfigService;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationBO;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationService;
|
||||
import cn.iocoder.yudao.module.member.client.service.ThirdAuthService;
|
||||
import cn.iocoder.yudao.module.member.service.opentype.OpenTypeService;
|
||||
@@ -93,6 +97,9 @@ public class RecentServiceImpl implements RecentService {
|
||||
@Resource
|
||||
private OpenTypeService openTypeService;
|
||||
|
||||
@Resource
|
||||
private TxMapApi txMapApi;
|
||||
|
||||
/**
|
||||
* 创建朋友圈
|
||||
*/
|
||||
@@ -104,6 +111,22 @@ public class RecentServiceImpl implements RecentService {
|
||||
if (ObjectUtil.isEmpty(user)) throw exception(MemberErrorCode.USER_NOT_EXISTS);
|
||||
// 判断是否为会员
|
||||
|
||||
// 判断是否有位置信息
|
||||
if (!ObjectUtil.isAllNotEmpty(vo.getIssueProvince(), vo.getIssueCity(), vo.getIssueDistrict(), vo.getIssueAddress())) {
|
||||
if (ObjectUtil.isAllNotEmpty(vo.getIssueLat(), vo.getIssueLong())) {
|
||||
TxMapGeocoderRespVO geocoder = txMapApi.geocoder(TxMapGeocoderReqVO.builder().location(vo.getIssueLat() + "," + vo.getIssueLong()).build());
|
||||
if (ObjectUtil.isNotEmpty(geocoder) && ObjectUtil.isNotEmpty(geocoder.getAddress_component())) {
|
||||
vo.setIssueProvince(geocoder.getAddress_component().getProvince());
|
||||
vo.setIssueCity(geocoder.getAddress_component().getCity());
|
||||
vo.setIssueDistrict(geocoder.getAddress_component().getDistrict());
|
||||
vo.setIssueAddress(geocoder.getAddress_component().getStreet());
|
||||
if (ObjectUtil.isNotEmpty(geocoder.getFormatted_addresses()) && ObjectUtil.isNotEmpty(geocoder.getFormatted_addresses().getRecommend())) {
|
||||
vo.setIssueAddress(geocoder.getFormatted_addresses().getRecommend());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 插入
|
||||
RecentDO recent = BeanUtils.toBean(vo, RecentDO.class);
|
||||
recentMapper.insert(recent);
|
||||
@@ -148,7 +171,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
RecentDO recent = recentMapper.selectById(recentId);
|
||||
RecentPageResVo result = BeanUtil.toBean(recent, RecentPageResVo.class);
|
||||
|
||||
LocationDO currentUserLastLocation = locationService.getCurrentUserLastLocation();
|
||||
LocationBO currentUserLastLocation = locationService.getCurrentUserLastLocation();
|
||||
// 查询发送朋友圈用户
|
||||
convertRecentPageResVoSetupMember(result, false);
|
||||
// 查询用户最新的位置
|
||||
@@ -585,7 +608,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
// 添加用户信息
|
||||
convertRecentPageResVoSetupMember(result, isVip);
|
||||
// 查询用户最新的位置
|
||||
LocationDO currentUserLastLocation = locationService.getCurrentUserLastLocation();
|
||||
LocationBO currentUserLastLocation = locationService.getCurrentUserLastLocation();
|
||||
convertRecentPageResVoSetupLocation(result, currentUserLastLocation);
|
||||
// 添加用户相册
|
||||
convertRecentPageResVoSetupPhoto(result);
|
||||
@@ -754,7 +777,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
/**
|
||||
* 为RecentPageResVo设置Location信息
|
||||
*/
|
||||
private void convertRecentPageResVoSetupLocation(RecentPageResVo detail, LocationDO selfLocation) {
|
||||
private void convertRecentPageResVoSetupLocation(RecentPageResVo detail, LocationBO selfLocation) {
|
||||
if (ObjectUtil.isEmpty(detail) || ObjectUtil.isEmpty(selfLocation)) return;
|
||||
MemberExtBO member = detail.getMember();
|
||||
if (ObjectUtil.isAllNotEmpty(member.getMemberLng(), member.getMemberLat())) {
|
||||
@@ -837,7 +860,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
}
|
||||
}
|
||||
// 查询用户最新的位置(根据位置的查询)
|
||||
LocationDO locationDO = locationService.getCurrentUserLastLocation();
|
||||
LocationBO locationDO = locationService.getCurrentUserLastLocation();
|
||||
if (ObjectUtil.isNotEmpty(locationDO)) {
|
||||
resultQuery.setCurrentLat(locationDO.getLat());
|
||||
resultQuery.setCurrentLng(locationDO.getLon());
|
||||
|
||||
+1
@@ -186,6 +186,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
entity.setAppRefreshDate(member.getAppRefreshDate());
|
||||
entity.setMemberLat(member.getLat());
|
||||
entity.setMemberLng(member.getLng());
|
||||
entity.setMemberCity(member.getCity());
|
||||
entity.setWechatNum(member.getWechatNum());
|
||||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.wallet;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthCheckReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthPageReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthRespVO;
|
||||
@@ -109,7 +110,7 @@ public class WalletTxAuthController {
|
||||
@PostMapping("/update-transfer")
|
||||
@Operation(summary = "更新转账记录(回调)")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateTransfer(@RequestBody PayRefundNotifyReqDTO notifyReqDTO) {
|
||||
public CommonResult<Boolean> updateTransfer(@RequestBody PayTransferNotifyReqDTO notifyReqDTO) {
|
||||
log.info("[updateTransfer][notifyReqDTO({})]", notifyReqDTO);
|
||||
walletTxAuthService.updateTransfer(notifyReqDTO);
|
||||
return success(true);
|
||||
|
||||
+3
@@ -36,6 +36,9 @@ public class WalletTxAuthRespVO {
|
||||
@ExcelProperty("提现类型绑定id")
|
||||
private Long bizId;
|
||||
|
||||
@Schema(description = "提现缘都金额")
|
||||
private Integer txYdPrice;
|
||||
|
||||
@Schema(description = "提现金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "18586")
|
||||
@ExcelProperty("提现金额")
|
||||
private Integer txPrice;
|
||||
|
||||
+3
@@ -25,4 +25,7 @@ public class AppPayWalletRespVO {
|
||||
@Schema(description = "(礼物)累计充值,单位分")
|
||||
private Integer giftTotalRecharge;
|
||||
|
||||
@Schema(description = "(礼物)礼物冻结金额,单位分")
|
||||
private Integer giftFreezePrice;
|
||||
|
||||
}
|
||||
+1
-2
@@ -237,8 +237,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
.setTitle(String.format("用户[%s]充值[%s]元", user.getNickname(), fenToYuanStr(payOrderDO.getPrice())))
|
||||
);
|
||||
}};
|
||||
tradeBrokerageRecordApi.addBrokerage(user.getId(), BrokerageRecordBizTypeEnum.ORDER, brokerageList);
|
||||
|
||||
tradeBrokerageRecordApi.addRecentBrokerage(user.getId(), BrokerageRecordBizTypeEnum.ORDER, brokerageList);
|
||||
// 5. 发送订阅消息
|
||||
getSelf().sendWalletRechargerPaidMessage(payOrderId, recharge);
|
||||
}
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ public class PayWalletServiceImpl implements PayWalletService {
|
||||
return lockRedisDAO.lock(walletId, UPDATE_TIMEOUT_MILLIS, () -> {
|
||||
// 3. 更新钱包金额
|
||||
switch (bizType) {
|
||||
case RECEIVE_GIFT: // 收到礼物
|
||||
case RECEIVE_GIFT_TX: // 收到礼物
|
||||
walletMapper.updateWhenGiftConsumption(payWallet.getId(), price);
|
||||
break;
|
||||
default: {
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthCheckReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthPageReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthRespVO;
|
||||
@@ -20,7 +21,7 @@ public interface WalletTxAuthService {
|
||||
/**
|
||||
* 更新转账记录(回调)
|
||||
*/
|
||||
void updateTransfer(PayRefundNotifyReqDTO notifyReqDTO);
|
||||
void updateTransfer(PayTransferNotifyReqDTO notifyReqDTO);
|
||||
|
||||
/**
|
||||
* 礼物申请提现
|
||||
|
||||
+4
-3
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.member.api.config.dto.MemberConfigRespDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.transfer.PayTransferApiImpl;
|
||||
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.txauth.WalletTxAuthCheckReqVO;
|
||||
@@ -76,8 +77,8 @@ public class WalletTxAuthServiceImpl implements WalletTxAuthService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTransfer(PayRefundNotifyReqDTO notifyReqDTO) {
|
||||
Long id = notifyReqDTO.getPayRefundId();
|
||||
public void updateTransfer(PayTransferNotifyReqDTO notifyReqDTO) {
|
||||
Long id = notifyReqDTO.getPayTransferId();
|
||||
PayTransferRespDTO transfer = payTransferApi.getTransfer(id);
|
||||
WalletTxAuthDO detail = walletTxAuthMapper.selectOne(new LambdaQueryWrapperX<WalletTxAuthDO>()
|
||||
.eq(WalletTxAuthDO::getPayTransferId, id)
|
||||
@@ -102,7 +103,7 @@ public class WalletTxAuthServiceImpl implements WalletTxAuthService {
|
||||
updateObj.setCheckStatus(PayWalletTxAuthStatusEnum.AUTH_TX_ERROR.getType());
|
||||
walletTxAuthMapper.updateById(updateObj);
|
||||
}
|
||||
if (PayTransferStatusEnum.isClosed(transfer.getStatus())) {
|
||||
if (PayTransferStatusEnum.isSuccess(transfer.getStatus())) {
|
||||
// 解冻
|
||||
walletService.unfreezeGiftPrice(detail.getWalletId(), detail.getTxYdPrice());
|
||||
// 进行扣款
|
||||
|
||||
Reference in new issue
Block a user