Browse Source

Merge branch 'sprint/S1' into develop

master
郑贵龙 1 year ago
parent
commit
403cceb596
4 changed files with 8 additions and 23 deletions
  1. +1
    -1
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml
  2. +0
    -11
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java
  3. +1
    -1
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java
  4. +6
    -10
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java

+ 1
- 1
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml View File

@ -48,7 +48,7 @@
<foreach collection="list" item="item" index="index" close="" open="" separator=";">
update cim_staff
<trim prefix="SET" suffixOverrides=",">
<if test="item.status != null">status = #{item.status},</if>
<if test="item.tabStatus != null">tab_status = #{item.tabStatus},</if>
<if test="item.registerDate != null">register_date = #{item.registerDate},</if>
</trim>
where id = #{item.id} and `tenantsid`=#{tenantSid}


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

@ -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<StaffEntity> lmq = new LambdaQueryWrapper<>();
List<String> employeeNoList = staffList.stream().map(StaffEntity::getEmployeeNo).collect(Collectors.toList());
List<String> emailList = staffList.stream().map(StaffEntity::getEmail).collect(Collectors.toList());
lmq.in(StaffEntity::getEmployeeNo,employeeNoList);
lmq.or().in(StaffEntity::getEmail,emailList);
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
if (!CollectionUtils.isEmpty(staffEntities)){
throw new DWRuntimeException("员工编号或邮箱重复");
}
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));


+ 1
- 1
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java View File

@ -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<StaffEntity> list = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF);
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();


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

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

Loading…
Cancel
Save