代理商申请 逻辑增强 鉴权

This commit is contained in:
Jack 2026-01-29 18:33:14 +08:00
parent 001191b9c5
commit bad0d4925c

View File

@ -100,22 +100,24 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
return false; return false;
} }
String inviteCode;
// 根据等级和营业执照号查询现有记录 // 根据等级和营业执照号查询现有记录
EsignPlatformInfo existingRecord = getEsignPlatformInfo(esignPlatformInfo.getLevel(), esignPlatformInfo.getLicense_number()); EsignPlatformInfo existingRecord = getEsignPlatformInfo(esignPlatformInfo.getLevel(), esignPlatformInfo.getLicense_number());
String inviteCode = String.format("%06d", esignPlatformInfo.getId());
if (existingRecord == null) { if (existingRecord == null) {
// 记录不存在执行新增操作 // 记录不存在执行新增操作
log.debug("[添加平台方信息] 新增平台方信息,等级: {}, 营业执照号: {}", log.debug("[添加平台方信息] 新增平台方信息,等级: {}, 营业执照号: {}",
esignPlatformInfo.getLevel(), esignPlatformInfo.getLicense_number()); esignPlatformInfo.getLevel(), esignPlatformInfo.getLicense_number());
boolean saved = save(esignPlatformInfo); boolean saved = save(esignPlatformInfo);
if (saved) { if (saved) {
inviteCode = String.format("%06d", esignPlatformInfo.getId());
// 保存成功后设置邀请码 // 保存成功后设置邀请码
esignPlatformInfo.setInvite_code(inviteCode); esignPlatformInfo.setInvite_code(inviteCode);
return updateById(esignPlatformInfo); return updateById(esignPlatformInfo);
} }
return false; return false;
} else { } else {
inviteCode = String.format("%06d", esignPlatformInfo.getId());
// 记录存在更新现有记录ID并执行更新操作 // 记录存在更新现有记录ID并执行更新操作
esignPlatformInfo.setId(existingRecord.getId()); esignPlatformInfo.setId(existingRecord.getId());
log.debug("[更新平台方信息] 更新平台方信息ID: {}, 等级: {}, 营业执照号: {}", log.debug("[更新平台方信息] 更新平台方信息ID: {}, 等级: {}, 营业执照号: {}",
@ -501,17 +503,13 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
public CommonResult apply2ndAgent(JSONObject paramsJSON) { public CommonResult apply2ndAgent(JSONObject paramsJSON) {
log.info("[申请二级代理商] 开始处理申请params={}", paramsJSON); log.info("[申请二级代理商] 开始处理申请params={}", paramsJSON);
// 鉴权登录情况
// UserDto userDto = getCurrentUser();
// if (userDto == null || CheckUtil.isEmpty(userDto.getId())) {
// return CommonResult.failed("请先登录");
// }
// 参数校验 // 参数校验
if (paramsJSON == null) { if (paramsJSON == null) {
return CommonResult.failed("缺少必要参数错误"); return CommonResult.failed("缺少必要参数错误");
} }
// 鉴权登录情况
UserDto userDto = getCurrentUser(); UserDto userDto = getCurrentUser();
if (userDto == null) { if (userDto == null) {
return CommonResult.failed("请先登录"); return CommonResult.failed("请先登录");
@ -586,7 +584,7 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
record.setSplit_ratio(BigDecimal.valueOf(0.01)); record.setSplit_ratio(BigDecimal.valueOf(0.01));
} }
// 保存代理商信息 // 保存代理商信息邀请码也在里面处理
Boolean result = addOrUpdateEsignPlatformInfo(record); Boolean result = addOrUpdateEsignPlatformInfo(record);
if (!result) { if (!result) {
throw new ApiException("保存代理商信息失败"); throw new ApiException("保存代理商信息失败");
@ -613,6 +611,10 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
return CommonResult.failed("请先登录"); return CommonResult.failed("请先登录");
} }
if (!CommonConstant.USER_TYPE_AGENT.equals(userDto.getUser_is_admin())) {
return CommonResult.failed("无权限查看");
}
Integer userId = Convert.toInt(userDto.getId()); Integer userId = Convert.toInt(userDto.getId());
LambdaQueryWrapper<EsignPlatformInfo> queryWrapper = new LambdaQueryWrapper<EsignPlatformInfo>() LambdaQueryWrapper<EsignPlatformInfo> queryWrapper = new LambdaQueryWrapper<EsignPlatformInfo>()
@ -631,7 +633,7 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
String domain = StrUtil.blankToDefault(websiteDomain, "https://www.gpxscs.cn"); String domain = StrUtil.blankToDefault(websiteDomain, "https://www.gpxscs.cn");
record.setInvite_url(domain + "/start?invite_code=" + record.getInvite_code()); record.setInvite_url(domain + "/start?invite_code=" + record.getInvite_code());
} }
return CommonResult.success(record); return CommonResult.success(record);
} }
@ -645,11 +647,14 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
public CommonResult approval2ndAgent(JSONObject paramsJSON) { public CommonResult approval2ndAgent(JSONObject paramsJSON) {
log.info("[审批二级代理商] 开始处理申请params={}", paramsJSON); log.info("[审批二级代理商] 开始处理申请params={}", paramsJSON);
// 鉴权登录情况 // 鉴权登录情况
// UserDto userDto = getCurrentUser(); UserDto userDto = getCurrentUser();
// if (userDto == null || CheckUtil.isEmpty(userDto.getId())) { if (userDto == null || CheckUtil.isEmpty(userDto.getId())) {
// return CommonResult.failed("请先登录"); return CommonResult.failed("请先登录");
// } }
if (!CommonConstant.USER_TYPE_ADMIN.equals(userDto.getUser_is_admin())) {
return CommonResult.failed("无操作权限");
}
if (paramsJSON == null || paramsJSON.isEmpty()) { if (paramsJSON == null || paramsJSON.isEmpty()) {
return CommonResult.failed("缺少必要参数"); return CommonResult.failed("缺少必要参数");
@ -689,7 +694,6 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
return CommonResult.failed("缺少必要参数"); return CommonResult.failed("缺少必要参数");
} }
// 清算行号和银行账号一致 // 清算行号和银行账号一致
record.setRec_acc_clear_bank_no(record.getRec_acc_bank_no()); record.setRec_acc_clear_bank_no(record.getRec_acc_bank_no());
record.setRec_acc_type(2); // 款账户账户类型:1-个人对私2-企业对公 record.setRec_acc_type(2); // 款账户账户类型:1-个人对私2-企业对公