This commit is contained in:
zhangchenbiao
2024-04-09 11:31:54 +08:00
parent b9aa62f758
commit e4de100cd6
37 changed files with 1323 additions and 59 deletions

View File

@@ -87,6 +87,7 @@ public enum ErrorCodeEnum {
NO_PERMISSION(600004, "暂无处理审批任务权限", null),
POINT_AUDIT_NODE_ERROR(600005, "当前审批任务异常", null),
USER_NOT_TODO_AUDIT(600005, "当前用户没有待审批的任务", null),
NOT_ALLOW_MODIFY_WANT_SHOP_NUM(600006, "当前阶段不允许直接修改意向开店数量", null),
INTERVIEW_ENTER_FAIL(1021101, "进入面审间失败", null),
DINGDING_USER_NOT_EXIST(1021102, "用户钉钉信息不存在,无法发起资质审核!", null),

View File

@@ -1,5 +1,8 @@
package com.cool.store.enums.point;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: PointRecommendStatus
@@ -43,5 +46,21 @@ public enum PointRecommendStatus {
return null;
}
public static String getDescByCode(Integer code) {
for (PointRecommendStatus pointRecommendStatus : PointRecommendStatus.values()) {
if (pointRecommendStatus.getCode().equals(code)) {
return pointRecommendStatus.getDesc();
}
}
return null;
}
public static List<Integer> getSelectStatus(){
List<Integer> resultList = new ArrayList<>();
resultList.add(POINT_RECOMMEND_STATUS_2.code);
resultList.add(POINT_RECOMMEND_STATUS_4.code);
return resultList;
}
}

View File

@@ -97,6 +97,11 @@ public class EnterpriseUserDAO {
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
}
public Map<String, EnterpriseUserDO> getUserInfoMap(List<String> userIds){
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
return userList.stream().collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
}
public EnterpriseUserDO selectByMobile(String mobile) {
return enterpriseUserMapper.selectByMobile( mobile);
}

View File

@@ -167,4 +167,8 @@ public class HyOpenAreaInfoDAO {
return hyOpenAreaInfoMapper.updateByPrimaryKeySelective( hyOpenAreaInfoDO);
}
public Map<Long, HyOpenAreaInfoDO> getCityMap(List<Long> wantShopAreaIds) {
List<HyOpenAreaInfoDO> openAreaInfoList = selectByIds(wantShopAreaIds);
return openAreaInfoList.stream().collect(Collectors.toMap(k->k.getId(), v->v, (k1, k2)->k1));
}
}

View File

@@ -10,8 +10,11 @@ import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.request.LineListRequest;
import com.cool.store.request.PartnerRequest;
import com.cool.store.request.PointLinePageRequest;
import com.cool.store.request.PublicLineListRequest;
import com.cool.store.vo.PublicLineListVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -128,8 +131,9 @@ public class LineInfoDAO {
lineInfoMapper.insertOrUpdate(lineInfoParam);
}
public List<LineInfoDO> getLineListByDevelopmentManager(String developmentManager) {
return Lists.newArrayList();
public Page<LineInfoDO> getLinePageByDevelopmentManager(PointLinePageRequest request) {
PageHelper.startPage(request.getPageNum(), request.getPageSize());
return lineInfoMapper.getLinePageByDevelopmentManager(request);
}

View File

@@ -57,4 +57,11 @@ public class PointAuditRecordDAO {
}
return pointAuditRecordMapper.deletePointAuditRecord(pointId, cycleCount);
}
public List<PointAuditRecordDO> getPointAllAuditRecord(Long pointId) {
if(Objects.isNull(pointId)){
return Lists.newArrayList();
}
return pointAuditRecordMapper.getPointAllAuditRecord(pointId);
}
}

View File

@@ -1,11 +1,25 @@
package com.cool.store.dao;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.entity.PointInfoDO;
import com.cool.store.mapper.PointInfoMapper;
import com.cool.store.request.PointPageRequest;
import com.cool.store.request.RecommendPointPageRequest;
import com.cool.store.utils.StringUtil;
import com.cool.store.vo.point.PointHomePageDataVO;
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;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
@@ -35,4 +49,45 @@ public class PointInfoDAO {
public Integer updatePointInfo(PointInfoDO shopPointInfo) {
return pointInfoMapper.updateByPrimaryKeySelective(shopPointInfo);
}
public PointHomePageDataVO getMyPointData(String userId) {
return pointInfoMapper.getMyPointData(userId);
}
/**
* 获取我的铺位
* @param request
* @return
*/
public Page<PointInfoDO> getMyPointPage(PointPageRequest request) {
PageHelper.startPage(request.getPageNum(), request.getPageSize());
return pointInfoMapper.getMyPointPage(request);
}
public Map<Long, Integer> getSelectedShopNumMap(List<Long> lineIds) {
if(CollectionUtils.isEmpty(lineIds)){
return Maps.newHashMap();
}
List<LineCountDTO> selectedShopNum = pointInfoMapper.getSelectedShopNum(lineIds);
return selectedShopNum.stream().collect(Collectors.toMap(k->k.getLineId(), v->v.getSelectedShopNum()));
}
public List<PointInfoDO> getPointListByIds(List<Long> pointIds){
if(CollectionUtils.isEmpty(pointIds)){
return Lists.newArrayList();
}
return pointInfoMapper.getPointListByIds(pointIds);
}
public Page<PointInfoDO> getRecommendPointList(RecommendPointPageRequest request) {
PageHelper.startPage(request.getPageNum(), request.getPageSize());
return pointInfoMapper.getRecommendPointList(request);
}
public Integer updateSelectedDevelopmentManager(Long lineId, String developmentManager) {
if(Objects.isNull(lineId) || StringUtils.isBlank(developmentManager)){
return null;
}
return pointInfoMapper.updateSelectedDevelopmentManager(lineId, developmentManager);
}
}

View File

