Browse Source

Merge branch 'sprint/S1' into develop

master
郑贵龙 1 year ago
parent
commit
69d9ab7682
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java

+ 5
- 4
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java View File

@ -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));
}
}

Loading…
Cancel
Save