Parcourir la source

Merge branch 'master' of http://git.ningdatech.com/liushuai/project-management into 20230904-project-collection-2.0

 Conflicts:
	pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
	pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
tags/24080901
PoffyZhang il y a 1 an
Parent
révision
30812afb2d
10 fichiers modifiés avec 170 ajouts et 11 suppressions
  1. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java
  2. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  3. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  4. +45
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java
  7. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java
  8. +5
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  9. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  10. +96
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java Voir le fichier

@@ -24,6 +24,8 @@ public interface RegionConst {
* 丽水行政区划编码
*/
String RC_LS = "331100";
String LS_KF = "331118";
String LS_KF_IRS = "331151";
String RC_LS_SBJ_IRS = "331101";
//遂昌县
String RC_SC = "331123";


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Voir le fichier

@@ -89,6 +89,11 @@ public class DingInfoPullController {
organizationBatchGetTask.organizationGetSubs(orgCode);
}

@GetMapping("/organization-sub/{orgCode}")
public void organizationSubGetOrgs(@PathVariable String orgCode) {
organizationBatchGetTask.organizationSubGetOrgs(orgCode);
}

@GetMapping("/employeeByRegionCode/{regionCode}")
public void employeeBatchGetByRegionCode(@PathVariable String regionCode) {
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode);


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Voir le fichier

@@ -223,8 +223,8 @@ public class EmployeeBatchGetTask {
String employeeCode = dingEmployeeInfo.getEmployeeCode();

DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmpPosUnitCode, dingEmployeeInfo.getEmpPosUnitCode())
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode));
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode)
.last(BizConst.LIMIT_1));
if (Objects.isNull(employeeInfo)) {
iDingEmployeeInfoService.save(dingEmployeeInfo);
} else {
@@ -261,6 +261,12 @@ public class EmployeeBatchGetTask {
iUserInfoService.save(userInfo);
}else{
userInfo.setAvatar(dingEmployeeInfo.getAvatar());
userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode());
if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode());
userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName());
userInfo.setRegionCode(dingOrganization.getDivisionCode());
}
iUserInfoService.updateById(userInfo);
}
}


+ 45
- 6
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java Voir le fichier

@@ -45,6 +45,9 @@ public class OrganizationBatchGetTask {
@Autowired
private IDingOrganizationService iDingOrganizationService;

@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

/**
* 获取浙政钉组织架构
*/
@@ -115,17 +118,28 @@ public class OrganizationBatchGetTask {
.eq(DingOrganization::getOrganizationCode, orgCode)
.last(BizConst.LIMIT_1));
// 顶级组织code
List<String> topOrgCodes = Lists.newArrayList(orgCode);
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(topOrgCodes);
log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult));
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
GenericResult<PageSubOrganizationCodeDTO> subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode);
log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult));
PageSubOrganizationCodeDTO data = subOrganizationResult.getData();
List<String> subOrganizationCodeList = data.getSubOrganizationCodeList();

if(Objects.isNull(subOrganizationCodeList)){
log.info("subOrganizationCodeList为null");
return;
}

for(DingOrgInfoDTO dingOrgInfo : dingOrgInfoDtos){
employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);

for(String subOrganizationCode : subOrganizationCodeList){
GenericResult<DingOrgInfoDTO> organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode);
DingOrgInfoDTO dingOrgInfo = organizationByCode.getData();
DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode())
.last(BizConst.LIMIT_1));
if(Objects.nonNull(old)){
log.info("该单位已经存在 :{}",old.getOrganizationName());
organizationGetSubs(dingOrgInfo.getOrganizationCode());
// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(dingOrgInfo.getOrganizationCode());
continue;
}

@@ -142,11 +156,36 @@ public class OrganizationBatchGetTask {
organization.setGmtCreate(LocalDateTime.now());
organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode());
organization.setParentName(dingOrgInfo.getParentName());
iDingOrganizationService.save(organization);
if(iDingOrganizationService.save(organization)){
organizationGetSubs(organization.getOrganizationCode());
// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode());
}
}

log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode);
}

/**
* 查看下 当前的子单位信息
* @param orgCode
*/
public void organizationSubGetOrgs(String orgCode) {
// 顶级组织code
GenericResult<PageSubOrganizationCodeDTO> subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode);
log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult));
PageSubOrganizationCodeDTO data = subOrganizationResult.getData();
List<String> subOrganizationCodeList = data.getSubOrganizationCodeList();

if(Objects.isNull(subOrganizationCodeList)){
log.info("subOrganizationCodeList为null");
return;
}

for(String subOrganizationCode : subOrganizationCodeList){
GenericResult<DingOrgInfoDTO> organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode);
DingOrgInfoDTO dingOrgInfo = organizationByCode.getData();
log.info("dingOrgInfo :{}",JSON.toJSONString(dingOrgInfo));
}
}

private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java Voir le fichier

@@ -55,6 +55,9 @@ public class GovBizProjectBaseinfoDTO implements Serializable {
@ApiModelProperty("上级主管单位钉id")
private String baseProvManDeprtDing;

@ApiModelProperty("是否省级 1省级 2非省级")
private Integer baseProvManDeprtType;

@ApiModelProperty("本级主管单位")
private String baseManDeprt;



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java Voir le fichier

@@ -57,6 +57,9 @@ public class GovBizProjectBaseinfo implements Serializable {
@ApiModelProperty("信息是否有效")
private String isEffective;

@ApiModelProperty("是否省级 1省级 2非省级")
private Integer baseProvManDeprtType;

@ApiModelProperty("上级主管单位")
private String baseProvManDeprt;



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java Voir le fichier

@@ -51,6 +51,9 @@ public class GovBizProjectBaseinfoVO implements Serializable {
@ApiModelProperty("信息是否有效")
private String isEffective;

@ApiModelProperty("是否省级 1省级 2非省级")
private Integer baseProvManDeprtType;

@ApiModelProperty("上级主管单位")
private String baseProvManDeprt;



+ 5
- 2
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java Voir le fichier

@@ -235,10 +235,11 @@ public class AppIrsManage {
"&appKey=" + searchAppKey + "&pageSize=1000&" +
"pageNum=1&areaCode=" + areaCode +
"&deptCode=&name=";
log.info("查询应用目录:{}",url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info("查询应用目录 : {}", forEntity.getStatusCode());
log.info("查询应用目录 : {}", forEntity.getBody());

if (Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody());
@@ -260,13 +261,15 @@ public class AppIrsManage {
}

/**
* 如果是市本级的 结尾改成01
* 如果是市本级的 结尾改成01 还要转换开发区的code
* @param areaCode
* @return
*/
private String convertAreaCode(String areaCode) {
if(RegionConst.RC_LS.equals(areaCode)){
return RegionConst.RC_LS_SBJ_IRS;
}else if(RegionConst.LS_KF.equals(areaCode)){
return RegionConst.LS_KF_IRS;
}
return areaCode;
}


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java Voir le fichier

@@ -109,7 +109,6 @@ public class PerformanceAppraisalPlanManage {
if(CollUtil.isEmpty(page.getRecords())){
return PageVo.empty();
}

List<Long> paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList());
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getAppraisalId, paIds));


+ 96
- 0
pmapi/src/test/java/com/ningdatech/pmapi/employee/EmployeeTest.java Voir le fichier

@@ -0,0 +1,96 @@
package com.ningdatech.pmapi.employee;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.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);
}


}

Chargement…
Annuler
Enregistrer