Commit 6d45aa96 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 65fa2c1c 8f03b53b
package com.gic.cloud.constants;
/**
* @author zhiwj
* @Description:
* @date 2020-07-10 17:02
*/
public enum IndexTypeEnum {
INDEX(1, "指标"),
DIMENSION(2, "维度"),
NOTE(3, "说明");
private Integer code;
private String msg;
IndexTypeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
public static String parse(Integer code) {
for (IndexTypeEnum value : values()) {
if (value.code.equals(code)) {
return value.msg;
}
}
return null;
}
}
......@@ -54,7 +54,7 @@ public class DataExplainDTO implements Serializable {
/**
* 模块id
*/
private Integer moduleId;
private String moduleId;
private Integer optUserId;
private String optUserName;
......@@ -122,11 +122,11 @@ public class DataExplainDTO implements Serializable {
this.status = status;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
......
......@@ -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;
}
}
package com.gic.cloud.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 15:32
*/
public class IndexGroupDTO implements Serializable {
private static final long serialVersionUID = -3805956042154485116L;
/**
*
*/
private Integer indexGroupId;
/**
*
*/
private String indexGroupName;
/**
*
*/
private Integer parentId;
/**
*
*/
private String groupChain;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer status;
private List<IndexGroupDTO> childList;
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;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getGroupChain() {
return groupChain;
}
public void setGroupChain(String groupChain) {
this.groupChain = groupChain;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public List<IndexGroupDTO> getChildList() {
return childList;
}
public void setChildList(List<IndexGroupDTO> childList) {
this.childList = childList;
}
}
......@@ -19,7 +19,7 @@ public class IndexLogDTO implements Serializable {
/**
* 被操作的指标数据字典
*/
private Integer indexId;
private Integer businessId;
/**
* 操作时间
......@@ -69,12 +69,12 @@ public class IndexLogDTO implements Serializable {
this.cloudIndexLogId = cloudIndexLogId;
}
public Integer getIndexId() {
return indexId;
public Integer getBusinessId() {
return businessId;
}
public void setIndexId(Integer indexId) {
this.indexId = indexId;
public void setBusinessId(Integer businessId) {
this.businessId = businessId;
}
public Date getOptTime() {
......
......@@ -11,6 +11,7 @@ public class DataExplainQO extends PageQO implements Serializable {
private static final long serialVersionUID = 5687670215343610800L;
private String search;
private String moduleId;
public String getSearch() {
return search;
......@@ -19,4 +20,12 @@ public class DataExplainQO extends PageQO implements Serializable {
public void setSearch(String search) {
this.search = search;
}
public String getModuleId() {
return moduleId;
}
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
}
......@@ -11,7 +11,7 @@ public class IndexQO extends PageQO implements Serializable {
private static final long serialVersionUID = 5687670215343610800L;
private Integer classifyType;
private Integer moduleId;
private String moduleId;
private Integer isAppIndex;
private String search;
......@@ -23,11 +23,11 @@ public class IndexQO extends PageQO implements Serializable {
this.classifyType = classifyType;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
......
......@@ -5,6 +5,8 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.DataExplainDTO;
import com.gic.cloud.qo.DataExplainQO;
import java.util.List;
/**
* @author zhiwj
* @Description:
......@@ -50,4 +52,34 @@ public interface DataExplainApiService {
* @throws
*/
ServiceResponse<Page<DataExplainDTO>> listDataExplain(DataExplainQO dataExplainQO);
/**
* @Title: delete
* @Description:
* @author zhiwj
* @param dataExplainId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> delete(Integer dataExplainId);
/**
* @Title: publish
* @Description:
* @author zhiwj
* @param dataExplainIdList
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> publish(List<Integer> dataExplainIdList);
/**
* @Title: listByModule
* @Description:
* @author zhiwj
* @param moduleId
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.cloud.dto.IndexDTO>>
* @throws
*/
ServiceResponse<List<DataExplainDTO>> listByModule(String moduleId);
}
......@@ -5,6 +5,8 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.qo.IndexQO;
import java.util.List;
/**
* @author zhiwj
* @Description:
......@@ -50,4 +52,35 @@ public interface IndexApiService {
* @throws
*/
ServiceResponse<Page<IndexDTO>> listIndex(IndexQO indexQO);
/**
* @Title: delete
* @Description:
* @author zhiwj
* @param indexId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> delete(Integer indexId);
/**
* 发布指标
* @Title: publish
* @Description:
* @author zhiwj
* @param indexIdList
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> publish(List<Integer> indexIdList);
/**
* @Title: listByModule
* @Description:
* @author zhiwj
* @param moduleId
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.cloud.dto.IndexDTO>>
* @throws
*/
ServiceResponse<List<IndexDTO>> listByModule(String moduleId);
}
package com.gic.cloud.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexGroupDTO;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 15:31
*/
public interface IndexGroupApiService {
/**
* @Title: save
* @Description:
* @author zhiwj
* @param indexGroupDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> save(IndexGroupDTO indexGroupDTO);
/**
* @Title: update
* @Description:
* @author zhiwj
* @param indexGroupDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> update(IndexGroupDTO indexGroupDTO);
/**
* @Title: tree
* @Description:
* @author zhiwj
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.cloud.dto.IndexGroupDTO>>
* @throws
*/
ServiceResponse<List<IndexGroupDTO>> tree();
/**
* @Title: delete
* @Description:
* @author zhiwj
* @param indexGroupId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> delete(Integer indexGroupId);
}
......@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author zhiwj
......@@ -63,4 +65,19 @@ public class DataExplainController {
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/deleteDataExplain")
public RestResponse delete(Integer dataExplainId) {
ServiceResponse<Void> serviceResponse = dataExplainApiService.delete(dataExplainId);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/publishDataExplain")
public RestResponse publishIndex(String dataExplainIds) {
if (StringUtils.isBlank(dataExplainIds)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
ServiceResponse<Void> serviceResponse = dataExplainApiService.publish(Stream.of(dataExplainIds.split(",")).map(Integer::valueOf).collect(Collectors.toList()));
return ResultControllerUtils.commonResult(serviceResponse);
}
}
\ No newline at end of file
package com.gic.cloud.operation.web.controller;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.authcenter.security.core.dto.UserDetailsVO;
import com.gic.authcenter.security.core.util.UserUtils;
import com.gic.cloud.constants.IndexTypeEnum;
import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.dto.IndexLogDTO;
import com.gic.cloud.qo.IndexQO;
......@@ -12,12 +14,16 @@ 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.gic.redis.data.util.RedisUtil;
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;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author zhiwj
......@@ -34,16 +40,20 @@ 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())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
UserDetailsVO user = UserUtils.getUser();
indexDTO.setClassifyName(IndexTypeEnum.parse(indexDTO.getClassifyType()));
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);
}
......@@ -75,4 +85,28 @@ public class IndexController {
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/deleteIndex")
public RestResponse delete(Integer indexId) {
ServiceResponse<Void> serviceResponse = indexApiService.delete(indexId);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/publishIndex")
public RestResponse publishIndex(String indexIds) {
if (StringUtils.isBlank(indexIds)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
ServiceResponse<Void> serviceResponse = indexApiService.publish(Stream.of(indexIds.split(",")).map(Integer::valueOf).collect(Collectors.toList()));
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/moduleList")
public RestResponse moduleList() {
Object cache = RedisUtil.getCache("enterprise:datacloud:moduleList");
if (cache != null) {
return RestResponse.success(JSON.parseArray(cache.toString()));
}
return RestResponse.success();
}
}
\ No newline at end of file
package com.gic.cloud.operation.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexGroupDTO;
import com.gic.cloud.service.IndexGroupApiService;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.ResultControllerUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 16:26
*/
@RestController
public class IndexGroupController {
@Autowired
private IndexGroupApiService indexGroupApiService;
@RequestMapping("/saveIndexGroup")
public RestResponse saveIndexGroup(IndexGroupDTO indexGroupDTO) {
if (StringUtils.isBlank(indexGroupDTO.getIndexGroupName()) || indexGroupDTO.getParentId() == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
ServiceResponse<Void> serviceResponse = indexGroupApiService.save(indexGroupDTO);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/updateIndexGroup")
public RestResponse updateIndexGroup(IndexGroupDTO indexGroupDTO) {
if (StringUtils.isBlank(indexGroupDTO.getIndexGroupName()) || indexGroupDTO.getParentId() == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
ServiceResponse<Void> serviceResponse = indexGroupApiService.update(indexGroupDTO);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/treeIndexGroup")
public RestResponse tree() {
ServiceResponse<List<IndexGroupDTO>> serviceResponse = indexGroupApiService.tree();
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/deleteIndexGroup")
public RestResponse tree(Integer indexGroupId) {
ServiceResponse<Void> serviceResponse = indexGroupApiService.delete(indexGroupId);
return ResultControllerUtils.commonResult(serviceResponse);
}
}
app.id=gic-data-cloud-operation-web
app.project-code=data-cloud
app.project-code=gic-data-cloud
logging.level.org.springframework.security=DEBUG
......
......@@ -95,6 +95,7 @@
<dubbo:reference interface="com.gic.cloud.service.IndexApiService" id="indexApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.cloud.service.IndexLogApiService" id="indexLogApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.cloud.service.IndexGroupApiService" id="indexGroupApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.cloud.service.DataExplainApiService" id="dataExplainApiService" timeout="6000" retries="0"/>
......
package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabIndexGroup;
import java.util.List;
public interface TabIndexGroupMapper {
/**
* 根据主键删除
*
* @param indexGroupId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer indexGroupId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabIndexGroup record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabIndexGroup record);
/**
* 根据主键查询
*
* @param indexGroupId 主键
* @return 实体对象
*/
TabIndexGroup selectByPrimaryKey(Integer indexGroupId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabIndexGroup record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabIndexGroup record);
TabIndexGroup getBySelective(TabIndexGroup indexGroup);
List<TabIndexGroup> listIndexGroup();
}
\ No newline at end of file
......@@ -54,5 +54,5 @@ public interface TabIndexLogMapper {
*/
int updateByPrimaryKey(TabIndexLog record);
List<TabIndexLog> listIndexLog(@Param("indexId") Integer indexId, @Param("type") Integer type);
List<TabIndexLog> listBusinessLog(@Param("businessId") Integer businessId, @Param("type") Integer type);
}
\ No newline at end of file
......@@ -58,9 +58,11 @@ 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> listModuleIdByIndexId(@Param("indexId") Integer indexId);
List<String> listModuleIdByBusinessId(@Param("businessId") Integer businessId, @Param("type") Integer type);
List<Integer> listIndexIdByModuleId(@Param("moduleId") Integer moduleId);
List<Integer> listBusinessIdByModuleId(@Param("moduleId") Integer moduleId);
List<TabIndexModuleRel> listModuleIdByBusinessIds(@Param("ids") List<Integer> businessIdList, @Param("type") Integer type);
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ public class TabDataExplain {
/**
* 模块id
*/
private Integer moduleId;
private String moduleId;
public Integer getDataExplainId() {
return dataExplainId;
......@@ -115,11 +115,11 @@ public class TabDataExplain {
this.status = status;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
}
\ No newline at end of file
......@@ -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() {
......
package com.gic.cloud.entity;
import java.util.Date;
/**
* tab_index_group
*/
public class TabIndexGroup {
/**
*
*/
private Integer indexGroupId;
/**
*
*/
private String indexGroupName;
/**
*
*/
private Integer parentId;
/**
*
*/
private String groupChain;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer status;
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;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getGroupChain() {
return groupChain;
}
public void setGroupChain(String groupChain) {
this.groupChain = groupChain;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ public class TabIndexLog {
/**
* 被操作的指标数据字典
*/
private Integer indexId;
private Integer businessId;
/**
* 操作时间
......@@ -64,12 +64,12 @@ public class TabIndexLog {
this.cloudIndexLogId = cloudIndexLogId;
}
public Integer getIndexId() {
return indexId;
public Integer getBusinessId() {
return businessId;
}
public void setIndexId(Integer indexId) {
this.indexId = indexId;
public void setBusinessId(Integer businessId) {
this.businessId = businessId;
}
public Date getOptTime() {
......
......@@ -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;
}
......
......@@ -24,5 +24,7 @@ public interface DataExplainService {
Page<TabDataExplain> listDataExplain(DataExplainQO dataExplainQO);
List<TabDataExplain> listAllDataExplain();
List<TabDataExplain> listAllDataExplain(DataExplainQO dataExplainQO);
void deleteById(Integer dataExplainId);
}
package com.gic.cloud.service;
import com.gic.cloud.dto.IndexGroupDTO;
import com.gic.cloud.entity.TabIndexGroup;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 15:37
*/
public interface IndexGroupService {
boolean isNameRepeat(String indexGroupName, Integer indexGroupId);
Integer save(IndexGroupDTO indexGroupDTO);
TabIndexGroup getById(Integer indexGroupId);
void update(IndexGroupDTO indexGroupDTO);
void delete(Integer indexGroupId);
List<TabIndexGroup> listIndexGroup();
}
package com.gic.cloud.service;
import java.util.List;
import java.util.Map;
/**
* @author zhiwj
......@@ -8,9 +9,13 @@ import java.util.List;
* @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> listModuleIdByIndexId(Integer indexId);
List<String> listModuleIdByBusinessId(Integer indexId, Integer type);
List<Integer> listIndexIdByModuleId(Integer moduleId);
List<Integer> listBusinessIdByModuleId(Integer moduleId);
void deleteByBusinessId(Integer businessId, Integer type);
Map<Integer, List<String>> groupModuleIdByBusinessIds(List<Integer> indexIdList, Integer type);
}
......@@ -26,5 +26,7 @@ public interface IndexService {
Page<TabIndex> listIndex(IndexQO indexQO);
List<TabIndex> listAllIndex();
List<TabIndex> listAllIndex(IndexQO indexQO);
void deleteById(Integer indexId);
}
......@@ -60,7 +60,15 @@ public class DataExplainServiceImpl implements DataExplainService {
}
@Override
public List<TabDataExplain> listAllDataExplain() {
return tabDataExplainMapper.listDataExplain(new DataExplainQO());
public List<TabDataExplain> listAllDataExplain(DataExplainQO dataExplainQO) {
return tabDataExplainMapper.listDataExplain(dataExplainQO);
}
@Override
public void deleteById(Integer dataExplainId) {
TabDataExplain dataExplain = new TabDataExplain();
dataExplain.setDataExplainId(dataExplainId);
dataExplain.setStatus(0);
tabDataExplainMapper.updateByPrimaryKeySelective(dataExplain);
}
}
package com.gic.cloud.service.impl;
import com.gic.cloud.dao.mapper.TabIndexGroupMapper;
import com.gic.cloud.dto.IndexGroupDTO;
import com.gic.cloud.entity.TabIndexGroup;
import com.gic.cloud.service.IndexGroupService;
import com.gic.commons.util.EntityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 15:38
*/
@Service
public class IndexGroupServiceImpl implements IndexGroupService {
@Autowired
private TabIndexGroupMapper tabIndexGroupMapper;
@Override
public boolean isNameRepeat(String indexGroupName, Integer indexGroupId) {
TabIndexGroup indexGroup = new TabIndexGroup();
indexGroup.setIndexGroupName(indexGroupName);
indexGroup.setIndexGroupId(indexGroupId);
return tabIndexGroupMapper.getBySelective(indexGroup) != null;
}
@Override
public Integer save(IndexGroupDTO indexGroupDTO) {
TabIndexGroup indexGroup = EntityUtil.changeEntityByJSON(TabIndexGroup.class, indexGroupDTO);
indexGroup.setStatus(1);
indexGroup.setCreateTime(new Date());
tabIndexGroupMapper.insertSelective(indexGroup);
return indexGroup.getIndexGroupId();
}
@Override
public TabIndexGroup getById(Integer indexGroupId) {
return tabIndexGroupMapper.selectByPrimaryKey(indexGroupId);
}
@Override
public void update(IndexGroupDTO indexGroupDTO) {
tabIndexGroupMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabIndexGroup.class, indexGroupDTO));
}
@Override
public void delete(Integer indexGroupId) {
TabIndexGroup tabIndexGroup = new TabIndexGroup();
tabIndexGroup.setIndexGroupId(indexGroupId);
tabIndexGroup.setStatus(0);
tabIndexGroupMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabIndexGroup.class, tabIndexGroup));
}
@Override
public List<TabIndexGroup> listIndexGroup() {
return tabIndexGroupMapper.listIndexGroup();
}
}
......@@ -35,7 +35,7 @@ public class IndexLogServiceImpl implements IndexLogService {
private void saveLog(IndexDTO indexDTO, String reason) {
TabIndexLog indexLog = new TabIndexLog();
indexLog.setIndexId(indexDTO.getIndexId());
indexLog.setBusinessId(indexDTO.getIndexId());
indexLog.setOptTime(new Date());
indexLog.setOptUserId(indexDTO.getOptUserId());
indexLog.setOptUserName(indexDTO.getOptUserName());
......@@ -59,17 +59,17 @@ public class IndexLogServiceImpl implements IndexLogService {
@Override
public List<TabIndexLog> listIndexLog(Integer indexId) {
return tabIndexLogMapper.listIndexLog(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
return tabIndexLogMapper.listBusinessLog(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
}
@Override
public List<TabIndexLog> listDataExplainLog(Integer dataExplainId) {
return tabIndexLogMapper.listIndexLog(dataExplainId, LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
return tabIndexLogMapper.listBusinessLog(dataExplainId, LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
}
private void saveLog(DataExplainDTO dataExplainDTO, String reason) {
TabIndexLog indexLog = new TabIndexLog();
indexLog.setIndexId(dataExplainDTO.getDataExplainId());
indexLog.setBusinessId(dataExplainDTO.getDataExplainId());
indexLog.setOptTime(new Date());
indexLog.setOptUserId(dataExplainDTO.getOptUserId());
indexLog.setOptUserName(dataExplainDTO.getOptUserName());
......
......@@ -3,11 +3,12 @@ package com.gic.cloud.service.impl;
import com.gic.cloud.dao.mapper.TabIndexModuleRelMapper;
import com.gic.cloud.entity.TabIndexModuleRel;
import com.gic.cloud.service.IndexModuleRelService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -22,11 +23,12 @@ 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) {
if (CollectionUtils.isNotEmpty(moduleIdList)) {
// 把所有关联status设置为0
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
// 插入不存在的关联
for (Integer moduleId : moduleIdList) {
for (String moduleId : moduleIdList) {
TabIndexModuleRel rel = new TabIndexModuleRel();
rel.setType(type);
rel.setBusinessId(businessId);
......@@ -38,14 +40,28 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
// 把所有userId关联status都设置为1
tabIndexModuleRelMapper.updateStatusByBusinessIds(businessId, moduleIdList, type);
}
}
@Override
public List<String> listModuleIdByBusinessId(Integer businessId, Integer type) {
return tabIndexModuleRelMapper.listModuleIdByBusinessId(businessId, type);
}
@Override
public List<Integer> listModuleIdByIndexId(Integer indexId) {
return tabIndexModuleRelMapper.listModuleIdByIndexId(indexId);
public List<Integer> listBusinessIdByModuleId(Integer moduleId) {
return tabIndexModuleRelMapper.listBusinessIdByModuleId(moduleId);
}
@Override
public void deleteByBusinessId(Integer businessId, Integer type) {
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
}
@Override
public List<Integer> listIndexIdByModuleId(Integer moduleId) {
return tabIndexModuleRelMapper.listIndexIdByModuleId(moduleId);
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::getModuleId, Collectors.toList())));
}
}
......@@ -11,6 +11,7 @@ import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -43,6 +44,9 @@ public class IndexServiceImpl implements IndexService {
@Override
public Integer save(IndexDTO indexDTO) {
TabIndex tabIndex = EntityUtil.changeEntityByJSON(TabIndex.class, indexDTO);
tabIndex.setStatus(1);
tabIndex.setCreateTime(new Date());
tabIndex.setUpdateTime(new Date());
tabIndexMapper.insertSelective(tabIndex);
return tabIndex.getIndexId();
}
......@@ -65,7 +69,15 @@ public class IndexServiceImpl implements IndexService {
}
@Override
public List<TabIndex> listAllIndex() {
public List<TabIndex> listAllIndex(IndexQO indexQO) {
return tabIndexMapper.listIndex(new IndexQO());
}
@Override
public void deleteById(Integer indexId) {
TabIndex index = new TabIndex();
index.setIndexId(indexId);
index.setStatus(0);
tabIndexMapper.updateByPrimaryKeySelective(index);
}
}
......@@ -6,6 +6,8 @@ import com.gic.cloud.entity.TabDataExplain;
import com.gic.cloud.entity.TabIndex;
import com.gic.cloud.entity.TabSysUser;
import com.gic.cloud.entity.TabUpdateTips;
import com.gic.cloud.qo.DataExplainQO;
import com.gic.cloud.qo.IndexQO;
import com.gic.cloud.qo.UserQO;
import com.gic.cloud.service.DataExplainService;
import com.gic.cloud.service.IndexService;
......@@ -35,7 +37,7 @@ public class UpdateTipServiceImpl implements UpdateTipService {
@Override
public void insertBySaveUser(Integer userId) {
List<TabIndex> indexList = indexService.listAllIndex();
List<TabIndex> indexList = indexService.listAllIndex(new IndexQO());
for (TabIndex index : indexList) {
TabUpdateTips tabUpdateTips = new TabUpdateTips();
tabUpdateTips.setUserId(userId);
......@@ -44,7 +46,7 @@ public class UpdateTipServiceImpl implements UpdateTipService {
tabUpdateTips.setType(LogAndUpdateTipsTypeEnum.INDEX.getCode());
tabUpdateTipsMapper.insertSelective(tabUpdateTips);
}
List<TabDataExplain> dataExplainList = dataExplainService.listAllDataExplain();
List<TabDataExplain> dataExplainList = dataExplainService.listAllDataExplain(new DataExplainQO());
for (TabDataExplain dataExplain : dataExplainList) {
TabUpdateTips tabUpdateTips = new TabUpdateTips();
tabUpdateTips.setUserId(userId);
......
......@@ -18,6 +18,8 @@ import com.gic.enterprise.response.EnterpriseServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zhiwj
* @Description:
......@@ -81,4 +83,33 @@ public class DataExplainApiServiceImpl implements DataExplainApiService {
Page<DataExplainDTO> dtoPage = PageHelperUtils.changePageHelperToCurrentPage(listDataExplain, DataExplainDTO.class);
return EnterpriseServiceResponse.success(dtoPage);
}
@Override
public ServiceResponse<Void> delete(Integer dataExplainId) {
TabDataExplain dataExplain = this.dataExplainService.getByDataExplainId(dataExplainId);
if (dataExplain == null) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "数据解读不存在或已删除");
}
if (dataExplain.getModuleId() == null) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不能删除被引用的指标");
}
this.dataExplainService.deleteById(dataExplainId);
return EnterpriseServiceResponse.success();
}
@Override
public ServiceResponse<Void> publish(List<Integer> dataExplainIdList) {
for (Integer dataExplainId : dataExplainIdList) {
this.updateTipService.publish(dataExplainId, LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
}
return EnterpriseServiceResponse.success();
}
@Override
public ServiceResponse<List<DataExplainDTO>> listByModule(String moduleId) {
DataExplainQO dataExplainQO = new DataExplainQO();
dataExplainQO.setModuleId(moduleId);
List<TabDataExplain> dataExplainList = dataExplainService.listAllDataExplain(dataExplainQO);
return EnterpriseServiceResponse.success(EntityUtil.changeEntityListByJSON(DataExplainDTO.class, dataExplainList));
}
}
......@@ -12,10 +12,13 @@ import com.gic.commons.util.EntityUtil;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -86,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.listModuleIdByIndexId(indexDTO.getIndexId());
List<String> moduleIdList = this.indexModuleRelService.listModuleIdByBusinessId(indexDTO.getIndexId(), LogAndUpdateTipsTypeEnum.INDEX.getCode());
indexDTO.setRelModuleIdList(moduleIdList);
return EnterpriseServiceResponse.success(indexDTO);
}
......@@ -95,6 +98,45 @@ public class IndexApiServiceImpl implements IndexApiService {
public ServiceResponse<Page<IndexDTO>> listIndex(IndexQO indexQO) {
com.github.pagehelper.Page<TabIndex> indexList = indexService.listIndex(indexQO);
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<String>> moduleIdByBusinessIdMap = indexModuleRelService.groupModuleIdByBusinessIds(indexIdList, LogAndUpdateTipsTypeEnum.INDEX.getCode());
List<IndexDTO> indexDTOList = indexDTOPage.getResult();
for (IndexDTO indexDTO : indexDTOList) {
indexDTO.setRelModuleIdList(moduleIdByBusinessIdMap.get(indexDTO.getIndexId()));
}
}
return EnterpriseServiceResponse.success(indexDTOPage);
}
@Override
public ServiceResponse<Void> delete(Integer indexId) {
TabIndex index = this.indexService.getByIndexId(indexId);
if (index == null) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "指标不存在或已删除");
}
List<String> moduleIdList = indexModuleRelService.listModuleIdByBusinessId(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
if (CollectionUtils.isNotEmpty(moduleIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不能删除被引用的指标");
}
this.indexService.deleteById(indexId);
this.indexModuleRelService.deleteByBusinessId(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
return EnterpriseServiceResponse.success();
}
@Override
public ServiceResponse<Void> publish(List<Integer> indexIdList) {
for (Integer indexId : indexIdList) {
this.updateTipService.publish(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
}
return EnterpriseServiceResponse.success();
}
@Override
public ServiceResponse<List<IndexDTO>> listByModule(String moduleId) {
IndexQO indexQO = new IndexQO();
indexQO.setModuleId(moduleId);
List<TabIndex> indexList = indexService.listAllIndex(indexQO);
return EnterpriseServiceResponse.success(EntityUtil.changeEntityListByJSON(IndexDTO.class, indexList));
}
}
package com.gic.cloud.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.IndexGroupDTO;
import com.gic.cloud.entity.TabIndexGroup;
import com.gic.cloud.service.IndexGroupApiService;
import com.gic.cloud.service.IndexGroupService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhiwj
* @Description:
* @date 2020-07-13 15:37
*/
@Service("indexGroupApiService")
public class IndexGroupApiServiceImpl implements IndexGroupApiService {
@Autowired
private IndexGroupService indexGroupService;
@Override
public ServiceResponse<Void> save(IndexGroupDTO indexGroupDTO) {
// 校验参数
if (indexGroupService.isNameRepeat(indexGroupDTO.getIndexGroupName(), null)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "名称重复");
}
Integer indexGroupId = indexGroupService.save(indexGroupDTO);
indexGroupDTO.setIndexGroupId(indexGroupId);
TabIndexGroup parentIndexGroup = indexGroupService.getById(indexGroupDTO.getParentId());
indexGroupDTO.setGroupChain(parentIndexGroup.getGroupChain() + indexGroupId + "_");
indexGroupService.update(indexGroupDTO);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> update(IndexGroupDTO indexGroupDTO) {
// 校验参数
if (indexGroupService.isNameRepeat(indexGroupDTO.getIndexGroupName(), null)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "名称重复");
}
TabIndexGroup parentIndexGroup = indexGroupService.getById(indexGroupDTO.getParentId());
indexGroupDTO.setGroupChain(parentIndexGroup.getGroupChain() + "_" + indexGroupDTO.getIndexGroupId() + "_");
indexGroupService.update(indexGroupDTO);
return ServiceResponse.success();
}
@Override
public ServiceResponse<List<IndexGroupDTO>> tree() {
List<TabIndexGroup> groupList = this.indexGroupService.listIndexGroup();
List<IndexGroupDTO> groupDTOList = EntityUtil.changeEntityListByJSON(IndexGroupDTO.class, groupList);
List<IndexGroupDTO> tree = toTree(groupDTOList);
return EnterpriseServiceResponse.success(tree);
}
private List<IndexGroupDTO> toTree(List<IndexGroupDTO> groupDTOList) {
return toTree(0, groupDTOList);
}
private List<IndexGroupDTO> toTree(Integer parentIndexGroupId, List<IndexGroupDTO> groupDTOList) {
if (CollectionUtils.isEmpty(groupDTOList)) {
return null;
}
List<IndexGroupDTO> resultList = new ArrayList<>();
for (IndexGroupDTO indexGroupDTO : groupDTOList) {
if (parentIndexGroupId.equals(indexGroupDTO.getParentId())) {
resultList.add(indexGroupDTO);
indexGroupDTO.setChildList(toTree(indexGroupDTO.getIndexGroupId(), groupDTOList));
}
}
return resultList;
}
@Override
public ServiceResponse<Void> delete(Integer indexGroupId) {
indexGroupService.delete(indexGroupId);
return ServiceResponse.success();
}
}
......@@ -24,4 +24,5 @@
<dubbo:service interface="com.gic.cloud.service.IndexApiService" ref="indexApiService" timeout="6000" />
<dubbo:service interface="com.gic.cloud.service.IndexLogApiService" ref="indexLogApiService" timeout="6000" />
<dubbo:service interface="com.gic.cloud.service.TempStoreConditionApiService" ref="tempStoreConditionApiService" timeout="6000" />
<dubbo:service interface="com.gic.cloud.service.IndexGroupApiService" ref="indexGroupApiService" timeout="6000" />
</beans>
......@@ -10,7 +10,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="module_id" jdbcType="INTEGER" property="moduleId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
</resultMap>
<sql id="Base_Column_List">
data_explain_id, data_name, data_classify, index_remark, complement, create_time,
......@@ -33,7 +33,7 @@
)
values (#{dataExplainId,jdbcType=INTEGER}, #{dataName,jdbcType=VARCHAR}, #{dataClassify,jdbcType=VARCHAR},
#{indexRemark,jdbcType=VARCHAR}, #{complement,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{moduleId,jdbcType=INTEGER}
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{moduleId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabDataExplain">
......@@ -96,7 +96,7 @@
#{status,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=INTEGER},
#{moduleId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -125,7 +125,7 @@
status = #{status,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
</set>
where data_explain_id = #{dataExplainId,jdbcType=INTEGER}
......@@ -139,7 +139,7 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=INTEGER}
module_id = #{moduleId,jdbcType=VARCHAR}
where data_explain_id = #{dataExplainId,jdbcType=INTEGER}
</update>
<!-- getBySelective-->
......@@ -147,14 +147,11 @@
select
<include refid="Base_Column_List" />
from tab_data_explain where status = 1
<if test="data_name != null ">
and data_name = #{data_name}
</if>
<if test="null != ids and ids.size > 0">
and data_explain_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="dataName != null ">
and data_name = #{dataName}
</if>
<if test="dataExplainId != null ">
and data_explain_id &lt;&gt; #{dataExplainId}
</if>
</select>
<select id="listDataExplain" resultMap="BaseResultMap">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.cloud.dao.mapper.TabIndexGroupMapper">
<resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabIndexGroup">
<id column="index_group_id" jdbcType="INTEGER" property="indexGroupId" />
<result column="index_group_name" jdbcType="VARCHAR" property="indexGroupName" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
<result column="group_chain" jdbcType="VARCHAR" property="groupChain" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
index_group_id, index_group_name, parent_id, group_chain, create_time, update_time,
status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_group
where index_group_id = #{indexGroupId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_index_group
where index_group_id = #{indexGroupId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.cloud.entity.TabIndexGroup">
insert into tab_index_group (index_group_id, index_group_name, parent_id,
group_chain, create_time, update_time,
status)
values (#{indexGroupId,jdbcType=INTEGER}, #{indexGroupName,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
#{groupChain,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabIndexGroup">
<selectKey keyProperty="indexGroupId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_index_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="indexGroupId != null">
index_group_id,
</if>
<if test="indexGroupName != null">
index_group_name,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="groupChain != null">
group_chain,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="indexGroupId != null">
#{indexGroupId,jdbcType=INTEGER},
</if>
<if test="indexGroupName != null">
#{indexGroupName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=INTEGER},
</if>
<if test="groupChain != null">
#{groupChain,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.cloud.entity.TabIndexGroup">
update tab_index_group
<set>
<if test="indexGroupName != null">
index_group_name = #{indexGroupName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if test="groupChain != null">
group_chain = #{groupChain,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where index_group_id = #{indexGroupId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabIndexGroup">
update tab_index_group
set index_group_name = #{indexGroupName,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=INTEGER},
group_chain = #{groupChain,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where index_group_id = #{indexGroupId,jdbcType=INTEGER}
</update>
<select id="getBySelective" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_group
where status = 1
<if test="indexGroupName != null ">
and index_group_name = #{indexGroupName}
</if>
<if test="indexGroupId != null ">
and index_group_id &lt;&gt; #{indexGroupId}
</if>
limit 1
</select>
<select id="listIndexGroup" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_group where status = 1
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="com.gic.cloud.dao.mapper.TabIndexLogMapper">
<resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabIndexLog">
<id column="cloud_index_log_id" jdbcType="INTEGER" property="cloudIndexLogId" />
<result column="index_id" jdbcType="INTEGER" property="indexId" />
<result column="business_id" jdbcType="INTEGER" property="businessId" />
<result column="opt_time" jdbcType="TIMESTAMP" property="optTime" />
<result column="opt_user_id" jdbcType="INTEGER" property="optUserId" />
<result column="opt_user_name" jdbcType="VARCHAR" property="optUserName" />
......@@ -14,7 +14,7 @@
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<sql id="Base_Column_List">
cloud_index_log_id, index_id, opt_time, opt_user_id, opt_user_name, reason, status,
cloud_index_log_id, business_id, opt_time, opt_user_id, opt_user_name, reason, status,
create_time, update_time, type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
......@@ -28,11 +28,11 @@
where cloud_index_log_id = #{cloudIndexLogId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.cloud.entity.TabIndexLog">
insert into tab_index_log (cloud_index_log_id, index_id, opt_time,
insert into tab_index_log (cloud_index_log_id, business_id, opt_time,
opt_user_id, opt_user_name, reason,
status, create_time, update_time,
type)
values (#{cloudIndexLogId,jdbcType=INTEGER}, #{indexId,jdbcType=INTEGER}, #{optTime,jdbcType=TIMESTAMP},
values (#{cloudIndexLogId,jdbcType=INTEGER}, #{businessId,jdbcType=INTEGER}, #{optTime,jdbcType=TIMESTAMP},
#{optUserId,jdbcType=INTEGER}, #{optUserName,jdbcType=VARCHAR}, #{reason,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{type,jdbcType=INTEGER})
......@@ -43,8 +43,8 @@
<if test="cloudIndexLogId != null">
cloud_index_log_id,
</if>
<if test="indexId != null">
index_id,
<if test="businessId != null">
business_id,
</if>
<if test="optTime != null">
opt_time,
......@@ -75,8 +75,8 @@
<if test="cloudIndexLogId != null">
#{cloudIndexLogId,jdbcType=INTEGER},
</if>
<if test="indexId != null">
#{indexId,jdbcType=INTEGER},
<if test="businessId != null">
#{businessId,jdbcType=INTEGER},
</if>
<if test="optTime != null">
#{optTime,jdbcType=TIMESTAMP},
......@@ -107,8 +107,8 @@
<update id="updateByPrimaryKeySelective" parameterType="com.gic.cloud.entity.TabIndexLog">
update tab_index_log
<set>
<if test="indexId != null">
index_id = #{indexId,jdbcType=INTEGER},
<if test="businessId != null">
business_id = #{businessId,jdbcType=INTEGER},
</if>
<if test="optTime != null">
opt_time = #{optTime,jdbcType=TIMESTAMP},
......@@ -139,7 +139,7 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabIndexLog">
update tab_index_log
set index_id = #{indexId,jdbcType=INTEGER},
set business_id = #{businessId,jdbcType=INTEGER},
opt_time = #{optTime,jdbcType=TIMESTAMP},
opt_user_id = #{optUserId,jdbcType=INTEGER},
opt_user_name = #{optUserName,jdbcType=VARCHAR},
......@@ -150,16 +150,17 @@
type = #{type,jdbcType=INTEGER}
where cloud_index_log_id = #{cloudIndexLogId,jdbcType=INTEGER}
</update>
<select id="listIndexLog" resultMap="BaseResultMap">
<select id="listBusinessLog" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_log
where status = 1
<if test="indexId != null ">
and index_id = #{indexId}
<if test="businessId != null ">
and business_id = #{businessId}
</if>
<if test="type != null ">
and type = #{type}
</if>
order by update_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -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},
......@@ -354,7 +354,7 @@
select
<include refid="Base_Column_List" />
from tab_index
<where>
where status = 1
<if test="classifyType != null ">
and classify_type = #{classifyType}
</if>
......@@ -367,6 +367,6 @@
<if test="search != null and search != '' ">
and name like concat('%', #{search}, '%')
</if>
</where>
order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -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}
......@@ -127,7 +127,7 @@
status
) SELECT
#{type},
#{busisessId},
#{businessId},
#{moduleId},
#{createTime},
#{updateTime},
......@@ -150,22 +150,33 @@
<update id="updateStatusByBusinessIds">
update tab_index_module_rel set status = 1 where business_id = #{businessId} and `type` = #{type}
<if test="null != ids and ids.size > 0">
and business_id in
and module_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<select id="listModuleIdByIndexId" resultType="int">
<select id="listModuleIdByBusinessId" resultType="string">
select
module_id
from tab_index_module_rel
where status = 1 and index_id = #{indexId}
where status = 1 and business_id = #{businessId} and type = #{type}
</select>
<select id="listIndexIdByModuleId" resultType="int">
<select id="listBusinessIdByModuleId" resultType="int">
select
module_id
from tab_index_module_rel
where status = 1 and module_id = #{moduleId}
</select>
<select id="listModuleIdByBusinessIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_index_module_rel where status = 1 and type = #{type}
<if test="null != ids and ids.size > 0">
and business_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
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
......@@ -4,10 +4,12 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.UserDTO;
import com.gic.cloud.service.UserApiService;
import com.gic.cloud.web.constant.ErrorCode;
import com.gic.cloud.web.vo.LoginUserVo;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
public class LoginController {
......@@ -32,10 +35,18 @@ public class LoginController {
List<UserDTO> userDTOList = this.userApiService.listUserByPhone("86", phoneNumber).getResult();
if(CollectionUtils.isNotEmpty(userDTOList)){
Integer enterpriseId = userDTOList.get(0).getEnterpriseId();
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(smsSenceId,
enterpriseId,areaCode, phoneNumber, new String[]{CreateRandomUtils.getStringRandom(4)});
String code = CreateRandomUtils.getStringRandom(4);
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(smsSenceId,enterpriseId,areaCode, phoneNumber, new String[]{code});
if(smsSendResult.isSuccess()){
return RestResponse.success();
String key = "GYTCode:" + areaCode + ":" + phoneNumber;
LoginUserVo userVo = new LoginUserVo();
userVo.setEnterpriseId(enterpriseId);
userVo.setAreaCode(areaCode);
userVo.setCode(code);
userVo.setPhoneNumber(phoneNumber);
userVo.setUserId(userDTOList.get(0).getUserId());
RedisUtil.setCache(key, userVo, 5l, TimeUnit.MINUTES);
return RestResponse.success(enterpriseId);
}else {
return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), smsSendResult.getMessage());
}
......@@ -43,4 +54,20 @@ public class LoginController {
return RestResponse.failure(ErrorCode.ACCOUNTNOTEXISTS.getCode(), ErrorCode.ACCOUNTNOTEXISTS.getMsg());
}
}
@RequestMapping("login")
public RestResponse login(String areaCode, String phoneNumber, String code){
String key = "GYTCode:" + areaCode + ":" + phoneNumber;
Object cache = RedisUtil.getCache(key);
if(cache != null){
LoginUserVo userVo = (LoginUserVo) cache;
if(userVo.getCode().equals(code)){
return RestResponse.success(userVo);
}else {
return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), "验证码错误");
}
}else {
return RestResponse.failure(ErrorCode.ACCOUNTNOTEXISTS.getCode(), "请发送验证码");
}
}
}
package com.gic.cloud.web.vo;
import java.io.Serializable;
public class IndexItemVo implements Serializable {
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.gic.cloud.web.vo;
import java.io.Serializable;
public class LoginUserVo implements Serializable {
private Integer userId;
private Integer enterpriseId;
private String phoneNumber;
private String areaCode;
private String code;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.gic.cloud.web.vo;
import java.util.List;
public class StoreWidgetIndexVo {
/****1多渠道首页 2单渠道线下首页 3单渠道线上首页****/
private Integer type;
private List<IndexItemVo> items;
private Integer attentionCount;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getAttentionCount() {
return attentionCount;
}
public void setAttentionCount(Integer attentionCount) {
this.attentionCount = attentionCount;
}
public List<IndexItemVo> getItems() {
return items;
}
public void setItems(List<IndexItemVo> items) {
this.items = items;
}
}
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