|
@@ -1,9 +1,11 @@
|
|
|
-package cn.newfeifan.mall.module.distri.controller.admin.sharelink;
|
|
|
+package cn.newfeifan.mall.module.distri.controller.app.sharelink;
|
|
|
|
|
|
+import cn.newfeifan.mall.module.distri.controller.app.sharelink.vo.*;
|
|
|
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;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
@@ -17,37 +19,36 @@ 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.sharelink.vo.*;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.sharelink.ShareLinkDO;
|
|
|
import cn.newfeifan.mall.module.distri.service.sharelink.ShareLinkService;
|
|
|
|
|
|
-@Tag(name = "管理后台 - 分享链接")
|
|
|
+@Tag(name = "用户 APP - 分享链接")
|
|
|
@RestController
|
|
|
@RequestMapping("/distri/share-link")
|
|
|
@Validated
|
|
|
-public class ShareLinkController {
|
|
|
+public class AppShareLinkController {
|
|
|
|
|
|
@Resource
|
|
|
private ShareLinkService shareLinkService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建分享链接")
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:create')")
|
|
|
- public CommonResult<Long> createShareLink(@Valid @RequestBody ShareLinkSaveReqVO createReqVO) {
|
|
|
+ public CommonResult<Long> createShareLink(@Valid @RequestBody AppShareLinkSaveReqVO createReqVO) {
|
|
|
return success(shareLinkService.createShareLink(createReqVO));
|
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新分享链接")
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:update')")
|
|
|
- public CommonResult<Boolean> updateShareLink(@Valid @RequestBody ShareLinkSaveReqVO updateReqVO) {
|
|
|
+ public CommonResult<Boolean> updateShareLink(@Valid @RequestBody AppShareLinkSaveReqVO updateReqVO) {
|
|
|
shareLinkService.updateShareLink(updateReqVO);
|
|
|
return success(true);
|
|
|
}
|
|
@@ -55,40 +56,37 @@ public class ShareLinkController {
|
|
|
@DeleteMapping("/delete")
|
|
|
@Operation(summary = "删除分享链接")
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:delete')")
|
|
|
public CommonResult<Boolean> deleteShareLink(@RequestParam("id") Long id) {
|
|
|
shareLinkService.deleteShareLink(id);
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/get")
|
|
|
+ @GetMapping("/getShareLink")
|
|
|
@Operation(summary = "获得分享链接")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:query')")
|
|
|
- public CommonResult<ShareLinkRespVO> getShareLink(@RequestParam("id") Long id) {
|
|
|
- ShareLinkDO shareLink = shareLinkService.getShareLink(id);
|
|
|
- return success(BeanUtils.toBean(shareLink, ShareLinkRespVO.class));
|
|
|
+ public CommonResult<AppShareLinkResultVO> getShareLink(AppShareLinkReqVO appShareLinkReqVO) {
|
|
|
+ String id = shareLinkService.getShareLink(appShareLinkReqVO);
|
|
|
+ return success(AppShareLinkResultVO.builder()
|
|
|
+ .linkId(id).build()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得分享链接分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:query')")
|
|
|
- public CommonResult<PageResult<ShareLinkRespVO>> getShareLinkPage(@Valid ShareLinkPageReqVO pageReqVO) {
|
|
|
+ public CommonResult<PageResult<AppShareLinkRespVO>> getShareLinkPage(@Valid AppShareLinkPageReqVO pageReqVO) {
|
|
|
PageResult<ShareLinkDO> pageResult = shareLinkService.getShareLinkPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, ShareLinkRespVO.class));
|
|
|
+ return success(BeanUtils.toBean(pageResult, AppShareLinkRespVO.class));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
|
@Operation(summary = "导出分享链接 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('distri:share-link:export')")
|
|
|
@OperateLog(type = EXPORT)
|
|
|
- public void exportShareLinkExcel(@Valid ShareLinkPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
+ public void exportShareLinkExcel(@Valid AppShareLinkPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<ShareLinkDO> list = shareLinkService.getShareLinkPage(pageReqVO).getList();
|
|
|
// 导出 Excel
|
|
|
- ExcelUtils.write(response, "分享链接.xls", "数据", ShareLinkRespVO.class,
|
|
|
- BeanUtils.toBean(list, ShareLinkRespVO.class));
|
|
|
+ ExcelUtils.write(response, "分享链接.xls", "数据", AppShareLinkRespVO.class,
|
|
|
+ BeanUtils.toBean(list, AppShareLinkRespVO.class));
|
|
|
}
|
|
|
|
|
|
}
|