| | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.entity.Franchisee; |
| | | import com.ruoyi.admin.entity.Region; |
| | | import com.ruoyi.admin.entity.SysUser; |
| | | import com.ruoyi.admin.entity.UserRole; |
| | | import com.ruoyi.admin.service.FranchiseeService; |
| | | import com.ruoyi.admin.service.RegionService; |
| | | import com.ruoyi.admin.service.SysUserService; |
| | | import com.ruoyi.admin.service.UserRoleService; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | |
| | | private SysUserService sysUserService; |
| | | @Resource |
| | | private UserRoleService userRoleService; |
| | | @Resource |
| | | private RegionService regionService; |
| | | |
| | | /** |
| | | * 加盟商信息分页列表 |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_list") |
| | | @ApiOperation(value = "加盟商信息分页查询列表", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | * |
| | | * @param id 加盟商信息id |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_detail") |
| | | @ApiOperation(value = "加盟商信息详情", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/detail") |
| | | @ApiImplicitParams({ |
| | |
| | | public R<List<String>> cityDetail(@RequestParam("id") Integer id) { |
| | | Franchisee franchisee = franchiseeService.lambdaQuery() |
| | | .eq(Franchisee::getId, id).eq(Franchisee::getIsDelete, 0).one(); |
| | | return R.ok(Arrays.stream(franchisee.getCity().split(",")).collect(Collectors.toList())); |
| | | return R.ok(Arrays.stream(franchisee.getCityCode().split(",")).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param franchisee 加盟商信息信息 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_save") |
| | | @ApiOperation(value = "新增加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody @Validated Franchisee franchisee) { |
| | |
| | | throw new GlobalException("请输入管理员初始密码!"); |
| | | } |
| | | String md5Password = checkFranchisee(franchisee); |
| | | String cityCode = franchisee.getCityCode(); |
| | | List<String> list = Arrays.stream(cityCode.split(",")).collect(Collectors.toList()); |
| | | StringBuilder str = new StringBuilder(); |
| | | for (String code : list) { |
| | | Region region = regionService.lambdaQuery() |
| | | .eq(Region::getCode, code).one(); |
| | | if (null != region) { |
| | | str.append(region.getName()).append(","); |
| | | } |
| | | } |
| | | String city = str.substring(Constants.ZERO, str.length() - 1); |
| | | franchisee.setCity(city); |
| | | boolean save = franchiseeService.save(franchisee); |
| | | // 生成sysUser账号 |
| | | SysUser sysUser = new SysUser(); |
| | |
| | | * |
| | | * @param franchisee 加盟商信息信息 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_update") |
| | | @ApiOperation(value = "修改加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody @Validated Franchisee franchisee) { |
| | |
| | | * @param id 加盟商id |
| | | * @param enable 启用/关闭 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_enable") |
| | | @ApiOperation(value = "启用/关闭加盟商", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/enable") |
| | | @ApiImplicitParams({ |
| | |
| | | .eq(SysUser::getIsDelete, Constants.ZERO) |
| | | .eq(SysUser::getFranchiseeId, null).one(); |
| | | if (null != only || null != user) { |
| | | throw new GlobalException("该账号已存在!"); |
| | | throw new GlobalException("该账号已存在!", 500); |
| | | } |
| | | // String city = franchisee.getCity(); |
| | | // List<String> cityList = Arrays.stream(city.split(",")).collect(Collectors.toList()); |
| | |
| | | * |
| | | * @param ids 加盟商信息多条id拼接 |
| | | */ |
| | | @RequiresPermissions("franchisee") |
| | | @RequiresPermissions("franchisee_delete") |
| | | @ApiOperation(value = "批量删除加盟商信息", tags = {"后台-加盟商管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |