Merge branch 'master' into cc_sign_20250507

This commit is contained in:
苏竹红
2025-05-08 10:15:13 +08:00
10 changed files with 290 additions and 53 deletions

View File

@@ -41,6 +41,7 @@ public enum UserRoleEnum {
KUAI_SHOU_CUSTOMER(360000000L,"快手客服"),
XIN_FA_SYS_CUSTOMER(370000000L,"信发系统客服"),
TENT_PASS_CUSTOMER(380000000L,"营帐通客服"),
//设计师
DESIGN_CUSTOMER(390000000L,"设计客服"),
CONSTRUCTION_CUSTOMER(400000000L,"立规内勤"),
BRANCH_OFFICE(1724233283449L,"分部内勤"),

View File

@@ -2,7 +2,10 @@ package com.cool.store.dao;
import com.cool.store.entity.DecorationDesignInfoDO;
import com.cool.store.mapper.DecorationDesignInfoMapper;
import com.cool.store.utils.StringUtil;
import com.cool.store.vo.desk.PreparationCommonPendingVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
@@ -51,6 +54,13 @@ public class DecorationDesignInfoDAO {
return decorationDesignInfoMapper.selectByShopId(shopId);
}
// 根据设计师人员id和店铺阶段 SHOP_SUB_STAGE_STATUS_901 查询店铺信息
public List<PreparationCommonPendingVO> getByDesignUserIdAndShopStage(String userId){
if(userId == null){
return new ArrayList<>();
}
return decorationDesignInfoMapper.getByDesignUserIdAndShopStage(userId);
}

View File

@@ -3,6 +3,8 @@ package com.cool.store.dao;
import com.cool.store.entity.DecorationDesignInfoDO;
import com.cool.store.entity.DecorationMeasureDO;
import com.cool.store.mapper.DecorationMeasureMapper;
import com.cool.store.utils.StringUtil;
import com.cool.store.vo.desk.PreparationCommonPendingVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
@@ -59,4 +61,26 @@ public class DecorationMeasureDAO {
return decorationMeasureMapper.selectByShopId(shopId);
}
public List<PreparationCommonPendingVO> getByMeasureUserIdAndShopStage(String measureUserId){
if (StringUtil.isBlank(measureUserId)){
return null;
}
return decorationMeasureMapper.selectByMeasureUserIdAndShopStage(measureUserId);
}
//根据设计师和阶段900 查询 店铺id
public List<PreparationCommonPendingVO> getShopIdListByDesignUserIdAndShopStage(String userId) {
if (StringUtil.isBlank(userId)){
return new ArrayList<>();
}
return decorationMeasureMapper.getShopIdListByDesignUserIdAndShopStage(userId);
}
//有 设计组长 和 设计师 查询 指定当前用户和 阶段为 900 待分配设计师 阶段为 901 设计中 设计表关联查询
public List<PreparationCommonPendingVO> getShopIdListByDesignUserIdOrQuotationAndShopStage(String userId) {
if (StringUtil.isBlank(userId)){
return new ArrayList<>();
}
return decorationMeasureMapper.getShopIdListByDesignUserIdOrQuotationAndShopStage(userId);
}
}

View File

@@ -1,8 +1,12 @@
package com.cool.store.mapper;
import com.cool.store.entity.DecorationDesignInfoDO;
import com.cool.store.vo.desk.PreparationCommonPendingVO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface DecorationDesignInfoMapper extends Mapper<DecorationDesignInfoDO> {
@@ -13,4 +17,6 @@ public interface DecorationDesignInfoMapper extends Mapper<DecorationDesignInfoD
*/
DecorationDesignInfoDO selectByShopId(Long shopId);
List<PreparationCommonPendingVO> getByDesignUserIdAndShopStage(@Param("userId") String userId);
}

View File

