|
|
@ -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<StaffEntity> 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<Boolean, List<StaffEntity>> collect = staffList.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); |
|
|
|
List<StaffEntity> insert = collect.get(true); |
|
|
@ -70,20 +71,15 @@ public class StaffUpdateEAIService extends AbsEAIService { |
|
|
|
staffService.saveBatch(insert); |
|
|
|
List<StaffEntity> 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<Long> idList = staffList.stream().map(StaffEntity::getId).collect(Collectors.toList()); |
|
|
|
LambdaUpdateWrapper<StaffEntity> 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<StaffEntity> 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<>()); |
|
|
|
} |
|
|
|
} |