Commit 639e06c1 authored by 赵啸非's avatar 赵啸非

添加站点模块列表

parent 1988087b
package com.mortals.xhx.module.site.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.model.model.ModelEntity;
import com.mortals.xhx.module.site.model.SiteEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 站点视图对象
*
* @author zxfei
* @date 2022-01-12
*/
* 站点视图对象
*
* @author zxfei
* @date 2022-01-12
*/
@Data
public class SiteVo extends BaseEntityLong {
private List<Long> idList;
private String logoFullPath;
/**
* 模块列表
*/
private List<ModelEntity> modelList;
}
\ No newline at end of file
......@@ -6,24 +6,22 @@ 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;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.model.model.ModelEntity;
import com.mortals.xhx.module.model.service.ModelService;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import lombok.Getter;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.service.SiteService;
import org.springframework.util.ObjectUtils;
import java.util.*;
......@@ -50,6 +48,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Autowired
private AreaService areaService;
@Autowired
private ModelService modelService;
@Override
protected void validData(SiteEntity entity, Context context) throws AppException {
......@@ -209,7 +209,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw new AppException(String.format("区域不存在!区域编码:%s", areaCode));
}
List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site->changeUrlPath(site)).collect(Collectors.toList());
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;
......@@ -233,7 +233,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw new AppException(String.format("区域不存在!区域编码:%s", siteCache.getAreaCode()));
}
List<SiteEntity> siteEntities = this.find(new SiteQuery()).stream().peek(site->changeUrlPath(site)).collect(Collectors.toList());;
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;
......@@ -268,9 +269,10 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
protected void findAfter(SiteEntity params, PageInfo pageInfo, Context context, List<SiteEntity> list) throws AppException {
list.stream().forEach(site->changeUrlPath(site));
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())) {
......@@ -278,5 +280,10 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
String fullPath = URLUtil.completeUrl(domain, siteEntity.getLogoPath());
siteEntity.setLogoFullPath(fullPath);
}
if (!ObjectUtils.isEmpty(siteEntity) && !ObjectUtils.isEmpty(siteEntity.getModelIds())) {
List<ModelEntity> collect = Arrays.asList(siteEntity.getModelIds().split(",")).stream().map(modelId -> modelService.get(Long.parseLong(modelId))).collect(Collectors.toList());
siteEntity.setModelList(collect);
}
}
}
\ No newline at end of file
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