登录修改
This commit is contained in:
@ -1,40 +0,0 @@
|
||||
package com.ruoyi.bgt.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("包工头实名认证对象")
|
||||
public class LoginBodyDto
|
||||
{
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid = "";
|
||||
|
||||
}
|
@ -1,12 +1,17 @@
|
||||
package com.ruoyi.bgt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.bgt.domain.dto.UserRealNameAuthenticationDTO;
|
||||
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||
import com.ruoyi.common.domain.dto.AnnexDTO;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
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;
|
||||
@ -14,7 +19,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.bgt.bo.BgtUserQueryBo;
|
||||
import com.ruoyi.bgt.mapper.BgtUserMapper;
|
||||
import com.ruoyi.bgt.service.IBgtUserService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@ -28,6 +35,9 @@ import java.util.Collection;
|
||||
@Service
|
||||
public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser> implements IBgtUserService {
|
||||
|
||||
@Autowired
|
||||
private IAnnexService annexService;
|
||||
|
||||
@Override
|
||||
public BgtUser queryById(String id){
|
||||
return getById(id);
|
||||
@ -87,7 +97,13 @@ public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser>
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(BgtUser entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
List<BgtUser> bgtUsers = baseMapper.selectList(new LambdaQueryWrapper<BgtUser>()
|
||||
.eq(BgtUser::getPhone, entity.getPhone())
|
||||
.ne(entity.getId()!=null,BgtUser::getId, entity.getId()));
|
||||
if(CollectionUtil.isNotEmpty(bgtUsers)){
|
||||
throw new BaseException("手机号已存在");
|
||||
}
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,8 +120,12 @@ public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean realNameAuthentication(UserRealNameAuthenticationDTO dto) {
|
||||
BgtUser bgtUser = BeanUtil.copyProperties(dto, BgtUser.class);
|
||||
//todo: 资格证书附件类型
|
||||
annexService.deleteByTypes(Arrays.asList("1"));
|
||||
annexService.insertBatch(dto.getAnnexList());
|
||||
return baseMapper.updateById(bgtUser)>0;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.bo.AnnexQueryBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.domain.dto.AnnexDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -52,4 +53,20 @@ public interface IAnnexService extends IServicePlus<Annex> {
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 删除指定类型的附件
|
||||
* @param types 类型集合
|
||||
* @return
|
||||
*/
|
||||
void deleteByTypes(List<String> types);
|
||||
|
||||
/**
|
||||
* 附件批量添加
|
||||
* @param annexList 附件集合
|
||||
* @return
|
||||
*/
|
||||
void insertBatch(List<AnnexDTO> annexList);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.ruoyi.common.service.impl;
|
||||
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.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@ -18,6 +19,7 @@ import com.ruoyi.common.service.IAnnexService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 附件Service业务层处理
|
||||
@ -84,4 +86,21 @@ public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implem
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTypes(List<String> types) {
|
||||
baseMapper.delete(new LambdaQueryWrapper<Annex>().in(Annex::getAnnexType, types));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<AnnexDTO> annexList) {
|
||||
List<Annex> annexes = annexList.stream()
|
||||
.map(dto -> {
|
||||
Annex annex = new Annex();
|
||||
BeanUtil.copyProperties(dto, annex);
|
||||
return annex;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
baseMapper.insertAll(annexes);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user