登录修改
This commit is contained in:
@ -0,0 +1,54 @@
|
|||||||
|
package com.ruoyi.web.controller.bgt;
|
||||||
|
|
||||||
|
import com.ruoyi.bgt.domain.dto.UserRealNameAuthenticationDTO;
|
||||||
|
import com.ruoyi.bgt.service.IBgtUserService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后台管理包工头Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-02-14
|
||||||
|
*/
|
||||||
|
@Api(value = "APP包工头控制器", tags = {"APP包工头管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/bgt/user")
|
||||||
|
public class AppBgtUserController extends BaseController {
|
||||||
|
|
||||||
|
private final IBgtUserService iBgtUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证
|
||||||
|
*/
|
||||||
|
@ApiOperation("实名认证")
|
||||||
|
@Log(title = "APP管理包工头", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult<Void> realNameAuthentication(@Validated @RequestBody UserRealNameAuthenticationDTO dto) {
|
||||||
|
return toAjax(iBgtUserService.realNameAuthentication(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实名认证
|
||||||
|
*/
|
||||||
|
@ApiOperation("个人信息")
|
||||||
|
@RepeatSubmit
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public AjaxResult<Void> getInfo(@Validated @RequestBody UserRealNameAuthenticationDTO dto) {
|
||||||
|
return toAjax(iBgtUserService.realNameAuthentication(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,12 +25,12 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP包工头Controller
|
* 后台管理包工头Controller
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2025-02-14
|
* @date 2025-02-14
|
||||||
*/
|
*/
|
||||||
@Api(value = "APP包工头控制器", tags = {"APP包工头管理"})
|
@Api(value = "后台管理包工头控制器", tags = {"后台管理包工头管理"})
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bgt/user")
|
@RequestMapping("/bgt/user")
|
||||||
@ -39,9 +39,9 @@ public class BgtUserController extends BaseController {
|
|||||||
private final IBgtUserService iBgtUserService;
|
private final IBgtUserService iBgtUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询APP包工头列表
|
* 查询后台管理包工头列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询APP包工头列表")
|
@ApiOperation("查询后台管理包工头列表")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:list')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<BgtUser> list(@Validated BgtUserQueryBo bo) {
|
public TableDataInfo<BgtUser> list(@Validated BgtUserQueryBo bo) {
|
||||||
@ -49,22 +49,22 @@ public class BgtUserController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出APP包工头列表
|
* 导出后台管理包工头列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("导出APP包工头列表")
|
@ApiOperation("导出后台管理包工头列表")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:export')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:export')")
|
||||||
@Log(title = "APP包工头", businessType = BusinessType.EXPORT)
|
@Log(title = "后台管理包工头", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult<BgtUser> export(@Validated BgtUserQueryBo bo) {
|
public AjaxResult<BgtUser> export(@Validated BgtUserQueryBo bo) {
|
||||||
List<BgtUser> list = iBgtUserService.queryList(bo);
|
List<BgtUser> list = iBgtUserService.queryList(bo);
|
||||||
ExcelUtil<BgtUser> util = new ExcelUtil<BgtUser>(BgtUser.class);
|
ExcelUtil<BgtUser> util = new ExcelUtil<BgtUser>(BgtUser.class);
|
||||||
return util.exportExcel(list, "APP包工头");
|
return util.exportExcel(list, "后台管理包工头");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取APP包工头详细信息
|
* 获取后台管理包工头详细信息
|
||||||
*/
|
*/
|
||||||
@ApiOperation("获取APP包工头详细信息")
|
@ApiOperation("获取后台管理包工头详细信息")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:query')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:query')")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public AjaxResult<BgtUser> getInfo(@NotNull(message = "主键不能为空")
|
public AjaxResult<BgtUser> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@ -73,11 +73,11 @@ public class BgtUserController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增APP包工头
|
* 新增后台管理包工头
|
||||||
*/
|
*/
|
||||||
@ApiOperation("新增APP包工头")
|
@ApiOperation("新增后台管理包工头")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:add')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:add')")
|
||||||
@Log(title = "APP包工头", businessType = BusinessType.INSERT)
|
@Log(title = "后台管理包工头", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public AjaxResult<Void> add(@Validated @RequestBody BgtUser bo) {
|
public AjaxResult<Void> add(@Validated @RequestBody BgtUser bo) {
|
||||||
@ -85,11 +85,11 @@ public class BgtUserController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改APP包工头
|
* 修改后台管理包工头
|
||||||
*/
|
*/
|
||||||
@ApiOperation("修改APP包工头")
|
@ApiOperation("修改后台管理包工头")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:edit')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:edit')")
|
||||||
@Log(title = "APP包工头", businessType = BusinessType.UPDATE)
|
@Log(title = "后台管理包工头", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit
|
@RepeatSubmit
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody BgtUser bo) {
|
public AjaxResult<Void> edit(@Validated @RequestBody BgtUser bo) {
|
||||||
@ -97,25 +97,14 @@ public class BgtUserController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除APP包工头
|
* 删除后台管理包工头
|
||||||
*/
|
*/
|
||||||
@ApiOperation("删除APP包工头")
|
@ApiOperation("删除后台管理包工头")
|
||||||
@PreAuthorize("@ss.hasPermi('bgt:user:remove')")
|
@PreAuthorize("@ss.hasPermi('bgt:user:remove')")
|
||||||
@Log(title = "APP包工头" , businessType = BusinessType.DELETE)
|
@Log(title = "后台管理包工头" , businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable String[] ids) {
|
@PathVariable String[] ids) {
|
||||||
return toAjax(iBgtUserService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
return toAjax(iBgtUserService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 实名认证
|
|
||||||
*/
|
|
||||||
@ApiOperation("实名认证")
|
|
||||||
@Log(title = "APP包工头", businessType = BusinessType.UPDATE)
|
|
||||||
@RepeatSubmit
|
|
||||||
@PutMapping("/realNameAuthentication")
|
|
||||||
public AjaxResult<Void> realNameAuthentication(@Validated @RequestBody UserRealNameAuthenticationDTO dto) {
|
|
||||||
return toAjax(iBgtUserService.realNameAuthentication(dto));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package com.ruoyi.web.controller.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import com.ruoyi.bgt.service.IBgtUserService;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.BgtLoginBody;
|
import com.ruoyi.common.core.domain.model.BgtLoginBody;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.framework.web.service.AppLoginService;
|
import com.ruoyi.framework.web.service.AppLoginService;
|
||||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||||
import com.ruoyi.framework.web.service.TokenService;
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
@ -36,6 +41,9 @@ public class AppLoginController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBgtUserService iBgtUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录方法
|
* 登录方法
|
||||||
*
|
*
|
||||||
@ -53,6 +61,39 @@ public class AppLoginController
|
|||||||
return AjaxResult.success(ajax);
|
return AjaxResult.success(ajax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
*
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/app/getInfo")
|
||||||
|
public AjaxResult getInfo()
|
||||||
|
{
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
|
SysUser user = loginUser.getUser();
|
||||||
|
String userType = loginUser.getUserType();
|
||||||
|
Map<String,Object> ajax = new HashMap<>();
|
||||||
|
switch (userType){
|
||||||
|
case Constants.BGT:
|
||||||
|
BgtUser bgtUser = iBgtUserService.selectUserByPhone(user.getPhonenumber());
|
||||||
|
ajax.put("user", bgtUser);
|
||||||
|
break;
|
||||||
|
case Constants.WGZ:
|
||||||
|
ajax.put("user", user);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 角色集合
|
||||||
|
// Set<String> roles = permissionService.getRolePermission(user);
|
||||||
|
// 权限集合
|
||||||
|
// Set<String> permissions = permissionService.getMenuPermission(user);
|
||||||
|
// ajax.put("roles", roles);
|
||||||
|
// ajax.put("permissions", permissions);
|
||||||
|
return AjaxResult.success(ajax);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
public AjaxResult test(){
|
public AjaxResult test(){
|
||||||
return AjaxResult.success("test");
|
return AjaxResult.success("test");
|
||||||
|
@ -68,6 +68,11 @@ public class LoginUser implements UserDetails
|
|||||||
*/
|
*/
|
||||||
private SysUser user;
|
private SysUser user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*/
|
||||||
|
private String userType;
|
||||||
|
|
||||||
public LoginUser(SysUser user, Set<String> permissions)
|
public LoginUser(SysUser user, Set<String> permissions)
|
||||||
{
|
{
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -11,8 +11,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.enums.UserStatus;
|
import com.ruoyi.common.enums.UserStatus;
|
||||||
import com.ruoyi.common.exception.BaseException;
|
import com.ruoyi.common.exception.BaseException;
|
||||||
|
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -46,14 +44,14 @@ public class AppUserDetailsServiceImpl implements UserDetailsService
|
|||||||
if(phone.contains(Constants.BGT)){
|
if(phone.contains(Constants.BGT)){
|
||||||
BgtUser user = userService.selectUserByPhone(phone.replace(Constants.BGT,""));
|
BgtUser user = userService.selectUserByPhone(phone.replace(Constants.BGT,""));
|
||||||
check(user,phone);
|
check(user,phone);
|
||||||
userDetailsl = createLoginUser(user);
|
userDetailsl = createLoginUser(user,Constants.BGT);
|
||||||
} else if (phone.contains(Constants.WGZ)) {
|
} else if (phone.contains(Constants.WGZ)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return userDetailsl;
|
return userDetailsl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserDetails createLoginUser(Object obj)
|
public UserDetails createLoginUser(Object obj,String userType)
|
||||||
{
|
{
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
try {
|
try {
|
||||||
@ -81,7 +79,9 @@ public class AppUserDetailsServiceImpl implements UserDetailsService
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
return new LoginUser(sysUser, null);
|
LoginUser loginUser = new LoginUser(sysUser, null);
|
||||||
|
loginUser.setUserType(userType);
|
||||||
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
package com.ruoyi.bgt.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.bgt.domain.dto.UserRealNameAuthenticationDTO;
|
import com.ruoyi.bgt.domain.dto.UserRealNameAuthenticationDTO;
|
||||||
import com.ruoyi.common.core.domain.entity.BgtUser;
|
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.utils.PageUtils;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.bo.BgtUserQueryBo;
|
||||||
import com.ruoyi.bgt.mapper.BgtUserMapper;
|
import com.ruoyi.bgt.mapper.BgtUserMapper;
|
||||||
import com.ruoyi.bgt.service.IBgtUserService;
|
import com.ruoyi.bgt.service.IBgtUserService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -28,6 +35,9 @@ import java.util.Collection;
|
|||||||
@Service
|
@Service
|
||||||
public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser> implements IBgtUserService {
|
public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser> implements IBgtUserService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAnnexService annexService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BgtUser queryById(String id){
|
public BgtUser queryById(String id){
|
||||||
return getById(id);
|
return getById(id);
|
||||||
@ -87,7 +97,13 @@ public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser>
|
|||||||
* @param entity 实体类数据
|
* @param entity 实体类数据
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(BgtUser 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
|
@Override
|
||||||
@ -104,8 +120,12 @@ public class BgtUserServiceImpl extends ServicePlusImpl<BgtUserMapper, BgtUser>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean realNameAuthentication(UserRealNameAuthenticationDTO dto) {
|
public Boolean realNameAuthentication(UserRealNameAuthenticationDTO dto) {
|
||||||
BgtUser bgtUser = BeanUtil.copyProperties(dto, BgtUser.class);
|
BgtUser bgtUser = BeanUtil.copyProperties(dto, BgtUser.class);
|
||||||
|
//todo: 资格证书附件类型
|
||||||
|
annexService.deleteByTypes(Arrays.asList("1"));
|
||||||
|
annexService.insertBatch(dto.getAnnexList());
|
||||||
return baseMapper.updateById(bgtUser)>0;
|
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.bo.AnnexQueryBo;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.domain.dto.AnnexDTO;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -52,4 +53,20 @@ public interface IAnnexService extends IServicePlus<Annex> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
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.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.utils.PageUtils;
|
||||||
import com.ruoyi.common.core.page.PagePlus;
|
import com.ruoyi.common.core.page.PagePlus;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
@ -18,6 +19,7 @@ import com.ruoyi.common.service.IAnnexService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 附件Service业务层处理
|
* 附件Service业务层处理
|
||||||
@ -84,4 +86,21 @@ public class AnnexServiceImpl extends ServicePlusImpl<AnnexMapper, Annex> implem
|
|||||||
}
|
}
|
||||||
return removeByIds(ids);
|
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