选址
This commit is contained in:
@@ -21,6 +21,8 @@ public enum ErrorCodeEnum {
|
||||
PUBLIC_LINE_NOT_FOLLOW(419, "该线索已存在公海,无跟进人", null),
|
||||
LINE_EXIST_FOLLOW(420, "该线索已存在,跟进人为【{0},{1}】", null),
|
||||
|
||||
ERROR_MESSAGE(421, "{0}", null),
|
||||
|
||||
|
||||
/**
|
||||
* 000000 未知错误
|
||||
@@ -92,6 +94,14 @@ public enum ErrorCodeEnum {
|
||||
USER_NOT_ALLOW_ENTER_ROOM(600007, "当前用户不允许进入面试房间", null),
|
||||
|
||||
SHOP_STAGE_ERROR(600008, "店铺阶段错误", null),
|
||||
SHOP_NOT_EXIST(600009, "店铺不存在", null),
|
||||
POINT_IS_SELECTED(600010, "该铺位已被其他人选择", null),
|
||||
POINT_ALREADY_SELECT(600011, "该铺位已被您选择", null),
|
||||
SHOP_IS_SELECTED(600012, "该店铺已选址", null),
|
||||
SHOP_STAGE_NOT_OPERATE(600013, "当前店铺所处阶段不允许该操作", null),
|
||||
POINT_IS_LOCK(600014, "当前铺位已被锁定,刷新后再试", null),
|
||||
POINT_IS_INVALID(600015, "该铺位已失效", null),
|
||||
POINT_SELECTED(600016, "该铺位已被选择", null),
|
||||
|
||||
INTERVIEW_ENTER_FAIL(1021101, "进入面审间失败", null),
|
||||
DINGDING_USER_NOT_EXIST(1021102, "用户钉钉信息不存在,无法发起资质审核!", null),
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
* @Description:
|
||||
* @date 2024-04-01 14:38
|
||||
*/
|
||||
public enum PointRecommendStatus {
|
||||
public enum PointRecommendStatusEnum {
|
||||
|
||||
//状态 1.待选择 2.已选择 3.已被他人选择 4.已签约 5.已拒绝 6.已失效
|
||||
POINT_RECOMMEND_STATUS_1(1, "待选择"),
|
||||
@@ -24,7 +24,7 @@ public enum PointRecommendStatus {
|
||||
|
||||
private String desc;
|
||||
|
||||
PointRecommendStatus(Integer code, String desc) {
|
||||
PointRecommendStatusEnum(Integer code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
@@ -37,19 +37,19 @@ public enum PointRecommendStatus {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static PointRecommendStatus getByCode(Integer code) {
|
||||
for (PointRecommendStatus pointRecommendStatus : PointRecommendStatus.values()) {
|
||||
if (pointRecommendStatus.getCode().equals(code)) {
|
||||
return pointRecommendStatus;
|
||||
public static PointRecommendStatusEnum getByCode(Integer code) {
|
||||
for (PointRecommendStatusEnum pointRecommendStatusEnum : PointRecommendStatusEnum.values()) {
|
||||
if (pointRecommendStatusEnum.getCode().equals(code)) {
|
||||
return pointRecommendStatusEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(Integer code) {
|
||||
for (PointRecommendStatus pointRecommendStatus : PointRecommendStatus.values()) {
|
||||
if (pointRecommendStatus.getCode().equals(code)) {
|
||||
return pointRecommendStatus.getDesc();
|
||||
for (PointRecommendStatusEnum pointRecommendStatusEnum : PointRecommendStatusEnum.values()) {
|
||||
if (pointRecommendStatusEnum.getCode().equals(code)) {
|
||||
return pointRecommendStatusEnum.getDesc();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -14,10 +14,14 @@ public enum ShopStageEnum {
|
||||
SHOP_STAGE_3(3, "开业"),
|
||||
;
|
||||
|
||||
//店铺阶段
|
||||
private Integer shopStage;
|
||||
|
||||
//阶段名称
|
||||
private String stageName;
|
||||
|
||||
|
||||
|
||||
ShopStageEnum(Integer shopStage, String stageName) {
|
||||
this.shopStage = shopStage;
|
||||
this.stageName = stageName;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cool.store.enums.point;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,17 +12,17 @@ import java.util.List;
|
||||
*/
|
||||
public enum ShopSubStageEnum {
|
||||
|
||||
SHOP_STAGE_1(ShopStageEnum.SHOP_STAGE_1, 10, "选址"),
|
||||
SHOP_STAGE_2(ShopStageEnum.SHOP_STAGE_1, 20, "上传租赁合同"),
|
||||
SHOP_STAGE_3(ShopStageEnum.SHOP_STAGE_2, 30, "系统建店"),
|
||||
SHOP_STAGE_4(ShopStageEnum.SHOP_STAGE_2, 40, "证照办理"),
|
||||
SHOP_STAGE_5(ShopStageEnum.SHOP_STAGE_2, 50, "员工招聘"),
|
||||
SHOP_STAGE_6(ShopStageEnum.SHOP_STAGE_2, 60, "加盟商/员工培训"),
|
||||
SHOP_STAGE_7(ShopStageEnum.SHOP_STAGE_2, 70, "缴纳加盟费/保证金"),
|
||||
SHOP_STAGE_8(ShopStageEnum.SHOP_STAGE_2, 80, "加盟合同签约"),
|
||||
SHOP_STAGE_9(ShopStageEnum.SHOP_STAGE_2, 90, "设计阶段"),
|
||||
SHOP_STAGE_10(ShopStageEnum.SHOP_STAGE_2, 100, "施工阶段"),
|
||||
SHOP_STAGE_11(ShopStageEnum.SHOP_STAGE_2, 110, "三方验收"),
|
||||
SHOP_STAGE_1(ShopStageEnum.SHOP_STAGE_1, 10, "选址", 3),
|
||||
SHOP_STAGE_2(ShopStageEnum.SHOP_STAGE_1, 20, "上传租赁合同", 2),
|
||||
SHOP_STAGE_3(ShopStageEnum.SHOP_STAGE_2, 30, "系统建店", 2),
|
||||
SHOP_STAGE_4(ShopStageEnum.SHOP_STAGE_2, 40, "证照办理", 2),
|
||||
SHOP_STAGE_5(ShopStageEnum.SHOP_STAGE_2, 50, "员工招聘", 2),
|
||||
SHOP_STAGE_6(ShopStageEnum.SHOP_STAGE_2, 60, "加盟商/员工培训", 2),
|
||||
SHOP_STAGE_7(ShopStageEnum.SHOP_STAGE_2, 70, "缴纳加盟费/保证金", 2),
|
||||
SHOP_STAGE_8(ShopStageEnum.SHOP_STAGE_2, 80, "加盟合同签约", 2),
|
||||
SHOP_STAGE_9(ShopStageEnum.SHOP_STAGE_2, 90, "设计阶段", 2),
|
||||
SHOP_STAGE_10(ShopStageEnum.SHOP_STAGE_2, 100, "施工阶段", 2),
|
||||
SHOP_STAGE_11(ShopStageEnum.SHOP_STAGE_2, 110, "三方验收", 2),
|
||||
;
|
||||
|
||||
//阶段
|
||||
@@ -33,10 +34,14 @@ public enum ShopSubStageEnum {
|
||||
//子阶段名称
|
||||
private String shopSubStageName;
|
||||
|
||||
ShopSubStageEnum(ShopStageEnum shopStageEnum, Integer shopSubStage, String shopSubStageName) {
|
||||
//计划完成天数
|
||||
private Integer planCompleteDays;
|
||||
|
||||
ShopSubStageEnum(ShopStageEnum shopStageEnum, Integer shopSubStage, String shopSubStageName, Integer planCompleteDays) {
|
||||
this.shopStageEnum = shopStageEnum;
|
||||
this.shopSubStage = shopSubStage;
|
||||
this.shopSubStageName = shopSubStageName;
|
||||
this.planCompleteDays = planCompleteDays;
|
||||
}
|
||||
|
||||
public static List<ShopSubStageEnum> getShopStageEnum(Integer shopStage) {
|
||||
@@ -61,6 +66,10 @@ public enum ShopSubStageEnum {
|
||||
return shopSubStageName;
|
||||
}
|
||||
|
||||
public Integer getPlanCompleteDays() {
|
||||
return planCompleteDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取各阶段的初始状态
|
||||
* @return
|
||||
@@ -94,4 +103,29 @@ public enum ShopSubStageEnum {
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getSelectStageMaxDays() {
|
||||
return Math.max(ShopSubStageEnum.SHOP_STAGE_1.getPlanCompleteDays(), ShopSubStageEnum.SHOP_STAGE_2.getPlanCompleteDays());
|
||||
|
||||
}
|
||||
|
||||
public String getPlanCompleteTime(LocalDate planCompleteTime, LocalDate planSelectPointCompleteDate) {
|
||||
switch (this){
|
||||
case SHOP_STAGE_1:
|
||||
case SHOP_STAGE_2:
|
||||
case SHOP_STAGE_5:
|
||||
case SHOP_STAGE_6:
|
||||
case SHOP_STAGE_7:
|
||||
case SHOP_STAGE_8:
|
||||
return planCompleteTime.plusDays(getPlanCompleteDays()).toString();
|
||||
case SHOP_STAGE_3:
|
||||
case SHOP_STAGE_4:
|
||||
case SHOP_STAGE_9:
|
||||
case SHOP_STAGE_10:
|
||||
case SHOP_STAGE_11:
|
||||
return planSelectPointCompleteDate.plusDays(getPlanCompleteDays()).toString();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.cool.store.dto.point;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MiniPointPageDTO {
|
||||
|
||||
@ApiModelProperty("店铺id")
|
||||
private Long pointId;
|
||||
|
||||
@ApiModelProperty("线索id")
|
||||
private Long lineId;
|
||||
|
||||
@ApiModelProperty("铺位名称")
|
||||
private String pointName;
|
||||
|
||||
@ApiModelProperty("铺位编号")
|
||||
private String pointCode;
|
||||
|
||||
@ApiModelProperty("所属站区")
|
||||
private Long regionId;
|
||||
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("铺位得分")
|
||||
private Integer pointScore;
|
||||
|
||||
@ApiModelProperty("铺位面积")
|
||||
private String pointArea;
|
||||
|
||||
@ApiModelProperty("铺位状态 1.采集中、2.已评估、3.待审核、5.已审核、6.已签约、7.已失效")
|
||||
private Integer pointStatus;
|
||||
|
||||
@ApiModelProperty("选择状态0.未选择, 1.已被选择")
|
||||
private Integer selectStatus;
|
||||
|
||||
@ApiModelProperty("1.待选择 2.已选择 3.已被他人选择 4.已签约 5.已拒绝 6.已失效")
|
||||
private Integer recommendStatus;
|
||||
}
|
||||
@@ -45,11 +45,29 @@ public class ShopStageInfoDO {
|
||||
@Column(name = "is_terminated")
|
||||
private Boolean isTerminated;
|
||||
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
@Column(name = "plan_complete_time")
|
||||
private String planCompleteTime;
|
||||
|
||||
/**
|
||||
* 实际完成时间
|
||||
*/
|
||||
@Column(name = "actual_complete_time")
|
||||
private String actualCompleteTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 审核id
|
||||
*/
|
||||
@Column(name = "audit_id")
|
||||
private Long auditId;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import com.cool.store.entity.PointRecommendDO;
|
||||
import com.cool.store.enums.point.PointRecommendStatus;
|
||||
import com.cool.store.enums.point.PointRecommendStatusEnum;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -38,7 +38,7 @@ public class LineRecommendPointRequest {
|
||||
pointRecommendDO.setLineId(this.lineId);
|
||||
pointRecommendDO.setDevelopmentManager(this.developmentManager);
|
||||
pointRecommendDO.setPointId(pointId);
|
||||
pointRecommendDO.setStatus(PointRecommendStatus.POINT_RECOMMEND_STATUS_1.getCode());
|
||||
pointRecommendDO.setStatus(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode());
|
||||
return pointRecommendDO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: MiniPointPageRequest
|
||||
* @Description:
|
||||
* @date 2024-04-12 14:33
|
||||
*/
|
||||
@Data
|
||||
public class MiniPointPageRequest extends PageBasicInfo {
|
||||
|
||||
@Min(value = 1, message = "status不能小于1")
|
||||
@Max(value = 3, message = "status不能大于3")
|
||||
@ApiModelProperty("1.待选择 2.已选择 3.拒绝/失效")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "线索id",hidden = true)
|
||||
private Long lineId;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import com.cool.store.entity.PointRecommendDO;
|
||||
import com.cool.store.enums.point.PointRecommendStatus;
|
||||
import com.cool.store.enums.point.PointRecommendStatusEnum;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -38,7 +38,7 @@ public class PointRecommendLineRequest {
|
||||
pointRecommendDO.setLineId(lineId);
|
||||
pointRecommendDO.setDevelopmentManager(this.developmentManager);
|
||||
pointRecommendDO.setPointId(pointId);
|
||||
pointRecommendDO.setStatus(PointRecommendStatus.POINT_RECOMMEND_STATUS_1.getCode());
|
||||
pointRecommendDO.setStatus(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode());
|
||||
return pointRecommendDO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: SelectPointRequest
|
||||
* @Description:
|
||||
* @date 2024-04-12 15:08
|
||||
*/
|
||||
@Data
|
||||
public class SelectPointRequest {
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty("店铺id")
|
||||
private Long shopId;
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty("铺位id")
|
||||
private Long pointId;
|
||||
|
||||
@ApiModelProperty(value = "当前线索id", hidden = true)
|
||||
private Long lineId;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
public class LineAuditInfoVO {
|
||||
@@ -28,10 +29,13 @@ public class LineAuditInfoVO {
|
||||
@ApiModelProperty("明文件或凭证")
|
||||
private String certifyFile;
|
||||
|
||||
@ApiModelProperty("审批事件")
|
||||
@ApiModelProperty("审批时间")
|
||||
private Date createTime;
|
||||
|
||||
public static LineAuditInfoVO convertVO(LineAuditInfoDO auditInfo) {
|
||||
if(Objects.isNull(auditInfo)){
|
||||
return null;
|
||||
}
|
||||
LineAuditInfoVO result = new LineAuditInfoVO();
|
||||
result.setAuditId(auditInfo.getId());
|
||||
result.setResultType(auditInfo.getResultType());
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.cool.store.vo.point;
|
||||
|
||||
import com.cool.store.dto.point.MiniPointPageDTO;
|
||||
import com.cool.store.entity.PointInfoDO;
|
||||
import com.cool.store.enums.point.PointRecommendStatusEnum;
|
||||
import com.cool.store.enums.point.PointStatusEnum;
|
||||
import com.cool.store.enums.point.SelectStatusEnum;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class MiniPointPageVO {
|
||||
|
||||
@ApiModelProperty("店铺id")
|
||||
private Long pointId;
|
||||
|
||||
@ApiModelProperty("铺位名称")
|
||||
private String pointName;
|
||||
|
||||
@ApiModelProperty("铺位编号")
|
||||
private String pointCode;
|
||||
|
||||
@ApiModelProperty("所属站区")
|
||||
private String regionNodeName;
|
||||
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("铺位得分")
|
||||
private Integer pointScore;
|
||||
|
||||
@ApiModelProperty("铺位面积")
|
||||
private String pointArea;
|
||||
|
||||
@ApiModelProperty("1.待选择 2.已选择 3.已被他人选择 4.已签约 5.已拒绝 6.已失效")
|
||||
private Integer recommendStatus;
|
||||
|
||||
public static List<MiniPointPageVO> convertVO(List<MiniPointPageDTO> pointList, Map<Long, String> regionNameMap, Long curLineId) {
|
||||
if(CollectionUtils.isEmpty(pointList)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<MiniPointPageVO> resultList = new ArrayList<>();
|
||||
for (MiniPointPageDTO pointInfo : pointList) {
|
||||
MiniPointPageVO pointPageVO = new MiniPointPageVO();
|
||||
pointPageVO.setPointId(pointInfo.getPointId());
|
||||
pointPageVO.setPointName(pointInfo.getPointName());
|
||||
pointPageVO.setPointCode(pointInfo.getPointCode());
|
||||
pointPageVO.setRegionNodeName(regionNameMap.get(pointInfo.getRegionId()));
|
||||
pointPageVO.setAddress(pointInfo.getAddress());
|
||||
pointPageVO.setPointScore(pointInfo.getPointScore());
|
||||
pointPageVO.setPointArea(pointInfo.getPointArea());
|
||||
pointPageVO.setRecommendStatus(getRecommendStatus(curLineId, pointInfo.getLineId(), pointInfo.getPointStatus(), pointInfo.getSelectStatus(), pointInfo.getRecommendStatus()));
|
||||
resultList.add(pointPageVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public static Integer getRecommendStatus(Long curLineId, Long lineId, Integer pointStatus, Integer selectStatus, Integer recommendStatus) {
|
||||
if(PointStatusEnum.POINT_STATUS_7.getCode().equals(pointStatus)){
|
||||
return PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6.getCode();
|
||||
}
|
||||
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(selectStatus)){
|
||||
//已选择 判断线索id是否是自己
|
||||
if(curLineId.equals(lineId)){
|
||||
return PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode();
|
||||
}
|
||||
return PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode();
|
||||
}
|
||||
return recommendStatus;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ public class MiniShopPageVO {
|
||||
@ApiModelProperty("店铺名称")
|
||||
private String shopName;
|
||||
|
||||
|
||||
public MiniShopPageVO(Long shopId, String shopName) {
|
||||
this.shopId = shopId;
|
||||
this.shopName = shopName;
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.cool.store.vo.shop;
|
||||
|
||||
import com.cool.store.entity.LineAuditInfoDO;
|
||||
import com.cool.store.entity.ShopStageInfoDO;
|
||||
import com.cool.store.vo.LineAuditInfoVO;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -30,20 +36,37 @@ public class ShopStageInfoVO {
|
||||
@ApiModelProperty("当前阶段是否结束 0未结束 1已结束")
|
||||
private Boolean isTerminated;
|
||||
|
||||
@ApiModelProperty("预估完成时间")
|
||||
private String planCompleteTime;
|
||||
|
||||
@ApiModelProperty("实际完成时间")
|
||||
private String actualCompleteTime;
|
||||
|
||||
@ApiModelProperty("阶段审核信息")
|
||||
private LineAuditInfoVO auditInfo;
|
||||
|
||||
public ShopStageInfoVO(Integer shopStage, Integer shopSubStage, Integer shopSubStageStatus, Boolean isTerminated) {
|
||||
this.shopStage = shopStage;
|
||||
this.shopSubStage = shopSubStage;
|
||||
this.shopSubStageStatus = shopSubStageStatus;
|
||||
this.isTerminated = isTerminated;
|
||||
|
||||
}
|
||||
|
||||
public static List<ShopStageInfoVO> convertList(List<ShopStageInfoDO> stageList){
|
||||
public static List<ShopStageInfoVO> convertList(List<ShopStageInfoDO> stageList, List<LineAuditInfoDO> auditList){
|
||||
if(CollectionUtils.isEmpty(stageList)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
Map<Long, LineAuditInfoDO> auditMap = auditList.stream().collect(Collectors.toMap(LineAuditInfoDO::getId, Function.identity()));
|
||||
List<ShopStageInfoVO> resultList = new ArrayList<>();
|
||||
for (ShopStageInfoDO stageInfo : stageList) {
|
||||
resultList.add(new ShopStageInfoVO(stageInfo.getShopStage(), stageInfo.getShopSubStage(), stageInfo.getShopSubStageStatus(), stageInfo.getIsTerminated()));
|
||||
ShopStageInfoVO shopStageInfo = new ShopStageInfoVO(stageInfo.getShopStage(), stageInfo.getShopSubStage(), stageInfo.getShopSubStageStatus(), stageInfo.getIsTerminated());
|
||||
LineAuditInfoDO auditInfo = auditMap.get(stageInfo.getAuditId());
|
||||
LineAuditInfoVO auditInfoVO = LineAuditInfoVO.convertVO(auditInfo);
|
||||
shopStageInfo.setAuditInfo(auditInfoVO);
|
||||
shopStageInfo.setPlanCompleteTime(stageInfo.getPlanCompleteTime());
|
||||
shopStageInfo.setActualCompleteTime(stageInfo.getActualCompleteTime());
|
||||
resultList.add(shopStageInfo);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -193,4 +193,17 @@ public interface PointService {
|
||||
*/
|
||||
PageInfo<PointPageVO> getTodoList(PointTodoPageRequest request);
|
||||
|
||||
/**
|
||||
* 获取线索推荐店铺列表
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
PageInfo<MiniPointPageVO> getLineRecommendPointPage(MiniPointPageRequest request);
|
||||
|
||||
/**
|
||||
* 线索选址铺位
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Integer lineSelectPoint(SelectPointRequest request);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dao.LineAuditInfoDAO;
|
||||
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;
|
||||
@@ -33,6 +35,8 @@ public class ShopServiceImpl implements ShopService {
|
||||
private ShopInfoDAO shopInfoDAO;
|
||||
@Resource
|
||||
private ShopStageInfoDAO shopStageInfoDAO;
|
||||
@Resource
|
||||
private LineAuditInfoDAO lineAuditInfoDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -53,7 +57,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
shopInfoDAO.batchAddShop(addShopList);
|
||||
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
|
||||
List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
|
||||
return shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds, ShopStageEnum.SHOP_STAGE_1);
|
||||
return shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,11 +68,15 @@ public class ShopServiceImpl implements ShopService {
|
||||
|
||||
@Override
|
||||
public List<ShopStageInfoVO> getShopStageInfo(Long lineId, Long shopId, Integer shopStage) {
|
||||
ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage);
|
||||
if(Objects.isNull(shopStageEnum)){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR);
|
||||
if(Objects.nonNull(shopStage)){
|
||||
ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage);
|
||||
if(Objects.isNull(shopStageEnum)){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR);
|
||||
}
|
||||
}
|
||||
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, shopStage);
|
||||
return ShopStageInfoVO.convertList(shopStageInfo);
|
||||
List<Long> auditIds = shopStageInfo.stream().map(ShopStageInfoDO::getAuditId).collect(Collectors.toList());
|
||||
List<LineAuditInfoDO> auditList = lineAuditInfoDAO.getLineAuditInfoList(auditIds);
|
||||
return ShopStageInfoVO.convertList(shopStageInfo, auditList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.point.AuditNodeDTO;
|
||||
import com.cool.store.dto.point.MiniPointPageDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.AuditStatusEnum;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.NodeNoEnum;
|
||||
import com.cool.store.enums.WorkflowStageEnum;
|
||||
import com.cool.store.enums.point.PointRecommendStatus;
|
||||
import com.cool.store.enums.point.PointStatusEnum;
|
||||
import com.cool.store.enums.point.SelectStatusEnum;
|
||||
import com.cool.store.enums.point.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.service.LabelService;
|
||||
@@ -29,10 +27,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.MessageFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -74,8 +74,13 @@ public class PointServiceImpl implements PointService {
|
||||
private LabelService labelService;
|
||||
@Resource
|
||||
private HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
||||
@Resource
|
||||
private ShopStageInfoDAO shopStageInfoDAO;
|
||||
@Value("${mybatis.configuration.variables.enterpriseId}")
|
||||
private String enterpriseId;
|
||||
|
||||
private static final String AUDIT_SETTING_KEY = "audit_setting_key";
|
||||
private static final String AUDIT_SETTING_KEY = "audit_setting_key:{0}";
|
||||
private static final String POINT_SELECT_KEY = "point_select_key:{0}:{1}";
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -148,7 +153,7 @@ public class PointServiceImpl implements PointService {
|
||||
updatePoint.setId(pointId);
|
||||
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_7.getCode());
|
||||
pointInfoDAO.updatePointInfo(updatePoint);
|
||||
return pointRecommendDAO.updateRecommendStatus(pointId, PointRecommendStatus.POINT_RECOMMEND_STATUS_6);
|
||||
return pointRecommendDAO.updateRecommendStatus(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,7 +172,7 @@ public class PointServiceImpl implements PointService {
|
||||
updatePoint.setSelectStatus(SelectStatusEnum.SELECT_STATUS_0.getCode());
|
||||
pointInfoDAO.updatePointInfo(updatePoint);
|
||||
//将已选择、已被他人选择的状态更新成待选泽
|
||||
return pointRecommendDAO.updateRecommendStatusByStatusAndPointId(pointId, PointRecommendStatus.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatus.POINT_RECOMMEND_STATUS_2, PointRecommendStatus.POINT_RECOMMEND_STATUS_3));
|
||||
return pointRecommendDAO.updateRecommendStatusByStatusAndPointId(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,8 +233,9 @@ public class PointServiceImpl implements PointService {
|
||||
|
||||
@Override
|
||||
public Integer auditSetting(AuditSettingRequest request) {
|
||||
String cacheKey = MessageFormat.format(AUDIT_SETTING_KEY, enterpriseId);
|
||||
request.setSecondApproval(Arrays.asList(UserAndPositionRequest.convert("position", null, "战区营运")));
|
||||
redisUtilPool.setString(AUDIT_SETTING_KEY, JSONObject.toJSONString(request));
|
||||
redisUtilPool.setString(cacheKey, JSONObject.toJSONString(request));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -432,7 +438,7 @@ public class PointServiceImpl implements PointService {
|
||||
List<Long> regionIds = pointList.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList());
|
||||
List<String> developmentManagers = pointList.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList());
|
||||
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers);
|
||||
Map<Long, String> regionNameMap = new HashMap<>();
|
||||
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
|
||||
return PointRecommendPageVO.convertVO(recommendPointList, pointList, userNameMap, regionNameMap);
|
||||
}
|
||||
|
||||
@@ -454,12 +460,36 @@ public class PointServiceImpl implements PointService {
|
||||
|
||||
@Override
|
||||
public Integer lineRecommendPoint(LineRecommendPointRequest request) {
|
||||
List<Long> pointIds = request.getPointIds();
|
||||
List<PointInfoDO> pointList = pointInfoDAO.getPointListByIds(pointIds);
|
||||
List<PointInfoDO> selectList = pointList.stream().filter(o -> SelectStatusEnum.SELECT_STATUS_1.getCode().equals(o.getSelectStatus())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(selectList)){
|
||||
String pointNames = selectList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已经被选");
|
||||
}
|
||||
List<PointInfoDO> invalidList = pointList.stream().filter(o -> PointStatusEnum.POINT_STATUS_7.getCode().equals(o.getPointStatus())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(invalidList)){
|
||||
String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(","));
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已失效");
|
||||
}
|
||||
List<PointRecommendDO> recommendList = request.convertList();
|
||||
return pointRecommendDAO.addRecommendPoint(recommendList);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
if(PointStatusEnum.POINT_STATUS_7.getCode().equals(pointInfo.getPointStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_IS_INVALID);
|
||||
}
|
||||
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_SELECTED);
|
||||
}
|
||||
List<PointRecommendDO> recommendList = request.convertList();
|
||||
return pointRecommendDAO.addRecommendPoint(recommendList);
|
||||
}
|
||||
@@ -510,6 +540,68 @@ public class PointServiceImpl implements PointService {
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MiniPointPageVO> getLineRecommendPointPage(MiniPointPageRequest request) {
|
||||
Page<MiniPointPageDTO> pointPage = pointRecommendDAO.getLineRecommendPointPage(request);
|
||||
List<MiniPointPageVO> resultList = new ArrayList<>();
|
||||
if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){
|
||||
List<Long> regionIds = pointPage.getResult().stream().map(MiniPointPageDTO::getRegionId).distinct().collect(Collectors.toList());
|
||||
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
|
||||
resultList = MiniPointPageVO.convertVO(pointPage, regionNameMap, request.getLineId());
|
||||
}
|
||||
PageInfo resultPage = new PageInfo(pointPage);
|
||||
resultPage.setList(resultList);
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer lineSelectPoint(SelectPointRequest request) {
|
||||
Long pointId = request.getPointId(), shopId = request.getShopId(), lineId = request.getLineId();
|
||||
String lockKey = MessageFormat.format(POINT_SELECT_KEY, enterpriseId, pointId);
|
||||
if(!redisUtilPool.setNxExpire(lockKey, JSONObject.toJSONString(request), 30)){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_IS_LOCK);
|
||||
}
|
||||
try {
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
||||
if(Objects.isNull(shopInfo)){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
|
||||
}
|
||||
if(!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_NOT_OPERATE);
|
||||
}
|
||||
if(Objects.nonNull(shopInfo.getPointId())){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_IS_SELECTED);
|
||||
}
|
||||
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
||||
if(Objects.isNull(pointInfo)){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
|
||||
}
|
||||
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
||||
if(lineId.equals(pointInfo.getLineId())){
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_ALREADY_SELECT);
|
||||
}
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_IS_SELECTED);
|
||||
}
|
||||
PointInfoDO updatePoint = new PointInfoDO();
|
||||
updatePoint.setId(pointId);
|
||||
updatePoint.setSelectStatus(SelectStatusEnum.SELECT_STATUS_1.getCode());
|
||||
updatePoint.setLineId(lineId);
|
||||
updatePoint.setShopId(shopId);
|
||||
pointInfoDAO.updatePointInfo(updatePoint);
|
||||
ShopInfoDO updateShop = new ShopInfoDO();
|
||||
updateShop.setId(shopId);
|
||||
updateShop.setPointId(pointId);
|
||||
shopInfoDAO.updateShopInfo(shopInfo);
|
||||
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_1);
|
||||
return pointRecommendDAO.updateStatusByPointIdAndLineId(pointId, lineId);
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} finally {
|
||||
redisUtilPool.delKey(lockKey);
|
||||
}
|
||||
}
|
||||
|
||||
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, Long regionId, String operateUserId, String developmentManager) {
|
||||
List<String> roleIds = new ArrayList<>();
|
||||
//审核人
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
* @Description:
|
||||
* @date 2024-03-29 15:36
|
||||
*/
|
||||
@Api(tags = "选址/铺位")
|
||||
@Api(tags = "选址&铺位")
|
||||
@RestController
|
||||
@RequestMapping("/pc/point")
|
||||
public class PointController {
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.request.MiniPointPageRequest;
|
||||
import com.cool.store.request.PointRecommendLineRequest;
|
||||
import com.cool.store.request.SelectPointRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.PointService;
|
||||
import com.cool.store.service.ShopService;
|
||||
import com.cool.store.vo.point.MiniPointPageVO;
|
||||
import com.cool.store.vo.point.PointDetailVO;
|
||||
import com.cool.store.vo.point.PointPageVO;
|
||||
import com.cool.store.vo.shop.MiniShopPageVO;
|
||||
import com.cool.store.vo.shop.ShopStageInfoVO;
|
||||
import com.cool.store.vo.shop.ShopStageVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -42,7 +47,7 @@ public class MiniShopController {
|
||||
|
||||
@ApiOperation("获取店铺的阶段信息")
|
||||
@GetMapping("/getShopStageInfo")
|
||||
public ResponseResult<List<ShopStageInfoVO>> getShopStageInfo(@RequestParam("shopId")Long shopId, @RequestParam("shopStage")Integer shopStage) {
|
||||
public ResponseResult<List<ShopStageInfoVO>> getShopStageInfo(@RequestParam("shopId")Long shopId, @RequestParam(value = "shopStage", required = false)Integer shopStage) {
|
||||
Long lineId = PartnerUserHolder.getUser().getLineId();
|
||||
return ResponseResult.success(shopService.getShopStageInfo(lineId, shopId, shopStage));
|
||||
}
|
||||
@@ -53,4 +58,26 @@ public class MiniShopController {
|
||||
return ResponseResult.success(ShopStageVO.getShopStageList());
|
||||
}
|
||||
|
||||
@ApiOperation("获取推荐给我的铺位")
|
||||
@PostMapping("/getLineRecommendPointPage")
|
||||
public ResponseResult<PageInfo<MiniPointPageVO>> getLineRecommendPointPage(@RequestBody MiniPointPageRequest request) {
|
||||
Long lineId = PartnerUserHolder.getUser().getLineId();
|
||||
request.setLineId(lineId);
|
||||
return ResponseResult.success(pointService.getLineRecommendPointPage(request));
|
||||
}
|
||||
|
||||
@ApiOperation("铺位详情")
|
||||
@GetMapping("/detail")
|
||||
public ResponseResult<PointDetailVO> getPointDetailInfo(@RequestParam("pointId")Long pointId) {
|
||||
return ResponseResult.success(pointService.getPointDetailInfo(pointId));
|
||||
}
|
||||
|
||||
@ApiOperation("选址铺位")
|
||||
@PostMapping("/selectPoint")
|
||||
public ResponseResult<Integer> lineSelectPoint(@RequestBody @Validated SelectPointRequest request) {
|
||||
Long lineId = PartnerUserHolder.getUser().getLineId();
|
||||
request.setLineId(lineId);
|
||||
return ResponseResult.success(pointService.lineSelectPoint(request));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user