筹建列表 筹建详情
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||||
import com.cool.store.dto.point.LineCountDTO;
|
import com.cool.store.dto.point.LineCountDTO;
|
||||||
import com.cool.store.entity.ShopInfoDO;
|
import com.cool.store.entity.ShopInfoDO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.mapper.ShopInfoMapper;
|
import com.cool.store.mapper.ShopInfoMapper;
|
||||||
|
import com.cool.store.request.PreparationRequest;
|
||||||
import com.cool.store.vo.shop.StageShopCountVO;
|
import com.cool.store.vo.shop.StageShopCountVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
@@ -167,5 +169,11 @@ public class ShopInfoDAO {
|
|||||||
*/
|
*/
|
||||||
public List<OpenPlanShopInfoDTO> queryShopCodeListByid(@Param("shopIdList") List<Long> shopIdList){
|
public List<OpenPlanShopInfoDTO> queryShopCodeListByid(@Param("shopIdList") List<Long> shopIdList){
|
||||||
return shopInfoMapper.queryShopCodeListByid(shopIdList);
|
return shopInfoMapper.queryShopCodeListByid(shopIdList);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PreparationDTO> ListByCondition(PreparationRequest request){
|
||||||
|
return shopInfoMapper.ListByCondition(request);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||||
import com.cool.store.entity.ShopStageInfoDO;
|
import com.cool.store.entity.ShopStageInfoDO;
|
||||||
import com.cool.store.enums.point.ShopStageEnum;
|
import com.cool.store.enums.point.ShopStageEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageEnum;
|
import com.cool.store.enums.point.ShopSubStageEnum;
|
||||||
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -176,4 +178,20 @@ public class ShopStageInfoDAO {
|
|||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
return shopStageInfoMapper.getShopIdListByStageStatus();
|
return shopStageInfoMapper.getShopIdListByStageStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ScheduleDTO> getScheduleList(List<Long> shopIdList){
|
||||||
|
if (CollectionUtils.isEmpty(shopIdList)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return shopStageInfoMapper.getScheduleList(shopIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ShopStageInfoDO> getShopContractActualCompletionTime(List<Long> shopIdList){
|
||||||
|
if (CollectionUtils.isEmpty(shopIdList)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return shopStageInfoMapper.getShopContractActualCompletionTime(shopIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||||
import com.cool.store.dto.point.LineCountDTO;
|
import com.cool.store.dto.point.LineCountDTO;
|
||||||
import com.cool.store.entity.ShopInfoDO;
|
import com.cool.store.entity.ShopInfoDO;
|
||||||
|
import com.cool.store.request.PreparationRequest;
|
||||||
import com.cool.store.vo.shop.StageShopCountVO;
|
import com.cool.store.vo.shop.StageShopCountVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -84,4 +86,8 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
|||||||
List<OpenPlanShopInfoDTO> queryShopCodeListByid(@Param("shopIdList") List<Long> shopIdList);
|
List<OpenPlanShopInfoDTO> queryShopCodeListByid(@Param("shopIdList") List<Long> shopIdList);
|
||||||
|
|
||||||
List<LineCountDTO> getSelectedShopNum(@Param("lineIds") List<Long> lineIds);
|
List<LineCountDTO> getSelectedShopNum(@Param("lineIds") List<Long> lineIds);
|
||||||
|
|
||||||
|
|
||||||
|
List<PreparationDTO> ListByCondition(@Param("request") PreparationRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||||
import com.cool.store.entity.ShopStageInfoDO;
|
import com.cool.store.entity.ShopStageInfoDO;
|
||||||
import com.cool.store.vo.shop.RentInfoToDoVO;
|
import com.cool.store.vo.shop.RentInfoToDoVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
@@ -100,4 +101,8 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
|
|||||||
* @description:获取处于订货金阶段的shopid
|
* @description:获取处于订货金阶段的shopid
|
||||||
*/
|
*/
|
||||||
Page<Long> getShopIdListByStageStatus();
|
Page<Long> getShopIdListByStageStatus();
|
||||||
|
|
||||||
|
List<ScheduleDTO> getScheduleList(@Param("shopIds") List<Long> shopIds);
|
||||||
|
|
||||||
|
List<ShopStageInfoDO> getShopContractActualCompletionTime(@Param("shopIds") List<Long> shopIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,5 +128,49 @@
|
|||||||
group by line_id
|
group by line_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="ListByCondition" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
||||||
|
select
|
||||||
|
a.id as id,
|
||||||
|
a.shop_name as shopName,
|
||||||
|
a.store_num as storeNum,
|
||||||
|
a.shop_manager_user_id as shopManagerUserId,
|
||||||
|
a.region_id as regionId,
|
||||||
|
a.plan_open_time as planOpenTime,
|
||||||
|
b.username as username,
|
||||||
|
b.mobile as mobile
|
||||||
|
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
||||||
|
where a.deleted = 0
|
||||||
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
|
and (b.username like concat('%', #{request.keyword}, '%') or b.mobile like concat('%', #{request.keyword}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="request.shopName!=null and request.shopName!=''">
|
||||||
|
and a.shop_name like concat('%', #{request.shopName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="request.investmentUserId != null and request.investmentUserId != ''">
|
||||||
|
and b.investment_manager = #{request.investmentUserId}
|
||||||
|
</if>
|
||||||
|
<if test="request.supervisorUserId != null and request.supervisorUserId != ''">
|
||||||
|
and a.supervisor_user_id = #{request.supervisorUserId}
|
||||||
|
</if>
|
||||||
|
<if test="request.planOpenStartTime != null and request.planOpenStartTime != ''">
|
||||||
|
and a.plan_open_time >= #{request.planOpenStartTime}
|
||||||
|
</if>
|
||||||
|
<if test="request.planOpenEndTime != null and request.planOpenEndTime != ''">
|
||||||
|
<![CDATA[and a.plan_open_time <= #{request.planOpenEndTime}]]>
|
||||||
|
</if>
|
||||||
|
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
||||||
|
and a.region_id in
|
||||||
|
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||||
|
#{regionId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
||||||
|
and a.region_id in
|
||||||
|
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
||||||
|
#{regionId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -154,4 +154,33 @@
|
|||||||
where shop_stage = 2 and shop_sub_stage = 150 and shop_sub_stage_status= 1505 and is_terminated = 0
|
where shop_stage = 2 and shop_sub_stage = 150 and shop_sub_stage_status= 1505 and is_terminated = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getScheduleList" resultType="com.cool.store.dto.Preparation.ScheduleDTO">
|
||||||
|
select
|
||||||
|
shop_id as shopId,
|
||||||
|
max(plan_complete_time) as planCompleteTime,
|
||||||
|
count(1) as totalColumn,
|
||||||
|
sum(if(is_terminated = 1, 1, 0)) as completionColumn
|
||||||
|
from xfsg_shop_stage_info where shop_stage = 2
|
||||||
|
<if test="shopIds != null and shopIds.size() > 0">
|
||||||
|
and shop_id in
|
||||||
|
<foreach collection="shopIds" item="shopId" index="index" open="(" separator="," close=")">
|
||||||
|
#{shopId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by shop_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getShopContractActualCompletionTime" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from xfsg_shop_stage_info where shop_stage = 1 and shop_sub_stage = 20 and actual_complete_time is not null
|
||||||
|
<if test="shopIds != null and shopIds.size() > 0">
|
||||||
|
and shop_id in
|
||||||
|
<foreach collection="shopIds" item="shopId" index="index" open="(" separator="," close=")">
|
||||||
|
#{shopId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.cool.store.dto.Preparation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 15:40
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreparationDTO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
private String storeNum;
|
||||||
|
|
||||||
|
private String shopManagerUserId;
|
||||||
|
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
private Date planOpenTime;
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.cool.store.dto.Preparation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 16:19
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScheduleDTO {
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
private Date planCompleteTime;
|
||||||
|
|
||||||
|
private Integer totalColumn;
|
||||||
|
|
||||||
|
private Integer completionColumn;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.cool.store.request;
|
||||||
|
|
||||||
|
import com.cool.store.common.PageBasicInfo;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 15:15
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreparationRequest extends PageBasicInfo {
|
||||||
|
|
||||||
|
@ApiModelProperty("选择区域")
|
||||||
|
private List<String> regionIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店名称")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
@ApiModelProperty("加盟商名称与手机号")
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
@ApiModelProperty("计划开业开始时间")
|
||||||
|
private String planOpenStartTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("计划开业结束时间")
|
||||||
|
private String planOpenEndTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("招商经理Id")
|
||||||
|
private String investmentUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("督导ID")
|
||||||
|
private String supervisorUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前登录用户", hidden = true)
|
||||||
|
private String curUserId;
|
||||||
|
@ApiModelProperty(value = "管辖区域",hidden = true)
|
||||||
|
private List<String> authRegionIds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.cool.store.vo.Preparation;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 17:38
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreparationScheduleDetailVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("加盟商名称")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("加盟手机号")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private Integer joinStatus;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店名称")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店编码")
|
||||||
|
private String storeNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("总项数")
|
||||||
|
private Integer totalColumn;
|
||||||
|
|
||||||
|
@ApiModelProperty("完成项")
|
||||||
|
private Integer completionColumn;
|
||||||
|
|
||||||
|
@ApiModelProperty("计划开店时间")
|
||||||
|
private Date planOpenTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("合同完成时间")
|
||||||
|
private Date ContractCompletionTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("开店时长")
|
||||||
|
private String days;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属站区")
|
||||||
|
private String regionNodeName;
|
||||||
|
|
||||||
|
@ApiModelProperty("预估完成时间")
|
||||||
|
private Date planCompletionTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("招商经理名称")
|
||||||
|
private String investmentManagerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("招商经理手机号")
|
||||||
|
private String investmentManagerMobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("扩展经理名称")
|
||||||
|
private String developmentManagerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("扩展经理手机号")
|
||||||
|
private String developmentManagerMobile;
|
||||||
|
|
||||||
|
public void setDays() {
|
||||||
|
if (this.planOpenTime==null|| this.ContractCompletionTime==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long between = ChronoUnit.SECONDS.between(this.ContractCompletionTime.toInstant(), this.planOpenTime.toInstant());
|
||||||
|
double days = (double) between / (24*60*60);
|
||||||
|
this.days = String.format("%.1f", days);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.cool.store.vo.Preparation;
|
||||||
|
|
||||||
|
import com.cool.store.vo.BaseInfoVO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 15:00
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreparationScheduleVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("加盟商名称")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("加盟手机号")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店名称")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店编码")
|
||||||
|
private String storeNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("开店负责人")
|
||||||
|
private String shopManagerUserName;
|
||||||
|
|
||||||
|
@ApiModelProperty("总项数")
|
||||||
|
private Integer totalColumn;
|
||||||
|
|
||||||
|
@ApiModelProperty("完成项")
|
||||||
|
private Integer completionColumn;
|
||||||
|
|
||||||
|
@ApiModelProperty("计划开店时间")
|
||||||
|
private Date planOpenTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("合同完成时间")
|
||||||
|
private Date ContractCompletionTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("开店时长")
|
||||||
|
private String days;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属站区")
|
||||||
|
private String regionNodeName;
|
||||||
|
|
||||||
|
public void setDays() {
|
||||||
|
if (this.planOpenTime==null|| this.ContractCompletionTime==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long between = ChronoUnit.SECONDS.between(this.ContractCompletionTime.toInstant(), this.planOpenTime.toInstant());
|
||||||
|
double days = (double) between / (24*60*60);
|
||||||
|
this.days = String.format("%.1f", days);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.request.PreparationRequest;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleDetailVO;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleVO;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
* @Date 2024/4/22 16:10
|
* @Date 2024/4/22 16:10
|
||||||
@@ -8,6 +15,21 @@ package com.cool.store.service;
|
|||||||
public interface PreparationService {
|
public interface PreparationService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开业进度列表
|
||||||
|
* @param preparationRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageInfo<PreparationScheduleVO> getPreparationSchedule(PreparationRequest preparationRequest);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开业进度详情
|
||||||
|
* @param shopId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PreparationScheduleDetailVO getPreparationDetail(Long shopId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验建店与加盟签约合同是否完成 并初始化后续流程数据
|
* 校验建店与加盟签约合同是否完成 并初始化后续流程数据
|
||||||
* @param shopId
|
* @param shopId
|
||||||
|
|||||||
@@ -1,22 +1,33 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dao.OpenAcceptanceInfoDAO;
|
import com.cool.store.dao.*;
|
||||||
import com.cool.store.dao.ShopStageInfoDAO;
|
import com.cool.store.dto.Preparation.PreparationDTO;
|
||||||
import com.cool.store.entity.OpenAcceptanceInfoDO;
|
import com.cool.store.dto.Preparation.ScheduleDTO;
|
||||||
import com.cool.store.entity.ShopStageInfoDO;
|
import com.cool.store.entity.*;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.enums.point.ShopStageEnum;
|
import com.cool.store.enums.point.ShopStageEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageEnum;
|
import com.cool.store.enums.point.ShopSubStageEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.request.PreparationRequest;
|
||||||
import com.cool.store.service.PreparationService;
|
import com.cool.store.service.PreparationService;
|
||||||
|
import com.cool.store.service.RegionService;
|
||||||
|
import com.cool.store.service.SysRoleService;
|
||||||
|
import com.cool.store.service.UserAuthMappingService;
|
||||||
|
import com.cool.store.utils.poi.DateUtils;
|
||||||
|
import com.cool.store.utils.poi.StringUtils;
|
||||||
import com.cool.store.utils.poi.constant.Constants;
|
import com.cool.store.utils.poi.constant.Constants;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleDetailVO;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleVO;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,8 +42,120 @@ public class PreparationServiceImpl implements PreparationService {
|
|||||||
private ShopStageInfoDAO shopStageInfoDAO;
|
private ShopStageInfoDAO shopStageInfoDAO;
|
||||||
@Resource
|
@Resource
|
||||||
private OpenAcceptanceInfoDAO openAcceptanceInfoDAO;
|
private OpenAcceptanceInfoDAO openAcceptanceInfoDAO;
|
||||||
|
@Resource
|
||||||
|
private SysRoleService sysRoleService;
|
||||||
|
@Resource
|
||||||
|
private UserAuthMappingService userAuthMappingService;
|
||||||
|
@Resource
|
||||||
|
private RegionService regionService;
|
||||||
|
@Resource
|
||||||
|
ShopInfoDAO shopInfoDAO;
|
||||||
|
@Resource
|
||||||
|
EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
@Resource
|
||||||
|
LineInfoDAO lineInfoDAO;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<PreparationScheduleVO> getPreparationSchedule(PreparationRequest request) {
|
||||||
|
if(!sysRoleService.checkIsAdmin(request.getCurUserId())){
|
||||||
|
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId()));
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(request.getRegionIds())){
|
||||||
|
if(request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)){
|
||||||
|
request.setRegionIds(null);
|
||||||
|
}else{
|
||||||
|
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||||
|
//开业进度数据
|
||||||
|
List<PreparationDTO> preparationDTOS = shopInfoDAO.ListByCondition(request);
|
||||||
|
PageInfo pageInfo = new PageInfo<>(preparationDTOS);
|
||||||
|
List<Long> shopIds = preparationDTOS.stream().map(PreparationDTO::getId).collect(Collectors.toList());
|
||||||
|
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
|
||||||
|
List<ShopStageInfoDO> shopContractActualCompletionTime = shopStageInfoDAO.getShopContractActualCompletionTime(shopIds);
|
||||||
|
Map<Long, ScheduleDTO> scheduleDTOMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
|
||||||
|
Map<Long, ShopStageInfoDO> shopStageInfoDOMap = shopContractActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
||||||
|
List<Long> regionIds = preparationDTOS.stream().map(PreparationDTO::getRegionId).collect(Collectors.toList());
|
||||||
|
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
|
||||||
|
List<String> userIds = preparationDTOS.stream().map(PreparationDTO::getShopManagerUserId).collect(Collectors.toList());
|
||||||
|
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(userIds);
|
||||||
|
|
||||||
|
List<PreparationScheduleVO> preparationScheduleVOS = new ArrayList<>();
|
||||||
|
preparationDTOS.forEach(x->{
|
||||||
|
PreparationScheduleVO preparationScheduleVO = new PreparationScheduleVO();
|
||||||
|
preparationScheduleVO.setMobile(x.getMobile());
|
||||||
|
preparationScheduleVO.setUsername(x.getUsername());
|
||||||
|
preparationScheduleVO.setShopId(x.getId());
|
||||||
|
preparationScheduleVO.setShopName(x.getShopName());
|
||||||
|
preparationScheduleVO.setPlanOpenTime(x.getPlanOpenTime());
|
||||||
|
preparationScheduleVO.setStoreNum(x.getStoreNum());
|
||||||
|
preparationScheduleVO.setShopManagerUserName(userInfoMap.getOrDefault(x.getShopManagerUserId(), new EnterpriseUserDO()).getName());
|
||||||
|
preparationScheduleVO.setRegionNodeName(regionNameMap.getOrDefault(x.getRegionId(), ""));
|
||||||
|
ScheduleDTO dto = scheduleDTOMap.getOrDefault(x.getId(), new ScheduleDTO());
|
||||||
|
preparationScheduleVO.setCompletionColumn(dto.getCompletionColumn());
|
||||||
|
preparationScheduleVO.setTotalColumn(dto.getTotalColumn());
|
||||||
|
ShopStageInfoDO stageInfoDO = shopStageInfoDOMap.getOrDefault(x.getId(), new ShopStageInfoDO());
|
||||||
|
if (StringUtils.isNotEmpty(stageInfoDO.getActualCompleteTime())){
|
||||||
|
preparationScheduleVO.setContractCompletionTime(DateUtils.strToDate(stageInfoDO.getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||||
|
}
|
||||||
|
preparationScheduleVO.setDays();
|
||||||
|
preparationScheduleVOS.add(preparationScheduleVO);
|
||||||
|
});
|
||||||
|
pageInfo.setList(preparationScheduleVOS);
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PreparationScheduleDetailVO getPreparationDetail(Long shopId) {
|
||||||
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
||||||
|
if (shopInfo == null){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.SHOP_ID_IS_NULL);
|
||||||
|
}
|
||||||
|
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
|
||||||
|
|
||||||
|
List<ScheduleDTO> shopContractActualCompletionTime = shopStageInfoDAO.getScheduleList(Collections.singletonList(shopId));
|
||||||
|
PreparationScheduleDetailVO preparationScheduleDetailVO = new PreparationScheduleDetailVO();
|
||||||
|
List<ShopStageInfoDO> shop = shopStageInfoDAO.getShopContractActualCompletionTime(Collections.singletonList(shopId));
|
||||||
|
Set<Object> userSet = new HashSet<>();
|
||||||
|
if (StringUtils.isNotEmpty(lineInfo.getInvestmentManager())){
|
||||||
|
userSet.add(lineInfo.getInvestmentManager());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(lineInfo.getDevelopmentManager())){
|
||||||
|
userSet.add(lineInfo.getDevelopmentManager());
|
||||||
|
}
|
||||||
|
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(Collections.singletonList(shopInfo.getRegionId()));
|
||||||
|
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(new ArrayList(userSet));
|
||||||
|
preparationScheduleDetailVO.setShopId(shopId);
|
||||||
|
preparationScheduleDetailVO.setUsername(lineInfo.getUsername());
|
||||||
|
preparationScheduleDetailVO.setMobile(lineInfo.getMobile());
|
||||||
|
preparationScheduleDetailVO.setJoinStatus(lineInfo.getJoinStatus());
|
||||||
|
preparationScheduleDetailVO.setShopName(shopInfo.getShopName());
|
||||||
|
preparationScheduleDetailVO.setPlanOpenTime(shopInfo.getPlanOpenTime());
|
||||||
|
preparationScheduleDetailVO.setStoreNum(shopInfo.getStoreNum());
|
||||||
|
preparationScheduleDetailVO.setJoinStatus(lineInfo.getJoinStatus());
|
||||||
|
if (CollectionUtils.isNotEmpty(shopContractActualCompletionTime)){
|
||||||
|
ScheduleDTO scheduleDTO = shopContractActualCompletionTime.get(CommonConstants.ZERO);
|
||||||
|
preparationScheduleDetailVO.setCompletionColumn(scheduleDTO.getCompletionColumn());
|
||||||
|
preparationScheduleDetailVO.setTotalColumn(scheduleDTO.getTotalColumn());
|
||||||
|
preparationScheduleDetailVO.setPlanCompletionTime(scheduleDTO.getPlanCompleteTime());
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(shop)){
|
||||||
|
ShopStageInfoDO shopStageInfoDO = shop.get(CommonConstants.ZERO);
|
||||||
|
preparationScheduleDetailVO.setContractCompletionTime(DateUtils.strToDate(shopStageInfoDO.getActualCompleteTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||||
|
}
|
||||||
|
EnterpriseUserDO developmentManager = userInfoMap.getOrDefault(lineInfo.getDevelopmentManager(), new EnterpriseUserDO());
|
||||||
|
EnterpriseUserDO investmentManager = userInfoMap.getOrDefault(lineInfo.getInvestmentManager(), new EnterpriseUserDO());
|
||||||
|
preparationScheduleDetailVO.setDevelopmentManagerName(developmentManager.getName());
|
||||||
|
preparationScheduleDetailVO.setDevelopmentManagerMobile(developmentManager.getMobile());
|
||||||
|
preparationScheduleDetailVO.setInvestmentManagerName(investmentManager.getName());
|
||||||
|
preparationScheduleDetailVO.setInvestmentManagerMobile(investmentManager.getMobile());
|
||||||
|
preparationScheduleDetailVO.setRegionNodeName(regionNameMap.get(shopInfo.getRegionId()));
|
||||||
|
preparationScheduleDetailVO.setDays();
|
||||||
|
return preparationScheduleDetailVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contractAndBuildStoreCompletion(Long shopId) {
|
public void contractAndBuildStoreCompletion(Long shopId) {
|
||||||
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
|
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.cool.store.controller.webb;
|
||||||
|
|
||||||
|
import com.cool.store.context.CurrentUserHolder;
|
||||||
|
import com.cool.store.request.PreparationRequest;
|
||||||
|
import com.cool.store.request.TrainingExperienceDistributionRequest;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.PreparationService;
|
||||||
|
import com.cool.store.service.impl.PreparationServiceImpl;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleDetailVO;
|
||||||
|
import com.cool.store.vo.Preparation.PreparationScheduleVO;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2024/4/26 16:56
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "筹建进度")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pc/preparation")
|
||||||
|
public class PreparationController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PreparationService preparationService;
|
||||||
|
|
||||||
|
@ApiOperation("进度列表")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseResult<PageInfo<PreparationScheduleVO>> distribution(@RequestBody PreparationRequest request) {
|
||||||
|
request.setCurUserId(CurrentUserHolder.getUserId());
|
||||||
|
return ResponseResult.success(preparationService.getPreparationSchedule(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("筹建详情")
|
||||||
|
@GetMapping("/getPreparationDetail")
|
||||||
|
public ResponseResult<PreparationScheduleDetailVO> getPreparationDetail(@RequestParam("shopId")Long shopId) {
|
||||||
|
return ResponseResult.success(preparationService.getPreparationDetail(shopId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user