@@ -1,12 +1,17 @@
package com.cool.store.dao;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.entity.PointRecommendDO;
import com.cool.store.enums.point.PointRecommendStatus;
import com.cool.store.mapper.PointRecommendMapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -22,6 +27,12 @@ public class PointRecommendDAO {
@Resource
private PointRecommendMapper pointRecommendMapper;
/**
* 更新推荐状态
* @param pointId
* @param status
* @return
*/
public Integer updateRecommendStatus(Long pointId, PointRecommendStatus status) {
if(Objects.isNull(status)){
return 0;
@@ -29,6 +40,13 @@ public class PointRecommendDAO {
return pointRecommendMapper.updateShopPointRecommendStatus(pointId, status.getCode());
}
/**
* 更新推荐状态
* @param pointId
* @param status
* @param statusList
* @return
*/
public Integer updateRecommendStatusByStatusAndPointId(Long pointId, PointRecommendStatus status, List<PointRecommendStatus> statusList) {
if(Objects.isNull(status) || CollectionUtils.isEmpty(statusList)){
return 0;
@@ -37,4 +55,41 @@ public class PointRecommendDAO {
return pointRecommendMapper.updateRecommendStatusByStatusAndPointId(pointId, status.getCode(), statusCodeList);
}
/**
* 获取已推门店数量
* @param lineIds
* @return
*/
public Map<Long, Integer> getPushShopNumMap(List<Long> lineIds) {
if(CollectionUtils.isEmpty(lineIds)){
return Maps.newHashMap();
}
List<LineCountDTO> pushShopNumMap = pointRecommendMapper.getPushShopNumMap(lineIds);
return pushShopNumMap.stream().collect(Collectors.toMap(k->k.getLineId(), v->v.getRecommendShopNum()));
}
/**
* 获取推荐列表
* @param lineId
* @return
*/
public List<PointRecommendDO> getRecommendPointList(Long lineId) {
if(Objects.isNull(lineId)){
return Lists.newArrayList();
}
return pointRecommendMapper.getRecommendPointList(lineId);
}
public Integer addRecommendPoint(List<PointRecommendDO> recommendList) {
return pointRecommendMapper.batchInsert(recommendList);
}
/**
* 删除未选择的推荐铺位
* @param lineId
* @return
*/
public Integer deleteUnselectedRecommendPointByLineId(Long lineId) {
return pointRecommendMapper.deleteUnselectedRecommendPointByLineId(lineId);
}
}

View File

@@ -5,7 +5,9 @@ import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.request.LineListRequest;
import com.cool.store.request.PartnerRequest;
import com.cool.store.request.PointLinePageRequest;
import com.cool.store.request.PublicLineListRequest;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -76,4 +78,11 @@ public interface LineInfoMapper extends Mapper<LineInfoDO> {
Integer batchUpdateInterviewWorkflowStage(@Param("lineIds") List<Long> lineIds, @Param("workflowSubStage")Integer workflowSubStage, @Param("workflowSubStageStatus")Integer workflowSubStageStatus);
/**
* 选址人员获取蓄水池状态的加盟商
* @param request
* @return
*/
Page<LineInfoDO> getLinePageByDevelopmentManager(@Param("request") PointLinePageRequest request);
}

View File

@@ -31,4 +31,11 @@ public interface PointAuditRecordMapper extends Mapper<PointAuditRecordDO> {
* @return
*/
Integer deletePointAuditRecord(@Param("pointId") Long pointId, @Param("cycleCount") Integer cycleCount);
/**
* 获取点位所有的审批记录
* @param pointId
* @return
*/
List<PointAuditRecordDO> getPointAllAuditRecord(@Param("pointId") Long pointId);
}

View File

@@ -1,7 +1,60 @@
package com.cool.store.mapper;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.entity.PointInfoDO;
import com.cool.store.request.PointPageRequest;
import com.cool.store.request.RecommendPointPageRequest;
import com.cool.store.vo.point.PointHomePageDataVO;
import com.cool.store.vo.point.PointPageVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface PointInfoMapper extends Mapper<PointInfoDO> {
/**
* 获取我的数据
* @param userId
* @return
*/
PointHomePageDataVO getMyPointData(@Param("userId") String userId);
/**
* 获取我的铺位分页
* @param request
* @return
*/
Page<PointInfoDO> getMyPointPage(@Param("request") PointPageRequest request);
/**
* 获取线索选择门店数
* @param lineIds
* @return
*/
List<LineCountDTO> getSelectedShopNum(@Param("lineIds") List<Long> lineIds);
/**
* 获取铺位详情
* @param pointIds
* @return
*/
List<PointInfoDO> getPointListByIds(@Param("pointIds") List<Long> pointIds);
/**
* 获取推荐铺位分页
* @param request
* @return
*/
Page<PointInfoDO> getRecommendPointList(@Param("request") RecommendPointPageRequest request);
/**
* 更新铺位的拓展经理
* @param lineId
* @param developmentManager
* @return
*/
Integer updateSelectedDevelopmentManager(@Param("lineId") Long lineId, @Param("developmentManager")String developmentManager);
}

View File

@@ -1,10 +1,12 @@
package com.cool.store.mapper;
import com.cool.store.dto.point.LineCountDTO;
import com.cool.store.entity.PointRecommendDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
@@ -23,4 +25,32 @@ public interface PointRecommendMapper extends Mapper<PointRecommendDO> {
* @return
*/
Integer updateRecommendStatusByStatusAndPointId(@Param("pointId") Long pointId, @Param("status") Integer status, @Param("statusList") List<Integer> statusList);
/**
* 获取体检店铺数量
* @param lineIds
* @return
*/
List<LineCountDTO> getPushShopNumMap(@Param("lineIds") List<Long> lineIds);
/**
* 获取推荐列表
* @param lineId
* @return
*/
List<PointRecommendDO> getRecommendPointList(@Param("lineId") Long lineId);
/**
* 批量新增
* @param recommendList
* @return
*/
Integer batchInsert(@Param("recommendList") List<PointRecommendDO> recommendList);
/**
* 删除线索为推进的铺位
* @param lineId
* @return
*/
Integer deleteUnselectedRecommendPointByLineId(@Param("lineId") Long lineId);
}

View File

@@ -459,5 +459,12 @@
</foreach>
and workflow_sub_stage_status = 15 and workflow_sub_stage = 5
</update>
<select id="getLinePageByDevelopmentManager" resultMap="BaseResultMap">
select * from xfsg_line_info where deleted = 0 and development_manager = #{request.developmentManager} and join_status = 1
<if test="request.keyword != null and request.keyword!=''">
and (username like #{request.keyword} or mobile like #{request.keyword})
</if>
</select>
</mapper>

View File

@@ -121,6 +121,15 @@
</if>
order by node_no asc
</select>
<select id="getPointAllAuditRecord" resultMap="BaseResultMap">
select
id, point_id, node_no, cycle_count, action_remark, handler_user_id, handler_user_ids, receive_task_time, finish_task_time, audit_status, sign_time, sign_address, picture_url, reason
from
xfsg_point_audit_record
where
point_id = #{pointId} and deleted = 0
order by cycle_count asc, node_no asc
</select>
<update id="deletePointAuditRecord">
update xfsg_point_audit_record set deleted = 1 where point_id = #{pointId} and cycle_count = #{cycleCount} and audit_status = 0

View File

@@ -24,4 +24,96 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="allColumn">
id, point_code, point_name, region_id, shop_id, line_id, point_area, longitude, latitude, address, development_manager, operate_user_id, development_time, point_status, point_score, select_status, submit_audit_count, is_line_upload
</sql>
<select id="getMyPointData" resultType="com.cool.store.vo.point.PointHomePageDataVO">
select
sum(if(point_status != 7, 1, 0)) as myPoint,
sum(if(point_status in (4, 5, 6), 1, 0)) as poolPoint,
sum(if(point_status = 1, 1, 0)) as collectPoint,
sum(if(point_status = 2, 1, 0)) as evaluatePoint,
sum(if(point_status in (3, 4), 1, 0)) as waitAuditPoint,
sum(if(point_status = 7, 1, 0)) as signPoint
from xfsg_point_info
where deleted = 0 and development_manager = #{userId}
</select>
<select id="getMyPointPage" resultMap="BaseResultMap">
select
pi.id,
pi.point_name,
pi.point_code,
pi.region_id,
pi.point_status,
pi.point_score,
pi.point_area,
pi.development_manager,
pi.operate_user_id,
pi.development_time,
pi.select_status
from xfsg_point_info pi
where pi.deleted = 0 and pi.development_manager = #{request.developmentManager}
<if test="request.keyword != null and request.keyword != ''">
and (pi.point_code like concat('%', #{request.keyword}, '%') or pi.point_name like concat('%', #{request.keyword}, '%'))
</if>
<if test="request.developmentStartTime != null and request.developmentStartTime != ''">
and pi.development_time >= #{request.developmentStartTime}
</if>
<if test="request.developmentEndTime != null and request.developmentEndTime != ''">
<![CDATA[and pi.development_time <= #{request.developmentEndTime}]]>
</if>
<if test="request.pointStatus != null and request.pointStatus != ''">
and pi.point_status = #{request.pointStatus}
</if>
<if test="request.storageStatus != null and request.storageStatus == 1">
and pi.point_status in (4,5,6,7)
</if>
<if test="request.storageStatus != null and request.storageStatus == 2">
and pi.point_status in (1,2,3,7)
</if>
<if test="request.operateUserId != null and request.operateUserId != ''">
and pi.operate_user_id = #{request.operateUserId}
</if>
</select>
<select id="getSelectedShopNum" resultType="com.cool.store.dto.point.LineCountDTO">
select
line_id as lineId,
count(1) as selectedShopNum
from xfsg_point_info
where deleted = 0 and select_status = 1 and line_id in
<foreach collection="lineIds" item="lineId" index="index" open="(" separator="," close=")">
#{lineId}
</foreach>
group by line_id
</select>
<select id="getPointListByIds" resultMap="BaseResultMap">
select
<include refid="allColumn"/>
from xfsg_point_info
where deleted = 0 and id in
<foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">
#{pointId}
</foreach>
</select>
<select id="getRecommendPointList" resultType="com.cool.store.entity.PointInfoDO">
select
<include refid="allColumn"/>
from xfsg_point_info
where deleted = 0 and point_status in (4,5) and development_manager = #{request.developmentManager}
<if test="request.pointStatus != null and request.pointStatus != ''">
and point_status = #{request.pointStatus}
</if>
</select>
<update id="updateSelectedDevelopmentManager">
update
xfsg_point_info
set
development_manager = #{developmentManager}
where
line_id = #{lineId} and select_status = '1' and deleted = 0
</update>
</mapper>

View File

@@ -12,14 +12,54 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<update id="updateShopPointRecommendStatus">
update xfsg_point_recommend set status = #{status} where point_id = #{pointId}
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and deleted = 0
</update>
<update id="updateRecommendStatusByStatusAndPointId">
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and status in
update xfsg_point_recommend set status = #{status} where point_id = #{pointId} and deleted = 0 and status in
<foreach collection="statusList" item="status" index="index" open="(" separator="," close=")">
#{status}
</foreach>
</update>
<select id="getPushShopNumMap" resultType="com.cool.store.dto.point.LineCountDTO">
select
line_id as lineId,
count(1) as recommendShopNum
from
xfsg_point_recommend
where
deleted = 0 and line_id in
<foreach collection="lineIds" item="lineId" index="index" open="(" separator="," close=")">
#{lineId}
</foreach>
group by line_id
</select>
<select id="getRecommendPointList" resultMap="BaseResultMap">
select
id,
point_id as pointId,
line_id as lineId,
development_manager as developmentManager,
status,
reason
from
xfsg_point_recommend
where
line_id = #{lineId} and deleted = 0
</select>
<insert id="batchInsert">
<foreach collection="recommendList" item="item" index="index" separator=";">
insert into xfsg_point_recommend (line_id, point_id, development_manager, status)
values (#{item.lineId}, #{item.pointId}, #{item.developmentManager}, #{item.status})
</foreach>
</insert>
<update id="deleteUnselectedRecommendPointByLineId">
update xfsg_point_recommend set deleted = 1 where line_id = #{lineId} and deleted = 0 and status in (0,2)
</update>
</mapper>

View File

@@ -0,0 +1,24 @@
package com.cool.store.dto.point;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: LineCountDTO
* @Description:
* @date 2024-04-08 15:52
*/
@Data
public class LineCountDTO {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("推荐门店数量")
private Integer recommendShopNum;
@ApiModelProperty("选择门店数量")
private Integer selectedShopNum;
}

View File

@@ -1,9 +1,12 @@
package com.cool.store.request;
import com.cool.store.enums.AuditStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.Objects;
/**
* @author zhangchenbiao
@@ -23,5 +26,18 @@ public class PointAuditRequest {
@ApiModelProperty("原因")
private String reason;
public boolean check(){
if(Objects.isNull(this.pointId)){
return false;
}
if(Objects.isNull(this.auditStatus)){
return false;
}
if(AuditStatusEnum.REJECT.equals(this.auditStatus) && StringUtils.isBlank(this.reason)){
return false;
}
return true;
}
}

View File

@@ -0,0 +1,21 @@
package com.cool.store.request;
import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: PointLinePageRequest
* @Description:
* @date 2024-04-09 10:29
*/
@Data
public class PointLinePageRequest extends PageBasicInfo {
@ApiModelProperty(value = "搜索关键字 线索姓名手机号")
private String keyword;
@ApiModelProperty(value = "拓展经理", hidden = true)
private String developmentManager;
}

View File

@@ -0,0 +1,43 @@
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;
import javax.validation.constraints.NotNull;
/**
* @author zhangchenbiao
* @FileName: PointPageRequest
* @Description:
* @date 2024-04-08 10:28
*/
@Data
public class PointPageRequest extends PageBasicInfo {
@ApiModelProperty("铺位名称或编号")
private String keyword;
@ApiModelProperty("营运人员")
private String operateUserId;
@ApiModelProperty("开始拓展时间 yyyy-MM-dd HH:mm:ss")
private String developmentStartTime;
@ApiModelProperty("结束拓展时间 yyyy-MM-dd HH:mm:ss")
private String developmentEndTime;
@ApiModelProperty(value = "拓展专员", hidden = true)
private String developmentManager;
@NotNull
@Min(1)@Max(2)
@ApiModelProperty("必传参数:1已入库 2暂未入库")
private Integer storageStatus;
@ApiModelProperty("1.采集中、2.已评估、3.待审核、5.已审核、6.已签约、7.已失效")
private Integer pointStatus;
}

View File

@@ -0,0 +1,22 @@
package com.cool.store.request;
import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: RecommendPointPageRequest
* @Description:
* @date 2024-04-08 16:43
*/
@Data
public class RecommendPointPageRequest extends PageBasicInfo {
@ApiModelProperty("1.采集中、2.已评估、3.待审核、5.已审核、6.已签约、7.已失效")
private Integer pointStatus;
@ApiModelProperty(value = "拓展专员", hidden = true)
private String developmentManager;
}

View File

@@ -0,0 +1,46 @@
package com.cool.store.request;
import com.cool.store.entity.PointRecommendDO;
import com.cool.store.enums.point.PointRecommendStatus;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: RecommendPointRequest
* @Description:
* @date 2024-04-08 16:50
*/
@Data
public class RecommendPointRequest {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("铺位ids")
private List<Long> pointIds;
@ApiModelProperty(value = "拓展经理", hidden = true)
private String developmentManager;
public List<PointRecommendDO> convertList(){
if(Objects.isNull(this.lineId) || CollectionUtils.isEmpty(pointIds)){
return Lists.newArrayList();
}
return this.pointIds.stream().map(pointId -> {
PointRecommendDO pointRecommendDO = new PointRecommendDO();
pointRecommendDO.setLineId(this.lineId);
pointRecommendDO.setDevelopmentManager(this.developmentManager);
pointRecommendDO.setPointId(pointId);
pointRecommendDO.setStatus(PointRecommendStatus.POINT_RECOMMEND_STATUS_1.getCode());
return pointRecommendDO;
}).collect(Collectors.toList());
}
}

View File

@@ -3,6 +3,8 @@ package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author zhangchenbiao
* @FileName: TurnDevelopmentManagerRequest
@@ -12,9 +14,11 @@ import lombok.Data;
@Data
public class TurnDevelopmentManagerRequest {
@NotNull
@ApiModelProperty("铺位id")
private Long pointId;
@NotNull
@ApiModelProperty("拓展经理")
private String developmentManager;

View File

@@ -0,0 +1,21 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: TurnLineRequest
* @Description:
* @date 2024-04-08 17:09
*/
@Data
public class TurnLineRequest {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("新的选址人员")
private String developmentManager;
}

View File

@@ -0,0 +1,27 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @author zhangchenbiao
* @FileName: UpdateWantShopNumRequest
* @Description:意向开店数量
* @date 2024-04-09 11:16
*/
@Data
public class UpdateWantShopNumRequest {
@NotNull
@ApiModelProperty("线索id")
private Long lineId;
@NotNull
@Min(1)
@ApiModelProperty("意向开店数量")
private Integer wantShopNum;
}

View File

@@ -99,6 +99,9 @@ public class LineInfoVO {
@ApiModelProperty("流程子阶段状态")
private Integer workflowSubStageStatus;
@ApiModelProperty("意向开店数量")
private Integer wantShopNum;
/**
* 待选址铺位
*/

View File

@@ -0,0 +1,92 @@
package com.cool.store.vo;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.LineInfoDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: LineUsernameAndMobileVO
* @Description:
* @date 2024-04-07 14:39
*/
@Data
public class LinePointBaseInfoVO {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("区域名称")
private String areaName;
@ApiModelProperty("区域路径")
private String areaPath;
@ApiModelProperty("用户标签")
private List<String> userPortraitList;
@ApiModelProperty("招商经理")
private String investmentManagerUsername;
@ApiModelProperty("已推门店")
private Integer recommendShopNum;
@ApiModelProperty("已选门店")
private Integer selectedShopNum;
@ApiModelProperty("意向开店数量")
private Integer wantShopNum;
public LinePointBaseInfoVO(Long lineId, String username, String mobile) {
this.lineId = lineId;
this.username = username;
this.mobile = mobile;
}
public static List<LinePointBaseInfoVO> convertList(List<LineInfoDO> lineList, Map<String, String> userNameMap, Map<Long, String> userPortraitMap, Map<Long, HyOpenAreaInfoDO> cityMap, Map<Long, Integer> recommendShopNumMap, Map<Long, Integer> selectedShopNumMap){
List<LinePointBaseInfoVO> resultList = new ArrayList<>();
for (LineInfoDO lineInfo : lineList) {
LinePointBaseInfoVO linePointBaseInfo = new LinePointBaseInfoVO(lineInfo.getId(), lineInfo.getUsername(), lineInfo.getMobile());
linePointBaseInfo.setWantShopNum(lineInfo.getWantShopNum());
String username = userNameMap.get(lineInfo.getInvestmentManager());
linePointBaseInfo.setInvestmentManagerUsername(username);
HyOpenAreaInfoDO areaInfo = cityMap.get(lineInfo.getWantShopAreaId());
if(Objects.nonNull(areaInfo)){
linePointBaseInfo.setAreaName(areaInfo.getAreaName());
linePointBaseInfo.setAreaPath(areaInfo.getAreaPath().replace("/", "").trim());
}
linePointBaseInfo.setRecommendShopNum(recommendShopNumMap.get(lineInfo.getId()));
linePointBaseInfo.setSelectedShopNum(selectedShopNumMap.get(lineInfo.getId()));
if(StringUtils.isNotBlank(lineInfo.getUserPortrait())){
List<String> userPortraitList = new ArrayList<>();
String[] parts = lineInfo.getUserPortrait().split(",");
for (String part : parts) {
String trimmedPart = part.trim();
if (StringUtils.isNotBlank(trimmedPart)) {
String s = userPortraitMap.get(Long.valueOf(part));
if(StringUtils.isNotBlank(s)){
userPortraitList.add(s);
}
}
}
linePointBaseInfo.setUserPortraitList(userPortraitList);
}
resultList.add(linePointBaseInfo);
}
return resultList;
}
}

View File

@@ -1,24 +0,0 @@
package com.cool.store.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: LineUsernameAndMobileVO
* @Description:
* @date 2024-04-07 14:39
*/
@Data
public class LineUsernameAndMobileVO {
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("手机号")
private String mobile;
}

View File

@@ -0,0 +1,83 @@
package com.cool.store.vo.point;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.PointAuditRecordDO;
import com.cool.store.utils.StringUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
* @author zhangchenbiao
* @FileName: AuditRecordVO
* @Description:
* @date 2024-04-08 11:36
*/
@Data
public class PointAuditRecordVO {
@ApiModelProperty("实际处理人")
private UserBaseInfoVO handlerUser;
@ApiModelProperty("处理人列表")
private List<UserBaseInfoVO> handlerUserList;
@ApiModelProperty("处理时间")
private Date handlerTime;
@ApiModelProperty("原因")
private String reason;
@ApiModelProperty("0待处理,1通过,2拒绝")
private String auditStatus;
@ApiModelProperty("signTime")
private Date signTime;
@ApiModelProperty("签到地址")
private String signAddress;
@ApiModelProperty("图片")
private String pictureUrl;
@ApiModelProperty("是否超时")
private Boolean isTimeout;
public static List<PointAuditRecordVO> convert(List<PointAuditRecordDO> auditRecordList, Map<String, EnterpriseUserDO> userMap) {
List<PointAuditRecordVO> resultList = new ArrayList<>();
for (PointAuditRecordDO pointAuditRecord : auditRecordList) {
PointAuditRecordVO pointAuditRecordVO = new PointAuditRecordVO();
pointAuditRecordVO.setHandlerTime(pointAuditRecord.getFinishTaskTime());
pointAuditRecordVO.setReason(pointAuditRecord.getReason());
pointAuditRecordVO.setAuditStatus(pointAuditRecord.getAuditStatus().toString());
pointAuditRecordVO.setSignTime(pointAuditRecord.getSignTime());
pointAuditRecordVO.setSignAddress(pointAuditRecord.getSignAddress());
pointAuditRecordVO.setPictureUrl(pointAuditRecord.getPictureUrl());
pointAuditRecordVO.setIsTimeout(Boolean.FALSE);
if(Objects.nonNull(pointAuditRecord.getReceiveTaskTime())){
Date time = Objects.isNull(pointAuditRecord.getFinishTaskTime()) ? new Date() : pointAuditRecord.getFinishTaskTime();
LocalDateTime localDateTime = LocalDateTime.ofInstant(pointAuditRecord.getReceiveTaskTime().toInstant(), ZoneId.systemDefault());
LocalDateTime localDateTime1 = LocalDateTime.ofInstant(time.toInstant(), ZoneId.systemDefault());
Duration duration = Duration.between(localDateTime, localDateTime1);
long hours = duration.toHours();
pointAuditRecordVO.setIsTimeout(hours >= 48);
}
pointAuditRecordVO.setHandlerUser(UserBaseInfoVO.convert(pointAuditRecord.getHandlerUserId(), userMap));
List<String> handlerUserIds = JSONObject.parseArray(pointAuditRecord.getHandlerUserIds(), String.class);
pointAuditRecordVO.setHandlerUserList(UserBaseInfoVO.convert(handlerUserIds, userMap));
resultList.add(pointAuditRecordVO);
}
return resultList;
}
}

View File

@@ -0,0 +1,32 @@
package com.cool.store.vo.point;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhangchenbiao
* @FileName: PointHomePageDataVO
* @Description:铺位首页数据
* @date 2024-04-07 16:57
*/
@Data
public class PointHomePageDataVO {
@ApiModelProperty("我的铺位")
private Integer myPoint;
@ApiModelProperty("铺位池")
private Integer poolPoint;
@ApiModelProperty("采集中")
private Integer collectPoint;
@ApiModelProperty("已评估")
private Integer evaluatePoint;
@ApiModelProperty("待审核铺位")
private Integer waitAuditPoint;
@ApiModelProperty("已签约")
private Integer signPoint;
}

View File

@@ -0,0 +1,76 @@
package com.cool.store.vo.point;
import com.cool.store.entity.PointDetailInfoDO;
import com.cool.store.entity.PointInfoDO;
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.Date;
import java.util.List;
import java.util.Map;
@Data
public class PointPageVO {
@ApiModelProperty("店铺id")
private Long pointId;
@ApiModelProperty("铺位名称")
private String pointName;
@ApiModelProperty("铺位编号")
private String pointCode;
@ApiModelProperty("所属大区")
private Long regionId;
@ApiModelProperty("所属站区")
private String regionNodeName;
@ApiModelProperty("铺位状态 1.采集中、2.已评估、3.待审核、4.待审核可推荐、5.已审核、6.已签约、7.已失效")
private Integer pointStatus;
@ApiModelProperty("铺位得分")
private Integer pointScore;
@ApiModelProperty("铺位面积")
private String pointArea;
@ApiModelProperty("拓展专员")
private String developmentManagerUsername;
@ApiModelProperty("拓展时间")
private Date developmentTime;
@ApiModelProperty("选择状态0.未选择, 1.已被选择")
private Integer selectStatus;
public static List<PointPageVO> convertVO(List<PointInfoDO> pointList, Map<String, String> usernameMap, Map<Long, String> regionNameMap) {
if(CollectionUtils.isEmpty(pointList)){
return Lists.newArrayList();
}
List<PointPageVO> resultList = new ArrayList<>();
for (PointInfoDO pointInfo : pointList) {
PointPageVO pointPageVO = new PointPageVO();
pointPageVO.setPointId(pointInfo.getId());
pointPageVO.setPointName(pointInfo.getPointName());
pointPageVO.setPointCode(pointInfo.getPointCode());
pointPageVO.setRegionId(pointInfo.getRegionId());
pointPageVO.setRegionNodeName(regionNameMap.get(pointInfo.getRegionId()));
pointPageVO.setPointStatus(pointInfo.getPointStatus());
pointPageVO.setPointScore(pointInfo.getPointScore());
pointPageVO.setPointArea(pointInfo.getPointArea());
pointPageVO.setDevelopmentManagerUsername(usernameMap.get(pointInfo.getDevelopmentManager()));
pointPageVO.setDevelopmentTime(pointInfo.getDevelopmentTime());
pointPageVO.setSelectStatus(pointInfo.getSelectStatus());
resultList.add(pointPageVO);
}
return resultList;
}
}

View File

@@ -0,0 +1,84 @@
package com.cool.store.vo.point;
import com.cool.store.entity.PointInfoDO;
import com.cool.store.entity.PointRecommendDO;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: PointRecommendPageVO
* @Description:
* @date 2024-04-08 16:11
*/
@Data
public class PointRecommendPageVO {
@ApiModelProperty("店铺id")
private Long pointId;
@ApiModelProperty("铺位名称")
private String pointName;
@ApiModelProperty("铺位编号")
private String pointCode;
@ApiModelProperty("所属大区")
private Long regionId;
@ApiModelProperty("所属站区")
private String regionNodeName;
@ApiModelProperty("铺位状态 1.采集中、2.已评估、3.待审核、4.待审核可推荐、5.已审核、6.已签约、7.已失效")
private Integer pointStatus;
@ApiModelProperty("铺位得分")
private Integer pointScore;
@ApiModelProperty("铺位面积")
private String pointArea;
@ApiModelProperty("拓展专员")
private String developmentManagerUsername;
@ApiModelProperty("拓展时间")
private Date developmentTime;
@ApiModelProperty("选择状态1.待选择 2.已选择 3.已被他人选择 4.已签约 5.已拒绝 6.已失效")
private Integer recommendStatus;
public static List<PointRecommendPageVO> convertVO(List<PointRecommendDO> recommendList, List<PointInfoDO> pointList, Map<String, String> usernameMap, Map<Long, String> regionNameMap) {
if(CollectionUtils.isEmpty(recommendList) || CollectionUtils.isEmpty(pointList)){
return Lists.newArrayList();
}
List<PointRecommendPageVO> resultList = new ArrayList<>();
Map<Long, PointInfoDO> pointMap = pointList.stream().collect(Collectors.toMap(k -> k.getId(), Function.identity()));
for (PointRecommendDO pointRecommend : recommendList) {
PointRecommendPageVO recommend = new PointRecommendPageVO();
recommend.setRecommendStatus(pointRecommend.getStatus());
PointInfoDO pointInfo = pointMap.get(pointRecommend.getPointId());
if(Objects.nonNull(pointInfo)){
recommend.setPointId(pointInfo.getId());
recommend.setPointName(pointInfo.getPointName());
recommend.setPointCode(pointInfo.getPointCode());
recommend.setRegionId(pointInfo.getRegionId());
recommend.setRegionNodeName(regionNameMap.get(pointInfo.getRegionId()));
recommend.setPointStatus(pointInfo.getPointStatus());
recommend.setPointScore(pointInfo.getPointScore());
recommend.setPointArea(pointInfo.getPointArea());
recommend.setDevelopmentManagerUsername(usernameMap.get(pointInfo.getDevelopmentManager()));
recommend.setDevelopmentTime(pointInfo.getDevelopmentTime());
}
resultList.add(recommend);
}
return resultList;
}
}

View File

@@ -0,0 +1,65 @@
package com.cool.store.vo.point;
import cn.hutool.core.map.MapUtil;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.cool.store.entity.EnterpriseUserDO;
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;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: UserBaseInfoVO
* @Description:
* @date 2024-04-08 13:42
*/
@Data
public class UserBaseInfoVO {
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("姓名")
private String username;
@ApiModelProperty("头像")
private String avatar;
public UserBaseInfoVO(String userId, String username, String avatar) {
this.userId = userId;
this.username = username;
this.avatar = avatar;
}
public static UserBaseInfoVO convert(String userId, Map<String, EnterpriseUserDO> userMap) {
if(StringUtils.isBlank(userId) || MapUtil.isEmpty(userMap)){
return null;
}
EnterpriseUserDO user = userMap.get(userId);
if(Objects.isNull(user)){
return null;
}
return new UserBaseInfoVO(user.getUserId(), user.getName(), user.getAvatar());
}
public static List<UserBaseInfoVO> convert(List<String> userIdList, Map<String, EnterpriseUserDO> userMap) {
if(CollectionUtils.isEmpty(userIdList) || MapUtil.isEmpty(userMap)){
return null;
}
List<UserBaseInfoVO> resultList = new ArrayList<>();
for (String userId : userIdList) {
EnterpriseUserDO user = userMap.get(userId);
if(Objects.isNull(user)){
continue;
}
resultList.add(new UserBaseInfoVO(user.getUserId(), user.getName(), user.getAvatar()));
}
return resultList;
}
}

View File

@@ -1,9 +1,9 @@
package com.cool.store.service;
import com.cool.store.request.*;
import com.cool.store.vo.LineUsernameAndMobileVO;
import com.cool.store.vo.point.AuditSettingVO;
import com.cool.store.vo.point.PointDetailVO;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
import com.github.pagehelper.PageInfo;
import java.util.List;
@@ -118,8 +118,64 @@ public interface ShopPointService {
/**
* 获取我负责的线索列表
* @param developmentManager
* @param request
* @return
*/
List<LineUsernameAndMobileVO> getLineList(String developmentManager);
PageInfo<LinePointBaseInfoVO> getLinePage(PointLinePageRequest request);
/**
* 获取我的数据
* @param userId
* @return
*/
PointHomePageDataVO getMyPointData(String userId);
/**
* 获取我的铺位
* @param request
* @return
*/
PageInfo<PointPageVO> getMyPointPage(PointPageRequest request);
/**
* 获取审批记录
* @param pointId
* @return
*/
List<PointAuditRecordVO> getPointAllAuditRecord(Long pointId);
/**
* 获取推荐铺位列表
* @param lineId
* @return
*/
List<PointRecommendPageVO> getLineRecommendPointList(Long lineId);
/**
* 获取我的可推荐铺位列表
* @param request
* @return
*/
PageInfo<PointPageVO> getRecommendPointList(RecommendPointPageRequest request);
/**
* 推送铺位
* @param request
* @return
*/
Integer recommendPoint(RecommendPointRequest request);
/**
* 选址人员转让加盟商
* @param request
* @return
*/
Integer turnLine(TurnLineRequest request);
/**
* 修改意向开店数量
* @param request
* @return
*/
Integer updateWantShopNum(UpdateWantShopNumRequest request);
}

View File

@@ -62,17 +62,6 @@ public class CommonService {
return (LineFlowService)applicationContext.getBean(workflowSubStageEnum.getClazz());
}
/**
* 获取用户id
* @param areaId 城市id
* @param userRole
* @return
*/
public String getUserIdByAreaAndUserRole(Long areaId, UserRoleEnum userRole){
//随机一个
return enterpriseUserDAO.getUserInfoByUserIds(Arrays.asList("02012524481349484395", "123836131931284423")).stream().findAny().get().getUserId();
}
public void sendMessage(List<String> userIds, Long lineId, MessageEnum message, String... param){
if(CollectionUtils.isEmpty(userIds)){
return;

View File

@@ -3,23 +3,29 @@ 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.interview.LineInterviewPageDTO;
import com.cool.store.dto.point.AuditNodeDTO;
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.exception.ServiceException;
import com.cool.store.request.*;
import com.cool.store.service.LabelService;
import com.cool.store.service.RegionService;
import com.cool.store.service.ShopPointService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.LineUsernameAndMobileVO;
import com.cool.store.vo.point.AuditSettingVO;
import com.cool.store.vo.point.PointDetailVO;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
@@ -61,10 +67,19 @@ public class ShopPointServiceImpl implements ShopPointService {
private PointAuditRecordDAO pointAuditRecordDAO;
@Resource
private PointTodoInfoDAO pointTodoInfoDAO;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Resource
private RegionService regionService;
@Resource
private LabelService labelService;
@Resource
private HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
private static final String AUDIT_SETTING_KEY = "audit_setting_key";
@Override
@Transactional(rollbackFor = Exception.class)
public Long addPointDetailInfo(AddPointDetailRequest shopPointDetailRequest, String userId) {
PointInfoDO shopPointInfo = AddPointDetailRequest.convertPointDO(shopPointDetailRequest);
shopPointInfo.setPointCode(generateCode());
@@ -92,6 +107,7 @@ public class ShopPointServiceImpl implements ShopPointService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updatePointDetailInfo(UpdatePointDetailRequest shopPointDetailRequest) {
PointInfoDO shopPointInfo = UpdatePointDetailRequest.convertPointDO(shopPointDetailRequest);
PointDetailInfoDO shopPoint = UpdatePointDetailRequest.convertDO(shopPointDetailRequest);
@@ -137,6 +153,7 @@ public class ShopPointServiceImpl implements ShopPointService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer pointUnbind(Long pointId) {
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
if(Objects.isNull(pointInfo)){
@@ -189,6 +206,7 @@ public class ShopPointServiceImpl implements ShopPointService {
updatePoint.setId(pointId);
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_3.getCode());
updatePoint.setSubmitAuditCount(submitAuditCount);
updatePoint.setOperateUserId(request.getOperateUserId());
PointDetailInfoDO updatePointDetail = new PointDetailInfoDO();
updatePointDetail.setId(pointDetailInfo.getId());
updatePointDetail.setDevelopmentManagerSign(request.getDevelopmentManagerSign());
@@ -297,6 +315,9 @@ public class ShopPointServiceImpl implements ShopPointService {
@Override
@Transactional(rollbackFor = Exception.class)
public Integer audit(String userId, PointAuditRequest request) {
if(!request.check()){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
Long pointId = request.getPointId();
PointTodoInfoDO pointTodo = pointTodoInfoDAO.getPointToDoByUserIdAndPointId(userId, pointId);
if(Objects.isNull(pointTodo)){
@@ -357,9 +378,123 @@ public class ShopPointServiceImpl implements ShopPointService {
}
@Override
public List<LineUsernameAndMobileVO> getLineList(String developmentManager) {
lineInfoDAO.getLineListByDevelopmentManager(developmentManager);
return null;
public PageInfo<LinePointBaseInfoVO> getLinePage(PointLinePageRequest request) {
Page<LineInfoDO> lineList = lineInfoDAO.getLinePageByDevelopmentManager(request);
List<String> userPortraitList = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait() )).map(LineInfoDO::getUserPortrait).collect(Collectors.toList());
List<String> investmentManagerUserIds = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager() )).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList());
List<Long> lineIds = lineList.stream().map(LineInfoDO::getId).collect(Collectors.toList());
List<Long> wantShopAreaIds = lineList.stream().map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList());
Map<Long, Integer> recommendShopNumMap = pointRecommendDAO.getPushShopNumMap(lineIds);
Map<Long, HyOpenAreaInfoDO> cityMap = hyOpenAreaInfoDAO.getCityMap(wantShopAreaIds);
Map<Long, Integer> selectedShopNumMap = pointInfoDAO.getSelectedShopNumMap(lineIds);
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(investmentManagerUserIds);
Map<Long, String> userPortraitMap = labelService.getUserPortraitMap(userPortraitList);
List<LinePointBaseInfoVO> resultList = LinePointBaseInfoVO.convertList(lineList, userNameMap, userPortraitMap, cityMap, recommendShopNumMap, selectedShopNumMap);
PageInfo resultPage = new PageInfo(lineList);
resultPage.setList(resultList);
return resultPage;
}
@Override
public PointHomePageDataVO getMyPointData(String userId) {
return pointInfoDAO.getMyPointData(userId);
}
@Override
public PageInfo<PointPageVO> getMyPointPage(PointPageRequest request) {
if(Objects.nonNull(request.getPointStatus()) && PointStatusEnum.POINT_STATUS_3.getCode().equals(request.getPointStatus())){
request.setPointStatus(CommonConstants.ONE == request.getStorageStatus() ? PointStatusEnum.POINT_STATUS_4.getCode() : PointStatusEnum.POINT_STATUS_3.getCode());
}
List<PointPageVO> resultList = new ArrayList();
Page<PointInfoDO> pointPage = pointInfoDAO.getMyPointPage(request);
if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){
List<Long> regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList());
List<String> developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList());
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers);
Map<Long, String> regionNameMap = new HashMap<>();
resultList = PointPageVO.convertVO(pointPage.getResult(), userNameMap, regionNameMap);
}
PageInfo resultPage = new PageInfo(pointPage);
resultPage.setList(resultList);
return resultPage;
}
@Override
public List<PointAuditRecordVO> getPointAllAuditRecord(Long pointId) {
List<PointAuditRecordDO> auditRecordList = pointAuditRecordDAO.getPointAllAuditRecord(pointId);
if(CollectionUtils.isEmpty(auditRecordList)){
return Lists.newArrayList();
}
List<String> userIds = auditRecordList.stream().map(o->JSONObject.parseArray(o.getHandlerUserIds(), String.class)).flatMap(Collection::stream).distinct().collect(Collectors.toList());
Map<String, EnterpriseUserDO> userMap = enterpriseUserDAO.getUserInfoMap(userIds);
return PointAuditRecordVO.convert(auditRecordList, userMap);
}
@Override
public List<PointRecommendPageVO> getLineRecommendPointList(Long lineId) {
List<PointRecommendDO> recommendPointList = pointRecommendDAO.getRecommendPointList(lineId);
List<Long> pointIds = recommendPointList.stream().map(PointRecommendDO::getPointId).distinct().collect(Collectors.toList());
List<PointInfoDO> pointList = pointInfoDAO.getPointListByIds(pointIds);
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<>();
return PointRecommendPageVO.convertVO(recommendPointList, pointList, userNameMap, regionNameMap);
}
@Override
public PageInfo<PointPageVO> getRecommendPointList(RecommendPointPageRequest request) {
if(Objects.nonNull(request.getPointStatus()) && PointStatusEnum.POINT_STATUS_3.getCode().equals(request.getPointStatus())){
request.setPointStatus(PointStatusEnum.POINT_STATUS_4.getCode());
}
List<PointPageVO> resultList = new ArrayList();
Page<PointInfoDO> pointPage = pointInfoDAO.getRecommendPointList(request);
if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){
List<Long> regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList());
List<String> developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList());
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers);
Map<Long, String> regionNameMap = new HashMap<>();
resultList = PointPageVO.convertVO(pointPage.getResult(), userNameMap, regionNameMap);
}
PageInfo resultPage = new PageInfo(pointPage);
resultPage.setList(resultList);
return resultPage;
}
@Override
public Integer recommendPoint(RecommendPointRequest request) {
List<PointRecommendDO> recommendList = request.convertList();
return pointRecommendDAO.addRecommendPoint(recommendList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer turnLine(TurnLineRequest request) {
Long lineId = request.getLineId();
//更改线索中的拓展经理
LineInfoDO updateLineInfo = new LineInfoDO();
updateLineInfo.setId(lineId);
updateLineInfo.setDevelopmentManager(request.getDevelopmentManager());
lineInfoDAO.updateLineInfo(updateLineInfo);
//更新已被选择的铺位的拓展经理
pointInfoDAO.updateSelectedDevelopmentManager(lineId, request.getDevelopmentManager());
//删除未选择的推荐铺位
return pointRecommendDAO.deleteUnselectedRecommendPointByLineId(lineId);
}
@Override
public Integer updateWantShopNum(UpdateWantShopNumRequest request) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
if(!WorkflowStageEnum.INTENT.getCode().equals(lineInfo.getWorkflowStage())){
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_MODIFY_WANT_SHOP_NUM);
}
LineInfoDO updateLine = new LineInfoDO();
updateLine.setId(request.getLineId());
updateLine.setWantShopNum(request.getWantShopNum());
return lineInfoDAO.updateLineInfo(updateLine);
}
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, PointInfoDO pointInfo) {

View File

@@ -4,9 +4,9 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.request.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ShopPointService;
import com.cool.store.vo.LineUsernameAndMobileVO;
import com.cool.store.vo.point.AuditSettingVO;
import com.cool.store.vo.point.PointDetailVO;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
@@ -101,7 +101,7 @@ public class ShopPointController {
return ResponseResult.success(shopPointService.operationUserAudit(CurrentUserHolder.getUserId(), request));
}
@ApiOperation("审批")
@ApiOperation("审批(排除第二级审批)")
@PostMapping("/audit")
public ResponseResult<Integer> audit(@RequestBody PointAuditRequest request) {
return ResponseResult.success(shopPointService.audit(CurrentUserHolder.getUserId(), request));
@@ -109,14 +109,66 @@ public class ShopPointController {
@ApiOperation("铺位转让")
@PostMapping("/turnDevelopmentManager")
public ResponseResult<Integer> turnDevelopmentManager(@RequestBody TurnDevelopmentManagerRequest request) {
public ResponseResult<Integer> turnDevelopmentManager(@RequestBody @Validated TurnDevelopmentManagerRequest request) {
return ResponseResult.success(shopPointService.turnDevelopmentManager(request));
}
@ApiOperation("获取我负责的加盟商列表")
@GetMapping("/getLineList")
public ResponseResult<List<LineUsernameAndMobileVO>> getLineList() {
return ResponseResult.success(shopPointService.getLineList(CurrentUserHolder.getUserId()));
@PostMapping("/getLinePage")
public ResponseResult<PageInfo<LinePointBaseInfoVO>> getLinePage(@RequestBody PointLinePageRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.getLinePage(request));
}
@ApiOperation("首页我的数据")
@GetMapping("/getMyData")
public ResponseResult<PointHomePageDataVO> getMyPointData() {
return ResponseResult.success(shopPointService.getMyPointData(CurrentUserHolder.getUserId()));
}
@ApiOperation("我的铺位-已入库/暂未入库")
@PostMapping("/getMyPointPage")
public ResponseResult<PageInfo<PointPageVO>> getMyPointPage(@RequestBody @Validated PointPageRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.getMyPointPage(request));
}
@ApiOperation("获取单个铺位审批记录")
@GetMapping("/getAuditRecord")
public ResponseResult<List<PointAuditRecordVO>> getPointAllAuditRecord(@RequestParam("pointId")Long pointId) {
return ResponseResult.success(shopPointService.getPointAllAuditRecord(pointId));
}
@ApiOperation("获取加盟商的推荐铺位列表")
@GetMapping("/getLineRecommendPointList")
public ResponseResult<List<PointRecommendPageVO>> getLineRecommendPointList(@RequestParam("lineId")Long lineId) {
return ResponseResult.success(shopPointService.getLineRecommendPointList(lineId));
}
@ApiOperation("选址人员获取可推荐铺位列表")
@PostMapping("/getRecommendPointList")
public ResponseResult<PageInfo<PointPageVO>> getRecommendPointList(@RequestBody @Validated RecommendPointPageRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.getRecommendPointList(request));
}
@ApiOperation("铺位推送")
@PostMapping("/recommendPoint")
public ResponseResult<Integer> recommendPoint(@RequestBody @Validated RecommendPointRequest request) {
request.setDevelopmentManager(CurrentUserHolder.getUserId());
return ResponseResult.success(shopPointService.recommendPoint(request));
}
@ApiOperation("选址人员转让加盟商")
@PostMapping("/turnLine")
public ResponseResult<Integer> turnLine(@RequestBody @Validated TurnLineRequest request) {
return ResponseResult.success(shopPointService.turnLine(request));
}
@ApiOperation("修改意向开店数量")
@PostMapping("/updateWantShopNum")
public ResponseResult<Integer> updateWantShopNum(@RequestBody @Validated UpdateWantShopNumRequest request) {
return ResponseResult.success(shopPointService.updateWantShopNum(request));
}