Commit 1988087b authored by 赵啸非's avatar 赵啸非

添加站点logofullPath全路径

parent 90b63ba0
......@@ -906,6 +906,7 @@ data|object|数据对象|-
  building|Integer|楼栋|-
  modelIds|String|部署模块,逗号分隔|-
  logoPath|String|设备logo地址
  logoFullPath|String|设备logo全地址
  englishName|String|站点英文名称
  createTime|Date|创建时间|-
  createUserId|Long|创建用户|-
......@@ -1075,6 +1076,7 @@ data|object|数据对象|-
 level|Integer|楼层|-
 building|Integer|楼栋|-
 logoPath|String|设备logo地址
 logoFullPath|String|设备logo全地址
 englishName|String|站点英文名称
 modelIds|String|部署模块,逗号分隔|-
 createTime|Date|创建时间|-
......
......@@ -63,4 +63,11 @@ public final class Constant {
public final static String BASEMANAGER_VERSION = "Z-BASE.MANAGER-S1.0.0";
/**
* 服务器http
*/
public final static String PARAM_SERVER_HTTP_IMAGE_URL = "server_http_image_url";
}
package com.mortals.xhx.module.site.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.site.model.vo.SiteVo;
import java.util.Date;
/**
* 站点实体对象
*
......
......@@ -25,6 +25,11 @@ public class SiteTreeSelect implements Serializable {
*/
private String id;
/**
* 站点编码
*/
private String siteCode;
/**
* 节点名称
*/
......@@ -76,6 +81,7 @@ public class SiteTreeSelect implements Serializable {
if (!ObjectUtils.isEmpty(collect)) {
this.id = collect.stream().map(item -> item.getId().toString()).collect(Collectors.joining(","));
this.label = collect.stream().map(item -> item.getSiteName()).collect(Collectors.joining(","));
this.siteCode = collect.stream().map(item -> item.getSiteCode()).collect(Collectors.joining(","));
this.type = "site";
this.icon = "el-icon-document";
} else {
......
......@@ -14,4 +14,8 @@ import java.util.List;
@Data
public class SiteVo extends BaseEntityLong {
private List<Long> idList;
private String logoFullPath;
}
\ No newline at end of file
......@@ -59,4 +59,5 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
void setSiteTree(List<SiteTreeSelect> list, Context context);
void changeUrlPath(SiteEntity siteEntity);
}
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl;
import cn.hutool.core.util.URLUtil;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils;
......@@ -26,6 +29,8 @@ import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_IMAGE_URL;
/**
* SiteService
* 站点 service实现
......@@ -204,7 +209,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw new AppException(String.format("区域不存在!区域编码:%s", areaCode));
}
List<SiteEntity> siteEntities = this.find(new SiteQuery());
List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site->changeUrlPath(site)).collect(Collectors.toList());
for (SiteEntity siteEntity : siteEntities) {
boolean bool = getSite(areaCode, siteEntity.getAreaCode(), siteList, siteEntity);
if (bool) continue;
......@@ -228,7 +233,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw new AppException(String.format("区域不存在!区域编码:%s", siteCache.getAreaCode()));
}
List<SiteEntity> siteEntities = this.find(new SiteQuery());
List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site->changeUrlPath(site)).collect(Collectors.toList());;
for (SiteEntity siteEntity : siteEntities) {
boolean bool = getSite(siteCache.getAreaCode(), siteEntity.getAreaCode(), siteList, siteEntity);
if (bool) continue;
......@@ -259,4 +264,19 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
public void setSiteTree(List<SiteTreeSelect> list, Context context) {
siteTreeMap.put(context.getUser().getId(), list);
}
@Override
protected void findAfter(SiteEntity params, PageInfo pageInfo, Context context, List<SiteEntity> list) throws AppException {
list.stream().forEach(site->changeUrlPath(site));
super.findAfter(params, pageInfo, context, list);
}
@Override
public void changeUrlPath(SiteEntity siteEntity) {
if (!ObjectUtils.isEmpty(siteEntity) && !ObjectUtils.isEmpty(siteEntity.getLogoPath())) {
String domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_IMAGE_URL, "http://192.168.0.98:11091");
String fullPath = URLUtil.completeUrl(domain, siteEntity.getLogoPath());
siteEntity.setLogoFullPath(fullPath);
}
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.site.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -161,6 +162,13 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
return jsonObject.toJSONString();
}
@Override
protected int infoAfter(Long id, Map<String, Object> model, SiteEntity entity, Context context) throws AppException {
this.service.changeUrlPath(entity);
return super.infoAfter(id, model, entity, context);
}
public static void main(String[] args) {
//深度克隆
......
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