推送逻辑新增校验

This commit is contained in:
zhangchenbiao
2024-04-19 10:34:04 +08:00
parent c38cd9b4a4
commit 8e66e20e97
4 changed files with 71 additions and 4 deletions

View File

@@ -136,4 +136,16 @@ public class PointRecommendDAO {
}
return pointRecommendMapper.rejectPoint(lineId, pointId, reason);
}
/**
* 获取铺位推送了哪些列表
* @param pointId
* @return
*/
public List<PointRecommendDO> getRecommendPointListByPointId(Long pointId) {
if(Objects.isNull(pointId)){
return Lists.newArrayList();
}
return pointRecommendMapper.getRecommendPointListByPointId(pointId);
}
}

View File

@@ -80,4 +80,11 @@ public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
* @return
*/
Integer rejectPoint(@Param("lineId") Long lineId, @Param("pointId") Long pointId, @Param("reason") String reason);
/**
* 获取铺位推送过哪些线索
* @param pointId
* @return
*/
List<PointRecommendDO> getRecommendPointListByPointId(@Param("pointId") Long pointId);
}

View File

@@ -13,6 +13,10 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="allColumn">
id, line_id, point_id, development_manager, status, reason, deleted, create_time, update_time
</sql>
<update id="updateShopPointRecommendStatus">
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and deleted = 0
<if test="excludeStatus != null and excludeStatus.size()>0">
@@ -72,7 +76,7 @@
<select id="getLineRecommendPointPage" resultType="com.cool.store.dto.point.MiniPointPageDTO">
select
p.id as pointId,
p.line_id as lineId,
pr.line_id as lineId,
p.point_name as pointName,
p.point_code as pointCode,
p.region_id as regionId,
@@ -103,7 +107,7 @@
xfsg_point_recommend
set
status = if(line_id = #{lineId}, 2, 3)
where point_id = #{pointId} and deleted = 0
where point_id = #{pointId} and deleted = 0 and status = 1
</update>
<update id="rejectPoint">
@@ -112,6 +116,15 @@
set
status = 4,
reason = #{reason}
where point_id = #{pointId} and line_id = #{lineId} and deleted = 0
where point_id = #{pointId} and line_id = #{lineId} and deleted = 0 and status = 1
</update>
<select id="getRecommendPointListByPointId" resultMap="BaseResultMap">
select
<include refid="allColumn"/>
from
xfsg_point_recommend
where
point_id = #{pointId} and deleted = 0
</select>
</mapper>

View File

@@ -539,6 +539,19 @@ public class PointServiceImpl implements PointService {
String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已失效");
}
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getRecommendPointList(request.getLineId());
if(CollectionUtils.isNotEmpty(recommendPointList)){
List<PointRecommendDO> recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(recommendList)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "铺位已推送,请勿重复推送");
}
List<PointRecommendDO> selectedList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(selectedList)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "铺位已选,请勿重复推送");
}
}
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}
@@ -546,7 +559,6 @@ public class PointServiceImpl implements PointService {
@Override
public Integer pointRecommendLine(PointRecommendLineRequest request) {
Long pointId = request.getPointId();
List<Long> lineIds = request.getLineIds();
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
if(Objects.isNull(pointInfo)){
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
@@ -557,6 +569,22 @@ public class PointServiceImpl implements PointService {
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
throw new ServiceException(ErrorCodeEnum.POINT_SELECTED);
}
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getRecommendPointListByPointId(pointId);
if(CollectionUtils.isNotEmpty(recommendPointList)){
List<PointRecommendDO> recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus()) ||
PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(recommendList)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "推送失败,铺位已被选");
}
List<Long> lineIds = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus())).map(PointRecommendDO::getLineId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(lineIds)){
lineIds.retainAll(request.getLineIds());
if(CollectionUtils.isNotEmpty(lineIds)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送");
}
}
}
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}
@@ -802,6 +830,13 @@ public class PointServiceImpl implements PointService {
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_6.getCode());
pointInfoDAO.updatePointInfo(updatePoint);
//系统筹建初始化 TODO
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_30);
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_40);
ShopInfoDO updateShop = new ShopInfoDO();
updateShop.setId(shopId);
updateShop.setShopStage(ShopStageEnum.SHOP_STAGE_2.getShopStage());
updateShop.setShopManagerUserId(null);
shopInfoDAO.updateShopInfo(updateShop);
}
return shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, subStageStatus, auditId);
}