@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RequestParam; | |||||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
/** | /** | ||||
@@ -41,4 +42,8 @@ public class DingInfoPullController { | |||||
organizationBatchGetTask.batchGetOrganizationTask(); | organizationBatchGetTask.batchGetOrganizationTask(); | ||||
} | } | ||||
@GetMapping("/employee/{regionCode}") | |||||
public void employeeBatchGetByRegionCode(@RequestParam(required = false) String regionCode) { | |||||
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode); | |||||
} | |||||
} | } |
@@ -244,6 +244,87 @@ public class EmployeeBatchGetTask { | |||||
} | } | ||||
} | } | ||||
/** | |||||
* 按区域 来更新员工 | |||||
* @param regionCode | |||||
*/ | |||||
public void batchGetEmployeeTaskByRegionCode(String regionCode) { | |||||
List<DingOrganization> units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.eq(DingOrganization::getTypeCode, "GOV_UNIT") | |||||
.eq(DingOrganization::getDivisionCode, regionCode)); | |||||
log.info("所有地区 {} 待更新员工的单位数:{}",regionCode,units.size()); | |||||
if (CollUtil.isNotEmpty(units)) { | |||||
//记录任务 单位数 | |||||
Integer index = 0; | |||||
for (DingOrganization dingOrganization : units) { | |||||
log.info("当前单位:{},下标数,{}",dingOrganization.getOrganizationName(),index); | |||||
index++; | |||||
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>(); | |||||
String organizationCode = dingOrganization.getOrganizationCode(); | |||||
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); | |||||
query.setEmployeeStatus("A"); | |||||
query.setOrganizationCode(organizationCode); | |||||
query.setReturnTotalSize(true); | |||||
query.setTenantId(zwddIntegrationProperties.getTenantId()); | |||||
int pageNo = 1; | |||||
query.setPageNo(pageNo); | |||||
query.setPageSize(PAGE_SIZE); | |||||
// 查询组织下 用户信息 | |||||
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData(); | |||||
if (Objects.isNull(data)){ | |||||
log.info("响应为空:{}",organizationCode); | |||||
continue; | |||||
} | |||||
if (CollUtil.isNotEmpty(data.getData())) { | |||||
allOrganizationEmployeePositionList.addAll(data.getData()); | |||||
} | |||||
Long totalSize = data.getTotalSize(); | |||||
log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); | |||||
log.info("totalSize :{},{}", totalSize,dingOrganization.getOrganizationName()); | |||||
if (totalSize > PAGE_SIZE) { | |||||
if (totalSize > MAX_SIZE) { | |||||
//超过1万 按1万的处理 | |||||
totalSize = MAX_SIZE.longValue(); | |||||
} | |||||
int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; | |||||
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo; | |||||
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||||
query.setPageNo(pageNo); | |||||
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); | |||||
if(pageGenericResult.isSuccess()){ | |||||
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||||
}else{ | |||||
log.error(pageGenericResult.getMsg()); | |||||
} | |||||
} | |||||
} | |||||
// 批量查询 成员的accountId | |||||
List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList = new ArrayList<>(); | |||||
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { | |||||
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); | |||||
assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); | |||||
} else { | |||||
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size()); | |||||
List<List<OrganizationEmployeePosition>> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); | |||||
for (List<OrganizationEmployeePosition> segment : split) { | |||||
assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); | |||||
} | |||||
} | |||||
// 批量保存用户信息 | |||||
saveBatch(dingEmployeeInfoSaveRecordList); | |||||
} | |||||
} | |||||
} | |||||
// if (saveList.size() <= GROUP_SIZE) { | // if (saveList.size() <= GROUP_SIZE) { | ||||
// iDingEmployeeInfoService.saveBatch(saveList); | // iDingEmployeeInfoService.saveBatch(saveList); | ||||
// } else { | // } else { | ||||
@@ -0,0 +1,34 @@ | |||||
package com.ningdatech.pmapi.filemanage.controller; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.filemanage.manage.ProjectFileManage; | |||||
import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam; | |||||
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.AllArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.*; | |||||
/** | |||||
* @Classname ProjectFileController | |||||
* @Description | |||||
* @Date 2023/6/6 15:48 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@RestController | |||||
@AllArgsConstructor | |||||
@Api(tags = "档案管理-项目档案") | |||||
@RequestMapping("/api/v1/file-manage/project-file") | |||||
@Validated | |||||
public class ProjectFileController { | |||||
private final ProjectFileManage projectFileManage; | |||||
@GetMapping("/list") | |||||
@ApiOperation(value = "档案列表", notes = "档案列表") | |||||
public PageVo<ProjectFileListVO> list(@ModelAttribute ProjectFileListParam param){ | |||||
return projectFileManage.list(param); | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
package com.ningdatech.pmapi.filemanage.manage; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam; | |||||
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @Classname ProjectFileManage | |||||
* @Description | |||||
* @Date 2023/6/6 16:04 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Component | |||||
@AllArgsConstructor | |||||
@Slf4j | |||||
public class ProjectFileManage { | |||||
private final IProjectService projectService; | |||||
public PageVo<ProjectFileListVO> list(ProjectFileListParam param) { | |||||
Page<Project> page = param.page(); | |||||
projectService.page(page,Wrappers.lambdaQuery(Project.class) | |||||
.like(StringUtils.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) | |||||
.like(StringUtils.isNotBlank(param.getBuildOrgName()),Project::getBuildOrgName,param.getBuildOrgName()) | |||||
.orderByDesc(Project::getUpdateOn)); | |||||
if(0L == page.getTotal()){ | |||||
return PageVo.empty(); | |||||
} | |||||
List<ProjectFileListVO> vos = page.getRecords().stream().map(p -> { | |||||
ProjectFileListVO vo = new ProjectFileListVO(); | |||||
vo.setId(p.getId()); | |||||
vo.setCanRead(Boolean.TRUE); | |||||
vo.setBuildOrgName(p.getBuildOrgName()); | |||||
vo.setPojectCode(p.getProjectCode()); | |||||
vo.setProjectName(p.getProjectName()); | |||||
return vo; | |||||
}).collect(Collectors.toList()); | |||||
return PageVo.of(vos,page.getTotal()); | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
package com.ningdatech.pmapi.filemanage.model.param; | |||||
import com.ningdatech.basic.model.PagePo; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* @Classname ProjectFileListParam | |||||
* @Description | |||||
* @Date 2023/6/6 16:06 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Data | |||||
public class ProjectFileListParam extends PagePo { | |||||
@ApiModelProperty("项目名称") | |||||
private String projectName; | |||||
@ApiModelProperty("项目单位") | |||||
private String buildOrgName; | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package com.ningdatech.pmapi.filemanage.model.vo; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* @Classname Documentation | |||||
* @Description | |||||
* @Date 2023/6/6 14:41 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Data | |||||
@ApiModel(value = "ProjectFileListVO", description = "资料文档") | |||||
public class ProjectFileListVO { | |||||
@ApiModelProperty("项目ID") | |||||
private Long id; | |||||
@ApiModelProperty("项目名称") | |||||
private String projectName; | |||||
@ApiModelProperty("项目单位") | |||||
private String buildOrgName; | |||||
@ApiModelProperty("项目编号") | |||||
private String pojectCode; | |||||
@ApiModelProperty("是否可阅") | |||||
private Boolean canRead = Boolean.FALSE; | |||||
@ApiModelProperty("最后修改时间") | |||||
private LocalDateTime updateOn; | |||||
} |
@@ -45,6 +45,9 @@ public class UserInfo implements Serializable { | |||||
private String regionCode; | private String regionCode; | ||||
private String empPosUnitCode; | |||||
private String empPosUnitName; | |||||
@TableField(fill = FieldFill.INSERT) | @TableField(fill = FieldFill.INSERT) | ||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
@@ -63,6 +63,7 @@ public class UserInfoManage { | |||||
String phoneNo = req.getPhoneNo(); | String phoneNo = req.getPhoneNo(); | ||||
String orgCode = req.getOrgCode(); | String orgCode = req.getOrgCode(); | ||||
String name = req.getName(); | String name = req.getName(); | ||||
String orgName = req.getOrgName(); | |||||
Long regionId = req.getRegionId(); | Long regionId = req.getRegionId(); | ||||
List<Long> userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); | List<Long> userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); | ||||
@@ -71,19 +72,14 @@ public class UserInfoManage { | |||||
pageVo.setTotal(0L); | pageVo.setTotal(0L); | ||||
return pageVo; | return pageVo; | ||||
} | } | ||||
List<String> compliantOrgEmpCodeList = getCompliantOrgEmpCodeList(req.getOrgName(), orgCode); | |||||
if (compliantOrgEmpCodeList != null && compliantOrgEmpCodeList.size() == 0) { | |||||
pageVo.setRecords(new ArrayList<>()); | |||||
pageVo.setTotal(0L); | |||||
return pageVo; | |||||
} | |||||
LambdaQueryWrapper<UserInfo> wrapper = Wrappers.lambdaQuery(UserInfo.class) | LambdaQueryWrapper<UserInfo> wrapper = Wrappers.lambdaQuery(UserInfo.class) | ||||
.like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) | .like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) | ||||
.like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) | .like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) | ||||
.in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) | .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) | ||||
.eq(Objects.nonNull(regionId), UserInfo::getRegionCode,regionId) | .eq(Objects.nonNull(regionId), UserInfo::getRegionCode,regionId) | ||||
.in(Objects.nonNull(compliantOrgEmpCodeList), UserInfo::getEmployeeCode, compliantOrgEmpCodeList) | |||||
.like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) | |||||
.eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) | |||||
.orderByDesc(UserInfo::getUpdateOn); | .orderByDesc(UserInfo::getUpdateOn); | ||||
Page<UserInfo> page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper); | Page<UserInfo> page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper); | ||||
@@ -136,7 +132,7 @@ public class UserInfoManage { | |||||
if (StringUtils.isNotBlank(orgName)) { | if (StringUtils.isNotBlank(orgName)) { | ||||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | ||||
.like(DingOrganization::getOrganizationName, orgName) | .like(DingOrganization::getOrganizationName, orgName) | ||||
.notIn(DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") | |||||
.eq(DingOrganization::getTypeCode, "GOV_UNIT") | |||||
); | ); | ||||
List<String> compliantOrgNameCodeList = dingOrganizationList.stream() | List<String> compliantOrgNameCodeList = dingOrganizationList.stream() | ||||