@@ -1,8 +1,12 @@
package com.cool.store.mapper;
import com.cool.store.entity.DecorationMeasureDO;
import com.cool.store.vo.desk.PreparationCommonPendingVO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface DecorationMeasureMapper extends Mapper<DecorationMeasureDO> {
/**
@@ -13,4 +17,9 @@ public interface DecorationMeasureMapper extends Mapper<DecorationMeasureDO> {
*/
DecorationMeasureDO selectByShopId(Long shopId);
List<PreparationCommonPendingVO> selectByMeasureUserIdAndShopStage(@Param("measureUserId") String measureUserId);
List<PreparationCommonPendingVO> getShopIdListByDesignUserIdAndShopStage(@Param("userId") String userId);
List<PreparationCommonPendingVO> getShopIdListByDesignUserIdOrQuotationAndShopStage(@Param("userId") String userId);
}

View File

@@ -33,10 +33,29 @@
*
from xfsg_decoration_design_info where shop_id = #{shopId} and deleted = 0
</select>
<select id="getByDesignUserIdAndShopStage" resultType="com.cool.store.vo.desk.PreparationCommonPendingVO">
select
c.shop_name as storeName,
c.shop_code as ShopCode,
c.detail_address as shopAddress,
c.investment_manager as investmentManagerId,
c.id as shopId,
c.line_id as lineId,
c.region_id as regionId,
c.store_type as storeType,
b.shop_stage as stage,
b.shop_sub_stage as subStage,
b.shop_sub_stage_status as subStageStatus,
b.update_time as updateTime
from xfsg_decoration_design_info a
left join xfsg_shop_stage_info b on a.shop_id = b.shop_id
left join xfsg_shop_info c on a.shop_id = c.id
where a.design_user_id = #{userId}
and b.shop_sub_stage_status = 901
and c.deleted = 0
order by b.update_time desc
</select>
</mapper>

View File

