diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index fe5ff53..e326099 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -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"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java index 279b65f..ab797aa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java @@ -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> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); Page 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> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) { allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); - } } - } else { - } + + } // zwddClient.pageOrganizationEmployeePositions(query); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingEmployeeInfoController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingEmployeeInfoController.java new file mode 100644 index 0000000..46358ef --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingEmployeeInfoController.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.organization.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +@Controller +@RequestMapping("/pmapi.organization/ding-employee-info") +public class DingEmployeeInfoController { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/DingEmployeeInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/DingEmployeeInfo.java new file mode 100644 index 0000000..f844808 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/entity/DingEmployeeInfo.java @@ -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; + +/** + *

+ * + *

+ * + * @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; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.java new file mode 100644 index 0000000..d82ff5a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.organization.mapper; + +import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +public interface DingEmployeeInfoMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml new file mode 100644 index 0000000..138e8ff --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/mapper/DingEmployeeInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java new file mode 100644 index 0000000..13d78c9 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/IDingEmployeeInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.organization.service; + +import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +public interface IDingEmployeeInfoService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java new file mode 100644 index 0000000..14803e8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/service/impl/DingEmployeeInfoServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author Lierbao + * @since 2023-02-11 + */ +@Service +public class DingEmployeeInfoServiceImpl extends ServiceImpl implements IDingEmployeeInfoService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java index 44ce29e..9692307 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/DeclaredProjectDto.java @@ -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 getFormData(){ + if(CollUtil.isNotEmpty(this.formData)){ + this.formData = Maps.newHashMap(); + return this.formData; + } + return this.formData; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectConditionDto.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectConditionDto.java new file mode 100644 index 0000000..4e60030 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/entity/dto/ProjectConditionDto.java @@ -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; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index c091aeb..c211e70 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -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 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 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>() { - })); + ProjectConditionDto conditionDto = new ProjectConditionDto(); + BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto); + if (Objects.nonNull(conditionDto)) { + dto.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + } 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 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()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java index 8916463..1e9e569 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java @@ -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;