商户中心优化
This commit is contained in:
parent
5b2246c9d9
commit
78577db9b3
|
@ -204,10 +204,12 @@ public class SmUser extends BaseEntity
|
|||
|
||||
@ApiModelProperty("用户类型")
|
||||
@NotNull(message = "用户类型不允许为空", groups = {ValidGroup.Create.class})
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private String type;
|
||||
|
||||
@Excel(name = "代理商服务费比例")
|
||||
@ApiModelProperty("代理商服务费比例")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private BigDecimal agentServiceRate;
|
||||
|
||||
@Excel(name = "到账延迟时间", readConverterExp = "小=时")
|
||||
|
@ -231,6 +233,7 @@ public class SmUser extends BaseEntity
|
|||
|
||||
@Excel(name = "代理商默认设备服务费率")
|
||||
@ApiModelProperty("代理商默认设备服务费率")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
private BigDecimal agentDeviceService;
|
||||
|
||||
}
|
||||
|
|
|
@ -124,4 +124,7 @@ public class TransactionBillQuery extends TransactionBill {
|
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间(结束)")
|
||||
private LocalDateTime createTimeEnd;
|
||||
|
||||
@ApiModelProperty("收入人ID")
|
||||
private Long incomeUserId;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.userId != null "> and stb.user_id = #{query.userId}</if>
|
||||
<if test="query.incomeUserId != null "> and (stb.mch_id = #{query.incomeUserId} or stb.agent_id = #{query.incomeUserId}) </if>
|
||||
<if test="query.billNo != null and query.billNo != ''"> and stb.bill_no like concat('%', #{query.billNo}, '%')</if>
|
||||
<if test="query.billId != null "> and stb.bill_id = #{query.billId}</if>
|
||||
<if test="query.deviceId != null "> and stb.device_id = #{query.deviceId}</if>
|
||||
|
|
|
@ -55,4 +55,8 @@ public interface TransactionBillValidator {
|
|||
*/
|
||||
ValidateResult prePayDeposit(RechargePayDepositBO bo);
|
||||
|
||||
/**
|
||||
* 判断用户是否是订单的代理商
|
||||
*/
|
||||
boolean isAgent(TransactionBillVO bill, Long userId);
|
||||
}
|
||||
|
|
|
@ -315,4 +315,9 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
|
|||
|
||||
return success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAgent(TransactionBillVO bill, Long userId) {
|
||||
return bill != null && userId != null && Objects.equals(bill.getAgentId(), userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.ss.user.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/10/15
|
||||
*/
|
||||
public interface UserConverter {
|
||||
/**
|
||||
* 用户设置
|
||||
*/
|
||||
SmUser toUserSettingByApp(SmUser data);
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.ss.user.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||
import com.ruoyi.ss.user.service.UserConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/10/15
|
||||
*/
|
||||
@Service
|
||||
public class UserConverterImpl implements UserConverter {
|
||||
@Override
|
||||
public SmUser toUserSettingByApp(SmUser data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
SmUser po = new SmUser();
|
||||
po.setUserId(data.getUserId());
|
||||
po.setAgentDeviceService(data.getAgentDeviceService());
|
||||
return po;
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
|
|||
BigDecimal agentRate = vo.getAgentServiceRate();
|
||||
BigDecimal deviceRate = vo.getAgentDeviceService();
|
||||
ServiceUtil.assertion(agentRate != null && deviceRate != null && agentRate.compareTo(deviceRate) > 0,
|
||||
"代理服务费不允许大于代理默认设备服务费:" + deviceRate + "%");
|
||||
String.format("代理服务费(%s%%)不允许大于默认设备服务费(%s%%)", agentRate, deviceRate));
|
||||
|
||||
// 代理服务费不允许大于目前最大的设备服务费
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
|
|
|
@ -121,7 +121,7 @@ public class AppTransactionBillController extends BaseController
|
|||
public TableDataInfo incomeList(TransactionBillQuery query)
|
||||
{
|
||||
startPage();
|
||||
query.setMchId(getUserId());
|
||||
query.setIncomeUserId(getUserId());
|
||||
query.setType(TransactionBillType.RECHARGE.getType());
|
||||
List<TransactionBillVO> list = transactionBillService.selectSmTransactionBillList(query);
|
||||
transactionAssembler.assembleChannelName(list);
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.constant.HttpStatus;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
|
@ -17,6 +18,7 @@ import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
|
|||
import com.ruoyi.ss.user.domain.dto.UserUpdatePasswordDTO;
|
||||
import com.ruoyi.ss.user.service.ISmUserService;
|
||||
import com.ruoyi.ss.user.service.UserAssembler;
|
||||
import com.ruoyi.ss.user.service.UserConverter;
|
||||
import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType;
|
||||
import com.ruoyi.system.service.IVerificationCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -54,6 +56,9 @@ public class AppUserController extends BaseController {
|
|||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private UserConverter userConvert;
|
||||
|
||||
@ApiOperation("获取当前登录前台用户的信息")
|
||||
@GetMapping("/userInfo")
|
||||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
|
@ -147,4 +152,11 @@ public class AppUserController extends BaseController {
|
|||
public AjaxResult bindWxMobile(@ApiParam("微信手机号临时授权码") String mobileCode) {
|
||||
return toAjax(userService.bindWxMobile(getUserId(), mobileCode));
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户设置")
|
||||
@PutMapping("/updateSetting")
|
||||
public AjaxResult updateSetting(@RequestBody SmUser data) {
|
||||
data.setUserId(getUserId());
|
||||
return toAjax(userService.updateSmUser(userConvert.toUserSettingByApp(data)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class MchTransactionBillController extends BaseController {
|
|||
@JsonView(JsonViewProfile.AppMch.class)
|
||||
public AjaxResult detail(@PathVariable Long billId) {
|
||||
TransactionBillVO bill = transactionBillService.selectSmTransactionBillByBillId(billId);
|
||||
if (bill == null || !transactionBillValidator.isMch(bill, getUserId())) {
|
||||
if (!transactionBillValidator.isMch(bill, getUserId()) && !transactionBillValidator.isAgent(bill, getUserId())) {
|
||||
return success();
|
||||
}
|
||||
transactionAssembler.assembleChannelName(Collections.singletonList(bill));
|
||||
|
|
Loading…
Reference in New Issue
Block a user