Commit 75d9b1ac by zhiwj

修改bug

parent ca8a5cb3
......@@ -141,6 +141,7 @@ public class IndexDTO implements Serializable {
private String optUserName;
private Integer indexGroupId;
private String indexGroupName;
public Integer getIndexId() {
return indexId;
......@@ -365,4 +366,12 @@ public class IndexDTO implements Serializable {
public void setIndexGroupId(Integer indexGroupId) {
this.indexGroupId = indexGroupId;
}
public String getIndexGroupName() {
return indexGroupName;
}
public void setIndexGroupName(String indexGroupName) {
this.indexGroupName = indexGroupName;
}
}
......@@ -64,7 +64,7 @@ public interface TabIndexModuleRelMapper {
List<Integer> listBusinessIdByModuleId(@Param("moduleId") String moduleId);
List<Integer> listBusinessIdByModuleIds(@Param("moduleIdList") List<String> moduleIdList);
List<Integer> listBusinessIdByModuleIds(@Param("ids") List<String> moduleIdList);
List<TabIndexModuleRel> listModuleIdByBusinessIds(@Param("ids") List<Integer> businessIdList, @Param("type") Integer type);
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.gic.cloud.constants.LogAndUpdateTipsTypeEnum;
import com.gic.cloud.constants.UpdateTypeEnum;
import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.entity.TabIndex;
import com.gic.cloud.entity.TabIndexGroup;
import com.gic.cloud.qo.IndexQO;
import com.gic.cloud.service.*;
import com.gic.commons.util.EntityUtil;
......@@ -13,9 +14,11 @@ import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -36,6 +39,8 @@ public class IndexApiServiceImpl implements IndexApiService {
private IndexModuleRelService indexModuleRelService;
@Autowired
private UpdateTipService updateTipService;
@Autowired
private IndexGroupService indexGroupService;
@Override
public ServiceResponse<Void> saveIndex(IndexDTO indexDTO) {
......@@ -102,13 +107,30 @@ public class IndexApiServiceImpl implements IndexApiService {
List<Integer> indexIdList = indexList.stream().map(TabIndex::getIndexId).collect(Collectors.toList());
Map<Integer, List<String>> moduleIdByBusinessIdMap = indexModuleRelService.groupModuleIdByBusinessIds(indexIdList, LogAndUpdateTipsTypeEnum.INDEX.getCode());
List<IndexDTO> indexDTOList = indexDTOPage.getResult();
HashMap<Integer, String> cache = new HashMap<>();
for (IndexDTO indexDTO : indexDTOList) {
indexDTO.setRelModuleIdList(moduleIdByBusinessIdMap.get(indexDTO.getIndexId()));
Integer indexGroupId = indexDTO.getIndexGroupId();
if (indexGroupId != null) {
indexDTO.setIndexGroupName(getIndexGroupName(cache, indexGroupId));
}
}
}
return EnterpriseServiceResponse.success(indexDTOPage);
}
private String getIndexGroupName(HashMap<Integer, String> cache, Integer indexGroupId) {
String indexGroupName = cache.get(indexGroupId);
if (StringUtils.isNotBlank(indexGroupName)) {
return indexGroupName;
}
TabIndexGroup indexGroup = indexGroupService.getById(indexGroupId);
// List<Integer> indexGroupId = Stream.of(indexGroup.getGroupChain().split("_")).map(Integer::valueOf).collect(Collectors.toList());
return null;
}
@Override
public ServiceResponse<List<IndexDTO>> listAllIndex() {
List<TabIndex> tabIndices = indexService.listAllIndex(new IndexQO());
......
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