package com.ruoyi.system.controller.management; import com.baomidou.mybatisplus.core.metadata.IPage; 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.MGtOneClinkSyncingShopPageDTO; import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; import com.ruoyi.system.api.domain.dto.MgtClassNumDto; 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.pojo.config.BottomNav; 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.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 * @Description TODO * @Author jqs * @Date 2023/6/6 9:14 * @Version 1.0 */ @Api(value = "管理后台配置相关接口", tags = "管理后台配置相关接口", description = "管理后台配置相关接口") @RestController @RequestMapping("/mgt/config") public class MgtConfigController { @Resource private CustomConfigService customConfigService; @Resource private CooperationService cooperationService; @Resource private AgreementService agreementService; @Resource private BannerService bannerService; @Resource private PopService popService; @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; @Resource private BottomNavService bottomNavService; @Resource private OneClinkSyncingService oneClinkSyncingService; @RequestMapping(value = "/getCustomConfig", method = RequestMethod.POST) @ApiOperation(value = "获取单个配置") public R> getCustomConfig(@RequestBody MgtCustomConfigDto mgtCustomConfigDto) { Long userId = SecurityUtils.getUserId(); mgtCustomConfigDto.setUserId(userId); List mgtCustomConfigVo = customConfigService.getCustomConfig(mgtCustomConfigDto); return R.ok(mgtCustomConfigVo); } @RequestMapping(value = "/getActivenessList", method = RequestMethod.POST) @ApiOperation(value = "获取活跃度") public R> getActivenessList() { List activenessList = activenessService.getActivenessList(); return R.ok(activenessList); } @RequestMapping(value = "/getCooperation", method = RequestMethod.POST) @ApiOperation(value = "获取申请合作") public R getCooperation() { Long userId = SecurityUtils.getUserId(); MgtCooperationGetVo cooperationGetVo = cooperationService.getCooperation(); return R.ok(cooperationGetVo); } @RequestMapping(value = "/editCooperation", method = RequestMethod.POST) @Log(title = "申请合作管理", businessType = BusinessType.UPDATE,operContent = "修改申请合作") @ApiOperation(value = "修改申请合作") public R editCooperation(@RequestBody MgtCooperationEditDto mgtCooperationEditDto) { Long userId = SecurityUtils.getUserId(); mgtCooperationEditDto.setUserId(userId); cooperationService.editCooperation(mgtCooperationEditDto); return R.ok(); } @RequestMapping(value = "/editServiceMobile", method = RequestMethod.POST) @Log(title = "客服电话管理", businessType = BusinessType.UPDATE,operContent = "修改客服电话") @ApiOperation(value = "修改客服电话") public R editServiceMobile(@RequestBody MgtServiceMobileEditDto mgtServiceMobileEditDto) { Long userId = SecurityUtils.getUserId(); mgtServiceMobileEditDto.setUserId(userId); customConfigService.editServiceMobile(mgtServiceMobileEditDto); return R.ok(); } @RequestMapping(value = "/editServiceCode", method = RequestMethod.POST) @Log(title = "客服二维码管理", businessType = BusinessType.UPDATE,operContent = "修改客服二维码") @ApiOperation(value = "修改客服二维码") public R editServiceCode(@RequestBody MgtServiceCodeEditDto mgtServiceCodeEditDto) { Long userId = SecurityUtils.getUserId(); mgtServiceCodeEditDto.setUserId(userId); customConfigService.editServiceCode(mgtServiceCodeEditDto); return R.ok(); } @RequestMapping(value = "/editShopProportion", method = RequestMethod.POST) @Log(title = "商户分成管理", businessType = BusinessType.UPDATE,operContent = "修改商户分成") @ApiOperation(value = "修改商户分成") public R editShopProportion(@RequestBody MgtShopCommonProportionEditDto mgtShopCommonProportionEditDto) { Long userId = SecurityUtils.getUserId(); mgtShopCommonProportionEditDto.setUserId(userId); customConfigService.editShopProportion(mgtShopCommonProportionEditDto); return R.ok(); } @RequestMapping(value = "/editAgreement", method = RequestMethod.POST) @Log(title = "协议管理", businessType = BusinessType.UPDATE,operContent = "修改协议") @ApiOperation(value = "修改协议") public R editAgreement(@RequestBody MgtAgreementEditDto mgtAgreementEditDto) { Long userId = SecurityUtils.getUserId(); mgtAgreementEditDto.setUserId(userId); agreementService.editAgreement(mgtAgreementEditDto); return R.ok(); } @RequestMapping(value = "/editBanner", method = RequestMethod.POST) @Log(title = "banner管理", businessType = BusinessType.UPDATE,operContent = "修改banner") @ApiOperation(value = "修改banner【2.0】") public R editBanner(@RequestBody MgtBannerEditDto mgtBannerEditDto) { Long userId = SecurityUtils.getUserId(); mgtBannerEditDto.setUserId(userId); bannerService.editBanner(mgtBannerEditDto); return R.ok(); } @RequestMapping(value = "/pageBanner", method = RequestMethod.POST) @ApiOperation(value = "分页获取banner") public R> pageBanner(@RequestBody MgtPageDto mgtPageDto) { Long userId = SecurityUtils.getUserId(); mgtPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtPageDto.getPageSize()); page.setCurrent(mgtPageDto.getPageNum()); List mgtBannerPageVoList = bannerService.pageMgtBannerVo(page); return R.ok(page.setRecords(mgtBannerPageVoList)); } @RequestMapping(value = "/getBanner", method = RequestMethod.POST) @ApiOperation(value = "获取banner编辑信息【2.0】") public R getBanner(@RequestBody MgtBaseGetDto mgtBaseGetDto) { Long userId = SecurityUtils.getUserId(); mgtBaseGetDto.setUserId(userId); MgtBannerGetVo mgtBannerGetVo = bannerService.getMgtBanner(Long.valueOf(mgtBaseGetDto.getId())); return R.ok(mgtBannerGetVo); } @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(); mgtBaseGetDto.setUserId(userId); bannerService.deleteBanner(mgtBaseGetDto); return R.ok(); } @RequestMapping(value = "/pagePop", method = RequestMethod.POST) @ApiOperation(value = "分页获取广告弹窗") public R> pagePop(@RequestBody MgtPageDto mgtPageDto) { Long userId = SecurityUtils.getUserId(); mgtPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtPageDto.getPageSize()); page.setCurrent(mgtPageDto.getPageNum()); List mgtPopPageVoList = popService.pageMgtPop(page); return R.ok(page.setRecords(mgtPopPageVoList)); } @RequestMapping(value = "/editPop", method = RequestMethod.POST) @Log(title = "弹窗管理", businessType = BusinessType.UPDATE,operContent = "修改弹窗广告") @ApiOperation(value = "修改弹窗广告【2.0】") public R editPop(@RequestBody MgtPopEditDto mgtPopEditDto) { Long userId = SecurityUtils.getUserId(); mgtPopEditDto.setUserId(userId); popService.editMgtPop(mgtPopEditDto); return R.ok(); } @RequestMapping(value = "/getPop", method = RequestMethod.POST) @ApiOperation(value = "获取弹窗编辑信息【2.0】") public R getPop(@RequestBody MgtBaseGetDto mgtBaseGetDto) { Long userId = SecurityUtils.getUserId(); mgtBaseGetDto.setUserId(userId); MgtPopGetVo mgtPopGetVo = popService.getMgtPop(Long.valueOf(mgtBaseGetDto.getId())); return R.ok(mgtPopGetVo); } @RequestMapping(value = "/deletePop", method = RequestMethod.POST) @Log(title = "弹窗管理", businessType = BusinessType.DELETE,operContent = "删除弹窗广告") @ApiOperation(value = "删除弹窗广告") public R deletePop(@RequestBody MgtBaseGetDto mgtBaseGetDto) { Long userId = SecurityUtils.getUserId(); mgtBaseGetDto.setUserId(userId); popService.deleteMgtPop(mgtBaseGetDto); return R.ok(); } @RequestMapping(value = "/getBottomNav", method = RequestMethod.GET) @ApiOperation(value = "获取底部导航栏配置数据【2.0】") public R> getBottomNav() { List list = bottomNavService.getAllBottomNav(); return R.ok(list); } @RequestMapping(value = "/editBottomNav", method = RequestMethod.PUT) @ApiOperation(value = "获取底部导航栏配置数据【2.0】") public R editBottomNav(@RequestBody BottomNavDto bottomNavDto) { return bottomNavService.editBottomNav(bottomNavDto); } @RequestMapping(value = "/pageQuickEntry", method = RequestMethod.POST) @ApiOperation(value = "分页获取快速入口") public R> pageQuickEntry(@RequestBody MgtPageDto mgtPageDto) { Long userId = SecurityUtils.getUserId(); mgtPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtPageDto.getPageSize()); page.setCurrent(mgtPageDto.getPageNum()); List mgtQuickEntryPageVoList = quickEntryService.pageMgtQuickEntry(page); return R.ok(page.setRecords(mgtQuickEntryPageVoList)); } @RequestMapping(value = "/editQuickEntry", method = RequestMethod.POST) @Log(title = "快速入口管理", businessType = BusinessType.UPDATE,operContent = "修改快速入口") @ApiOperation(value = "修改快速入口【2.0】") public R editQuickEntry(@RequestBody MgtQuickEntryEditDto mgtQuickEntryEditDto) { Long userId = SecurityUtils.getUserId(); mgtQuickEntryEditDto.setUserId(userId); quickEntryService.editMgtQuickEntry(mgtQuickEntryEditDto); return R.ok(); } @RequestMapping(value = "/getQuickEntry", method = RequestMethod.POST) @ApiOperation(value = "获取快速入口编辑信息【2.0】") public R getQuickEntry(@RequestBody MgtBaseGetDto mgtBaseGetDto) { Long userId = SecurityUtils.getUserId(); mgtBaseGetDto.setUserId(userId); MgtQuickEntryGetVo mgtQuickEntryGetVo = quickEntryService.getMgtQuickEntry(Long.valueOf(mgtBaseGetDto.getId())); return R.ok(mgtQuickEntryGetVo); } @RequestMapping(value = "/deleteQuickEntry", method = RequestMethod.POST) @Log(title = "快速入口管理", businessType = BusinessType.DELETE,operContent = "删除快速入口") @ApiOperation(value = "删除快速入口") public R deleteQuickEntry(@RequestBody MgtBaseGetDto mgtBaseGetDto) { Long userId = SecurityUtils.getUserId(); mgtBaseGetDto.setUserId(userId); quickEntryService.deleteMgtQuickEntry(mgtBaseGetDto); return R.ok(); } @RequestMapping(value = "/getAllCustomConfig", method = RequestMethod.POST) @ApiOperation(value = "获取全部自定义设置") public R 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(@Validated @RequestBody MgtOtherConfigEditDto mgtOtherConfigEditDto) { customConfigService.editOtherConfig(mgtOtherConfigEditDto); return R.ok(); } @RequestMapping(value = "/editStoreCurriculum", method = RequestMethod.POST) @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改门店课程设置") @ApiOperation(value = "修改门店课程设置") public R editStoreCurriculum(@Validated @RequestBody MgtStoreCurriculumEditDto mgtStoreCurriculumEditDto) { customConfigService.editStoreCurriculum(mgtStoreCurriculumEditDto); return R.ok(); } @RequestMapping(value = "/editShopConfig", method = RequestMethod.POST) @Log(title = "其它设置管理", businessType = BusinessType.UPDATE,operContent = "修改合作商配置") @ApiOperation(value = "修改合作商配置") 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(@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> pageClassification(@RequestBody MgtClassificationPageDto mgtClassificationPageDto) { Long userId = SecurityUtils.getUserId(); mgtClassificationPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtClassificationPageDto.getPageSize()); page.setCurrent(mgtClassificationPageDto.getPageNum()); List 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 = "/listOperTitle", method = RequestMethod.POST) @ApiOperation(value = "获取操作类型列表") public R> pageOperLog() { List operTitleList = customConfigService.listOperTitle(); return R.ok(operTitleList); } @RequestMapping(value = "/pageOperLog", method = RequestMethod.POST) @ApiOperation(value = "分页获取操作日志") public R> pageOperLog(@RequestBody MgtOperLogPageDto mgtOperLogPageDto) { Long userId = SecurityUtils.getUserId(); mgtOperLogPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtOperLogPageDto.getPageSize()); page.setCurrent(mgtOperLogPageDto.getPageNum()); List mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto); return R.ok(page.setRecords(mgtOperLogPageVoList)); } @RequestMapping(value = "/deleteOperlog", method = RequestMethod.POST) @Log(title = "日志管理", businessType = BusinessType.DELETE,operContent = "清空日志") @ApiOperation(value = "清空日志") public R deleteOperlog() { customConfigService.deleteOperlog(); return R.ok(); } @RequestMapping(value = "/exportPageOperLog", method = RequestMethod.POST) @ApiOperation(value = "导出操作日志") public void exportPageOperLog(MgtOperLogPageDto mgtOperLogPageDto, HttpServletResponse response) { Long userId = SecurityUtils.getUserId(); mgtOperLogPageDto.setUserId(userId); Page page = new Page<>(); if(mgtOperLogPageDto.getPageSize() > 5000){ page.setSize(5000); page.setCurrent(1); }else{ page.setSize(mgtOperLogPageDto.getPageSize()); page.setCurrent(mgtOperLogPageDto.getPageNum()); } List mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto); ExcelUtil util = new ExcelUtil(MgtOperLogPageVo.class); util.exportExcel(response, mgtOperLogPageVoList, "操作日志"); } @RequestMapping(value = "/pageTag", method = RequestMethod.POST) @ApiOperation(value = "分页获取标签列表") public R> pageTag(@RequestBody MgtTagPageDto mgtTagPageDto) { Long userId = SecurityUtils.getUserId(); mgtTagPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtTagPageDto.getPageSize()); page.setCurrent(mgtTagPageDto.getPageNum()); List mgtTagPageVoList = sysTagService.pageTag(page, mgtTagPageDto); return R.ok(page.setRecords(mgtTagPageVoList)); } @ApiOperation(value = "导入商品标签") @PostMapping("/importGoodsTagData") public AjaxResult importGoodsTagData(@RequestPart("file")MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(MgtTagImportDto.class); List tagList = util.importExcel(file.getInputStream()); String operName = SecurityUtils.getUsername(); String message = sysTagService.importTag(tagList, 1, operName); return success(message); } @ApiOperation(value = "导入用户标签") @PostMapping("/importUserTagData") public AjaxResult importUserTagData(@RequestPart("file")MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(MgtTagImportDto.class); List tagList = util.importExcel(file.getInputStream()); String operName = SecurityUtils.getUsername(); String message = sysTagService.importTag(tagList, 2, operName); return success(message); } @ApiOperation(value = "导入商户标签") @PostMapping("/importShopTagData") public AjaxResult importShopTagData(@RequestPart("file")MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(MgtTagImportDto.class); List tagList = util.importExcel(file.getInputStream()); String operName = SecurityUtils.getUsername(); String message = sysTagService.importTag(tagList, 3, operName); return success(message); } @ApiOperation(value = "导入建议标签") @PostMapping("/importSuggestTagData") public AjaxResult importSuggestTagData(@RequestPart("file")MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(MgtTagImportDto.class); List tagList = util.importExcel(file.getInputStream()); String operName = SecurityUtils.getUsername(); String message = sysTagService.importTag(tagList, 4, operName); return success(message); } @ApiOperation(value = "下载标签模板") @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) throws IOException { ExcelUtil util = new ExcelUtil(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> pageArticle(@RequestBody MgtArticlePageDto mgtArticlePageDto) { Long userId = SecurityUtils.getUserId(); mgtArticlePageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtArticlePageDto.getPageSize()); page.setCurrent(mgtArticlePageDto.getPageNum()); List mgtArticlePageVoList = articleService.pageArticle(page, mgtArticlePageDto); return R.ok(page.setRecords(mgtArticlePageVoList)); } @RequestMapping(value = "/getArticle", method = RequestMethod.POST) @ApiOperation(value = "获取文章") public R getArticle(@RequestBody MgtBaseGetDto mgtBaseGetDto) { mgtBaseGetDto.setUserId(SecurityUtils.getUserId()); MgtArticleGetVo mgtArticleGetVo = articleService.getArticle(Long.valueOf(mgtBaseGetDto.getId())); return R.ok(mgtArticleGetVo); } @RequestMapping(value = "/editArticle", method = RequestMethod.POST) @Log(title = "文章管理", businessType = BusinessType.UPDATE,operContent = "修改文章") @ApiOperation(value = "修改文章") public R editArticle(@RequestBody MgtArticleEditDto mgtArticleEditDto) { mgtArticleEditDto.setUserId(SecurityUtils.getUserId()); Long oldClassId = articleService.editMgtArticle(mgtArticleEditDto); // 创建MgtClassNumDto对象 MgtClassNumDto mgtClassNumDto = new MgtClassNumDto(); if(mgtArticleEditDto.getArticleId()!=null){ // 如果类别ID不为空并且文章的类别ID不为空并且类别ID不同,则设置子类别ID和新增类别ID if (mgtArticleEditDto.getClassId() != null && oldClassId != null && !mgtArticleEditDto.getClassId().equals(oldClassId)) { mgtClassNumDto.setSubClassId(oldClassId); mgtClassNumDto.setAddClassId(mgtArticleEditDto.getClassId()); } // 如果类别ID不为空并且文章的类别ID为空,则设置新增类别ID else if (mgtArticleEditDto.getClassId() != null && oldClassId == null) { mgtClassNumDto.setAddClassId(mgtArticleEditDto.getClassId()); } }else{ mgtClassNumDto.setAddClassId(mgtArticleEditDto.getClassId()); } // 更新类别数量 sysClassificationService.changeClassNum(mgtClassNumDto); 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()); Long oldClassId = articleService.deleteArticle(mgtBaseGetDto); if(oldClassId!=null){ MgtClassNumDto mgtClassNumDto = new MgtClassNumDto(); mgtClassNumDto.setSubClassId(oldClassId); sysClassificationService.changeClassNum(mgtClassNumDto); } return R.ok(); } @RequestMapping(value = "/listRegion", method = RequestMethod.POST) @ApiOperation(value = "获取省市区列表") public R> listRegion(){ List regionVoList = regionService.listRegionVo(); return R.ok(regionVoList); } @RequestMapping(value = "/listCity", method = RequestMethod.POST) @ApiOperation(value = "获取省市列表") public R> listCity(){ List regionVoList = regionService.listCityVo(); return R.ok(regionVoList); } @RequestMapping(value = "/listRegions", method = RequestMethod.GET) @ApiOperation(value = "获取省市区列表") public R> listRegions(Long pid){ List regionVoList = regionService.listRegions(pid); return R.ok(regionVoList); } @RequestMapping(value = "/pageAllotRecommend", method = RequestMethod.POST) @ApiOperation(value = "分页获取推荐分配列表") public R> pageAllotRecommend(@RequestBody MgtAllotRecommendPageDto mgtAllotRecommendPageDto) { Long userId = SecurityUtils.getUserId(); mgtAllotRecommendPageDto.setUserId(userId); Page page = new Page<>(); page.setSize(mgtAllotRecommendPageDto.getPageSize()); page.setCurrent(mgtAllotRecommendPageDto.getPageNum()); List 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 getBulletinBoard() { MgtBulletinBoardVo bulletinBoard = customConfigService.getBulletinBoard(); return R.ok(bulletinBoard); } @RequestMapping(value = "/pageOneClinkSyncing", method = RequestMethod.POST) @ApiOperation(value = "分页获取一键同步【2.0】") public R> pageOneClinkSyncing(@RequestBody MgtOneClinkSyncingPageDTO mgtPageDto) { return R.ok(oneClinkSyncingService.pageOneClinkSyncing(mgtPageDto)); } @RequestMapping(value = "/editOneClinkSyncing", method = RequestMethod.POST) @Log(title = "一键同步管理", businessType = BusinessType.UPDATE,operContent = "修改一键同步") @ApiOperation(value = "修改一键同步【2.0】") public R editOneClinkSyncing(@RequestBody MgtOneClinkSyncingEditDto dto) { Long userId = SecurityUtils.getUserId(); dto.setUserId(userId); return oneClinkSyncingService.editOneClinkSyncing(dto); } @RequestMapping(value = "/getOneClinkSyncing", method = RequestMethod.POST) @ApiOperation(value = "获取一键同步信息(查看详情)【2.0】") public R getOneClinkSyncing(@RequestBody MGtOneClinkSyncingShopPageDTO dto ) { return oneClinkSyncingService.getOneClinkSyncing(dto); } @RequestMapping(value = "/deleteOneClinkSyncing", method = RequestMethod.GET) @Log(title = "一键同步管理", businessType = BusinessType.DELETE,operContent = "删除一键同步") @ApiOperation(value = "删除一键同步【2.0】") public R deleteOneClinkSyncing(@RequestParam("syncingId") Integer syncingId ) { return oneClinkSyncingService.deleteOneClinkSyncing(syncingId); } @RequestMapping(value = "/executeOneClinkSyncing", method = RequestMethod.GET) @Log(title = "一键同步管理", businessType = BusinessType.UPDATE,operContent = "执行一键同步") @ApiOperation(value = "执行一键同步【2.0】") public R executeOneClinkSyncing(@RequestParam("syncingId") Integer syncingId ) { return oneClinkSyncingService.executeOneClinkSyncing(syncingId); } }