Merge branch 'master' into cc_sign_20250507
This commit is contained in:
@@ -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,24 +393,68 @@ 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())) {
|
||||
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());
|
||||
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());
|
||||
if (isAdmin) {
|
||||
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_90.getShopSubStageStatus());
|
||||
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_901.getShopSubStageStatus());
|
||||
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_902.getShopSubStageStatus());
|
||||
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);
|
||||
}
|
||||
return commonPendingVOPageInfo(pageNum, pageSize, isAdmin ? null : user, ShopSubStageEnum.SHOP_STAGE_9, subStageStatusList, isAdmin ? Boolean.FALSE : Boolean.TRUE);
|
||||
}
|
||||
|
||||
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())) {
|
||||
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())) {
|
||||
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_862.getShopSubStageStatus());
|
||||
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);
|
||||
}
|
||||
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user