Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | /** 删除标志(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> |
| | |
| | | * 添加商品 |
| | | * @param shoppingCart |
| | | */ |
| | | void addGoods(ShoppingCart shoppingCart); |
| | | Long addGoods(ShoppingCart shoppingCart); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | @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 R shoppingCartPayment(ShoppingCartPayment shoppingCartPayment) { |
| | | Integer position = shoppingCartPayment.getPosition(); |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | //直接购买商品 |
| | | if(2 == position){ |
| | | //先加入购物车 |
| | | String goodsJson = shoppingCartPayment.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); |
| | | shoppingCartPayment.setGoodsJson("[{\"id\": " + shoppingCarId + ", \"num\": " + num1 + "}]"); |
| | | } |
| | | AppUser appUser = appUserClient.getAppUserById(userid); |
| | | Integer shopId = shoppingCartPayment.getShopId(); |
| | | String goodsJson = shoppingCartPayment.getGoodsJson(); |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class ShoppingCartPayment { |
| | | @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=账户余额,3=积分)", required = true) |
| | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | | |