Pārlūkot izejas kodu

更新员工信息

master
PoffyZhang pirms 1 gada
vecāks
revīzija
cacec73b3e
4 mainītis faili ar 67 papildinājumiem un 0 dzēšanām
  1. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +50
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java
  4. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Parādīt failu

@@ -48,4 +48,14 @@ public class DingInfoPullController {
public void employeeBatchGetByOrdCode(@PathVariable String orgCode) {
employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);
}

@GetMapping("/getEmployeeByCode/{empCode}")
public void getEmployeeByCode(@PathVariable String empCode) {
employeeBatchGetTask.getEmployeeByCode(empCode);
}

@GetMapping("/getBatchEmployeeByCode/{orgCode}")
public void getBatchEmployeeByCode(@PathVariable String orgCode) {
employeeBatchGetTask.getBatchEmployeeByCode(orgCode);
}
}

+ 50
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Parādīt failu

@@ -19,6 +19,7 @@ import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO;
import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO;
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition;
@@ -245,6 +246,7 @@ public class EmployeeBatchGetTask {
.createOn(LocalDateTime.now())
.updateOn(LocalDateTime.now())
.empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode())
.avatar(dingEmployeeInfo.getAvatar())
.build();
if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode());
@@ -252,6 +254,10 @@ public class EmployeeBatchGetTask {
userInfo.setRegionCode(dingOrganization.getDivisionCode());
}
iUserInfoService.save(userInfo);
}else{
userInfo.setAvatar(dingEmployeeInfo.getAvatar());
userInfo.setUpdateOn(LocalDateTime.now());
iUserInfoService.updateById(userInfo);
}
}

@@ -409,4 +415,48 @@ public class EmployeeBatchGetTask {

}

/**
* 更新员工信息 主要是头像
* @param empCode
*/
public void getEmployeeByCode(String empCode) {
GenericResult<EmployeeInfoDTO> result = zwddClient.getEmployeeByCode(empCode);
log.error("请求员工信息 result:{}",JSON.toJSONString(result));
if(!result.isSuccess()){
log.error("请求员工信息失败 :{},mesg:{}",empCode,result.getMsg());
}
EmployeeInfoDTO data = result.getData();

DingEmployeeInfo emp = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmployeeCode, empCode)
.last(BizConst.LIMIT_1));

if(Objects.nonNull(emp)){
emp.setAvatar(data.getGovEmpAvatar());
iDingEmployeeInfoService.updateById(emp);
}

UserInfo user = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, empCode)
.last(BizConst.LIMIT_1));

if(Objects.nonNull(user)){
user.setAvatar(data.getGovEmpAvatar());
iUserInfoService.updateById(user);
}
}

/**
* 更新一整个单位的
* @param orgCode
*/
public void getBatchEmployeeByCode(String orgCode) {

List<DingEmployeeInfo> employees = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode));

for(DingEmployeeInfo employee : employees){
getEmployeeByCode(employee.getEmployeeCode());
}
}
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingEmployeeInfo.java Parādīt failu

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
@@ -78,4 +79,6 @@ public class DingEmployeeInfo implements Serializable {
*/
private String bindUserMobile;

@ApiModelProperty("头像")
private String avatar;
}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java Parādīt failu

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -48,6 +49,9 @@ public class UserInfo implements Serializable {
private String empPosUnitCode;
private String empPosUnitName;

@ApiModelProperty("头像")
private String avatar;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;



Notiek ielāde…
Atcelt
Saglabāt