Commit 71b76cf0 by 黄炜

feat: 策略中心-人员更换评估逻辑调整

1 parent f69aae72
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rop-dj-staff-miniprogram</artifactId> <artifactId>rop-dj-staff-miniprogram</artifactId>
<version>5.8.4-SNAPSHOT</version> <version>5.8.5-SNAPSHOT</version>
<name>rop-dj-staff-miniprogram</name> <name>rop-dj-staff-miniprogram</name>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<sale.api.version>5.8.4-SNAPSHOT</sale.api.version> <sale.api.version>5.8.4-SNAPSHOT</sale.api.version>
<analysis.api.version>5.8.4-SNAPSHOT</analysis.api.version> <analysis.api.version>5.8.4-SNAPSHOT</analysis.api.version>
<staff-api.version>5.8.5-SNAPSHOT</staff-api.version>
</properties> </properties>
...@@ -48,8 +49,9 @@ ...@@ -48,8 +49,9 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff-api</artifactId> <artifactId>rpc-dj-staff-api</artifactId>
<version>5.8.4-SNAPSHOT</version> <version>${staff-api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rop-common</artifactId> <artifactId>rop-common</artifactId>
......
...@@ -3,17 +3,21 @@ package cn.com.glsx.dj.staff.miniprogram.controller.recruitment; ...@@ -3,17 +3,21 @@ package cn.com.glsx.dj.staff.miniprogram.controller.recruitment;
import cn.com.glsx.dj.sale.dto.SalePotentialCustomersDTO; import cn.com.glsx.dj.sale.dto.SalePotentialCustomersDTO;
import cn.com.glsx.dj.sale.dto.SalePotentialCustomersFilterDTO; import cn.com.glsx.dj.sale.dto.SalePotentialCustomersFilterDTO;
import cn.com.glsx.dj.sale.remote.SalePotentialCustomersRemote; import cn.com.glsx.dj.sale.remote.SalePotentialCustomersRemote;
import cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO;
import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDTO; import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDTO;
import cn.com.glsx.dj.staff.miniprogram.convert.RecruitmentDemandDTOConvert; import cn.com.glsx.dj.staff.miniprogram.convert.RecruitmentDemandDTOConvert;
import cn.com.glsx.dj.staff.miniprogram.convert.RecruitmentStaffDTOConvert;
import cn.com.glsx.dj.staff.miniprogram.request.common.CommonIdRequest; import cn.com.glsx.dj.staff.miniprogram.request.common.CommonIdRequest;
import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandAddRequest; import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandAddRequest;
import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandPageRequest; import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandPageRequest;
import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandStoreListRequest; import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentDemandStoreListRequest;
import cn.com.glsx.dj.staff.miniprogram.request.recruitment.RecruitmentStaffPageRequest;
import cn.com.glsx.dj.staff.miniprogram.request.recruitment.SalePotentialCustomersPageRequest; import cn.com.glsx.dj.staff.miniprogram.request.recruitment.SalePotentialCustomersPageRequest;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandDetailResponse; import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandDetailResponse;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandPageResponse; import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandPageResponse;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandStatResponse; import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandStatResponse;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandStoreListResponse; import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentDemandStoreListResponse;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentStaffResponse;
import cn.com.glsx.dj.staff.miniprogram.service.recruitment.RecruitmentDemandService; import cn.com.glsx.dj.staff.miniprogram.service.recruitment.RecruitmentDemandService;
import cn.com.glsx.dj.staff.miniprogram.util.CommonUtil; import cn.com.glsx.dj.staff.miniprogram.util.CommonUtil;
import cn.com.glsx.dj.staff.remote.RecruitmentDemandRemote; import cn.com.glsx.dj.staff.remote.RecruitmentDemandRemote;
...@@ -55,9 +59,12 @@ public class RecruitmentDemandController { ...@@ -55,9 +59,12 @@ public class RecruitmentDemandController {
@ApiOperation("招聘需求分页查询") @ApiOperation("招聘需求分页查询")
@ServiceMethod(method = "dj.api.staff.miniprogram.recruitment.page", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.api.staff.miniprogram.recruitment.page", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.api.staff.miniprogram.recruitment.page/1.0.0")
public RopResponse<RpcPagination<RecruitmentDemandPageResponse>> pageRecruitmentDemand(RecruitmentDemandPageRequest request){ public RopResponse<RpcPagination<RecruitmentDemandPageResponse>> pageRecruitmentDemand(RecruitmentDemandPageRequest request){
RpcPagination<RecruitmentDemandDTO> pagination = CommonUtil.getRpcPagination(RecruitmentDemandDTO.class); RpcPagination<RecruitmentDemandDTO> pagination = CommonUtil.getRpcPagination(RecruitmentDemandDTO.class);
pagination.getCondition().setRegionOperationId(CommonUtil.getLoginUserInfo().getUuid()); pagination.getCondition().setRegionOperationId(CommonUtil.getLoginUserInfo().getUuid());
pagination.getCondition().setMerchantId(request.getMerchantId());
pagination.getCondition().setBusinessType(request.getBusinessType());
return CommonUtil.convertPaginationRopResponse(recruitmentDemandService.pageRecruitmentDemand(pagination), RecruitmentDemandDTOConvert.INSTANCE::toRecruitmentDemandPageResponse); return CommonUtil.convertPaginationRopResponse(recruitmentDemandService.pageRecruitmentDemand(pagination), RecruitmentDemandDTOConvert.INSTANCE::toRecruitmentDemandPageResponse);
} }
...@@ -81,10 +88,23 @@ public class RecruitmentDemandController { ...@@ -81,10 +88,23 @@ public class RecruitmentDemandController {
return recruitmentDemandService.listStore(request); return recruitmentDemandService.listStore(request);
} }
@ApiOperation("全公司在职及试岗驻店人员分页列表")
@ServiceMethod(method = "dj.api.staff.miniprogram.recruitment.staff.page", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.api.staff.miniprogram.recruitment.staff.page/1.0.0")
public RopResponse<RpcPagination<RecruitmentStaffResponse>> pageRecruitmentStaff(RecruitmentStaffPageRequest request) {
RpcPagination<StaffInfoDTO> pagination = new RpcPagination<>();
pagination.setPageNum(Math.max(request.getCurrentPage(), 1));
pagination.setPageSize(request.getPageSize() <= 0 ? 10 : Math.min(request.getPageSize(), 100));
pagination.setCondition(StaffInfoDTO.builder().staffName(request.getStaffName()).build());
return CommonUtil.convertPaginationRopResponse(
recruitmentDemandService.pageRecruitmentStaff(pagination),
RecruitmentStaffDTOConvert.INSTANCE::toRecruitmentStaffResponse);
}
@ApiOperation("添加招聘需求") @ApiOperation("添加招聘需求")
@ServiceMethod(method = "dj.api.staff.miniprogram.recruitment.demand.add", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.api.staff.miniprogram.recruitment.demand.add", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.api.staff.miniprogram.recruitment.demand.add/1.0.0") @PostMapping("/dj.api.staff.miniprogram.recruitment.demand.add/1.0.0")
public RopResponse<Boolean> add(RecruitmentDemandAddRequest request){ public RopResponse<Integer> add(RecruitmentDemandAddRequest request){
RecruitmentDemandDTO dto = CommonUtil.convertRequest(RecruitmentDemandDTO.class); RecruitmentDemandDTO dto = CommonUtil.convertRequest(RecruitmentDemandDTO.class);
return recruitmentDemandService.addRecruitmentDemand(dto); return recruitmentDemandService.addRecruitmentDemand(dto);
} }
...@@ -107,4 +127,6 @@ public class RecruitmentDemandController { ...@@ -107,4 +127,6 @@ public class RecruitmentDemandController {
} }
return CommonUtil.convertRopResponse(salePotentialCustomersRemote.getPotentialCustomerListPage(customersFilterDTO, rpcPagination)); return CommonUtil.convertRopResponse(salePotentialCustomersRemote.getPotentialCustomerListPage(customersFilterDTO, rpcPagination));
} }
} }
...@@ -19,7 +19,10 @@ import com.rop.annotation.ServiceMethod; ...@@ -19,7 +19,10 @@ import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean; import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -32,10 +35,11 @@ import javax.annotation.Resource; ...@@ -32,10 +35,11 @@ import javax.annotation.Resource;
@Slf4j @Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO) @ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("事项") @Api("事项")
@RestController
@RequiredArgsConstructor
public class TaskCenterController { public class TaskCenterController {
@Resource private final TaskInfoRemote taskInfoRemote;
private TaskInfoRemote taskInfoRemote;
/** /**
* 分页查询事项列表 * 分页查询事项列表
...@@ -43,6 +47,7 @@ public class TaskCenterController { ...@@ -43,6 +47,7 @@ public class TaskCenterController {
*/ */
@ApiOperation("分页查询事项列表") @ApiOperation("分页查询事项列表")
@ServiceMethod(method = "dj.staff.api.taskcenter.task.page", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.staff.api.taskcenter.task.page", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.staff.api.taskcenter.task.page/1.0.0")
public RopResponse<RpcPagination<TaskInfoDTO>> pageTask(TaskPageRequest request) { public RopResponse<RpcPagination<TaskInfoDTO>> pageTask(TaskPageRequest request) {
LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo(); LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo();
...@@ -60,6 +65,7 @@ public class TaskCenterController { ...@@ -60,6 +65,7 @@ public class TaskCenterController {
*/ */
@ApiOperation("统计事项任务数量(待完成/已完成/全部)") @ApiOperation("统计事项任务数量(待完成/已完成/全部)")
@ServiceMethod(method = "dj.staff.api.taskcenter.task.count.stat", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.staff.api.taskcenter.task.count.stat", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.staff.api.taskcenter.task.count.stat/1.0.0")
public RopResponse<TaskCountStatDTO> countTaskStat(TaskCountRequest request) { public RopResponse<TaskCountStatDTO> countTaskStat(TaskCountRequest request) {
LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo(); LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo();
...@@ -76,6 +82,7 @@ public class TaskCenterController { ...@@ -76,6 +82,7 @@ public class TaskCenterController {
*/ */
@ApiOperation("查询事项详情") @ApiOperation("查询事项详情")
@ServiceMethod(method = "dj.staff.api.taskcenter.task.detail", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.staff.api.taskcenter.task.detail", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.staff.api.taskcenter.task.detail/1.0.0")
public RopResponse<TaskInfoDTO> getTaskDetail(TaskDetailRequest request) { public RopResponse<TaskInfoDTO> getTaskDetail(TaskDetailRequest request) {
RpcResponse<TaskInfoDTO> response = taskInfoRemote.getTaskInfoDetail(request.getId()); RpcResponse<TaskInfoDTO> response = taskInfoRemote.getTaskInfoDetail(request.getId());
return CommonUtil.convertRopResponse(response); return CommonUtil.convertRopResponse(response);
...@@ -87,6 +94,7 @@ public class TaskCenterController { ...@@ -87,6 +94,7 @@ public class TaskCenterController {
*/ */
@ApiOperation("专项任务回复提交") @ApiOperation("专项任务回复提交")
@ServiceMethod(method = "dj.staff.api.taskcenter.task.submit", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "dj.staff.api.taskcenter.task.submit", needInSession = NeedInSessionType.YES)
@PostMapping("/dj.staff.api.taskcenter.task.submit/1.0.0")
public RopResponse<Boolean> submitTaskReply(TaskSubmitRequest request) { public RopResponse<Boolean> submitTaskReply(TaskSubmitRequest request) {
LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo(); LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo();
TaskInfoSubmitDTO dto = CommonUtil.convertRequest(TaskInfoSubmitDTO.class); TaskInfoSubmitDTO dto = CommonUtil.convertRequest(TaskInfoSubmitDTO.class);
......
package cn.com.glsx.dj.staff.miniprogram.convert;
import cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO;
import cn.com.glsx.dj.staff.miniprogram.response.recruitment.RecruitmentStaffResponse;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface RecruitmentStaffDTOConvert {
RecruitmentStaffDTOConvert INSTANCE = Mappers.getMapper(RecruitmentStaffDTOConvert.class);
RecruitmentStaffResponse toRecruitmentStaffResponse(StaffInfoDTO source);
}
...@@ -7,6 +7,12 @@ import lombok.Data; ...@@ -7,6 +7,12 @@ import lombok.Data;
@Data @Data
public class RecruitmentDemandPageRequest extends CommonPageRequest { public class RecruitmentDemandPageRequest extends CommonPageRequest {
@ApiModelProperty(notes = "归属门店id")
private String merchantId;
@ApiModelProperty(notes = "归属场景,对应招聘需求业务类型")
private String businessType;
@ApiModelProperty(notes="是否只查待处理") @ApiModelProperty(notes="是否只查待处理")
private Boolean onlyWaiting; private Boolean onlyWaiting;
} }
package cn.com.glsx.dj.staff.miniprogram.request.recruitment;
import cn.com.glsx.dj.staff.miniprogram.request.common.CommonPageRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 招聘业务驻店人员分页查询请求。
*/
@Data
public class RecruitmentStaffPageRequest extends CommonPageRequest {
@ApiModelProperty(notes = "驻店人员姓名,支持模糊搜索")
private String staffName;
}
...@@ -21,4 +21,16 @@ public class TaskSubmitRequest extends AbstractRopRequest { ...@@ -21,4 +21,16 @@ public class TaskSubmitRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "专项任务回复内容,1-800字符", required = true) @ApiModelProperty(notes = "专项任务回复内容,1-800字符", required = true)
private String replyContent; private String replyContent;
@ApiModelProperty(notes = "是否更换:0-不更换,1-更换;人员更换评估任务必填")
private Integer replaceFlag;
@ApiModelProperty(notes = "更换方式:1-发起招聘需求,2-关联已有招聘需求,3-关联另一个驻店人员完成调换")
private Integer replaceMethod;
@ApiModelProperty(notes = "招聘需求id")
private String recruitmentDemandId;
@ApiModelProperty(notes = "完成调换的驻店人员uuid")
private String replacementStaffUuid;
} }
package cn.com.glsx.dj.staff.miniprogram.response.recruitment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 招聘业务可选驻店人员。
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("招聘业务可选驻店人员")
public class RecruitmentStaffResponse implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "驻店人员UUID")
private String staffUuid;
@ApiModelProperty(notes = "驻店人员名称")
private String staffName;
}
...@@ -7,9 +7,11 @@ import cn.com.glsx.dj.carboutique.response.LoginUserInfoResponse; ...@@ -7,9 +7,11 @@ import cn.com.glsx.dj.carboutique.response.LoginUserInfoResponse;
import cn.com.glsx.dj.smartcarlife.dto.MerchantListDTO; import cn.com.glsx.dj.smartcarlife.dto.MerchantListDTO;
import cn.com.glsx.dj.smartcarlife.dto.SceneMerchantRefDTO; import cn.com.glsx.dj.smartcarlife.dto.SceneMerchantRefDTO;
import cn.com.glsx.dj.smartcarlife.dto.ShopMerchantDirectorConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.ShopMerchantDirectorConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO;
import cn.com.glsx.dj.smartcarlife.enums.DirectorTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.DirectorTypeEnum;
import cn.com.glsx.dj.smartcarlife.remote.SceneMerchantRefRemote; import cn.com.glsx.dj.smartcarlife.remote.SceneMerchantRefRemote;
import cn.com.glsx.dj.smartcarlife.remote.ShopMerchantDirectorConfigRemote; import cn.com.glsx.dj.smartcarlife.remote.ShopMerchantDirectorConfigRemote;
import cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote;
import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDTO; import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDTO;
import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDetailDTO; import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDetailDTO;
import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO; import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO;
...@@ -31,6 +33,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -31,6 +33,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse; import cn.com.glsx.framework.rop.response.RopResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -47,19 +50,37 @@ import java.util.stream.Collectors; ...@@ -47,19 +50,37 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
@RequiredArgsConstructor
public class RecruitmentDemandService { public class RecruitmentDemandService {
@Autowired
private ShopMerchantDirectorConfigRemote shopMerchantDirectorConfigRemote; private final ShopMerchantDirectorConfigRemote shopMerchantDirectorConfigRemote;
@Autowired
private SceneMerchantRefRemote sceneMerchantRefRemote; private final SceneMerchantRefRemote sceneMerchantRefRemote;
@Autowired
private RecruitmentDemandRemote recruitmentDemandRemote; private final RecruitmentDemandRemote recruitmentDemandRemote;
@Autowired
private BusinessAnalysisRemote businessAnalysisRemote; private final BusinessAnalysisRemote businessAnalysisRemote;
private final StaffInfoRemote staffInfoRemote;
private static final Integer NO_PERMISSION_MERCHANT_ID = -1; private static final Integer NO_PERMISSION_MERCHANT_ID = -1;
/** /**
* 查询全公司有效驻店人员。
* 试岗审批通过后会开通驻店账号并同步至员工信息表,因此与在职人员统一从员工信息查询。
*
* @param pagination 分页查询参数
* @return 驻店人员分页数据
*/
public RpcResponse<RpcPagination<StaffInfoDTO>> pageRecruitmentStaff(
RpcPagination<StaffInfoDTO> pagination) {
StaffInfoDTO condition = pagination.getCondition();
condition.setStaffType((byte) 0);
condition.setDeletedFlag("N");
return staffInfoRemote.listWithPage(pagination);
}
/**
* 门店列表 * 门店列表
* *
* @param request * @param request
...@@ -257,7 +278,7 @@ public class RecruitmentDemandService { ...@@ -257,7 +278,7 @@ public class RecruitmentDemandService {
* 标记招聘需求已确认 * 标记招聘需求已确认
* *
* @param request * @param request
* @return cn.com.glsx.framework.rop.response.RopResponse<java.lang.Boolean> * @return 新增成功后的招聘需求id
* @author caiym * @author caiym
* @date 2025年10月20日 15:19:47 * @date 2025年10月20日 15:19:47
*/ */
...@@ -289,7 +310,23 @@ public class RecruitmentDemandService { ...@@ -289,7 +310,23 @@ public class RecruitmentDemandService {
* @date 2025年10月22日 16:55:16 * @date 2025年10月22日 16:55:16
*/ */
public RopResponse<Boolean> addRecruitmentDemand(RecruitmentDemandDTO dto) { public RopResponse<Integer> addRecruitmentDemand(RecruitmentDemandDTO dto) {
RopErrorEnum paramError = prepareRecruitmentDemand(dto);
if (paramError != null) {
return RopResponse.error(paramError);
}
RpcResponse<RecruitmentDemandDTO> response = recruitmentDemandRemote.recruitmentDemandAdd(dto);
if (!response.isSuccess()) {
return RopResponse.error(response.getError());
}
RecruitmentDemandDTO result = response.getResult();
if (result == null || result.getId() == null) {
throw new RpcServiceException("新增招聘需求失败,未返回需求id");
}
return RopResponse.success(result.getId());
}
private RopErrorEnum prepareRecruitmentDemand(RecruitmentDemandDTO dto) {
dto.setUpdatedBy(CommonUtil.getUserName()); dto.setUpdatedBy(CommonUtil.getUserName());
LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo(); LoginUserInfoResponse loginUserInfo = CommonUtil.getLoginUserInfo();
if (!RecruitmentDemandBusinessTypeEnum.USED_CAR_INSPECTOR.getValue().equals(dto.getBusinessType())) { if (!RecruitmentDemandBusinessTypeEnum.USED_CAR_INSPECTOR.getValue().equals(dto.getBusinessType())) {
...@@ -300,14 +337,10 @@ public class RecruitmentDemandService { ...@@ -300,14 +337,10 @@ public class RecruitmentDemandService {
if (bySystemMerchant) { if (bySystemMerchant) {
// 通过系统门店创建:门店商户号必填 // 通过系统门店创建:门店商户号必填
if (org.apache.commons.lang3.StringUtils.isBlank(dto.getMerchantId())) { if (org.apache.commons.lang3.StringUtils.isBlank(dto.getMerchantId())) {
return RopResponse.error(RopErrorEnum.RECRUITMENT_DEMAND_MERCHANT_REQUIRED); return RopErrorEnum.RECRUITMENT_DEMAND_MERCHANT_REQUIRED;
}
} }
RpcResponse<RecruitmentDemandDTO> response = recruitmentDemandRemote.recruitmentDemandAdd(dto);
if (!response.isSuccess()) {
return RopResponse.error(response.getError());
} }
return RopResponse.success(response.getResult().getId() != null); return null;
} }
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(仅限 Top 3)

    1. 健壮性风险:包装类型自动拆箱可能导致 NullPointerException

    • 位置:RecruitmentDemandController.java 中的 pageRecruitmentStaff 方法。
    • 问题描述:代码中使用了 Math.max(request.getCurrentPage(), 1) 和 request.getPageSize() <= 0。如果 CommonPageRequest 中的 currentPage 和 pageSize 定义为包装类型(Integer),当前端未传递这些参数时,其值为 null。在进行数学运算或比较时触发自动拆箱,将直接抛出 NullPointerException。
    • 优化建议:在进行运算前进行空值判断,或赋予默认值。 java int currentPage = request.getCurrentPage() != null ? request.getCurrentPage() : 1; int pageSize = request.getPageSize() != null ? request.getPageSize() : 10; pagination.setPageNum(Math.max(currentPage, 1)); pagination.setPageSize(pageSize <= 0 ? 10 : Math.min(pageSize, 100));

    2. 规范与可维护性:代码中存在“魔法值”(Magic Values)

    • 位置:RecruitmentDemandService.java 中的 pageRecruitmentStaff 方法。
    • 问题描述:代码中直接硬编码了 condition.setStaffType((byte) 0); 和 condition.setDeletedFlag("N");。根据《阿里巴巴 Java 开发手册》,不允许任何魔法值(即未经预先定义的常量)直接出现在代码中,这会严重降低代码的可读性和可维护性。
    • 优化建议:将其替换为枚举或全局常量类。 java condition.setStaffType(StaffTypeEnum.STORE_STAFF.getCode()); // 假设的枚举 condition.setDeletedFlag(CommonConstants.DELETED_FLAG_NO);

    3. 性能与规范风险:事务范围内包含 RPC 远程调用

    • 位置:RecruitmentDemandService.java 类级别与 addRecruitmentDemand 方法。
    • 问题描述:该服务类在类级别标注了 @Transactional(propagation = Propagation.SUPPORTS...)。虽然是 SUPPORTS(有事务则加入,无则非事务执行),但如果上层调用方存在事务,该方法将加入事务。而在 addRecruitmentDemand 方法内部执行了 recruitmentDemandRemote.recruitmentDemandAdd(dto)(RPC 远程调用)。《阿里巴巴 Java 开发手册》明确规定:禁止在事务内进行 RPC 远程调用。RPC 的网络耗时不可控,极易导致数据库长事务,进而引发连接池耗尽、死锁等严重问题。
    • 优化建议:将涉及 RPC 调用的方法移出事务管控范围,或者在方法级别显式声明 @Transactional(propagation = Propagation.NOT_SUPPORTED) 以挂起可能存在的事务。

    二、评分明细

    • 功能实现的正确性与健壮性(32/40分):整体功能逻辑清晰,分页最大限制(Math.min(..., 100))处理得当,但 Controller 层的自动拆箱存在明显的 NPE 隐患。
    • 安全性与潜在风险(27/30分):新增的 TaskSubmitRequest 字段缺乏 JSR-303 参数校验注解(如 @NotNull、@Range 等),依赖底层逻辑防范,存在一定风险。
    • 最佳实践与可维护性(15/20分):使用了 @RequiredArgsConstructor 替代 @Autowired,符合 Spring 推荐的构造器注入最佳实践,值得表扬。但存在魔法值硬编码以及事务内包含 RPC 调用的规范性问题扣除部分分数。
    • 性能与资源利用(4/5分):未见明显的内存泄漏或低效循环,但潜在的长事务风险对资源利用有负面影响。
    • 提交信息质量(4/5分):提交信息 "feat: 策略中心-人员更换评估逻辑调整" 格式标准,但缺乏对具体技术实现变动的简要描述。

    总分:82分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!