Commit f1b07933 by 叶立庆

优化项目内容

1 parent 61b0a724
Showing 33 changed files with 26 additions and 1706 deletions
...@@ -64,11 +64,6 @@ ...@@ -64,11 +64,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.bs</groupId>
<artifactId>bs-service</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
...@@ -115,6 +110,31 @@ ...@@ -115,6 +110,31 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
</dependency> </dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-apache-httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
</dependency>
</dependencies> </dependencies>
......
package com.bs.web.controller.relation;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.relation.SpStoreRelation;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.enums.OperatorType;
import com.bs.web.service.relation.ISpStoreRelationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.bs.common.core.domain.entity.store.BusinessStore;
import com.bs.web.domain.vo.sp.SpStoreListReq;
import com.bs.web.domain.vo.sp.SpStoreRelationMaintainReq;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import java.util.List;
@RestController
@RequestMapping("/sp/relation/sp-store")
@Tag(name = "服务商-门店关联")
public class SpStoreRelationController extends BaseController {
@Resource
private ISpStoreRelationService spStoreRelationService;
@Log(title = "维护服务商关联门店关系", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/maintain")
@Operation(summary = "维护服务商关联门店关系")
public AjaxResult<Boolean> maintainRelation(@RequestBody @Validated SpStoreRelationMaintainReq req) {
return AjaxResult.success(spStoreRelationService.maintainRelation(req));
}
@GetMapping(value = "/storeList")
@Operation(summary = "查询指定服务商关联的所有门店列表")
public TableDataInfo<List<BusinessStore>> getStoreListBySpId(@Validated SpStoreListReq req) {
if (req == null) req = new SpStoreListReq();
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> pageResult = spStoreRelationService.getStoreListBySpIdPage(req.getSpId(), req.getStoreName(), pageNum, pageSize);
TableDataInfo<List<BusinessStore>> rspData = new TableDataInfo<>();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
@Operation(summary = "列表")
public AjaxResult<List<SpStoreRelation>> list(SpStoreRelation query) {
List<SpStoreRelation> list = spStoreRelationService.list(query);
return AjaxResult.success(list);
}
@RequestMapping(value = "/page", method = {RequestMethod.GET, RequestMethod.POST})
@Operation(summary = "分页列表")
public TableDataInfo page(@RequestBody(required = false) SpStoreRelation query) {
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null && query != null && query.getParams() != null && query.getParams().get("pageNum") != null) {
pageNum = Integer.parseInt(query.getParams().get("pageNum").toString());
}
if (pageSize == null && query != null && query.getParams() != null && query.getParams().get("pageSize") != null) {
pageSize = Integer.parseInt(query.getParams().get("pageSize").toString());
}
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<SpStoreRelation> pageResult = spStoreRelationService.page(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<SpStoreRelation> get(@PathVariable("id") Long id) {
return AjaxResult.success(spStoreRelationService.get(id));
}
@Log(title = "门店关联", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody SpStoreRelation info) {
spStoreRelationService.add(info);
return AjaxResult.success();
}
@Log(title = "门店关联", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody SpStoreRelation info) {
spStoreRelationService.edit(info);
return AjaxResult.success();
}
@Log(title = "门店关联", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
spStoreRelationService.remove(id);
return AjaxResult.success();
}
@PostMapping("/code/{storeCode}")
@Operation(summary = "根据门店编码查未删除的关联列表")
public AjaxResult<List<SpStoreRelation>> listActiveByStoreCode(@PathVariable("storeCode") String storeCode) {
return AjaxResult.success(spStoreRelationService.listByStoreCodeActive(storeCode));
}
}
package com.bs.web.controller.relation;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.relation.SysUserSpRelation;
import com.bs.common.core.page.TableDataInfo;
import com.bs.web.service.relation.ISysUserSpRelationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sp/relation/user-sp")
@Tag(name = "用户-服务商关联")
public class SysUserSpRelationController extends BaseController {
@Resource
private ISysUserSpRelationService sysUserSpRelationService;
@PostMapping("/list")
@Operation(summary = "列表")
public AjaxResult<List<SysUserSpRelation>> list(SysUserSpRelation query) {
List<SysUserSpRelation> list = sysUserSpRelationService.list(query);
return AjaxResult.success(list);
}
@GetMapping(value = "/page")
@Operation(summary = "分页列表")
public TableDataInfo page(SysUserSpRelation query) {
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null && query != null && query.getParams() != null && query.getParams().get("pageNum") != null) {
pageNum = Integer.parseInt(query.getParams().get("pageNum").toString());
}
if (pageSize == null && query != null && query.getParams() != null && query.getParams().get("pageSize") != null) {
pageSize = Integer.parseInt(query.getParams().get("pageSize").toString());
}
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<SysUserSpRelation> pageResult = sysUserSpRelationService.page(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<SysUserSpRelation> get(@PathVariable("id") Long id) {
return AjaxResult.success(sysUserSpRelationService.get(id));
}
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody SysUserSpRelation info) {
sysUserSpRelationService.add(info);
return AjaxResult.success();
}
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody SysUserSpRelation info) {
sysUserSpRelationService.edit(info);
return AjaxResult.success();
}
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
sysUserSpRelationService.remove(id);
return AjaxResult.success();
}
}
package com.bs.web.controller.relation;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.relation.SysUserStoreRelation;
import com.bs.common.core.page.TableDataInfo;
import com.bs.web.domain.vo.relation.SysUserStoreRelationVO;
import com.bs.web.service.relation.ISysUserStoreRelationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sp/relation/user-store")
@Tag(name = "用户-门店关联")
public class SysUserStoreRelationController extends BaseController {
@Resource
private ISysUserStoreRelationService sysUserStoreRelationService;
@PostMapping("/list")
@Operation(summary = "列表")
public AjaxResult<List<SysUserStoreRelation>> list(SysUserStoreRelation query) {
List<SysUserStoreRelation> list = sysUserStoreRelationService.list(query);
return AjaxResult.success(list);
}
@GetMapping(value = "/page")
@Operation(summary = "分页列表")
public TableDataInfo page(com.bs.web.domain.vo.relation.SysUserStoreRelationQueryReq query) {
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
IPage<SysUserStoreRelationVO> pageResult = sysUserStoreRelationService.pageCustom(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<SysUserStoreRelation> get(@PathVariable("id") Long id) {
return AjaxResult.success(sysUserStoreRelationService.get(id));
}
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody SysUserStoreRelation info) {
sysUserStoreRelationService.add(info);
return AjaxResult.success();
}
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody SysUserStoreRelation info) {
sysUserStoreRelationService.edit(info);
return AjaxResult.success();
}
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
sysUserStoreRelationService.remove(id);
return AjaxResult.success();
}
}
package com.bs.web.controller.role;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.role.SpRole;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.enums.OperatorType;
import com.bs.web.service.role.ISpRoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sp/role")
@Tag(name = "服务商角色")
public class SpRoleController extends BaseController {
@Resource
private ISpRoleService spRoleService;
@PostMapping("/list")
@Operation(summary = "列表")
public AjaxResult<List<SpRole>> list(SpRole query) {
List<SpRole> list = spRoleService.list(query);
return AjaxResult.success(list);
}
@RequestMapping(value = "/page", method = {RequestMethod.GET, RequestMethod.POST})
@Operation(summary = "分页列表")
public TableDataInfo page(@RequestBody(required = false) SpRole query) {
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null && query != null && query.getParams() != null && query.getParams().get("pageNum") != null) {
pageNum = Integer.parseInt(query.getParams().get("pageNum").toString());
}
if (pageSize == null && query != null && query.getParams() != null && query.getParams().get("pageSize") != null) {
pageSize = Integer.parseInt(query.getParams().get("pageSize").toString());
}
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<SpRole> pageResult = spRoleService.page(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<SpRole> get(@PathVariable("id") Long id) {
return AjaxResult.success(spRoleService.get(id));
}
@Log(title = "服务商角色新增", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody SpRole info) {
spRoleService.add(info);
return AjaxResult.success();
}
@Log(title = "服务商角色编辑", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody SpRole info) {
spRoleService.edit(info);
return AjaxResult.success();
}
@Log(title = "服务商角色删除", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
spRoleService.remove(id);
return AjaxResult.success();
}
}
package com.bs.web.controller.sp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.sp.SpInfo;
import com.bs.common.core.page.PageDomain;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.core.page.TableSupport;
import com.bs.common.enums.BusinessType;
import com.bs.common.enums.OperatorType;
import com.bs.web.service.sp.ISpInfoService;
import com.bs.common.core.domain.entity.store.BusinessStore;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sp/info")
@Tag(name = "服务商信息")
public class SpInfoController extends BaseController {
@Resource
private ISpInfoService spInfoService;
@PostMapping("/list")
@Operation(summary = "列表")
public AjaxResult<List<SpInfo>> list(SpInfo query) {
List<SpInfo> list = spInfoService.list(query);
return AjaxResult.success(list);
}
@GetMapping(value = "/page")
@Operation(summary = "分页列表")
public TableDataInfo page(SpInfo query) {
com.bs.common.core.page.PageDomain pageDomain = com.bs.common.core.page.TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null && query != null && query.getParams() != null && query.getParams().get("pageNum") != null) {
pageNum = Integer.parseInt(query.getParams().get("pageNum").toString());
}
if (pageSize == null && query != null && query.getParams() != null && query.getParams().get("pageSize") != null) {
pageSize = Integer.parseInt(query.getParams().get("pageSize").toString());
}
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<SpInfo> pageResult = spInfoService.page(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<SpInfo> get(@PathVariable("id") Long id) {
return AjaxResult.success(spInfoService.get(id));
}
@Log(title = "服务商信息", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody @Validated SpInfo info, BindingResult br) {
if (br.hasErrors()) {
return AjaxResult.error(br.getFieldError().getDefaultMessage());
}
spInfoService.add(info);
return AjaxResult.success();
}
@Log(title = "服务商信息", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody @Validated SpInfo info, BindingResult br) {
if (br.hasErrors()) {
return AjaxResult.error(br.getFieldError().getDefaultMessage());
}
spInfoService.edit(info);
return AjaxResult.success();
}
@Log(title = "服务商信息", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
spInfoService.remove(id);
return AjaxResult.success();
}
@GetMapping(value = "/storeInfo/list/{spCode}")
@Operation(summary = "根据服务商编码查询关联的门店分页列表")
public TableDataInfo<List<BusinessStore>> selectStoreListBySpCode(@PathVariable("spCode") String spCode) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> pageResult = spInfoService.selectStoreListBySpCodePage(spCode, pageNum, pageSize);
TableDataInfo<List<BusinessStore>> rspData = new TableDataInfo<>();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
}
package com.bs.web.controller.sp;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bs.common.annotation.Log;
import com.bs.common.constant.HttpStatus;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.PageDomain;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.core.page.TableSupport;
import com.bs.common.enums.BusinessType;
import com.bs.common.enums.OperatorType;
import com.bs.web.domain.vo.sp.SpUserCreateReq;
import com.bs.web.domain.vo.sp.SpUserListReq;
import com.bs.web.domain.vo.sp.SpUserUpdateReq;
import com.bs.web.domain.vo.sp.SpUserBatchUpdateReq;
import com.bs.web.domain.vo.sp.SpUserVo;
import com.bs.web.service.sp.ISpInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/sp/user")
@Tag(name = "服务商用户管理")
public class SpUserController extends BaseController {
@Resource
private ISpInfoService spInfoService;
@Log(title = "服务商用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@Operation(summary = "新增服务商用户")
public AjaxResult<Long> add(@RequestBody @Validated SpUserCreateReq req) {
return AjaxResult.success(spInfoService.addSpUser(req));
}
@Log(title = "服务商用户管理", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/edit")
@Operation(summary = "设置服务商用户")
public AjaxResult edit(@RequestBody @Validated SpUserUpdateReq req) {
spInfoService.editSpUser(req);
return AjaxResult.success();
}
@Log(title = "服务商用户管理", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
@PostMapping("/editBatch")
@Operation(summary = "批量设置服务商用户")
public AjaxResult editBatch(@RequestBody @Validated SpUserBatchUpdateReq req) {
spInfoService.editBatchSpUser(req);
return AjaxResult.success();
}
@GetMapping(value = "/list")
@Operation(summary = "查询服务商用户列表")
public TableDataInfo<List<SpUserVo>> list(SpUserListReq req) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
IPage<SpUserVo> pageResult = spInfoService.selectSpUserPage(req, pageNum, pageSize);
TableDataInfo<List<SpUserVo>> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@GetMapping("/checkPhone")
@Operation(summary = "服务商员工手机号重复校验")
public AjaxResult<Boolean> checkPhone(@RequestParam(value = "phone", required = true) String phone, @RequestParam(value = "userName", required = false) String userName) {
if (StringUtils.isEmpty(phone)) {
return AjaxResult.error("手机号不能为空");
}
return AjaxResult.success(spInfoService.checkSpUserPhone(phone, userName));
}
@Log(title = "服务商用户管理", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
@PostMapping("/delete/{userId}")
@Operation(summary = "删除服务商用户")
public AjaxResult<Boolean> remove(@PathVariable("userId") Long userId) {
return AjaxResult.success(spInfoService.deleteSpUser(userId));
}
@Log(title = "服务商用户管理", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
@PostMapping("/deleteBatch")
@Operation(summary = "批量删除服务商用户")
public AjaxResult<Boolean> removeBatch(@RequestBody List<Long> userIds) {
return AjaxResult.success(spInfoService.deleteBatchSpUser(userIds));
}
}
package com.bs.web.controller.store;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.domain.entity.store.BusinessStore;
import com.bs.common.core.page.PageDomain;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.core.page.TableSupport;
import com.bs.web.service.store.IBusinessStoreService;
import com.bs.web.domain.vo.store.BusinessStoreCreateReq;
import com.bs.web.domain.vo.store.BusinessStoreUpdateReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import com.bs.common.core.domain.entity.sp.SpInfo;
@RestController
@RequestMapping("/sp/store")
@Tag(name = "门店信息")
public class BusinessStoreController extends BaseController {
@Resource
private IBusinessStoreService businessStoreService;
@PostMapping("/spInfo/list/{storeCode}")
@Operation(summary = "根据门店编码查询关联的服务商分页列表")
public TableDataInfo selectSpListByStoreCode(@PathVariable("storeCode") String storeCode) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
IPage<SpInfo> pageResult = businessStoreService.selectSpListByStoreCodePage(storeCode, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@GetMapping("/list")
@Operation(summary = "列表")
public AjaxResult<List<BusinessStore>> list(BusinessStore query) {
List<BusinessStore> list = businessStoreService.list(query);
return AjaxResult.success(list);
}
@GetMapping(value = "/page")
@Operation(summary = "分页列表")
public TableDataInfo page(BusinessStore query) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (pageNum == null && query != null && query.getParams() != null && query.getParams().get("pageNum") != null) {
pageNum = Integer.parseInt(query.getParams().get("pageNum").toString());
}
if (pageSize == null && query != null && query.getParams() != null && query.getParams().get("pageSize") != null) {
pageSize = Integer.parseInt(query.getParams().get("pageSize").toString());
}
if (pageNum == null) pageNum = 1;
if (pageSize == null) pageSize = 10;
IPage<BusinessStore> pageResult = businessStoreService.page(query, pageNum, pageSize);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(com.bs.common.constant.HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(pageResult.getRecords());
rspData.setTotal(pageResult.getTotal());
return rspData;
}
@PostMapping("/{id}")
@Operation(summary = "详情")
public AjaxResult<BusinessStore> get(@PathVariable("id") Long id) {
return AjaxResult.success(businessStoreService.get(id));
}
@PostMapping("/code/{code}")
@Operation(summary = "根据编码查询详情")
public AjaxResult<BusinessStore> getByCode(@PathVariable("code") String code) {
return AjaxResult.success(businessStoreService.getByCode(code));
}
@PostMapping("/add")
@Operation(summary = "新增")
public AjaxResult add(@RequestBody @Validated BusinessStoreCreateReq req, BindingResult br) {
if (br.hasErrors()) {
return AjaxResult.error(br.getFieldError().getDefaultMessage());
}
return AjaxResult.success(businessStoreService.add(req));
}
@PostMapping("/edit")
@Operation(summary = "编辑")
public AjaxResult edit(@RequestBody @Validated BusinessStoreUpdateReq req, BindingResult br) {
if (br.hasErrors()) {
return AjaxResult.error(br.getFieldError().getDefaultMessage());
}
businessStoreService.edit(req);
return AjaxResult.success();
}
@PostMapping("/delete/{id}")
@Operation(summary = "删除")
public AjaxResult remove(@PathVariable("id") Long id) {
businessStoreService.remove(id);
return AjaxResult.success();
}
@GetMapping("/import/template")
@Operation(summary = "导入模板下载")
public AjaxResult importStoreTemplateDownLode() {
return AjaxResult.success(businessStoreService.importStoreTemplateDownLode());
}
@GetMapping("/import")
@Operation(summary = "导入")
public AjaxResult importStore(@RequestParam("url") String url) {
// 参数校验
if (url == null || url.isEmpty()) {
return AjaxResult.error("导入文件URL不能为空");
}
return AjaxResult.success(businessStoreService.importStore(url));
}
@GetMapping("/import/progress/{importId}")
@Operation(summary = "获取导入进度")
public AjaxResult getImportProgress(@PathVariable("importId") String importId) {
return AjaxResult.success(businessStoreService.getImportProgress(importId));
}
}
...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@FeignClient(name = "linkwe-file", contextId = "AuthFileFeignClient", path = "/file") @FeignClient(name = "bs-fileservice", contextId = "AuthFileFeignClient", path = "/fileservice")
public interface FileFeignClient { public interface FileFeignClient {
/** /**
* 文件上传 * 文件上传
......
package com.bs.web.mapper.relation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.common.core.domain.entity.relation.SpStoreRelation;
public interface SpStoreRelationMapper extends BaseMapper<SpStoreRelation> {
}
package com.bs.web.mapper.relation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.common.core.domain.entity.relation.SysUserSpRelation;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface SysUserSpRelationMapper extends BaseMapper<SysUserSpRelation> {
/**
* 统计每个服务商下的店长数量(满足三个条件:用户未删除、门店关联存在且未删除、服务商关联存在且未删除)
*
* @param spCodes 服务商编码列表
* @param roleCode 角色编码
* @param storeCode 门店编码
* @return List<Map<String, Object>>,每个 map 包含 sp_code 和 user_count
*/
@MapKey("sp_code")
List<Map<String, Object>> countStoreManagersBySpCode(@Param("spCodes") List<String> spCodes, @Param("roleCode") String roleCode, @Param("storeCode") String storeCode);
/**
* 统计指定服务商下各个门店的成员数量(满足三个条件:用户未删除、门店关联存在且未删除、服务商关联存在且未删除、指定角色)
*
* @param spCode 服务商编码
* @param storeCodes 门店编码列表
* @param roleCode 角色编码
* @return List<Map<String, Object>>,每个 map 包含 store_code 和 user_count
*/
@MapKey("store_code")
List<Map<String, Object>> countUsersBySpCodeAndStoreCodes(@Param("spCode") String spCode, @Param("storeCodes") List<String> storeCodes, @Param("roleCode") String roleCode);
}
package com.bs.web.mapper.relation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bs.common.core.domain.entity.relation.SysUserStoreRelation;
import com.bs.web.domain.vo.relation.SysUserStoreRelationQueryReq;
import com.bs.web.domain.vo.relation.SysUserStoreRelationVO;
import org.apache.ibatis.annotations.Param;
public interface SysUserStoreRelationMapper extends BaseMapper<SysUserStoreRelation> {
IPage<SysUserStoreRelationVO> selectUserStoreRelationPage(
@Param("page") IPage<SysUserStoreRelationVO> page,
@Param("req") SysUserStoreRelationQueryReq req);
}
package com.bs.web.mapper.role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.common.core.domain.entity.role.SpRole;
public interface SpRoleMapper extends BaseMapper<SpRole> {
}
package com.bs.web.mapper.sp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.common.core.domain.entity.sp.SpInfo;
import com.bs.web.domain.vo.sp.SpUserVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SpInfoMapper extends BaseMapper<SpInfo> {
/**
* 查询服务商用户列表
* @param spId 服务商ID
* @param keyword 关键词(姓名或手机号)
* @param spRoleCode 角色编码
* @param storeCode 门店编码
* @return 用户列表
*/
List<SpUserVo> selectSpUserList(@Param("spId") Long spId, @Param("keyword") String keyword, @Param("spRoleCode") String spRoleCode, @Param("storeCode") String storeCode);
/**
* 查询服务商用户分页列表
* @param page 分页对象
* @param spId 服务商ID
* @param keyword 关键词(姓名或手机号)
* @param spRoleCode 角色编码
* @param storeCode 门店编码
* @return 用户分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpUserVo> selectSpUserList(com.baomidou.mybatisplus.core.metadata.IPage<SpUserVo> page, @Param("spId") Long spId, @Param("keyword") String keyword, @Param("spRoleCode") String spRoleCode, @Param("storeCode") String storeCode);
}
package com.bs.web.mapper.store;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.common.core.domain.entity.store.BusinessStore;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BusinessStoreMapper extends BaseMapper<BusinessStore> {
/**
* 根据服务商编码查询关联的门店列表
* @param spCode 服务商编码
* @param storeName 门店名称(模糊搜索)
* @return 门店列表
*/
List<BusinessStore> selectStoreListBySpId(@Param("spCode") String spCode, @Param("storeName") String storeName);
/**
* 根据服务商编码分页查询关联的门店列表
* @param page 分页参数
* @param spCode 服务商编码
* @param storeName 门店名称(模糊搜索)
* @return 门店分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> selectStoreListBySpIdPage(com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> page, @Param("spCode") String spCode, @Param("storeName") String storeName);
}
package com.bs.web.service.relation;
import com.bs.common.core.domain.entity.relation.SpStoreRelation;
import com.bs.common.core.domain.entity.store.BusinessStore;
import com.bs.web.domain.vo.sp.SpStoreRelationMaintainReq;
import java.util.List;
/**
* 服务商-门店关联服务接口
* 定义关联关系的基础增删改查方法
*/
public interface ISpStoreRelationService {
/**
* 列表查询
*/
List<SpStoreRelation> list(SpStoreRelation query);
/**
* 分页列表查询
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpStoreRelation> page(SpStoreRelation query, Integer pageNum, Integer pageSize);
/**
* 详情查询
*/
SpStoreRelation get(Long id);
/**
* 新增关联
*/
void add(SpStoreRelation info);
/**
* 编辑关联
*/
void edit(SpStoreRelation info);
/**
* 删除关联
*/
void remove(Long id);
/**
* 根据门店编码查询未删除的关联列表,并确保服务商信息未删除
*/
List<SpStoreRelation> listByStoreCodeActive(String storeCode);
/**
* 维护服务商关联门店关系
* @param req 请求参数
* @return 是否成功
*/
Boolean maintainRelation(SpStoreRelationMaintainReq req);
/**
* 查询指定服务商关联的所有门店列表
* @param spId 服务商ID
* @param storeName 门店名称(模糊搜索)
* @return 门店列表
*/
List<BusinessStore> getStoreListBySpId(Long spId, String storeName);
/**
* 分页查询指定服务商关联的所有门店列表
* @param spId 服务商ID
* @param storeName 门店名称(模糊搜索)
* @param pageNum 页码
* @param pageSize 每页大小
* @return 门店分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> getStoreListBySpIdPage(Long spId, String storeName, Integer pageNum, Integer pageSize);
}
package com.bs.web.service.relation;
import com.bs.common.core.domain.entity.relation.SysUserSpRelation;
import java.util.List;
/**
* 用户-服务商关联服务接口
* 定义关联关系的基础增删改查方法
*/
public interface ISysUserSpRelationService {
/**
* 列表查询
*/
List<SysUserSpRelation> list(SysUserSpRelation query);
/**
* 分页查询
*/
com.baomidou.mybatisplus.core.metadata.IPage<SysUserSpRelation> page(SysUserSpRelation query, Integer pageNum, Integer pageSize);
/**
* 详情查询
*/
SysUserSpRelation get(Long id);
/**
* 新增关联
*/
void add(SysUserSpRelation info);
/**
* 编辑关联
*/
void edit(SysUserSpRelation info);
/**
* 删除关联
*/
void remove(Long id);
}
package com.bs.web.service.relation;
import com.bs.common.core.domain.entity.relation.SysUserStoreRelation;
import com.bs.web.domain.vo.relation.SysUserStoreRelationQueryReq;
import com.bs.web.domain.vo.relation.SysUserStoreRelationVO;
import java.util.List;
/**
* 用户-门店关联服务接口
* 定义关联关系的基础增删改查方法
*/
public interface ISysUserStoreRelationService {
/**
* 列表查询
*/
List<SysUserStoreRelation> list(SysUserStoreRelation query);
/**
* 分页查询
*/
com.baomidou.mybatisplus.core.metadata.IPage<SysUserStoreRelation> page(SysUserStoreRelation query, Integer pageNum, Integer pageSize);
/**
* 自定义分页查询(带门店名称和关联表排序)
*/
com.baomidou.mybatisplus.core.metadata.IPage<SysUserStoreRelationVO> pageCustom(SysUserStoreRelationQueryReq req, Integer pageNum, Integer pageSize);
/**
* 详情查询
*/
SysUserStoreRelation get(Long id);
/**
* 新增关联
*/
void add(SysUserStoreRelation info);
/**
* 编辑关联
*/
void edit(SysUserStoreRelation info);
/**
* 删除关联
*/
void remove(Long id);
}
package com.bs.web.service.relation.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.core.domain.entity.relation.SysUserSpRelation;
import com.bs.web.mapper.relation.SysUserSpRelationMapper;
import com.bs.web.service.relation.ISysUserSpRelationService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户-服务商关联服务实现
* 负责关联关系的基础增删改查
*/
@Service
public class SysUserSpRelationServiceImpl implements ISysUserSpRelationService {
@Resource
private SysUserSpRelationMapper sysUserSpRelationMapper;
/**
* 列表查询
*/
@Override
public List<SysUserSpRelation> list(SysUserSpRelation query) {
return sysUserSpRelationMapper.selectList(new LambdaQueryWrapper<>());
}
/**
* 分页查询
*/
@Override
public com.baomidou.mybatisplus.core.metadata.IPage<SysUserSpRelation> page(SysUserSpRelation query, Integer pageNum, Integer pageSize) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUserSpRelation> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
return sysUserSpRelationMapper.selectPage(page, new LambdaQueryWrapper<>());
}
/**
* 详情查询
*/
@Override
public SysUserSpRelation get(Long id) {
return sysUserSpRelationMapper.selectById(id);
}
/**
* 新增关联
*/
@Override
public void add(SysUserSpRelation info) {
sysUserSpRelationMapper.insert(info);
}
/**
* 编辑关联
*/
@Override
public void edit(SysUserSpRelation info) {
sysUserSpRelationMapper.updateById(info);
}
/**
* 删除关联
*/
@Override
public void remove(Long id) {
sysUserSpRelationMapper.deleteById(id);
}
}
package com.bs.web.service.relation.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.core.domain.entity.relation.SysUserStoreRelation;
import com.bs.web.domain.vo.relation.SysUserStoreRelationQueryReq;
import com.bs.web.domain.vo.relation.SysUserStoreRelationVO;
import com.bs.web.mapper.relation.SysUserStoreRelationMapper;
import com.bs.web.service.relation.ISysUserStoreRelationService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户-门店关联服务实现
* 负责关联关系的基础增删改查
*/
@Service
public class SysUserStoreRelationServiceImpl implements ISysUserStoreRelationService {
@Resource
private SysUserStoreRelationMapper sysUserStoreRelationMapper;
/**
* 列表查询
*/
@Override
public List<SysUserStoreRelation> list(SysUserStoreRelation query) {
return sysUserStoreRelationMapper.selectList(new LambdaQueryWrapper<>());
}
/**
* 分页查询
*/
@Override
public com.baomidou.mybatisplus.core.metadata.IPage<SysUserStoreRelation> page(SysUserStoreRelation query, Integer pageNum, Integer pageSize) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUserStoreRelation> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
return sysUserStoreRelationMapper.selectPage(page, new LambdaQueryWrapper<>());
}
/**
* 自定义分页查询
*/
@Override
public com.baomidou.mybatisplus.core.metadata.IPage<SysUserStoreRelationVO> pageCustom(SysUserStoreRelationQueryReq req, Integer pageNum, Integer pageSize) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SysUserStoreRelationVO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
return sysUserStoreRelationMapper.selectUserStoreRelationPage(page, req);
}
/**
* 详情查询
*/
@Override
public SysUserStoreRelation get(Long id) {
return sysUserStoreRelationMapper.selectById(id);
}
/**
* 新增关联
*/
@Override
public void add(SysUserStoreRelation info) {
sysUserStoreRelationMapper.insert(info);
}
/**
* 编辑关联
*/
@Override
public void edit(SysUserStoreRelation info) {
sysUserStoreRelationMapper.updateById(info);
}
/**
* 删除关联
*/
@Override
public void remove(Long id) {
sysUserStoreRelationMapper.deleteById(id);
}
}
package com.bs.web.service.role;
import com.bs.common.core.domain.entity.role.SpRole;
import java.util.List;
/**
* 服务商角色服务接口
* 定义服务商角色的基础增删改查方法
*/
public interface ISpRoleService {
/**
* 列表查询
* @param query 查询条件
* @return 角色列表
*/
List<SpRole> list(SpRole query);
/**
* 分页查询
* @param query 查询条件
* @param pageNum 页码
* @param pageSize 每页条数
* @return 角色分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpRole> page(SpRole query, Integer pageNum, Integer pageSize);
/**
* 详情查询
* @param id 角色ID
* @return 角色详情
*/
SpRole get(Long id);
/**
* 新增角色
* @param info 角色信息
*/
void add(SpRole info);
/**
* 编辑角色
* @param info 角色信息
*/
void edit(SpRole info);
/**
* 删除角色
* @param id 角色ID
*/
void remove(Long id);
}
package com.bs.web.service.role.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bs.common.core.domain.entity.role.SpRole;
import com.bs.web.mapper.role.SpRoleMapper;
import com.bs.web.service.role.ISpRoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务商角色服务实现
* 负责角色的基础增删改查
*/
@Service
public class SpRoleServiceImpl implements ISpRoleService {
@Resource
private SpRoleMapper spRoleMapper;
/**
* 列表查询
*/
@Override
public List<SpRole> list(SpRole query) {
return spRoleMapper.selectList(new LambdaQueryWrapper<>());
}
/**
* 分页查询
*/
@Override
public com.baomidou.mybatisplus.core.metadata.IPage<SpRole> page(SpRole query, Integer pageNum, Integer pageSize) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<SpRole> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
return spRoleMapper.selectPage(page, new LambdaQueryWrapper<>());
}
/**
* 详情查询
*/
@Override
public SpRole get(Long id) {
return spRoleMapper.selectById(id);
}
/**
* 新增角色
*/
@Override
public void add(SpRole info) {
spRoleMapper.insert(info);
}
/**
* 编辑角色
*/
@Override
public void edit(SpRole info) {
spRoleMapper.updateById(info);
}
/**
* 删除角色
*/
@Override
public void remove(Long id) {
spRoleMapper.deleteById(id);
}
}
package com.bs.web.service.sp;
import com.bs.common.core.domain.entity.sp.SpInfo;
import com.bs.common.core.domain.entity.store.BusinessStore;
import com.bs.web.domain.vo.sp.SpUserCreateReq;
import com.bs.web.domain.vo.sp.SpUserListReq;
import com.bs.web.domain.vo.sp.SpUserUpdateReq;
import com.bs.web.domain.vo.sp.SpUserBatchUpdateReq;
import com.bs.web.domain.vo.sp.SpUserVo;
import java.util.List;
/**
* 服务商信息服务接口
* 定义服务商信息的基础增删改查方法
*/
public interface ISpInfoService {
/**
* 列表查询
* @param query 查询条件
* @return 服务商列表
*/
List<SpInfo> list(SpInfo query);
/**
* 分页查询
* @param query 查询条件
* @param pageNum 页码
* @param pageSize 每页条数
* @return 服务商分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpInfo> page(SpInfo query, Integer pageNum, Integer pageSize);
/**
* 详情查询
* @param id 服务商ID
* @return 服务商详情
*/
SpInfo get(Long id);
/**
* 新增服务商
* @param info 服务商信息
*/
void add(SpInfo info);
/**
* 编辑服务商
* @param info 服务商信息
*/
void edit(SpInfo info);
/**
* 删除服务商
* @param id 服务商ID
*/
void remove(Long id);
/**
* 新增服务商用户
* @param req 请求参数
* @return 用户ID
*/
Long addSpUser(SpUserCreateReq req);
/**
* 编辑服务商用户
* @param req 请求参数
*/
void editSpUser(SpUserUpdateReq req);
/**
* 批量编辑服务商用户
* @param req 请求参数
*/
void editBatchSpUser(SpUserBatchUpdateReq req);
/**
* 查询服务商用户列表
* @param req 查询参数
* @return 用户列表
*/
List<SpUserVo> selectSpUserList(SpUserListReq req);
/**
* 查询服务商用户分页列表
* @param req 查询参数
* @param pageNum 页码
* @param pageSize 每页条数
* @return 用户分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpUserVo> selectSpUserPage(SpUserListReq req, Integer pageNum, Integer pageSize);
/**
* 校验服务商员工手机号是否重复
*
* @param phone 手机号
* @param userName
* @return true-不重复,false-重复
*/
Boolean checkSpUserPhone(String phone, String userName);
/**
* 删除服务商用户
* @param userId 用户ID
* @return 是否成功
*/
Boolean deleteSpUser(Long userId);
/**
* 批量删除服务商用户
* @param userIds 用户ID列表
* @return 是否成功
*/
Boolean deleteBatchSpUser(List<Long> userIds);
/**
* 根据服务商编码查询关联的门店分页列表
* @param spCode 服务商编码
* @return 门店列表
*/
List<BusinessStore> selectStoreListBySpCode(String spCode);
/**
* 根据服务商编码查询关联的门店分页列表 (带原生分页)
* @param spCode 服务商编码
* @param pageNum 页码
* @param pageSize 每页条数
* @return 门店分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> selectStoreListBySpCodePage(String spCode, Integer pageNum, Integer pageSize);
}
package com.bs.web.service.store;
import com.bs.common.core.domain.entity.sp.SpInfo;
import com.bs.common.core.domain.entity.store.BusinessStore;
import com.bs.web.domain.vo.store.BusinessStoreCreateReq;
import com.bs.web.domain.vo.store.BusinessStoreUpdateReq;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.bs.web.domain.vo.store.BusinessStoreImportVo;
import java.util.Map;
/**
* 门店信息服务接口
* 定义门店的基础增删改查与查询方法
*/
public interface IBusinessStoreService {
/**
* 列表查询
* @param query 查询条件
* @return 门店列表
*/
List<BusinessStore> list(BusinessStore query);
/**
* 分页查询
* @param query 查询条件
* @param pageNum 页码
* @param pageSize 每页条数
* @return 门店分页列表
*/
com.baomidou.mybatisplus.core.metadata.IPage<BusinessStore> page(BusinessStore query, Integer pageNum, Integer pageSize);
/**
* 详情查询
* @param id 门店ID
* @return 门店详情
*/
BusinessStore get(Long id);
/**
* 根据门店编码查询门店
* @param storeCode 门店代码
* @return 门店详情
*/
BusinessStore getByCode(String storeCode);
/**
* 新增门店
* @param info 门店信息
*/
Long add(BusinessStore info);
/**
* 新增门店
* @param req 门店信息
* @return 门店ID
*/
Long add(BusinessStoreCreateReq req);
/**
* 编辑门店
* @param info 门店信息
*/
void edit(BusinessStore info);
/**
* 编辑门店
* @param req 门店信息
*/
void edit(BusinessStoreUpdateReq req);
/**
* 删除门店
* @param id 门店ID
*/
void remove(Long id);
/**
* 导入门店信息
* @param url 导入文件URL
* @return 导入任务ID
*/
String importStore(String url);
/**
* 获取导入进度
* @param importId 导入任务ID
* @return 进度信息
*/
Map<String, Object> getImportProgress(String importId);
/**
* 下载导入模板
* @return 导入模板URL
*/
String importStoreTemplateDownLode();
/**
* 根据门店编码查询关联的服务商列表
* @param storeCode 门店编码
* @return 服务商列表
*/
List<SpInfo> selectSpListByStoreCode(String storeCode);
/**
* 根据门店编码查询关联的服务商分页列表
* @param storeCode 门店编码
* @param pageNum 页码
* @param pageSize 每页数量
* @return 服务商分页
*/
com.baomidou.mybatisplus.core.metadata.IPage<SpInfo> selectSpListByStoreCodePage(String storeCode, Integer pageNum, Integer pageSize);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.relation.SpStoreRelationMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.relation.SysUserSpRelationMapper">
<!-- 统计每个服务商下的店长数量 -->
<select id="countStoreManagersBySpCode" resultType="java.util.HashMap">
SELECT
spr.sp_code,
COUNT(DISTINCT u.user_id) AS user_count
FROM sys_user_sp_relation spr
INNER JOIN sys_user u
ON spr.user_id = u.user_id AND u.del_flag = 0
INNER JOIN sys_user_store_relation usr
ON u.user_id = usr.user_id AND usr.del_flag = 0
WHERE spr.del_flag = 0
AND spr.role_code = #{roleCode}
<if test="spCodes != null and spCodes.size() > 0">
AND spr.sp_code IN
<foreach collection="spCodes" item="spCode" open="(" separator="," close=")">
#{spCode}
</foreach>
</if>
<if test="storeCode != null and storeCode != ''">
AND usr.store_code = #{storeCode}
</if>
GROUP BY spr.sp_code
</select>
<!-- 统计指定服务商下各个门店的成员数量 -->
<select id="countUsersBySpCodeAndStoreCodes" resultType="java.util.HashMap">
SELECT
usr.store_code,
COUNT(DISTINCT u.user_id) AS user_count
FROM sys_user_sp_relation spr
INNER JOIN sys_user u
ON spr.user_id = u.user_id AND u.del_flag = 0
INNER JOIN sys_user_store_relation usr
ON u.user_id = usr.user_id AND usr.del_flag = 0
WHERE spr.del_flag = 0
AND spr.sp_code = #{spCode}
<if test="roleCode != null and roleCode != ''">
AND spr.role_code = #{roleCode}
</if>
<if test="storeCodes != null and storeCodes.size() > 0">
AND usr.store_code IN
<foreach collection="storeCodes" item="storeCode" open="(" separator="," close=")">
#{storeCode}
</foreach>
</if>
GROUP BY usr.store_code
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.relation.SysUserStoreRelationMapper">
<select id="selectUserStoreRelationPage" resultType="com.bs.web.domain.vo.relation.SysUserStoreRelationVO">
SELECT
r.*,
s.store_name
FROM sys_user_store_relation r
LEFT JOIN business_store s ON r.store_code = s.store_code AND s.del_flag = 0
WHERE r.del_flag = 0
<if test="req.userId != null">
AND r.user_id = #{req.userId}
</if>
<if test="req.storeName != null and req.storeName != ''">
AND s.store_name LIKE concat('%', #{req.storeName}, '%')
</if>
ORDER BY r.id ASC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.role.SpRoleMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.sp.SpInfoMapper">
<select id="selectSpUserList" resultType="com.bs.web.domain.vo.sp.SpUserVo">
SELECT
u.user_id, u.dept_id, u.user_name, u.nick_name, u.user_type, u.email, u.phone_number, u.sex, u.avatar,
u.password, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.update_by,
u.update_time, u.remark,
sp.id AS spId, sp.sp_code, sp.sp_name,
sr.id AS spRoleId, sr.role_code AS spRoleCode, sr.role_name AS spRoleName
FROM sys_user u
INNER JOIN sys_user_sp_relation susr ON u.user_id = susr.user_id
INNER JOIN sp_info sp ON susr.sp_code = sp.sp_code
LEFT JOIN sp_role sr ON susr.role_code = sr.role_code
<if test="storeCode != null and storeCode != ''">
INNER JOIN sys_user_store_relation susr2 ON u.user_id = susr2.user_id
AND susr2.store_code = #{storeCode}
AND susr2.del_flag = 0
</if>
WHERE sp.id = #{spId}
AND u.del_flag = '0'
AND susr.del_flag = 0
<if test="keyword != null and keyword != ''">
AND (u.user_name LIKE concat('%', #{keyword}, '%') OR u.phone_number LIKE concat('%', #{keyword}, '%'))
</if>
<if test="spRoleCode != null and spRoleCode != ''">
AND sr.role_code = #{spRoleCode}
</if>
ORDER BY u.user_id ASC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.web.mapper.store.BusinessStoreMapper">
<select id="selectStoreListBySpId" resultType="com.bs.common.core.domain.entity.store.BusinessStore">
SELECT s.*
FROM business_store s
INNER JOIN sp_store_relation r ON s.store_code = r.store_code
WHERE r.sp_code = #{spCode}
AND r.del_flag = 0
AND s.del_flag = 0
<if test="storeName != null and storeName != ''">
AND s.store_name LIKE concat('%', #{storeName}, '%')
</if>
ORDER BY s.id DESC
</select>
<select id="selectStoreListBySpIdPage" resultType="com.bs.common.core.domain.entity.store.BusinessStore">
SELECT s.*
FROM business_store s
INNER JOIN sp_store_relation r ON s.store_code = r.store_code
WHERE r.sp_code = #{spCode}
AND r.del_flag = 0
AND s.del_flag = 0
<if test="storeName != null and storeName != ''">
AND s.store_name LIKE concat('%', #{storeName}, '%')
</if>
ORDER BY s.id DESC
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!