杭州市委办项管
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

97 行
3.7KB

  1. package com.hz.pm.api.employee;
  2. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  3. import com.hz.pm.api.AppTests;
  4. import com.hz.pm.api.common.model.constant.BizConst;
  5. import com.hz.pm.api.common.model.constant.RegionConst;
  6. import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
  7. import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
  8. import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
  9. import com.hz.pm.api.organization.model.entity.DingOrganization;
  10. import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
  11. import com.hz.pm.api.organization.service.IDingOrganizationService;
  12. import com.hz.pm.api.user.entity.UserInfo;
  13. import com.hz.pm.api.user.service.IUserInfoService;
  14. import org.junit.Test;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import java.time.LocalDateTime;
  17. import java.util.List;
  18. import java.util.Objects;
  19. /**
  20. * @Classname EmployeeTest
  21. * @Description
  22. * @Date 2023/9/6 14:34
  23. * @Author PoffyZhang
  24. */
  25. public class EmployeeTest extends AppTests {
  26. @Autowired
  27. private IDingEmployeeInfoService dingEmployeeInfoService;
  28. @Autowired
  29. private IDingOrganizationService dingOrganizationService;
  30. @Autowired
  31. private IUserInfoService userInfoService;
  32. @Autowired
  33. private OrganizationBatchGetTask organizationBatchGetTask;
  34. @Autowired
  35. private EmployeeBatchGetTask employeeBatchGetTask;
  36. @Test
  37. public void test(){
  38. List<DingEmployeeInfo> employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
  39. .eq(DingEmployeeInfo::getEmployeeName, "吴玉斌"));
  40. for(DingEmployeeInfo employee : employees){
  41. UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
  42. .eq(UserInfo::getEmployeeCode, employee.getEmployeeCode())
  43. .last(BizConst.LIMIT_1));
  44. if(Objects.nonNull(user)){
  45. DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
  46. .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
  47. .last(BizConst.LIMIT_1));
  48. user.setRegionCode(RegionConst.LS_KF);
  49. user.setEmpPosUnitCode(employee.getEmpPosUnitCode());
  50. user.setEmpPosUnitName(organization.getOrganizationName());
  51. userInfoService.updateById(user);
  52. }else{
  53. DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
  54. .eq(DingOrganization::getOrganizationCode, employee.getOrganizationCode())
  55. .last(BizConst.LIMIT_1));
  56. UserInfo saveUser = new UserInfo();
  57. saveUser.setRegionCode(RegionConst.LS_KF);
  58. saveUser.setEmpPosUnitCode(employee.getEmpPosUnitCode());
  59. saveUser.setEmpPosUnitName(organization.getOrganizationName());
  60. saveUser.setCreateOn(LocalDateTime.now());
  61. saveUser.setUsername("吴玉斌");
  62. saveUser.setRealName("吴玉斌");
  63. saveUser.setUpdateOn(LocalDateTime.now());
  64. saveUser.setAccountId(employee.getAccountId());
  65. saveUser.setEmployeeCode(employee.getEmployeeCode());
  66. userInfoService.save(saveUser);
  67. }
  68. }
  69. }
  70. @Test
  71. public void test2(){
  72. String orgCode = "GO_4e6be07f25594df88e7bd1b7b7cdf9a8";
  73. organizationBatchGetTask.organizationGetSubs(orgCode);
  74. }
  75. @Test
  76. public void test3(){
  77. String orgCode = "GO_1aceac0b3a664afbb31ea0d627189781";
  78. employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);
  79. }
  80. }