diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index 956116a..cf56c30 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -298,7 +298,6 @@ public class DelayedApplyManage { .eq(ProjectDelayApply::getProjectId, projectId) .orderByDesc(ProjectDelayApply::getCreateOn) .last(BizConst.LIMIT_1)); - if(Objects.isNull(delayApply)){ return null; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java index 7d9360c..58ad501 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java @@ -54,4 +54,7 @@ public class ProjectDelayApply implements Serializable { @ApiModelProperty("延期申请实例ID") private String instanceId; + + @ApiModelProperty("是否审批成功") + private Boolean success; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java new file mode 100644 index 0000000..68b5532 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.sys.contants; + +/** + * @Classname UserGuidanceContant + * @Description + * @Date 2023/8/8 14:56 + * @Author PoffyZhang + */ +public interface UserGuidanceContant { + + Integer ALL_FINISHED_NUM = 3; + + class OrgModel { + public static final String GUIDANCE_NAME = "配置单位流程"; + public static final String GUIDANCE_REMARK = "用户项目审核,请先配置单位默认流程"; + public static final String GUIDANCE_PATH1 = "unitSet/flowPathConfiguration"; + public static final String GUIDANCE_PATH2 = "unitSet/unitConfigEdit?processDefId="; + } + + class FiscalCode { + public static final String GUIDANCE_NAME = "配置财政编码"; + public static final String GUIDANCE_REMARK = "用于生成项目唯一编码"; + public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; + } + + class Signature { + public static final String GUIDANCE_NAME = "配置财政编码"; + public static final String GUIDANCE_REMARK = "用于生成项目唯一编码"; + public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java new file mode 100644 index 0000000..dff983d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.sys.controller; + +import com.ningdatech.pmapi.sys.manage.UserGuidanceManage; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Classname UserGuidanceController + * @Description + * @Date 2023/8/8 13:46 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/sys/user-guidanc") +@Api(value = "UserGuidance", tags = "用户引导") +@RequiredArgsConstructor +public class UserGuidanceController { + + private final UserGuidanceManage userGuidanceManage; + + @ApiOperation(value = "获取当前用户单位的一些配置是否完成", notes = "获取当前用户单位的一些配置是否完成") + @GetMapping("/detail") + public UserGuidanceVO detail() { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + return userGuidanceManage.detailUserGuidance(user); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java index 6df1577..674da96 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java @@ -66,14 +66,17 @@ public class EarlyWarningManage { case PROCESS_WARNING: content = convertContent(noticeContent,project.getProjectName(), InstTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); break; case DECLARED_WARNING: content = convertContent(noticeContent,project.getProjectName(), WarningFlowTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); break; case OPERATION_WARNING: content = convertContent(noticeContent,project.getProjectName(), WarningOperationTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); break; default: log.info("匹配不到 规则类型"); @@ -90,7 +93,6 @@ public class EarlyWarningManage { records.setNoticeMethod(noticeMethod); records.setNoticeContent(content); records.setProjectName(project.getProjectName()); - records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); records.setWarningEmployeecode(employeeCode); earlyWarningRecordsService.save(records); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java new file mode 100644 index 0000000..7da38fb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java @@ -0,0 +1,133 @@ +package com.ningdatech.pmapi.sys.manage; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; +import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; +import com.ningdatech.pmapi.signature.entity.CompanySignature; +import com.ningdatech.pmapi.signature.service.ICompanySignatureService; +import com.ningdatech.pmapi.sys.contants.UserGuidanceContant; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceDetailVO; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.wflow.bean.entity.WflowOrgModels; +import com.wflow.enums.ProcessDefTypeEnum; +import com.wflow.service.OrgProcdefService; +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.Objects; + +/** + * @Classname UserGuidanceManage + * @Description + * @Date 2023/8/8 13:49 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class UserGuidanceManage { + + private final OrgProcdefService orgProcdefService; + + private final ICompanyFiscalCodeService fiscalCodeService; + + private final ICompanySignatureService signatureService; + + /** + * 查询用户引导 详情 + * @param user + * @return + */ + public UserGuidanceVO detailUserGuidance(UserInfoDetails user) { + UserGuidanceVO vo = new UserGuidanceVO(); + //单位code + String empPosUnitCode = user.getEmpPosUnitCode(); + vo.setEmpPosUnitCode(empPosUnitCode); + //用户信息 + String username = user.getUsername(); + vo.setUsername(username); + Long userId = user.getUserId(); + vo.setUserId(userId); + + //查询引导详情 + List details = Lists.newArrayList(); + UserGuidanceDetailVO orgModelGuidance = new UserGuidanceDetailVO(); + orgModelGuidance.setName(UserGuidanceContant.OrgModel.GUIDANCE_NAME); + orgModelGuidance.setRemark(UserGuidanceContant.OrgModel.GUIDANCE_REMARK); + + Integer finishedNum = 0; + //1.去查询 用户所在单位 有没有单位默认流程配置 并且process 不能为空 + WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, empPosUnitCode) + .eq(WflowOrgModels::getType, ProcessDefTypeEnum.DEFAULT.name()) + .eq(WflowOrgModels::getIsDelete, Boolean.FALSE) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(orgModel)){ + orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH1); + orgModelGuidance.setIsFinish(Boolean.FALSE); + }else{ + orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH2 + orgModel.getProcessDefId()); + //判断process是否为空 + if(StringUtils.isNotBlank(orgModel.getProcess())){ + orgModelGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + orgModelGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(orgModelGuidance); + + //2.去查询 财政编码 印章编码 + UserGuidanceDetailVO fiscalCodeGuidance = new UserGuidanceDetailVO(); + fiscalCodeGuidance.setName(UserGuidanceContant.FiscalCode.GUIDANCE_NAME); + fiscalCodeGuidance.setRemark(UserGuidanceContant.FiscalCode.GUIDANCE_REMARK); + fiscalCodeGuidance.setPath(UserGuidanceContant.FiscalCode.GUIDANCE_PATH); + CompanyFiscalCode fiscalCode = fiscalCodeService.getOne(Wrappers.lambdaQuery(CompanyFiscalCode.class) + .eq(CompanyFiscalCode::getOrganizationCode, empPosUnitCode) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(fiscalCode)){ + fiscalCodeGuidance.setIsFinish(Boolean.FALSE); + }else{ + //判断fiscalCode是否为空 + if(StringUtils.isNotBlank(fiscalCode.getFiscalCode())){ + fiscalCodeGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + fiscalCodeGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(fiscalCodeGuidance); + + UserGuidanceDetailVO signatureGuidance = new UserGuidanceDetailVO(); + signatureGuidance.setName(UserGuidanceContant.Signature.GUIDANCE_NAME); + signatureGuidance.setRemark(UserGuidanceContant.Signature.GUIDANCE_REMARK); + signatureGuidance.setPath(UserGuidanceContant.Signature.GUIDANCE_PATH); + CompanySignature signature = signatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, empPosUnitCode) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(signature)){ + signatureGuidance.setIsFinish(Boolean.FALSE); + }else{ + //判断印章编码是否为空 + if(StringUtils.isNotBlank(signature.getSealSn())){ + signatureGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + signatureGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(signatureGuidance); + + if(UserGuidanceContant.ALL_FINISHED_NUM.equals(finishedNum)){ + vo.setIsAllFinished(Boolean.TRUE); + } + vo.setDetails(details); + return vo; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java new file mode 100644 index 0000000..f4819d1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java @@ -0,0 +1,46 @@ +package com.ningdatech.pmapi.sys.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + * @Classname UserGuidanceDetailVO + * @Description + * @Date 2023/8/8 14:24 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "UserGuidanceDetailVO", description = "用户引导详情VO") +public class UserGuidanceDetailVO { + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 是否完成 + */ + @ApiModelProperty(value = "是否完成") + private Boolean isFinish; + + /** + * 事项名称 + */ + @ApiModelProperty(value = "事项名称") + private String name; + + /** + * 备注 描述 + */ + @ApiModelProperty(value = "备注 描述") + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java new file mode 100644 index 0000000..da3ff89 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java @@ -0,0 +1,51 @@ +package com.ningdatech.pmapi.sys.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @Classname UserGuidanceVO + * @Description + * @Date 2023/8/8 14:24 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "UserGuidanceVO", description = "用户引导VO") +public class UserGuidanceVO { + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + private Long userId; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名") + private String username; + + /** + * 单位code + */ + @ApiModelProperty(value = "单位code") + private String empPosUnitCode; + + /** + * 是否全部完成 + */ + @ApiModelProperty(value = "是否全部完成") + private Boolean isAllFinished = Boolean.FALSE; + + @ApiModelProperty(value = "详情") + private List details; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 3cac81b..ebecf9f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -243,6 +243,9 @@ public class HandlerManage { ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) .eq(ProjectDelayApply::getProjectId, declaredProject.getId()) .eq(ProjectDelayApply::getInstanceId, instanceId)); + delayApply.setSuccess(Boolean.FALSE); + delayApply.setUpdateOn(LocalDateTime.now()); + projectDelayApplyService.updateById(delayApply); // 获取项目的立项批复时间和建设周期 LocalDateTime approvalDate = declaredProject.getApprovalDate(); String buildCycle = declaredProject.getBuildCycle();