Compare commits

..

No commits in common. "aa06fcb829486fec5cb2fc708bb429fd4912c2b5" and "e2ea71e9393773277b53828507b78308f63d3eda" have entirely different histories.

4 changed files with 9 additions and 34 deletions

View File

@ -21,7 +21,4 @@ public class TrainingApplyProcessNodeE {
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "审批时间")
private String approvalTime;
}

View File

@ -136,12 +136,12 @@ public class TrainingApplyRecordE extends BaseE {
public void addTrainingUser() {
if (this.applyUsers == null) return;
applyUsers.forEach(user -> {
if (user != null && user.getApplyStatus().equals(ApplyStatusEnum.APPROVED.getCode())) {
TrainingUserE trainingUser = new TrainingUserE();
trainingUser.setTrainingUserId(IdUtil.simpleUUID());
trainingUser.setPhone(user.getPhone());
trainingUser.setApplyStatus(user.getApplyStatus());
trainingUser.setExamineStatus(ExamineStatusEnum.PENDING.getCode());
this.trainingUsers.add(trainingUser);
}
});
}
/**

View File

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
@ -36,25 +35,8 @@ public class TrainingUserGatewayImpl implements TrainingUserGateway {
@Override
public Boolean addBatch(List<TrainingUserE> trainingUserEList) {
if (trainingUserEList == null || trainingUserEList.isEmpty()) {
return true;
}
List<String> phones = trainingUserEList.stream()
.map(TrainingUserE::getPhone)
.filter(StrUtil::isNotBlank)
.distinct()
.collect(Collectors.toList());
List<TrainingUserDO> existingUsers = trainingUserRepository.lambdaQuery()
.select(TrainingUserDO::getPhone)
.in(TrainingUserDO::getPhone, phones)
.list();
Set<String> existingPhones = existingUsers.stream()
.map(TrainingUserDO::getPhone)
.collect(Collectors.toSet());
// 使用 Stream 流进行转换
List<TrainingUserDO> doList = trainingUserEList.stream()
.filter(e -> StrUtil.isNotBlank(e.getPhone())
&& !existingPhones.contains(e.getPhone()))
.map(e -> {
TrainingUserDO d = new TrainingUserDO(Tools.get32UUID());
BeanUtils.copyProperties(e, d, "trainingUserId");
@ -62,10 +44,7 @@ public class TrainingUserGatewayImpl implements TrainingUserGateway {
})
.collect(Collectors.toList());
if (!doList.isEmpty()) {
trainingUserRepository.saveBatch(doList);
}
return true;
}

View File

@ -16,8 +16,7 @@
tar.approval_status AS approvalStatus,
u.username AS username,
tap.apply_type AS applyType,
DATE_FORMAT(tap.create_time, '%Y-%m-%d %H:%i:%s') AS time,
DATE_FORMAT(tap.update_time, '%Y-%m-%d %H:%i:%s') as approvalTime
DATE_FORMAT(tap.create_time, '%Y-%m-%d %H:%i:%s') AS time
FROM
training_apply_process tap
LEFT JOIN