refactor(cms): 重构网站信息获取接口
- 移除 CmsMainController 中的 getSiteInfo 方法 - 新增 ShopMainController 控制器用于获取商城信息 - 重构 CmsWebsiteController 中的 getSiteInfo 方法,使用 Redis 缓存 - 更新 CmsWebsiteService 接口和实现类,返回 ShopVo 对象- 删除 TestController 和 WechatCertTestController - 更新 SecurityConfig 中的放行接口列表
This commit is contained in:
@@ -26,25 +26,4 @@ public class CmsMainController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CmsWebsiteService cmsWebsiteService;
|
private CmsWebsiteService cmsWebsiteService;
|
||||||
|
|
||||||
@Operation(summary = "网站基本信息", description = "获取网站的基本信息,包括配置、导航、设置和过期状态等")
|
|
||||||
@GetMapping("/getSiteInfo")
|
|
||||||
public ApiResult<CmsVO> getSiteInfo() {
|
|
||||||
try {
|
|
||||||
Integer tenantId = getTenantId();
|
|
||||||
if (ObjectUtil.isEmpty(tenantId)) {
|
|
||||||
return fail("租户ID不能为空", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
CmsVO websiteVO = cmsWebsiteService.getSiteInfo(tenantId);
|
|
||||||
return success(websiteVO);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return fail(e.getMessage(), null);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
return fail(e.getMessage(), null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取网站信息失败", e);
|
|
||||||
return fail("获取网站信息失败", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,60 @@
|
|||||||
package com.gxwebsoft.cms.controller;
|
package com.gxwebsoft.cms.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.gxwebsoft.cms.entity.CmsWebsite;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.gxwebsoft.cms.param.CmsWebsiteParam;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.gxwebsoft.cms.service.CmsWebsiteService;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.gxwebsoft.cms.vo.CmsVO;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.cms.entity.CmsNavigation;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.cms.entity.CmsWebsite;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.cms.entity.CmsWebsiteField;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.cms.entity.CmsWebsiteSetting;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.cms.param.CmsNavigationParam;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.cms.param.CmsWebsiteParam;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import com.gxwebsoft.cms.service.CmsNavigationService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import com.gxwebsoft.cms.service.CmsWebsiteFieldService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import com.gxwebsoft.cms.service.CmsWebsiteService;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import com.gxwebsoft.cms.service.CmsWebsiteSettingService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import com.gxwebsoft.cms.vo.CmsVO;
|
||||||
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网站信息记录表控制器
|
* 网站信息记录表控制器
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-09-10 20:36:14
|
* @since 2024-09-10 20:36:14
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "网站信息记录表管理")
|
@Tag(name = "网站信息记录表管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/cms/cms-website")
|
@RequestMapping("/api/cms/cms-website")
|
||||||
public class CmsWebsiteController extends BaseController {
|
public class CmsWebsiteController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private CmsWebsiteService cmsWebsiteService;
|
private CmsWebsiteService cmsWebsiteService;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
@Resource
|
||||||
|
private CmsNavigationService cmsNavigationService;
|
||||||
|
@Resource
|
||||||
|
private CmsWebsiteSettingService cmsWebsiteSettingService;
|
||||||
|
@Resource
|
||||||
|
private CmsWebsiteFieldService cmsWebsiteFieldService;
|
||||||
|
|
||||||
private static final String SITE_INFO_KEY_PREFIX = "SiteInfo:";
|
private static final String SITE_INFO_KEY_PREFIX = "SiteInfo:";
|
||||||
private static final String MP_INFO_KEY_PREFIX = "MpInfo:";
|
private static final String MP_INFO_KEY_PREFIX = "MpInfo:";
|
||||||
@@ -45,155 +65,277 @@ public class CmsWebsiteController extends BaseController {
|
|||||||
@Operation(summary = "分页查询网站信息记录表")
|
@Operation(summary = "分页查询网站信息记录表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<CmsWebsite>> page(CmsWebsiteParam param) {
|
public ApiResult<PageResult<CmsWebsite>> page(CmsWebsiteParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(cmsWebsiteService.pageRel(param));
|
return success(cmsWebsiteService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询全部网站信息记录表")
|
@Operation(summary = "查询全部网站信息记录表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<CmsWebsite>> list(CmsWebsiteParam param) {
|
public ApiResult<List<CmsWebsite>> list(CmsWebsiteParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(cmsWebsiteService.listRel(param));
|
return success(cmsWebsiteService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分页查询网站信息记录表")
|
@Operation(summary = "分页查询网站信息记录表")
|
||||||
@GetMapping("/pageAll")
|
@GetMapping("/pageAll")
|
||||||
public ApiResult<PageResult<CmsWebsite>> pageAll(CmsWebsiteParam param) {
|
public ApiResult<PageResult<CmsWebsite>> pageAll(CmsWebsiteParam param) {
|
||||||
return success(cmsWebsiteService.pageRelAll(param));
|
return success(cmsWebsiteService.pageRelAll(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "根据id查询网站信息记录表")
|
@Operation(summary = "根据id查询网站信息记录表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<CmsWebsite> get(@PathVariable("id") Integer id) {
|
public ApiResult<CmsWebsite> get(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(cmsWebsiteService.getByIdRel(id));
|
return success(cmsWebsiteService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "根据id查询网站信息记录表")
|
@Operation(summary = "根据id查询网站信息记录表")
|
||||||
@GetMapping("/getAll/{id}")
|
@GetMapping("/getAll/{id}")
|
||||||
public ApiResult<CmsWebsite> getAll(@PathVariable("id") Integer id) {
|
public ApiResult<CmsWebsite> getAll(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(cmsWebsiteService.getByIdRelAll(id));
|
return success(cmsWebsiteService.getByIdRelAll(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:save')")
|
@PreAuthorize("hasAuthority('cms:website:save')")
|
||||||
@Operation(summary = "添加网站信息记录表")
|
@Operation(summary = "添加网站信息记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> save(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
// 记录当前登录用户id
|
// 记录当前登录用户id
|
||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
cmsWebsite.setLoginUser(loginUser);
|
cmsWebsite.setLoginUser(loginUser);
|
||||||
return success("创建成功", cmsWebsiteService.create(cmsWebsite));
|
return success("创建成功", cmsWebsiteService.create(cmsWebsite));
|
||||||
}
|
}
|
||||||
return fail("创建失败");
|
return fail("创建失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:update')")
|
@PreAuthorize("hasAuthority('cms:website:update')")
|
||||||
@Operation(summary = "修改网站信息记录表")
|
@Operation(summary = "修改网站信息记录表")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> update(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
if (cmsWebsiteService.updateById(cmsWebsite)) {
|
if (cmsWebsiteService.updateById(cmsWebsite)) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:update')")
|
@PreAuthorize("hasAuthority('cms:website:update')")
|
||||||
@Operation(summary = "修改网站信息记录表")
|
@Operation(summary = "修改网站信息记录表")
|
||||||
@PutMapping("/updateAll")
|
@PutMapping("/updateAll")
|
||||||
public ApiResult<?> updateAll(@RequestBody CmsWebsite cmsWebsite) {
|
public ApiResult<?> updateAll(@RequestBody CmsWebsite cmsWebsite) {
|
||||||
if (cmsWebsiteService.updateByIdAll(cmsWebsite)) {
|
if (cmsWebsiteService.updateByIdAll(cmsWebsite)) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:remove')")
|
@PreAuthorize("hasAuthority('cms:website:remove')")
|
||||||
@Operation(summary = "删除网站信息记录表")
|
@Operation(summary = "删除网站信息记录表")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
if (cmsWebsiteService.removeById(id)) {
|
if (cmsWebsiteService.removeById(id)) {
|
||||||
return success("删除成功");
|
return success("删除成功");
|
||||||
}
|
}
|
||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:remove')")
|
@PreAuthorize("hasAuthority('cms:website:remove')")
|
||||||
@Operation(summary = "删除网站信息记录表")
|
@Operation(summary = "删除网站信息记录表")
|
||||||
@DeleteMapping("/removeAll/{id}")
|
@DeleteMapping("/removeAll/{id}")
|
||||||
public ApiResult<?> removeAll(@PathVariable("id") Integer id) {
|
public ApiResult<?> removeAll(@PathVariable("id") Integer id) {
|
||||||
if (cmsWebsiteService.removeByIdAll(id)) {
|
if (cmsWebsiteService.removeByIdAll(id)) {
|
||||||
return success("删除成功");
|
return success("删除成功");
|
||||||
}
|
}
|
||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:save')")
|
@PreAuthorize("hasAuthority('cms:website:save')")
|
||||||
@Operation(summary = "批量添加网站信息记录表")
|
@Operation(summary = "批量添加网站信息记录表")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<CmsWebsite> list) {
|
public ApiResult<?> saveBatch(@RequestBody List<CmsWebsite> list) {
|
||||||
if (cmsWebsiteService.saveBatch(list)) {
|
if (cmsWebsiteService.saveBatch(list)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:update')")
|
@PreAuthorize("hasAuthority('cms:website:update')")
|
||||||
@Operation(summary = "批量修改网站信息记录表")
|
@Operation(summary = "批量修改网站信息记录表")
|
||||||
@PutMapping("/batch")
|
@PutMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<CmsWebsite> batchParam) {
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<CmsWebsite> batchParam) {
|
||||||
if (batchParam.update(cmsWebsiteService, "website_id")) {
|
if (batchParam.update(cmsWebsiteService, "website_id")) {
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:remove')")
|
@PreAuthorize("hasAuthority('cms:website:remove')")
|
||||||
@Operation(summary = "批量删除网站信息记录表")
|
@Operation(summary = "批量删除网站信息记录表")
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
if (cmsWebsiteService.removeByIds(ids)) {
|
if (cmsWebsiteService.removeByIds(ids)) {
|
||||||
return success("删除成功");
|
return success("删除成功");
|
||||||
}
|
}
|
||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "网站基本信息", description = "获取网站的基本信息,包括配置、导航、设置和过期状态等")
|
@Operation(summary = "网站基本信息")
|
||||||
@GetMapping("/getSiteInfo")
|
@GetMapping("/getSiteInfo")
|
||||||
public ApiResult<CmsVO> getSiteInfo() {
|
public ApiResult<CmsWebsite> getSiteInfo() {
|
||||||
try {
|
if (ObjectUtil.isEmpty(getTenantId())) {
|
||||||
Integer tenantId = getTenantId();
|
return fail("参数不正确", null);
|
||||||
if (ObjectUtil.isEmpty(tenantId)) {
|
}
|
||||||
return fail("租户ID不能为空", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
CmsVO websiteVO = cmsWebsiteService.getSiteInfo(tenantId);
|
String key = SITE_INFO_KEY_PREFIX + getTenantId();
|
||||||
|
final String siteInfo = redisUtil.get(key);
|
||||||
|
if (StrUtil.isNotBlank(siteInfo)) {
|
||||||
|
log.info("从缓存获取网站信息: = {}", key);
|
||||||
|
// return success(JSONUtil.parseObject(siteInfo, CmsWebsite.class));
|
||||||
|
}
|
||||||
|
|
||||||
return success(websiteVO);
|
// 获取站点信息
|
||||||
} catch (IllegalArgumentException e) {
|
CmsWebsite website = cmsWebsiteService.getOne(new LambdaQueryWrapper<CmsWebsite>().eq(CmsWebsite::getDeleted, 0).last("limit 1"));
|
||||||
return fail(e.getMessage(), null);
|
|
||||||
} catch (RuntimeException e) {
|
// 创建默认站点
|
||||||
return fail(e.getMessage(), null);
|
if (ObjectUtil.isEmpty(website)) {
|
||||||
} catch (Exception e) {
|
return success("请先创建站点...", null);
|
||||||
log.error("获取网站信息失败", e);
|
}
|
||||||
return fail("获取网站信息失败", null);
|
|
||||||
}
|
// 站点异常状态
|
||||||
|
setWebsiteStatus(website);
|
||||||
|
|
||||||
|
// 站点配置参数
|
||||||
|
HashMap<String, Object> config = buildWebsiteConfig(website);
|
||||||
|
website.setConfig(config);
|
||||||
|
|
||||||
|
// 网站导航
|
||||||
|
setWebsiteNavigation(website);
|
||||||
|
|
||||||
|
// 网站设置信息
|
||||||
|
setWebsiteSetting(website);
|
||||||
|
|
||||||
|
// 服务器时间
|
||||||
|
HashMap<String, Object> serverTime = buildServerTime();
|
||||||
|
website.setServerTime(serverTime);
|
||||||
|
|
||||||
|
// 即将过期(一周内过期的)
|
||||||
|
website.setSoon(DateUtil.offsetDay(website.getExpirationTime(), -30).compareTo(DateUtil.date()));
|
||||||
|
// 是否过期 -1已过期 大于0 未过期
|
||||||
|
website.setExpired(website.getExpirationTime().compareTo(DateUtil.date()));
|
||||||
|
// 剩余天数
|
||||||
|
website.setExpiredDays(DateUtil.betweenDay(website.getExpirationTime(), DateUtil.date(), false));
|
||||||
|
|
||||||
|
redisUtil.set(key, website, 1L, TimeUnit.DAYS);
|
||||||
|
return success(website);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setWebsiteStatus(CmsWebsite website) {
|
||||||
|
if (!website.getRunning().equals(1)) {
|
||||||
|
// 未开通
|
||||||
|
if (website.getRunning().equals(0)) {
|
||||||
|
website.setStatusIcon("error");
|
||||||
|
website.setStatusText("该站点未开通");
|
||||||
|
}
|
||||||
|
// 维护中
|
||||||
|
if (website.getRunning().equals(2)) {
|
||||||
|
website.setStatusIcon("warning");
|
||||||
|
}
|
||||||
|
// 已关闭
|
||||||
|
if (website.getRunning().equals(3)) {
|
||||||
|
website.setStatusIcon("error");
|
||||||
|
website.setStatusText("已关闭");
|
||||||
|
}
|
||||||
|
// 已欠费停机
|
||||||
|
if (website.getRunning().equals(4)) {
|
||||||
|
website.setStatusIcon("error");
|
||||||
|
website.setStatusText("已欠费停机");
|
||||||
|
}
|
||||||
|
// 违规关停
|
||||||
|
if (website.getRunning().equals(5)) {
|
||||||
|
website.setStatusIcon("error");
|
||||||
|
website.setStatusText("违规关停");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> buildWebsiteConfig(CmsWebsite website) {
|
||||||
|
HashMap<String, Object> config = new HashMap<>();
|
||||||
|
LambdaQueryWrapper<CmsWebsiteField> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CmsWebsiteField::getDeleted, 0);
|
||||||
|
final List<CmsWebsiteField> fields = cmsWebsiteFieldService.list(wrapper);
|
||||||
|
fields.forEach(d -> {
|
||||||
|
config.put(d.getName(), d.getValue());
|
||||||
|
});
|
||||||
|
config.put("SysDomain", getSysDomain(website));
|
||||||
|
config.put("Domain", getDomain(website));
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSysDomain(CmsWebsite website) {
|
||||||
|
return StrUtil.isNotBlank(website.getWebsiteCode()) ? website.getWebsiteCode() + SYS_DOMAIN_SUFFIX : website.getTenantId() + SYS_DOMAIN_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDomain(CmsWebsite website) {
|
||||||
|
return StrUtil.isNotBlank(website.getDomain()) ? website.getDomain() : website.getWebsiteCode() + DOMAIN_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWebsiteNavigation(CmsWebsite website) {
|
||||||
|
final CmsNavigationParam navigationParam = new CmsNavigationParam();
|
||||||
|
navigationParam.setHide(0);
|
||||||
|
navigationParam.setTop(0);
|
||||||
|
navigationParam.setBottom(null);
|
||||||
|
final List<CmsNavigation> topNavs = cmsNavigationService.listRel(navigationParam);
|
||||||
|
// 顶部菜单
|
||||||
|
website.setTopNavs(CommonUtil.toTreeData(topNavs, 0, CmsNavigation::getParentId, CmsNavigation::getNavigationId, CmsNavigation::setChildren));
|
||||||
|
navigationParam.setTop(null);
|
||||||
|
navigationParam.setBottom(0);
|
||||||
|
final List<CmsNavigation> bottomNavs = cmsNavigationService.listRel(navigationParam);
|
||||||
|
// 底部菜单
|
||||||
|
website.setBottomNavs(CommonUtil.toTreeData(bottomNavs, 0, CmsNavigation::getParentId, CmsNavigation::getNavigationId, CmsNavigation::setChildren));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWebsiteSetting(CmsWebsite website) {
|
||||||
|
final CmsWebsiteSetting setting = cmsWebsiteSettingService.getOne(new LambdaQueryWrapper<CmsWebsiteSetting>().eq(CmsWebsiteSetting::getWebsiteId, website.getWebsiteId()));
|
||||||
|
if (ObjectUtil.isNotEmpty(setting)) {
|
||||||
|
website.setSetting(setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> buildServerTime() {
|
||||||
|
HashMap<String, Object> serverTime = new HashMap<>();
|
||||||
|
// 今天日期
|
||||||
|
DateTime date = DateUtil.date();
|
||||||
|
String today = DateUtil.today();
|
||||||
|
// 明天日期
|
||||||
|
final DateTime dateTime = DateUtil.tomorrow();
|
||||||
|
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
||||||
|
// 后天日期
|
||||||
|
final DateTime dateTime2 = DateUtil.offsetDay(date, 2);
|
||||||
|
final String afterDay = DateUtil.format(dateTime2, "yyyy-MM-dd");
|
||||||
|
// 今天星期几
|
||||||
|
final int week = DateUtil.thisDayOfWeek();
|
||||||
|
final DateTime nextWeek = DateUtil.nextWeek();
|
||||||
|
serverTime.put("now", DateUtil.now());
|
||||||
|
serverTime.put("today", today);
|
||||||
|
serverTime.put("tomorrow", tomorrow);
|
||||||
|
serverTime.put("afterDay", afterDay);
|
||||||
|
serverTime.put("week", week);
|
||||||
|
serverTime.put("nextWeek", nextWeek);
|
||||||
|
return serverTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "清除缓存")
|
@Operation(summary = "清除缓存")
|
||||||
@DeleteMapping("/clearSiteInfo/{key}")
|
@DeleteMapping("/clearSiteInfo/{key}")
|
||||||
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
|
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
|
||||||
// 清除指定key
|
// 清除指定key
|
||||||
redisUtil.delete(key);
|
redisUtil.delete(key);
|
||||||
// 清除缓存
|
// 清除缓存
|
||||||
redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString()));
|
redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString()));
|
||||||
// 清除小程序缓存
|
// 清除小程序缓存
|
||||||
redisUtil.delete(MP_INFO_KEY_PREFIX.concat(getTenantId().toString()));
|
redisUtil.delete(MP_INFO_KEY_PREFIX.concat(getTenantId().toString()));
|
||||||
// 选择支付方式
|
// 选择支付方式
|
||||||
redisUtil.delete(SELECT_PAYMENT_KEY_PREFIX.concat(getTenantId().toString()));
|
redisUtil.delete(SELECT_PAYMENT_KEY_PREFIX.concat(getTenantId().toString()));
|
||||||
return success("清除成功");
|
return success("清除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.gxwebsoft.common.core.web.PageResult;
|
|||||||
import com.gxwebsoft.cms.entity.CmsWebsite;
|
import com.gxwebsoft.cms.entity.CmsWebsite;
|
||||||
import com.gxwebsoft.cms.param.CmsWebsiteParam;
|
import com.gxwebsoft.cms.param.CmsWebsiteParam;
|
||||||
import com.gxwebsoft.cms.vo.CmsVO;
|
import com.gxwebsoft.cms.vo.CmsVO;
|
||||||
|
import com.gxwebsoft.shop.vo.ShopVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ public interface CmsWebsiteService extends IService<CmsWebsite> {
|
|||||||
* @param tenantId 租户ID
|
* @param tenantId 租户ID
|
||||||
* @return 网站信息VO
|
* @return 网站信息VO
|
||||||
*/
|
*/
|
||||||
CmsVO getSiteInfo(Integer tenantId);
|
ShopVo getSiteInfo(Integer tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除网站信息缓存
|
* 清除网站信息缓存
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.gxwebsoft.common.system.service.CompanyService;
|
|||||||
import com.gxwebsoft.common.system.service.UserService;
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
import com.gxwebsoft.project.entity.Project;
|
import com.gxwebsoft.project.entity.Project;
|
||||||
import com.gxwebsoft.project.service.ProjectService;
|
import com.gxwebsoft.project.service.ProjectService;
|
||||||
|
import com.gxwebsoft.shop.vo.ShopVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -313,7 +314,7 @@ public class CmsWebsiteServiceImpl extends ServiceImpl<CmsWebsiteMapper, CmsWebs
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CmsVO getSiteInfo(Integer tenantId) {
|
public ShopVo getSiteInfo(Integer tenantId) {
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if (ObjectUtil.isEmpty(tenantId)) {
|
if (ObjectUtil.isEmpty(tenantId)) {
|
||||||
throw new IllegalArgumentException("租户ID不能为空");
|
throw new IllegalArgumentException("租户ID不能为空");
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.gxwebsoft.common.core.controller;
|
|
||||||
|
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试控制器
|
|
||||||
* 用于测试LocalDateTime序列化
|
|
||||||
*
|
|
||||||
* @author WebSoft
|
|
||||||
* @since 2025-01-12
|
|
||||||
*/
|
|
||||||
@Tag(name = "测试接口")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/test")
|
|
||||||
public class TestController extends BaseController {
|
|
||||||
|
|
||||||
@Operation(summary = "测试LocalDateTime序列化")
|
|
||||||
@GetMapping("/datetime")
|
|
||||||
public ApiResult<Map<String, Object>> testDateTime() {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("currentTime", LocalDateTime.now());
|
|
||||||
result.put("message", "LocalDateTime序列化测试");
|
|
||||||
return success(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
package com.gxwebsoft.common.core.controller;
|
|
||||||
|
|
||||||
import com.gxwebsoft.common.core.utils.WechatCertAutoConfig;
|
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
|
||||||
import com.wechat.pay.java.core.Config;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付证书自动配置测试控制器
|
|
||||||
*
|
|
||||||
* @author 科技小王子
|
|
||||||
* @since 2024-07-26
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/wechat-cert-test")
|
|
||||||
@Tag(name = "微信支付证书自动配置测试")
|
|
||||||
public class WechatCertTestController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WechatCertAutoConfig wechatCertAutoConfig;
|
|
||||||
|
|
||||||
@Operation(summary = "测试默认开发环境证书配置")
|
|
||||||
@PostMapping("/test-default")
|
|
||||||
public ApiResult<Map<String, Object>> testDefaultConfig() {
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
log.info("开始测试默认开发环境证书配置...");
|
|
||||||
|
|
||||||
// 创建自动证书配置
|
|
||||||
Config config = wechatCertAutoConfig.createDefaultDevConfig();
|
|
||||||
|
|
||||||
// 测试配置
|
|
||||||
boolean testResult = wechatCertAutoConfig.testConfig(config);
|
|
||||||
|
|
||||||
result.put("success", true);
|
|
||||||
result.put("configCreated", config != null);
|
|
||||||
result.put("testPassed", testResult);
|
|
||||||
result.put("message", "默认证书配置测试完成");
|
|
||||||
result.put("instructions", wechatCertAutoConfig.getUsageInstructions());
|
|
||||||
|
|
||||||
log.info("✅ 默认证书配置测试成功");
|
|
||||||
return success("测试成功", result);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("❌ 默认证书配置测试失败: {}", e.getMessage(), e);
|
|
||||||
|
|
||||||
result.put("success", false);
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
result.put("message", "证书配置测试失败");
|
|
||||||
result.put("troubleshooting", getTroubleshootingInfo());
|
|
||||||
|
|
||||||
return fail("测试失败: " + e.getMessage(), result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "测试自定义证书配置")
|
|
||||||
@PostMapping("/test-custom")
|
|
||||||
public ApiResult<Map<String, Object>> testCustomConfig(
|
|
||||||
@Parameter(description = "商户号") @RequestParam String merchantId,
|
|
||||||
@Parameter(description = "私钥文件路径") @RequestParam String privateKeyPath,
|
|
||||||
@Parameter(description = "证书序列号") @RequestParam String merchantSerialNumber,
|
|
||||||
@Parameter(description = "APIv3密钥") @RequestParam String apiV3Key) {
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
log.info("开始测试自定义证书配置...");
|
|
||||||
log.info("商户号: {}", merchantId);
|
|
||||||
log.info("私钥路径: {}", privateKeyPath);
|
|
||||||
|
|
||||||
// 创建自动证书配置
|
|
||||||
Config config = wechatCertAutoConfig.createAutoConfig(
|
|
||||||
merchantId, privateKeyPath, merchantSerialNumber, apiV3Key);
|
|
||||||
|
|
||||||
// 测试配置
|
|
||||||
boolean testResult = wechatCertAutoConfig.testConfig(config);
|
|
||||||
|
|
||||||
result.put("success", true);
|
|
||||||
result.put("configCreated", config != null);
|
|
||||||
result.put("testPassed", testResult);
|
|
||||||
result.put("message", "自定义证书配置测试完成");
|
|
||||||
result.put("merchantId", merchantId);
|
|
||||||
result.put("privateKeyPath", privateKeyPath);
|
|
||||||
|
|
||||||
log.info("✅ 自定义证书配置测试成功");
|
|
||||||
return success("测试成功", result);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("❌ 自定义证书配置测试失败: {}", e.getMessage(), e);
|
|
||||||
|
|
||||||
result.put("success", false);
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
result.put("message", "证书配置测试失败");
|
|
||||||
result.put("troubleshooting", getTroubleshootingInfo());
|
|
||||||
|
|
||||||
return fail("测试失败: " + e.getMessage(), result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "获取使用说明")
|
|
||||||
@GetMapping("/instructions")
|
|
||||||
public ApiResult<String> getInstructions() {
|
|
||||||
String instructions = wechatCertAutoConfig.getUsageInstructions();
|
|
||||||
return success("获取使用说明成功", instructions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "获取故障排除信息")
|
|
||||||
@GetMapping("/troubleshooting")
|
|
||||||
public ApiResult<Map<String, Object>> getTroubleshooting() {
|
|
||||||
Map<String, Object> troubleshooting = getTroubleshootingInfo();
|
|
||||||
return success("获取故障排除信息成功", troubleshooting);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取故障排除信息
|
|
||||||
*/
|
|
||||||
private Map<String, Object> getTroubleshootingInfo() {
|
|
||||||
Map<String, Object> info = new HashMap<>();
|
|
||||||
|
|
||||||
info.put("commonIssues", Map.of(
|
|
||||||
"404错误", "商户平台未开启API安全功能或未申请使用微信支付公钥",
|
|
||||||
"证书序列号错误", "请检查商户平台中的证书序列号是否正确",
|
|
||||||
"APIv3密钥错误", "请确认APIv3密钥是否正确设置",
|
|
||||||
"私钥文件不存在", "请检查私钥文件路径是否正确",
|
|
||||||
"网络连接问题", "请检查网络连接是否正常"
|
|
||||||
));
|
|
||||||
|
|
||||||
info.put("solutions", Map.of(
|
|
||||||
"开启API安全", "登录微信商户平台 -> 账户中心 -> API安全 -> 申请使用微信支付公钥",
|
|
||||||
"获取证书序列号", "在API安全页面查看或重新下载证书",
|
|
||||||
"设置APIv3密钥", "在API安全页面设置APIv3密钥",
|
|
||||||
"检查私钥文件", "确保apiclient_key.pem文件存在且路径正确"
|
|
||||||
));
|
|
||||||
|
|
||||||
info.put("advantages", Map.of(
|
|
||||||
"自动下载", "RSAAutoCertificateConfig会自动下载平台证书",
|
|
||||||
"自动更新", "证书过期时会自动更新",
|
|
||||||
"简化管理", "无需手动管理wechatpay_cert.pem文件",
|
|
||||||
"官方推荐", "微信支付官方推荐的证书管理方式"
|
|
||||||
));
|
|
||||||
|
|
||||||
info.put("documentation", "https://pay.weixin.qq.com/doc/v3/merchant/4012153196");
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "检查商户平台配置状态")
|
|
||||||
@PostMapping("/check-merchant-config")
|
|
||||||
public ApiResult<Map<String, Object>> checkMerchantConfig(
|
|
||||||
@RequestParam String merchantId,
|
|
||||||
@RequestParam String privateKeyPath,
|
|
||||||
@RequestParam String merchantSerialNumber,
|
|
||||||
@RequestParam String apiV3Key) {
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
log.info("开始检查商户平台配置状态...");
|
|
||||||
log.info("商户号: {}", merchantId);
|
|
||||||
|
|
||||||
// 尝试创建自动证书配置
|
|
||||||
Config config = wechatCertAutoConfig.createAutoConfig(
|
|
||||||
merchantId, privateKeyPath, merchantSerialNumber, apiV3Key);
|
|
||||||
|
|
||||||
result.put("success", true);
|
|
||||||
result.put("configCreated", true);
|
|
||||||
result.put("message", "商户平台配置正常,自动证书配置创建成功");
|
|
||||||
result.put("merchantId", merchantId);
|
|
||||||
result.put("recommendation", "配置正常,可以正常使用微信支付功能");
|
|
||||||
|
|
||||||
log.info("✅ 商户平台配置检查成功");
|
|
||||||
return success("配置检查成功", result);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("❌ 商户平台配置检查失败: {}", e.getMessage(), e);
|
|
||||||
|
|
||||||
result.put("success", false);
|
|
||||||
result.put("configCreated", false);
|
|
||||||
result.put("error", e.getMessage());
|
|
||||||
result.put("merchantId", merchantId);
|
|
||||||
|
|
||||||
// 分析错误类型并提供解决方案
|
|
||||||
if (e.getMessage().contains("404") || e.getMessage().contains("RESOURCE_NOT_EXISTS")) {
|
|
||||||
result.put("errorType", "商户平台配置问题");
|
|
||||||
result.put("solution", "请在微信支付商户平台完成以下配置:\n" +
|
|
||||||
"1. 登录商户平台:https://pay.weixin.qq.com/\n" +
|
|
||||||
"2. 进入:产品中心 → 开发配置 → API安全\n" +
|
|
||||||
"3. 申请API证书\n" +
|
|
||||||
"4. 申请使用微信支付公钥\n" +
|
|
||||||
"5. 确保API证书和微信支付公钥状态为\"已生效\"");
|
|
||||||
result.put("documentUrl", "https://pay.weixin.qq.com/doc/v3/merchant/4012153196");
|
|
||||||
} else {
|
|
||||||
result.put("errorType", "其他配置问题");
|
|
||||||
result.put("solution", "请检查商户号、证书序列号、API密钥等配置是否正确");
|
|
||||||
}
|
|
||||||
|
|
||||||
return success("配置检查完成(发现问题)", result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -74,8 +74,8 @@ public class SecurityConfig {
|
|||||||
"/api/shop/merchant-account/getMerchantAccountByPhone",
|
"/api/shop/merchant-account/getMerchantAccountByPhone",
|
||||||
"/api/hjm/hjm-car/**",
|
"/api/hjm/hjm-car/**",
|
||||||
"/api/chat/**",
|
"/api/chat/**",
|
||||||
"/api/shop/shop-order/test",
|
"/api/shop/getShopInfo",
|
||||||
"/api/cms/getSiteInfo"
|
"/api/shop/shop-order/test"
|
||||||
)
|
)
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
package com.gxwebsoft.common.task;
|
|
||||||
|
|
||||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
|
||||||
import com.gxwebsoft.common.system.service.UserRoleService;
|
|
||||||
import com.gxwebsoft.common.system.service.UserService;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务
|
|
||||||
*
|
|
||||||
* @author 科技小王子
|
|
||||||
* @since 2022-12-15 19:11:07
|
|
||||||
*/
|
|
||||||
@Tag(name = "定时任务")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/love/scheduling")
|
|
||||||
public class AddUserTaskController extends BaseController {
|
|
||||||
@Resource
|
|
||||||
private RequestUtil requestUtil;
|
|
||||||
@Resource
|
|
||||||
private UserRoleService userRoleService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模拟注册用户
|
|
||||||
* @Scheduled(fixedDelay = 1000, initialDelay = 1000)
|
|
||||||
*/
|
|
||||||
@Scheduled(fixedDelay = 1000, initialDelay = 1000)
|
|
||||||
public void addUserProfile() {
|
|
||||||
// final User userId = requestUtil.getCoreUserInfoByUserId(27344);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.gxwebsoft.cms.service.CmsWebsiteService;
|
||||||
|
import com.gxwebsoft.cms.vo.CmsVO;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.shop.vo.ShopVo;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城主入口
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-09-10 20:36:14
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "商城")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/shop")
|
||||||
|
public class ShopMainController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private CmsWebsiteService cmsWebsiteService;
|
||||||
|
|
||||||
|
@Operation(summary = "商城基本信息", description = "获取商城的基本信息,包括配置、导航、设置和过期状态等")
|
||||||
|
@GetMapping("/getShopInfo")
|
||||||
|
public ApiResult<ShopVo> getSiteInfo() {
|
||||||
|
Integer tenantId = getTenantId();
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(tenantId)) {
|
||||||
|
return fail("租户ID不能为空", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ShopVo vo = cmsWebsiteService.getSiteInfo(tenantId);
|
||||||
|
return success(vo);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return fail(e.getMessage(), null);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return fail(e.getMessage(), null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取商城信息失败", e);
|
||||||
|
return fail("获取商城信息失败", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -122,7 +122,6 @@ public class ShopUserCouponController extends BaseController {
|
|||||||
return success("领取成功");
|
return success("领取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopUserCoupon:list')")
|
|
||||||
@Operation(summary = "分页查询用户优惠券")
|
@Operation(summary = "分页查询用户优惠券")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ShopUserCoupon>> page(ShopUserCouponParam param) {
|
public ApiResult<PageResult<ShopUserCoupon>> page(ShopUserCouponParam param) {
|
||||||
|
|||||||
55
src/main/java/com/gxwebsoft/shop/vo/MenuVo.java
Normal file
55
src/main/java/com/gxwebsoft/shop/vo/MenuVo.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package com.gxwebsoft.shop.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航信息视图对象
|
||||||
|
* 专门用于前端展示,只包含前端需要的字段
|
||||||
|
*
|
||||||
|
* @author WebSoft
|
||||||
|
* @since 2025-01-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "导航信息视图对象")
|
||||||
|
public class MenuVo implements Serializable {
|
||||||
|
|
||||||
|
@Schema(description = "导航ID")
|
||||||
|
private Integer navigationId;
|
||||||
|
|
||||||
|
@Schema(description = "导航名称")
|
||||||
|
private String navigationName;
|
||||||
|
|
||||||
|
@Schema(description = "导航链接")
|
||||||
|
private String navigationUrl;
|
||||||
|
|
||||||
|
@Schema(description = "导航图标")
|
||||||
|
private String navigationIcon;
|
||||||
|
|
||||||
|
@Schema(description = "导航颜色")
|
||||||
|
private String navigationColor;
|
||||||
|
|
||||||
|
@Schema(description = "父级ID")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Schema(description = "排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Schema(description = "是否隐藏 0显示 1隐藏")
|
||||||
|
private Integer hide;
|
||||||
|
|
||||||
|
@Schema(description = "位置 0顶部 1底部")
|
||||||
|
private Integer top;
|
||||||
|
|
||||||
|
@Schema(description = "打开方式 0当前窗口 1新窗口")
|
||||||
|
private Integer target;
|
||||||
|
|
||||||
|
@Schema(description = "导航类型")
|
||||||
|
private String navigationType;
|
||||||
|
|
||||||
|
@Schema(description = "子导航")
|
||||||
|
private List<MenuVo> children;
|
||||||
|
}
|
||||||
92
src/main/java/com/gxwebsoft/shop/vo/ShopVo.java
Normal file
92
src/main/java/com/gxwebsoft/shop/vo/ShopVo.java
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
package com.gxwebsoft.shop.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用信息
|
||||||
|
* 专门用于前端展示,只包含前端需要的字段
|
||||||
|
*
|
||||||
|
* @author WebSoft
|
||||||
|
* @since 2025-01-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "应用信息视图对象")
|
||||||
|
public class ShopVo implements Serializable {
|
||||||
|
|
||||||
|
@Schema(description = "应用ID")
|
||||||
|
private Integer appId;
|
||||||
|
|
||||||
|
@Schema(description = "应用名称")
|
||||||
|
private String appName;
|
||||||
|
|
||||||
|
@Schema(description = "应用介绍")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "网站关键词")
|
||||||
|
private String keywords;
|
||||||
|
|
||||||
|
@Schema(description = "应用编号")
|
||||||
|
private String appCode;
|
||||||
|
|
||||||
|
@Schema(description = "小程序二维码")
|
||||||
|
private String mpQrCode;
|
||||||
|
|
||||||
|
@Schema(description = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "LOGO")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
@Schema(description = "图标")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
@Schema(description = "域名")
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
@Schema(description = "运行状态 0未开通 1正常 2维护中 3违规关停")
|
||||||
|
private Integer running;
|
||||||
|
|
||||||
|
@Schema(description = "应用版本 10免费版 20授权版 30永久授权")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "服务到期时间")
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@Schema(description = "是否到期 -1已过期 1未过期")
|
||||||
|
private Integer expired;
|
||||||
|
|
||||||
|
@Schema(description = "剩余天数")
|
||||||
|
private Long expiredDays;
|
||||||
|
|
||||||
|
@Schema(description = "即将过期 0否 1是")
|
||||||
|
private Integer soon;
|
||||||
|
|
||||||
|
@Schema(description = "状态图标")
|
||||||
|
private String statusIcon;
|
||||||
|
|
||||||
|
@Schema(description = "状态文本")
|
||||||
|
private String statusText;
|
||||||
|
|
||||||
|
@Schema(description = "网站配置")
|
||||||
|
private Object config;
|
||||||
|
|
||||||
|
@Schema(description = "服务器时间信息")
|
||||||
|
private HashMap<String, Object> serverTime;
|
||||||
|
|
||||||
|
@Schema(description = "顶部导航")
|
||||||
|
private List<MenuVo> topNavs;
|
||||||
|
|
||||||
|
@Schema(description = "底部导航")
|
||||||
|
private List<MenuVo> bottomNavs;
|
||||||
|
|
||||||
|
@Schema(description = "网站设置")
|
||||||
|
private Object setting;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user