|
- package com.hz.pm.api.employee;
-
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.hz.pm.api.AppTests;
- import com.hz.pm.api.common.model.constant.BizConst;
- import com.hz.pm.api.common.model.constant.RegionConst;
- import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
- import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
- import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
- import com.hz.pm.api.organization.model.entity.DingOrganization;
- import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
- import com.hz.pm.api.organization.service.IDingOrganizationService;
- import com.hz.pm.api.user.entity.UserInfo;
- import com.hz.pm.api.user.service.IUserInfoService;
- import org.junit.Test;
- import org.springframework.beans.factory.annotation.Autowired;
-
- import java.time.LocalDateTime;
- import java.util.List;
- import java.util.Objects;
-
- /**
- * @Classname EmployeeTest
- * @Description
- * @Date 2023/9/6 14:34
- * @Author PoffyZhang
- */
- public class EmployeeTest extends AppTests {
-
- @Autowired
- private IDingEmployeeInfoService dingEmployeeInfoService;
-
- @Autowired
- private IDingOrganizationService dingOrganizationService;
-
- @Autowired
- private IUserInfoService userInfoService;
-
- @Autowired
- private OrganizationBatchGetTask organizationBatchGetTask;
-
- @Autowired
- private EmployeeBatchGetTask employeeBatchGetTask;
-
- @Test
- public void test(){
- List<DingEmployeeInfo> employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
- .eq(DingEmployeeInfo::getEmployeeName, "吴玉斌"));
-
- for(DingEmployeeInfo employee : employees){
- UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
- .eq(UserInfo::getEmployeeCode, employee.getEmployeeCode())
- .last(BizConst.LIMIT_1));
-
- if(Objects.nonNull(user)){
- DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
- .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
- .last(BizConst.LIMIT_1));
- user.setRegionCode(RegionConst.LS_KF);
- user.setEmpPosUnitCode(employee.getEmpPosUnitCode());
- user.setEmpPosUnitName(organization.getOrganizationName());
- userInfoService.updateById(user);
- }else{
- DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
- .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
- .last(BizConst.LIMIT_1));
- UserInfo saveUser = new UserInfo();
- saveUser.setRegionCode(RegionConst.LS_KF);
- saveUser.setEmpPosUnitCode(employee.getEmpPosUnitCode());
- saveUser.setEmpPosUnitName(organization.getOrganizationName());
- saveUser.setCreateOn(LocalDateTime.now());
- saveUser.setUsername("吴玉斌");
- saveUser.setRealName("吴玉斌");
- saveUser.setUpdateOn(LocalDateTime.now());
- saveUser.setAccountId(employee.getAccountId());
- saveUser.setEmployeeCode(employee.getEmployeeCode());
- userInfoService.save(saveUser);
- }
-
- }
- }
-
- @Test
- public void test2(){
- String orgCode = "GO_4e6be07f25594df88e7bd1b7b7cdf9a8";
- organizationBatchGetTask.organizationGetSubs(orgCode);
- }
-
- @Test
- public void test3(){
- String orgCode = "GO_1aceac0b3a664afbb31ea0d627189781";
- employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);
- }
-
-
- }
|