Commit 48aa07e9 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-data-cloud into developer
parents 24f5cf07 4242e9b8
......@@ -18,7 +18,7 @@ public class IndexDTO implements Serializable {
private Integer indexId;
/**
* 分类类型
* 分类类型 1指标 2维度 3说明
*/
private Integer classifyType;
......@@ -127,7 +127,9 @@ public class IndexDTO implements Serializable {
*/
private Date updateTime;
private List<Integer> relModuleIdList;
private Integer showStatus;
private List<String> relModuleIdList;
/**
* 操作人id
......@@ -322,11 +324,11 @@ public class IndexDTO implements Serializable {
this.updateTime = updateTime;
}
public List<Integer> getRelModuleIdList() {
public List<String> getRelModuleIdList() {
return relModuleIdList;
}
public void setRelModuleIdList(List<Integer> relModuleIdList) {
public void setRelModuleIdList(List<String> relModuleIdList) {
this.relModuleIdList = relModuleIdList;
}
......@@ -345,4 +347,12 @@ public class IndexDTO implements Serializable {
public void setOptUserName(String optUserName) {
this.optUserName = optUserName;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
}
......@@ -12,6 +12,7 @@ import com.gic.cloud.service.IndexLogApiService;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -34,8 +35,8 @@ public class IndexController {
@RequestMapping("/saveIndex")
public RestResponse saveIndex(IndexDTO indexDTO) {
if (indexDTO.getIsAppIndex() == null ||
public RestResponse saveIndex(IndexDTO indexDTO, String relModuleIds) {
if (indexDTO.getClassifyType() == null ||
StringUtils.isBlank(indexDTO.getCode()) ||
StringUtils.isBlank(indexDTO.getName()) ||
StringUtils.isBlank(indexDTO.getIndexRemark())) {
......@@ -44,6 +45,9 @@ public class IndexController {
UserDetailsVO user = UserUtils.getUser();
indexDTO.setOptUserId(user.getId());
indexDTO.setOptUserName(user.getRealName());
if (StringUtils.isNotBlank(relModuleIds)) {
indexDTO.setRelModuleIdList(Lists.newArrayList(relModuleIds.split(",")));
}
ServiceResponse<Void> serviceResponse = indexApiService.saveIndex(indexDTO);
return ResultControllerUtils.commonResult(serviceResponse);
}
......
......@@ -58,9 +58,9 @@ public interface TabIndexModuleRelMapper {
void insertSelectiveByNotExist(TabIndexModuleRel rel);
void updateStatusByBusinessIds(@Param("businessId") Integer businessId, @Param("ids") List<Integer> moduleIdList, @Param("type") Integer type);
void updateStatusByBusinessIds(@Param("businessId") Integer businessId, @Param("ids") List<String> moduleIdList, @Param("type") Integer type);
List<Integer> listModuleIdByBusinessId(@Param("businessId") Integer businessId, @Param("type") Integer type);
List<String> listModuleIdByBusinessId(@Param("businessId") Integer businessId, @Param("type") Integer type);
List<Integer> listBusinessIdByModuleId(@Param("moduleId") Integer moduleId);
......
......@@ -109,7 +109,7 @@ public class TabIndex {
/**
* 是否展示 1展示 0不展示
*/
private Integer show;
private Integer showStatus;
/**
* 补充说明
......@@ -291,12 +291,12 @@ public class TabIndex {
this.indexRemark = indexRemark;
}
public Integer getShow() {
return show;
public Integer getShowStatus() {
return showStatus;
}
public void setShow(Integer show) {
this.show = show;
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public String getComplement() {
......
......@@ -24,7 +24,7 @@ public class TabIndexModuleRel {
/**
* 模块的id
*/
private Integer moduleId;
private String moduleId;
/**
*
......@@ -65,11 +65,11 @@ public class TabIndexModuleRel {
this.businessId = businessId;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
......
......@@ -9,13 +9,13 @@ import java.util.Map;
* @date 2020-07-08 10:22
*/
public interface IndexModuleRelService {
void save(Integer indexId, List<Integer> moduleId, Integer type);
void save(Integer indexId, List<String> moduleId, Integer type);
List<Integer> listModuleIdByBusinessId(Integer indexId, Integer type);
List<String> listModuleIdByBusinessId(Integer indexId, Integer type);
List<Integer> listBusinessIdByModuleId(Integer moduleId);
void deleteByBusinessId(Integer businessId, Integer type);
Map<Integer, List<Integer>> groupModuleIdByBusinessIds(List<Integer> indexIdList, Integer type);
Map<Integer, List<String>> groupModuleIdByBusinessIds(List<Integer> indexIdList, Integer type);
}
......@@ -22,11 +22,11 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
@Override
public void save(Integer businessId, List<Integer> moduleIdList, Integer type) {
public void save(Integer businessId, List<String> moduleIdList, Integer type) {
// 把所有关联status设置为0
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
// 插入不存在的关联
for (Integer moduleId : moduleIdList) {
for (String moduleId : moduleIdList) {
TabIndexModuleRel rel = new TabIndexModuleRel();
rel.setType(type);
rel.setBusinessId(businessId);
......@@ -40,7 +40,7 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
}
@Override
public List<Integer> listModuleIdByBusinessId(Integer businessId, Integer type) {
public List<String> listModuleIdByBusinessId(Integer businessId, Integer type) {
return tabIndexModuleRelMapper.listModuleIdByBusinessId(businessId, type);
}
......@@ -55,10 +55,10 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
}
@Override
public Map<Integer, List<Integer>> groupModuleIdByBusinessIds(List<Integer> businessIdList, Integer type) {
public Map<Integer, List<String>> groupModuleIdByBusinessIds(List<Integer> businessIdList, Integer type) {
List<TabIndexModuleRel> relList = tabIndexModuleRelMapper.listModuleIdByBusinessIds(businessIdList, type);
return Optional.ofNullable(relList).orElse(Collections.emptyList()).stream()
.collect(Collectors.groupingBy(TabIndexModuleRel::getBusinessId,
Collectors.mapping(TabIndexModuleRel::getIndexModuleRelId, Collectors.toList())));
Collectors.mapping(TabIndexModuleRel::getModuleId, Collectors.toList())));
}
}
......@@ -89,7 +89,7 @@ public class IndexApiServiceImpl implements IndexApiService {
public ServiceResponse<IndexDTO> getByIndexId(Integer indexId) {
TabIndex index = this.indexService.getByIndexId(indexId);
IndexDTO indexDTO = EntityUtil.changeEntityByJSON(IndexDTO.class, index);
List<Integer> moduleIdList = this.indexModuleRelService.listModuleIdByBusinessId(indexDTO.getIndexId(), LogAndUpdateTipsTypeEnum.INDEX.getCode());
List<String> moduleIdList = this.indexModuleRelService.listModuleIdByBusinessId(indexDTO.getIndexId(), LogAndUpdateTipsTypeEnum.INDEX.getCode());
indexDTO.setRelModuleIdList(moduleIdList);
return EnterpriseServiceResponse.success(indexDTO);
}
......@@ -100,7 +100,7 @@ public class IndexApiServiceImpl implements IndexApiService {
Page<IndexDTO> indexDTOPage = PageHelperUtils.changePageHelperToCurrentPage(indexList, IndexDTO.class);
if (CollectionUtils.isNotEmpty(indexList)) {
List<Integer> indexIdList = indexList.stream().map(TabIndex::getIndexId).collect(Collectors.toList());
Map<Integer, List<Integer>> moduleIdByBusinessIdMap = indexModuleRelService.groupModuleIdByBusinessIds(indexIdList, LogAndUpdateTipsTypeEnum.INDEX.getCode());
Map<Integer, List<String>> moduleIdByBusinessIdMap = indexModuleRelService.groupModuleIdByBusinessIds(indexIdList, LogAndUpdateTipsTypeEnum.INDEX.getCode());
List<IndexDTO> indexDTOList = indexDTOPage.getResult();
for (IndexDTO indexDTO : indexDTOList) {
indexDTO.setRelModuleIdList(moduleIdByBusinessIdMap.get(indexDTO.getIndexId()));
......@@ -115,7 +115,7 @@ public class IndexApiServiceImpl implements IndexApiService {
if (index == null) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "指标不存在或已删除");
}
List<Integer> moduleIdList = indexModuleRelService.listModuleIdByBusinessId(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
List<String> moduleIdList = indexModuleRelService.listModuleIdByBusinessId(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
if (CollectionUtils.isNotEmpty(moduleIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不能删除被引用的指标");
}
......
......@@ -22,7 +22,7 @@
<result column="update_rate" jdbcType="VARCHAR" property="updateRate" />
<result column="update_rate_remark" jdbcType="VARCHAR" property="updateRateRemark" />
<result column="index_remark" jdbcType="VARCHAR" property="indexRemark" />
<result column="show" jdbcType="INTEGER" property="show" />
<result column="show_status" jdbcType="INTEGER" property="showStatus" />
<result column="complement" jdbcType="VARCHAR" property="complement" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
......@@ -32,7 +32,7 @@
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, complement, create_time, update_time, status
index_remark, `show_status`, complement, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -51,7 +51,7 @@
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,
update_rate_remark, index_remark, `show_status`,
complement, create_time, update_time,
status)
values (#{indexId,jdbcType=INTEGER}, #{classifyType,jdbcType=INTEGER}, #{classifyName,jdbcType=VARCHAR},
......@@ -60,7 +60,7 @@
#{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}, #{show,jdbcType=INTEGER},
#{updateRateRemark,jdbcType=VARCHAR}, #{indexRemark,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER},
#{complement,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
......@@ -130,8 +130,8 @@
<if test="indexRemark != null">
index_remark,
</if>
<if test="show != null">
show,
<if test="showStatus != null">
show_status,
</if>
<if test="complement != null">
complement,
......@@ -207,8 +207,8 @@
<if test="indexRemark != null">
#{indexRemark,jdbcType=VARCHAR},
</if>
<if test="show != null">
#{show,jdbcType=INTEGER},
<if test="showStatus != null">
#{showStatus,jdbcType=INTEGER},
</if>
<if test="complement != null">
#{complement,jdbcType=VARCHAR},
......@@ -284,8 +284,8 @@
<if test="indexRemark != null">
index_remark = #{indexRemark,jdbcType=VARCHAR},
</if>
<if test="show != null">
show = #{show,jdbcType=INTEGER},
<if test="showStatus != null">
show_status = #{showStatus,jdbcType=INTEGER},
</if>
<if test="complement != null">
complement = #{complement,jdbcType=VARCHAR},
......@@ -323,7 +323,7 @@
update_rate = #{updateRate,jdbcType=VARCHAR},
update_rate_remark = #{updateRateRemark,jdbcType=VARCHAR},
index_remark = #{indexRemark,jdbcType=VARCHAR},
show = #{show,jdbcType=INTEGER},
show_status = #{showStatus,jdbcType=INTEGER},
complement = #{complement,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
......
......@@ -5,7 +5,7 @@
<id column="index_module_rel_id" jdbcType="INTEGER" property="indexModuleRelId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="business_id" jdbcType="INTEGER" property="businessId" />
<result column="module_id" jdbcType="INTEGER" property="moduleId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
......@@ -28,7 +28,7 @@
module_id, create_time, update_time,
status)
values (#{indexModuleRelId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{businessId,jdbcType=INTEGER},
#{moduleId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{moduleId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabIndexModuleRel">
......@@ -67,7 +67,7 @@
#{businessId,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=INTEGER},
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
......@@ -90,7 +90,7 @@
business_id = #{businessId,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
......@@ -108,7 +108,7 @@
update tab_index_module_rel
set type = #{type,jdbcType=INTEGER},
business_id = #{businessId,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
......@@ -156,7 +156,7 @@
</foreach>
</if>
</update>
<select id="listModuleIdByBusinessId" resultType="int">
<select id="listModuleIdByBusinessId" resultType="string">
select
module_id
from tab_index_module_rel
......
package com.gic.enterprise.service.outer;
import com.gic.cloud.constants.FunctionEnum;
import com.gic.cloud.dto.AccountGroupDTO;
import com.gic.cloud.dto.DataAuthDTO;
import com.gic.cloud.dto.FunctionDTO;
import com.gic.cloud.service.DataAuthApiService;
import com.gic.cloud.service.FunctionApiService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import com.alibaba.fastjson.JSON;
import com.gic.cloud.service.AccountGroupApiService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author guojx
* @date 2019/7/16 6:31 PM
*/
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class EnterpriseApiServiceImplTest extends AbstractJUnit4SpringContextTests{
@Autowired
private AccountGroupApiService accountGroupApiService;
@Autowired
private FunctionApiService functionApiService;
@Autowired
private DataAuthApiService dataAuthApiService;
@Test
public void saveEnterprise() throws Exception {
// EnterpriseDTO dto = new EnterpriseDTO();
//
// ServiceResponse response = enterpriseApiService.saveEnterprise(dto);
// if (!response.isSuccess()) {
// System.out.println(response.getMessage());
// }
DataAuthDTO dto = new DataAuthDTO().setEnterpriseId(1129).setDataAuthName("guojx");
System.out.println(JSON.toJSONString(dataAuthApiService.pageDataAuth(1129, null, null, null)));
}
}
\ 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