From 850811f5c3bc29bd4b89c0cc5dfa168059689f13 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Thu, 4 May 2023 17:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9update=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91=E4=BB=A5=E5=8F=8Aget?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../athena/app/infra/mapper/StaffMapper.xml | 2 +- .../app/service/staff/StaffCreateEAIService.java | 11 ----------- .../app/service/staff/StaffGetEAIService.java | 2 +- .../app/service/staff/StaffUpdateEAIService.java | 16 ++++++---------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml index 93e07b4..3725c6d 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml @@ -48,7 +48,7 @@ update cim_staff - status = #{item.status}, + tab_status = #{item.tabStatus}, register_date = #{item.registerDate}, where id = #{item.id} and `tenantsid`=#{tenantSid} 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 0d70bee..a2b2948 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 @@ -1,7 +1,6 @@ package com.digiwin.athena.app.service.staff; 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.entity.StaffEntity; @@ -48,16 +47,6 @@ public class StaffCreateEAIService extends AbsEAIService { if (CollectionUtils.isEmpty(staffList)){ throw new DWRuntimeException("缺少必要参数"); } - //判断编号跟邮箱是否存在 - LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); - List employeeNoList = staffList.stream().map(StaffEntity::getEmployeeNo).collect(Collectors.toList()); - List emailList = staffList.stream().map(StaffEntity::getEmail).collect(Collectors.toList()); - lmq.in(StaffEntity::getEmployeeNo,employeeNoList); - lmq.or().in(StaffEntity::getEmail,emailList); - List staffEntities = staffRepository.selectList(lmq); - if (!CollectionUtils.isEmpty(staffEntities)){ - throw new DWRuntimeException("员工编号或邮箱重复"); - } 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)); diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java index 624ab26..c7dc4b6 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java @@ -68,7 +68,7 @@ public class StaffGetEAIService extends AbsEAIService { item.setTabStatus(TabStatusEnums.PENDING.getValue()); }); } - return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities)); + return EAIUtil.buildEAIResult(new JSONObject().fluentPut("change_objects", staffEntities)); } else if (OptionEnums.TASK.getValue().equals(option)) { List list = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java index 0badec3..c792481 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java @@ -1,7 +1,7 @@ package com.digiwin.athena.app.service.staff; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.digiwin.app.container.exceptions.DWRuntimeException; import com.digiwin.app.service.DWEAIResult; import com.digiwin.athena.app.infra.common.enums.OptionEnums; import com.digiwin.athena.app.infra.common.enums.StatusEnums; @@ -19,6 +19,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -49,17 +50,17 @@ public class StaffUpdateEAIService extends AbsEAIService { EAIRequest request = new EAIRequest(messageBody); String option = request.getObject("option", String.class); List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); + if (!CollectionUtils.isEmpty(staffList)) { + throw new DWRuntimeException("必要参数不可为空"); + } //界面 if (StringUtils.isEmpty(option)) { - if (!CollectionUtils.isEmpty(staffList)){ staffList.forEach(item ->{ item.setStatus(StatusEnums.TOBEREPORTED.getValue()); item.setTabStatus(TabStatusEnums.NOSET.getValue()); }); staffService.saveBatch(staffList); - } } else if (OptionEnums.BASIC.getValue().equals(option)) { - if (!CollectionUtils.isEmpty(staffList)) { //区分是否有id没有则新增 Map> collect = staffList.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); List insert = collect.get(true); @@ -70,20 +71,15 @@ public class StaffUpdateEAIService extends AbsEAIService { staffService.saveBatch(insert); List update = collect.get(false); staffRepository.updateStaffList(update, SecurityUtil.getUserProfile().getTenantSid()); - } } else if (OptionEnums.TASK.getValue().equals(option)) { - if (!CollectionUtils.isEmpty(staffList)) { staffRepository.updateStatusAndDate(staffList, SecurityUtil.getUserProfile().getTenantSid()); - } } else if (OptionEnums.FLOW.getValue().equals(option)) { List idList = staffList.stream().map(StaffEntity::getId).collect(Collectors.toList()); LambdaUpdateWrapper lmu = new LambdaUpdateWrapper<>(); lmu.set(StaffEntity::getStatus, StatusEnums.REPORTED.getValue()); - lmu.set(StaffEntity::getTabStatus, TabStatusEnums.COMPLETED.getValue()); lmu.in(StaffEntity::getId, idList); staffService.update(lmu); } - List collect = staffList.stream().map(item -> new StaffEntity(item.getId())).collect(Collectors.toList()); - return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", collect)); + return EAIUtil.buildEAIResult(new HashMap<>()); } }