|
|
@ -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<StaffEntity> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); |
|
|
|
if (CollectionUtils.isEmpty(staffList)){ |
|
|
|
throw new DWRuntimeException("缺少必要参数"); |
|
|
|
} |
|
|
|
//判断编号跟邮箱是否存在 |
|
|
|
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>(); |
|
|
|
List<String> 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<StaffEntity> staffEntityList = BeanCopyUtil.copyList(staffList, StaffEntity.class); |
|
|
|
staffService.saveBatch(staffEntityList); |
|
|
|
List<StaffEntity> collect = staffEntityList.stream().map(item -> new StaffEntity(item.getId(),item.getEmployeeNo())).collect(Collectors.toList()); |
|
|
|
staffService.saveBatch(staffList); |
|
|
|
List<StaffEntity> collect = staffList.stream().map(item -> new StaffEntity(item.getId(),item.getEmployeeNo())).collect(Collectors.toList()); |
|
|
|
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",collect)); |
|
|
|
} |
|
|
|
} |