Commit 629bdb02 by 叶立庆

Merge branch 'v5.7.4' into 'master'

上线合并

See merge request !16
2 parents fe8fb74f e3370365
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<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.7.1-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
<name>rpc-dj-staff-api</name> <name>rpc-dj-staff-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.staff.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.staff.remote</deploy.scanPackage>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<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.7.1-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -37,6 +37,9 @@ public class RecruitmentDemandDTO extends RecruitmentDemand { ...@@ -37,6 +37,9 @@ public class RecruitmentDemandDTO extends RecruitmentDemand {
@ApiModelProperty(notes = "待确认试岗计划数量") @ApiModelProperty(notes = "待确认试岗计划数量")
private Integer trialWaitConfirmCount; private Integer trialWaitConfirmCount;
@ApiModelProperty(notes = "待处理试岗记录数(process_result IS NULL)")
private Integer waitProcessTrialCount;
@ApiModelProperty(notes = "是否只查待处理") @ApiModelProperty(notes = "是否只查待处理")
private Boolean onlyWaiting; private Boolean onlyWaiting;
......
...@@ -67,6 +67,11 @@ public class RecruitmentDemandExportDTO implements Serializable { ...@@ -67,6 +67,11 @@ public class RecruitmentDemandExportDTO implements Serializable {
private String recruitmentStatus; private String recruitmentStatus;
/** /**
* 试岗状态,1-试岗中 2-无试岗
*/
private String trialStatusName;
/**
* 关联状态,1-已关联 0-未关联 * 关联状态,1-已关联 0-未关联
*/ */
private String connectionFlag; private String connectionFlag;
...@@ -89,6 +94,11 @@ public class RecruitmentDemandExportDTO implements Serializable { ...@@ -89,6 +94,11 @@ public class RecruitmentDemandExportDTO implements Serializable {
* 试岗人数 * 试岗人数
*/ */
private Integer allOfTrialOnboarding; private Integer allOfTrialOnboarding;
/**
* 待招人员 = 招聘数量 - 入职人数,负数取0
*/
private Integer pendingCount;
/** /**
* 需求描述 * 需求描述
*/ */
......
...@@ -47,4 +47,10 @@ public class RecruitmentDemandPageRecordDTO extends RecruitmentDemand { ...@@ -47,4 +47,10 @@ public class RecruitmentDemandPageRecordDTO extends RecruitmentDemand {
@ApiModelProperty(notes = "试岗人数") @ApiModelProperty(notes = "试岗人数")
private Integer allOfTrialOnboarding = 0; private Integer allOfTrialOnboarding = 0;
@ApiModelProperty(notes = "待招人数,=招聘数量-入职人数,负数时取0")
private Integer pendingCount = 0;
@ApiModelProperty(notes = "试岗状态,1-试岗中 2-无试岗")
private Integer trialStatus;
} }
...@@ -105,6 +105,7 @@ public class RecruitmentTrialOnboarding implements Serializable { ...@@ -105,6 +105,7 @@ public class RecruitmentTrialOnboarding implements Serializable {
/** /**
* 修改时间 * 修改时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Column(name = "updated_date") @Column(name = "updated_date")
private Date updatedDate; private Date updatedDate;
...@@ -118,4 +119,34 @@ public class RecruitmentTrialOnboarding implements Serializable { ...@@ -118,4 +119,34 @@ public class RecruitmentTrialOnboarding implements Serializable {
@ApiModelProperty(notes = "创建者手机号") @ApiModelProperty(notes = "创建者手机号")
@Column(name = "created_phone") @Column(name = "created_phone")
private String createdPhone; private String createdPhone;
/**
* 处理结果,null待处理 0不通过 1通过
*/
@ApiModelProperty(notes = "处理结果,null待处理 0不通过 1通过")
@Column(name = "process_result")
private Integer processResult;
/**
* 处理说明
*/
@ApiModelProperty(notes = "处理说明")
@Column(name = "process_remark")
private String processRemark;
/**
* 处理人名称
*/
@ApiModelProperty(notes = "处理人名称")
@Column(name = "processor_name")
private String processorName;
/**
* 处理时间
*/
@ApiModelProperty(notes = "处理时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@Column(name = "process_time")
private Date processTime;
} }
...@@ -99,4 +99,9 @@ public interface RecruitmentDemandRemote { ...@@ -99,4 +99,9 @@ public interface RecruitmentDemandRemote {
@ApiParam(name = "dto", notes = "试岗人员信息,id/demandId/updatedBy必填", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "dto", notes = "试岗人员信息,id/demandId/updatedBy必填", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("删除结果") @ApiResponse("删除结果")
RpcResponse<String> trialOnboardingDelete(@NotNull RecruitmentTrialOnboardingDTO dto); RpcResponse<String> trialOnboardingDelete(@NotNull RecruitmentTrialOnboardingDTO dto);
@ApiMethod("移动端-处理试岗人员")
@ApiParam(name = "dto", notes = "试岗人员信息,id/demandId/processResult/updatedBy必填", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("处理结果")
RpcResponse<String> trialOnboardingProcess(@NotNull RecruitmentTrialOnboardingDTO dto);
} }
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
</parent> </parent>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-staff</artifactId> <artifactId>rpc-dj-staff</artifactId>
<version>5.7.0-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
<name>rpc-dj-staff</name> <name>rpc-dj-staff</name>
<packaging>war</packaging> <packaging>war</packaging>
<dependencies> <dependencies>
<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.7.1-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.oreframework.boot</groupId> <groupId>org.oreframework.boot</groupId>
......
...@@ -18,6 +18,13 @@ public interface RecruitmentTrialOnboardingMapper extends OreMapper<RecruitmentT ...@@ -18,6 +18,13 @@ public interface RecruitmentTrialOnboardingMapper extends OreMapper<RecruitmentT
*/ */
List<RecruitmentDemandPageRecordDTO> countTotalGroupByDemandId(@Param("demandIdList") List<Integer> demandIdList); List<RecruitmentDemandPageRecordDTO> countTotalGroupByDemandId(@Param("demandIdList") List<Integer> demandIdList);
/**
* 批量统计各需求待处理试岗数(process_result is null)
* @param demandIdList
* @return
*/
List<RecruitmentDemandPageRecordDTO> countPendingProcessGroupByDemandId(@Param("demandIdList") List<Integer> demandIdList);
RecruitmentTrialOnboardingDTO statRecruitmentTrialOnboarding(RecruitmentTrialOnboardingDTO dto); RecruitmentTrialOnboardingDTO statRecruitmentTrialOnboarding(RecruitmentTrialOnboardingDTO dto);
List<RecruitmentTrialOnboardingDTO> listRecruitmentTrialOnboarding(RecruitmentTrialOnboardingDTO dto); List<RecruitmentTrialOnboardingDTO> listRecruitmentTrialOnboarding(RecruitmentTrialOnboardingDTO dto);
......
...@@ -126,7 +126,7 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{ ...@@ -126,7 +126,7 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{
Integer id = dto.getId(); Integer id = dto.getId();
RecruitmentDemand currentDemand = recruitmentDemandService.getRecruitmentDemand(id); RecruitmentDemand currentDemand = recruitmentDemandService.getRecruitmentDemand(id);
if (RecruitmentDemandBusinessTypeEnum.needsRegionOperationMessage(currentDemand.getBusinessType())) { if (RecruitmentDemandBusinessTypeEnum.needsRegionOperationMessage(currentDemand.getBusinessType())) {
// 推送区域运营(延保、权益、轻改、权益+延保) // 推送区域运营(延保、权益、轻改、权益+延保、洗车工)
recruitmentDemandService.sendRegionOperationQWMessage( recruitmentDemandService.sendRegionOperationQWMessage(
dto.getId(), dto.getId(),
"招聘进度提醒", "招聘进度提醒",
...@@ -322,4 +322,18 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{ ...@@ -322,4 +322,18 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<String> trialOnboardingProcess(RecruitmentTrialOnboardingDTO dto) {
try {
recruitmentDemandService.trialOnboardingProcess(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);
}
}
} }
...@@ -325,6 +325,12 @@ public class RecruitmentDemandService { ...@@ -325,6 +325,12 @@ public class RecruitmentDemandService {
if (!CollectionUtils.isEmpty(countList)) { if (!CollectionUtils.isEmpty(countList)) {
countMap = countList.stream().collect(Collectors.toMap(RecruitmentDemandPageRecordDTO::getId, RecruitmentDemandPageRecordDTO::getAllOfTrialOnboarding)); countMap = countList.stream().collect(Collectors.toMap(RecruitmentDemandPageRecordDTO::getId, RecruitmentDemandPageRecordDTO::getAllOfTrialOnboarding));
} }
// 批量查询待处理试岗数
Map<Integer, Integer> pendingTrialMap = new HashMap<>();
List<RecruitmentDemandPageRecordDTO> pendingTrialList = recruitmentTrialOnboardingMapper.countPendingProcessGroupByDemandId(idList);
if (!CollectionUtils.isEmpty(pendingTrialList)) {
pendingTrialMap = pendingTrialList.stream().collect(Collectors.toMap(RecruitmentDemandPageRecordDTO::getId, RecruitmentDemandPageRecordDTO::getAllOfTrialOnboarding));
}
for (RecruitmentDemandPageRecordDTO dto : result) { for (RecruitmentDemandPageRecordDTO dto : result) {
Integer demandId = dto.getId(); Integer demandId = dto.getId();
...@@ -347,6 +353,13 @@ public class RecruitmentDemandService { ...@@ -347,6 +353,13 @@ public class RecruitmentDemandService {
if (countMap.containsKey(demandId)) { if (countMap.containsKey(demandId)) {
dto.setAllOfTrialOnboarding(countMap.get(demandId)); dto.setAllOfTrialOnboarding(countMap.get(demandId));
} }
// 设置待招人数 = 招聘数量 - 入职人数,负数取0
Integer recruitmentQuantity = dto.getRecruitmentQuantity();
int pending = (recruitmentQuantity != null ? recruitmentQuantity : 0) - onboardingPlanCount;
dto.setPendingCount(Math.max(pending, 0));
// 设置试岗状态:1-试岗中 2-无试岗
int pendingTrialCount = pendingTrialMap.getOrDefault(demandId, 0);
dto.setTrialStatus(pendingTrialCount > 0 ? 1 : 2);
} }
...@@ -1439,6 +1452,15 @@ public class RecruitmentDemandService { ...@@ -1439,6 +1452,15 @@ public class RecruitmentDemandService {
exportDTO.setDemandApplyTime(DateUtil.format(demand.getCreatedDate(), "yyyy/MM/dd")); exportDTO.setDemandApplyTime(DateUtil.format(demand.getCreatedDate(), "yyyy/MM/dd"));
exportDTO.setRecruitmentStatus(RecruitmentDemandStatusEnum.getDisplayNameByValue(demand.getStatus())); exportDTO.setRecruitmentStatus(RecruitmentDemandStatusEnum.getDisplayNameByValue(demand.getStatus()));
// 试岗状态文字
Integer trialStatus = demand.getTrialStatus();
if (Objects.equals(trialStatus, 1)) {
exportDTO.setTrialStatusName("试岗中");
} else {
exportDTO.setTrialStatusName("无试岗");
}
// 待招人员
exportDTO.setPendingCount(demand.getPendingCount() != null ? demand.getPendingCount() : 0);
List<RecruitmentDemandExportDTO.BaseInfo> baseInfos = new ArrayList<>(); List<RecruitmentDemandExportDTO.BaseInfo> baseInfos = new ArrayList<>();
List<RecruitmentOnboardingPlan> demandPlans = demandPlansMap.get(demand.getId()); List<RecruitmentOnboardingPlan> demandPlans = demandPlansMap.get(demand.getId());
...@@ -1859,6 +1881,11 @@ public class RecruitmentDemandService { ...@@ -1859,6 +1881,11 @@ public class RecruitmentDemandService {
if (!dto.getCreatedPhone().equals(existing.getCreatedPhone())) { if (!dto.getCreatedPhone().equals(existing.getCreatedPhone())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对个人新增的试岗人员进行编辑"); throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对个人新增的试岗人员进行编辑");
} }
if (Objects.nonNull(existing.getProcessResult())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对待处理的试岗人员进行编辑");
}
RecruitmentTrialOnboarding update = new RecruitmentTrialOnboarding(); RecruitmentTrialOnboarding update = new RecruitmentTrialOnboarding();
update.setId(dto.getId()); update.setId(dto.getId());
update.setPersonName(dto.getPersonName()); update.setPersonName(dto.getPersonName());
...@@ -1908,6 +1935,10 @@ public class RecruitmentDemandService { ...@@ -1908,6 +1935,10 @@ public class RecruitmentDemandService {
if (!dto.getCreatedPhone().equals(existing.getCreatedPhone())) { if (!dto.getCreatedPhone().equals(existing.getCreatedPhone())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对个人新增的试岗人员进行删除"); throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对个人新增的试岗人员进行删除");
} }
if (Objects.nonNull(existing.getProcessResult())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "仅支持对待处理的试岗人员进行删除");
}
RecruitmentTrialOnboarding update = new RecruitmentTrialOnboarding(); RecruitmentTrialOnboarding update = new RecruitmentTrialOnboarding();
update.setId(dto.getId()); update.setId(dto.getId());
update.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name()); update.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name());
...@@ -1930,4 +1961,54 @@ public class RecruitmentDemandService { ...@@ -1930,4 +1961,54 @@ public class RecruitmentDemandService {
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR); throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
} }
} }
/**
* 移动端-处理试岗人员(单条)
* 与 dj.staff.api.recruitment.demand.process 使用同一把分布式锁(以 demandId 为 key)
* 仅允许对待处理(process_result IS NULL)的试岗记录执行处理
*
* @param dto 试岗记录信息,id / demandId / processResult / processorName / processTime / updatedBy 必填
*/
@GlsxDistributeLockable(name = "'RecruitmentDemandService_recruitmentDemandProcess_' + #dto.demandId", timeoutException = RpcServiceException.class)
@Transactional
public void trialOnboardingProcess(RecruitmentTrialOnboardingDTO dto) {
RpcAssert.assertNotNull(dto, DefaultErrorEnum.DATA_NULL, "dto not be null");
RpcAssert.assertNotNull(dto.getId(), DefaultErrorEnum.DATA_NULL, "id not be null");
RpcAssert.assertNotNull(dto.getDemandId(), DefaultErrorEnum.DATA_NULL, "demandId not be null");
RpcAssert.assertNotNull(dto.getProcessResult(), DefaultErrorEnum.DATA_NULL, "processResult not be null");
RpcAssert.assertNotEmpty(dto.getUpdatedBy(), DefaultErrorEnum.DATA_NULL, "updatedBy not be empty");
try {
RecruitmentTrialOnboarding existing = recruitmentTrialOnboardingMapper.selectByPrimaryKey(dto.getId());
if (existing == null || BaseModel.DeletedFlagEnum.D.name().equals(existing.getDeletedFlag())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "试岗记录不存在");
}
if (Objects.nonNull(existing.getProcessResult())) {
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "试岗记录已处理,不可重复处理");
}
RecruitmentTrialOnboarding update = new RecruitmentTrialOnboarding();
update.setId(dto.getId());
update.setProcessResult(dto.getProcessResult());
update.setProcessRemark(dto.getProcessRemark());
update.setProcessorName(dto.getProcessorName());
update.setProcessTime(dto.getProcessTime());
update.setUpdatedBy(dto.getUpdatedBy());
update.setUpdatedDate(new Date());
recruitmentTrialOnboardingMapper.updateByPrimaryKeySelective(update);
// 添加招聘需求操作记录(处理类型)
RecruitmentDemandOperationLog operationLog = new RecruitmentDemandOperationLog();
operationLog.setDemandId(dto.getDemandId());
operationLog.setOperationType(RecruitmentDemandLogOperationTypeEnum.PROCESS.getValue());
operationLog.setCreatedBy(dto.getUpdatedBy());
operationLog.setCreatedDate(new Date());
operationLog.setUpdatedBy(dto.getUpdatedBy());
operationLog.setUpdatedDate(new Date());
logMapper.insertSelective(operationLog);
} catch (RpcServiceException e) {
throw e;
} catch (Exception e) {
log.error("处理试岗人员异常,id:{}", dto.getId(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
} }
...@@ -17,9 +17,7 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -17,9 +17,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -53,6 +51,23 @@ public class RecruitmentTrialOnboardingService { ...@@ -53,6 +51,23 @@ public class RecruitmentTrialOnboardingService {
} }
} }
// 检查被删除的记录是否有已被处理的正常记录
List<Integer> editIdList = trialsEdit.stream().map(RecruitmentTrialOnboarding::getId).collect(Collectors.toList());
Example checkProcessBeforeDel = new Example(RecruitmentTrialOnboarding.class);
Example.Criteria criteriaCheckProcessBeforeDel = checkProcessBeforeDel.createCriteria();
criteriaCheckProcessBeforeDel.andEqualTo("demandId", demandId)
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name())
.andIsNotNull("processResult");
if (CollectionUtils.isNotEmpty(editIdList)) {
criteriaCheckProcessBeforeDel.andNotIn("id", editIdList);
}
List<RecruitmentTrialOnboarding> undeletableList = recruitmentTrialOnboardingMapper.selectByExample(checkProcessBeforeDel);
if (CollectionUtils.isNotEmpty(undeletableList)) {
log.info("存在已处理记录被删除,请刷新后重新操作");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "存在已处理记录被删除,请刷新后重新操作");
}
// 删除已有的试岗人员(部分删除或全部删除) // 删除已有的试岗人员(部分删除或全部删除)
RecruitmentTrialOnboarding trialToDelete = new RecruitmentTrialOnboarding(); RecruitmentTrialOnboarding trialToDelete = new RecruitmentTrialOnboarding();
trialToDelete.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name()); trialToDelete.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name());
...@@ -63,7 +78,7 @@ public class RecruitmentTrialOnboardingService { ...@@ -63,7 +78,7 @@ public class RecruitmentTrialOnboardingService {
Example.Criteria trialCriteriaToDel = trialExampleToDel.createCriteria(); Example.Criteria trialCriteriaToDel = trialExampleToDel.createCriteria();
trialCriteriaToDel.andEqualTo("demandId", demandId).andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name()); trialCriteriaToDel.andEqualTo("demandId", demandId).andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
if (CollectionUtils.isNotEmpty(trialsEdit)) { if (CollectionUtils.isNotEmpty(trialsEdit)) {
trialCriteriaToDel.andNotIn("id", trialsEdit.stream().map(RecruitmentTrialOnboarding::getId).collect(Collectors.toList())); trialCriteriaToDel.andNotIn("id", editIdList);
} }
recruitmentTrialOnboardingMapper.updateByExampleSelective(trialToDelete, trialExampleToDel); recruitmentTrialOnboardingMapper.updateByExampleSelective(trialToDelete, trialExampleToDel);
...@@ -74,29 +89,63 @@ public class RecruitmentTrialOnboardingService { ...@@ -74,29 +89,63 @@ public class RecruitmentTrialOnboardingService {
trial.setCreatedDate(new Date()); trial.setCreatedDate(new Date());
trial.setUpdatedBy(dto.getUpdatedBy()); trial.setUpdatedBy(dto.getUpdatedBy());
trial.setUpdatedDate(new Date()); trial.setUpdatedDate(new Date());
if (Objects.nonNull(trial.getProcessResult())) {
trial.setProcessTime(new Date());
trial.setProcessorName(dto.getUpdatedBy());
} else {
trial.setProcessTime(null);
trial.setProcessorName(null);
trial.setProcessRemark(null);
trial.setProcessResult(null);
}
recruitmentTrialOnboardingMapper.insertSelective(trial); recruitmentTrialOnboardingMapper.insertSelective(trial);
} }
} }
if (CollectionUtils.isNotEmpty(trialsEdit)) { if (CollectionUtils.isNotEmpty(trialsEdit)) {
Example editCheckStatus = new Example(RecruitmentTrialOnboarding.class); Example editOldListExample = new Example(RecruitmentTrialOnboarding.class);
Example.Criteria criteriaEditCheckStatus = editCheckStatus.createCriteria(); Example.Criteria criteriaEditOldList = editOldListExample.createCriteria();
criteriaEditCheckStatus.andEqualTo("demandId", demandId) criteriaEditOldList.andEqualTo("demandId", demandId).andIn("id", editIdList);
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.D.name())
.andIn("id", trialsEdit.stream().map(RecruitmentTrialOnboarding::getId).collect(Collectors.toList())); List<RecruitmentTrialOnboarding> editOldList = recruitmentTrialOnboardingMapper.selectByExample(editOldListExample);
List<RecruitmentTrialOnboarding> delStatusCheck = editOldList.stream().filter(trial -> Objects.equals(trial.getDeletedFlag(), BaseModel.DeletedFlagEnum.D.name())).collect(Collectors.toList());
List<RecruitmentTrialOnboarding> statusErrList = recruitmentTrialOnboardingMapper.selectByExample(editCheckStatus); if (CollectionUtils.isNotEmpty(delStatusCheck)) {
if (CollectionUtils.isNotEmpty(statusErrList)) {
log.info("数据异常,请刷新后重新操作"); log.info("数据异常,请刷新后重新操作");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "数据异常,请刷新后重新操作"); throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "数据异常,请刷新后重新操作");
} }
Map<Integer, RecruitmentTrialOnboarding> editOldListMap = editOldList.stream().collect(Collectors.toMap(RecruitmentTrialOnboarding::getId, trial -> trial));
for (RecruitmentTrialOnboarding trial : trialsEdit) { for (RecruitmentTrialOnboarding trial : trialsEdit) {
RecruitmentTrialOnboarding oldTrial = editOldListMap.get(trial.getId());
if (Objects.isNull(oldTrial)) {
log.info("修改的记录不存在,请刷新后重新操作");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "修改的记录不存在,请刷新后重新操作");
}
if (!Objects.equals(oldTrial.getUpdatedDate(), trial.getUpdatedDate())) {
log.info("数据已被修改,请刷新后重新操作");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "数据已被修改,请刷新后重新操作");
}
if (oldTrial.getProcessResult() != null) {
continue;
}
trial.setDemandId(null); trial.setDemandId(null);
trial.setCreatedBy(null); trial.setCreatedBy(null);
trial.setCreatedDate(null); trial.setCreatedDate(null);
trial.setDeletedFlag(null); trial.setDeletedFlag(null);
trial.setUpdatedBy(dto.getUpdatedBy()); trial.setUpdatedBy(dto.getUpdatedBy());
trial.setUpdatedDate(new Date()); trial.setUpdatedDate(new Date());
if (Objects.nonNull(trial.getProcessResult())) {
trial.setProcessTime(new Date());
trial.setProcessorName(dto.getUpdatedBy());
} else {
trial.setProcessTime(null);
trial.setProcessorName(null);
trial.setProcessRemark(null);
trial.setProcessResult(null);
}
recruitmentTrialOnboardingMapper.updateByPrimaryKeySelective(trial); recruitmentTrialOnboardingMapper.updateByPrimaryKeySelective(trial);
} }
} }
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<result column="wait_process_resume_count" property="waitProcessResumeCount" jdbcType="INTEGER" /> <result column="wait_process_resume_count" property="waitProcessResumeCount" jdbcType="INTEGER" />
<result column="trial_wait_confirm_count" property="trialWaitConfirmCount" jdbcType="INTEGER" /> <result column="trial_wait_confirm_count" property="trialWaitConfirmCount" jdbcType="INTEGER" />
<result column="onboarding_wait_confirm_count" property="onboardingWaitConfirmCount" jdbcType="INTEGER" /> <result column="onboarding_wait_confirm_count" property="onboardingWaitConfirmCount" jdbcType="INTEGER" />
<result column="wait_process_trial_count" property="waitProcessTrialCount" jdbcType="INTEGER" />
</resultMap> </resultMap>
<resultMap id="webPageRecordDTOMap" type="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandPageRecordDTO" extends="BaseResultMap"> <resultMap id="webPageRecordDTOMap" type="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandPageRecordDTO" extends="BaseResultMap">
</resultMap> </resultMap>
...@@ -62,11 +63,11 @@ ...@@ -62,11 +63,11 @@
select select
count(if((a.status in (2, 3) and a.confirm_flag = 'N') count(if((a.status in (2, 3) and a.confirm_flag = 'N')
or (a.status = 1 and or (a.status = 1 and
(a.resume_wait_confirm_count > 0 or trial_wait_confirm_count > 0 or (a.resume_wait_confirm_count > 0 or wait_process_trial_count > 0 or
onboarding_wait_confirm_count > 0)), onboarding_wait_confirm_count > 0)),
a.id, a.id,
null)) as waitProcessCount, null)) as waitProcessCount,
count(if(a.status = 1 and a.resume_wait_confirm_count > 0, a.id, null)) as waitTSProcessCount, count(if(a.status = 1 and (a.resume_wait_confirm_count > 0 or a.wait_process_trial_count > 0), a.id, null)) as waitTSProcessCount,
count(if(a.status = 4, a.id, null)) as waitTSCheckCount, count(if(a.status = 4, a.id, null)) as waitTSCheckCount,
count(*) as totalCount count(*) as totalCount
from ( from (
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
from dj_car_life_recruitment_trial_onboarding dclrt from dj_car_life_recruitment_trial_onboarding dclrt
where dclrt.demand_id = dclrd.id where dclrt.demand_id = dclrd.id
and dclrt.deleted_flag = 'N' and dclrt.deleted_flag = 'N'
and dclrt.confirm_flag = 'N') as trial_wait_confirm_count, and dclrt.process_result is null) as wait_process_trial_count,
(select count(*) (select count(*)
from dj_car_life_recruitment_onboarding_plan dclrop from dj_car_life_recruitment_onboarding_plan dclrop
where dclrop.demand_id = dclrd.id where dclrop.demand_id = dclrd.id
...@@ -115,10 +116,10 @@ ...@@ -115,10 +116,10 @@
and dclrr2.deleted_flag = 'N' and dclrr2.deleted_flag = 'N'
and (dclrr2.process_result is null or (dclrr2.process_result = 2 and dclrr2.interview_result is null))), 0) as wait_process_resume_count, and (dclrr2.process_result is null or (dclrr2.process_result = 2 and dclrr2.interview_result is null))), 0) as wait_process_resume_count,
if(dclrd.status = 1, (select count(*) if(dclrd.status = 1, (select count(*)
from dj_car_life_recruitment_trial_onboarding dclrt from dj_car_life_recruitment_trial_onboarding dclrt2
where dclrt.demand_id = dclrd.id and dclrt.deleted_flag = 'N' where dclrt2.demand_id = dclrd.id and dclrt2.deleted_flag = 'N'
and dclrt.confirm_flag = 'N' and dclrt2.process_result is null
), 0) as trial_wait_confirm_count, ), 0) as wait_process_trial_count,
if(dclrd.status = 1, (select count(*) if(dclrd.status = 1, (select count(*)
from dj_car_life_recruitment_onboarding_plan dclrop from dj_car_life_recruitment_onboarding_plan dclrop
where dclrop.demand_id = dclrd.id where dclrop.demand_id = dclrd.id
...@@ -151,32 +152,38 @@ ...@@ -151,32 +152,38 @@
and (dclrr.process_result is null or (dclrr.process_result = 2 and dclrr.interview_result is null))) and (dclrr.process_result is null or (dclrr.process_result = 2 and dclrr.interview_result is null)))
or exists( or exists(
select 1 select 1
from dj_car_life_recruitment_trial_onboarding t_pending
where t_pending.demand_id = dclrd.id
and t_pending.deleted_flag = 'N'
and t_pending.process_result is null)
or exists(
select 1
from dj_car_life_recruitment_onboarding_plan t1 from dj_car_life_recruitment_onboarding_plan t1
where t1.demand_id = dclrd.id where t1.demand_id = dclrd.id
and t1.deleted_flag = 'N' and t1.deleted_flag = 'N'
and t1.confirm_flag = 'N') and t1.confirm_flag = 'N')
or exists(
select 1
from dj_car_life_recruitment_trial_onboarding t2
where t2.demand_id = dclrd.id
and t2.deleted_flag = 'N'
and t2.confirm_flag = 'N')
))) )))
</if> </if>
<if test="onlyTSWaiting != null and onlyTSWaiting"> <if test="onlyTSWaiting != null and onlyTSWaiting">
and dclrd.status = 1 and dclrd.status = 1
and exists( and (exists(
select 1 select 1
from dj_car_life_recruitment_resume dclrr from dj_car_life_recruitment_resume dclrr
where dclrr.demand_id = dclrd.id where dclrr.demand_id = dclrd.id
and dclrr.deleted_flag = 'N' and dclrr.deleted_flag = 'N'
and (dclrr.process_result is null or (dclrr.process_result = 2 and dclrr.interview_result is null))) and (dclrr.process_result is null or (dclrr.process_result = 2 and dclrr.interview_result is null)))
or exists(
select 1
from dj_car_life_recruitment_trial_onboarding dclrto
where dclrto.demand_id = dclrd.id
and dclrto.deleted_flag = 'N'
and dclrto.process_result is null))
</if> </if>
</where> </where>
<if test="onlyWaiting != null and onlyWaiting"> <if test="onlyWaiting != null and onlyWaiting">
order by order by
case when dclrd.status = 1 and wait_process_resume_count > 0 then 5 case when dclrd.status = 1 and wait_process_resume_count > 0 then 5
when dclrd.status = 1 and trial_wait_confirm_count > 0 then 4 when dclrd.status = 1 and wait_process_trial_count > 0 then 4
when dclrd.status = 1 and onboarding_wait_confirm_count > 0 then 3 when dclrd.status = 1 and onboarding_wait_confirm_count > 0 then 3
when dclrd.status = 2 then 2 when dclrd.status = 2 then 2
when dclrd.status = 3 then 1 end desc, when dclrd.status = 3 then 1 end desc,
...@@ -234,6 +241,22 @@ ...@@ -234,6 +241,22 @@
<if test="connectionFlag != null"> <if test="connectionFlag != null">
and connection_flag = #{connectionFlag} and connection_flag = #{connectionFlag}
</if> </if>
<if test="trialStatus != null and trialStatus == 1">
and exists (
select 1 from dj_car_life_recruitment_trial_onboarding t
where t.demand_id = dj_car_life_recruitment_demand.id
and t.deleted_flag = 'N'
and t.process_result is null
)
</if>
<if test="trialStatus != null and trialStatus == 2">
and not exists (
select 1 from dj_car_life_recruitment_trial_onboarding t
where t.demand_id = dj_car_life_recruitment_demand.id
and t.deleted_flag = 'N'
and t.process_result is null
)
</if>
order by FIELD(status, 0,4,1,2,3) asc, created_date desc order by FIELD(status, 0,4,1,2,3) asc, created_date desc
</select> </select>
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="created_phone" property="createdPhone" jdbcType="VARCHAR" /> <result column="created_phone" property="createdPhone" jdbcType="VARCHAR" />
<result column="process_result" property="processResult" jdbcType="TINYINT" />
<result column="process_remark" property="processRemark" jdbcType="VARCHAR" />
<result column="processor_name" property="processorName" jdbcType="VARCHAR" />
<result column="process_time" property="processTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO" extends="BaseResultMap">
...@@ -28,7 +32,8 @@ ...@@ -28,7 +32,8 @@
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, demand_id, person_name, phone_number, trial_time, channel_type, channel_name, id, demand_id, person_name, phone_number, trial_time, channel_type, channel_name,
confirm_flag, created_by, created_date, updated_by, updated_date, deleted_flag, created_phone confirm_flag, created_by, created_date, updated_by, updated_date, deleted_flag, created_phone,
process_result, process_remark, processor_name, process_time
</sql> </sql>
<sql id="listCondition"> <sql id="listCondition">
where dclrto.deleted_flag = 'N' where dclrto.deleted_flag = 'N'
...@@ -57,6 +62,17 @@ ...@@ -57,6 +62,17 @@
group by demand_id group by demand_id
</select> </select>
<select id="countPendingProcessGroupByDemandId" resultMap="CountTotalResultMap">
select demand_id, count(1) as total from dj_car_life_recruitment_trial_onboarding
where demand_id in
<foreach collection="demandIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and deleted_flag = 'N'
and process_result is null
group by demand_id
</select>
<select id="statRecruitmentTrialOnboarding" <select id="statRecruitmentTrialOnboarding"
resultType="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO"> resultType="cn.com.glsx.dj.staff.dto.recruitment.RecruitmentTrialOnboardingDTO">
select select
...@@ -70,7 +86,7 @@ ...@@ -70,7 +86,7 @@
select <include refid="Base_Column_List"></include> select <include refid="Base_Column_List"></include>
from dj_car_life_recruitment_trial_onboarding dclrto from dj_car_life_recruitment_trial_onboarding dclrto
<include refid="listCondition"></include> <include refid="listCondition"></include>
order by dclrto.trial_time, dclrto.id order by (dclrto.process_result is null) desc, dclrto.trial_time asc
</select> </select>
<update id="updateConfirmFlagToConfirmed"> <update id="updateConfirmFlagToConfirmed">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!