master:代发编辑接口添加;

pull/1121/head
liujiang 2025-10-18 23:06:32 +08:00
parent ecdb7c4377
commit ccc896a536
6 changed files with 151 additions and 5 deletions

View File

@ -31,12 +31,21 @@ public class UserAuthenticationController extends XktBaseController {
final IUserAuthenticationService userAuthService;
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,agent')")
@ApiOperation(value = "新增代发 ", httpMethod = "POST", response = R.class)
@ApiOperation(value = "新增代发", httpMethod = "POST", response = R.class)
@Log(title = "新增代发", businessType = BusinessType.INSERT)
@PostMapping()
public R<Integer> create(@Validated @RequestBody UserAuthCreateVO createVO) {
return R.ok(userAuthService.create(BeanUtil.toBean(createVO, UserAuthCreateDTO.class)));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,agent')")
@ApiOperation(value = "代发编辑", httpMethod = "PUT", response = R.class)
@Log(title = "代发编辑", businessType = BusinessType.UPDATE)
@PutMapping()
public R<Integer> update(@Validated @RequestBody UserAuthUpdateVO updateVO) {
return R.ok(userAuthService.update(BeanUtil.toBean(updateVO, UserAuthUpdateDTO.class)));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store,seller,agent')||@ss.hasSupplierSubRole()")
@ApiOperation(value = "APP 代发列表 ", httpMethod = "POST", response = R.class)
@PostMapping("/app/page")
@ -51,7 +60,7 @@ public class UserAuthenticationController extends XktBaseController {
return R.ok(userAuthService.page(BeanUtil.toBean(pageVO, UserAuthPageDTO.class)));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,agent')")
@ApiOperation(value = "查询代发详情", httpMethod = "GET", response = R.class)
@GetMapping(value = "/{userAuthId}")
public R<UserAuthResVO> getInfo(@PathVariable("userAuthId") Long userAuthId) {

View File

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@ -38,6 +39,7 @@ public class UserAuthCreateVO {
@Data
@ApiModel
@Valid
public static class UACFileDTO {
@NotBlank(message = "文件名称不能为空")
@ApiModelProperty(value = "文件名称", required = true)

View File

@ -0,0 +1,57 @@
package com.ruoyi.web.controller.xkt.vo.userAuthentication;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@Data
@ApiModel
public class UserAuthUpdateVO {
@NotNull(message = "代发ID不能为空!")
@ApiModelProperty(value = "代发ID", required = true)
private Long userAuthId;
@NotBlank(message = "真实名称不能为空")
@ApiModelProperty(value = "真实名称", required = true)
@Size(max = 50, message = "真实名称长度不能超过50个字符!")
private String realName;
@NotBlank(message = "联系电话不能为空")
@ApiModelProperty(value = "联系电话", required = true)
private String phonenumber;
@NotBlank(message = "身份证号不能为空")
@ApiModelProperty(value = "身份证号", required = true)
private String idCard;
@NotNull(message = "人脸图片不能为空")
@ApiModelProperty(value = "人脸图片", required = true)
private UACFileDTO faceFile;
@NotNull(message = "国徽图片不能为空")
@ApiModelProperty(value = "国徽图片", required = true)
private UACFileDTO emblemFile;
@Data
@ApiModel
@Valid
public static class UACFileDTO {
@NotBlank(message = "文件名称不能为空")
@ApiModelProperty(value = "文件名称", required = true)
private String fileName;
@NotBlank(message = "文件路径不能为空")
@ApiModelProperty(value = "文件路径", required = true)
private String fileUrl;
@NotNull(message = "文件大小不能为空")
@ApiModelProperty(value = "文件大小", required = true)
private BigDecimal fileSize;
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.xkt.dto.userAuthentication;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@Data
@ApiModel
public class UserAuthUpdateDTO {
@ApiModelProperty(value = "代发ID")
private Long userAuthId;
@ApiModelProperty(value = "真实名称")
private String realName;
@ApiModelProperty(value = "联系电话")
private String phonenumber;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "人脸图片")
private UACFileDTO faceFile;
@ApiModelProperty(value = "国徽图片")
private UACFileDTO emblemFile;
@Data
@ApiModel
public static class UACFileDTO {
@ApiModelProperty(value = "文件名称")
private String fileName;
@ApiModelProperty(value = "文件路径")
private String fileUrl;
@ApiModelProperty(value = "文件大小")
private BigDecimal fileSize;
}
}

View File

@ -59,4 +59,11 @@ public interface IUserAuthenticationService {
*/
Page<UserAuthAppPageResDTO> appPage(UserAuthPageDTO pageDTO);
/**
*
*
* @param updateDTO
* @return Integer
*/
Integer update(UserAuthUpdateDTO updateDTO);
}

View File

@ -51,7 +51,6 @@ public class UserAuthenticationServiceImpl implements IUserAuthenticationService
if (ObjectUtils.isEmpty(userId)) {
throw new ServiceException("用户未登录,请先登录!", HttpStatus.ERROR);
}
// 保存身份证人脸
SysFile idCardFace = BeanUtil.toBean(createDTO.getFaceFile(), SysFile.class);
this.fileMapper.insert(idCardFace);
@ -64,6 +63,34 @@ public class UserAuthenticationServiceImpl implements IUserAuthenticationService
return userAuthMapper.insert(userAuth);
}
/**
*
*
* @param updateDTO
* @return Integer
*/
@Override
@Transactional
public Integer update(UserAuthUpdateDTO updateDTO) {
Long userId = SecurityUtils.getUserIdSafe();
if (ObjectUtils.isEmpty(userId)) {
throw new ServiceException("用户未登录,请先登录!", HttpStatus.ERROR);
}
UserAuthentication userAuth = Optional.ofNullable(this.userAuthMapper.selectOne(new LambdaQueryWrapper<UserAuthentication>()
.eq(UserAuthentication::getId, updateDTO.getUserAuthId()).eq(UserAuthentication::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("代发专员不存在!", HttpStatus.ERROR));
// 保存身份证人脸
SysFile idCardFace = BeanUtil.toBean(updateDTO.getFaceFile(), SysFile.class);
this.fileMapper.insert(idCardFace);
// 保存身份证国徽
SysFile idCardEmblem = BeanUtil.toBean(updateDTO.getEmblemFile(), SysFile.class);
this.fileMapper.insert(idCardEmblem);
userAuth.setIdCard(updateDTO.getIdCard())
.setRealName(updateDTO.getRealName()).setUserId(userId).setAuthStatus(UserAuthStatus.UN_AUDITED.getValue())
.setIdCardFaceFileId(idCardFace.getId()).setIdCardEmblemFileId(idCardEmblem.getId());
return userAuthMapper.updateById(userAuth);
}
/**
* APP
*
@ -79,6 +106,8 @@ public class UserAuthenticationServiceImpl implements IUserAuthenticationService
}
/**
*
*
@ -108,8 +137,8 @@ public class UserAuthenticationServiceImpl implements IUserAuthenticationService
.orElseThrow(() -> new ServiceException("代发不存在!", HttpStatus.ERROR));
SysFile faceFile = this.fileMapper.selectById(userAuth.getIdCardFaceFileId());
SysFile emblemFile = this.fileMapper.selectById(userAuth.getIdCardEmblemFileId());
return BeanUtil.toBean(userAuth, UserAuthResDTO.class).setFaceUrl(faceFile.getFileUrl())
.setEmblemUrl(emblemFile.getFileUrl());
return BeanUtil.toBean(userAuth, UserAuthResDTO.class).setUserAuthId(userAuthId)
.setFaceUrl(faceFile.getFileUrl()).setEmblemUrl(emblemFile.getFileUrl());
}
/**