Browse Source

Merge branch 'feature/fq' into sprint/S1

master
郑贵龙 1 year ago
parent
commit
6a47229381
17 changed files with 214 additions and 103 deletions
  1. +24
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/common/enums/OptionEnums.java
  2. +4
    -7
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/staff/StaffDTO.java
  3. +3
    -3
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java
  4. +58
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml
  5. +7
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/StaffRepository.java
  6. +2
    -9
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/StaffEAIService.java
  7. +0
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java
  8. +0
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicEAIServiceImpl.java
  9. +0
    -0
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java
  10. +0
    -4
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/StaffEAIServiceImpl.java
  11. +12
    -14
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java
  12. +64
    -15
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java
  13. +0
    -42
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffQueryEAIService.java
  14. +38
    -6
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java
  15. +1
    -2
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUtil.java
  16. +0
    -0
      demo-athenaopt_backend/develop/src/test/java/com/digiwin/athena/app/provider/impl/temp.txt
  17. +1
    -1
      version_control/BUILD

+ 24
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/common/enums/OptionEnums.java View File

@ -0,0 +1,24 @@
package com.digiwin.athena.app.infra.common.enums;
/**
* @Auther: zhenggl
* @Date: 2023/4/28
*/
public enum OptionEnums {
//任务卡
TASK("task"),
//界面
BASIC("basic"),
//流程
FLOW("flow");
private final String value;
OptionEnums(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/order/StaffDTO.java → demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/staff/StaffDTO.java View File

@ -1,4 +1,4 @@
package com.digiwin.athena.app.infra.dto.order;
package com.digiwin.athena.app.infra.dto.staff;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -38,7 +38,7 @@ public class StaffDTO
/** 手机号码 */ /** 手机号码 */
@SerializedName("mobile_no") @SerializedName("mobile_no")
private Long mobileNo;
private String mobileNo;
/** 电子邮件 */ /** 电子邮件 */
@SerializedName("email") @SerializedName("email")
@ -61,13 +61,10 @@ public class StaffDTO
@SerializedName("timestamp") @SerializedName("timestamp")
private String timestamp; private String timestamp;
//==========冗余==============
@SerializedName("register_personnel_id")
public Long registerPersonnelId;
public StaffDTO(String employeeNo, Long registerPersonnelId) {
public StaffDTO(String employeeNo, Long id) {
this.employeeNo = employeeNo; this.employeeNo = employeeNo;
this.registerPersonnelId = registerPersonnelId;
this.id = id;
} }
} }

+ 3
- 3
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java View File

@ -42,7 +42,7 @@ public class StaffEntity extends BaseMgrEntity<StaffEntity>
/** 手机号码 */ /** 手机号码 */
@SerializedName("mobile_no") @SerializedName("mobile_no")
private Long mobileNo;
private String mobileNo;
/** 电子邮件 */ /** 电子邮件 */
@SerializedName("email") @SerializedName("email")
@ -50,11 +50,11 @@ public class StaffEntity extends BaseMgrEntity<StaffEntity>
/** 状态 */ /** 状态 */
@SerializedName("status") @SerializedName("status")
private Integer status;
private Integer status = 1;
/** 数据状态 */ /** 数据状态 */
@SerializedName("tab_status") @SerializedName("tab_status")
private Integer tabStatus;
private Integer tabStatus = 0;
/** 报道日期 */ /** 报道日期 */
@SerializedName("register_date") @SerializedName("register_date")


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

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.digiwin.athena.app.infra.repository.StaffRepository">
<resultMap type="com.digiwin.athena.app.infra.entity.StaffEntity" id="StaffResult">
<result property="id" column="id"/>
<result property="employeeNo" column="employee_no"/>
<result property="employeeName" column="employee_name"/>
<result property="enEmployeeName" column="en_employee_name"/>
<result property="mobileNo" column="mobile_no"/>
<result property="email" column="email"/>
<result property="status" column="status"/>
<result property="tabStatus" column="tab_status"/>
<result property="registerDate" column="register_date"/>
<result property="tenantSid" column="tenantsid"/>
<result property="tenantId" column="tenant_id"/>
<result property="createBy" column="create_by"/>
<result property="createDate" column="create_date"/>
<result property="modifiedBy" column="modified_by"/>
<result property="modifiedDate" column="modified_date"/>
<result property="version" column="version"/>
<result property="deleted" column="deleted"/>
<result property="timestamp" column="timestamp"/>
</resultMap>
<sql id="selectStaffVo">
select id, employee_no, employee_name, en_employee_name, mobile_no, email, status, tab_status, register_date, tenantsid, tenant_id, create_by, create_date, modified_by, modified_date, version, deleted, timestamp from ca_cim_staff
</sql>
<update id="updateStaffList">
<foreach collection="list" item="item" index="index" close="" open="" separator=";">
update ca_cim_staff
<trim prefix="SET" suffixOverrides=",">
<if test="item.employeeNo != null">employee_no = #{item.employeeNo},</if>
<if test="item.employeeName != null">employee_name = #{item.employeeName},</if>
<if test="item.enEmployeeName != null">en_employee_name = #{item.enEmployeeName},</if>
<if test="item.mobileNo != null">mobile_no = #{item.mobileNo},</if>
<if test="item.email != null">email = #{item.email},</if>
</trim>
where id = #{item.id} and `tenantsid`=#{tenantSid}
</foreach>
</update>
<update id="updateStatusAndDate">
<foreach collection="list" item="item" index="index" close="" open="" separator=";">
update ca_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>
</trim>
where id = #{item.id} and `tenantsid`=#{tenantSid}
</foreach>
</update>
</mapper>

