解绑、失效、删除 逻辑调整
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.point.LineCountDTO;
|
||||
import com.cool.store.entity.PointInfoDO;
|
||||
import com.cool.store.mapper.PointInfoMapper;
|
||||
@@ -96,4 +97,11 @@ public class PointInfoDAO {
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
return pointInfoMapper.getTeamPointPage(request);
|
||||
}
|
||||
|
||||
public Integer recyclePoint(Long pointId) {
|
||||
if(Objects.isNull(pointId)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
return pointInfoMapper.recyclePoint(pointId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,18 @@ public class PointRecommendDAO {
|
||||
* 更新推荐状态
|
||||
* @param pointId
|
||||
* @param status
|
||||
* @param excludeStatusList 排除状态
|
||||
* @return
|
||||
*/
|
||||
public Integer updateRecommendStatus(Long pointId, PointRecommendStatusEnum status) {
|
||||
public Integer updateRecommendStatus(Long pointId, PointRecommendStatusEnum status, List<PointRecommendStatusEnum> excludeStatusList) {
|
||||
if(Objects.isNull(status)){
|
||||
return 0;
|
||||
}
|
||||
return pointRecommendMapper.updateShopPointRecommendStatus(pointId, status.getCode());
|
||||
List<Integer> excludeStatus = Lists.newArrayList();
|
||||
if(CollectionUtils.isNotEmpty(excludeStatusList)){
|
||||
excludeStatus = excludeStatusList.stream().map(PointRecommendStatusEnum::getCode).collect(Collectors.toList());
|
||||
}
|
||||
return pointRecommendMapper.updateShopPointRecommendStatus(pointId, status.getCode(), excludeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,4 +104,16 @@ public class ShopInfoDAO {
|
||||
public StageShopCountVO getStageShopCount(Long lineId) {
|
||||
return shopInfoMapper.getStageShopCount(lineId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑铺位
|
||||
* @param shopId
|
||||
* @return
|
||||
*/
|
||||
public Integer unbindPoint(Long shopId){
|
||||
if(Objects.isNull(shopId)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
return shopInfoMapper.unbindPoint(shopId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,11 @@ public class ShopRentInfoDAO {
|
||||
}
|
||||
return shopRentInfoMapper.updateByPrimaryKeySelective(shopRentInfo);
|
||||
}
|
||||
|
||||
public Integer deleteRentContractByShopId(Long shopId) {
|
||||
if(Objects.isNull(shopId)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
return shopRentInfoMapper.deleteRentContractByShopId(shopId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,19 @@ public class ShopStageInfoDAO {
|
||||
return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新子阶段到未开始状态
|
||||
* @param shopId
|
||||
* @param shopSubStageEnum
|
||||
* @return
|
||||
*/
|
||||
public Integer updateShopStageToNotStarted(Long shopId, ShopSubStageEnum shopSubStageEnum) {
|
||||
if(Objects.isNull(shopId) || Objects.isNull(shopSubStageEnum)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
return shopStageInfoMapper.updateShopStageToNotStarted(shopId, shopSubStageEnum.getShopSubStage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺阶段状态及审核信息
|
||||
* @param shopId
|
||||
|
||||
@@ -65,4 +65,11 @@ public interface PointInfoMapper extends Mapper<PointInfoDO> {
|
||||
* @return
|
||||
*/
|
||||
Page<PointInfoDO> getTeamPointPage(@Param("request") AllPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 回收铺位
|
||||
* @param pointId
|
||||
* @return
|
||||
*/
|
||||
Integer recyclePoint(@Param("pointId") Long pointId);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
Integer updateShopPointRecommendStatus(@Param("pointId") Long pointId, @Param("status") Integer status);
|
||||
Integer updateShopPointRecommendStatus(@Param("pointId") Long pointId, @Param("status") Integer status, @Param("excludeStatus") List<Integer> excludeStatus);
|
||||
|
||||
/**
|
||||
* 跟进点位 和 推荐状态 更新推荐状态
|
||||
|
||||
@@ -46,4 +46,11 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
||||
* @return
|
||||
*/
|
||||
StageShopCountVO getStageShopCount(@Param("lineId") Long lineId);
|
||||
|
||||
/**
|
||||
* 解绑店铺
|
||||
* @param shopId
|
||||
* @return
|
||||
*/
|
||||
Integer unbindPoint(@Param("shopId") Long shopId);
|
||||
}
|
||||
@@ -13,4 +13,10 @@ public interface ShopRentInfoMapper extends Mapper<ShopRentInfoDO> {
|
||||
*/
|
||||
ShopRentInfoDO getRentContractByShopId(@Param("shopId") Long shopId);
|
||||
|
||||
/**
|
||||
* 根据店铺id删除租赁合同
|
||||
* @param shopId
|
||||
* @return
|
||||
*/
|
||||
Integer deleteRentContractByShopId(@Param("shopId") Long shopId);
|
||||
}
|
||||
@@ -55,4 +55,12 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
|
||||
* @return
|
||||
*/
|
||||
ShopStageInfoDO getShopSubStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage);
|
||||
|
||||
/**
|
||||
* 更新阶段到未开始状态
|
||||
* @param shopId
|
||||
* @param shopSubStage
|
||||
* @return
|
||||
*/
|
||||
Integer updateShopStageToNotStarted(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage);
|
||||
}
|
||||
@@ -185,4 +185,8 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="recyclePoint">
|
||||
update xfsg_point_info set line_id = null, shop_id = null, select_status = 0, update_time = now(), point_status = if(point_status = 6, 5, point_status)) where id = #{pointId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -15,6 +15,12 @@
|
||||
|
||||
<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">
|
||||
and status not in
|
||||
<foreach collection="excludeStatus" separator="," open="(" close=")" item="status">
|
||||
#{status}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="updateRecommendStatusByStatusAndPointId">
|
||||
|
||||
@@ -60,4 +60,8 @@
|
||||
group by shop_stage
|
||||
</select>
|
||||
|
||||
<update id="unbindPoint">
|
||||
update xfsg_shop_info set point_id = null where id = #{shopId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -36,4 +36,12 @@
|
||||
where shop_id = #{shopId} and deleted = 0
|
||||
</select>
|
||||
|
||||
<update id="deleteRentContractByShopId">
|
||||
update
|
||||
xfsg_shop_rent_info
|
||||
set
|
||||
deleted = 1
|
||||
where shop_id = #{shopId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -78,4 +78,17 @@
|
||||
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
|
||||
</update>
|
||||
|
||||
<update id="updateShopStageToNotStarted">
|
||||
update
|
||||
xfsg_shop_stage_info
|
||||
set
|
||||
shop_sub_stage_status = -100,
|
||||
is_terminated = 0,
|
||||
remark = '未开始',
|
||||
actual_complete_time = null,
|
||||
audit_id = null
|
||||
where
|
||||
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -143,6 +143,7 @@ public class PointServiceImpl implements PointService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer pointInvalid(Long pointId) {
|
||||
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
||||
if(Objects.isNull(pointInfo)){
|
||||
@@ -156,7 +157,26 @@ public class PointServiceImpl implements PointService {
|
||||
updatePoint.setId(pointId);
|
||||
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_7.getCode());
|
||||
pointInfoDAO.updatePointInfo(updatePoint);
|
||||
return pointRecommendDAO.updateRecommendStatus(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6);
|
||||
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||
rollbackSelectPoint(pointInfo.getShopId());
|
||||
}
|
||||
return pointRecommendDAO.updateRecommendStatus(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退选址状态
|
||||
* @return
|
||||
*/
|
||||
private void rollbackSelectPoint(Long shopId){
|
||||
shopInfoDAO.unbindPoint(shopId);
|
||||
//回到待选址状态
|
||||
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_0);
|
||||
//租赁合同回到未开始
|
||||
Integer result = shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_2);
|
||||
if(result > CommonConstants.ZERO){
|
||||
//删除租赁合同
|
||||
shopRentInfoDAO.deleteRentContractByShopId(shopId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,10 +190,10 @@ public class PointServiceImpl implements PointService {
|
||||
if(PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_SIGNED);
|
||||
}
|
||||
PointInfoDO updatePoint = new PointInfoDO();
|
||||
updatePoint.setId(pointId);
|
||||
updatePoint.setSelectStatus(SelectStatusEnum.SELECT_STATUS_0.getCode());
|
||||
pointInfoDAO.updatePointInfo(updatePoint);
|
||||
pointInfoDAO.recyclePoint(pointId);
|
||||
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||
rollbackSelectPoint(pointInfo.getShopId());
|
||||
}
|
||||
//将已选择、已被他人选择的状态更新成待选泽
|
||||
return pointRecommendDAO.updateRecommendStatusByStatusAndPointId(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3));
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.dao.LineAuditInfoDAO;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.dao.ShopStageInfoDAO;
|
||||
import com.cool.store.entity.LineAuditInfoDO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.entity.ShopInfoDO;
|
||||
import com.cool.store.entity.ShopStageInfoDO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.point.ShopStageEnum;
|
||||
import com.cool.store.enums.point.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.AddShopRequest;
|
||||
import com.cool.store.request.DeleteShopRequest;
|
||||
@@ -23,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -44,6 +39,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
private LineAuditInfoDAO lineAuditInfoDAO;
|
||||
@Resource
|
||||
private LineInfoDAO lineInfoDAO;
|
||||
@Resource
|
||||
private PointInfoDAO pointInfoDAO;
|
||||
@Resource
|
||||
private PointRecommendDAO pointRecommendDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -95,6 +94,17 @@ public class ShopServiceImpl implements ShopService {
|
||||
@Override
|
||||
public Integer deleteShop(DeleteShopRequest request) {
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopInfo.getId(), ShopSubStageEnum.SHOP_STAGE_3);
|
||||
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_9.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
|
||||
}
|
||||
if(Objects.nonNull(shopInfo.getPointId())){
|
||||
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId());
|
||||
if(Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||
pointInfoDAO.recyclePoint(pointInfo.getId());
|
||||
}
|
||||
pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5));
|
||||
}
|
||||
ShopInfoDO updateShop = new ShopInfoDO();
|
||||
updateShop.setId(request.getShopId());
|
||||
updateShop.setDeleted(true);
|
||||
|
||||
Reference in New Issue
Block a user