|
@@ -1,7 +1,9 @@
|
|
|
package cn.newfeifan.mall.module.distri.controller.admin.sharepath;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -18,11 +20,13 @@ import cn.newfeifan.mall.framework.common.pojo.PageParam;
|
|
|
import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
|
import cn.newfeifan.mall.framework.common.pojo.CommonResult;
|
|
|
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
|
|
|
+
|
|
|
import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
|
|
|
+
|
|
|
import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
|
import cn.newfeifan.mall.module.distri.controller.admin.sharepath.vo.*;
|
|
@@ -41,10 +45,28 @@ public class SharePathController {
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建分销用户关系")
|
|
|
@PreAuthorize("@ss.hasPermission('distri:share-path:create')")
|
|
|
- public CommonResult<Long> createSharePath(@Valid @RequestBody SharePathSaveReqVO createReqVO) {
|
|
|
- return success(sharePathService.createSharePath(createReqVO));
|
|
|
+ public CommonResult<Boolean> createSharePath(@Valid @RequestBody SharePathSaveReqVO createReqVO) {
|
|
|
+ sharePathService.createSharePathByUserId(createReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getTree")
|
|
|
+ @Operation(summary = "获取分销人员关系树")
|
|
|
+ @PreAuthorize("@ss.hasPermission('distri:share-path:query')")
|
|
|
+ public CommonResult<SharePathRespVO> getTree() {
|
|
|
+ TreeNode sharePath = sharePathService.getTree();
|
|
|
+ return success(BeanUtils.toBean(sharePath, SharePathRespVO.class));
|
|
|
}
|
|
|
|
|
|
+ @PutMapping("/transference_rela")
|
|
|
+ @Operation(summary = "转让分销关系")
|
|
|
+ @PreAuthorize("@ss.hasPermission('distri:share-path:update')")
|
|
|
+ public CommonResult<Boolean> transferenceRela(SharePathtransFerenceRelaReqVO sharePathtransFerenceRelaReqVO) {
|
|
|
+ sharePathService.transferenceRela(sharePathtransFerenceRelaReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新分销用户关系")
|
|
|
@PreAuthorize("@ss.hasPermission('distri:share-path:update')")
|
|
@@ -84,12 +106,12 @@ public class SharePathController {
|
|
|
@PreAuthorize("@ss.hasPermission('distri:share-path:export')")
|
|
|
@OperateLog(type = EXPORT)
|
|
|
public void exportSharePathExcel(@Valid SharePathPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<SharePathDO> list = sharePathService.getSharePathPage(pageReqVO).getList();
|
|
|
// 导出 Excel
|
|
|
ExcelUtils.write(response, "分销用户关系.xls", "数据", SharePathRespVO.class,
|
|
|
- BeanUtils.toBean(list, SharePathRespVO.class));
|
|
|
+ BeanUtils.toBean(list, SharePathRespVO.class));
|
|
|
}
|
|
|
|
|
|
}
|