+ 7
- 0
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/StaffRepository.java View File

@ -3,10 +3,17 @@ package com.digiwin.athena.app.infra.repository;
import com.digiwin.athena.app.infra.entity.StaffEntity; import com.digiwin.athena.app.infra.entity.StaffEntity;
import com.digiwin.athena.opt.persistence.repository.BaseRepository; import com.digiwin.athena.opt.persistence.repository.BaseRepository;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Auther: zhenggl * @Auther: zhenggl
* @Date: 2023/4/28 * @Date: 2023/4/28
*/ */
public interface StaffRepository extends BaseRepository<StaffEntity> { public interface StaffRepository extends BaseRepository<StaffEntity> {
public void updateStaffList(@Param("list")List<StaffEntity> list,@Param("tenantsid") Long tenantsid);
public void updateStatusAndDate(@Param("list")List<StaffEntity> list,@Param("tenantsid") Long tenantsid);
} }

+ 2
- 9
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/StaffEAIService.java View File

@ -1,5 +1,6 @@
package com.digiwin.athena.app.provider; package com.digiwin.athena.app.provider;
import com.digiwin.app.service.AllowAnonymous;
import com.digiwin.app.service.DWEAIResult; import com.digiwin.app.service.DWEAIResult;
import com.digiwin.app.service.DWService; import com.digiwin.app.service.DWService;
import com.digiwin.app.service.eai.EAIService; import com.digiwin.app.service.eai.EAIService;
@ -33,15 +34,6 @@ public interface StaffEAIService extends DWService {
@EAIService(id = StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET) @EAIService(id = StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET)
DWEAIResult get(Map<String, String> headers, String messageBody) throws Exception; DWEAIResult get(Map<String, String> headers, String messageBody) throws Exception;
/**
* 新人报道查询
* @param headers
* @param messageBody
* @return
* @throws Exception
*/
@EAIService(id = StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_QUERY)
DWEAIResult query(Map<String, String> headers, String messageBody) throws Exception;
/** /**
* 新人报道创建 * 新人报道创建
@ -51,5 +43,6 @@ public interface StaffEAIService extends DWService {
* @throws Exception * @throws Exception
*/ */
@EAIService(id = StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_CREATE) @EAIService(id = StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_CREATE)
@AllowAnonymous
DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception; DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception;
} }

demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/Impl/BasicApiServiceImpl.java → demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java View File


demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/Impl/BasicEAIServiceImpl.java → demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicEAIServiceImpl.java View File


demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/Impl/SalesOrderDetailEAIServiceImpl.java → demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/SalesOrderDetailEAIServiceImpl.java View File


demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/Impl/StaffEAIServiceImpl.java → demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/StaffEAIServiceImpl.java View File

