Commit f92de300 authored by 赵啸非's avatar 赵啸非

添加主题缓存

parent 3b217b2d
...@@ -26,12 +26,10 @@ import com.mortals.xhx.module.site.model.SiteThemeEntity; ...@@ -26,12 +26,10 @@ import com.mortals.xhx.module.site.model.SiteThemeEntity;
import com.mortals.xhx.module.site.service.SiteThemeService; import com.mortals.xhx.module.site.service.SiteThemeService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
...@@ -62,25 +60,21 @@ public class SiteThemeController extends BaseCRUDJsonBodyMappingController<SiteT ...@@ -62,25 +60,21 @@ public class SiteThemeController extends BaseCRUDJsonBodyMappingController<SiteT
/** /**
* 根据站点id获取当前站点主题 * 根据站点id获取当前站点主题
*/ */
@PostMapping(value = "site") @PostMapping(value = "getThemeBySite")
@UnAuth @UnAuth
public String getThemeCacheBySite(@RequestBody SiteThemeEntity site) { public String getThemeCacheBySite(@RequestBody SiteThemeEntity site) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String busiDesc = "根据站点id获取当前站点主题列表" + this.getModuleDesc(); String busiDesc = "根据站点id获取当前站点主题列表" + this.getModuleDesc();
try { try {
if(ObjectUtils.isEmpty(site.getSiteId())) throw new AppException("站点id不能为空!");
if(ObjectUtils.isEmpty(site.getSiteId())) if(ObjectUtils.isEmpty(site.getUserType())) throw new AppException("服务类型不能为空!");
throw new AppException("站点id不能为空!");
if(ObjectUtils.isEmpty(site.getUserType()))
throw new AppException("服务类型不能为空!");
String jsonstr = cacheService.hget(RedisCacheKeys.getSiteUserTypeThemeCodeKey() + site.getSiteId(), site.getUserType(), String.class); String jsonstr = cacheService.hget(RedisCacheKeys.getSiteUserTypeThemeCodeKey() + site.getSiteId(), site.getUserType(), String.class);
List<SiteThemeEntity> siteThemeEntities = JSON.parseObject(jsonstr, new TypeReference<List<SiteThemeEntity>>() {});
List<SiteThemeEntity> siteThemeEntities = JSON.parseObject(jsonstr, new TypeReference<List<SiteThemeEntity>>() { if(ObjectUtils.isEmpty(siteThemeEntities)){
}); jsonObject.put(KEY_RESULT_DATA, new ArrayList<SiteThemeEntity>());
}else{
jsonObject.put(KEY_RESULT_DATA, siteThemeEntities); jsonObject.put(KEY_RESULT_DATA, siteThemeEntities);
}
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "根据站点id获取当前站点主题列表成功!"); jsonObject.put(KEY_RESULT_MSG, "根据站点id获取当前站点主题列表成功!");
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
......
...@@ -13,14 +13,15 @@ client.global.set("SmsSet_id", JSON.parse(response.body).data.id); ...@@ -13,14 +13,15 @@ client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token); client.global.set("authToken", JSON.parse(response.body).data.token);
%} %}
###主题列表
POST {{baseUrl}}/site/theme/list
###主题站点
POST {{baseUrl}}/site/theme/site
Content-Type: application/json Content-Type: application/json
{ {
"siteId":22, "siteId":1,
"page":1, "userType":4
"size":10
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment