From f94d845814d209b7b5cda0ea70a2e8cb6cda5b39 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 13 一月 2025 15:22:50 +0800
Subject: [PATCH] 12.18
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 103 insertions(+), 2 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java
index 32ea9cf..2aee854 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java
@@ -1,8 +1,23 @@
package com.ruoyi.other.controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.account.api.feignClient.AppUserClient;
+import com.ruoyi.account.api.model.AppUser;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.BaseSetting;
+import com.ruoyi.other.api.domain.VipSetting;
+import com.ruoyi.other.service.BaseSettingService;
+import com.ruoyi.other.service.VipSettingService;
+import com.ruoyi.other.vo.RefundPassSettingVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
/**
* <p>
@@ -14,7 +29,93 @@
*/
@RestController
@RequestMapping("/base-setting")
+@Api("基础配置")
public class BaseSettingController {
+ @Resource
+ private BaseSettingService baseSettingService;
+
+ @Resource
+ private VipSettingService vipSettingService;
+
+ @Resource
+ private TokenService tokenService;
+
+ @Resource
+ private AppUserClient appUserClient;
+
+
+
+ /**
+ * 获取基础配置
+ * @param id
+ * @return
+ */
+ @ResponseBody
+ @GetMapping("/getBaseSetting")
+ @ApiOperation(value = "获取基础配置", tags = {"管理后台-基础配置"})
+ public R<BaseSetting> getBaseSetting(@RequestParam("id") Integer id){
+ BaseSetting baseSetting = baseSettingService.getById(id);
+ return R.ok(baseSetting);
+ }
+
+
+ @ResponseBody
+ @GetMapping("/getBaseSetting1")
+ @ApiOperation(value = "获取基础配置", tags = {"小程序-基础配置"})
+ public R<BaseSetting> getBaseSetting1(@RequestParam("id") Integer id){
+ BaseSetting baseSetting = baseSettingService.getById(id);
+ Long userid = tokenService.getLoginUserApplet().getUserid();
+ AppUser appUser = appUserClient.getAppUserById(userid);
+ VipSetting vipSetting = vipSettingService.getById(appUser.getVipId());
+ baseSetting.setWithdraw(vipSetting.getVipWithdrawalRole());
+ baseSetting.setWithdrawalMinAmount(vipSetting.getVipWithdrawalMinAmount());
+ return R.ok(baseSetting);
+ }
+
+
+ /**
+ * 保存设置
+ */
+ @ApiOperation(value = "保存设置", tags = {"管理后台-基础配置"})
+ @PostMapping("/save")
+ public R saveActivityConfig(@RequestBody String json){
+ JSONObject jsonObject = JSONObject.parseObject(json);
+ Integer id = jsonObject.getInteger("id");
+ BaseSetting baseSetting = baseSettingService.getById(id);
+ baseSetting.setContent(jsonObject.getString("content"));
+ baseSettingService.saveOrUpdate(baseSetting);
+ return R.ok();
+ }
+
+
+ @PostMapping("/setRefundPassSetting")
+ @ApiOperation(value = "保存售后设置", tags = {"管理后台-售后管理"})
+ public R setRefundPassSetting(@RequestBody RefundPassSettingVo settingVo){
+ BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5));
+ if(null == one){
+ one = new BaseSetting();
+ one.setId(5);
+ one.setContent(JSON.toJSONString(settingVo));
+ baseSettingService.save(one);
+ }else{
+ one.setContent(JSON.toJSONString(settingVo));
+ baseSettingService.updateById(one);
+ }
+ return R.ok();
+ }
+
+
+
+ @GetMapping("/getRefundPassSetting")
+ @ApiOperation(value = "获取售后设置", tags = {"管理后台-售后管理"})
+ public R<RefundPassSettingVo> getRefundPassSetting(){
+ BaseSetting one = baseSettingService.getOne(new LambdaQueryWrapper<BaseSetting>().eq(BaseSetting::getId, 5));
+ if(null != one){
+ RefundPassSettingVo refundPassSettingVo = JSON.parseObject(one.getContent(), RefundPassSettingVo.class);
+ return R.ok(refundPassSettingVo);
+ }
+ return R.ok();
+ }
}
--
Gitblit v1.7.1