@ -28,10 +28,6 @@ public class StaffEAIServiceImpl implements StaffEAIService {
return eaiServiceContext.execute(StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET,headers,messageBody); return eaiServiceContext.execute(StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET,headers,messageBody);
} }
@Override
public DWEAIResult query(Map<String, String> headers, String messageBody) throws Exception {
return eaiServiceContext.execute(StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_QUERY,headers,messageBody);
}
@Override @Override
public DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult create(Map<String, String> headers, String messageBody) throws Exception {

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

@ -5,13 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.digiwin.app.container.exceptions.DWRuntimeException; import com.digiwin.app.container.exceptions.DWRuntimeException;
import com.digiwin.app.service.DWEAIResult; import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.common.utils.BeanCopyUtil; import com.digiwin.athena.app.infra.common.utils.BeanCopyUtil;
import com.digiwin.athena.app.infra.dto.order.StaffDTO;
import com.digiwin.athena.app.infra.dto.staff.StaffDTO;
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;
import com.digiwin.athena.opt.common.eai.EAIRequest; import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil; import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -23,6 +26,8 @@ import java.util.stream.Collectors;
* @Auther: zhenggl * @Auther: zhenggl
* @Date: 2023/4/28 * @Date: 2023/4/28
*/ */
@Service
@Log4j2
public class StaffCreateEAIService extends AbsEAIService { public class StaffCreateEAIService extends AbsEAIService {
@Resource @Resource
@ -37,31 +42,24 @@ public class StaffCreateEAIService extends AbsEAIService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
//反序列化字段 //反序列化字段
EAIRequest request = new EAIRequest(messageBody); EAIRequest request = new EAIRequest(messageBody);
List<StaffDTO> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); List<StaffDTO> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF);
//判断编号跟邮箱是否存在 //判断编号跟邮箱是否存在
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.or(queryWrapperInner -> {
for (StaffDTO staffDTO : staffList) {
queryWrapperInner.or(
wrapper->wrapper
.eq(StaffEntity::getEmployeeNo,staffDTO.getEmployeeNo())
);
queryWrapperInner.or(
wrapper->wrapper
.eq(StaffEntity::getEmail,staffDTO.getEmail())
);
}
});
List<String> employeeNoList = staffList.stream().map(StaffDTO::getEmployeeNo).collect(Collectors.toList());
List<String> emailList = staffList.stream().map(StaffDTO::getEmail).collect(Collectors.toList());
lmq.in(StaffEntity::getEmployeeNo,employeeNoList);
lmq.or().in(StaffEntity::getEmail,emailList);
List<StaffEntity> staffEntities = staffRepository.selectList(lmq); List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
if (!CollectionUtils.isEmpty(staffEntities)){ if (!CollectionUtils.isEmpty(staffEntities)){
throw new DWRuntimeException("员工编号或邮箱重复"); throw new DWRuntimeException("员工编号或邮箱重复");
} }
List<StaffEntity> staffEntityList = BeanCopyUtil.copyList(staffList, StaffEntity.class); List<StaffEntity> staffEntityList = BeanCopyUtil.copyList(staffList, StaffEntity.class);
staffService.saveBatch(staffEntityList); staffService.saveBatch(staffEntityList);
List<StaffDTO> collect = staffEntities.stream().map(item -> new StaffDTO(item.getEmployeeNo(), item.getId())).collect(Collectors.toList());
List<StaffDTO> collect = staffEntityList.stream().map(item -> new StaffDTO(item.getEmployeeNo(), item.getId())).collect(Collectors.toList());
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",collect)); return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",collect));
} }
} }

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

