This commit is contained in:
zhangchenbiao
2024-04-15 09:50:21 +08:00
parent f2c84f888f
commit 74e37a73c6
25 changed files with 572 additions and 63 deletions

View File

@@ -1,9 +1,13 @@
package com.cool.store.dao;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.dto.point.MiniPointPageDTO;
import com.cool.store.entity.PointRecommendDO;
import com.cool.store.enums.point.PointRecommendStatus;
import com.cool.store.enums.point.PointRecommendStatusEnum;
import com.cool.store.mapper.PointRecommendMapper;
import com.cool.store.request.MiniPointPageRequest;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
@@ -33,7 +37,7 @@ public class PointRecommendDAO {
* @param status
* @return
*/
public Integer updateRecommendStatus(Long pointId, PointRecommendStatus status) {
public Integer updateRecommendStatus(Long pointId, PointRecommendStatusEnum status) {
if(Objects.isNull(status)){
return 0;
}
@@ -47,11 +51,11 @@ public class PointRecommendDAO {
* @param statusList
* @return
*/
public Integer updateRecommendStatusByStatusAndPointId(Long pointId, PointRecommendStatus status, List<PointRecommendStatus> statusList) {
public Integer updateRecommendStatusByStatusAndPointId(Long pointId, PointRecommendStatusEnum status, List<PointRecommendStatusEnum> statusList) {
if(Objects.isNull(status) || CollectionUtils.isEmpty(statusList)){
return 0;
}
List<Integer> statusCodeList = statusList.stream().map(PointRecommendStatus::getCode).collect(Collectors.toList());
List<Integer> statusCodeList = statusList.stream().map(PointRecommendStatusEnum::getCode).collect(Collectors.toList());
return pointRecommendMapper.updateRecommendStatusByStatusAndPointId(pointId, status.getCode(), statusCodeList);
}
@@ -92,4 +96,21 @@ public class PointRecommendDAO {
public Integer deleteUnselectedRecommendPointByLineId(Long lineId) {
return pointRecommendMapper.deleteUnselectedRecommendPointByLineId(lineId);
}
/**
* 线索获取推荐列表
* @param request
* @return
*/
public Page<MiniPointPageDTO> getLineRecommendPointPage(MiniPointPageRequest request){
PageHelper.startPage(request.getPageNum(), request.getPageSize());
return pointRecommendMapper.getLineRecommendPointPage(request);
}
public Integer updateStatusByPointIdAndLineId(Long pointId, Long lineId){
if(Objects.isNull(pointId) || Objects.isNull(lineId)){
return 0;
}
return pointRecommendMapper.updateStatusByPointIdAndLineId(pointId, lineId);
}
}

View File

@@ -3,8 +3,11 @@ package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ShopInfoMapper;
import com.cool.store.utils.NumberConverter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
@@ -19,6 +22,7 @@ import java.util.Objects;
* @Description:
* @date 2024-03-29 10:14
*/
@Slf4j
@Repository
public class ShopInfoDAO {
@@ -63,4 +67,12 @@ public class ShopInfoDAO {
return shopInfo.getId();
}
public Integer updateShopInfo(ShopInfoDO shopInfo){
if(Objects.isNull(shopInfo) || Objects.isNull(shopInfo.getId())){
log.info("店铺为空 或者店铺id为空");
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
return shopInfoMapper.updateByPrimaryKeySelective(shopInfo);
}
}

View File

@@ -11,6 +11,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -34,24 +35,26 @@ public class ShopStageInfoDAO {
* @param shopStageEnum
* @return
*/
public Integer initShopStageInfo(Long lineId, List<Long> shopIds, ShopStageEnum shopStageEnum) {
if(CollectionUtils.isEmpty(shopIds) || Objects.isNull(shopStageEnum)){
public Integer initShopStageInfo(Long lineId, List<Long> shopIds) {
if(CollectionUtils.isEmpty(shopIds)){
return CommonConstants.ZERO;
}
Integer shopStage = shopStageEnum.getShopStage();
List<ShopSubStageEnum> shopStageEnumList = ShopSubStageEnum.getShopStageEnum(shopStage);
List<ShopStageInfoDO> addShopStageList = new ArrayList<>();
LocalDate selectStartDate = LocalDate.now();
LocalDate planSelectPointCompleteDate = selectStartDate.plusDays(ShopSubStageEnum.getSelectStageMaxDays());
for (Long shopId : shopIds) {
for (ShopSubStageEnum shopSubStageEnum : shopStageEnumList) {
for (ShopSubStageEnum shopSubStageEnum : ShopSubStageEnum.values()) {
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
shopStageInfo.setLineId(lineId);
shopStageInfo.setShopId(shopId);
shopStageInfo.setShopStage(shopStage);
ShopStageEnum shopStageEnum = shopSubStageEnum.getShopStageEnum();
shopStageInfo.setShopStage(shopStageEnum.getShopStage());
shopStageInfo.setShopSubStage(shopSubStageEnum.getShopSubStage());
ShopSubStageStatusEnum initStatus = shopSubStageEnum.getInitStatus();
shopStageInfo.setShopSubStageStatus(initStatus.getShopSubStageStatus());
shopStageInfo.setRemark(shopSubStageEnum.getShopSubStageName() + CommonConstants.PATH_BAR +shopSubStageEnum.getInitStatus().getShopSubStageStatusName());
shopStageInfo.setIsTerminated(initStatus.isTerminated());
shopStageInfo.setPlanCompleteTime(shopSubStageEnum.getPlanCompleteTime(selectStartDate, planSelectPointCompleteDate));
addShopStageList.add(shopStageInfo);
}
}

View File

@@ -1,7 +1,10 @@
package com.cool.store.mapper;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.dto.point.MiniPointPageDTO;
import com.cool.store.entity.PointRecommendDO;
import com.cool.store.request.MiniPointPageRequest;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -53,4 +56,20 @@ public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
* @return
*/
Integer deleteUnselectedRecommendPointByLineId(@Param("lineId") Long lineId);
/**
* 线索获取推荐铺位列表
* @param request
* @return
*/
Page<MiniPointPageDTO> getLineRecommendPointPage(@Param("request") MiniPointPageRequest request);
/**
* 更新推荐选择状态
* @param pointId
* @param lineId
* @return
*/
Integer updateStatusByPointIdAndLineId(@Param("pointId") Long pointId, @Param("lineId") Long lineId);
}

View File

@@ -62,4 +62,41 @@
<update id="deleteUnselectedRecommendPointByLineId">
update xfsg_point_recommend set deleted = 1 where line_id = #{lineId} and deleted = 0 and status in (0,2)
</update>
<select id="getLineRecommendPointPage" resultType="com.cool.store.dto.point.MiniPointPageDTO">
select
p.id as pointId,
p.line_id as lineId,
p.point_name as pointName,
p.point_code as pointCode,
p.region_id as regionId,
p.address as address,
p.point_score as pointScore,
p.point_area as pointArea,
p.point_status as pointStatus,
p.select_status as selectStatus,
pr.status as recommendStatus
from
xfsg_point_recommend pr
inner join xfsg_point_info p on p.id = pr.point_id
where
p.deleted = 0 and pr.line_id = #{request.lineId} and pr.deleted = 0
<if test="request.status != null and request.status == '1'">
and pr.status = 1 and p.select_status = 0
</if>
<if test="request.status != null and request.status == '2'">
and pr.status = 2 and p.select_status = 1 and p.line_id = #{request.lineId}
</if>
<if test="request.status != null and request.status == '3'">
and pr.status in (5, 6)
</if>
</select>
<update id="updateStatusByPointIdAndLineId">
update
xfsg_point_recommend
set
status = if(line_id = #{lineId}, 2, 3)
where point_id = #{pointId} and deleted = 0
</update>
</mapper>

View File

@@ -9,20 +9,23 @@
<result column="shop_sub_stage" jdbcType="TINYINT" property="shopSubStage" />
<result column="shop_sub_stage_status" jdbcType="TINYINT" property="shopSubStageStatus" />
<result column="is_terminated" jdbcType="BIT" property="isTerminated" />
<result column="plan_complete_time" jdbcType="VARCHAR" property="planCompleteTime" />
<result column="actual_complete_time" jdbcType="VARCHAR" property="actualCompleteTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="audit_id" jdbcType="BIGINT" property="auditId" />
<result column="deleted" jdbcType="BIT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="allColumn">
id, line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, is_terminated, remark, deleted, create_time, update_time
id, line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, is_terminated, plan_complete_time, actual_complete_time, remark, audit_id, deleted, create_time, update_time
</sql>
<insert id="batchInsert">
<foreach collection="addShopStageList" separator=";" item="shop">
INSERT INTO xfsg_shop_stage_info(line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, is_terminated, remark)
VALUES(#{shop.lineId}, #{shop.shopId}, #{shop.shopStage}, #{shop.shopSubStage}, #{shop.shopSubStageStatus}, #{shop.isTerminated}, #{shop.remark})
INSERT INTO xfsg_shop_stage_info(line_id, shop_id, shop_stage, shop_sub_stage, shop_sub_stage_status, is_terminated, plan_complete_time, remark)
VALUES(#{shop.lineId}, #{shop.shopId}, #{shop.shopStage}, #{shop.shopSubStage}, #{shop.shopSubStageStatus}, #{shop.isTerminated}, #{shop.planCompleteTime}, #{shop.remark})
</foreach>
</insert>
@@ -39,7 +42,15 @@
</select>
<update id="updateShopStageInfo">
update xfsg_shop_stage_info set shop_sub_stage_status = #{shopSubStageStatus}, is_terminated = #{isTerminated}, remark = #{remark} where shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
update
xfsg_shop_stage_info
set
shop_sub_stage_status = #{shopSubStageStatus},
is_terminated = #{isTerminated},
remark = #{remark},
actual_complete_time = if(is_terminated, now(), null)
where
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
</mapper>