From cbc564a7088503ad8cc7af4e1d2ba417d061e615 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期五, 30 六月 2023 11:35:05 +0800
Subject: [PATCH] 联调bug和统计完善

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java |  285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 273 insertions(+), 12 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
index 2524734..f7c4ff3 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
@@ -2,21 +2,29 @@
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.system.api.domain.dto.MgtBaseGetDto;
 import com.ruoyi.system.api.domain.dto.MgtPageDto;
+import com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo;
 import com.ruoyi.system.domain.dto.*;
 import com.ruoyi.system.domain.vo.*;
 import com.ruoyi.system.service.config.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.List;
+
+import static com.ruoyi.common.core.web.domain.AjaxResult.success;
 
 /**
  * @ClassName MgtConfigController
@@ -48,8 +56,46 @@
     @Resource
     private QuickEntryService quickEntryService;
 
+    @Resource
+    private AdvertService advertService;
+
+    @Resource
+    private ActivenessService activenessService;
+
+    @Resource
+    private SysClassificationService sysClassificationService;
+
+    @Resource
+    private SysTagService sysTagService;
+
+    @Resource
+    private ArticleService articleService;
+
+    @Resource
+    private RegionService regionService;
+
+    @Resource
+    private RecommendCooperationService recommendCooperationService;
+
+
+    @RequestMapping(value = "/getCustomConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "获取单个配置")
+    public R<MgtCustomConfigVo> getCustomConfig(@RequestBody MgtCustomConfigDto mgtCustomConfigDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtCustomConfigDto.setUserId(userId);
+        MgtCustomConfigVo mgtCustomConfigVo = customConfigService.getCustomConfig(mgtCustomConfigDto);
+        return R.ok(mgtCustomConfigVo);
+    }
+
+    @RequestMapping(value = "/getActivenessList", method = RequestMethod.POST)
+    @ApiOperation(value = "获取活跃度")
+    public R<List<String>> getActivenessList() {
+        List<String> activenessList = activenessService.getActivenessList();
+        return R.ok(activenessList);
+    }
 
     @RequestMapping(value = "/editCooperation", method = RequestMethod.POST)
+    @Log(title = "申请合作管理", businessType = BusinessType.UPDATE,operContent = "修改申请合作")
     @ApiOperation(value = "修改申请合作")
     public R editCooperation(@RequestBody MgtCooperationEditDto mgtCooperationEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -59,6 +105,7 @@
     }
 
     @RequestMapping(value = "/editServiceMobile", method = RequestMethod.POST)
+    @Log(title = "客服电话管理", businessType = BusinessType.UPDATE,operContent = "修改客服电话")
     @ApiOperation(value = "修改客服电话")
     public R editServiceMobile(@RequestBody MgtServiceMobileEditDto mgtServiceMobileEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -68,6 +115,7 @@
     }
 
     @RequestMapping(value = "/editAgreement", method = RequestMethod.POST)
+    @Log(title = "协议管理", businessType = BusinessType.UPDATE,operContent = "修改协议")
     @ApiOperation(value = "修改协议")
     public R editAgreement(@RequestBody MgtAgreementEditDto mgtAgreementEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -77,6 +125,7 @@
     }
 
     @RequestMapping(value = "/editBanner", method = RequestMethod.POST)
+    @Log(title = "banner管理", businessType = BusinessType.UPDATE,operContent = "修改banner")
     @ApiOperation(value = "修改banner")
     public R editBanner(@RequestBody MgtBannerEditDto mgtBannerEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -107,6 +156,7 @@
     }
 
     @RequestMapping(value = "/deleteBanner", method = RequestMethod.POST)
+    @Log(title = "banner管理", businessType = BusinessType.DELETE,operContent = "删除banner")
     @ApiOperation(value = "删除banner")
     public R deleteBanner(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
         Long userId = SecurityUtils.getUserId();
@@ -128,6 +178,7 @@
     }
 
     @RequestMapping(value = "/editPop", method = RequestMethod.POST)
+    @Log(title = "弹窗管理", businessType = BusinessType.UPDATE,operContent = "修改弹窗广告")
     @ApiOperation(value = "修改弹窗广告")
     public R editPop(@RequestBody MgtPopEditDto mgtPopEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -146,6 +197,7 @@
     }
 
     @RequestMapping(value = "/deletePop", method = RequestMethod.POST)
+    @Log(title = "弹窗管理", businessType = BusinessType.DELETE,operContent = "删除弹窗广告")
     @ApiOperation(value = "删除弹窗广告")
     public R deletePop(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
         Long userId = SecurityUtils.getUserId();
@@ -167,6 +219,7 @@
     }
 
     @RequestMapping(value = "/editQuickEntry", method = RequestMethod.POST)
+    @Log(title = "快速入口管理", businessType = BusinessType.UPDATE,operContent = "修改快速入口")
     @ApiOperation(value = "修改快速入口")
     public R editQuickEntry(@RequestBody MgtQuickEntryEditDto mgtQuickEntryEditDto) {
         Long userId = SecurityUtils.getUserId();
@@ -185,6 +238,7 @@
     }
 
     @RequestMapping(value = "/deleteQuickEntry", method = RequestMethod.POST)
+    @Log(title = "快速入口管理", businessType = BusinessType.DELETE,operContent = "删除快速入口")
     @ApiOperation(value = "删除快速入口")
     public R deleteQuickEntry(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
         Long userId = SecurityUtils.getUserId();
@@ -193,31 +247,238 @@
         return R.ok();
     }
 
-    @RequestMapping(value = "/getCustomConfig", method = RequestMethod.POST)
-    @ApiOperation(value = "获取自定义设置")
-    public R<MgtCustomConfigVo> getCustomConfig() {
-        MgtCustomConfigVo mgtCustomConfigVo = customConfigService.getCustomConfig();
-        return R.ok(mgtCustomConfigVo);
+    @RequestMapping(value = "/getAllCustomConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "获取全部自定义设置")
+    public R<MgtAllCustomConfigVo> getAllCustomConfig() {
+        MgtAllCustomConfigVo mgtAllCustomConfigVo = customConfigService.getAllCustomConfig();
+        return R.ok(mgtAllCustomConfigVo);
     }
 
     @RequestMapping(value = "/editOtherConfig", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改其它设置")
     @ApiOperation(value = "修改其它设置")
-    public R editOtherConfig(@RequestBody MgtOtherConfigEditDto mgtOtherConfigEditDto) {
+    public R editOtherConfig(@Validated @RequestBody MgtOtherConfigEditDto mgtOtherConfigEditDto) {
         customConfigService.editOtherConfig(mgtOtherConfigEditDto);
         return R.ok();
     }
 
     @RequestMapping(value = "/editShopConfig", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改合作商配置")
     @ApiOperation(value = "修改合作商配置")
-    public R editShopConfig(@RequestBody MgtShopConfigEditDto mgtShopConfigEditDto) {
+    public R editShopConfig(@Validated @RequestBody MgtShopConfigEditDto mgtShopConfigEditDto) {
         customConfigService.editShopConfig(mgtShopConfigEditDto);
         return R.ok();
     }
 
     @RequestMapping(value = "/editMemberConfig", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改会员配置")
     @ApiOperation(value = "修改会员配置")
-    public R editMemberConfig(@RequestBody MgtMemberConfigEditDto mgtMemberConfigEditDto) {
+    public R editMemberConfig(@Validated @RequestBody MgtMemberConfigEditDto mgtMemberConfigEditDto) {
         customConfigService.editMemberConfig(mgtMemberConfigEditDto);
         return R.ok();
     }
+
+    @RequestMapping(value = "/editAdvert", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改广告配置")
+    @ApiOperation(value = "修改广告配置")
+    public R editAdvert(@Validated @RequestBody MgtAdvertEditDto mgtAdvertEditDto) {
+        mgtAdvertEditDto.setUserId(SecurityUtils.getUserId());
+        advertService.editMgtAdvert(mgtAdvertEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/editActiveness", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改活跃度")
+    @ApiOperation(value = "修改活跃度")
+    public R editActiveness(@RequestBody MgtActivenessEditDto mgtActivenessEditDto) {
+        mgtActivenessEditDto.setUserId(SecurityUtils.getUserId());
+        activenessService.editMgtActiveness(mgtActivenessEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/deleteActiveness", method = RequestMethod.POST)
+    @Log(title = "其它设置管理", businessType = BusinessType.DELETE,operContent = "删除活跃度")
+    @ApiOperation(value = "删除活跃度")
+    public R deleteMgtActiveness(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
+        mgtBaseGetDto.setUserId(SecurityUtils.getUserId());
+        activenessService.deleteMgtActiveness(mgtBaseGetDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/pageClassification", method = RequestMethod.POST)
+    @ApiOperation(value = "分页获取分类列表")
+    public R<Page<MgtClassificationPageVo>> pageClassification(@RequestBody MgtClassificationPageDto mgtClassificationPageDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtClassificationPageDto.setUserId(userId);
+        Page<MgtClassificationPageVo> page = new Page<>();
+        page.setSize(mgtClassificationPageDto.getPageSize());
+        page.setCurrent(mgtClassificationPageDto.getPageNum());
+        List<MgtClassificationPageVo> mgtClassificationPageVoList = sysClassificationService.pageClassification(page, mgtClassificationPageDto);
+        return R.ok(page.setRecords(mgtClassificationPageVoList));
+    }
+
+    @RequestMapping(value = "/editClassification", method = RequestMethod.POST)
+    @Log(title = "分类管理", businessType = BusinessType.UPDATE,operContent = "修改分类")
+    @ApiOperation(value = "修改分类")
+    public R editClassification(@RequestBody MgtClassificationEditDto mgtClassificationEditDto) {
+        mgtClassificationEditDto.setUserId(SecurityUtils.getUserId());
+        sysClassificationService.editClassification(mgtClassificationEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/deleteClassification", method = RequestMethod.POST)
+    @Log(title = "分类管理", businessType = BusinessType.DELETE,operContent = "删除分类")
+    @ApiOperation(value = "删除分类")
+    public R deleteClassification(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
+        mgtBaseGetDto.setUserId(SecurityUtils.getUserId());
+        sysClassificationService.deleteClassification(Long.valueOf(mgtBaseGetDto.getId()));
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/pageOperLog", method = RequestMethod.POST)
+    @ApiOperation(value = "分页获取操作日志")
+    public R<Page<MgtOperLogPageVo>> pageOperLog(@RequestBody MgtOperLogPageDto mgtOperLogPageDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtOperLogPageDto.setUserId(userId);
+        Page<MgtOperLogPageVo> page = new Page<>();
+        page.setSize(mgtOperLogPageDto.getPageSize());
+        page.setCurrent(mgtOperLogPageDto.getPageNum());
+        List<MgtOperLogPageVo> mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto);
+        return R.ok(page.setRecords(mgtOperLogPageVoList));
+    }
+
+    @RequestMapping(value = "/exportPageOperLog", method = RequestMethod.POST)
+    @ApiOperation(value = "导出操作日志")
+    public void exportPageOperLog(@RequestBody MgtOperLogPageDto mgtOperLogPageDto, HttpServletResponse response) {
+        Long userId = SecurityUtils.getUserId();
+        mgtOperLogPageDto.setUserId(userId);
+        Page<MgtOperLogPageVo> page = new Page<>();
+        page.setSize(2000);
+        page.setCurrent(1);
+        List<MgtOperLogPageVo> mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto);
+        ExcelUtil<MgtOperLogPageVo> util = new ExcelUtil<MgtOperLogPageVo>(MgtOperLogPageVo.class);
+        util.exportExcel(response, mgtOperLogPageVoList, "操作日志");
+    }
+
+    @RequestMapping(value = "/pageTag", method = RequestMethod.POST)
+    @ApiOperation(value = "分页获取标签列表")
+    public R<Page<MgtTagPageVo>> pageTag(@RequestBody MgtTagPageDto mgtTagPageDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtTagPageDto.setUserId(userId);
+        Page<MgtTagPageVo> page = new Page<>();
+        page.setSize(mgtTagPageDto.getPageSize());
+        page.setCurrent(mgtTagPageDto.getPageNum());
+        List<MgtTagPageVo> mgtTagPageVoList = sysTagService.pageTag(page, mgtTagPageDto);
+        return R.ok(page.setRecords(mgtTagPageVoList));
+    }
+
+    @ApiOperation(value = "导入标签")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, Integer tagType) throws Exception
+    {
+        ExcelUtil<MgtTagImportDto> util = new ExcelUtil<MgtTagImportDto>(MgtTagImportDto.class);
+        List<MgtTagImportDto> tagList = util.importExcel(file.getInputStream());
+        String operName = SecurityUtils.getUsername();
+        String message = sysTagService.importTag(tagList, tagType, operName);
+        return success(message);
+    }
+
+    @ApiOperation(value = "下载标签模板")
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) throws IOException
+    {
+        ExcelUtil<MgtTagImportDto> util = new ExcelUtil<MgtTagImportDto>(MgtTagImportDto.class);
+        util.importTemplateExcel(response, "标签导入模板");
+    }
+
+    @RequestMapping(value = "/editTag", method = RequestMethod.POST)
+    @Log(title = "标签管理", businessType = BusinessType.UPDATE,operContent = "修改标签")
+    @ApiOperation(value = "修改标签")
+    public R editTag(@RequestBody MgtTagEditDto mgtTagEditDto) {
+        mgtTagEditDto.setUserId(SecurityUtils.getUserId());
+        sysTagService.editTag(mgtTagEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/deleteTag", method = RequestMethod.POST)
+    @Log(title = "标签管理", businessType = BusinessType.DELETE,operContent = "删除标签")
+    @ApiOperation(value = "删除标签")
+    public R deleteTag(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
+        mgtBaseGetDto.setUserId(SecurityUtils.getUserId());
+        sysTagService.deleteTag(Long.valueOf(mgtBaseGetDto.getId()));
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/pageArticle", method = RequestMethod.POST)
+    @ApiOperation(value = "分页获取文章列表")
+    public R<Page<MgtArticlePageVo>> pageArticle(@RequestBody MgtArticlePageDto mgtArticlePageDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtArticlePageDto.setUserId(userId);
+        Page<MgtArticlePageVo> page = new Page<>();
+        page.setSize(mgtArticlePageDto.getPageSize());
+        page.setCurrent(mgtArticlePageDto.getPageNum());
+        List<MgtArticlePageVo> mgtArticlePageVoList = articleService.pageArticle(page, mgtArticlePageDto);
+        return R.ok(page.setRecords(mgtArticlePageVoList));
+    }
+
+    @RequestMapping(value = "/editArticle", method = RequestMethod.POST)
+    @Log(title = "文章管理", businessType = BusinessType.UPDATE,operContent = "修改文章")
+    @ApiOperation(value = "修改文章")
+    public R editArticle(@RequestBody MgtArticleEditDto mgtArticleEditDto) {
+        mgtArticleEditDto.setUserId(SecurityUtils.getUserId());
+        articleService.editMgtArticle(mgtArticleEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/deleteArticle", method = RequestMethod.POST)
+    @Log(title = "文章管理", businessType = BusinessType.DELETE,operContent = "删除文章")
+    @ApiOperation(value = "删除文章")
+    public R deleteArticle(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
+        mgtBaseGetDto.setUserId(SecurityUtils.getUserId());
+        articleService.deleteArticle(mgtBaseGetDto);
+        return R.ok();
+    }
+
+
+    @RequestMapping(value = "/listRegion", method = RequestMethod.POST)
+    @ApiOperation(value = "获取省市区列表")
+    public R<List<RegionVo>> listRegion(){
+        List<RegionVo> regionVoList = regionService.listRegionVo();
+        return R.ok(regionVoList);
+    }
+
+    @RequestMapping(value = "/listCity", method = RequestMethod.POST)
+    @ApiOperation(value = "获取省市列表")
+    public R<List<RegionVo>> listCity(){
+        List<RegionVo> regionVoList = regionService.listRegionVo();
+        return R.ok(regionVoList);
+    }
+
+    @RequestMapping(value = "/pageAllotRecommend", method = RequestMethod.POST)
+    @ApiOperation(value = "分页获取推荐分配列表")
+    public R<Page<MgtAllotRecommendPageVo>> pageAllotRecommend(@RequestBody MgtAllotRecommendPageDto mgtAllotRecommendPageDto) {
+        Long userId = SecurityUtils.getUserId();
+        mgtAllotRecommendPageDto.setUserId(userId);
+        Page<MgtAllotRecommendPageVo> page = new Page<>();
+        page.setSize(mgtAllotRecommendPageDto.getPageSize());
+        page.setCurrent(mgtAllotRecommendPageDto.getPageNum());
+        List<MgtAllotRecommendPageVo> allotRecommendPageVoList = recommendCooperationService.pageAllotRecommend(page, mgtAllotRecommendPageDto);
+        return R.ok(page.setRecords(allotRecommendPageVoList));
+    }
+
+    @RequestMapping(value = "/allotRecommend", method = RequestMethod.POST)
+    @Log(title = "分配管理", businessType = BusinessType.UPDATE,operContent = "分配推荐")
+    @ApiOperation(value = "分配推荐")
+    public R allotRecommend(@RequestBody MgtAllotRecommendDto mgtAllotRecommendDto) {
+        mgtAllotRecommendDto.setUserId(SecurityUtils.getUserId());
+        recommendCooperationService.allotRecommend(mgtAllotRecommendDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/getBulletinBoard", method = RequestMethod.POST)
+    @ApiOperation(value = "获取看板统计")
+    public R<MgtBulletinBoardVo> getBulletinBoard() {
+        MgtBulletinBoardVo bulletinBoard = customConfigService.getBulletinBoard();
+        return R.ok(bulletinBoard);
+    }
 }

--
Gitblit v1.7.1