@ -4,17 +4,24 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.TabStatusEnums; import com.digiwin.athena.app.infra.common.enums.TabStatusEnums;
import com.digiwin.athena.app.infra.dto.staff.StaffDTO;
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;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil; import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.security.SecurityUtil; import com.digiwin.athena.opt.common.security.SecurityUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
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;
@ -23,6 +30,8 @@ import java.util.stream.Collectors;
* @Auther: zhenggl * @Auther: zhenggl
* @Date: 2023/4/28 * @Date: 2023/4/28
*/ */
@Service
@Log4j2
public class StaffGetEAIService extends AbsEAIService { public class StaffGetEAIService extends AbsEAIService {
@Resource @Resource
@ -39,22 +48,62 @@ public class StaffGetEAIService extends AbsEAIService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
//查询所有tab_status=0的数据然后把他们全部修改为1
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid());
lmq.eq(StaffEntity::getTabStatus, TabStatusEnums.NOSET.getValue());
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
if (!CollectionUtils.isEmpty(staffEntities)){
List<Long> idList = staffEntities.stream().map(StaffEntity::getId).collect(Collectors.toList());
LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>();
lmu.set(StaffEntity::getTabStatus,TabStatusEnums.PENDING);
lmu.in(StaffEntity::getId,idList);
staffService.update(lmu);
//修改查询到的参数
staffEntities.forEach(item ->{
item.setTabStatus(TabStatusEnums.PENDING.getValue());
//反序列化字段
EAIRequest request = new EAIRequest(messageBody);
String option = request.getObject("option", String.class);
//为空走侦测逻辑
if (StringUtils.isEmpty(option)) {
//查询所有tab_status=0的数据然后把他们全部修改为1
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid());
lmq.eq(StaffEntity::getTabStatus, TabStatusEnums.NOSET.getValue());
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
if (!CollectionUtils.isEmpty(staffEntities)) {
List<Long> idList = staffEntities.stream().map(StaffEntity::getId).collect(Collectors.toList());
LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>();
lmu.set(StaffEntity::getTabStatus, TabStatusEnums.PENDING);
lmu.in(StaffEntity::getId, idList);
staffService.update(lmu);
//修改查询到的参数
staffEntities.forEach(item -> {
item.setTabStatus(TabStatusEnums.PENDING.getValue());
});
}
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities));
} else if (OptionEnums.TASK.equals(option)) {
List<StaffDTO> staffDTOS = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF);
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid());
lmq.and(queryWrapperInner -> {
for (StaffDTO staffDTO : staffDTOS) {
queryWrapperInner.or(
wrapper -> wrapper
.eq(!StringUtils.isEmpty(staffDTO.getTabStatus()), StaffEntity::getTabStatus, staffDTO.getTabStatus())
.eq(!StringUtils.isEmpty(staffDTO.getId()), StaffEntity::getId, staffDTO.getId())
);
}
}); });
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities));
} else if (OptionEnums.BASIC.equals(option)) {
List<StaffDTO> staffDTOS = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF);
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid());
lmq.and(queryWrapperInner -> {
for (StaffDTO staffDTO : staffDTOS) {
queryWrapperInner.or(
wrapper -> wrapper
.eq(!StringUtils.isEmpty(staffDTO.getEmployeeNo()), StaffEntity::getEmployeeNo, staffDTO.getEmployeeNo())
.eq(!StringUtils.isEmpty(staffDTO.getEmployeeName()), StaffEntity::getEmployeeName, staffDTO.getEmployeeName())
.eq(!StringUtils.isEmpty(staffDTO.getEnEmployeeName()), StaffEntity::getEnEmployeeName, staffDTO.getEnEmployeeName())
.eq(!StringUtils.isEmpty(staffDTO.getEmail()), StaffEntity::getEmail, staffDTO.getEmail())
.eq(!StringUtils.isEmpty(staffDTO.getMobileNo()), StaffEntity::getMobileNo, staffDTO.getMobileNo())
);
}
});
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities));
} }
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",staffEntities));
return EAIUtil.buildEAIResult(new HashMap<>());
} }
} }

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

@ -1,42 +0,0 @@
package com.digiwin.athena.app.service.staff;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.infra.common.enums.TabStatusEnums;
import com.digiwin.athena.app.infra.dto.order.StaffDTO;
import com.digiwin.athena.app.infra.entity.StaffEntity;
import com.digiwin.athena.app.infra.repository.StaffRepository;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.security.SecurityUtil;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Auther: zhenggl
* @Date: 2023/4/28
*/
public class StaffQueryEAIService extends AbsEAIService {
@Resource
private StaffRepository staffRepository;
@Override
public String getServiceName() {
return StaffUtil.DEMO_WAIT_REGISTER_PERSONNEL_INFO_QUERY;
}
@Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
LambdaQueryWrapper<StaffEntity> lmq = new LambdaQueryWrapper<>();
lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid());
lmq.eq(StaffEntity::getTabStatus, TabStatusEnums.NOSET.getValue());
List<StaffEntity> staffEntities = staffRepository.selectList(lmq);
return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",staffEntities));
}
}

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

