Commit 8c0d8956 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-data-cloud into developer
parents 390448d9 2e621477
......@@ -140,6 +140,9 @@ public class IndexDTO implements Serializable {
*/
private String optUserName;
private Integer indexGroupId;
private String indexGroupName;
public Integer getIndexId() {
return indexId;
}
......@@ -355,4 +358,20 @@ public class IndexDTO implements Serializable {
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public Integer getIndexGroupId() {
return indexGroupId;
}
public void setIndexGroupId(Integer indexGroupId) {
this.indexGroupId = indexGroupId;
}
public String getIndexGroupName() {
return indexGroupName;
}
public void setIndexGroupName(String indexGroupName) {
this.indexGroupName = indexGroupName;
}
}
package com.gic.cloud.qo;
import java.io.Serializable;
import java.util.List;
/**
* @author zhiwj
......@@ -14,6 +15,7 @@ public class IndexQO extends PageQO implements Serializable {
private String moduleId;
private Integer isAppIndex;
private String search;
private List<Integer> indexIdList;
public Integer getClassifyType() {
return classifyType;
......@@ -46,4 +48,12 @@ public class IndexQO extends PageQO implements Serializable {
public void setSearch(String search) {
this.search = search;
}
public void setIndexIdList(List<Integer> indexIdList) {
this.indexIdList = indexIdList;
}
public List<Integer> getIndexIdList() {
return indexIdList;
}
}
......@@ -24,7 +24,7 @@ public class IndexGroupController {
@Autowired
private IndexGroupApiService indexGroupApiService;
@RequestMapping("/saveIndexGroup")
@RequestMapping("/save-index-group")
public RestResponse saveIndexGroup(IndexGroupDTO indexGroupDTO) {
if (StringUtils.isBlank(indexGroupDTO.getIndexGroupName()) || indexGroupDTO.getParentId() == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
......@@ -33,7 +33,7 @@ public class IndexGroupController {
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/updateIndexGroup")
@RequestMapping("/update-index-group")
public RestResponse updateIndexGroup(IndexGroupDTO indexGroupDTO) {
if (StringUtils.isBlank(indexGroupDTO.getIndexGroupName()) || indexGroupDTO.getParentId() == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
......@@ -42,13 +42,13 @@ public class IndexGroupController {
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/treeIndexGroup")
@RequestMapping("/tree-index-group")
public RestResponse tree() {
ServiceResponse<List<IndexGroupDTO>> serviceResponse = indexGroupApiService.tree();
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/deleteIndexGroup")
@RequestMapping("/delete-index-group")
public RestResponse tree(Integer indexGroupId) {
ServiceResponse<Void> serviceResponse = indexGroupApiService.delete(indexGroupId);
return ResultControllerUtils.commonResult(serviceResponse);
......
......@@ -62,7 +62,9 @@ public interface TabIndexModuleRelMapper {
List<String> listModuleIdByBusinessId(@Param("businessId") Integer businessId, @Param("type") Integer type);
List<Integer> listBusinessIdByModuleId(@Param("moduleId") Integer moduleId);
List<Integer> listBusinessIdByModuleId(@Param("moduleId") String moduleId);
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
......@@ -12,7 +12,7 @@ public class TabIndex {
private Integer indexId;
/**
* 分类类型
* 分类类型 1指标 2维度 3说明
*/
private Integer classifyType;
......@@ -72,6 +72,11 @@ public class TabIndex {
private Integer decimalSize;
/**
*
*/
private Integer indexGroupId;
/**
* 数据类型 1流量 2存量
*/
private Integer dataType;
......@@ -235,6 +240,14 @@ public class TabIndex {
this.decimalSize = decimalSize;
}
public Integer getIndexGroupId() {
return indexGroupId;
}
public void setIndexGroupId(Integer indexGroupId) {
this.indexGroupId = indexGroupId;
}
public Integer getDataType() {
return dataType;
}
......
......@@ -13,7 +13,9 @@ public interface IndexModuleRelService {
List<String> listModuleIdByBusinessId(Integer indexId, Integer type);
List<Integer> listBusinessIdByModuleId(Integer moduleId);
List<Integer> listBusinessIdByModuleId(String moduleId);
List<Integer> listBusinessIdByModuleIds(List<String> moduleIdList);
void deleteByBusinessId(Integer businessId, Integer type);
......
......@@ -48,11 +48,16 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
}
@Override
public List<Integer> listBusinessIdByModuleId(Integer moduleId) {
public List<Integer> listBusinessIdByModuleId(String moduleId) {
return tabIndexModuleRelMapper.listBusinessIdByModuleId(moduleId);
}
@Override
public List<Integer> listBusinessIdByModuleIds(List<String> moduleIdList) {
return tabIndexModuleRelMapper.listBusinessIdByModuleIds(moduleIdList);
}
@Override
public void deleteByBusinessId(Integer businessId, Integer type) {
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
}
......
......@@ -4,13 +4,16 @@ import com.gic.cloud.dao.mapper.TabIndexMapper;
import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.entity.TabIndex;
import com.gic.cloud.qo.IndexQO;
import com.gic.cloud.service.IndexModuleRelService;
import com.gic.cloud.service.IndexService;
import com.gic.commons.util.EntityUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -24,6 +27,8 @@ public class IndexServiceImpl implements IndexService {
@Autowired
private TabIndexMapper tabIndexMapper;
@Autowired
private IndexModuleRelService indexModuleRelService;
@Override
public boolean isNameRepeat(String name, Integer indexId) {
......@@ -65,6 +70,10 @@ public class IndexServiceImpl implements IndexService {
@Override
public Page<TabIndex> listIndex(IndexQO indexQO) {
PageHelper.startPage(indexQO.getCurrentPage(), indexQO.getPageSize());
if (StringUtils.isNotBlank(indexQO.getModuleId())) {
List<Integer> indexIdList = indexModuleRelService.listBusinessIdByModuleIds(Arrays.asList(indexQO.getModuleId().split(",")));
indexQO.setIndexIdList(indexIdList);
}
return tabIndexMapper.listIndex(indexQO);
}
......
......@@ -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());
......
......@@ -49,7 +49,7 @@ public class IndexGroupApiServiceImpl implements IndexGroupApiService {
}
TabIndexGroup parentIndexGroup = indexGroupService.getById(indexGroupDTO.getParentId());
indexGroupDTO.setGroupChain(parentIndexGroup.getGroupChain() + "_" + indexGroupDTO.getIndexGroupId() + "_");
indexGroupDTO.setGroupChain(parentIndexGroup.getGroupChain() + indexGroupDTO.getIndexGroupId() + "_");
indexGroupService.update(indexGroupDTO);
return ServiceResponse.success();
......
......@@ -15,6 +15,7 @@
<result column="unit_code" jdbcType="INTEGER" property="unitCode" />
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
<result column="decimal_size" jdbcType="INTEGER" property="decimalSize" />
<result column="index_group_id" jdbcType="INTEGER" property="indexGroupId" />
<result column="data_type" jdbcType="INTEGER" property="dataType" />
<result column="index_type" jdbcType="INTEGER" property="indexType" />
<result column="base_organized" jdbcType="VARCHAR" property="baseOrganized" />
......@@ -31,8 +32,8 @@
<sql id="Base_Column_List">
index_id, classify_type, classify_name, is_app_index, rel_app_index, code, name,
index_level, index_level_name, rel_top_level, unit_code, unit_name, decimal_size,
data_type, index_type, base_organized, base_time, update_rate, update_rate_remark,
index_remark, `show_status`, complement, create_time, update_time, status
index_group_id, data_type, index_type, base_organized, base_time, update_rate, update_rate_remark,
index_remark, show_status, complement, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -49,20 +50,20 @@
is_app_index, rel_app_index, code,
name, index_level, index_level_name,
rel_top_level, unit_code, unit_name,
decimal_size, data_type, index_type,
base_organized, base_time, update_rate,
update_rate_remark, index_remark, `show_status`,
complement, create_time, update_time,
status)
decimal_size, index_group_id, data_type,
index_type, base_organized, base_time,
update_rate, update_rate_remark, index_remark,
show_status, complement, create_time,
update_time, status)
values (#{indexId,jdbcType=INTEGER}, #{classifyType,jdbcType=INTEGER}, #{classifyName,jdbcType=VARCHAR},
#{isAppIndex,jdbcType=INTEGER}, #{relAppIndex,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{indexLevel,jdbcType=INTEGER}, #{indexLevelName,jdbcType=VARCHAR},
#{relTopLevel,jdbcType=VARCHAR}, #{unitCode,jdbcType=INTEGER}, #{unitName,jdbcType=VARCHAR},
#{decimalSize,jdbcType=INTEGER}, #{dataType,jdbcType=INTEGER}, #{indexType,jdbcType=INTEGER},
#{baseOrganized,jdbcType=VARCHAR}, #{baseTime,jdbcType=VARCHAR}, #{updateRate,jdbcType=VARCHAR},
#{updateRateRemark,jdbcType=VARCHAR}, #{indexRemark,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER},
#{complement,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
#{decimalSize,jdbcType=INTEGER}, #{indexGroupId,jdbcType=INTEGER}, #{dataType,jdbcType=INTEGER},
#{indexType,jdbcType=INTEGER}, #{baseOrganized,jdbcType=VARCHAR}, #{baseTime,jdbcType=VARCHAR},
#{updateRate,jdbcType=VARCHAR}, #{updateRateRemark,jdbcType=VARCHAR}, #{indexRemark,jdbcType=VARCHAR},
#{showStatus,jdbcType=INTEGER}, #{complement,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabIndex">
<selectKey keyProperty="indexId" order="AFTER" resultType="java.lang.Integer">
......@@ -109,6 +110,9 @@
<if test="decimalSize != null">
decimal_size,
</if>
<if test="indexGroupId != null">
index_group_id,
</if>
<if test="dataType != null">
data_type,
</if>
......@@ -186,6 +190,9 @@
<if test="decimalSize != null">
#{decimalSize,jdbcType=INTEGER},
</if>
<if test="indexGroupId != null">
#{indexGroupId,jdbcType=INTEGER},
</if>
<if test="dataType != null">
#{dataType,jdbcType=INTEGER},
</if>
......@@ -263,6 +270,9 @@
<if test="decimalSize != null">
decimal_size = #{decimalSize,jdbcType=INTEGER},
</if>
<if test="indexGroupId != null">
index_group_id = #{indexGroupId,jdbcType=INTEGER},
</if>
<if test="dataType != null">
data_type = #{dataType,jdbcType=INTEGER},
</if>
......@@ -316,6 +326,7 @@
unit_code = #{unitCode,jdbcType=INTEGER},
unit_name = #{unitName,jdbcType=VARCHAR},
decimal_size = #{decimalSize,jdbcType=INTEGER},
index_group_id = #{indexGroupId,jdbcType=INTEGER},
data_type = #{dataType,jdbcType=INTEGER},
index_type = #{indexType,jdbcType=INTEGER},
base_organized = #{baseOrganized,jdbcType=VARCHAR},
......@@ -358,15 +369,18 @@
<if test="classifyType != null ">
and classify_type = #{classifyType}
</if>
<if test="moduleId != null ">
and module_id = #{moduleId}
</if>
<if test="isAppIndex != null ">
and is_app_index = #{isAppIndex}
</if>
<if test="search != null and search != '' ">
and name like concat('%', #{search}, '%')
</if>
<if test="null != indexIdList and indexIdList.size > 0">
and index_id in
<foreach collection="indexIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -168,6 +168,18 @@
from tab_index_module_rel
where status = 1 and module_id = #{moduleId}
</select>
<select id="listBusinessIdByModuleIds" resultType="int">
select
module_id
from tab_index_module_rel
where status = 1
<if test="null != ids and ids.size > 0">
and module_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="listModuleIdByBusinessIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......
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