1 文件已重命名
9个文件已添加
12个文件已修改
| | |
| | | /** |
| | | * 角色类型 1=平台 2=公司 3=门店 4=修理厂 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=公司 3=门店 4=修理厂") |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=公司 3=门店 4=修理厂", hidden = true) |
| | | private Integer roleType; |
| | | |
| | | @Excel(name = "密码修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "角色名称") |
| | | @TableField(exist = false) |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty(value = "是否为拍卖师 1=否 2=是") |
| | | @TableField(exist = false) |
| | | private Integer isAuctioneer; |
| | | @Override |
| | | public String getRemark() { |
| | | return remark; |
File was renamed from ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/validate/ModifyGroup.java |
| | |
| | | * @date 2024/6/9 |
| | | * <p>编辑数据校验分组</p> |
| | | */ |
| | | public interface ModifyGroup { |
| | | public interface UpdateGroup { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TimeTypeEnum { |
| | | TODAY(1, "今天"), |
| | | PAST_SEVEN_DAYS(2, "最近7天"), |
| | | PAST_THIRTY_DAYS(3, "最近30天"), |
| | | CUSTOM(4, "自定义"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | public static TimeTypeEnum getEnumByCode(Integer code) { |
| | | for (TimeTypeEnum e : TimeTypeEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller.management; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.controller.management.dto.MgtOrderStaticsQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtOrderStaticsVO; |
| | | import com.ruoyi.order.service.impl.MgtBusinessDataService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Api(tags = "业务数据相关接口") |
| | | @RestController |
| | | @RequestMapping("/mgt/business-data") |
| | | @RequiredArgsConstructor |
| | | public class MgtBusinessDataController { |
| | | |
| | | private final MgtBusinessDataService mgtBusinessDataService; |
| | | |
| | | @PostMapping("/get-overview") |
| | | public R<MgtOrderStaticsVO> getOverview(@Validated @RequestBody MgtOrderStaticsQuery query) { |
| | | return R.ok(mgtBusinessDataService.getOverview(query)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller.management.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("订单统计查询对象") |
| | | public class MgtOrderStaticsQuery implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -3594771110201346889L; |
| | | |
| | | @ApiModelProperty(value = "开始时间", notes = "类型为自定义时必传") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间", notes = "类型为自定义时必传") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty("时间类型 1:今天 2:最近7天 3:最近30天 4:自定义") |
| | | @NotNull(message = "时间类型不能为空") |
| | | private Integer timeType; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.controller.management.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("订单统计视图对象") |
| | | public class MgtOrderStaticsVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -6511810306263817540L; |
| | | @ApiModelProperty("商城订单统计-订单总数") |
| | | private Integer mallOrderTotalCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-商城订单") |
| | | private Integer mallOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-秒杀订单") |
| | | private Integer seckillOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-团购订单") |
| | | private Integer groupPurchaseOrderCount; |
| | | |
| | | @ApiModelProperty("商城订单统计-订单总金额") |
| | | private BigDecimal mallOrderTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-商城总金额") |
| | | private BigDecimal mallTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-秒杀总金额") |
| | | private BigDecimal seckillTotalAmount; |
| | | |
| | | @ApiModelProperty("商城订单统计-团购总金额") |
| | | private BigDecimal groupPurchaseTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-订单总数") |
| | | private Integer auctionOrderTotalCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖商品订单") |
| | | private Integer auctionGoodsOrderCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖场订单") |
| | | private Integer auctionSalesroomOrderCount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-订单总金额") |
| | | private BigDecimal auctionOrderTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖商品总金额") |
| | | private BigDecimal auctionGoodsTotalAmount; |
| | | |
| | | @ApiModelProperty("拍卖订单统计-拍卖场总金额") |
| | | private BigDecimal auctionSalesroomTotalAmount; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.ruoyi.common.core.enums.TimeTypeEnum; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.order.controller.management.dto.MgtOrderStaticsQuery; |
| | | import com.ruoyi.order.controller.management.vo.MgtOrderStaticsVO; |
| | | import com.ruoyi.order.service.IOrderService; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MgtBusinessDataService { |
| | | |
| | | private final IOrderService orderService; |
| | | |
| | | public MgtOrderStaticsVO getOverview(MgtOrderStaticsQuery query) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | getTimeByTimeType(query, startTime, endTime, now); |
| | | return null; |
| | | } |
| | | |
| | | private static void getTimeByTimeType(MgtOrderStaticsQuery query, LocalDateTime startTime, |
| | | LocalDateTime endTime, LocalDateTime now) { |
| | | if (Objects.equals(TimeTypeEnum.TODAY.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.PAST_SEVEN_DAYS.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now.minusDays(7)); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.PAST_THIRTY_DAYS.getCode(), query.getTimeType())) { |
| | | startTime = DateUtils.getDayStart(now.minusDays(30)); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } else if (Objects.equals(TimeTypeEnum.CUSTOM.getCode(), query.getTimeType())) { |
| | | if (Objects.isNull(query.getStartTime()) || Objects.isNull(query.getEndTime())) { |
| | | throw new ServiceException("自定义时间不能为空"); |
| | | } |
| | | startTime = query.getStartTime(); |
| | | endTime = query.getEndTime(); |
| | | } else { |
| | | startTime = DateUtils.getDayStart(now); |
| | | endTime = DateUtils.getDayEnd(now); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.promotion.controller.management.vo.MgtCouponVO; |
| | | import com.ruoyi.promotion.service.ICouponService; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.ModifyGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.Date; |
| | |
| | | */ |
| | | @ApiOperation("编辑优惠券") |
| | | @PutMapping("/update") |
| | | public R<?> updateCoupon(@Validated(ModifyGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | public R<?> updateCoupon(@Validated(UpdateGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | couponService.updateCoupon(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | import com.ruoyi.common.core.enums.CouponTypeEnum; |
| | | import com.ruoyi.common.core.enums.DistributionMethodEnum; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.ModifyGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | |
| | | private static final long serialVersionUID = 471073836029292058L; |
| | | |
| | | @ApiModelProperty(value = "优惠券id", notes = "添加不传,更新必传") |
| | | @NotNull(message = "优惠券id不能为空", groups = {ModifyGroup.class}) |
| | | @NotNull(message = "优惠券id不能为空", groups = {UpdateGroup.class}) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotBlank(message = "优惠券名称不能为空", groups = {InsertGroup.class, ModifyGroup.class}) |
| | | @NotBlank(message = "优惠券名称不能为空", groups = {InsertGroup.class, UpdateGroup.class}) |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型 1=满减券 2=代金券 3=折扣券") |
| | |
| | | private BigDecimal maxDiscount; |
| | | |
| | | @ApiModelProperty(value = "优惠券说明") |
| | | @NotBlank(message = "优惠券说明不能为空", groups = {InsertGroup.class, ModifyGroup.class}) |
| | | @NotBlank(message = "优惠券说明不能为空", groups = {InsertGroup.class, UpdateGroup.class}) |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "有效期起") |
| | |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.dto.RoleAddDto; |
| | | import com.ruoyi.system.domain.dto.RoleQuery; |
| | | import com.ruoyi.system.domain.dto.RoleUpdateDto; |
| | | import com.ruoyi.system.domain.vo.RoleInfoVo; |
| | | import com.ruoyi.system.mapper.SysMenuMapper; |
| | |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.seata.common.util.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | } |
| | | |
| | | |
| | | // @ApiOperation("获取所有角色信息根据公司id--分页") |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Integer companyId,int pageNumber,int pageSize) |
| | | @ApiOperation("获取角色列表") |
| | | @PostMapping("/listPage") |
| | | public AjaxResult listPage(@Validated @RequestBody RoleQuery query) |
| | | { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, |
| | | new LambdaQueryWrapper<SysRole>().ne(SysRole::getRoleId, 20)); |
| | | new LambdaQueryWrapper<SysRole>().ne(SysRole::getRoleId, 20) |
| | | .like(StringUtils.isNotBlank(query.getRoleName()), SysRole::getRoleName, |
| | | query.getRoleName()).eq(SysRole::getDelFlag, "0")); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | |
| | | public AjaxResult roleInfoFromUserId( @RequestParam Long userId) |
| | | { |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | if (Objects.isNull(one)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | Long id =one.getRoleId(); |
| | | // 获取当前角色的菜单id |
| | | List<Long> menusId = sysRoleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, id)).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList()); |
| | | if(menusId.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | if(id!=1){ |
| | | menusId = menusId.stream().filter(e->e!=1074 && e!=1075 && e!=1193 && e!=1194).collect(Collectors.toList()); |
| | | } |
| | | //获取当前的权限菜单 |
| | | List<SysMenus> all = menuMapper.getAllInIds(menusId); |
| | | List<SysMenus> allUser = menuMapper.getAllInIds(menusId); |
| | | // 查询所有权限菜单 |
| | | List<SysMenus> all = menuMapper.getAll(); |
| | | // 创建一个Map来存储all集合中的menuId |
| | | Map<Long, Boolean> menuIdExistMap = allUser.stream() |
| | | .collect(Collectors.toMap(SysMenus::getMenuId, aMenu -> true, |
| | | (oldValue, newValue) -> oldValue)); |
| | | |
| | | // 遍历allUser集合,根据menuIdExistMap来设置isHave值 |
| | | for (SysMenus allMenu : all) { |
| | | allMenu.setIsHave(menuIdExistMap.containsKey(allMenu.getMenuId()) ? 1 : 2); |
| | | } |
| | | |
| | | // 第三级 |
| | | List<SysMenus> s3 = all.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); |
| | | // 第二级 |
| | |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation("删除角色") |
| | | @DeleteMapping("/{id}") |
| | | @DeleteMapping("/del/{id}") |
| | | public AjaxResult removeRole( |
| | | @ApiParam(name = "id", value = "角色ID", required = true) @PathVariable Long id) { |
| | | roleService.removeRole(id); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.domain.dto.ResetPwdDTO; |
| | | import com.ruoyi.system.domain.dto.SupplierDTO; |
| | | import com.ruoyi.system.domain.dto.SupplierQuery; |
| | | import com.ruoyi.system.domain.dto.SysUserDTO; |
| | | import com.ruoyi.system.domain.dto.SysUserQuery; |
| | | import com.ruoyi.system.domain.vo.SupplierVO; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation("管理员列表") |
| | | public AjaxResult list(String phonenumber, int pageNumber, int pageSize) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, phonenumber); |
| | | @PostMapping("/list") |
| | | @ApiOperation("账号管理列表") |
| | | public AjaxResult list(@Validated @RequestBody SysUserQuery query) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, query.getNickName(), |
| | | query.getPhonenumber(), query.getStatus()); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @Log(title = "账号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation("添加管理员") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | | @ApiOperation("添加账号") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@Validated(InsertGroup.class) @RequestBody SysUserDTO dto) { |
| | | SysUser user = BeanUtils.copyBean(dto, SysUser.class); |
| | | user.setUserId(null); |
| | | user.setUserType(dto.getIsAuctioneer() == 1 ? "04" : "00"); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | return error("手机号已开通账号"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword("123456")); |
| | | user.setRoleType(1); |
| | | int i = userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(1l); |
| | | sysUserRole.setRoleId(dto.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | int i1 = userRoleService.insertSysUserRole(sysUserRole); |
| | | return AjaxResult.success(i1); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @ApiOperation("管理员详情") |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | @ApiOperation("账号详情") |
| | | @GetMapping("/{userId}") |
| | | public AjaxResult getInfo( |
| | | @ApiParam(value = "用户ID", required = true) @PathVariable(value = "userId", required = true) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @Log(title = "账号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation("编辑管理员") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | |
| | | @ApiOperation("编辑账号") |
| | | public AjaxResult edit(@Validated(UpdateGroup.class) @RequestBody SysUserDTO dto) { |
| | | SysUser user = BeanUtils.copyBean(dto, SysUser.class); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | Integer data = admin.getData(); |
| | | if(data == null || data != 1){ |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getUserId())); |
| | | one.setRoleId(user.getRoleId()); |
| | | one.setRoleId(dto.getRoleId()); |
| | | sysUserRoleService.updateSysUserRole(one); |
| | | } |
| | | userService.checkUserAllowed(user); |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @Log(title = "账号管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation("删除管理员") |
| | | @ApiOperation("删除账号") |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation("账号管理--停用/启用") |
| | | public AjaxResult shopUserStart(Long userId) { |
| | | @PostMapping("/updStatus/{userId}") |
| | | @ApiOperation("账号管理--冻结/解冻") |
| | | public AjaxResult updStatus( |
| | | @ApiParam(value = "账号ID", required = true) @PathVariable("userId") Long userId) { |
| | | if (userId == null) { |
| | | return AjaxResult.error("userId不能为空"); |
| | | } |
| | |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @ApiOperation("重置密码") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody ResetPwdDTO dto) { |
| | | SysUser user = userService.lambdaQuery().eq(SysUser::getUserId, dto.getUserId()) |
| | | .in(SysUser::getUserType, "00", "01").one(); |
| | | if (StringUtils.isNull(user)) { |
| | | throw new ServiceException("账号不存在"); |
| | | } |
| | | |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("重置密码") |
| | | public class ResetPwdDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4349599620340762098L; |
| | | |
| | | @ApiModelProperty(value = "账号id") |
| | | @NotNull(message = "账号ID不能为空") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "新密码") |
| | | @NotBlank(message = "新密码不能为空") |
| | | private String password; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel("角色查询") |
| | | public class RoleQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = 6935257450787285105L; |
| | | |
| | | @ApiModelProperty("角色名称") |
| | | private String roleName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.system.api.validate.UpdateGroup; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 用户对象 sys_user |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class SysUserDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @ApiModelProperty(value = "账号id", notes = "添加不传") |
| | | @NotNull(message = "账号ID不能为空", groups = {UpdateGroup.class}) |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @ApiModelProperty(value = "员工姓名") |
| | | @NotBlank(message = "员工姓名不能为空") |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | @NotBlank(message = "联系电话不能为空") |
| | | private String phonenumber; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @ApiModelProperty(value = "所属角色") |
| | | @NotNull(message = "角色id不能为空") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty(value = "是否为拍卖师 1=否 2=是") |
| | | @NotNull(message = "是否为拍卖师不能为空") |
| | | private Integer isAuctioneer; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/6/19 |
| | | */ |
| | | @Data |
| | | @ApiModel("用户查询条件") |
| | | public class SysUserQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = -5515862189079789834L; |
| | | @ApiModelProperty("员工姓名") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("联系电话") |
| | | private String phonenumber; |
| | | |
| | | @ApiModelProperty("状态 0:正常 1:冻结") |
| | | private Integer status; |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * 用户表 数据层 |
| | |
| | | */ |
| | | public SysUser checkEmailUnique(String email); |
| | | |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("phonenumber") String phonenumber); |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, |
| | | @Param("nickName") String nickName, @Param("phonenumber") String phonenumber, |
| | | @Param("status") Integer status); |
| | | |
| | | PageInfo<SysUser> getAllList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("ids") List<Integer> collect); |
| | | |
| | |
| | | */ |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber); |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickname, String phonenumber, |
| | | Integer status); |
| | | |
| | | |
| | | PageInfo<SysUser> getAllList(PageInfo<SysUser> pageInfo, List<Integer> collect); |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | |
| | | @Override |
| | | public void removeRole(Long id) { |
| | | SysRole sysRole = this.getById(id); |
| | | SysRole sysRole = baseMapper.selectRoleById(id); |
| | | Long count = userRoleMapper.selectCount( |
| | | Wrappers.lambdaQuery(SysUserRole.class).eq(SysUserRole::getRoleId, id)); |
| | | if (count > 0) { |
| | | throw new ServiceException("角色已绑定账号,不能删除"); |
| | | } |
| | | if (StringUtils.isNull(sysRole)) { |
| | | throw new ServiceException("角色不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber) { |
| | | return this.baseMapper.getList(pageInfo,phonenumber); |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickName, |
| | | String phonenumber, Integer status) { |
| | | return this.baseMapper.getList(pageInfo, nickName, phonenumber, status); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (StringUtils.isNull(dto.getUserId())) { |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | user.setUserType("03"); |
| | | user.setUserType("04"); |
| | | this.save(user); |
| | | } else { |
| | | // 编辑 |
| | |
| | | update_time updateTime, |
| | | remark |
| | | from sys_menu |
| | | order by create_time desc |
| | | order by create_time asc |
| | | </select> |
| | | <select id="getAllInIds" resultType="com.ruoyi.system.domain.SysMenus"> |
| | | select menu_id menuId, |
| | |
| | | |
| | | <sql id="selectRoleVo"> |
| | | select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, |
| | | r.status, r.del_flag, r.create_time, r.remark ,r.carDataAuth,r.carTrainOperAuth,r.contractDataAuth |
| | | from sys_role r |
| | | r.status, |
| | | r.del_flag, |
| | | r.create_time, |
| | | r.remark |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="carDataAuth != null and carDataAuth != ''">carDataAuth,</if> |
| | | <if test="carTrainOperAuth != null and carTrainOperAuth != ''">carTrainOperAuth,</if> |
| | | <if test="contractDataAuth != null and contractDataAuth != ''">contractDataAuth,</if> |
| | | <if test="companyId != null and companyId != ''">companyId,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | |
| | | </select> |
| | | |
| | | <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 |
| | | select user_id, phonenumber |
| | | from sys_user |
| | | where phonenumber = #{phonenumber} |
| | | and del_flag = '0' |
| | | and user_type in ("00", "01") |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,nick_name nickName,login_date loginDate,create_time createTime,user_id userId from sys_user where 1=1 |
| | | select su.user_id userId,su.nick_name nickName,su.phonenumber,su.status,sr.role_name |
| | | roleName,sr.role_id roleId,case su.user_type when '01' then 2 |
| | | else 1 end as isAuctioneer |
| | | from |
| | | sys_user su left join sys_user_role sur on su.user_id = sur.user_id left join sys_role sr on |
| | | sr.role_id |
| | | = sur.role_id where 1=1 |
| | | <if test="nickName !=null and nickName !=''"> |
| | | and su.nick_name like concat("%", #{nickName},"%") |
| | | </if> |
| | | <if test="phonenumber !=null and phonenumber !=''"> |
| | | and phonenumber like concat("%", #{phonenumber},"%") |
| | | and su.phonenumber like concat("%", #{phonenumber},"%") |
| | | </if> |
| | | and del_flag = '0' and roleType =1 |
| | | order by create_time desc |
| | | <if test="status !=null and status !=''"> |
| | | and su.status = #{status} |
| | | </if> |
| | | and su.del_flag = '0' and su.user_type in('00','01') |
| | | order by su.create_time desc |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,user_id userId,nick_name userName ,create_time createTime ,login_date loginDate from sys_user where roleType=3 and user_id in |
| | |
| | | <if test="roleType != null and roleType != ''">roleType,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="objectId != null and objectId != ''">objectId,</if> |
| | | <if test="userType != null and userType != ''">user_type,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="roleType != null and roleType != ''">#{roleType},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="objectId != null and objectId != ''">#{objectId},</if> |
| | | <if test="userType != null and userType != ''">#{userType},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="userType != null and userType != ''">user_type = #{userType},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |