Commit e1eafb2b by zhiwj

数据字典

parent 5393ae65
...@@ -5,7 +5,7 @@ package com.gic.cloud.constants; ...@@ -5,7 +5,7 @@ package com.gic.cloud.constants;
* @Description: * @Description:
* @date 2020-07-08 16:22 * @date 2020-07-08 16:22
*/ */
public enum LogTypeEnum { public enum LogAndUpdateTipsTypeEnum {
// 指标字典 // 指标字典
INDEX(1), INDEX(1),
// 数据解读 // 数据解读
...@@ -13,7 +13,7 @@ public enum LogTypeEnum { ...@@ -13,7 +13,7 @@ public enum LogTypeEnum {
; ;
private Integer code; private Integer code;
LogTypeEnum(Integer code) { LogAndUpdateTipsTypeEnum(Integer code) {
this.code = code; this.code = code;
} }
......
package com.gic.cloud.constants;
/**
* @author zhiwj
* @Description:
* @date 2020-07-09 14:06
*/
public enum UpdateTypeEnum {
// 指标字典
ONLY_DETAIL(1),
// 数据解读
UPDATE_PUBLISH(2),
;
private Integer code;
UpdateTypeEnum(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package com.gic.cloud.dao.mapper; package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabUpdateTips; import com.gic.cloud.entity.TabUpdateTips;
import org.apache.ibatis.annotations.Param;
public interface TabUpdateTipsMapper { public interface TabUpdateTipsMapper {
/** /**
...@@ -50,4 +51,6 @@ public interface TabUpdateTipsMapper { ...@@ -50,4 +51,6 @@ public interface TabUpdateTipsMapper {
* @return 更新条目数 * @return 更新条目数
*/ */
int updateByPrimaryKey(TabUpdateTips record); int updateByPrimaryKey(TabUpdateTips record);
void updateStatus(@Param("businessId") Integer businessId, @Param("type") Integer type, @Param("userId") Integer userId, @Param("showStatus") Integer showStatus);
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ public class TabUpdateTips { ...@@ -17,7 +17,7 @@ public class TabUpdateTips {
/** /**
* *
*/ */
private Integer indexId; private Integer businessId;
/** /**
* 展示状态 1展示红的 0展示灰色已读 * 展示状态 1展示红的 0展示灰色已读
...@@ -45,12 +45,12 @@ public class TabUpdateTips { ...@@ -45,12 +45,12 @@ public class TabUpdateTips {
this.userId = userId; this.userId = userId;
} }
public Integer getIndexId() { public Integer getBusinessId() {
return indexId; return businessId;
} }
public void setIndexId(Integer indexId) { public void setBusinessId(Integer businessId) {
this.indexId = indexId; this.businessId = businessId;
} }
public Integer getShowStatus() { public Integer getShowStatus() {
......
...@@ -5,6 +5,8 @@ import com.gic.cloud.entity.TabDataExplain; ...@@ -5,6 +5,8 @@ import com.gic.cloud.entity.TabDataExplain;
import com.gic.cloud.qo.DataExplainQO; import com.gic.cloud.qo.DataExplainQO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import java.util.List;
/** /**
* @author zhiwj * @author zhiwj
* @Description: * @Description:
...@@ -21,4 +23,6 @@ public interface DataExplainService { ...@@ -21,4 +23,6 @@ public interface DataExplainService {
TabDataExplain getByDataExplainId(Integer dataExplainId); TabDataExplain getByDataExplainId(Integer dataExplainId);
Page<TabDataExplain> listDataExplain(DataExplainQO dataExplainQO); Page<TabDataExplain> listDataExplain(DataExplainQO dataExplainQO);
List<TabDataExplain> listAllDataExplain();
} }
...@@ -5,6 +5,8 @@ import com.gic.cloud.entity.TabIndex; ...@@ -5,6 +5,8 @@ import com.gic.cloud.entity.TabIndex;
import com.gic.cloud.qo.IndexQO; import com.gic.cloud.qo.IndexQO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import java.util.List;
/** /**
* @author zhiwj * @author zhiwj
* @Description: * @Description:
...@@ -23,4 +25,6 @@ public interface IndexService { ...@@ -23,4 +25,6 @@ public interface IndexService {
TabIndex getByIndexId(Integer indexId); TabIndex getByIndexId(Integer indexId);
Page<TabIndex> listIndex(IndexQO indexQO); Page<TabIndex> listIndex(IndexQO indexQO);
List<TabIndex> listAllIndex();
} }
...@@ -6,4 +6,16 @@ package com.gic.cloud.service; ...@@ -6,4 +6,16 @@ package com.gic.cloud.service;
* @date 2020-07-08 14:28 * @date 2020-07-08 14:28
*/ */
public interface UpdateTipService { public interface UpdateTipService {
void insertBySaveUser(Integer userId);
void insertBySaveBusiness(Integer businessId, Integer type);
/**
* 发布 要更新小红点
*/
void publish(Integer businessId, Integer type);
void erase(Integer userId);
} }
...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author zhiwj * @author zhiwj
...@@ -57,4 +58,9 @@ public class DataExplainServiceImpl implements DataExplainService { ...@@ -57,4 +58,9 @@ public class DataExplainServiceImpl implements DataExplainService {
PageHelper.startPage(dataExplainQO.getCurrentPage(), dataExplainQO.getPageSize()); PageHelper.startPage(dataExplainQO.getCurrentPage(), dataExplainQO.getPageSize());
return tabDataExplainMapper.listDataExplain(dataExplainQO); return tabDataExplainMapper.listDataExplain(dataExplainQO);
} }
@Override
public List<TabDataExplain> listAllDataExplain() {
return tabDataExplainMapper.listDataExplain(new DataExplainQO());
}
} }
package com.gic.cloud.service.impl; package com.gic.cloud.service.impl;
import com.gic.cloud.constants.LogTypeEnum; import com.gic.cloud.constants.LogAndUpdateTipsTypeEnum;
import com.gic.cloud.dao.mapper.TabIndexLogMapper; import com.gic.cloud.dao.mapper.TabIndexLogMapper;
import com.gic.cloud.dto.DataExplainDTO; import com.gic.cloud.dto.DataExplainDTO;
import com.gic.cloud.dto.IndexDTO; import com.gic.cloud.dto.IndexDTO;
...@@ -42,7 +42,7 @@ public class IndexLogServiceImpl implements IndexLogService { ...@@ -42,7 +42,7 @@ public class IndexLogServiceImpl implements IndexLogService {
indexLog.setStatus(1); indexLog.setStatus(1);
indexLog.setCreateTime(new Date()); indexLog.setCreateTime(new Date());
indexLog.setUpdateTime(new Date()); indexLog.setUpdateTime(new Date());
indexLog.setType(LogTypeEnum.INDEX.getCode()); indexLog.setType(LogAndUpdateTipsTypeEnum.INDEX.getCode());
tabIndexLogMapper.insert(indexLog); tabIndexLogMapper.insert(indexLog);
} }
...@@ -66,7 +66,7 @@ public class IndexLogServiceImpl implements IndexLogService { ...@@ -66,7 +66,7 @@ public class IndexLogServiceImpl implements IndexLogService {
indexLog.setStatus(1); indexLog.setStatus(1);
indexLog.setCreateTime(new Date()); indexLog.setCreateTime(new Date());
indexLog.setUpdateTime(new Date()); indexLog.setUpdateTime(new Date());
indexLog.setType(LogTypeEnum.INDEX.getCode()); indexLog.setType(LogAndUpdateTipsTypeEnum.INDEX.getCode());
tabIndexLogMapper.insert(indexLog); tabIndexLogMapper.insert(indexLog);
} }
} }
...@@ -11,6 +11,8 @@ import com.github.pagehelper.PageHelper; ...@@ -11,6 +11,8 @@ import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author zhiwj * @author zhiwj
* @Description: * @Description:
...@@ -61,4 +63,9 @@ public class IndexServiceImpl implements IndexService { ...@@ -61,4 +63,9 @@ public class IndexServiceImpl implements IndexService {
PageHelper.startPage(indexQO.getCurrentPage(), indexQO.getPageSize()); PageHelper.startPage(indexQO.getCurrentPage(), indexQO.getPageSize());
return tabIndexMapper.listIndex(indexQO); return tabIndexMapper.listIndex(indexQO);
} }
@Override
public List<TabIndex> listAllIndex() {
return tabIndexMapper.listIndex(new IndexQO());
}
} }
package com.gic.cloud.service.impl; package com.gic.cloud.service.impl;
import com.gic.cloud.constants.LogAndUpdateTipsTypeEnum;
import com.gic.cloud.dao.mapper.TabUpdateTipsMapper;
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.UserQO;
import com.gic.cloud.service.DataExplainService;
import com.gic.cloud.service.IndexService;
import com.gic.cloud.service.UpdateTipService; import com.gic.cloud.service.UpdateTipService;
import com.gic.cloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author zhiwj * @author zhiwj
* @Description: * @Description:
...@@ -11,4 +24,57 @@ import org.springframework.stereotype.Service; ...@@ -11,4 +24,57 @@ import org.springframework.stereotype.Service;
@Service @Service
public class UpdateTipServiceImpl implements UpdateTipService { public class UpdateTipServiceImpl implements UpdateTipService {
@Autowired
private TabUpdateTipsMapper tabUpdateTipsMapper;
@Autowired
private UserService userService;
@Autowired
private IndexService indexService;
@Autowired
private DataExplainService dataExplainService;
@Override
public void insertBySaveUser(Integer userId) {
List<TabIndex> indexList = indexService.listAllIndex();
for (TabIndex index : indexList) {
TabUpdateTips tabUpdateTips = new TabUpdateTips();
tabUpdateTips.setUserId(userId);
tabUpdateTips.setBusinessId(index.getIndexId());
tabUpdateTips.setShowStatus(1);
tabUpdateTips.setType(LogAndUpdateTipsTypeEnum.INDEX.getCode());
tabUpdateTipsMapper.insertSelective(tabUpdateTips);
}
List<TabDataExplain> dataExplainList = dataExplainService.listAllDataExplain();
for (TabDataExplain dataExplain : dataExplainList) {
TabUpdateTips tabUpdateTips = new TabUpdateTips();
tabUpdateTips.setUserId(userId);
tabUpdateTips.setBusinessId(dataExplain.getDataExplainId());
tabUpdateTips.setShowStatus(1);
tabUpdateTips.setType(LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
tabUpdateTipsMapper.insertSelective(tabUpdateTips);
}
}
@Override
public void insertBySaveBusiness(Integer businessId, Integer type) {
List<TabSysUser> users = userService.listUser(new UserQO());
for (TabSysUser user : users) {
TabUpdateTips tabUpdateTips = new TabUpdateTips();
tabUpdateTips.setUserId(user.getUserId());
tabUpdateTips.setBusinessId(businessId);
tabUpdateTips.setShowStatus(1);
tabUpdateTips.setType(type);
tabUpdateTipsMapper.insertSelective(tabUpdateTips);
}
}
@Override
public void publish(Integer businessId, Integer type) {
tabUpdateTipsMapper.updateStatus(businessId, type, null, 1);
}
@Override
public void erase(Integer userId) {
tabUpdateTipsMapper.updateStatus(null, null, userId, 0);
}
} }
...@@ -2,12 +2,15 @@ package com.gic.cloud.service.outer.impl; ...@@ -2,12 +2,15 @@ package com.gic.cloud.service.outer.impl;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.constants.LogAndUpdateTipsTypeEnum;
import com.gic.cloud.constants.UpdateTypeEnum;
import com.gic.cloud.dto.DataExplainDTO; import com.gic.cloud.dto.DataExplainDTO;
import com.gic.cloud.entity.TabDataExplain; import com.gic.cloud.entity.TabDataExplain;
import com.gic.cloud.qo.DataExplainQO; import com.gic.cloud.qo.DataExplainQO;
import com.gic.cloud.service.DataExplainApiService; import com.gic.cloud.service.DataExplainApiService;
import com.gic.cloud.service.DataExplainService; import com.gic.cloud.service.DataExplainService;
import com.gic.cloud.service.IndexLogService; import com.gic.cloud.service.IndexLogService;
import com.gic.cloud.service.UpdateTipService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils; import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode; import com.gic.enterprise.error.ErrorCode;
...@@ -27,6 +30,8 @@ public class DataExplainApiServiceImpl implements DataExplainApiService { ...@@ -27,6 +30,8 @@ public class DataExplainApiServiceImpl implements DataExplainApiService {
private DataExplainService dataExplainService; private DataExplainService dataExplainService;
@Autowired @Autowired
private IndexLogService indexLogService; private IndexLogService indexLogService;
@Autowired
private UpdateTipService updateTipService;
@Override @Override
public ServiceResponse<Void> saveDataExplain(DataExplainDTO dataExplainDTO) { public ServiceResponse<Void> saveDataExplain(DataExplainDTO dataExplainDTO) {
...@@ -39,6 +44,9 @@ public class DataExplainApiServiceImpl implements DataExplainApiService { ...@@ -39,6 +44,9 @@ public class DataExplainApiServiceImpl implements DataExplainApiService {
dataExplainDTO.setDataExplainId(dataExplainId); dataExplainDTO.setDataExplainId(dataExplainId);
// 日志 // 日志
indexLogService.saveDataExplainInsertLog(dataExplainDTO); indexLogService.saveDataExplainInsertLog(dataExplainDTO);
// 红点提示
updateTipService.insertBySaveBusiness(dataExplainId, LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
return EnterpriseServiceResponse.success(); return EnterpriseServiceResponse.success();
} }
...@@ -52,7 +60,10 @@ public class DataExplainApiServiceImpl implements DataExplainApiService { ...@@ -52,7 +60,10 @@ public class DataExplainApiServiceImpl implements DataExplainApiService {
// 保存 // 保存
dataExplainService.update(dataExplainDTO); dataExplainService.update(dataExplainDTO);
// 日志 // 日志
indexLogService.saveDataExplainUpdateLog(dataExplainDTO, reason); if (UpdateTypeEnum.UPDATE_PUBLISH.getCode().equals(updateType)) {
indexLogService.saveDataExplainUpdateLog(dataExplainDTO, reason);
updateTipService.publish(dataExplainDTO.getDataExplainId(), LogAndUpdateTipsTypeEnum.DATA_EXPLAIN.getCode());
}
return EnterpriseServiceResponse.success(); return EnterpriseServiceResponse.success();
} }
......
...@@ -2,6 +2,8 @@ package com.gic.cloud.service.outer.impl; ...@@ -2,6 +2,8 @@ package com.gic.cloud.service.outer.impl;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.constants.LogAndUpdateTipsTypeEnum;
import com.gic.cloud.constants.UpdateTypeEnum;
import com.gic.cloud.dto.IndexDTO; import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.entity.TabIndex; import com.gic.cloud.entity.TabIndex;
import com.gic.cloud.qo.IndexQO; import com.gic.cloud.qo.IndexQO;
...@@ -49,8 +51,8 @@ public class IndexApiServiceImpl implements IndexApiService { ...@@ -49,8 +51,8 @@ public class IndexApiServiceImpl implements IndexApiService {
// 写日志 // 写日志
indexLogService.saveIndexInsertLog(indexDTO); indexLogService.saveIndexInsertLog(indexDTO);
// todo 红点提示 // 红点提示
// updateTipService.insert(); updateTipService.insertBySaveBusiness(indexId, LogAndUpdateTipsTypeEnum.INDEX.getCode());
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -68,11 +70,14 @@ public class IndexApiServiceImpl implements IndexApiService { ...@@ -68,11 +70,14 @@ public class IndexApiServiceImpl implements IndexApiService {
indexService.update(indexDTO); indexService.update(indexDTO);
// 保存关联表 // 保存关联表
indexModuleRelService.save(indexDTO.getIndexId(), indexDTO.getRelModuleIdList(), 1); indexModuleRelService.save(indexDTO.getIndexId(), indexDTO.getRelModuleIdList(), 1);
// 写日志
indexLogService.saveIndexUpdateLog(indexDTO, reason);
// todo 红点提示 if (UpdateTypeEnum.UPDATE_PUBLISH.getCode().equals(updateType)) {
// updateTipService.insert(); // 写日志
indexLogService.saveIndexUpdateLog(indexDTO, reason);
// 红点提示
updateTipService.publish(indexDTO.getIndexId(), LogAndUpdateTipsTypeEnum.INDEX.getCode());
}
return ServiceResponse.success(); return ServiceResponse.success();
} }
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
<resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabUpdateTips"> <resultMap id="BaseResultMap" type="com.gic.cloud.entity.TabUpdateTips">
<id column="update_tips_id" jdbcType="INTEGER" property="updateTipsId" /> <id column="update_tips_id" jdbcType="INTEGER" property="updateTipsId" />
<result column="user_id" jdbcType="INTEGER" property="userId" /> <result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="index_id" jdbcType="INTEGER" property="indexId" /> <result column="business_id" jdbcType="INTEGER" property="businessId" />
<result column="show_status" jdbcType="INTEGER" property="showStatus" /> <result column="show_status" jdbcType="INTEGER" property="showStatus" />
<result column="type" jdbcType="INTEGER" property="type" /> <result column="type" jdbcType="INTEGER" property="type" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
update_tips_id, user_id, index_id, show_status, type update_tips_id, user_id, business_id, show_status, type
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
where update_tips_id = #{updateTipsId,jdbcType=INTEGER} where update_tips_id = #{updateTipsId,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.gic.cloud.entity.TabUpdateTips"> <insert id="insert" parameterType="com.gic.cloud.entity.TabUpdateTips">
insert into tab_update_tips (update_tips_id, user_id, index_id, insert into tab_update_tips (update_tips_id, user_id, business_id,
show_status, type) show_status, type)
values (#{updateTipsId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{indexId,jdbcType=INTEGER}, values (#{updateTipsId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{businessId,jdbcType=INTEGER},
#{showStatus,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}) #{showStatus,jdbcType=INTEGER}, #{type,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabUpdateTips"> <insert id="insertSelective" parameterType="com.gic.cloud.entity.TabUpdateTips">
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</if> </if>
<if test="indexId != null"> <if test="businessId != null">
index_id, business_id,
</if> </if>
<if test="showStatus != null"> <if test="showStatus != null">
show_status, show_status,
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER},
</if> </if>
<if test="indexId != null"> <if test="businessId != null">
#{indexId,jdbcType=INTEGER}, #{businessId,jdbcType=INTEGER},
</if> </if>
<if test="showStatus != null"> <if test="showStatus != null">
#{showStatus,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER},
...@@ -70,8 +70,8 @@ ...@@ -70,8 +70,8 @@
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=INTEGER}, user_id = #{userId,jdbcType=INTEGER},
</if> </if>
<if test="indexId != null"> <if test="businessId != null">
index_id = #{indexId,jdbcType=INTEGER}, business_id = #{businessId,jdbcType=INTEGER},
</if> </if>
<if test="showStatus != null"> <if test="showStatus != null">
show_status = #{showStatus,jdbcType=INTEGER}, show_status = #{showStatus,jdbcType=INTEGER},
...@@ -85,9 +85,23 @@ ...@@ -85,9 +85,23 @@
<update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabUpdateTips"> <update id="updateByPrimaryKey" parameterType="com.gic.cloud.entity.TabUpdateTips">
update tab_update_tips update tab_update_tips
set user_id = #{userId,jdbcType=INTEGER}, set user_id = #{userId,jdbcType=INTEGER},
index_id = #{indexId,jdbcType=INTEGER}, business_id = #{businessId,jdbcType=INTEGER},
show_status = #{showStatus,jdbcType=INTEGER}, show_status = #{showStatus,jdbcType=INTEGER},
type = #{type,jdbcType=INTEGER} type = #{type,jdbcType=INTEGER}
where update_tips_id = #{updateTipsId,jdbcType=INTEGER} where update_tips_id = #{updateTipsId,jdbcType=INTEGER}
</update> </update>
<update id="updateStatus">
update tab_update_tips set show_status = #{showStatus}
<where>
<if test="businessId != null ">
and business_id = #{businessId}
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
</where>
</update>
</mapper> </mapper>
\ 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