实名认证
This commit is contained in:
@ -42,6 +42,9 @@ public class AnnexQueryBo extends BaseEntity {
|
||||
/** 唯一标识 */
|
||||
@ApiModelProperty("唯一标识")
|
||||
private Long userId;
|
||||
/** 用户类型 */
|
||||
@ApiModelProperty("用户类型")
|
||||
private String userType;
|
||||
/** 附件类型 */
|
||||
@ApiModelProperty("附件类型")
|
||||
private String annexType;
|
||||
|
@ -21,6 +21,9 @@ public class AnnexDTO {
|
||||
/** 唯一标识 */
|
||||
@ApiModelProperty("唯一标识")
|
||||
private Long userId;
|
||||
/** 用户类型 */
|
||||
@ApiModelProperty("用户类型")
|
||||
private String userType;
|
||||
/** 附件类型 */
|
||||
@ApiModelProperty("附件类型")
|
||||
private String annexType;
|
||||
|
@ -69,4 +69,9 @@ public interface IAnnexService extends IServicePlus<Annex> {
|
||||
*/
|
||||
void insertBatch(List<AnnexDTO> annexList);
|
||||
|
||||
|
||||
/**
|
||||
* 根据表自增ID来删除指定附件数据,并删除对应的资源
|
||||
*/
|
||||
Boolean deleteByIds(Long id);
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.domain.dto.AnnexDTO;
|
||||
import com.ruoyi.common.tool.FileDeletionService;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -15,7 +17,9 @@ import com.ruoyi.common.bo.AnnexQueryBo;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.mapper.AnnexMapper;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.tools.Tool;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@ -30,6 +34,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implements IAnnexService {
|
||||
|
||||
@Autowired
|
||||
private FileDeletionService fileDeletionService;
|
||||
|
||||
@Override
|
||||
public Annex queryById(String id){
|
||||
return getById(id);
|
||||
@ -103,4 +110,21 @@ public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implem
|
||||
.collect(Collectors.toList());
|
||||
baseMapper.insertAll(annexes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean deleteByIds(Long id) {
|
||||
//1、查询数据
|
||||
Annex annex = baseMapper.selectById(id);
|
||||
//2、删除对应的数据,并删除相对应的资源
|
||||
if (baseMapper.deleteById(id)>0){
|
||||
boolean b = fileDeletionService.deleteFileByPath(annex.getAnnexUrl());
|
||||
if(!b){
|
||||
throw new RuntimeException("附件删除失败!");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据删除失败!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.ruoyi.common.tool;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Service
|
||||
public class FileDeletionService {
|
||||
/**
|
||||
* 根据文件路径删除文件
|
||||
* @param filePath 文件的完整路径
|
||||
* @return 如果文件删除成功返回 true,否则返回 false
|
||||
*/
|
||||
public boolean deleteFileByPath(String filePath) {
|
||||
if (filePath == null || filePath.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
File file = new File(filePath);
|
||||
// 检查文件是否存在并且是一个普通文件
|
||||
if (file.exists() && file.isFile()) {
|
||||
try {
|
||||
// 执行删除操作
|
||||
return file.delete();
|
||||
} catch (SecurityException e) {
|
||||
// 处理没有权限删除文件的异常
|
||||
System.err.println("没有权限删除文件: " + filePath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.wgz.bo;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WgzAutonymAnnex extends BaseEntity {
|
||||
@ApiModelProperty("用户类型")
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
private String userType;
|
||||
|
||||
@ApiModelProperty("字典标签")
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
private String dictLabel;
|
||||
|
||||
@ApiModelProperty("字典键值")
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
private String dictValue;
|
||||
|
||||
@ApiModelProperty("附件实体数据")
|
||||
private List<Annex> annex;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.ruoyi.wgz.bo.WgzAutonymAnnex;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-实名认证·附件结构请求对象")
|
||||
public class WgzAppAttachmentAcquisitionReq implements Serializable {
|
||||
@ApiModelProperty("唯一标识")
|
||||
@NotNull(message = "唯一标识不能为空")
|
||||
private Long userId;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-修改头像请求对象")
|
||||
public class WgzAppModifyingUserProfilePictureReq implements Serializable {
|
||||
@ApiModelProperty("唯一标识")
|
||||
@NotNull(message = "唯一标识不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("头像地址")
|
||||
@NotBlank(message = "头像地址不能为空")
|
||||
private String avatarName;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -11,6 +12,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-查询个人基本信息对象")
|
||||
public class WgzAppPersonalBasicInformationReq implements Serializable {
|
||||
@ApiModelProperty("唯一标识")
|
||||
@NotBlank(message = "唯一标识不能为空")
|
||||
|
@ -1,24 +1,28 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("务工者APP注册账号对象")
|
||||
public class WgzAppUserLongInReq extends BaseEntity {
|
||||
@ApiModelProperty("联系电话")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("验证码")
|
||||
private String verificationCode;
|
||||
}
|
||||
//package com.ruoyi.wgz.bo.req;
|
||||
//
|
||||
//import com.ruoyi.common.core.domain.BaseEntity;
|
||||
//import io.swagger.annotations.ApiModel;
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.Data;
|
||||
//import lombok.EqualsAndHashCode;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//import lombok.experimental.Accessors;
|
||||
//
|
||||
//import javax.validation.constraints.Pattern;
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
//@Data
|
||||
//@NoArgsConstructor
|
||||
//@Accessors(chain = true)
|
||||
//@ApiModel("务工者APP登录账号对象")
|
||||
//public class WgzAppUserLongInReq implements Serializable {
|
||||
// @ApiModelProperty("联系电话")
|
||||
// @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
// private String phone;
|
||||
//
|
||||
// @ApiModelProperty("密码")
|
||||
// private String password;
|
||||
//
|
||||
// @ApiModelProperty("验证码")
|
||||
// private String verificationCode;
|
||||
//}
|
||||
|
@ -5,18 +5,24 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP注册账号对象")
|
||||
public class WgzAppUserRegisterReq extends BaseEntity {
|
||||
public class WgzAppUserRegisterReq implements Serializable {
|
||||
@ApiModelProperty("联系电话")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
|
||||
private String phone;
|
||||
|
||||
/** 密码 */
|
||||
@ApiModelProperty("密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
}
|
||||
|
@ -1,19 +1,26 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WgzRealNameAuthenticationReq {
|
||||
@ApiModel("务工者APP-实名认证对象")
|
||||
public class WgzRealNameAuthenticationReq implements Serializable {
|
||||
@ApiModelProperty("唯一标识")
|
||||
@NotBlank(message = "唯一标识不能为空")
|
||||
@NotNull(message = "唯一标识不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("身份证正面图路径")
|
||||
@ -64,6 +71,9 @@ public class WgzRealNameAuthenticationReq {
|
||||
@NotBlank(message = "银行卡号不能为空")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("附件实体数据")
|
||||
private List<Annex> annex;
|
||||
|
||||
// @ApiModelProperty("银行卡图路径")
|
||||
// private String bankCardPath;
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.wgz.bo.res;
|
||||
|
||||
import com.ruoyi.wgz.bo.WgzAutonymAnnex;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-实名认证·附件结构返回对象")
|
||||
public class WgzAppAttachmentAcquisitionRes implements Serializable {
|
||||
@ApiModelProperty("附件结构")
|
||||
private List<WgzAutonymAnnex> wgzAutonymAnnex;
|
||||
}
|
@ -1,9 +1,20 @@
|
||||
package com.ruoyi.wgz.bo.res;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
public class WgzAppPersonalBasicInformationRes {
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-个人基本信息返回对象")
|
||||
public class WgzAppPersonalBasicInformationRes implements Serializable {
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
@ -1,4 +0,0 @@
|
||||
package com.ruoyi.wgz.bo.res;
|
||||
|
||||
public class WgzAppUserLongInRes {
|
||||
}
|
@ -3,6 +3,7 @@ package com.ruoyi.wgz.service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppModifyingUserProfilePictureReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzRealNameAuthenticationReq;
|
||||
@ -69,29 +70,26 @@ public interface IWgzUserService extends IServicePlus<WgzUser> {
|
||||
|
||||
/**
|
||||
* 务工者APP注册账号
|
||||
* @param bo APP务工者注册业务对象
|
||||
* @return bool
|
||||
*/
|
||||
Boolean userRegister(WgzAppUserRegisterReq bo);
|
||||
|
||||
/**
|
||||
* 修改用户头像修改用户头像
|
||||
*/
|
||||
Boolean userModifyingUserProfilePicture(@Validated @RequestBody WgzAppModifyingUserProfilePictureReq req);
|
||||
|
||||
/**
|
||||
* 务工者APP登录账号
|
||||
* @param phone APP务工者登录业务对象
|
||||
* @return bool
|
||||
*/
|
||||
WgzUser userLongIn(String phone);
|
||||
|
||||
/**
|
||||
* 务工者APP登录账号
|
||||
* @param req APP务工者登录业务对象
|
||||
* @return bool
|
||||
* 务工者APP个人基本信息
|
||||
*/
|
||||
WgzAppPersonalBasicInformationRes userPersonalBasicInformation(WgzAppPersonalBasicInformationReq req);
|
||||
|
||||
/**
|
||||
* 务工者APP实名认证
|
||||
* @param req APP务工者实名认证业务对象
|
||||
* @return bool
|
||||
*/
|
||||
Boolean userRealNameAuthentication(@Validated @RequestBody WgzRealNameAuthenticationReq req);
|
||||
}
|
||||
|
@ -7,9 +7,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.domain.dto.AnnexDTO;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppModifyingUserProfilePictureReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzRealNameAuthenticationReq;
|
||||
@ -19,8 +23,11 @@ import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.mapper.WgzUserMapper;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -36,6 +43,9 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser> implements IWgzUserService {
|
||||
|
||||
@Autowired
|
||||
private IAnnexService iAnnexService;
|
||||
|
||||
@Override
|
||||
public WgzUser queryById(String id){
|
||||
return getById(id);
|
||||
@ -124,6 +134,17 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
|
||||
return baseMapper.insert(wgzUser) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean userModifyingUserProfilePicture(WgzAppModifyingUserProfilePictureReq req) {
|
||||
WgzUser user = new WgzUser();
|
||||
BeanUtils.copyProperties(req, user);
|
||||
int update = baseMapper.update(user, new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getUserId, req.getUserId()));
|
||||
if (update == 0){
|
||||
throw new RuntimeException("当前用户不存在!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//登录-获取用户
|
||||
@Override
|
||||
public WgzUser userLongIn(String phone) {
|
||||
@ -146,12 +167,21 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
|
||||
|
||||
//实名认证
|
||||
@Override
|
||||
@Transactional()
|
||||
public Boolean userRealNameAuthentication(WgzRealNameAuthenticationReq req) {
|
||||
//1、对指定用户进行实名认证
|
||||
WgzUser user = new WgzUser();
|
||||
BeanUtils.copyProperties(req,user);
|
||||
BeanUtils.copyProperties(req, user);
|
||||
int update = baseMapper.update(user, new LambdaQueryWrapper<WgzUser>().eq(WgzUser::getUserId, req.getUserId()));
|
||||
return update>0;
|
||||
if (update == 0){
|
||||
throw new RuntimeException("当前用户不存在!");
|
||||
}
|
||||
//2、新增附件
|
||||
List<Annex> annex = req.getAnnex();
|
||||
List<AnnexDTO> annexDTOS = new ArrayList<>();
|
||||
BeanUtils.copyProperties(annex, annexDTOS);
|
||||
iAnnexService.insertBatch(annexDTOS);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user