# Conflicts: # pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.javamaster
@@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { | |||
} | |||
public static void main(String[] args) { | |||
generate("Lierbao", "signature", PATH_LXX, "nd_company_signature"); | |||
generate("Lierbao", "organization", PATH_LXX, "ding_employee_info"); | |||
} | |||
} |
@@ -10,6 +10,7 @@ import com.ningdatech.zwdd.model.Page; | |||
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; | |||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.ArrayList; | |||
@@ -20,6 +21,7 @@ import java.util.List; | |||
* @date 2023/2/10 上午9:52 | |||
*/ | |||
@Component | |||
public class EmployeeBatchGetTask { | |||
private final static Integer PAGE_SIZE = 20; | |||
@@ -48,27 +50,23 @@ public class EmployeeBatchGetTask { | |||
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData(); | |||
if (CollUtil.isNotEmpty(data.getData())) { | |||
allOrganizationEmployeePositionList.addAll(data.getData()); | |||
} | |||
Long totalSize = data.getTotalSize(); | |||
if (totalSize > PAGE_SIZE) { | |||
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE); | |||
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||
query.setPageNo(maxPageNo); | |||
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||
if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) { | |||
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||
} | |||
} | |||
} else { | |||
} | |||
} | |||
// zwddClient.pageOrganizationEmployeePositions(query); | |||
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.organization.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.stereotype.Controller; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-11 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.organization/ding-employee-info") | |||
public class DingEmployeeInfoController { | |||
} |
@@ -0,0 +1,71 @@ | |||
package com.ningdatech.pmapi.organization.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-11 | |||
*/ | |||
@TableName("ding_employee_info") | |||
@Data | |||
@ApiModel(value = "DingEmployeeInfo对象", description = "") | |||
public class DingEmployeeInfo implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
private Long id; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private Long createBy; | |||
private Long updateBy; | |||
private String emplyeeName; | |||
private String gmtCreate; | |||
private String empGender; | |||
private String empPoliticalStatusCode; | |||
private String empJobLevelCode; | |||
private String empBudgetedPostCode; | |||
private String status; | |||
private String posJobRankCode; | |||
private String orderInOrganization; | |||
private String mainJob; | |||
private String empPosUnitCode; | |||
private String empPosEmployeeRoleCode; | |||
private String empPosInnerInstitutionCode; | |||
private String employeeCode; | |||
private String jobAttributesCode; | |||
private String organizationCode; | |||
private String empPosVirtualOrganizationCode; | |||
private String empStatus; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.organization.mapper; | |||
import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-11 | |||
*/ | |||
public interface DingEmployeeInfoMapper extends BaseMapper<DingEmployeeInfo> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.organization.mapper.DingEmployeeInfoMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.organization.service; | |||
import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-11 | |||
*/ | |||
public interface IDingEmployeeInfoService extends IService<DingEmployeeInfo> { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.organization.service.impl; | |||
import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; | |||
import com.ningdatech.pmapi.organization.mapper.DingEmployeeInfoMapper; | |||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-11 | |||
*/ | |||
@Service | |||
public class DingEmployeeInfoServiceImpl extends ServiceImpl<DingEmployeeInfoMapper, DingEmployeeInfo> implements IDingEmployeeInfoService { | |||
} |
@@ -1,5 +1,7 @@ | |||
package com.ningdatech.pmapi.projectdeclared.entity.dto; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
@@ -35,4 +37,12 @@ public class DeclaredProjectDto implements Serializable { | |||
@NotNull | |||
private ProcessInstanceUserDto user; | |||
public Map<String,Object> getFormData(){ | |||
if(CollUtil.isNotEmpty(this.formData)){ | |||
this.formData = Maps.newHashMap(); | |||
return this.formData; | |||
} | |||
return this.formData; | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.ningdatech.pmapi.projectdeclared.entity.dto; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
/** | |||
* @Classname DeclaredProjectDto | |||
* @Description 申报项目 里的条件判断实体 | |||
* @Date 2023/2/1 14:52 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@Builder | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
public class ProjectConditionDto implements Serializable { | |||
private Long projectId; | |||
@ApiModelProperty("申报金额") | |||
private BigDecimal declareAmount; | |||
@ApiModelProperty("是否临时增补 0:否 1:是") | |||
private Integer isTemporaryAugment; | |||
@ApiModelProperty("是否数字化改革项目 0:否 1:是") | |||
private Integer isDigitalReform; | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.projectdeclared.manage; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
@@ -16,6 +17,7 @@ import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDeclaredListItemVO; | |||
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo; | |||
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
@@ -70,8 +72,8 @@ public class DeclaredProjectManage { | |||
.eq(Objects.nonNull(params.getProjectStatus()), Project::getStatus, params.getProjectStatus()) | |||
.like(StringUtils.isNotBlank(params.getProjectName()), Project::getProjectName, params.getProjectName()) | |||
.orderByDesc(Project::getUpdateOn); | |||
projectService.page(page,wrapper); | |||
if(0L == page.getTotal()){ | |||
projectService.page(page, wrapper); | |||
if (0L == page.getTotal()) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectDeclaredListItemVO> res = page.getRecords().stream().map(record -> { | |||
@@ -79,7 +81,7 @@ public class DeclaredProjectManage { | |||
BeanUtils.copyProperties(record, vo); | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
public ProjectDeclaredDetailVO detail(Long id) { | |||
@@ -103,8 +105,8 @@ public class DeclaredProjectManage { | |||
.eq(Objects.nonNull(params.getProjectStatus()), ProjectDraft::getProjectStatusSecond, params.getProjectStatus()) | |||
.like(StringUtils.isNotBlank(params.getProjectName()), ProjectDraft::getProjectName, params.getProjectName()) | |||
.orderByDesc(ProjectDraft::getUpdateOn); | |||
projectDraftService.page(page,wrapper); | |||
if(0L == page.getTotal()){ | |||
projectDraftService.page(page, wrapper); | |||
if (0L == page.getTotal()) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectDraftVo> res = page.getRecords().stream().map(record -> { | |||
@@ -112,7 +114,7 @@ public class DeclaredProjectManage { | |||
BeanUtils.copyProperties(record, vo); | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
public ProjectDraftVo draftDatail(Long id) { | |||
@@ -124,6 +126,7 @@ public class DeclaredProjectManage { | |||
/** | |||
* 启动实例 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@@ -135,25 +138,44 @@ public class DeclaredProjectManage { | |||
.eq(WflowModels::getFormName, ProjectProessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getDesc()) | |||
.last("limit 1")); | |||
if(Objects.isNull(model)){ | |||
throw new BusinessException(String.format("此 【%s】区域找不到流程配置",regionCode)); | |||
if (Objects.isNull(model)) { | |||
throw new BusinessException(String.format("此 【%s】区域找不到流程配置", regionCode)); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
dto.getFormData().putAll( | |||
JSON.parseObject(JSON.toJSONString(dto.getProjectInfo()), new TypeReference<Map<String, Object>>() { | |||
})); | |||
ProjectConditionDto conditionDto = new ProjectConditionDto(); | |||
BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); | |||
if (Objects.nonNull(conditionDto)) { | |||
dto.getFormData().putAll( | |||
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() { | |||
}) | |||
); | |||
} | |||
params.setFormData(dto.getFormData()); | |||
String instanceId = processService.startProcess(model.getProcessDefId(), params); | |||
log.info("申报项目成功 【{}】",instanceId); | |||
String instanceId = processService.startProcess(model.getProcessDefId(), params); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
//保存项目 | |||
saveProject(dto.getProjectInfo(), instanceId, regionCode); | |||
return instanceId; | |||
} | |||
/** | |||
* 申报项目 时 新增项目到项目库 | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
*/ | |||
private void saveProject(ProjectDto projectDto, String instanceId, String regionCode) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try{ | |||
try { | |||
//保存项目表信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(dto.getProjectInfo(),project); | |||
BeanUtils.copyProperties(projectDto, project); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setAreaCode(regionCode); | |||
@@ -161,23 +183,32 @@ public class DeclaredProjectManage { | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
project.setInstCode(instanceId); | |||
projectService.save(project); | |||
}catch (Exception e){ | |||
log.error("项目信息入库错误 ",e); | |||
throw new BusinessException("项目信息入库错误 请注意格式"); | |||
//保存项目应用 | |||
if (CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||
ProjectApplication projectApplication = new ProjectApplication(); | |||
BeanUtils.copyProperties(application, projectApplication); | |||
projectApplication.setProjectId(project.getId()); | |||
return projectApplication; | |||
}).collect(Collectors.toList()); | |||
projectApplicationService.saveBatch(applications); | |||
} | |||
} catch (Exception e) { | |||
log.error("项目信息入库错误 ", e); | |||
throw new BusinessException("项目信息入库错误 :" + e.getMessage()); | |||
} | |||
return instanceId; | |||
} | |||
/** | |||
* 保存至草稿箱 | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
public Long saveToDraft(ProjectDraftSaveDto dto) { | |||
ProjectDraft draft = new ProjectDraft(); | |||
BeanUtils.copyProperties(dto,draft); | |||
if(Objects.isNull(draft.getId())){ | |||
BeanUtils.copyProperties(dto, draft); | |||
if (Objects.isNull(draft.getId())) { | |||
draft.setCreateOn(LocalDateTime.now()); | |||
} | |||
draft.setUpdateOn(LocalDateTime.now()); | |||
@@ -29,7 +29,7 @@ public class ProjectApplication implements Serializable { | |||
private Long id; | |||
@ApiModelProperty("项目ID") | |||
private String projectId; | |||
private Long projectId; | |||
@ApiModelProperty("是否初次建设 0否 1是") | |||
private Integer isFirst; | |||