Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
| | |
| | | public R<Void> updateOrderStatus(Order order) { |
| | | return R.fail("更新订单状态失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Void> subscribe(Long id, Integer technicianId) { |
| | | return R.fail("预约失败"); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/order/updateOrderStatus") |
| | | public R<Void> updateOrderStatus(@RequestBody Order order); |
| | | |
| | | /** |
| | | * 预约技师 |
| | | */ |
| | | @PostMapping("/order/subscribe") |
| | | public R<Void> subscribe(@RequestParam(value = "id" , required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "门店id") |
| | | private Integer shopId; |
| | | |
| | | @ApiModelProperty(value = "技师名称") |
| | | private String technicianName; |
| | | |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "1:合伙人积分设置一 2:合伙人积分设置二 3:会员说明设置 4:活动管理-活动设置 1开0关 5:售后设置") |
| | | @ApiModelProperty(value = "1:合伙人积分设置一 2:合伙人积分设置二 3:会员说明设置 4:活动管理-活动设置 1开0关 5:售后设置 6:充值设置") |
| | | @TableId("id") |
| | | private Integer id; |
| | | |
| | |
| | | @TableField(exist = false) |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "商品名字") |
| | | @TableField(exist = false) |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | @TableField(exist = false) |
| | | private String goodsImg; |
| | | |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | this.idStr = String.valueOf(id); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId("id") |
| | | private Long id; |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | |
| | | |
| | | @ApiModelProperty(value = "技师id") |
| | | @TableField("technician_id") |
| | | private Long technicianId; |
| | | private Integer technicianId; |
| | | |
| | | @ApiModelProperty(value = "预约时间") |
| | | @TableField("subscribe_time") |
| | |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long orderId; |
| | | |
| | | @TableField(exist = false) |
| | | private String idStr; |
| | | |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | this.idStr = String.valueOf(id); |
| | | } |
| | | } |
| | |
| | | @TableField("keep_shop_point") |
| | | private Integer keepShopPoint; |
| | | |
| | | @ApiModelProperty(value = "会员等级是否必须达到代理: 0-否 1-是") |
| | | @TableField("vip_level_up_proxy_role") |
| | | private Integer vipLevelUpProxyRole; |
| | | |
| | | |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> { |
| | | @Override |
| | |
| | | public R<Shop> getShopByPhone(String phone) { |
| | | return R.fail("根据店铺管理员电话获取门店数据失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Shop>> getShopByUserIds(List<Long> userIds) { |
| | | return R.fail("根据用户id集合获取门店数据失败"); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.api.feignClient.TechnicianClient; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Void> updateStatus(Integer status, Integer subscribeId) { |
| | | public R<Void> updateStatus(Integer status, Long subscribeId) { |
| | | return R.fail("跟新技师预约状态失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TechnicianSubscribe> getSubscribeByOrderId(Long orderId) { |
| | | return R.fail("根据订单id获取预约信息失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | public interface OrderClient { |
| | | @PostMapping(value = "/management/give/vip") |
| | | public R<List<Long>> getOrderIdsByTechId(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.factory.ShopClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/shop/getShopByPhone") |
| | | R<Shop> getShopByPhone(@RequestParam("phone") String phone); |
| | | |
| | | @PostMapping("/getShopByUserIds") |
| | | public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | @FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class) |
| | | public interface TechnicianClient { |
| | | |
| | | @PostMapping("/technician/shop/detail") |
| | | R<Technician> shopdetail(@RequestParam("techId") Integer techId); |
| | | @GetMapping("/technician/getById") |
| | | R<Technician> shopdetail(@RequestParam("id") Integer techId); |
| | | |
| | | @PutMapping("/technician-subscribe/updateStatus") |
| | | R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Integer subscribeId); |
| | | R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Long subscribeId); |
| | | |
| | | @GetMapping("/technician-subscribe/getSubscribeByOrderId") |
| | | R<TechnicianSubscribe> getSubscribeByOrderId(@RequestParam("orderId") Long orderId); |
| | | } |
| | |
| | | |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | private String delFlag; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | private Integer shopId; |
| | | |
| | | /** 父部门名称 */ |
| | | private String parentName; |
| | |
| | | { |
| | | this.children = children; |
| | | } |
| | | |
| | | |
| | | public Integer getShopId() { |
| | | return shopId; |
| | | } |
| | | |
| | | public void setShopId(Integer shopId) { |
| | | this.shopId = shopId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | /** 角色状态(0正常 1停用) */ |
| | | @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("shop_id") |
| | | private Integer shopId; |
| | | |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | @TableField("del_flag") |
| | |
| | | this.number = number; |
| | | } |
| | | |
| | | public Integer getShopId() { |
| | | return shopId; |
| | | } |
| | | |
| | | public void setShopId(Integer shopId) { |
| | | this.shopId = shopId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | * 获取部门列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | public AjaxResult list(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return success(depts); |
| | | } |
| | |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable Long deptId) { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return success(deptService.selectDeptById(deptId)); |
| | | } |
| | |
| | | * 新增部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) { |
| | | if (!deptService.checkDeptNameUnique(dept)) { |
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(SecurityUtils.getUsername()); |
| | |
| | | * 修改部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | |
| | | * 删除部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | @Resource |
| | | private SysMenuMapper menuMapper; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-系统用户管理"}) |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-账号管理", "门店后台-账号管理"}) |
| | | @GetMapping("/list") |
| | | public AjaxResult list() { |
| | | List<SysRole> list = roleService.list(new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0)); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0); |
| | | if(sysUser.getRoleType() == 2){ |
| | | wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); |
| | | } |
| | | List<SysRole> list = roleService.list(wrapper); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-角色管理"}) |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-权限管理", "门店后台-权限管理"}) |
| | | public AjaxResult listPage(String name, BasePage basePage) { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getStatus, 0).eq(SysRole::getDelFlag, 0); |
| | | if (StringUtils.isNotEmpty(name)) { |
| | | wrapper.like(SysRole::getRoleName, name); |
| | | } |
| | | |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); |
| | | } |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, wrapper.orderByDesc(SysRole::getCreateTime)); |
| | | for (SysRole record : page.getRecords()) { |
| | | long count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, record.getRoleId())); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/roleAdd") |
| | | @ApiOperation(value = "添加角色", tags = {"管理后台-角色管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | @ApiOperation(value = "添加角色", tags = {"管理后台-权限管理", "门店后台-权限管理"}) |
| | | public AjaxResult roleAdd(@Validated @RequestBody RoleAddDto dto) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | | long count = roleService.count(Wrappers.lambdaQuery(SysRole.class) |
| | | .eq(SysRole::getRoleName, dto.getRoleName())); |
| | | LambdaQueryWrapper<SysRole> wrapper = Wrappers.lambdaQuery(SysRole.class) |
| | | .eq(SysRole::getRoleName, dto.getRoleName()); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | wrapper.eq(SysRole::getShopId, sysUser.getObjectId()); |
| | | } |
| | | |
| | | long count = roleService.count(wrapper); |
| | | if (count > 0) { |
| | | return AjaxResult.error("角色已存在,请重新输入"); |
| | | } |
| | |
| | | role.setRemark(dto.getRemark()); |
| | | role.setCreateBy(SecurityUtils.getUsername()); |
| | | role.setCreateTime(new Date()); |
| | | |
| | | if(sysUser.getRoleType() == 2){ |
| | | role.setShopId(sysUser.getObjectId()); |
| | | } |
| | | roleService.insertRole(role); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/roleInfo") |
| | | @ApiOperation(value = "角色详情", tags = {"管理后台-角色管理"}) |
| | | @ApiOperation(value = "角色详情", tags = {"管理后台-权限管理"}) |
| | | public AjaxResult roleInfo(@RequestParam Long id) { |
| | | SysRole role = roleService.selectRoleById(id); |
| | | RoleInfoVo roleInfoVo = new RoleInfoVo(); |
| | |
| | | |
| | | |
| | | @PostMapping("/roleUpdate") |
| | | @ApiOperation(value = "编辑角色", tags = {"管理后台-角色管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | @ApiOperation(value = "编辑角色", tags = {"管理后台-权限管理"}) |
| | | public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | |
| | | */ |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | @ApiOperation(value = "删除角色", tags = {"管理后台-角色管理"}) |
| | | @ApiOperation(value = "删除角色", tags = {"管理后台-权限管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | |
| | | * 获取用户列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-系统用户管理", "管理后台-角色管理"}) |
| | | @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult list(GetSysUserList getSysUserList) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(getSysUserList.getPageCurr(), getSysUserList.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, getSysUserList); |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加系统用户", tags = {"管理后台-系统用户管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | @ApiOperation(value = "添加系统用户", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult add(@RequestBody SysUser user) { |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | |
| | | return error("登录账号重复"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(1); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | |
| | | |
| | | |
| | | @GetMapping("/verifyUserNameRepeat/{username}") |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"}) |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult verifyUserNameRepeat(@PathVariable String username){ |
| | | SysUser user = new SysUser(); |
| | | user.setUserName(username); |
| | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @ApiOperation(value = "获取用户详情", tags = {"管理后台-系统用户管理"}) |
| | | @ApiOperation(value = "获取用户详情", tags = {"管理后台-账号管理"}) |
| | | @GetMapping("/getInfo/{userId}") |
| | | public AjaxResult getInfo(@PathVariable Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "编辑系统用户", tags = {"管理后台-系统用户管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | @ApiOperation(value = "编辑系统用户", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation(value = "删除系统用户", tags = {"管理后台-系统用户管理"}) |
| | | @ApiOperation(value = "删除系统用户", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | |
| | | |
| | | |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-系统用户管理"}) |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult shopUserStart(@RequestBody ShopUserStart shopUserStart) { |
| | | if (shopUserStart.getUserId() == null) { |
| | | return AjaxResult.error("userId不能为空"); |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"}) |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | @ApiModelProperty("站点id") |
| | | private List<Integer> siteIds; |
| | | @ApiModelProperty(value = "站点名称") |
| | | private List<String> siteNames; |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.SpringUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.datascope.annotation.DataScope; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysDept; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | import com.ruoyi.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询部门管理数据 |
| | |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysDept> selectDeptList(SysDept dept) |
| | | { |
| | | public List<SysDept> selectDeptList(SysDept dept) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | return deptMapper.selectDeptList(dept); |
| | | } |
| | | |
| | |
| | | throw new ServiceException("部门停用,不允许新增"); |
| | | } |
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | return deptMapper.insertDept(dept); |
| | | } |
| | | |
| | |
| | | { |
| | | SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); |
| | | SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) |
| | | { |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) { |
| | | String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); |
| | | String oldAncestors = oldDept.getAncestors(); |
| | | dept.setAncestors(newAncestors); |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | int result = deptMapper.updateDept(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) |
| | |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectDeptVo"> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.shop_id |
| | | from sys_dept d |
| | | </sql> |
| | | |
| | |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="shopId != null"> |
| | | AND shop_id = #{shopId} |
| | | </if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | |
| | | <if test="phone != null and phone != ''">phone,</if> |
| | | <if test="email != null and email != ''">email,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="shopId != null">shop_id,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | |
| | | <if test="phone != null and phone != ''">#{phone},</if> |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="shopId != null">#{shopId},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | |
| | | <if test="phone != null">phone = #{phone},</if> |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="shopId != null">shop_id = #{shopId},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.account.vo.vip.Level; |
| | |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsVipClient; |
| | | import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private VipCenterService vipCenterService; |
| | | |
| | |
| | | @GetMapping("/check") |
| | | @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"}) |
| | | public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userid = loginUser.getUserid(); |
| | | if (type == 4){ |
| | | return R.ok(vipCenterService.checkReadyToBeProxy(userid, type)); |
| | | }else if (type == 5){ |
| | | return R.ok(vipCenterService.checkReadyToBeAgent(userid)); |
| | | }else if (type == 6){ |
| | | return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid)); |
| | | }else if (type == 7){ |
| | | return R.ok(vipCenterService.checkReadyToBePartner(userid)); |
| | | }else { |
| | | return R.fail("参数错误"); |
| | | } |
| | | return R.ok(vipCenterService.check(type)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private boolean checkSuccess(R<?> r) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | * 校验合伙人的申请条件 |
| | | */ |
| | | Boolean checkReadyToBePartner(Long userId); |
| | | |
| | | |
| | | Boolean check(Integer type); |
| | | } |
| | |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeProxy(Long userId,Integer vipId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | // 消费积分 |
| | | Integer shopPoint = appUser.getShopPoint(); |
| | | // 返佣积分 |
| | | Integer sharePoint = appUser.getSharePoint(); |
| | | // 准代理会员设置 |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(4); |
| | | // 获取通过消费积分达成会员等级的开关 |
| | | Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); |
| | | if (vipLevelUpShopRole == 1){ |
| | | // 消费积分阈值 |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | // 返佣积分阈值 |
| | | Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); |
| | | // 判断是否满足消费积分和返佣积分 |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | // 直推钻石用户数阈值 |
| | | Integer vipDirectNum = vipSetting.getVipDirectNum(); |
| | | // 获取用户直推钻石用户数量 |
| | | long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .eq(AppUser::getVipId, 3)); |
| | | // 判断是否满足直推钻石用户数量 |
| | | if (userDiamondsCount >= vipDirectNum){ |
| | | return true; |
| | | } |
| | | } |
| | | // 获取指定购买商品 |
| | | R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4); |
| | | if (R.isSuccess(vipGoodsByVipId)){ |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | | if (CollectionUtil.isEmpty(orderList)){ |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeAgent(Long userId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | // 消费积分 |
| | | Integer shopPoint = appUser.getShopPoint(); |
| | | // 返佣积分 |
| | | Integer sharePoint = appUser.getSharePoint(); |
| | | // 代理会员设置 |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(5); |
| | | // 获取通过消费积分达成会员等级的开关 |
| | | Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); |
| | | if (vipLevelUpShopRole == 1){ |
| | | // 消费积分阈值 |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | // 返佣积分阈值 |
| | | Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); |
| | | // 判断是否满足消费积分和返佣积分 |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | // 直推钻石用户数阈值 |
| | | Integer vipDirectNum = vipSetting.getVipDirectNum(); |
| | | // 获取用户直推钻石用户数量 |
| | | long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .eq(AppUser::getVipId, 3)); |
| | | // 判断是否满足直推钻石用户数量 |
| | | if (userDiamondsCount >= vipDirectNum){ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5); |
| | | if (R.isSuccess(vipGoodsByVipId)){ |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | | if (CollectionUtil.isEmpty(orderList)){ |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeTotalAgent(Long userId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | // 获取总代会员设置 |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(6); |
| | | // 获取会员等级是否必须达到代理 |
| | | Integer vipLevelUpProxyRole = vipSetting.getVipLevelUpProxyRole(); |
| | | if (vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){ |
| | | return true; |
| | | } |
| | | |
| | | // 消费积分 |
| | | Integer shopPoint = appUser.getShopPoint(); |
| | | // 返佣积分 |
| | | Integer sharePoint = appUser.getSharePoint(); |
| | | // 获取通过消费积分达成会员等级的开关 |
| | | Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); |
| | | if (vipLevelUpShopRole == 1){ |
| | | // 消费积分阈值 |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | // 返佣积分阈值 |
| | | Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); |
| | | // 判断是否满足消费积分和返佣积分 |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | // 直推代理用户数阈值 |
| | | Integer vipDirectNum = vipSetting.getVipDirectNum(); |
| | | // 准代理用户数阈值 |
| | | Integer vipDirectVipNum = vipSetting.getVipDirectVipNum(); |
| | | // 获取用户直推代理用户数量 |
| | | List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .eq(AppUser::getVipId, 5)); |
| | | |
| | | // 代理下的准代理数量 |
| | | List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getInviteUserId, userQuasiAgent) |
| | | .eq(AppUser::getVipId, 4)); |
| | | |
| | | // 判断是否满足直推代理用户数量和准代理数量 |
| | | if (userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum){ |
| | | return true; |
| | | } |
| | | } |
| | | // 获取指定购买商品 |
| | | R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5); |
| | | if (R.isSuccess(vipGoodsByVipId)){ |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | String goodJson = vipGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | | if (CollectionUtil.isEmpty(orderList)){ |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBePartner(Long userId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | // 消费积分 |
| | | Integer shopPoint = appUser.getShopPoint(); |
| | | // 返佣积分 |
| | | Integer sharePoint = appUser.getSharePoint(); |
| | | // 合伙人会员设置 |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(7); |
| | | // 获取通过消费积分达成会员等级的开关 |
| | | Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); |
| | | if (vipLevelUpShopRole == 1){ |
| | | // 消费积分阈值 |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | // 返佣积分阈值 |
| | | Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); |
| | | // 判断是否满足消费积分和返佣积分 |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ |
| | | return true; |
| | | } |
| | | |
| | | Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | // 直推代理用户数阈值 |
| | | Integer vipDirectNum = vipSetting.getVipDirectNum(); |
| | | // 准代理用户数阈值 |
| | | Integer vipDirectVipNum = vipSetting.getVipDirectVipNum(); |
| | | // 总代用户数阈值 |
| | | Integer vipTeamVipNum = vipSetting.getVipTeamVipNum(); |
| | | // 获取开店数量阈值 |
| | | Integer vipOpenShopNum = vipSetting.getVipOpenShopNum(); |
| | | |
| | | // 获取直推用户有超过指定门店数量的用户 |
| | | List<Long> userShopList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, userId)) |
| | | .stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(userShopList)){ |
| | | R<List<Shop>> r = shopClient.getShopByUserIds(userShopList); |
| | | List<Shop> shopList = r.getData(); |
| | | if (CollectionUtil.isNotEmpty(shopList)){ |
| | | Map<Long, List<Shop>> shopUserMap = shopList.stream().collect(Collectors.groupingBy(Shop::getAppUserId)); |
| | | |
| | | // 查找 list 长度大于 3 的 key |
| | | Set<Long> shopUserIdSet = shopUserMap.entrySet().stream() |
| | | .filter(entry -> entry.getValue().size() >= vipOpenShopNum) |
| | | .map(Map.Entry::getKey) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | // 获取用户直推总代理数量 |
| | | List<AppUser> userTotalAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getInviteUserId, shopUserIdSet) |
| | | .eq(AppUser::getVipId, 6)); |
| | | |
| | | // 获取用户直推代理用户数量 |
| | | List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getInviteUserId, shopUserIdSet) |
| | | .eq(AppUser::getVipId, 5)); |
| | | |
| | | // 代理下的准代理数量 |
| | | List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getInviteUserId, userQuasiAgent) |
| | | .eq(AppUser::getVipId, 4)); |
| | | |
| | | // 判断是否满足直推代理用户数量和准代理数量 |
| | | return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum && |
| | | userQuasiAgentCount >= vipDirectVipNum; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean check(Integer type) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userid = loginUser.getUserid(); |
| | | if (type == 4){ |
| | | return checkReadyToBeProxy(userid, type); |
| | | }else if (type == 5){ |
| | | return checkReadyToBeAgent(userid); |
| | | }else if (type == 6){ |
| | | return checkReadyToBeTotalAgent(userid); |
| | | }else if (type == 7){ |
| | | return checkReadyToBePartner(userid); |
| | | }else { |
| | | throw new ServiceException("参数错误"); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.enums.OrderStatus; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.service.CommissionService; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.vo.OrderDetailVO; |
| | | import com.ruoyi.order.vo.OrderVO; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigInteger; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private UserAddressClient addressClient; |
| | | @Resource |
| | | private CommissionService commissionService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | |
| | | |
| | | /** |
| | |
| | | }) |
| | | @GetMapping("/cancel/{orderId}") |
| | | public R<Void> cancel(@PathVariable("orderId") Long orderId){ |
| | | // TODO 待完善 |
| | | orderService.update(new LambdaUpdateWrapper<Order>() |
| | | .eq(Order::getId, orderId) |
| | | .set(Order::getOrderStatus, OrderStatus.CANCELLED.getCode())); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | }) |
| | | @GetMapping("/confirm/{orderId}") |
| | | public R<Void> confirm(@PathVariable("orderId") Long orderId){ |
| | | // TODO 待完善 |
| | | boolean update = orderService.update(new LambdaUpdateWrapper<Order>() |
| | | .eq(Order::getId, orderId) |
| | | .eq(Order::getOrderStatus, OrderStatus.PENDING_RECEIPT.getCode()) |
| | | .set(Order::getOrderStatus, OrderStatus.COMPLETED.getCode())); |
| | | if(!update){ |
| | | return R.fail("订单状态异常"); |
| | | } |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5); |
| | | if (R.isError(baseSettingR)) { |
| | | return R.fail("售后设置获取失败"); |
| | | } |
| | | BaseSetting baseSetting = baseSettingR.getData(); |
| | | if (baseSetting == null) { |
| | | return R.fail("售后设置获取失败"); |
| | | } |
| | | String content = baseSetting.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | Long days = jsonObject.getLong("days"); |
| | | commissionService.addToCommissionDelayQueue(orderId, LocalDateTime.now().plusDays(days)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 预约技师 |
| | | */ |
| | | @PostMapping("/subscribe") |
| | | public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){ |
| | | Order order = orderService.getById(id); |
| | | order.setTechnicianId(technicianId); |
| | | orderService.updateById(order); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | return R.fail("售后取消失败"); |
| | | } |
| | | refundPass.setDelFlag(1); |
| | | refundPassService.updateById(refundPass); |
| | | refundPassService.removeById(id); |
| | | order.setOrderStatus(4); |
| | | orderService.updateById(order); |
| | | return R.ok(); |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.service.ShoppingCartService; |
| | | import com.ruoyi.order.vo.*; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.GoodsShopClient; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/shopping-cart") |
| | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private GoodsShopClient goodsShopClient; |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/shoppingCartPayment") |
| | | @ApiOperation(value = "购物车订单支付", tags = {"商城-购物车-小程序"}) |
| | | public R<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | public R<String> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | return shoppingCartService.shoppingCartPayment(shoppingCartPayment); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getVerifiableShop") |
| | | @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"}) |
| | | public R<List<VerifiableShopVo>> getVerifiableShop(){ |
| | | LoginUser loginUser = tokenService.getLoginUserApplet(); |
| | | List<ShoppingCart> shoppingCarts = shoppingCartService.list(new LambdaQueryWrapper<ShoppingCart>() |
| | | .eq(ShoppingCart::getAppUserId, loginUser.getUserid())); |
| | | |
| | | List<Integer> goodsIds = shoppingCarts.stream().map(ShoppingCart::getGoodsId).collect(Collectors.toList()); |
| | | GetGoodsShopByGoodsIds goodsShopByGoodsIds = new GetGoodsShopByGoodsIds(); |
| | | goodsShopByGoodsIds.setGoodsIds(goodsIds); |
| | | R<List<GoodsShop>> r = goodsShopClient.getGoodsShopByGoodsIds(goodsShopByGoodsIds); |
| | | List<GoodsShop> goodsShops = r.getData(); |
| | | List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>(); |
| | | if (CollectionUtil.isNotEmpty(goodsShops)){ |
| | | for (GoodsShop goodsShop : goodsShops) { |
| | | R<Shop> shopR = shopClient.getShopById(goodsShop.getShopId()); |
| | | if (R.isSuccess(shopR)){ |
| | | VerifiableShopVo verifiableShopVo = new VerifiableShopVo(); |
| | | verifiableShopVo.setId(shopR.getData().getId()); |
| | | verifiableShopVo.setName(shopR.getData().getName()); |
| | | verifiableShopVoList.add(verifiableShopVo); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(verifiableShopVoList); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | void writeOff(String code,Integer shopId); |
| | | |
| | | void commission(Long orderId); |
| | | } |
| | |
| | | * 添加商品 |
| | | * @param shoppingCart |
| | | */ |
| | | void addGoods(ShoppingCart shoppingCart); |
| | | Long addGoods(ShoppingCart shoppingCart); |
| | | |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.order.model.OrderGood; |
| | | import com.ruoyi.order.service.CommissionService; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.vo.OrderDetailVO; |
| | | import com.ruoyi.order.vo.OrderGoodsVO; |
| | | import com.ruoyi.order.vo.OrderVO; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.TechnicianClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | private TechnicianClient technicianClient; |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private CommissionService commissionService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | orderDetailVO.setDistributionMode(goods.getDistributionMode()); |
| | | } |
| | | |
| | | Technician technician = new Technician(); |
| | | if (order.getTechnicianId() != null){ |
| | | R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId()); |
| | | if (shopdetail.getCode() != R.SUCCESS){ |
| | | throw new ServiceException("获取技师信息失败"); |
| | | } |
| | | technician = shopdetail.getData(); |
| | | } |
| | | Shop shop = shopR.getData(); |
| | | |
| | | |
| | | orderDetailVO.setId(order.getId()); |
| | | orderDetailVO.setOrderStatus(order.getOrderStatus()); |
| | | orderDetailVO.setPoint(order.getPoint()); |
| | |
| | | orderDetailVO.setLongitude(shop.getLongitude()); |
| | | orderDetailVO.setLatitude(shop.getLatitude()); |
| | | orderDetailVO.setShopId(shop.getId()); |
| | | orderDetailVO.setTechnicianName(technician.getName()); |
| | | return orderDetailVO; |
| | | } |
| | | |
| | |
| | | orderMapper.updateById(order); |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType.equals(OrderType.SERVICE.getCode())){ |
| | | R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId()); |
| | | if (shopdetail.getCode() != R.SUCCESS){ |
| | | throw new ServiceException("获取技师信息失败"); |
| | | R<TechnicianSubscribe> subscribeR = technicianClient.getSubscribeByOrderId(order.getId()); |
| | | if (R.isError(subscribeR)){ |
| | | throw new ServiceException("获取预约信息失败"); |
| | | } |
| | | Technician technician = shopdetail.getData(); |
| | | R<Void> r = technicianClient.updateStatus(2, technician.getId()); |
| | | if (r.getCode() != R.SUCCESS){ |
| | | throw new ServiceException("修改技师状态失败"); |
| | | TechnicianSubscribe subscribe = subscribeR.getData(); |
| | | subscribe.setStatus(2); |
| | | R<Void> r = technicianClient.updateStatus(subscribe.getStatus(), subscribe.getId()); |
| | | if (R.isError(r)){ |
| | | throw new ServiceException("更新预约状态失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void commission(Long orderId) { |
| | | |
| | | // 售后设置 |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5); |
| | | if (R.isError(baseSettingR)) { |
| | | throw new ServiceException("售后设置获取失败"); |
| | | } |
| | | BaseSetting baseSetting = baseSettingR.getData(); |
| | | if (baseSetting == null) { |
| | | throw new ServiceException("售后设置获取失败"); |
| | | } |
| | | String content = baseSetting.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | Long days = jsonObject.getLong("days"); |
| | | commissionService.addToCommissionDelayQueue(order.getId(), LocalDateTime.now().plusDays(days)); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public void addGoods(ShoppingCart shoppingCart) { |
| | | public Long addGoods(ShoppingCart shoppingCart) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | shoppingCart.setAppUserId(userid); |
| | | this.save(shoppingCart); |
| | | return shoppingCart.getId(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ConfirmOrderVo confirmOrder(ConfirmOrder confirmOrder) { |
| | | Integer position = confirmOrder.getPosition(); |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | //直接购买商品 |
| | | if(2 == position){ |
| | | //先加入购物车 |
| | | String goodsJson = confirmOrder.getGoodsJson(); |
| | | JSONArray objects = JSON.parseArray(goodsJson); |
| | | Long id = objects.getJSONObject(0).getLong("id"); |
| | | Integer num1 = objects.getJSONObject(0).getInteger("num"); |
| | | ShoppingCart shoppingCart = new ShoppingCart(); |
| | | shoppingCart.setAppUserId(userid); |
| | | shoppingCart.setGoodsId(id.intValue()); |
| | | shoppingCart.setNumber(num1); |
| | | Long shoppingCarId = addGoods(shoppingCart); |
| | | confirmOrder.setGoodsJson("[{\"id\": " + shoppingCarId + ", \"num\": " + num1 + "}]"); |
| | | } |
| | | AppUser appUser = appUserClient.getAppUserById(userid); |
| | | Integer shopId = confirmOrder.getShopId(); |
| | | Shop shop = shopClient.getShopById(shopId).getData(); |
| | |
| | | confirmOrderVo.setResidualPoint(appUser.getLavePoint().intValue()); |
| | | //获取默认收货地址 |
| | | UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData(); |
| | | userAddress.setIdStr(userAddress.getId().toString()); |
| | | confirmOrderVo.setUserAddress(userAddress); |
| | | confirmOrderVo.setPaymentType(confirmOrder.getPaymentType()); |
| | | //获取用户优惠券,用户全部优惠券,不能使用的需要标识出来置灰展示 |
| | |
| | | order.setGoodName(goodName.substring(0, goodName.length() - 1)); |
| | | Goods goods = goodsClient.getGoodsById(goodsList.get(0).getGoodsId()).getData(); |
| | | order.setOrderType(goods.getType()); |
| | | order.setOrderStatus(1); |
| | | order.setOrderStatus(goods.getType() == 1 ? 3 : 1); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | order.setOrderNumber("QJS" + getNumber(3) + sdf.format(new Date())); |
| | | order.setTotalAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN)); |
| | |
| | | this.removeBatchByIds(ids); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | return R.ok(order.getId().toString()); |
| | | } |
| | | |
| | | |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class ConfirmOrder { |
| | | @ApiModelProperty(value = "购买方式(1=购物车,2=商品详情)", required = true) |
| | | private Integer position; |
| | | @ApiModelProperty(value = "购物车数据id,数量 JSON[{id:1212,num:2}]", required = true) |
| | | private String goodsJson; |
| | | @ApiModelProperty(value = "支付方式(1=现金,2=积分)", required = true) |
File was renamed from ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/VerifiableShopVo.java |
| | |
| | | package com.ruoyi.other.vo; |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type)); |
| | | return R.ok(null == one ? "" : one.getContent()); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getAgreementByType/{type}") |
| | | @ApiOperation(value = "获取协议详情", tags = {"管理后台-协议管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public R<Agreement> getAgreementByType(@PathVariable("type") Integer type){ |
| | | Agreement one = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/saveAgreement") |
| | | @ApiOperation(value = "保存协议", tags = {"管理后台-协议管理"}) |
| | | public R saveAgreement(@RequestBody Agreement agreement){ |
| | | if(null != agreement.getId()){ |
| | | agreementService.updateById(agreement); |
| | | }else{ |
| | | agreement.setCreateTime(LocalDateTime.now()); |
| | | agreementService.save(agreement); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | import com.ruoyi.other.service.GoodsCategoryService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/goods-category") |
| | | @Api(tags = "商品分类") |
| | | public class GoodsCategoryController { |
| | | @Api("商品分类") |
| | | public class GoodsCategoryController extends BaseController { |
| | | @Resource |
| | | private GoodsCategoryService goodsCategoryService; |
| | | |
| | | |
| | | @PostMapping("/addGoodsCategory") |
| | | @ApiOperation(value = "添加商品分类", tags = {"管理后台-商品分类"}) |
| | | public R<Void> addGoodsCategory(GoodsCategory goodsCategory){ |
| | | goodsCategoryService.save(goodsCategory); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PutMapping("/updateGoodsCategory") |
| | | @ApiOperation(value = "修改商品分类", tags = {"管理后台-商品分类"}) |
| | | public R<Void> updateGoodsCategory(GoodsCategory goodsCategory){ |
| | | goodsCategoryService.updateById(goodsCategory); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getGoodsCategoryById") |
| | | @ApiOperation(value = "商品分类详情", tags = {"管理后台-商品分类"}) |
| | | public R<GoodsCategory> getGoodsCategoryById(@RequestParam("id") Integer id){ |
| | | return R.ok(goodsCategoryService.getById(id)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getList") |
| | | @ApiOperation(value = "商品分类列表", tags = {"管理后台-商品分类"}) |
| | | public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){ |
| | | Page<GoodsCategory> page = goodsCategoryService.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(goodsCategory.getName()),GoodsCategory::getName, goodsCategory.getName()) |
| | | .page(Page.of(PageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "删除商品分类", tags = {"管理后台-商品分类"}) |
| | | public R<Void> delete(@RequestParam("id") Integer id){ |
| | | goodsCategoryService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/index/list") |
| | | @ApiOperation(value = "商品分类", tags = {"小程序-首页"}) |
| | |
| | | List<GoodsCategory> indexlist = goodsCategoryService.lambdaQuery() |
| | | .orderByDesc(GoodsCategory::getCreateTime) |
| | | .last("limit 8") |
| | | .list() |
| | | ; |
| | | .list(); |
| | | return R.ok(indexlist); |
| | | } |
| | | @GetMapping("/list") |
| | |
| | | private GoodsService goodsService; |
| | | |
| | | /** |
| | | * 添加商品 |
| | | */ |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "添加商品", tags = {"管理后台-发布商品"}) |
| | | public R<Void> addGoods(@RequestBody Goods goods) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 商品列表 |
| | | */ |
| | | @GetMapping("/goodsList") |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private GoodsEvaluateService goodsEvaluateService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @GetMapping("/goodsList") |
| | | @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"}) |
| | |
| | | AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); |
| | | goodsEvaluate.setUserName(appUserById.getName()); |
| | | goodsEvaluate.setAvatar(appUserById.getAvatar()); |
| | | goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | |
| | | @GetMapping("/detail/{orderId}") |
| | | @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"}) |
| | | public R<List<GoodsEvaluate>> detail(@PathVariable("orderId") Long orderId){ |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>() |
| | | .eq(GoodsEvaluate::getStatus, 2) |
| | | .eq(GoodsEvaluate::getAppUserId,loginUserApplet.getUserid()) |
| | | .eq(GoodsEvaluate::getOrderId, orderId)); |
| | | for (GoodsEvaluate goodsEvaluate : list) { |
| | | Goods goods = goodsService.getById(goodsEvaluate.getGoodsId()); |
| | | goodsEvaluate.setGoodsName(goods.getName()); |
| | | goodsEvaluate.setGoodsImg(goods.getHomePagePicture()); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getGoodsShopByGoodsIds") |
| | | public R<List<GoodsShop>> getGoodsShopByGoodsIds(@RequestBody GetGoodsShopByGoodsIds goodsIds) { |
| | | List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, goodsIds.getShopId()).in(GoodsShop::getGoodsId, goodsIds.getGoodsIds())); |
| | | List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>() |
| | | .eq(goodsIds.getShopId() != null,GoodsShop::getShopId, goodsIds.getShopId()) |
| | | .in(goodsIds.getGoodsIds() !=null ,GoodsShop::getGoodsId, goodsIds.getGoodsIds())); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Phone; |
| | | import com.ruoyi.other.enums.PhoneType; |
| | | import com.ruoyi.other.service.PhoneService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | public class PhoneController extends BaseController { |
| | | @Resource |
| | | private PhoneService phoneService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询指定门店手机号 |
| | |
| | | .eq(Phone::getType, PhoneType.SHOP.getCode()) |
| | | .eq(Phone::getShopId, shopId))); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getSysPhone") |
| | | @ApiOperation(value = "获取客服电话", tags = {"管理后台-客服电话", "门店后台-客服电话"}) |
| | | public R<Phone> getSysPhone(){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | LambdaQueryWrapper<Phone> wrapper = new LambdaQueryWrapper<>(); |
| | | if(sysUser.getRoleType() == 1){ |
| | | wrapper.eq(Phone::getType, 1); |
| | | }else{ |
| | | wrapper.eq(Phone::getType, 2).eq(Phone::getShopId, sysUser.getObjectId()); |
| | | } |
| | | Phone one = phoneService.getOne(wrapper); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/savePhone") |
| | | @ApiOperation(value = "保存客服电话", tags = {"管理后台-客服电话", "门店后台-客服电话"}) |
| | | public R savePhone(@RequestBody Phone phone){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | //平台配置 |
| | | if(sysUser.getRoleType() == 1){ |
| | | Phone one = phoneService.getOne(new LambdaQueryWrapper<Phone>().eq(Phone::getType, 1)); |
| | | if(null != one){ |
| | | one.setPhoneOne(phone.getPhoneOne()); |
| | | one.setPhoneTwo(phone.getPhoneTwo()); |
| | | phoneService.updateById(one); |
| | | }else{ |
| | | phone.setType(1); |
| | | phoneService.save(phone); |
| | | } |
| | | }else{ |
| | | //门店配置 |
| | | Phone one = phoneService.getOne(new LambdaQueryWrapper<Phone>().eq(Phone::getType, 2).eq(Phone::getShopId, sysUser.getObjectId())); |
| | | if(null != one){ |
| | | one.setPhoneOne(phone.getPhoneOne()); |
| | | one.setPhoneTwo(phone.getPhoneTwo()); |
| | | phoneService.updateById(one); |
| | | }else{ |
| | | phone.setType(2); |
| | | phone.setShopId(sysUser.getObjectId()); |
| | | phoneService.save(phone); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Share; |
| | | import com.ruoyi.other.enums.ShareAddType; |
| | | import com.ruoyi.other.enums.ShareAuditStatus; |
| | | import com.ruoyi.other.service.ShareService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | @ApiOperation(value = "添加", tags = {"后台-分享管理"}) |
| | | @PostMapping("/manage/add") |
| | | public R<Void> manage(@RequestBody Share share){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userid = loginUser.getSysUser().getUserId(); |
| | | share.setAddType(1); |
| | | share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); |
| | | share.setObjectId(userid.toString()); |
| | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopScore; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.enums.ShopStatus; |
| | | import com.ruoyi.other.service.ShopScoreService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import com.ruoyi.other.vo.VerifiableShopVo; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private ShopScoreService shopScoreService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | @PostMapping("/getDetailById") |
| | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getVerifiableShop") |
| | | @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"}) |
| | | public R<List<VerifiableShopVo>> getVerifiableShop(){ |
| | | // todo 待完善 pu |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取门店信息 |
| | | * @param id |
| | |
| | | Shop one = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getPhone, phone).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | @PostMapping("/getShopByUserIds") |
| | | public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds){ |
| | | List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getAppUserId, userIds)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.api.domain.TechnicianScore; |
| | | import com.ruoyi.other.service.TechnicianScoreService; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | |
| | | */ |
| | | @GetMapping("/technicianListByShopId") |
| | | @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) |
| | | public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) { |
| | | public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) { |
| | | startPage(); |
| | | return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId))); |
| | | return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId,name))); |
| | | } |
| | | |
| | | @GetMapping("/getById") |
| | | @ApiOperation(value = "技师详情", tags = {"技师详情-小程序"}) |
| | | public R<Technician> getById(@RequestParam("id") Integer id){ |
| | | Technician byId = technicianService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/subscribe") |
| | | @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"}) |
| | | public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) { |
| | | technicianSubscribeService.subscribe(technicianSubscribe, technicianSubscribe.getTechnicianId()); |
| | | technicianSubscribeService.subscribe(technicianSubscribe); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status)); |
| | | } |
| | | |
| | | @GetMapping("/getSubscribeByOrderId") |
| | | @ApiOperation(value = "根据订单id获取预约信息", notes = "根据订单id获取预约信息", tags = {"后台-技师预约管理-根据订单id获取预约信息"}) |
| | | public R<TechnicianSubscribe> getSubscribeByOrderId(@ApiParam(value = "订单id") @RequestParam Long orderId) { |
| | | return R.ok(technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>() |
| | | .eq(TechnicianSubscribe::getOrderId, orderId))); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface TechnicianMapper extends BaseMapper<Technician> { |
| | | |
| | | List<TechnicianVO> selectTechnicianListByShopId(Long shopId); |
| | | List<TechnicianVO> selectTechnicianListByShopId(@Param("shopId") Long shopId,@Param("name") String name); |
| | | |
| | | TechnicianDetailVO selectTechnicianDetail(Long technicianId); |
| | | |
| | |
| | | List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude); |
| | | |
| | | ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude); |
| | | |
| | | } |
| | |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianService extends IService<Technician> { |
| | | List<TechnicianVO> getTechnicianListByShopId(Long shopId); |
| | | List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name); |
| | | |
| | | TechnicianDetailVO technicianDetail(Long technicianId); |
| | | } |
| | |
| | | |
| | | IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status); |
| | | |
| | | void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId); |
| | | void subscribe(TechnicianSubscribe technicianSubscribe); |
| | | } |
| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.mapper.GoodsEvaluateMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService { |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) { |
| | | List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates(); |
| | | for (GoodsEvaluate goodsEvaluate : evaluates) { |
| | | goodsEvaluate.setStatus(2); |
| | | if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){ |
| | | goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr())); |
| | | updateById(goodsEvaluate); |
| | | }else { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | goodsEvaluate.setAppUserId(loginUserApplet.getUserid()); |
| | | save(goodsEvaluate); |
| | | } |
| | | } |
| | | this.saveBatch(evaluates); |
| | | if (CollectionUtil.isNotEmpty(evaluates)){ |
| | | Order order = new Order(); |
| | | order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId()); |
| | |
| | | private TechnicianScoreService technicianScoreService; |
| | | |
| | | @Override |
| | | public List<TechnicianVO> getTechnicianListByShopId(Long shopId) { |
| | | return technicianMapper.selectTechnicianListByShopId(shopId); |
| | | public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name) { |
| | | return technicianMapper.selectTechnicianListByShopId(shopId,name); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.enums.TechnicianStatus; |
| | | import com.ruoyi.other.mapper.TechnicianMapper; |
| | | import com.ruoyi.other.mapper.TechnicianSubscribeMapper; |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import com.ruoyi.other.vo.TechnicianSubscribeVO; |
| | |
| | | @Resource |
| | | private TechnicianSubscribeMapper technicianSubscribeMapper; |
| | | @Resource |
| | | private TechnicianMapper technicianMapper; |
| | | private RemoteOrderGoodsClient orderGoodsClient; |
| | | |
| | | @Override |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | // @DistributedLock(lockNamePre = "#technician_subscribe_lock", lockNamePost = "#technicianId") |
| | | public void subscribe(TechnicianSubscribe subscribe, Long technicianId) { |
| | | // Long count = technicianSubscribeMapper.selectCount(new LambdaQueryWrapper<TechnicianSubscribe>() |
| | | // .eq(TechnicianSubscribe::getTechnicianId, technicianId) |
| | | // .eq(TechnicianSubscribe::getSubscribeTime, subscribe.getSubscribeTime()) |
| | | // .eq(TechnicianSubscribe::getStatus, TechnicianStatus.UNSUBSCRIBE.getCode())); |
| | | // if (count > 0) { |
| | | // throw new ServiceException("当前时间段已被预约", TechnicianErrorCode.TECHNICIAN_ALREADY_SUBSCRIBED.getCode()); |
| | | // } |
| | | // 创建技师预约单 |
| | | Long userId = SecurityUtils.getUserId(); |
| | | subscribe.setAppUserId(userId); |
| | | subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode()); |
| | | subscribe.setDelFlag(0); |
| | | subscribe.setCreateTime(LocalDateTime.now()); |
| | | technicianSubscribeMapper.insert(subscribe); |
| | | public void subscribe(TechnicianSubscribe subscribe) { |
| | | if (StringUtils.isNotEmpty(subscribe.getIdStr())){ |
| | | subscribe.setId(Long.parseLong(subscribe.getIdStr())); |
| | | technicianSubscribeMapper.updateById(subscribe); |
| | | }else { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | subscribe.setAppUserId(userId); |
| | | subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode()); |
| | | subscribe.setDelFlag(0); |
| | | subscribe.setCreateTime(LocalDateTime.now()); |
| | | technicianSubscribeMapper.insert(subscribe); |
| | | } |
| | | if (subscribe.getTechnicianId() != null){ |
| | | orderGoodsClient.subscribe(subscribe.getOrderId(), subscribe.getTechnicianId()); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | |
| | | |
| | | } |
| | |
| | | tt.`status` = 2 |
| | | AND tt.del_flag = 0 |
| | | AND tt.shop_id = #{shopId} |
| | | <if test="name != null and name != ''"> |
| | | AND tt.`name` LIKE concat('%', #{name}, '%') |
| | | </if> |
| | | GROUP BY |
| | | tt.id, |
| | | tt.`name`, |
| | |
| | | tt.`name`, |
| | | tt.introduction, |
| | | tt.home_picture, |
| | | COUNT(tts.id) AS serviceCount, |
| | | COUNT(DISTINCT tts.id) AS serviceCount, |
| | | AVG(ttsc.score) AS score, |
| | | tt.info_picture |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | AND tts.`status` != 0 |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tt.`status` = 2 |
| | |
| | | <select id="getTechnicianSubscribeByUser" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO"> |
| | | SELECT * from ( |
| | | SELECT |
| | | tts.id, |
| | | CAST(tts.id AS CHAR) id, |
| | | tts.user_address, |
| | | ts.`name` shopName, |
| | | ts.address shopAddress, |