推送逻辑新增校验
This commit is contained in:
@@ -136,4 +136,16 @@ public class PointRecommendDAO {
|
|||||||
}
|
}
|
||||||
return pointRecommendMapper.rejectPoint(lineId, pointId, reason);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,4 +80,11 @@ public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer rejectPoint(@Param("lineId") Long lineId, @Param("pointId") Long pointId, @Param("reason") String reason);
|
Integer rejectPoint(@Param("lineId") Long lineId, @Param("pointId") Long pointId, @Param("reason") String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取铺位推送过哪些线索
|
||||||
|
* @param pointId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PointRecommendDO> getRecommendPointListByPointId(@Param("pointId") Long pointId);
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,10 @@
|
|||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="allColumn">
|
||||||
|
id, line_id, point_id, development_manager, status, reason, deleted, create_time, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
<update id="updateShopPointRecommendStatus">
|
<update id="updateShopPointRecommendStatus">
|
||||||
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and deleted = 0
|
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and deleted = 0
|
||||||
<if test="excludeStatus != null and excludeStatus.size()>0">
|
<if test="excludeStatus != null and excludeStatus.size()>0">
|
||||||
@@ -72,7 +76,7 @@
|
|||||||
<select id="getLineRecommendPointPage" resultType="com.cool.store.dto.point.MiniPointPageDTO">
|
<select id="getLineRecommendPointPage" resultType="com.cool.store.dto.point.MiniPointPageDTO">
|
||||||
select
|
select
|
||||||
p.id as pointId,
|
p.id as pointId,
|
||||||
p.line_id as lineId,
|
pr.line_id as lineId,
|
||||||
p.point_name as pointName,
|
p.point_name as pointName,
|
||||||
p.point_code as pointCode,
|
p.point_code as pointCode,
|
||||||
p.region_id as regionId,
|
p.region_id as regionId,
|
||||||
@@ -103,7 +107,7 @@
|
|||||||
xfsg_point_recommend
|
xfsg_point_recommend
|
||||||
set
|
set
|
||||||
status = if(line_id = #{lineId}, 2, 3)
|
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>
|
||||||
|
|
||||||
<update id="rejectPoint">
|
<update id="rejectPoint">
|
||||||
@@ -112,6 +116,15 @@
|
|||||||
set
|
set
|
||||||
status = 4,
|
status = 4,
|
||||||
reason = #{reason}
|
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>
|
</update>
|
||||||
|
|
||||||
|
<select id="getRecommendPointListByPointId" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="allColumn"/>
|
||||||
|
from
|
||||||
|
xfsg_point_recommend
|
||||||
|
where
|
||||||
|
point_id = #{pointId} and deleted = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -539,6 +539,19 @@ public class PointServiceImpl implements PointService {
|
|||||||
String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
|
String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
|
||||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已失效");
|
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();
|
List<PointRecommendDO> recommendList = request.convertList();
|
||||||
return pointRecommendDAO.addRecommendPoint(recommendList);
|
return pointRecommendDAO.addRecommendPoint(recommendList);
|
||||||
}
|
}
|
||||||
@@ -546,7 +559,6 @@ public class PointServiceImpl implements PointService {
|
|||||||
@Override
|
@Override
|
||||||
public Integer pointRecommendLine(PointRecommendLineRequest request) {
|
public Integer pointRecommendLine(PointRecommendLineRequest request) {
|
||||||
Long pointId = request.getPointId();
|
Long pointId = request.getPointId();
|
||||||
List<Long> lineIds = request.getLineIds();
|
|
||||||
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
||||||
if(Objects.isNull(pointInfo)){
|
if(Objects.isNull(pointInfo)){
|
||||||
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
|
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())){
|
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||||
throw new ServiceException(ErrorCodeEnum.POINT_SELECTED);
|
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();
|
List<PointRecommendDO> recommendList = request.convertList();
|
||||||
return pointRecommendDAO.addRecommendPoint(recommendList);
|
return pointRecommendDAO.addRecommendPoint(recommendList);
|
||||||
}
|
}
|
||||||
@@ -802,6 +830,13 @@ public class PointServiceImpl implements PointService {
|
|||||||
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_6.getCode());
|
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_6.getCode());
|
||||||
pointInfoDAO.updatePointInfo(updatePoint);
|
pointInfoDAO.updatePointInfo(updatePoint);
|
||||||
//系统筹建初始化 TODO
|
//系统筹建初始化 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);
|
return shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, subStageStatus, auditId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user