feat:处理人数据
This commit is contained in:
@@ -101,6 +101,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
||||
@Resource
|
||||
StoreDao storeDao;
|
||||
@Resource
|
||||
DecorationMeasureDAO decorationMeasureDAO;
|
||||
@Resource
|
||||
DecorationDesignInfoDAO decorationDesignInfoDAO;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -703,24 +707,25 @@ public class ShopServiceImpl implements ShopService {
|
||||
}
|
||||
return userList;
|
||||
}
|
||||
@Resource
|
||||
DecorationMeasureDAO decorationMeasureDAO;
|
||||
@Resource
|
||||
DecorationDesignInfoDAO decorationDesignInfoDAO;
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserDTO> getSubStageHandle(Long shopId, Integer subStage) {
|
||||
if (shopId==null||subStage==null){
|
||||
// 参数校验
|
||||
if (shopId == null || subStage == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
|
||||
// 基础数据
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
|
||||
DecorationMeasureDO measureDO = decorationMeasureDAO.getByShopId(shopId);
|
||||
DecorationDesignInfoDO decoration = decorationDesignInfoDAO.getByShopId(shopId);
|
||||
ShopStageInfoDO stage = shopStageInfoDAO.getByShopIdAndSubStage(shopId, subStage);
|
||||
ShopSubStageStatusEnum shopSubStageStatusEnum = ShopSubStageStatusEnum.getShopSubStageStatusEnum(stage.getShopSubStageStatus());
|
||||
List<UserDTO> userList = new ArrayList<>();
|
||||
switch (shopSubStageStatusEnum){
|
||||
ShopSubStageStatusEnum statusEnum = ShopSubStageStatusEnum.getShopSubStageStatusEnum(stage.getShopSubStageStatus());
|
||||
|
||||
// Handle each status case
|
||||
switch (statusEnum) {
|
||||
case SHOP_SUB_STAGE_STATUS_10:
|
||||
case SHOP_SUB_STAGE_STATUS_20:
|
||||
case SHOP_SUB_STAGE_STATUS_22:
|
||||
@@ -731,83 +736,149 @@ public class ShopServiceImpl implements ShopService {
|
||||
case SHOP_SUB_STAGE_STATUS_74:
|
||||
case SHOP_SUB_STAGE_STATUS_905:
|
||||
case SHOP_SUB_STAGE_STATUS_121:
|
||||
userList.add(new UserDTO(lineInfo.getUsername(), lineInfo.getMobile()));
|
||||
return userList;
|
||||
case SHOP_SUB_STAGE_STATUS_150:
|
||||
case SHOP_SUB_STAGE_STATUS_180:
|
||||
case SHOP_SUB_STAGE_STATUS_182:
|
||||
case SHOP_SUB_STAGE_STATUS_190:
|
||||
case SHOP_SUB_STAGE_STATUS_194:
|
||||
case SHOP_SUB_STAGE_STATUS_200:
|
||||
case SHOP_SUB_STAGE_STATUS_202:
|
||||
case SHOP_SUB_STAGE_STATUS_210:
|
||||
case SHOP_SUB_STAGE_STATUS_214:
|
||||
case SHOP_SUB_STAGE_STATUS_220:
|
||||
case SHOP_SUB_STAGE_STATUS_222:
|
||||
return Collections.singletonList(new UserDTO(lineInfo.getUsername(), lineInfo.getMobile()));
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_11:
|
||||
case SHOP_SUB_STAGE_STATUS_21:
|
||||
case SHOP_SUB_STAGE_STATUS_110:
|
||||
case SHOP_SUB_STAGE_STATUS_111:
|
||||
case SHOP_SUB_STAGE_STATUS_122:
|
||||
EnterpriseUserDO userInfo = enterpriseUserDAO.getUserInfoById(lineInfo.getInvestmentManager());
|
||||
if (Objects.nonNull(userInfo)){
|
||||
userList.add(new UserDTO(userInfo.getName(), userInfo.getMobile()));
|
||||
}
|
||||
return userList;
|
||||
case SHOP_SUB_STAGE_STATUS_140:
|
||||
case SHOP_SUB_STAGE_STATUS_141:
|
||||
case SHOP_SUB_STAGE_STATUS_142:
|
||||
return getUserFromInvestmentManager(lineInfo);
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_70:
|
||||
case SHOP_SUB_STAGE_STATUS_80:
|
||||
case SHOP_SUB_STAGE_STATUS_85:
|
||||
List<EnterpriseUserDO> userDOList1 = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Arrays.asList(REGION_OFFICE, JOIN_OFFICE), shopInfo.getRegionId());
|
||||
userDOList1.forEach(x->{
|
||||
userList.add(new UserDTO(x.getName(), x.getMobile()));
|
||||
});
|
||||
return getUsersByRolesAndRegion(Arrays.asList(REGION_OFFICE, JOIN_OFFICE), shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_72:
|
||||
case SHOP_SUB_STAGE_STATUS_83:
|
||||
List<EnterpriseUserDO> userDOList2 = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Arrays.asList(REGION_OFFICE, BRANCH_OFFICE), shopInfo.getRegionId());
|
||||
userDOList2.forEach(x->{
|
||||
userList.add(new UserDTO(x.getName(), x.getMobile()));
|
||||
});
|
||||
return getUsersByRolesAndRegion(Arrays.asList(REGION_OFFICE, BRANCH_OFFICE), shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_85_1:
|
||||
//财务
|
||||
SysRoleRequest sysRoleRequest = new SysRoleRequest();
|
||||
sysRoleRequest.setRoleName(FINANCE.getDesc());
|
||||
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest);
|
||||
userListByRole.forEach(x->{
|
||||
userList.add(new UserDTO(x.getName(), x.getMobile()));
|
||||
});
|
||||
return getUsersByRole(FINANCE);
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_861:
|
||||
//财务
|
||||
SysRoleRequest req = new SysRoleRequest();
|
||||
req.setRoleName(CONSTRUCTION_CUSTOMER.getDesc());
|
||||
List<EnterpriseUserDO> userListByRole1 = userAuthMappingService.findUserListByRole(req);
|
||||
userListByRole1.forEach(x->{
|
||||
userList.add(new UserDTO(x.getName(), x.getMobile()));
|
||||
});
|
||||
return getUsersByRole(CONSTRUCTION_CUSTOMER);
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_862:
|
||||
EnterpriseUserDO measureUser = enterpriseUserDAO.getUserInfoById(measureDO.getMeasureUserId());
|
||||
if (Objects.nonNull(measureUser)){
|
||||
userList.add(new UserDTO(measureUser.getName(), measureUser.getMobile()));
|
||||
}
|
||||
return userList;
|
||||
return getUserById(measureDO.getMeasureUserId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_90:
|
||||
EnterpriseUserDO designLeaderUser = enterpriseUserDAO.getUserInfoById(decoration.getDesignLeaderId());
|
||||
if (Objects.nonNull(designLeaderUser)){
|
||||
userList.add(new UserDTO(designLeaderUser.getName(), designLeaderUser.getMobile()));
|
||||
}
|
||||
return userList;
|
||||
return getUserById(decoration.getDesignLeaderId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_901:
|
||||
EnterpriseUserDO designUser = enterpriseUserDAO.getUserInfoById(decoration.getDesignUserId());
|
||||
if (Objects.nonNull(designUser)){
|
||||
userList.add(new UserDTO(designUser.getName(), designUser.getMobile()));
|
||||
}
|
||||
return userList;
|
||||
return getUserById(decoration.getDesignUserId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_902:
|
||||
SysRoleRequest quotationReq = new SysRoleRequest();
|
||||
quotationReq.setRoleName(QUOTATION_OFFICE.getDesc());
|
||||
List<EnterpriseUserDO> userListByRole2 = userAuthMappingService.findUserListByRole(quotationReq);
|
||||
userListByRole2.forEach(x->{
|
||||
userList.add(new UserDTO(x.getName(), x.getMobile()));
|
||||
});
|
||||
return userList;
|
||||
return getUsersByRole(QUOTATION_OFFICE);
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_903:
|
||||
EnterpriseUserDO quotationDesignUser = enterpriseUserDAO.getUserInfoById(decoration.getQuotationUserId());
|
||||
if (Objects.nonNull(quotationDesignUser)){
|
||||
userList.add(new UserDTO(quotationDesignUser.getName(), quotationDesignUser.getMobile()));
|
||||
}
|
||||
return userList;
|
||||
return getUserById(decoration.getQuotationUserId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_151:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.LOGISTICS, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_152:
|
||||
UserRoleEnum financeRole = JoinModeEnum.OWN_STORE.equals(shopInfo.getJoinMode())
|
||||
? UserRoleEnum.OWN_SHOP_OFFICE
|
||||
: UserRoleEnum.FINANCE;
|
||||
return getUsersByRole(financeRole);
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_153:
|
||||
return getUsersByRolesAndRegion(Arrays.asList(HEAD_OF_DIVISION, REGIONAL_MANAGER), shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_154:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.VICE_PRESIDENT_IN_CHARGE, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_155:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.PRESIDENT, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_160:
|
||||
case SHOP_SUB_STAGE_STATUS_170:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.HUO_MA_EMPLOYEE, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_230:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.XIN_FA_SYS_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_240:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.TENT_PASS_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_181:
|
||||
return getUsersByRoleAndRegion(DOU_YIN_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_191:
|
||||
case SHOP_SUB_STAGE_STATUS_193:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.MEI_TUAN_OPERATIONS_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_201:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.MEI_TUAN_BUY_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_211:
|
||||
case SHOP_SUB_STAGE_STATUS_213:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.E_L_ME_TUAN_OPERATIONS_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
case SHOP_SUB_STAGE_STATUS_221:
|
||||
return getUsersByRoleAndRegion(UserRoleEnum.KUAI_SHOU_CUSTOMER, shopInfo.getRegionId());
|
||||
|
||||
default:
|
||||
return userList;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取招商经理信息
|
||||
* @param lineInfo
|
||||
* @return
|
||||
*/
|
||||
private List<UserDTO> getUserFromInvestmentManager(LineInfoDO lineInfo) {
|
||||
EnterpriseUserDO userInfo = enterpriseUserDAO.getUserInfoById(lineInfo.getInvestmentManager());
|
||||
if (userInfo != null) {
|
||||
return Collections.singletonList(new UserDTO(userInfo.getName(), userInfo.getMobile()));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private List<UserDTO> getUserById(String userId) {
|
||||
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(userId);
|
||||
if (user != null) {
|
||||
return Collections.singletonList(new UserDTO(user.getName(), user.getMobile()));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private List<UserDTO> getUsersByRole(UserRoleEnum role) {
|
||||
SysRoleRequest request = new SysRoleRequest();
|
||||
request.setRoleName(role.getDesc());
|
||||
return convertToUserDTOs(userAuthMappingService.findUserListByRole(request));
|
||||
}
|
||||
|
||||
private List<UserDTO> getUsersByRoleAndRegion(UserRoleEnum role, Long regionId) {
|
||||
return convertToUserDTOs(userAuthMappingService.getAllUserByRoleEnumAndRegionId(role, regionId));
|
||||
}
|
||||
|
||||
private List<UserDTO> getUsersByRolesAndRegion(List<UserRoleEnum> roles, Long regionId) {
|
||||
return convertToUserDTOs(userAuthMappingService.getUserIdByRoleEnumAndRegionId(roles, regionId));
|
||||
}
|
||||
|
||||
private List<UserDTO> convertToUserDTOs(List<EnterpriseUserDO> users) {
|
||||
return users.stream()
|
||||
.map(user -> new UserDTO(user.getName(), user.getMobile()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user