From 27f64aecc6e6ecb89abb028ccbc928e44552b243 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Thu, 4 May 2023 10:01:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=91=98=E5=B7=A5=E5=85=A5=E8=81=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../athena/app/service/staff/StaffCreateEAIService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java index 91215a6..0d70bee 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.digiwin.app.container.exceptions.DWRuntimeException; import com.digiwin.app.service.DWEAIResult; -import com.digiwin.athena.app.infra.common.utils.BeanCopyUtil; import com.digiwin.athena.app.infra.entity.StaffEntity; import com.digiwin.athena.app.infra.repository.StaffRepository; import com.digiwin.athena.app.infra.service.StaffService; @@ -46,6 +45,9 @@ public class StaffCreateEAIService extends AbsEAIService { //反序列化字段 EAIRequest request = new EAIRequest(messageBody); List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); + if (CollectionUtils.isEmpty(staffList)){ + throw new DWRuntimeException("缺少必要参数"); + } //判断编号跟邮箱是否存在 LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); List employeeNoList = staffList.stream().map(StaffEntity::getEmployeeNo).collect(Collectors.toList()); @@ -56,9 +58,8 @@ public class StaffCreateEAIService extends AbsEAIService { if (!CollectionUtils.isEmpty(staffEntities)){ throw new DWRuntimeException("员工编号或邮箱重复"); } - List staffEntityList = BeanCopyUtil.copyList(staffList, StaffEntity.class); - staffService.saveBatch(staffEntityList); - List collect = staffEntityList.stream().map(item -> new StaffEntity(item.getId(),item.getEmployeeNo())).collect(Collectors.toList()); + staffService.saveBatch(staffList); + List collect = staffList.stream().map(item -> new StaffEntity(item.getId(),item.getEmployeeNo())).collect(Collectors.toList()); return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",collect)); } }