Commit e2354536 authored by 廖旭伟's avatar 廖旭伟

应用列表接口增加host

parent 36935a31
......@@ -38,7 +38,7 @@ public interface SstAppsService extends ICRUDService<SstAppsEntity,Long>{
* @param siteId 站点ID
* @return
*/
Map<String, Object> getAppListBySite(Long siteId);
Map<String, Object> getAppListBySite(Long siteId,String host);
/**
* 应用下架
......
......@@ -139,7 +139,7 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
}
@Override
public Map<String, Object> getAppListBySite(Long siteId) {
public Map<String, Object> getAppListBySite(Long siteId,String host) {
SstAppsEntity query = new SstAppsEntity();
Map<String,String> orderCols = new HashMap<>();
orderCols.put("basicSort","DESC");
......@@ -150,6 +150,11 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
AppsInfoEntity appsInfoQuery = new AppsInfoEntity();
appsInfoQuery.setSiteId(siteId);
List<AppsInfoEntity> allApps = appsInfoService.find(appsInfoQuery);
for(AppsInfoEntity appsInfoEntity:allApps){
if(com.mortals.framework.util.StringUtils.isNotEmpty(host)) {
appsInfoEntity.setCustUrl(host + "/" + appsInfoEntity.getCustUrl());
}
}
Map<Long,AppsInfoEntity> appInfoMap = allApps.stream().collect(Collectors.toMap(AppsInfoEntity::getId, Function.identity()));
Map<String, Object> siteApp = new HashMap<>();
siteApp.put("allApps", allApps);
......
package com.mortals.xhx.module.sst.web;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
......@@ -16,6 +19,7 @@ import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.sst.model.SstAppsEntity;
import com.mortals.xhx.module.sst.service.SstAppsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -217,7 +221,16 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
String busiDesc = "查询自助终端应用展示数据" ;
int code=1;
try {
Map<String, Object> sstApps = sstAppsService.getAppListBySite(query.getSiteId());
String host = "";
String serverName = request.getHeader("server-name");
Integer serverPort = DataUtil.converStr2Int(request.getHeader("server-port"),0);
if (!ObjectUtils.isEmpty(serverName) && Validator.isIpv4(serverName)) {
host = UrlBuilder.ofHttp(serverName).setPort(serverPort > 0 ? serverPort : 11078).build();
host = StrUtil.sub(host, 0, host.length() - 1);
}else {
host="";
}
Map<String, Object> sstApps = sstAppsService.getAppListBySite(query.getSiteId(),host);
model.put("showApps", sstApps.get("showApps"));
model.put("hotApps", sstApps.get("hotApps"));
model.put("allApps", sstApps.get("allApps"));
......
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