@@ -27,6 +27,79 @@
submit_time,create_time,update_time,deleted,create_user_id,update_user_id
from xfsg_decoration_measure where shop_id = #{shopId} and deleted = 0
</select>
<select id="selectByMeasureUserIdAndShopStage"
resultType="com.cool.store.vo.desk.PreparationCommonPendingVO">
select
c.shop_name as storeName,
c.shop_code as ShopCode,
c.detail_address as shopAddress,
c.investment_manager as investmentManagerId,
c.id as shopId,
c.line_id as lineId,
c.region_id as regionId,
c.store_type as storeType,
b.shop_stage as stage,
b.shop_sub_stage as subStage,
b.shop_sub_stage_status as subStageStatus,
b.update_time as updateTime
from xfsg_decoration_measure a
left join xfsg_shop_stage_info b on a.shop_id = b.shop_id
left join xfsg_shop_info c on a.shop_id = c.id
where a.measure_user_id = #{measureUserId}
and b.shop_sub_stage_status = 892
and c.deleted = 0
order by b.update_time desc
</select>
<select id="getShopIdListByDesignUserIdAndShopStage" resultType="com.cool.store.vo.desk.PreparationCommonPendingVO">
select
c.shop_name as storeName,
c.shop_code as ShopCode,
c.detail_address as shopAddress,
c.investment_manager as investmentManagerId,
c.id as shopId,
c.line_id as lineId,
c.region_id as regionId,
c.store_type as storeType,
b.shop_stage as stage,
b.shop_sub_stage as subStage,
b.shop_sub_stage_status as subStageStatus,
b.update_time as updateTime
from xfsg_decoration_measure a
left join xfsg_shop_stage_info b on a.shop_id = b.shop_id
left join xfsg_shop_info c on a.shop_id = c.id
where a.design_user_id = #{userId}
and b.shop_sub_stage_status = 900
and c.deleted = 0
order by b.update_time desc
</select>
<select id="getShopIdListByDesignUserIdOrQuotationAndShopStage" resultType="com.cool.store.vo.desk.PreparationCommonPendingVO">
select
c.shop_name as storeName,
c.shop_code as ShopCode,
c.detail_address as shopAddress,
c.investment_manager as investmentManagerId,
c.id as shopId,
c.line_id as lineId,
c.region_id as regionId,
c.store_type as storeType,
b.shop_stage as stage,
b.shop_sub_stage as subStage,
b.shop_sub_stage_status as subStageStatus,
b.update_time as updateTime
from xfsg_decoration_measure a
left join xfsg_shop_stage_info b on a.shop_id = b.shop_id
left join xfsg_shop_info c on a.shop_id = c.id
left join xfsg_decoration_design_info d on a.shop_id = d.shop_id
where
((b.shop_sub_stage_status = 900 and a.design_user_id = #{userId}) or (b.shop_sub_stage_status = 901 and d.design_user_id = #{userId}))
and c.deleted = 0
order by b.update_time desc
</select>
</mapper>

View File

@@ -3,6 +3,8 @@ package com.cool.store.vo.desk;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Author suzhuhong
* @Date 2024/5/7 10:48
@@ -21,6 +23,8 @@ public class PreparationCommonPendingVO {
private String shopAddress;
@ApiModelProperty("督导")
private String investmentManager;
@ApiModelProperty("督导id")
private String investmentManagerId;
@ApiModelProperty("加盟商名称")
private String partnerName;
@ApiModelProperty("手机号")
@@ -39,5 +43,9 @@ public class PreparationCommonPendingVO {
private Long shopId;
@ApiModelProperty("提交时间")
private String submitTime;
@ApiModelProperty("门店类型")
private Integer storeType;
private Long regionId;
private Date updateTime;
}

View File

@@ -52,6 +52,8 @@ import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD_HH_MM_SS;
@Service
public class DeskServiceImpl implements DeskService {
@Resource
DecorationMeasureDAO decorationMeasureDAO;
@Resource
LineInfoDAO lineInfoDAO;
@Resource
@@ -391,17 +393,11 @@ public class DeskServiceImpl implements DeskService {
public PageInfo<PreparationCommonPendingVO> designPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
List<Integer> subStageStatusList = new ArrayList<>();
if (userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode())) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
}
if (userRoleIds.contains(UserRoleEnum.DESIGN_CUSTOMER.getCode())) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_901.getShopSubStageStatus());
}
if (userRoleIds.contains(UserRoleEnum.QUOTATION_OFFICE.getCode())) {
//报价员和管理员不指定人,看阶段符合的全部数据
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
if (userRoleIds.contains(UserRoleEnum.QUOTATION_OFFICE.getCode()) || isAdmin) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_902.getShopSubStageStatus());
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_903.getShopSubStageStatus());
}
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
if (isAdmin) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_901.getShopSubStageStatus());
@@ -409,6 +405,56 @@ public class DeskServiceImpl implements DeskService {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_903.getShopSubStageStatus());
}
return commonPendingVOPageInfo(pageNum, pageSize, isAdmin ? null : user, ShopSubStageEnum.SHOP_STAGE_9, subStageStatusList, isAdmin ? Boolean.FALSE : Boolean.TRUE);
} else {
List<PreparationCommonPendingVO> list = new ArrayList<>();
list = getDesignPendingVO(pageNum, pageSize, user, userRoleIds);
if (CollectionUtils.isEmpty(list)) {
return new PageInfo<>();
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
List<Long> lineIds = list.stream().map(PreparationCommonPendingVO::getLineId).collect(Collectors.toList());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.getByLineIds(lineIds);
Map<Long, LineInfoDO> lineMap = lineInfoDOS.stream().collect(Collectors.toMap(LineInfoDO::getId, line -> line));
Set<Long> regionIdSet = list.stream().map(PreparationCommonPendingVO::getRegionId).collect(Collectors.toSet());
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(new ArrayList<>(regionIdSet));
Set<String> investmentManagerIds = list.stream().map(PreparationCommonPendingVO::getInvestmentManager).collect(Collectors.toSet());
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(new ArrayList<>(investmentManagerIds));
for (PreparationCommonPendingVO preparationCommonPendingVO : list) {
LineInfoDO lineInfoDO = lineMap.get(preparationCommonPendingVO.getLineId());
if (lineInfoDO == null) {
continue;
}
preparationCommonPendingVO.setPartnerName(lineInfoDO.getUsername());
preparationCommonPendingVO.setPartnerPhone(lineInfoDO.getMobile());
preparationCommonPendingVO.setRegionNodeName(regionNameMap.getOrDefault(preparationCommonPendingVO.getRegionId(), ""));
preparationCommonPendingVO.setInvestmentManager(userNameMap.getOrDefault(preparationCommonPendingVO.getInvestmentManager(), ""));
preparationCommonPendingVO.setSubmitTime(DateUtils.parseDateToStr(SPECIAL_DATE_START, preparationCommonPendingVO.getUpdateTime()));
}
return new PageInfo<>(list);
}
}
private List<PreparationCommonPendingVO> getDesignPendingVO(Integer pageNum, Integer pageSize, LoginUserInfo user, List<Long> userRoleIds) {
//只有设计组长 查询 指定当前用户和阶段为 900 待分配设计师
if (userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode()) && !userRoleIds.contains(UserRoleEnum.DESIGN_CUSTOMER.getCode())) {
PageHelper.startPage(pageNum, pageSize);
return decorationMeasureDAO.getShopIdListByDesignUserIdAndShopStage(user.getUserId());
}
//只有设计师 查询 指定当前用户和阶段为 901 设计中
if (userRoleIds.contains(UserRoleEnum.DESIGN_CUSTOMER.getCode()) && !userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode())) {
PageHelper.startPage(pageNum, pageSize);
return decorationDesignInfoDAO.getByDesignUserIdAndShopStage(user.getUserId());
}
//有 设计组长 和 设计师 查询 指定当前用户和 阶段为 900 待分配设计师 阶段为 901 设计中
if (userRoleIds.contains(UserRoleEnum.DESIGN_CUSTOMER.getCode()) && userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode())) {
PageHelper.startPage(pageNum, pageSize);
return decorationMeasureDAO.getShopIdListByDesignUserIdOrQuotationAndShopStage(user.getUserId());
}
return null;
}
@Override
@@ -438,7 +484,7 @@ public class DeskServiceImpl implements DeskService {
vo.setSubmitTime(deskStageMap.get(vo.getShopId()).get(0).getActualCompleteTime());
}
} else if (vo.getSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_111.getShopSubStageStatus())) {
vo.setSubmitTime(CoolDateUtils.DateFormat(constructionMap.get(vo.getShopId()), SPECIAL_DATE_START));
vo.setSubmitTime(DateUtils.parseDateToStr( SPECIAL_DATE_START,constructionMap.get(vo.getShopId())));
}
}
@@ -535,18 +581,47 @@ public class DeskServiceImpl implements DeskService {
public PageInfo<PreparationCommonPendingVO> measurePendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
List<Integer> subStageStatusList = new ArrayList<>();
if (userRoleIds.contains(UserRoleEnum.CONSTRUCTION_CUSTOMER.getCode())) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_861.getShopSubStageStatus());
}
if (userRoleIds.contains(UserRoleEnum.MEASURE_OFFICE.getCode())) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_862.getShopSubStageStatus());
}
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
if (userRoleIds.contains(UserRoleEnum.CONSTRUCTION_CUSTOMER.getCode()) || isAdmin) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_861.getShopSubStageStatus());
if (isAdmin) {
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_861.getShopSubStageStatus());
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_862.getShopSubStageStatus());
}
return commonPendingVOPageInfo(pageNum, pageSize, isAdmin ? null : user, ShopSubStageEnum.SHOP_STAGE_8_6, subStageStatusList, isAdmin ? Boolean.FALSE : Boolean.TRUE);
}
if (userRoleIds.contains(UserRoleEnum.MEASURE_OFFICE.getCode())) {
PageHelper.startPage(pageNum, pageSize);
List<PreparationCommonPendingVO> list = decorationMeasureDAO.getByMeasureUserIdAndShopStage(user.getUserId());
if (CollectionUtils.isEmpty(list)) {
return new PageInfo<>();
}
List<Long> shopIds = list.stream().map(PreparationCommonPendingVO::getShopId).collect(Collectors.toList());
List<Long> lineIds = list.stream().map(PreparationCommonPendingVO::getLineId).collect(Collectors.toList());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.getByLineIds(lineIds);
Map<Long, LineInfoDO> lineMap = lineInfoDOS.stream().collect(Collectors.toMap(LineInfoDO::getId, line -> line));
Set<Long> regionIdSet = list.stream().map(PreparationCommonPendingVO::getRegionId).collect(Collectors.toSet());
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(new ArrayList<>(regionIdSet));
Set<String> investmentManagerIds = list.stream().map(PreparationCommonPendingVO::getInvestmentManager).collect(Collectors.toSet());
Map<String, String> userNameMap = enterpriseUserDAO.getUserNameMap(new ArrayList<>(investmentManagerIds));
for (PreparationCommonPendingVO preparationCommonPendingVO : list) {
LineInfoDO lineInfoDO = lineMap.get(preparationCommonPendingVO.getLineId());
if (lineInfoDO == null) {
continue;
}
preparationCommonPendingVO.setPartnerName(lineInfoDO.getUsername());
preparationCommonPendingVO.setPartnerPhone(lineInfoDO.getMobile());
preparationCommonPendingVO.setRegionNodeName(regionNameMap.getOrDefault(preparationCommonPendingVO.getRegionId(), ""));
preparationCommonPendingVO.setInvestmentManager(userNameMap.getOrDefault(preparationCommonPendingVO.getInvestmentManager(), ""));
preparationCommonPendingVO.setSubmitTime(DateUtils.parseDateToStr(SPECIAL_DATE_START, preparationCommonPendingVO.getUpdateTime()));
}
return new PageInfo<>(list);
}
return new PageInfo<>();
}
/**
@@ -596,6 +671,7 @@ public class DeskServiceImpl implements DeskService {
preparationCommonPendingVO.setLineId(x.getLineId());
preparationCommonPendingVO.setShopId(x.getShopId());
ShopInfoDO shopInfoDO = shopInfoMap.getOrDefault(x.getShopId(), new ShopInfoDO());
preparationCommonPendingVO.setStoreType(shopInfoDO.getStoreType());
if (shopInfoDO != null) {
PointInfoDO pointInfoDO = pointMap.get(shopInfoDO.getPointId());
if (pointInfoDO != null) {
@@ -624,13 +700,13 @@ public class DeskServiceImpl implements DeskService {
List<DeskStageDTO> deskStageDTOS = deskStageMap.get(shopStageInfoDO.getShopId());
if (CollectionUtils.isEmpty(deskStageDTOS)) {
DeskStageDTO dto = new DeskStageDTO();
Date date = DateUtils.dateTime(YYYY_MM_DD_HH_MM_SS, shopStageInfoDO.getActualCompleteTime());
Date date = DateUtils.toDate(YYYY_MM_DD_HH_MM_SS, shopStageInfoDO.getActualCompleteTime());
dto.setActualCompleteTime(DateUtils.parseDateToStr(SPECIAL_DATE_START, date));
dto.setShopSubStageStatus(shopStageInfoDO.getShopSubStageStatus());
deskStageMap.put(shopStageInfoDO.getShopId(), Arrays.asList(dto));
} else {
DeskStageDTO dto = new DeskStageDTO();
Date date = DateUtils.dateTime(YYYY_MM_DD_HH_MM_SS, shopStageInfoDO.getActualCompleteTime());
Date date = DateUtils.toDate(YYYY_MM_DD_HH_MM_SS, shopStageInfoDO.getActualCompleteTime());
dto.setActualCompleteTime(DateUtils.parseDateToStr(SPECIAL_DATE_START, date));
dto.setShopSubStageStatus(shopStageInfoDO.getShopSubStageStatus());
deskStageDTOS.add(dto);

View File

@@ -111,6 +111,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
}
public static Date toDate(final String format, final String ts) {
if (StringUtils.isEmpty(format)|| ObjectUtils.isEmpty(ts)){
return null;
}
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/