Commit f5532af2 by zhiwj

Merge branch 'developer' into 'master'

Developer

See merge request !38
parents d16a8715 6b6c5576
......@@ -66,6 +66,8 @@ public class IndexDescDTO implements Serializable {
private Integer updateTipsId;
private Integer indexId;
private String remark;
private int seq;
......@@ -199,4 +201,12 @@ public class IndexDescDTO implements Serializable {
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getIndexId() {
return indexId;
}
public void setIndexId(Integer indexId) {
this.indexId = indexId;
}
}
......@@ -3,6 +3,8 @@ package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabUpdateTips;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabUpdateTipsMapper {
/**
* 根据主键删除
......@@ -53,4 +55,6 @@ public interface TabUpdateTipsMapper {
int updateByPrimaryKey(TabUpdateTips record);
void updateStatus(@Param("businessId") Integer businessId, @Param("type") Integer type, @Param("userId") Integer userId, @Param("showStatus") Integer showStatus);
List<TabUpdateTips> listByIndexIdAndUser(@Param("ids") List<Integer> businessIdList, @Param("type") int type, @Param("userId") Integer userId);
}
\ No newline at end of file
package com.gic.cloud.service;
import com.gic.cloud.entity.TabUpdateTips;
import java.util.List;
import java.util.Map;
/**
* @author zhiwj
* @Description:
......@@ -18,4 +23,6 @@ public interface UpdateTipService {
void erase(Integer userId, Integer businessId, Integer type);
Map<Integer, TabUpdateTips> mapByIndexIdAndUser(List<Integer> indexIdList, int type, Integer userId);
}
......@@ -4,13 +4,18 @@ import com.gic.cloud.dao.mapper.TabIndexDescMapper;
import com.gic.cloud.dto.IndexDescDTO;
import com.gic.cloud.entity.TabIndexDesc;
import com.gic.cloud.entity.TabIndexDescEnterprise;
import com.gic.cloud.entity.TabUpdateTips;
import com.gic.cloud.service.IndexDescEnterpriseService;
import com.gic.cloud.service.IndexDescService;
import com.gic.cloud.service.UpdateTipService;
import com.github.pagehelper.PageHelper;
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
......@@ -24,6 +29,8 @@ public class IndexDescServiceImpl implements IndexDescService {
private TabIndexDescMapper tabIndexDescMapper;
@Autowired
private IndexDescEnterpriseService indexDescEnterpriseService;
@Autowired
private UpdateTipService updateTipService;
@Override
public List<IndexDescDTO> listByEnterpriseAndModule(Integer enterpriseId, String moduleId, String indexGroupName) {
......@@ -32,12 +39,34 @@ public class IndexDescServiceImpl implements IndexDescService {
@Override
public List<IndexDescDTO> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) {
return tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 1);
List<IndexDescDTO> indexDescDTOList = tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 1);
return parse(indexDescDTOList, userId);
}
@Override
public List<IndexDescDTO> listRecycle(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) {
return tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 0);
List<IndexDescDTO> indexDescDTOList = tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 0);
return parse(indexDescDTOList, userId);
}
private List<IndexDescDTO> parse(List<IndexDescDTO> indexDescDTOList, Integer userId) {
if (CollectionUtils.isNotEmpty(indexDescDTOList)) {
List<Integer> indexIdList = indexDescDTOList.stream().map(IndexDescDTO::getIndexId).collect(Collectors.toList());
Map<Integer, TabUpdateTips> updateTipsMap = updateTipService.mapByIndexIdAndUser(indexIdList, 1, userId);
for (IndexDescDTO indexDescDTO : indexDescDTOList) {
// -- ,ifnull(t4.show_status, 2) updateTips
// -- ,t4.update_tips_id updateTipsId
TabUpdateTips updateTips = updateTipsMap.get(indexDescDTO.getIndexId());
if (updateTips != null) {
indexDescDTO.setUpdateTips(updateTips.getShowStatus());
indexDescDTO.setUpdateTipsId(updateTips.getUpdateTipsId());
} else {
indexDescDTO.setUpdateTips(2);
indexDescDTO.setUpdateTipsId(null);
}
}
}
return indexDescDTOList;
}
@Override
......
......@@ -13,10 +13,14 @@ import com.gic.cloud.service.DataExplainService;
import com.gic.cloud.service.IndexService;
import com.gic.cloud.service.UpdateTipService;
import com.gic.cloud.service.UserService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -80,4 +84,16 @@ public class UpdateTipServiceImpl implements UpdateTipService {
tabUpdateTipsMapper.updateStatus(businessId, type, userId, 0);
}
@Override
public Map<Integer, TabUpdateTips> mapByIndexIdAndUser(List<Integer> indexIdList, int type, Integer userId) {
if (CollectionUtils.isNotEmpty(indexIdList)) {
List<TabUpdateTips> updateTipsList = tabUpdateTipsMapper.listByIndexIdAndUser(indexIdList, type, userId);
if (CollectionUtils.isNotEmpty(updateTipsList)) {
return updateTipsList.stream().collect(Collectors.toMap(TabUpdateTips::getBusinessId, e -> e, (a, b) -> a));
}
}
return Collections.emptyMap();
}
}
......@@ -7,6 +7,7 @@ import com.gic.cloud.entity.TabSysAccountGroup;
import com.gic.cloud.entity.TabSysUser;
import com.gic.cloud.qo.UserQO;
import com.gic.cloud.service.AccountGroupService;
import com.gic.cloud.service.UpdateTipService;
import com.gic.cloud.service.UserApiService;
import com.gic.cloud.service.UserService;
import com.gic.commons.util.EntityUtil;
......@@ -30,6 +31,8 @@ public class UserApiServiceImpl implements UserApiService{
private UserService userService;
@Autowired
private AccountGroupService accountGroupService;
@Autowired
private UpdateTipService updateTipService;
@Override
public ServiceResponse<Integer> saveUser(UserDTO dto) {
......@@ -38,7 +41,9 @@ public class UserApiServiceImpl implements UserApiService{
if (!validParamResult.isSuccess()) {
return ServiceResponse.failure(validParamResult.getCode(), validParamResult.getMessage());
}
return ServiceResponse.success(userService.saveUser(dto));
Integer userId = userService.saveUser(dto);
updateTipService.insertBySaveUser(userId);
return ServiceResponse.success(userId);
}
@Override
......
......@@ -163,13 +163,14 @@
</include>
,t2.index_desc_enterprise_id indexDescEnterpriseId
,t2.sort
,ifnull(t4.show_status, 2) updateTips
,t4.update_tips_id updateTipsId
,t3.index_id indexId
-- ,ifnull(t4.show_status, 2) updateTips
-- ,t4.update_tips_id updateTipsId
from tab_index_desc t1
left join tab_index_desc_enterprise t2 on t1.index_desc_id = t2.index_desc_id
left join tab_index_module_rel t5 on t1.index_desc_id = t5.module_id
left join tab_index t3 on t5.business_id = t3.index_id
left join tab_update_tips t4 on t3.index_id = t4.business_id
-- left join tab_update_tips t4 on t3.index_id = t4.business_id
where t1.status = 1
and t2.enterprise_id = #{enterpriseId}
and t1.module_id = #{moduleId}
......@@ -179,12 +180,11 @@
and t2.index_status = #{indexStatus}
and (t3.status = 1 or t3.status is null)
and (t3.classify_type = 1 or t3.classify_type is null)
AND (t4.business_id = 1 or t4.business_id is null)
AND (t4.type = 1 or t4.type is null)
-- AND (t4.type = 1 or t4.type is null)
and (t5.type = 1 or t5.type = 1 is null)
<if test="userId != null ">
<!--<if test="userId != null ">
AND (t4.user_id = #{userId} or t4.user_id is null )
</if>
</if>-->
order by t2.sort
</select>
<!-- <select id="listRecycle" resultMap="DTOResultMap">
......
......@@ -104,4 +104,15 @@
</if>
</where>
</update>
<select id="listByIndexIdAndUser" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_update_tips
where type = #{type}
and user_id = #{userId}
and business_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</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