| | |
| | | private String detail; |
| | | |
| | | @ApiModelProperty("排序权重") |
| | | @TableField("order") |
| | | private Integer order; |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | } |
| | |
| | | private String rotatePicture; |
| | | |
| | | @ApiModelProperty("排序") |
| | | @TableField("order") |
| | | private Integer order; |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("跳转服务id") |
| | | @TableField("rotate_serve_id") |
| | |
| | | private String role; |
| | | |
| | | /** |
| | | * 角色id |
| | | */ |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | */ |
| | | private SysUser sysUser; |
| | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @PostMapping("login") |
| | | @ApiOperation(value = "登录", tags = "后台-登录") |
| | | public R<?> login(@RequestBody LoginBody form) { |
| | |
| | | } |
| | | map.put("roleName", roles); |
| | | map.put("info", userInfo); |
| | | // 权限集合 |
| | | map.put("permissions", userInfo.getPermissions()); |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userInfo.getSysUser().getUserId()); |
| | |
| | | /** |
| | | * 手机号码正则 |
| | | */ |
| | | public static final String PHONE = ("^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\\d{8}$"); |
| | | public static final String PHONE = "^1[34578]\\d{9}$"; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.core.context; |
| | | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import com.alibaba.ttl.TransmittableThreadLocal; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * 获取当前线程变量中的 用户id、用户名称、Token等信息 |
| | | * 获取当前线程变量中的 用户id、用户名称、Token等信息 |
| | | * 注意: 必须在网关通过请求头的方法传入,同时在HeaderInterceptor拦截器设置值。 否则这里无法获取 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SecurityContextHolder |
| | | { |
| | | public class SecurityContextHolder { |
| | | private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>(); |
| | | |
| | | public static void set(String key, Object value) |
| | | { |
| | | public static void set(String key, Object value) { |
| | | Map<String, Object> map = getLocalMap(); |
| | | map.put(key, value == null ? StringUtils.EMPTY : value); |
| | | } |
| | | |
| | | public static String get(String key) |
| | | { |
| | | public static String get(String key) { |
| | | Map<String, Object> map = getLocalMap(); |
| | | return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY)); |
| | | } |
| | | |
| | | public static <T> T get(String key, Class<T> clazz) |
| | | { |
| | | public static <T> T get(String key, Class<T> clazz) { |
| | | Map<String, Object> map = getLocalMap(); |
| | | return StringUtils.cast(map.getOrDefault(key, null)); |
| | | } |
| | | |
| | | public static Map<String, Object> getLocalMap() |
| | | { |
| | | public static Map<String, Object> getLocalMap() { |
| | | Map<String, Object> map = THREAD_LOCAL.get(); |
| | | if (map == null) |
| | | { |
| | | if (map == null) { |
| | | map = new ConcurrentHashMap<String, Object>(); |
| | | THREAD_LOCAL.set(map); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | public static void setLocalMap(Map<String, Object> threadLocalMap) |
| | | { |
| | | public static void setLocalMap(Map<String, Object> threadLocalMap) { |
| | | THREAD_LOCAL.set(threadLocalMap); |
| | | } |
| | | |
| | | public static Long getUserId() |
| | | { |
| | | public static Long getUserId() { |
| | | return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); |
| | | } |
| | | |
| | | public static void setUserId(String account) |
| | | { |
| | | public static void setUserId(String account) { |
| | | set(SecurityConstants.DETAILS_USER_ID, account); |
| | | } |
| | | |
| | | public static String getUserName() |
| | | { |
| | | public static String getUserName() { |
| | | return get(SecurityConstants.DETAILS_USERNAME); |
| | | } |
| | | |
| | | public static void setUserName(String username) |
| | | { |
| | | public static void setUserName(String username) { |
| | | set(SecurityConstants.DETAILS_USERNAME, username); |
| | | } |
| | | |
| | | public static String getUserKey() |
| | | { |
| | | public static String getUserKey() { |
| | | return get(SecurityConstants.USER_KEY); |
| | | } |
| | | |
| | | public static void setUserKey(String userKey) |
| | | { |
| | | public static void setUserKey(String userKey) { |
| | | set(SecurityConstants.USER_KEY, userKey); |
| | | } |
| | | |
| | | public static String getPermission() |
| | | { |
| | | public static String getPermission() { |
| | | return get(SecurityConstants.ROLE_PERMISSION); |
| | | } |
| | | |
| | | public static void setPermission(String permissions) |
| | | { |
| | | public static void setPermission(String permissions) { |
| | | set(SecurityConstants.ROLE_PERMISSION, permissions); |
| | | } |
| | | |
| | | public static void remove() |
| | | { |
| | | public static void remove() { |
| | | THREAD_LOCAL.remove(); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 权限注解的验证模式 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum Logical |
| | | { |
| | | public enum Logical { |
| | | /** |
| | | * 必须具有所有的元素 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 权限认证:必须具有指定权限才能进入该方法 |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ ElementType.METHOD, ElementType.TYPE }) |
| | | public @interface RequiresPermissions |
| | | { |
| | | @Target({ElementType.METHOD, ElementType.TYPE}) |
| | | public @interface RequiresPermissions { |
| | | /** |
| | | * 需要校验的权限码 |
| | | */ |
| | |
| | | package com.ruoyi.common.security.aspect; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import com.ruoyi.common.security.annotation.RequiresLogin; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.annotation.RequiresRoles; |
| | | import com.ruoyi.common.security.auth.AuthUtil; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.security.annotation.RequiresLogin; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.annotation.RequiresRoles; |
| | | import com.ruoyi.common.security.auth.AuthUtil; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 基于 Spring Aop 的注解鉴权 |
| | | * |
| | | * |
| | | * @author kong |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class PreAuthorizeAspect |
| | | { |
| | | public class PreAuthorizeAspect { |
| | | /** |
| | | * 构建 |
| | | */ |
| | | public PreAuthorizeAspect() |
| | | { |
| | | public PreAuthorizeAspect() { |
| | | } |
| | | |
| | | /** |
| | |
| | | * 声明AOP签名 |
| | | */ |
| | | @Pointcut(POINTCUT_SIGN) |
| | | public void pointcut() |
| | | { |
| | | public void pointcut() { |
| | | } |
| | | |
| | | /** |
| | | * 环绕切入 |
| | | * |
| | | * |
| | | * @param joinPoint 切面对象 |
| | | * @return 底层方法执行后的返回值 |
| | | * @throws Throwable 底层方法抛出的异常 |
| | | */ |
| | | @Around("pointcut()") |
| | | public Object around(ProceedingJoinPoint joinPoint) throws Throwable |
| | | { |
| | | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | // 注解鉴权 |
| | | MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
| | | checkMethodAnnotation(signature.getMethod()); |
| | | try |
| | | { |
| | | try { |
| | | // 执行原有逻辑 |
| | | Object obj = joinPoint.proceed(); |
| | | return obj; |
| | | } |
| | | catch (Throwable e) |
| | | { |
| | | } catch (Throwable e) { |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 对一个Method对象进行注解检查 |
| | | */ |
| | | public void checkMethodAnnotation(Method method) |
| | | { |
| | | public void checkMethodAnnotation(Method method) { |
| | | // 校验 @RequiresLogin 注解 |
| | | RequiresLogin requiresLogin = method.getAnnotation(RequiresLogin.class); |
| | | if (requiresLogin != null) |
| | | { |
| | | if (requiresLogin != null) { |
| | | AuthUtil.checkLogin(); |
| | | } |
| | | |
| | | // 校验 @RequiresRoles 注解 |
| | | RequiresRoles requiresRoles = method.getAnnotation(RequiresRoles.class); |
| | | if (requiresRoles != null) |
| | | { |
| | | if (requiresRoles != null) { |
| | | AuthUtil.checkRole(requiresRoles); |
| | | } |
| | | |
| | | // 校验 @RequiresPermissions 注解 |
| | | RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class); |
| | | if (requiresPermissions != null) |
| | | { |
| | | if (requiresPermissions != null) { |
| | | AuthUtil.checkPermi(requiresPermissions); |
| | | } |
| | | } |
| | |
| | | * 判断是否包含角色 |
| | | * |
| | | * @param roleStr 角色列表 |
| | | * @param role 角色 |
| | | * @param role 角色 |
| | | * @return 用户是否具备某角色权限 |
| | | */ |
| | | public boolean hasRole(String roleStr, String role) { |
| | |
| | | return R.fail("用户名或密码错误"); |
| | | } |
| | | // 角色集合 |
| | | String roles = permissionService.getRolePermission(sysUser); |
| | | SysRole roles = permissionService.getRolePermission(sysUser); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(sysUser); |
| | | LoginUser sysUserVo = new LoginUser(); |
| | | sysUserVo.setSysUser(sysUser); |
| | | sysUserVo.setRole(roles); |
| | | sysUserVo.setRole(roles.getRoleName()); |
| | | sysUserVo.setRoleId(roles.getRoleId()); |
| | | sysUserVo.setPermissions(permissions); |
| | | return R.ok(sysUserVo); |
| | | } |
| | |
| | | public AjaxResult getInfo() { |
| | | SysUser user = userService.selectUserById(SecurityUtils.getUserId()); |
| | | // 角色集合 |
| | | String roles = permissionService.getRolePermission(user); |
| | | SysRole roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import java.util.Set; |
| | |
| | | * @param user 用户信息 |
| | | * @return 角色权限信息 |
| | | */ |
| | | public String getRolePermission(SysUser user); |
| | | public SysRole getRolePermission(SysUser user); |
| | | |
| | | /** |
| | | * 获取菜单数据权限 |
| | |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | public String selectRolePermissionByUserId(Long userId); |
| | | public SysRole selectRolePermissionByUserId(Long userId); |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (String perm : perms) { |
| | | if (StringUtils.isNotEmpty(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.trim().split(","))); |
| | | permsSet.add(perm); |
| | | } |
| | | } |
| | | return permsSet; |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import com.ruoyi.system.service.ISysPermissionService; |
| | |
| | | * @return 角色权限信息 |
| | | */ |
| | | @Override |
| | | public String getRolePermission(SysUser user) { |
| | | String roles; |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) { |
| | | roles = "admin"; |
| | | } else { |
| | | roles = roleService.selectRolePermissionByUserId(user.getUserId()); |
| | | } |
| | | return roles; |
| | | public SysRole getRolePermission(SysUser user) { |
| | | return roleService.selectRolePermissionByUserId(user.getUserId()); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public Set<String> getMenuPermission(SysUser user) { |
| | | Set<String> perms = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) { |
| | | perms.add("*:*:*"); |
| | | Long roleId = user.getSysRole().getRoleId(); |
| | | if (null == roleId) { |
| | | perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); |
| | | } else { |
| | | Long roleId = user.getSysRole().getRoleId(); |
| | | if (null == roleId) { |
| | | perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); |
| | | } else { |
| | | // 多角色设置permissions属性,以便数据权限匹配权限 |
| | | Set<String> rolePerms = menuService.selectMenuPermsByRoleId(roleId); |
| | | perms.addAll(rolePerms); |
| | | } |
| | | // 多角色设置permissions属性,以便数据权限匹配权限 |
| | | Set<String> rolePerms = menuService.selectMenuPermsByRoleId(roleId); |
| | | perms.addAll(rolePerms); |
| | | } |
| | | return perms; |
| | | } |
| | |
| | | * @return 权限列表 |
| | | */ |
| | | @Override |
| | | public String selectRolePermissionByUserId(Long userId) { |
| | | SysRole perms = roleMapper.selectRolePermissionByUserId(userId); |
| | | return perms.getRoleKey(); |
| | | public SysRole selectRolePermissionByUserId(Long userId) { |
| | | return roleMapper.selectRolePermissionByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | |
| | | </select> |
| | | |
| | | <select id="selectMenuPermsByUserId" parameterType="Long" resultType="String"> |
| | | select distinct m.perms |
| | | select distinct m.component |
| | | from sys_menu m |
| | | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| | | left join sys_user_role ur on rm.role_id = ur.role_id |
| | |
| | | // 是否软删除 |
| | | this.setFieldValByName("isDelete", 0, metaObject); |
| | | // 是否启用 默认启用 |
| | | this.setFieldValByName("isEnable", 1, metaObject); |
| | | this.setFieldValByName("delFlag", 0, metaObject); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.admin.entity.Agreement; |
| | | import com.ruoyi.admin.service.AgreementService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * |
| | | * @param type 查询类型 |
| | | */ |
| | | @RequiresPermissions(value = {"system_agreement", "system_operate"}, logical = Logical.OR) |
| | | @ApiOperation(value = "根据类型获取注册协议、隐私政策、司机操作指南", tags = {"后台-隐私政策/司机操作指南"}) |
| | | @GetMapping(value = "/dataInfo") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param agreement 协议信息 |
| | | */ |
| | | @RequiresPermissions(value = {"system_agreement", "system_operate"}, logical = Logical.OR) |
| | | @ApiOperation(value = "保存政策协议", tags = {"后台-隐私政策/司机操作指南"}) |
| | | @PostMapping(value = "/saveData") |
| | | public R<String> saveData(@RequestBody Agreement agreement) { |
| | |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("reassignment_apply") |
| | | @ApiOperation(value = "订单改派分页查询列表", tags = {"后台-系统设置-订单改派管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 订单改派id |
| | | */ |
| | | @RequiresPermissions("reassignment_apply") |
| | | @ApiOperation(value = "订单改派详情", tags = {"后台-系统设置-订单改派管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param ids 订单改派多条id拼接 |
| | | */ |
| | | @RequiresPermissions("reassignment_apply") |
| | | @ApiOperation(value = "批量删除订单改派", tags = {"后台-系统设置-订单改派管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | |
| | | * @param orderId 订单id |
| | | * @param workerId 师傅id |
| | | */ |
| | | @RequiresPermissions("reassignment_apply") |
| | | @ApiOperation(value = "订单改派师傅", tags = {"后台-系统设置-订单改派管理"}) |
| | | @GetMapping(value = "/changeWorker") |
| | | @ApiImplicitParams({ |
| | |
| | | import com.ruoyi.admin.service.EvaluateService; |
| | | import com.ruoyi.admin.vo.EvaluatePageVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("order_evaluate") |
| | | @ApiOperation(value = "订单评价分页查询列表", tags = {"后台-系统设置-订单评价管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 订单评价id |
| | | */ |
| | | @RequiresPermissions("order_evaluate") |
| | | @ApiOperation(value = "订单评价详情", tags = {"后台-系统设置-订单评价管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param ids 订单评价多条id拼接 |
| | | */ |
| | | @RequiresPermissions("order_evaluate") |
| | | @ApiOperation(value = "批量删除订单评价", tags = {"后台-系统设置-订单评价管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "加盟商信息分页查询列表", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 加盟商信息id |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "加盟商信息详情", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param franchisee 加盟商信息信息 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "新增加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody @Validated Franchisee franchisee) { |
| | |
| | | * |
| | | * @param franchisee 加盟商信息信息 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "修改加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody @Validated Franchisee franchisee) { |
| | |
| | | * @param id 加盟商id |
| | | * @param enable 启用/关闭 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "启用/关闭加盟商", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/enable") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param ids 加盟商信息多条id拼接 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @ApiOperation(value = "批量删除加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | |
| | | @ApiOperation(value = "师傅列表", tags = {"后台-师傅管理"}) |
| | | @GetMapping(value = "/selectServe") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "师傅姓名", name = "workerName", dataType = "String"), |
| | | @ApiImplicitParam(value = "师傅电话", name = "workerPhone", dataType = "String"), |
| | | @ApiImplicitParam(value = "师傅姓名", name = "name", dataType = "String"), |
| | | @ApiImplicitParam(value = "师傅电话", name = "phone", dataType = "String"), |
| | | @ApiImplicitParam(value = "服务城市", name = "city", dataType = "String"), |
| | | @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "每页显示条数", name = "pageSize", dataType = "Integer", required = true) |
| | | }) |
| | | public R<IPage<MasterWorker>> selectServe(String workerName, String workerPhone, String city, |
| | | public R<IPage<MasterWorker>> selectServe(String name, String phone, String city, |
| | | @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | LambdaQueryChainWrapper<MasterWorker> wrapper = masterWorkerService.lambdaQuery(); |
| | | wrapper = StringUtils.isNotBlank(workerName) ? wrapper.like(MasterWorker::getRealName, workerName) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(workerPhone) ? wrapper.like(MasterWorker::getPhone, workerPhone) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(name) ? wrapper.like(MasterWorker::getRealName, name) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(phone) ? wrapper.like(MasterWorker::getPhone, phone) : wrapper; |
| | | wrapper = StringUtils.isNotBlank(city) ? wrapper.like(MasterWorker::getCity, city) : wrapper; |
| | | return R.ok(wrapper.eq(MasterWorker::getIsDelete, 0) |
| | | .orderByDesc(MasterWorker::getCreateTime).page(Page.of(pageNum, pageSize))); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增师傅信息 |
| | | * 师傅详细信息 |
| | | * |
| | | * @param workerId 师傅id |
| | | */ |
| | |
| | | List<Evaluate> evaluateList = evaluateService.lambdaQuery().eq(Evaluate::getWorkerId, workerId) |
| | | .eq(Evaluate::getIsDelete, 0).list(); |
| | | List<BigDecimal> star = evaluateList.stream().map(Evaluate::getStarRating).collect(Collectors.toList()); |
| | | // 总评分 / 评价数量 |
| | | BigDecimal starRating = star.stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal result = starRating.divide(new BigDecimal(star.size()), 1, RoundingMode.HALF_UP); |
| | | workerDetail.setStarRating(result); |
| | | return R.fail(workerDetail); |
| | | if (!star.isEmpty()) { |
| | | // 总评分 / 评价数量 |
| | | BigDecimal starRating = star.stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal result = starRating.divide(new BigDecimal(star.size()), 1, RoundingMode.HALF_UP); |
| | | workerDetail.setStarRating(result); |
| | | } |
| | | return R.ok(workerDetail); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.admin.entity.Notices; |
| | | import com.ruoyi.admin.service.NoticesService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "系统通知分页查询列表", tags = {"后台-系统设置-系统通知管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | |
| | | /** |
| | | * 系统通知列表 |
| | | * |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "系统通知列表(不分页)", tags = {"后台-系统设置-系统通知管理"}) |
| | | @GetMapping(value = "/noticesList") |
| | | public R<List<Notices>> noticesList() { |
| | |
| | | * |
| | | * @param id 系统通知id |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "系统通知详情", tags = {"后台-系统设置-系统通知管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param notices 系统通知信息 |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "新增系统通知", tags = {"后台-系统设置-系统通知管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody Notices notices) { |
| | | notices.setNoticeDetail(String.valueOf(notices.getNoticeDetail())); |
| | | return noticesService.save(notices) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param notices 系统通知信息 |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "修改系统通知", tags = {"后台-系统设置-系统通知管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody Notices notices) { |
| | |
| | | * |
| | | * @param ids 系统通知多条id拼接 |
| | | */ |
| | | @RequiresPermissions("system_notice") |
| | | @ApiOperation(value = "批量删除系统通知", tags = {"后台-系统设置-系统通知管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | |
| | | import com.ruoyi.admin.entity.Prize; |
| | | import com.ruoyi.admin.service.PrizeService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("system_site") |
| | | @ApiOperation(value = "奖品分页查询列表", tags = {"后台-系统设置-奖品管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 奖品id |
| | | */ |
| | | @RequiresPermissions("system_site") |
| | | @ApiOperation(value = "奖品详情", tags = {"后台-系统设置-奖品管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param prize 奖品信息 |
| | | */ |
| | | @RequiresPermissions("system_site") |
| | | @ApiOperation(value = "新增奖品", tags = {"后台-系统设置-奖品管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody Prize prize) { |
| | |
| | | * |
| | | * @param prize 奖品信息 |
| | | */ |
| | | @RequiresPermissions("system_site") |
| | | @ApiOperation(value = "编辑奖品", tags = {"后台-系统设置-奖品管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody Prize prize) { |
| | |
| | | * |
| | | * @param ids 奖品id拼接 |
| | | */ |
| | | @RequiresPermissions("system_site") |
| | | @ApiOperation(value = "批量删除奖品", tags = {"后台-系统设置-奖品管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | |
| | | @GetMapping(value = "/problemList") |
| | | public R<List<Problem>> problemList() { |
| | | return R.ok(problemService.lambdaQuery().eq(Problem::getIsDelete, 0) |
| | | .orderByAsc(Problem::getOrder).list()); |
| | | .orderByAsc(Problem::getSort).list()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/site") |
| | | @Api( tags = {"后台-系统设置-站点管理"}) |
| | | @Api(tags = {"后台-系统设置-站点管理"}) |
| | | public class SiteController { |
| | | |
| | | @Resource |
| | |
| | | }) |
| | | public R<IPage<Site>> queryPageList(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | return R.ok(siteService.lambdaQuery().orderByDesc(Site::getCreateTime).page(Page.of(pageNum, pageSize))); |
| | | return R.ok(siteService.lambdaQuery().orderByDesc(Site::getCreateTime) |
| | | .eq(Site::getIsDelete, 0) |
| | | .page(Page.of(pageNum, pageSize))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @TableField("is_enable") |
| | | private Integer isEnable; |
| | | |
| | | @ApiModelProperty("管辖城市二维数组") |
| | | @TableField("city_str") |
| | | private String cityStr; |
| | | |
| | | } |
| | |
| | | @ApiModel(value = "Notices对象", description = "系统通知管理") |
| | | public class Notices extends BaseEntity { |
| | | |
| | | @TableId(value = "id",type = IdType.AUTO) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("排序") |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("通知标题") |
| | | @TableField("notice_title") |
| | |
| | | |
| | | @ApiModelProperty("通知内容") |
| | | @TableField("notice_detail") |
| | | private String noticeDetail; |
| | | private Object noticeDetail; |
| | | |
| | | } |
| | |
| | | private String detail; |
| | | |
| | | @ApiModelProperty("排序权重") |
| | | @TableField("order") |
| | | private Integer order; |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.admin.mapper.NoticesMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.admin.entity.Notices"> |
| | | <id column="id" property="id" /> |
| | | <result column="notice_title" property="noticeTitle" /> |
| | | <result column="notice_detail" property="noticeDetail" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="updateTime" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | <id column="id" property="id"/> |
| | | <result column="notice_title" property="noticeTitle"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="notice_detail" property="noticeDetail"/> |
| | | <result column="createBy" property="createBy"/> |
| | | <result column="updateBy" property="updateBy"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="updateTime" property="updateTime"/> |
| | | <result column="is_delete" property="isDelete"/> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="title" property="title" /> |
| | | <result column="detail" property="detail" /> |
| | | <result column="order" property="order" /> |
| | | <result column="sort" property="sort" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="createTime" property="createTime" /> |
| | |
| | | @ApiOperation(value = "首页回收分类推荐", tags = {"用户端-首页"}) |
| | | public R<List<RecoveryClassify>> recommend() { |
| | | return R.ok(recoveryClassifyService.lambdaQuery().eq(RecoveryClassify::getIsRecommend, Constants.ONE) |
| | | .eq(RecoveryClassify::getIsDelete, 0).orderByAsc(RecoveryClassify::getOrder).list()); |
| | | .eq(RecoveryClassify::getIsDelete, 0).orderByAsc(RecoveryClassify::getSort).list()); |
| | | } |
| | | |
| | | /** |
| | |
| | | private String typeDescribe; |
| | | |
| | | @ApiModelProperty("排序权重") |
| | | @TableField("order") |
| | | private Integer order; |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("分类简介") |
| | | @TableField("brief_introduction") |
| | |
| | | <result column="home_page_name" property="homePageName" /> |
| | | <result column="classification_picture" property="classificationPicture" /> |
| | | <result column="type_describe" property="typeDescribe" /> |
| | | <result column="order" property="order" /> |
| | | <result column="sort" property="sort" /> |
| | | <result column="brief_introduction" property="briefIntroduction" /> |
| | | <result column="is_recommend" property="isRecommend" /> |
| | | <result column="createBy" property="createBy" /> |
| | |
| | | private BigDecimal defaultPrice; |
| | | |
| | | @ApiModelProperty("排序权重") |
| | | @TableField("order") |
| | | private Integer order; |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("封面图片") |
| | | @TableField("cover") |
| | |
| | | <result column="serve_describe" property="serveDescribe"/> |
| | | <result column="estimate_price" property="estimatePrice"/> |
| | | <result column="default_price" property="defaultPrice"/> |
| | | <result column="order" property="order"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="cover" property="cover"/> |
| | | <result column="rotate" property="rotate"/> |
| | | <result column="createBy" property="createBy"/> |