Commit a358eedd by 谢海旭

v5.7.0版本 飞行督导:批量变更接口、新增招聘需求接口调整

1 parent 213e5ac7
...@@ -60,4 +60,22 @@ public class RecruitmentDemandDTO extends RecruitmentDemand { ...@@ -60,4 +60,22 @@ public class RecruitmentDemandDTO extends RecruitmentDemand {
private List<RecruitmentOnboardingPlanDTO> onboardingPlans; private List<RecruitmentOnboardingPlanDTO> onboardingPlans;
private List<RecruitmentTrialOnboardingDTO> trialOnboardingPlans; private List<RecruitmentTrialOnboardingDTO> trialOnboardingPlans;
@ApiModelProperty(notes = "批量操作的招聘需求id列表")
private List<Integer> ids;
@ApiModelProperty(notes = "变更类型:1-区域运营 2-技师督导 3-招聘负责人 4-创建人")
private Integer changeType;
@ApiModelProperty(notes = "接收人姓名")
private String receiverName;
@ApiModelProperty(notes = "接收人账号(uuid)")
private String receiverUuid;
@ApiModelProperty(notes = "接收人手机号")
private String receiverPhone;
@ApiModelProperty(notes = "省份名称(未创建系统门店时,用于查询技术督导)")
private String province;
} }
...@@ -74,4 +74,9 @@ public interface RecruitmentDemandRemote { ...@@ -74,4 +74,9 @@ public interface RecruitmentDemandRemote {
@ApiParam(name = "dto", notes = "招聘需求id、系统门店名称和商户号", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "招聘需求id、系统门店名称和商户号", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("关联结果") @ApiResponse("关联结果")
RpcResponse<String> recruitmentDemandLinkMerchant(@NotNull RecruitmentDemandDTO dto); RpcResponse<String> recruitmentDemandLinkMerchant(@NotNull RecruitmentDemandDTO dto);
@ApiMethod("招聘需求批量变更")
@ApiParam(name = "dto", notes = "招聘需求id列表、变更类型、接收人信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("变更结果")
RpcResponse<String> recruitmentDemandBatchChange(@NotNull RecruitmentDemandDTO dto);
} }
...@@ -255,4 +255,18 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{ ...@@ -255,4 +255,18 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<String> recruitmentDemandBatchChange(RecruitmentDemandDTO dto) {
try {
recruitmentDemandService.recruitmentDemandBatchChange(dto);
return RpcResponse.success("success");
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
} }
...@@ -211,38 +211,50 @@ public class RecruitmentDemandService { ...@@ -211,38 +211,50 @@ public class RecruitmentDemandService {
// 查询门店省市信息 // 查询门店省市信息
String merchantId = dto.getMerchantId(); String merchantId = dto.getMerchantId();
String provinceName = null; String provinceName = null;
if (StringUtils.isNotBlank(merchantId)) { boolean bySystemMerchant = !Boolean.FALSE.equals(dto.getBySystemMerchant());
RpcPagination<ListMerchantRequest> merchantPagination = new RpcPagination<>(); if (bySystemMerchant) {
merchantPagination.setPageNum(1); // 通过系统门店创建:查询门店省市信息
merchantPagination.setPageSize(1); dto.setBySystemMerchant(true);
dto.setConnectionFlag(true);
ListMerchantRequest condition = new ListMerchantRequest(); if (StringUtils.isNotBlank(merchantId)) {
condition.setAccounttypeIdList(Arrays.asList(AccountTypeEnum.SHOP_4S.getValue(), AccountTypeEnum.YQ_SHOP.getValue(), AccountTypeEnum.VIRTUAL_YQ_SHOP.getValue())); RpcPagination<ListMerchantRequest> merchantPagination = new RpcPagination<>();
condition.setMerchantNoStrSet(merchantId); merchantPagination.setPageNum(1);
condition.setStatus(String.valueOf(MerchantAccountStatusEnum.HAVE_PUBLISH.getValue())); merchantPagination.setPageSize(1);
merchantPagination.setCondition(condition);
RpcResponse<RpcPagination<MerchantRopResponse>> merchantWithPageResp = merchantRemote.listMerchantWithPage(merchantPagination); ListMerchantRequest condition = new ListMerchantRequest();
condition.setAccounttypeIdList(Arrays.asList(AccountTypeEnum.SHOP_4S.getValue(), AccountTypeEnum.YQ_SHOP.getValue(), AccountTypeEnum.VIRTUAL_YQ_SHOP.getValue()));
if (merchantWithPageResp.hasResult()) { condition.setMerchantNoStrSet(merchantId);
RpcPagination<MerchantRopResponse> merchantWithPage = merchantWithPageResp.getResult(); condition.setStatus(String.valueOf(MerchantAccountStatusEnum.HAVE_PUBLISH.getValue()));
if (CollectionUtils.isNotEmpty(merchantWithPage.getList())) { merchantPagination.setCondition(condition);
MerchantRopResponse merchant = merchantWithPage.getList().get(0); RpcResponse<RpcPagination<MerchantRopResponse>> merchantWithPageResp = merchantRemote.listMerchantWithPage(merchantPagination);
if (Objects.nonNull(merchant)) {
// 保存省名称+市名称 if (merchantWithPageResp.hasResult()) {
String provinceCity = ""; RpcPagination<MerchantRopResponse> merchantWithPage = merchantWithPageResp.getResult();
if (StringUtils.isNotBlank(merchant.getProvinceName())) { if (CollectionUtils.isNotEmpty(merchantWithPage.getList())) {
provinceCity = merchant.getProvinceName(); MerchantRopResponse merchant = merchantWithPage.getList().get(0);
provinceName = merchant.getProvinceName(); if (Objects.nonNull(merchant)) {
} // 保存省名称+市名称
if (StringUtils.isNotBlank(merchant.getCityName())) { String provinceCity = "";
provinceCity += merchant.getCityName(); if (StringUtils.isNotBlank(merchant.getProvinceName())) {
} provinceCity = merchant.getProvinceName();
if (StringUtils.isNotBlank(provinceCity)) { provinceName = merchant.getProvinceName();
dto.setProvinceCity(provinceCity); }
if (StringUtils.isNotBlank(merchant.getCityName())) {
provinceCity += merchant.getCityName();
}
if (StringUtils.isNotBlank(provinceCity)) {
dto.setProvinceCity(provinceCity);
}
} }
} }
} }
} }
} else {
// 未创建系统门店:直接使用入参中的字段就存,不查询门店
dto.setBySystemMerchant(false);
dto.setConnectionFlag(false);
// 省份信息取入参中的 province,用于后续查询技术督导
provinceName = dto.getProvince();
} }
// 根据省份查询技术督导(仅针对特定业务类型:窗膜技师、三膜技师、车衣技师、精品技师) // 根据省份查询技术督导(仅针对特定业务类型:窗膜技师、三膜技师、车衣技师、精品技师)
...@@ -412,6 +424,75 @@ public class RecruitmentDemandService { ...@@ -412,6 +424,75 @@ public class RecruitmentDemandService {
recruitmentDemandMapper.updateByPrimaryKeySelective(update); recruitmentDemandMapper.updateByPrimaryKeySelective(update);
} }
/**
* 招聘需求批量变更
* 可变更状态:待人事确认、待督导确认、招聘中
* 变更类型:1-区域运营 2-技师督导 3-招聘负责人 4-创建人
*
* @param dto 包含 ids、changeType、receiverName、receiverUuid、receiverPhone、updatedBy
*/
@Transactional
public void recruitmentDemandBatchChange(RecruitmentDemandDTO dto) {
RpcAssert.assertNotNull(dto.getIds(), DefaultErrorEnum.DATA_NULL, "ids不能为空");
RpcAssert.assertNotEmpty(dto.getIds(), DefaultErrorEnum.DATA_NULL, "请选择招聘需求");
RpcAssert.assertNotNull(dto.getChangeType(), DefaultErrorEnum.DATA_NULL, "changeType不能为空");
RpcAssert.assertNotEmpty(dto.getReceiverName(), DefaultErrorEnum.DATA_NULL, "receiverName不能为空");
RpcAssert.assertNotEmpty(dto.getReceiverUuid(), DefaultErrorEnum.DATA_NULL, "receiverUuid不能为空");
// 校验所有招聘需求必须为待人事确认、待督导确认、招聘中状态
List<Byte> allowedStatuses = Arrays.asList(
RecruitmentDemandStatusEnum.WAIT_HUMAN_CONFIRM.getValue(),
RecruitmentDemandStatusEnum.WAIT_SUPERVISOR_CONFIRM.getValue(),
RecruitmentDemandStatusEnum.RECRUITING.getValue()
);
List<RecruitmentDemand> demands = new ArrayList<>();
for (Integer id : dto.getIds()) {
RecruitmentDemand demand = recruitmentDemandMapper.selectByPrimaryKey(id);
if (demand == null) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "招聘需求不存在,id:" + id);
}
if (!allowedStatuses.contains(demand.getStatus())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "请选择未办结的招聘需求");
}
demands.add(demand);
}
Date now = new Date();
int changeType = dto.getChangeType();
for (RecruitmentDemand demand : demands) {
RecruitmentDemand update = new RecruitmentDemand();
update.setId(demand.getId());
update.setUpdatedBy(dto.getUpdatedBy());
update.setUpdatedDate(now);
switch (changeType) {
case 1:
// 区域运营
update.setRegionOperationName(dto.getReceiverName());
update.setRegionOperationId(dto.getReceiverUuid());
break;
case 2:
// 技师督导
update.setTechnicalSupervisorName(dto.getReceiverName());
update.setTechnicalSupervisorPhone(dto.getReceiverPhone());
break;
case 3:
// 招聘负责人
update.setRecruiterName(dto.getReceiverName());
update.setRecruiterPhone(dto.getReceiverPhone());
break;
case 4:
// 创建人
update.setCreatedBy(dto.getReceiverName());
update.setCreatedPhone(dto.getReceiverPhone());
break;
default:
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "无效的变更类型");
}
recruitmentDemandMapper.updateByPrimaryKeySelective(update);
}
}
public RecruitmentDemandDetailDTO recruitmentDemandDetailWeb(Integer id) { public RecruitmentDemandDetailDTO recruitmentDemandDetailWeb(Integer id) {
RecruitmentDemand demand = recruitmentDemandMapper.selectByPrimaryKey(id); RecruitmentDemand demand = recruitmentDemandMapper.selectByPrimaryKey(id);
if (Objects.isNull(demand)) { if (Objects.isNull(demand)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!