|
@ -1,11 +1,11 @@ |
|
|
package com.digiwin.athena.app.service.staff; |
|
|
package com.digiwin.athena.app.service.staff; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.digiwin.app.service.DWEAIResult; |
|
|
import com.digiwin.app.service.DWEAIResult; |
|
|
import com.digiwin.athena.app.infra.common.enums.OptionEnums; |
|
|
import com.digiwin.athena.app.infra.common.enums.OptionEnums; |
|
|
import com.digiwin.athena.app.infra.common.enums.StatusEnums; |
|
|
import com.digiwin.athena.app.infra.common.enums.StatusEnums; |
|
|
import com.digiwin.athena.app.infra.common.utils.BeanCopyUtil; |
|
|
|
|
|
import com.digiwin.athena.app.infra.dto.staff.StaffDTO; |
|
|
|
|
|
|
|
|
import com.digiwin.athena.app.infra.common.enums.TabStatusEnums; |
|
|
import com.digiwin.athena.app.infra.entity.StaffEntity; |
|
|
import com.digiwin.athena.app.infra.entity.StaffEntity; |
|
|
import com.digiwin.athena.app.infra.repository.StaffRepository; |
|
|
import com.digiwin.athena.app.infra.repository.StaffRepository; |
|
|
import com.digiwin.athena.app.infra.service.StaffService; |
|
|
import com.digiwin.athena.app.infra.service.StaffService; |
|
@ -19,7 +19,6 @@ import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -49,13 +48,12 @@ public class StaffUpdateEAIService extends AbsEAIService { |
|
|
//反序列化字段 |
|
|
//反序列化字段 |
|
|
EAIRequest request = new EAIRequest(messageBody); |
|
|
EAIRequest request = new EAIRequest(messageBody); |
|
|
String option = request.getObject("option", String.class); |
|
|
String option = request.getObject("option", String.class); |
|
|
List<StaffDTO> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); |
|
|
|
|
|
|
|
|
List<StaffEntity> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); |
|
|
//界面 |
|
|
//界面 |
|
|
if (OptionEnums.BASIC.getValue().equals(option)){ |
|
|
if (OptionEnums.BASIC.getValue().equals(option)){ |
|
|
if (!CollectionUtils.isEmpty(staffList)){ |
|
|
if (!CollectionUtils.isEmpty(staffList)){ |
|
|
List<StaffEntity> staffEntities = BeanCopyUtil.copyList(staffList, StaffEntity.class); |
|
|
|
|
|
//区分是否有id没有则新增 |
|
|
//区分是否有id没有则新增 |
|
|
Map<Boolean, List<StaffEntity>> collect = staffEntities.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); |
|
|
|
|
|
|
|
|
Map<Boolean, List<StaffEntity>> collect = staffList.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); |
|
|
List<StaffEntity> insert = collect.get(true); |
|
|
List<StaffEntity> insert = collect.get(true); |
|
|
staffService.saveBatch(insert); |
|
|
staffService.saveBatch(insert); |
|
|
List<StaffEntity> update = collect.get(false); |
|
|
List<StaffEntity> update = collect.get(false); |
|
@ -63,17 +61,17 @@ public class StaffUpdateEAIService extends AbsEAIService { |
|
|
} |
|
|
} |
|
|
}else if (OptionEnums.TASK.getValue().equals(option)){ |
|
|
}else if (OptionEnums.TASK.getValue().equals(option)){ |
|
|
if (!CollectionUtils.isEmpty(staffList)){ |
|
|
if (!CollectionUtils.isEmpty(staffList)){ |
|
|
List<StaffEntity> staffEntities = BeanCopyUtil.copyList(staffList, StaffEntity.class); |
|
|
|
|
|
staffRepository.updateStatusAndDate(staffEntities,SecurityUtil.getUserProfile().getTenantSid()); |
|
|
|
|
|
|
|
|
staffRepository.updateStatusAndDate(staffList,SecurityUtil.getUserProfile().getTenantSid()); |
|
|
} |
|
|
} |
|
|
}else if (OptionEnums.FLOW.getValue().equals(option)){ |
|
|
}else if (OptionEnums.FLOW.getValue().equals(option)){ |
|
|
List<Long> idList = staffList.stream().map(StaffDTO::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
List<Long> idList = staffList.stream().map(StaffEntity::getId).collect(Collectors.toList()); |
|
|
LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>(); |
|
|
LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>(); |
|
|
lmu.set(StaffEntity::getStatus, StatusEnums.REPORTED.getValue()); |
|
|
lmu.set(StaffEntity::getStatus, StatusEnums.REPORTED.getValue()); |
|
|
|
|
|
lmu.set(StaffEntity::getTabStatus, TabStatusEnums.COMPLETED.getValue()); |
|
|
lmu.in(StaffEntity::getId,idList); |
|
|
lmu.in(StaffEntity::getId,idList); |
|
|
staffService.update(lmu); |
|
|
staffService.update(lmu); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return EAIUtil.buildEAIResult(new HashMap<>()); |
|
|
|
|
|
|
|
|
List<StaffEntity> collect = staffList.stream().map(item -> new StaffEntity(item.getId())).collect(Collectors.toList()); |
|
|
|
|
|
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", collect)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |