Browse Source

修改接口判空处理

master
郑贵龙 1 year ago
parent
commit
c11c769546
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java

+ 12
- 7
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java View File

@ -16,6 +16,7 @@ import com.digiwin.athena.opt.common.security.SecurityUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
@ -62,15 +63,19 @@ public class StaffUpdateEAIService extends AbsEAIService {
staffService.saveBatch(staffList);
} else if (OptionEnums.BASIC.getValue().equals(option)) {
//区分是否有id没有则新增
Map<Boolean, List<StaffEntity>> collect = staffList.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId())));
Map<Boolean, List<StaffEntity>> collect = staffList.stream().collect(Collectors.groupingBy(item -> ObjectUtils.isEmpty(item.getId())));
List<StaffEntity> insert = collect.get(true);
insert.forEach(item ->{
item.setStatus(StatusEnums.TOBEREPORTED.getValue());
item.setTabStatus(TabStatusEnums.NOSET.getValue());
});
staffService.saveBatch(insert);
if (!CollectionUtils.isEmpty(insert)){
insert.forEach(item ->{
item.setStatus(StatusEnums.TOBEREPORTED.getValue());
item.setTabStatus(TabStatusEnums.NOSET.getValue());
});
staffService.saveBatch(insert);
}
List<StaffEntity> update = collect.get(false);
staffRepository.updateStaffList(update, SecurityUtil.getUserProfile().getTenantSid());
if (!CollectionUtils.isEmpty(update)){
staffRepository.updateStaffList(update, SecurityUtil.getUserProfile().getTenantSid());
}
} else if (OptionEnums.TASK.getValue().equals(option)) {
staffRepository.updateStatusAndDate(staffList, SecurityUtil.getUserProfile().getTenantSid());
} else if (OptionEnums.FLOW.getValue().equals(option)) {


Loading…
Cancel
Save