diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/staff/StaffDTO.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/staff/StaffDTO.java deleted file mode 100644 index e70936c..0000000 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/dto/staff/StaffDTO.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.digiwin.athena.app.infra.dto.staff; - -import com.google.gson.annotations.SerializedName; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -/** - * 人资报道对象 ca_cim_staff - * - * @author zhenggl - * @date 2023-04-28 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class StaffDTO -{ - - @SerializedName("id") - private Long id; - - /** 员工编号 */ - @SerializedName("employee_no") - private String employeeNo; - - /** 员工名称 */ - @SerializedName("employee_name") - private String employeeName; - - /** 员工英文名称 */ - @SerializedName("en_employee_name") - private String enEmployeeName; - - /** 手机号码 */ - @SerializedName("mobile_no") - private String mobileNo; - - /** 电子邮件 */ - @SerializedName("email") - private String email; - - /** 状态 */ - @SerializedName("status") - private Integer status = 1; - - /** 数据状态 */ - @SerializedName("tab_status") - private Integer tabStatus = 0; - - /** 报道日期 */ - @SerializedName("register_date") - private Date registerDate; - - - /** 时间戳 */ - @SerializedName("timestamp") - private String timestamp; - - - - public StaffDTO(String employeeNo, Long id) { - this.employeeNo = employeeNo; - this.id = id; - } -} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java index 0c2fa2e..5ab600b 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/StaffEntity.java @@ -11,7 +11,7 @@ import lombok.Data; import lombok.NoArgsConstructor; /** - * 人资报道对象 ca_cim_staff + * 人资报道对象 cim_staff * * @author zhenggl * @date 2023-04-28 @@ -20,7 +20,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Builder -@TableName(value = "ca_cim_staff", autoResultMap = true) +@TableName(value = "cim_staff", autoResultMap = true) public class StaffEntity extends BaseMgrEntity { private static final long serialVersionUID = 1L; @@ -66,4 +66,12 @@ public class StaffEntity extends BaseMgrEntity private String timestamp; + public StaffEntity(Long id, String employeeNo) { + this.id = id; + this.employeeNo = employeeNo; + } + + public StaffEntity(Long id) { + this.id = id; + } } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml index 5ca9738..aa517de 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/mapper/StaffMapper.xml @@ -26,13 +26,13 @@ - 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 + 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 cim_staff - update ca_cim_staff + update cim_staff employee_no = #{item.employeeNo}, employee_name = #{item.employeeName}, @@ -46,7 +46,7 @@ - update ca_cim_staff + update cim_staff status = #{item.status}, tab_status = #{item.tabStatus}, diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java index 5f5d0a3..91215a6 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffCreateEAIService.java @@ -5,7 +5,6 @@ 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.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.repository.StaffRepository; import com.digiwin.athena.app.infra.service.StaffService; @@ -46,11 +45,11 @@ public class StaffCreateEAIService extends AbsEAIService { public DWEAIResult execute(Map headers, String messageBody) throws Exception { //反序列化字段 EAIRequest request = new EAIRequest(messageBody); - List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); + List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); //判断编号跟邮箱是否存在 LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); - List employeeNoList = staffList.stream().map(StaffDTO::getEmployeeNo).collect(Collectors.toList()); - List emailList = staffList.stream().map(StaffDTO::getEmail).collect(Collectors.toList()); + List employeeNoList = staffList.stream().map(StaffEntity::getEmployeeNo).collect(Collectors.toList()); + List emailList = staffList.stream().map(StaffEntity::getEmail).collect(Collectors.toList()); lmq.in(StaffEntity::getEmployeeNo,employeeNoList); lmq.or().in(StaffEntity::getEmail,emailList); List staffEntities = staffRepository.selectList(lmq); @@ -59,7 +58,7 @@ public class StaffCreateEAIService extends AbsEAIService { } List staffEntityList = BeanCopyUtil.copyList(staffList, StaffEntity.class); staffService.saveBatch(staffEntityList); - List collect = staffEntityList.stream().map(item -> new StaffDTO(item.getEmployeeNo(), item.getId())).collect(Collectors.toList()); + List collect = staffEntityList.stream().map(item -> new StaffEntity(item.getId(),item.getEmployeeNo())).collect(Collectors.toList()); return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel",collect)); } } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java index f03e649..ca6dc8f 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffGetEAIService.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 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.dto.staff.StaffDTO; import com.digiwin.athena.app.infra.entity.StaffEntity; import com.digiwin.athena.app.infra.repository.StaffRepository; import com.digiwin.athena.app.infra.service.StaffService; @@ -71,33 +70,33 @@ public class StaffGetEAIService extends AbsEAIService { } return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities)); } else if (OptionEnums.TASK.equals(option)) { - List staffDTOS = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); + List list = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); lmq.and(queryWrapperInner -> { - for (StaffDTO staffDTO : staffDTOS) { + for (StaffEntity staff : list) { queryWrapperInner.or( wrapper -> wrapper - .eq(!StringUtils.isEmpty(staffDTO.getTabStatus()), StaffEntity::getTabStatus, staffDTO.getTabStatus()) - .eq(!StringUtils.isEmpty(staffDTO.getId()), StaffEntity::getId, staffDTO.getId()) + .eq(!StringUtils.isEmpty(staff.getTabStatus()), StaffEntity::getTabStatus, staff.getTabStatus()) + .eq(!StringUtils.isEmpty(staff.getId()), StaffEntity::getId, staff.getId()) ); } }); List staffEntities = staffRepository.selectList(lmq); return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", staffEntities)); } else if (OptionEnums.BASIC.equals(option)) { - List staffDTOS = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); + List list = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); lmq.eq(StaffEntity::getTenantSid, SecurityUtil.getUserProfile().getTenantSid()); lmq.and(queryWrapperInner -> { - for (StaffDTO staffDTO : staffDTOS) { + for (StaffEntity staff : list) { 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()) + .eq(!StringUtils.isEmpty(staff.getEmployeeNo()), StaffEntity::getEmployeeNo, staff.getEmployeeNo()) + .eq(!StringUtils.isEmpty(staff.getEmployeeName()), StaffEntity::getEmployeeName, staff.getEmployeeName()) + .eq(!StringUtils.isEmpty(staff.getEnEmployeeName()), StaffEntity::getEnEmployeeName, staff.getEnEmployeeName()) + .eq(!StringUtils.isEmpty(staff.getEmail()), StaffEntity::getEmail, staff.getEmail()) + .eq(!StringUtils.isEmpty(staff.getMobileNo()), StaffEntity::getMobileNo, staff.getMobileNo()) ); } }); diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java index 56bd70f..85ec971 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUpdateEAIService.java @@ -1,11 +1,11 @@ package com.digiwin.athena.app.service.staff; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.digiwin.app.service.DWEAIResult; 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.common.enums.TabStatusEnums; import com.digiwin.athena.app.infra.entity.StaffEntity; import com.digiwin.athena.app.infra.repository.StaffRepository; import com.digiwin.athena.app.infra.service.StaffService; @@ -19,7 +19,6 @@ 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,13 +48,12 @@ public class StaffUpdateEAIService extends AbsEAIService { //反序列化字段 EAIRequest request = new EAIRequest(messageBody); String option = request.getObject("option", String.class); - List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_DTO_STAFF); + List staffList = request.getObject("wait_register_personnel", StaffUtil.LIST_ENTITY_STAFF); //界面 if (OptionEnums.BASIC.getValue().equals(option)){ if (!CollectionUtils.isEmpty(staffList)){ - List staffEntities = BeanCopyUtil.copyList(staffList, StaffEntity.class); //区分是否有id没有则新增 - Map> collect = staffEntities.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); + Map> collect = staffList.stream().collect(Collectors.groupingBy(item -> StringUtils.isEmpty(item.getId()))); List insert = collect.get(true); staffService.saveBatch(insert); List update = collect.get(false); @@ -63,17 +61,17 @@ public class StaffUpdateEAIService extends AbsEAIService { } }else if (OptionEnums.TASK.getValue().equals(option)){ if (!CollectionUtils.isEmpty(staffList)){ - List 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)){ - List idList = staffList.stream().map(StaffDTO::getId).collect(Collectors.toList()); + List idList = staffList.stream().map(StaffEntity::getId).collect(Collectors.toList()); LambdaUpdateWrapper 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); } - - return EAIUtil.buildEAIResult(new HashMap<>()); + List collect = staffList.stream().map(item -> new StaffEntity(item.getId())).collect(Collectors.toList()); + return EAIUtil.buildEAIResult(new JSONObject().fluentPut("wait_register_personnel", collect)); } } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUtil.java index 2cbb944..f1dcae2 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUtil.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/staff/StaffUtil.java @@ -1,7 +1,7 @@ package com.digiwin.athena.app.service.staff; import com.alibaba.fastjson.TypeReference; -import com.digiwin.athena.app.infra.dto.staff.StaffDTO; +import com.digiwin.athena.app.infra.entity.StaffEntity; import java.util.List; @@ -21,6 +21,6 @@ public class StaffUtil { 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 TypeReference> LIST_DTO_STAFF = new TypeReference>() { + public static final TypeReference> LIST_ENTITY_STAFF = new TypeReference>() { }; } diff --git a/doc/sql/app-20230427-ddl.sql b/doc/sql/app-20230427-ddl.sql index 0808475..81c5770 100644 --- a/doc/sql/app-20230427-ddl.sql +++ b/doc/sql/app-20230427-ddl.sql @@ -21,3 +21,26 @@ create table `sales_order_detail` ( `deleted` tinyint(255) DEFAULT NULL, primary key (`id`) ) engine=innodb default charset=utf8mb4 comment='订单明细'; + -- 新人报道表 +CREATE TABLE `cim_staff` ( + `id` bigint(20) NOT NULL, + `employee_no` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '员工编号', + `employee_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '员工名称', + `en_employee_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '员工英文名称', + `mobile_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号码', + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子邮件', + `status` int(2) NULL DEFAULT NULL COMMENT '状态', + `tab_status` int(2) NULL DEFAULT NULL COMMENT '数据状态', + `register_date` datetime(0) NULL DEFAULT NULL COMMENT '报道日期', + `tenantsid` bigint(20) NULL DEFAULT NULL, + `tenant_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `create_date` datetime(0) NULL DEFAULT NULL, + `modified_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `modified_date` datetime(0) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` tinyint(255) NULL DEFAULT NULL, + `timestamp` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '人资报道表' ROW_FORMAT = Dynamic; +