feat:bug修改
This commit is contained in:
1 parent
bb942b08bc
commit
d6f80025e4
20 files changed
+187
-17
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.trade.api.brokerage;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageAddDTO;
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分销记录 API 接口
|
||||
*/
|
||||
public interface TradeBrokerageRecordApi {
|
||||
|
||||
/**
|
||||
* 增加佣金【多级分佣】
|
||||
* @param userId 会员编号
|
||||
* @param bizType 业务类型
|
||||
* @param list 请求参数列表
|
||||
*/
|
||||
void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, @Valid List<BrokerageAddDTO> list);
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.trade.api.brokerage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class BrokerageAddDTO {
|
||||
|
||||
/**
|
||||
* 业务编号
|
||||
*/
|
||||
@NotBlank(message = "业务编号不能为空")
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* 佣金基数
|
||||
*/
|
||||
@NotNull(message = "佣金基数不能为空")
|
||||
private Integer basePrice;
|
||||
|
||||
/**
|
||||
* 一级佣金(固定)
|
||||
*/
|
||||
@NotNull(message = "一级佣金(固定)不能为空")
|
||||
private Integer firstFixedPrice;
|
||||
|
||||
/**
|
||||
* 二级佣金(固定)
|
||||
*/
|
||||
private Integer secondFixedPrice;
|
||||
|
||||
/**
|
||||
* 来源用户编号
|
||||
*/
|
||||
@NotNull(message = "来源用户编号不能为空")
|
||||
private Long sourceUserId;
|
||||
|
||||
/**
|
||||
* 佣金记录标题
|
||||
*/
|
||||
@NotEmpty(message = "佣金记录标题不能为空")
|
||||
private String title;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.trade.api.brokerage;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageAddDTO;
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class TradeBrokerageRecordApiImpl implements TradeBrokerageRecordApi {
|
||||
|
||||
@Resource
|
||||
private BrokerageRecordService brokerageRecordService;
|
||||
|
||||
@Override
|
||||
public void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddDTO> list) {
|
||||
brokerageRecordService.addBrokerage(userId, bizType, BeanUtils.toBean(list, BrokerageAddReqBO.class));
|
||||
}
|
||||
}
|
||||
+3
@@ -23,6 +23,9 @@ public class BrokerageCodePageReqVO extends PageParam {
|
||||
@Schema(description = "邀请码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "提现微信号")
|
||||
private String txWechatNum;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
+4
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销码 Response VO")
|
||||
@@ -27,6 +28,9 @@ public class BrokerageCodeRespVO {
|
||||
@ExcelProperty("邀请码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "提现微信号")
|
||||
private String txWechatNum;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
+3
@@ -24,4 +24,7 @@ public class BrokerageCodeSaveReqVO {
|
||||
@NotEmpty(message = "邀请码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "提现微信号")
|
||||
private String txWechatNum;
|
||||
|
||||
}
|
||||
+6
@@ -30,5 +30,11 @@ public class AppBrokerageCodeController {
|
||||
return success(brokerageCodeService.getUserBrokerageCode(getLoginUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/bind-tx-wechat-num")
|
||||
@Operation(summary = "绑定提现微信")
|
||||
public CommonResult<BrokerageCodeDO> bindTxWechatNum(@RequestParam("txWechatNum") String txWechatNum) {
|
||||
return success(brokerageCodeService.bindTxWechatNum(getLoginUserId(), txWechatNum));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+5
@@ -48,4 +48,9 @@ public class BrokerageCodeDO extends BaseDO {
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 提现微信号
|
||||
*/
|
||||
private String txWechatNum;
|
||||
|
||||
}
|
||||
+5
@@ -40,6 +40,11 @@ public interface BrokerageCodeService {
|
||||
*/
|
||||
PageResult<BrokerageCodeDO> getBrokerageCodePage(BrokerageCodePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 绑定提现微信
|
||||
*/
|
||||
BrokerageCodeDO bindTxWechatNum(Long userId, String txWechatNum);
|
||||
|
||||
/**
|
||||
* 获取用户的分销码
|
||||
*/
|
||||
|
||||
+16
@@ -92,6 +92,22 @@ public class BrokerageCodeServiceImpl implements BrokerageCodeService {
|
||||
return brokerageCodeMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定提现微信
|
||||
*/
|
||||
@Override
|
||||
public BrokerageCodeDO bindTxWechatNum(Long userId, String txWechatNum) {
|
||||
BrokerageCodeDO brokerageCode = getUserBrokerageCode(userId);
|
||||
if (ObjectUtil.isEmpty(brokerageCode)) {
|
||||
return brokerageCode;
|
||||
}
|
||||
// 更新
|
||||
BrokerageCodeDO updateObj = BrokerageCodeDO.builder().id(brokerageCode.getId()).txWechatNum(txWechatNum).build();
|
||||
brokerageCodeMapper.updateById(updateObj);
|
||||
brokerageCode.setTxWechatNum(txWechatNum);
|
||||
return brokerageCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的分销码
|
||||
*/
|
||||
|
||||
+5
-5
@@ -37,14 +37,14 @@ public class ComAuthController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户认证")
|
||||
@PreAuthorize("@ss.hasPermission('member:auth:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:auth:create')")
|
||||
public CommonResult<Long> createAuth(@Valid @RequestBody ComAuthSaveReqVO createReqVO) {
|
||||
return success(authService.createAuth(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户认证")
|
||||
@PreAuthorize("@ss.hasPermission('member:auth:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:auth:update')")
|
||||
public CommonResult<Boolean> updateAuth(@Valid @RequestBody ComAuthSaveReqVO updateReqVO) {
|
||||
authService.updateAuth(updateReqVO);
|
||||
return success(true);
|
||||
@@ -60,7 +60,7 @@ public class ComAuthController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户认证")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:auth:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:auth:delete')")
|
||||
public CommonResult<Boolean> deleteAuth(@RequestParam("id") Long id) {
|
||||
authService.deleteAuth(id);
|
||||
return success(true);
|
||||
@@ -69,7 +69,7 @@ public class ComAuthController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户认证")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:auth:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:auth:query')")
|
||||
public CommonResult<ComAuthRespVO> getAuth(@RequestParam("id") Long id) {
|
||||
ComAuthDO auth = authService.getAuth(id);
|
||||
return success(BeanUtils.toBean(auth, ComAuthRespVO.class));
|
||||
@@ -77,7 +77,7 @@ public class ComAuthController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户认证分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:auth:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:auth:query')")
|
||||
public CommonResult<PageResult<ComAuthRespVO>> getAuthPage(@Valid ComAuthPageReqVO pageReqVO) {
|
||||
PageResult<ComAuthRespVO> pageResult = authService.getAuthPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class OpenTypeUserReqVO extends PageParam {
|
||||
private String status;
|
||||
|
||||
@Schema(description = "支付状态")
|
||||
private String payStatus;
|
||||
private Boolean payStatus;
|
||||
|
||||
@Schema(description = "退款状态")
|
||||
private String refundStatus;
|
||||
|
||||
+6
-6
@@ -46,14 +46,14 @@ public class OperationController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建朋友圈操作")
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:create')")
|
||||
public CommonResult<Long> createOperation(@Valid @RequestBody OperationSaveReqVO createReqVO) {
|
||||
return success(operationService.createOperation(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新朋友圈操作")
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:update')")
|
||||
public CommonResult<Boolean> updateOperation(@Valid @RequestBody OperationSaveReqVO updateReqVO) {
|
||||
operationService.updateOperation(updateReqVO);
|
||||
return success(true);
|
||||
@@ -62,7 +62,7 @@ public class OperationController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除朋友圈操作")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:delete')")
|
||||
public CommonResult<Boolean> deleteOperation(@RequestParam("id") Long id) {
|
||||
operationService.deleteOperation(id);
|
||||
return success(true);
|
||||
@@ -71,7 +71,7 @@ public class OperationController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得朋友圈操作")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:query')")
|
||||
public CommonResult<OperationRespVO> getOperation(@RequestParam("id") Long id) {
|
||||
OperationDO operation = operationService.getOperation(id);
|
||||
return success(BeanUtils.toBean(operation, OperationRespVO.class));
|
||||
@@ -79,7 +79,7 @@ public class OperationController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得朋友圈操作分页")
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:query')")
|
||||
public CommonResult<PageResult<OperationRespVO>> getOperationPage(@Valid OperationPageReqVO pageReqVO) {
|
||||
PageResult<OperationRespVO> pageResult = operationService.getOperationPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
@@ -87,7 +87,7 @@ public class OperationController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出朋友圈操作 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('member:operation:export')")
|
||||
// @PreAuthorize("@ss.hasPermission('member:operation:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOperationExcel(@Valid OperationPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
|
||||
+3
@@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "用户 App - 会员开通记录")
|
||||
@RestController
|
||||
@@ -32,6 +33,8 @@ public class AppOpenTypeUserController {
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "查看全部开通会员列表")
|
||||
public CommonResult<PageResult<OpenTypeRespVO>> getOpenTypeList(@Valid OpenTypeUserReqVO pageReqVO) {
|
||||
pageReqVO.setMemberId(getLoginUserId());
|
||||
pageReqVO.setPayStatus(true);
|
||||
IPage<OpenTypeUserRespVO> pageResult = openTypeUserMapper.page(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
|
||||
|
||||
PageResult result = new PageResult<OpenTypeUserRespVO>();
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class MemberExtBO {
|
||||
@Schema(description = "最近登录时间")
|
||||
private LocalDateTime appRefreshDate;
|
||||
|
||||
|
||||
|
||||
public String getwechatMaskString() {
|
||||
String str = this.wechatNum;
|
||||
if (str == null || str.length() <= 2) {
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@
|
||||
select
|
||||
a.member_id,
|
||||
max(if(a.biz_type = '4' AND a.cancel_time IS NULL, true, false)) AS isLike,
|
||||
max(if(a.biz_type = '100' AND a.cancel_time IS NULL, true, false)) AS isLookWechat
|
||||
max(if(a.biz_type = '100' AND a.cancel_time IS NULL AND date(a.create_time) = date(now()), true, false)) AS isLookWechat
|
||||
from member_operation a
|
||||
<where>
|
||||
a.deleted = '0'
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
<artifactId>yudao-module-pay-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-trade-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ public class PayWalletRechargeController {
|
||||
@Operation(summary = "更新钱包充值为已充值") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
||||
@PermitAll // 无需登录, 内部校验实现
|
||||
public CommonResult<Boolean> updateWalletRechargerPaid(@Valid @RequestBody PayOrderNotifyReqDTO notifyReqDTO) {
|
||||
walletRechargeService.updateWalletRechargerPaid(Long.valueOf(notifyReqDTO.getMerchantOrderId()),
|
||||
notifyReqDTO.getPayOrderId());
|
||||
walletRechargeService.updateWalletRechargerPaid(Long.valueOf(notifyReqDTO.getMerchantOrderId()), notifyReqDTO.getPayOrderId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -32,6 +32,9 @@ import cn.iocoder.yudao.module.product.api.gift.ProductGiftApi;
|
||||
import cn.iocoder.yudao.module.product.api.gift.dto.ProductGiftRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO;
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.TradeBrokerageRecordApi;
|
||||
import cn.iocoder.yudao.module.trade.api.brokerage.dto.BrokerageAddDTO;
|
||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -40,6 +43,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.hutool.core.util.ObjectUtil.notEqual;
|
||||
@@ -83,6 +88,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
private ProductGiftApi productGiftApi;
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
@Resource
|
||||
private TradeBrokerageRecordApi tradeBrokerageRecordApi;
|
||||
|
||||
@Resource
|
||||
private PayProperties payProperties;
|
||||
@@ -187,6 +194,9 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
log.error("[updateWalletRechargerPaid][recharge({}) payOrder({}) 不存在充值订单,请进行处理!]", id, payOrderId);
|
||||
throw exception(WALLET_RECHARGE_NOT_FOUND);
|
||||
}
|
||||
PayWalletDO wallet = payWalletService.getWallet(recharge.getWalletId());
|
||||
// 查询用户
|
||||
MemberUserRespDTO user = memberUserApi.getUser(wallet.getUserId());
|
||||
// 1.2 校验钱包充值是否可以支付
|
||||
if (recharge.getPayStatus()) {
|
||||
// 特殊:如果订单已支付,且支付单号相同,直接返回,说明重复回调
|
||||
@@ -216,6 +226,19 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||
payWalletService.addWalletBalance(recharge.getWalletId(), String.valueOf(id),
|
||||
PayWalletBizTypeEnum.RECHARGE, recharge.getTotalPrice());
|
||||
|
||||
// 添加分销记录
|
||||
List<BrokerageAddDTO> brokerageList = new ArrayList<BrokerageAddDTO>() {{
|
||||
add(new BrokerageAddDTO()
|
||||
.setBizId(String.valueOf(id))
|
||||
.setBasePrice(payOrderDO.getPrice())
|
||||
.setFirstFixedPrice(0)
|
||||
.setSecondFixedPrice(0)
|
||||
.setSourceUserId(wallet.getUserId())
|
||||
.setTitle(String.format("用户[%s]充值[%s]元", user.getNickname(), fenToYuanStr(payOrderDO.getPrice())))
|
||||
);
|
||||
}};
|
||||
tradeBrokerageRecordApi.addBrokerage(recharge.getId(), BrokerageRecordBizTypeEnum.ORDER, brokerageList);
|
||||
|
||||
// 5. 发送订阅消息
|
||||
getSelf().sendWalletRechargerPaidMessage(payOrderId, recharge);
|
||||
}
|
||||
|
||||
+6
-1
@@ -55,6 +55,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -266,14 +268,17 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
*/
|
||||
@Override
|
||||
public String getWxUrlScheme(String path, String json) {
|
||||
long expireTime = LocalDateTime.now().toInstant(ZoneOffset.UTC).getEpochSecond();
|
||||
expireTime += 5 * 60 * 1000;
|
||||
WxMaService service = getWxMaService(UserTypeEnum.MEMBER.getValue());
|
||||
try {
|
||||
String urlScheme = service.getWxMaSchemeService().generate(WxMaGenerateSchemeRequest.newBuilder()
|
||||
.jumpWxa(
|
||||
WxMaGenerateSchemeRequest.JumpWxa.newBuilder().path(path).query(json).envVersion("trial").build()
|
||||
)
|
||||
.expireTime((long) (5 * 60 * 1000))
|
||||
.expireTime(expireTime)
|
||||
.expireType(0)
|
||||
.isExpire(true)
|
||||
.build()
|
||||
);
|
||||
return urlScheme;
|
||||
|
||||
Reference in new issue
Block a user