@ -2,27 +2,40 @@ package com.digiwin.athena.app.service.staff;
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.TabStatusEnums;
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.utils.BeanCopyUtil;
import com.digiwin.athena.app.infra.dto.staff.StaffDTO;
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.service.StaffService; import com.digiwin.athena.app.infra.service.StaffService;
import com.digiwin.athena.opt.common.eai.EAIRequest; import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.EAIUtil; import com.digiwin.athena.opt.common.eai.EAIUtil;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
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.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap; 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;
/** /**
* @Auther: zhenggl * @Auther: zhenggl
* @Date: 2023/4/28 * @Date: 2023/4/28
*/ */
@Service
@Log4j2
public class StaffUpdateEAIService extends AbsEAIService { public class StaffUpdateEAIService extends AbsEAIService {
@Resource
private StaffRepository staffRepository;
@Resource @Resource
private StaffService staffService; private StaffService staffService;
@ -35,13 +48,32 @@ public class StaffUpdateEAIService extends AbsEAIService {
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
//反序列化字段 //反序列化字段
EAIRequest request = new EAIRequest(messageBody); EAIRequest request = new EAIRequest(messageBody);
List<Integer> staffList = request.getObject("wait_register_personnel", new ArrayList<Integer>().getClass());
if (!CollectionUtils.isEmpty(staffList)){
String option = request.getObject("option", String.class);
List<StaffDTO> staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF);
//界面
if (OptionEnums.BASIC.getValue().equals(option)){
if (!CollectionUtils.isEmpty(staffList)){
List<StaffEntity> staffEntities = BeanCopyUtil.copyList(staffList, StaffEntity.class);
//区分是否有id没有则新增
Map<Boolean, List<StaffEntity>> collect = staffEntities.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId())));
List<StaffEntity> insert = collect.get(true);
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)){
List<StaffEntity> staffEntities = BeanCopyUtil.copyList(staffList, StaffEntity.class);
staffRepository.updateStatusAndDate(staffEntities,SecurityUtil.getUserProfile().getTenantSid());
}
}else if (OptionEnums.FLOW.getValue().equals(option)){
List<Long> idList = staffList.stream().map(StaffDTO::getId).collect(Collectors.toList());
LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<StaffEntity> lmu = new LambdaUpdateWrapper<>();
lmu.set(StaffEntity::getTabStatus, TabStatusEnums.COMPLETED.getValue());
lmu.in(StaffEntity::getId,staffList);
lmu.set(StaffEntity::getStatus, StatusEnums.REPORTED.getValue());
lmu.in(StaffEntity::getId,idList);
staffService.update(lmu); staffService.update(lmu);
} }
return EAIUtil.buildEAIResult(new HashMap<>()); return EAIUtil.buildEAIResult(new HashMap<>());
} }
} }

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

@ -1,7 +1,7 @@
package com.digiwin.athena.app.service.staff; package com.digiwin.athena.app.service.staff;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.digiwin.athena.app.infra.dto.order.StaffDTO;
import com.digiwin.athena.app.infra.dto.staff.StaffDTO;
import java.util.List; import java.util.List;
@ -20,7 +20,6 @@ public class StaffUtil {
public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_CREATE = "demo.wait.register.personnel.info.create"; public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_CREATE = "demo.wait.register.personnel.info.create";
public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_UPDATE = "demo.wait.register.personnel.info.update"; public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_UPDATE = "demo.wait.register.personnel.info.update";
public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET = "demo.wait.register.personnel.info.get"; public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_GET = "demo.wait.register.personnel.info.get";
public static final String DEMO_WAIT_REGISTER_PERSONNEL_INFO_QUERY = "demo.wait.register.personnel.info.query";
public static final TypeReference<List<StaffDTO>> LIST_DTO_STAFF = new TypeReference<List<StaffDTO>>() { public static final TypeReference<List<StaffDTO>> LIST_DTO_STAFF = new TypeReference<List<StaffDTO>>() {
}; };


demo-athenaopt_backend/develop/src/test/java/com/digiwin/athena/app/provider/Impl/temp.txt → demo-athenaopt_backend/develop/src/test/java/com/digiwin/athena/app/provider/impl/temp.txt View File


+ 1
- 1
version_control/BUILD View File

@ -1 +1 @@
999
1001

Loading…
Cancel
Save