| | |
| | | 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.MgtClassNumDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtPageDto; |
| | | import com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo; |
| | | import com.ruoyi.system.domain.dto.*; |
| | |
| | | * @Date 2023/6/6 9:14 |
| | | * @Version 1.0 |
| | | */ |
| | | @Api(value = "平台端配置相关接口", tags = "平台端配置相关接口", description = "平台端配置相关接口") |
| | | @Api(value = "管理后台配置相关接口", tags = "管理后台配置相关接口", description = "管理后台配置相关接口") |
| | | @RestController |
| | | @RequestMapping("/mgt/config") |
| | | public class MgtConfigController { |
| | |
| | | |
| | | @RequestMapping(value = "/getCustomConfig", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取单个配置") |
| | | public R<MgtCustomConfigVo> getCustomConfig(@RequestBody MgtCustomConfigDto mgtCustomConfigDto) { |
| | | public R<List<String>> getCustomConfig(@RequestBody MgtCustomConfigDto mgtCustomConfigDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtCustomConfigDto.setUserId(userId); |
| | | MgtCustomConfigVo mgtCustomConfigVo = customConfigService.getCustomConfig(mgtCustomConfigDto); |
| | | List<String> 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(); |
| | | public R<List<MgtActivenessListVo>> getActivenessList() { |
| | | List<MgtActivenessListVo> activenessList = activenessService.getActivenessList(); |
| | | return R.ok(activenessList); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getCooperation", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取申请合作") |
| | | public R<MgtCooperationGetVo> getCooperation() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | MgtCooperationGetVo cooperationGetVo = cooperationService.getCooperation(); |
| | | return R.ok(cooperationGetVo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/editCooperation", method = RequestMethod.POST) |
| | |
| | | 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(); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listOperTitle", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取操作类型列表") |
| | | public R<List<String>> pageOperLog() { |
| | | List<String> operTitleList = customConfigService.listOperTitle(); |
| | | return R.ok(operTitleList); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pageOperLog", method = RequestMethod.POST) |
| | | @ApiOperation(value = "分页获取操作日志") |
| | | public R<Page<MgtOperLogPageVo>> pageOperLog(@RequestBody MgtOperLogPageDto 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(@RequestBody MgtOperLogPageDto mgtOperLogPageDto, HttpServletResponse response) { |
| | | public void exportPageOperLog(MgtOperLogPageDto mgtOperLogPageDto, HttpServletResponse response) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtOperLogPageDto.setUserId(userId); |
| | | Page<MgtOperLogPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | page.setCurrent(1); |
| | | if(mgtOperLogPageDto.getPageSize() > 5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | }else{ |
| | | page.setSize(mgtOperLogPageDto.getPageSize()); |
| | | page.setCurrent(mgtOperLogPageDto.getPageNum()); |
| | | } |
| | | List<MgtOperLogPageVo> mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto); |
| | | ExcelUtil<MgtOperLogPageVo> util = new ExcelUtil<MgtOperLogPageVo>(MgtOperLogPageVo.class); |
| | | util.exportExcel(response, mgtOperLogPageVoList, "操作日志"); |
| | |
| | | return R.ok(page.setRecords(mgtTagPageVoList)); |
| | | } |
| | | |
| | | @ApiOperation(value = "导入标签") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file, Integer tagType) throws Exception |
| | | @ApiOperation(value = "导入商品标签") |
| | | @PostMapping("/importGoodsTagData") |
| | | public AjaxResult importGoodsTagData(@RequestPart("file")MultipartFile file) 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); |
| | | String message = sysTagService.importTag(tagList, 1, operName); |
| | | return success(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "导入用户标签") |
| | | @PostMapping("/importUserTagData") |
| | | public AjaxResult importUserTagData(@RequestPart("file")MultipartFile file) 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, 2, operName); |
| | | return success(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "导入商户标签") |
| | | @PostMapping("/importShopTagData") |
| | | public AjaxResult importShopTagData(@RequestPart("file")MultipartFile file) 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, 3, operName); |
| | | return success(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "导入建议标签") |
| | | @PostMapping("/importSuggestTagData") |
| | | public AjaxResult importSuggestTagData(@RequestPart("file")MultipartFile file) 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, 4, operName); |
| | | return success(message); |
| | | } |
| | | |
| | |
| | | return R.ok(page.setRecords(mgtArticlePageVoList)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getArticle", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取文章") |
| | | public R<MgtArticleGetVo> 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()); |
| | | articleService.editMgtArticle(mgtArticleEditDto); |
| | | 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(); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "删除文章") |
| | | public R deleteArticle(@RequestBody MgtBaseGetDto mgtBaseGetDto) { |
| | | mgtBaseGetDto.setUserId(SecurityUtils.getUserId()); |
| | | articleService.deleteArticle(mgtBaseGetDto); |
| | | Long oldClassId = articleService.deleteArticle(mgtBaseGetDto); |
| | | if(oldClassId!=null){ |
| | | MgtClassNumDto mgtClassNumDto = new MgtClassNumDto(); |
| | | mgtClassNumDto.setSubClassId(oldClassId); |
| | | sysClassificationService.changeClassNum(mgtClassNumDto); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/listCity", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取省市列表") |
| | | public R<List<RegionVo>> listCity(){ |
| | | List<RegionVo> regionVoList = regionService.listRegionVo(); |
| | | List<RegionVo> regionVoList = regionService.listCityVo(); |
| | | return R.ok(regionVoList); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listRegions", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取省市区列表") |
| | | public R<List<RegionVo>> listRegions(Long pid){ |
| | | List<RegionVo> regionVoList = regionService.listRegions(pid); |
| | | return R.ok(regionVoList); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/pageAllotRecommend", method = RequestMethod.POST) |
| | | @ApiOperation(value = "分页获取推荐分配列表") |
| | |
| | | MgtBulletinBoardVo bulletinBoard = customConfigService.getBulletinBoard(); |
| | | return R.ok(bulletinBoard); |
| | | } |
| | | |
| | | |
| | | } |