Commit 57ef18b6 by 田超

Merge branch 'fixbug/1025505' into 'master'

bug: [1025505] 添加群然后下加群还存在

See merge request rays/pcloud-book!957
parents bae13fdb ce1a4598
...@@ -869,7 +869,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -869,7 +869,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
} }
} }
fillProductAndApp(nowItems); /* fillProductAndApp(nowItems);*/
} }
Iterator<RightsSettingTitle> iterator = rightsSettingTitles.iterator(); Iterator<RightsSettingTitle> iterator = rightsSettingTitles.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
......
...@@ -45,4 +45,17 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> { ...@@ -45,4 +45,17 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
* @return * @return
*/ */
List<RightsNowItem> getByNewsIds(List<Long> newsIds); List<RightsNowItem> getByNewsIds(List<Long> newsIds);
/**
*
* @param newArrayList
* @return
*/
List<RightsNowItem> getByActivityGroupIds(List<Long> newArrayList);
/**
* 删除失效的模板群
* @param activityIds
*/
void deleteInvalidActivityGroups(List<Long> activityIds);
} }
...@@ -3,7 +3,6 @@ package com.pcloud.book.rightsSetting.dao; ...@@ -3,7 +3,6 @@ package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail; import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -36,4 +35,17 @@ public interface RightsSettingItemDetailDao extends BaseDao<RightsSettingItemDet ...@@ -36,4 +35,17 @@ public interface RightsSettingItemDetailDao extends BaseDao<RightsSettingItemDet
* @return * @return
*/ */
List<RightsSettingItemDetail> getByNewsIds(List<Long> newsIds); List<RightsSettingItemDetail> getByNewsIds(List<Long> newsIds);
/**
* 获取社群关联了多少权益
* @param newArrayList
* @return
*/
List<RightsSettingItemDetail> getByActivityIds(List<Long> newArrayList);
/**
* 删除无效的模板群
* @param activityIds
*/
void deleteInvalidActivityGroups(List<Long> activityIds);
} }
\ No newline at end of file
...@@ -83,4 +83,15 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements ...@@ -83,4 +83,15 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
public List<RightsNowItem> getByNewsIds(List<Long> newsIds) { public List<RightsNowItem> getByNewsIds(List<Long> newsIds) {
return getSqlSession().selectList(getStatement("getByNewsIds"), newsIds); return getSqlSession().selectList(getStatement("getByNewsIds"), newsIds);
} }
@Override
public List<RightsNowItem> getByActivityGroupIds(List<Long> activityIds) {
return getSessionTemplate().selectList(getStatement("getByActivityGroupIds"), activityIds);
}
@Override
public void deleteInvalidActivityGroups(List<Long> activityIds) {
getSessionTemplate().delete(getStatement("deleteInvalidActivityGroups"), activityIds);
}
} }
...@@ -4,9 +4,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail; ...@@ -4,9 +4,7 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao; import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -47,4 +45,14 @@ public class RightsSettingItemDetailDaoImpl extends BaseDaoImpl<RightsSettingIte ...@@ -47,4 +45,14 @@ public class RightsSettingItemDetailDaoImpl extends BaseDaoImpl<RightsSettingIte
public List<RightsSettingItemDetail> getByNewsIds(List<Long> newsIds) { public List<RightsSettingItemDetail> getByNewsIds(List<Long> newsIds) {
return getSqlSession().selectList(getStatement("getByNewsIds"), newsIds); return getSqlSession().selectList(getStatement("getByNewsIds"), newsIds);
} }
@Override
public List<RightsSettingItemDetail> getByActivityIds(List<Long> activityIds) {
return getSessionTemplate().selectList(getStatement("getByActivityIds"), activityIds);
}
@Override
public void deleteInvalidActivityGroups(List<Long> activityIds) {
getSessionTemplate().delete(getStatement("deleteInvalidActivityGroups"), activityIds);
}
} }
\ No newline at end of file
...@@ -66,7 +66,7 @@ public interface PcloudGroupActivityBiz { ...@@ -66,7 +66,7 @@ public interface PcloudGroupActivityBiz {
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify, PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify,
Long secondClassify, Long secondClassify,
Long gradeLabelId, Long gradeLabelId,
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode, Long agentId); Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode, Long agentId, Integer isChoose);
/** /**
* 获取共读活动列表(弹窗) * 获取共读活动列表(弹窗)
......
...@@ -32,6 +32,8 @@ import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; ...@@ -32,6 +32,8 @@ import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dao.RightsNowItemDao; import com.pcloud.book.rightsSetting.dao.RightsNowItemDao;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao; import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle; import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import com.pcloud.book.rightsSetting.enums.RightsNowItemType; import com.pcloud.book.rightsSetting.enums.RightsNowItemType;
import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper; import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
...@@ -51,6 +53,7 @@ import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO; ...@@ -51,6 +53,7 @@ import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.ListGroupActivityResponseVO; import com.pcloud.book.skill.facade.response.ListGroupActivityResponseVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO; import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -72,7 +75,6 @@ import java.util.Arrays; ...@@ -72,7 +75,6 @@ import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -163,6 +165,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -163,6 +165,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
public void batchUpdateShowState(GroupActivityShowStateVO groupActivityShowStateVO) { public void batchUpdateShowState(GroupActivityShowStateVO groupActivityShowStateVO) {
pcloudGroupActivityDao.batchUpdateShowState(groupActivityShowStateVO); pcloudGroupActivityDao.batchUpdateShowState(groupActivityShowStateVO);
readerConsr.deleteGroupRecore(groupActivityShowStateVO.getIds(), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.UPDATE.value, groupActivityShowStateVO.getShowState() ? 1 : 0); readerConsr.deleteGroupRecore(groupActivityShowStateVO.getIds(), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.UPDATE.value, groupActivityShowStateVO.getShowState() ? 1 : 0);
if (!groupActivityShowStateVO.getShowState()) {
deleteInvalidGroupIds(groupActivityShowStateVO.getIds());
}
} }
@ParamLog("批量删除共读模板") @ParamLog("批量删除共读模板")
...@@ -173,6 +178,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -173,6 +178,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
} }
pcloudGroupActivityDao.deleteByIds(ids); pcloudGroupActivityDao.deleteByIds(ids);
readerConsr.deleteGroupRecore(ids, ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.DELETE.value, null); readerConsr.deleteGroupRecore(ids, ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.DELETE.value, null);
deleteInvalidGroupIds(ids);
} }
...@@ -245,6 +251,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -245,6 +251,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
} }
pcloudGroupActivityDao.deleteById(id); pcloudGroupActivityDao.deleteById(id);
readerConsr.deleteGroupRecore(Lists.newArrayList(id), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.DELETE.value, null); readerConsr.deleteGroupRecore(Lists.newArrayList(id), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.DELETE.value, null);
deleteInvalidGroupIds(Lists.newArrayList(id));
} }
@Override @Override
...@@ -297,7 +304,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -297,7 +304,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
public PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify, public PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify,
Long secondClassify, Long secondClassify,
Long gradeLabelId, Long gradeLabelId,
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode,Long agentId) { Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode, Long agentId, Integer isChoose) {
PageParam pageParam = new PageParam(currentPage, numPerPage); PageParam pageParam = new PageParam(currentPage, numPerPage);
BaseTempletClassify baseTempletClassify =new BaseTempletClassify(); BaseTempletClassify baseTempletClassify =new BaseTempletClassify();
...@@ -320,6 +327,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -320,6 +327,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
paraMap.put("subjectLabelId", baseTempletClassify.getSubjectLabelId()); paraMap.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
paraMap.put("cityCode", cityCode); paraMap.put("cityCode", cityCode);
paraMap.put("agentId", agentId); paraMap.put("agentId", agentId);
paraMap.put("isChoose", isChoose);
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "queryGroupActivity"); PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "queryGroupActivity");
if (null == queryGroupActivity || CollectionUtils.isEmpty(queryGroupActivity.getRecordList())) { if (null == queryGroupActivity || CollectionUtils.isEmpty(queryGroupActivity.getRecordList())) {
return queryGroupActivity; return queryGroupActivity;
...@@ -649,9 +657,30 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -649,9 +657,30 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
} }
byId.setIsShow(showStateDTO.getIsShow()); byId.setIsShow(showStateDTO.getIsShow());
pcloudGroupActivityDao.updateByPrimaryKeySelective(byId); pcloudGroupActivityDao.updateByPrimaryKeySelective(byId);
if (YesOrNoEnums.NO.getValue().equals(showStateDTO.getIsShow())) {
deleteInvalidGroupIds(Lists.newArrayList(showStateDTO.getId()));
}
readerConsr.deleteGroupRecore(Lists.newArrayList(byId.getId()), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.UPDATE.value, showStateDTO.getIsShow()); readerConsr.deleteGroupRecore(Lists.newArrayList(byId.getId()), ActivityGroupTypeEnum.THIRD_GROUP.value, GroupUpdateTypeEnum.UPDATE.value, showStateDTO.getIsShow());
} }
private void deleteInvalidGroupIds(List<Long> activityIds) {
if (ListUtils.isEmpty(activityIds)) {
return;
}
//查询该资讯关联了多少权益
List<RightsNowItem> rightsNowItems = rightsNowItemDao.getByActivityGroupIds(activityIds);
List<RightsSettingItemDetail> rightsSettingItemDetails = rightsSettingItemDetailDao.getByActivityIds(activityIds);
if (!ListUtils.isEmpty(rightsNowItems)) {
log.info("删除无效的资源前先查询rightsNowItems:{}", rightsNowItems);
rightsNowItemDao.deleteInvalidActivityGroups(activityIds);
}
if (!ListUtils.isEmpty(rightsSettingItemDetails)) {
log.info("删除无效的资源前先查询rightsSettingItemDetails:{}", rightsSettingItemDetails);
rightsSettingItemDetailDao.deleteInvalidActivityGroups(activityIds);
}
}
@Override @Override
public Map<Long, GroupActivity4AppletDTO> getByIds4Now(List<Long> ids) { public Map<Long, GroupActivity4AppletDTO> getByIds4Now(List<Long> ids) {
if (ListUtils.isEmpty(ids)) { if (ListUtils.isEmpty(ids)) {
......
...@@ -109,10 +109,12 @@ public class PcloudGroupActivityFacade { ...@@ -109,10 +109,12 @@ public class PcloudGroupActivityFacade {
@RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId, @RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId,
@RequestParam(value = "cityCode", required = false) String cityCode, @RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam("numPerPage") Integer numPerPage, @RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage){ @RequestParam("currentPage") Integer currentPage,
@RequestParam(value = "isChoose", required = false) Integer isChoose){
Map<String, Object> map = SessionUtil.getToken4Redis(token); Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID); Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage,cityCode, agentId)); return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,
secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage,cityCode, agentId, isChoose));
} }
@ApiOperation("获取共读活动列表(弹窗)") @ApiOperation("获取共读活动列表(弹窗)")
......
...@@ -233,4 +233,35 @@ ...@@ -233,4 +233,35 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="getByActivityGroupIds" parameterType="list" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
rights_now_item
where
serve_type = "GROUP"
and
group_type &lt;&gt; 2
and
serve_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteInvalidActivityGroups" parameterType="list">
delete
from
rights_now_item
where
serve_type = "GROUP"
and
group_type &lt;&gt; 2
and
serve_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -164,4 +164,35 @@ ...@@ -164,4 +164,35 @@
</foreach> </foreach>
</select> </select>
<select id="getByActivityIds" parameterType="list" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
rights_setting_item_detail
where
serve_type = "GROUP"
and
group_type &lt;&gt; 2
and
serve_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteInvalidActivityGroups" parameterType="list">
delete
from
rights_setting_item_detail
where
serve_type = "GROUP"
and
group_type &lt;&gt; 2
and
serve_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -138,6 +138,11 @@ ...@@ -138,6 +138,11 @@
pcloud_group_activity a left join book_group_classify b on a.book_group_classify_id = b.id pcloud_group_activity a left join book_group_classify b on a.book_group_classify_id = b.id
WHERE WHERE
a.is_delete = 0 a.is_delete = 0
<if test='isChoose == "1"'>
and
ifnull(b.is_delete, 0) = 0
and a.is_Show = 1
</if>
<if test="proLabelId != null"> <if test="proLabelId != null">
and a.pro_label_id = #{proLabelId} and a.pro_label_id = #{proLabelId}
</if> </if>
...@@ -196,8 +201,8 @@ ...@@ -196,8 +201,8 @@
count(c.classify_id) AS groupCount count(c.classify_id) AS groupCount
FROM FROM
pcloud_group_activity a pcloud_group_activity a
LEFT JOIN book_group_classify b ON a.book_group_classify_id = b.id AND b.is_delete = 0 LEFT JOIN book_group_classify b ON a.book_group_classify_id = b.id
LEFT JOIN book_group_qrcode c ON b.id = c.classify_id AND c.is_delete = 0 LEFT JOIN book_group_qrcode c ON b.id = c.classify_id
LEFT JOIN book_group d ON b.book_group_id = d.id LEFT JOIN book_group d ON b.book_group_id = d.id
<where> <where>
<if test="name!=null or bookIds != null and bookIds.size()>0"> <if test="name!=null or bookIds != null and bookIds.size()>0">
...@@ -222,7 +227,7 @@ ...@@ -222,7 +227,7 @@
<if test="joinType != null"> <if test="joinType != null">
AND a.join_type = #{joinType} AND a.join_type = #{joinType}
</if> </if>
AND a.is_delete = 0 AND a.is_delete = 0 and ifnull(b.is_delete, 0) = 0 and a.is_show = 1
<choose> <choose>
<when test="agentId != null"> <when test="agentId != null">
and a.agent_id = #{agentId} and a.agent_id = #{agentId}
......
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