From 3512bafa6cf157877a08ae07505f363ee1cf9389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Wed, 18 May 2022 05:46:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=AE=97=E5=8F=8A=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xm/core/ctrl/XmProjectController.java | 3 - .../com/xm/core/ctrl/XmTaskController.java | 3 - .../main/java/com/xm/core/entity/XmPhase.java | 920 ------------------ .../com/xm/core/service/XmGroupService.java | 26 +- .../com/xm/core/service/XmPhaseService.java | 588 ----------- .../com/xm/core/service/XmProductService.java | 4 - .../com/xm/core/service/XmProjectService.java | 2 - .../main/java/com/xm/core/vo/XmPhaseVo.java | 21 - 8 files changed, 24 insertions(+), 1543 deletions(-) delete mode 100644 xm-core/src/main/java/com/xm/core/entity/XmPhase.java delete mode 100644 xm-core/src/main/java/com/xm/core/service/XmPhaseService.java delete mode 100644 xm-core/src/main/java/com/xm/core/vo/XmPhaseVo.java diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmProjectController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmProjectController.java index c5e14400..4cc14182 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmProjectController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmProjectController.java @@ -58,9 +58,6 @@ public class XmProjectController { @Autowired private XmRecordService xmRecordService; - @Autowired - private XmPhaseService xmProjectPhaseService; - @Value("${mdp.platform-branch-id:platform-branch-001}") String platformBranchId="platform-branch-001"; diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java index bf09f02d..b65453da 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java @@ -71,8 +71,6 @@ public class XmTaskController { private XmPushMsgService xmPushMsgService; @Autowired private XmProjectService xmProjectService; - @Autowired - XmPhaseService xmPhaseService; @Autowired XmMenuService xmMenusService; @@ -1085,7 +1083,6 @@ public class XmTaskController { return ResponseHelper.failed("data-0","计划任务已不存在"); } String projectId=xmTaskDb.getProjectId(); - String productId=xmTaskDb.getProductId(); tips=groupService.checkIsAdmOrTeamHeadOrAss(user,user.getUserid(),xmTaskDb.getProjectId()); if(!tips.isOk()){ return ResponseHelper.failed(tips); diff --git a/xm-core/src/main/java/com/xm/core/entity/XmPhase.java b/xm-core/src/main/java/com/xm/core/entity/XmPhase.java deleted file mode 100644 index 06819a3e..00000000 --- a/xm-core/src/main/java/com/xm/core/entity/XmPhase.java +++ /dev/null @@ -1,920 +0,0 @@ -package com.xm.core.entity; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import java.math.BigDecimal; -import java.util.Date; - -/** - * 组织 com 顶级模块 xm 大模块 core 小模块
- * 实体 XmPhase所有属性名:
- * id,name,remark,parentId,branchId,projectId,beginDate,endDate,budgetHours,budgetStaffNu,ctime,budgetNouserAt,budgetIuserAt,budgetOuserAt,baselineId,bizProcInstId,bizFlowState,budgetWorkload,actWorkload,actIuserWorkload,actOuserWorkload,taskType,planType,seqNo,budgetIuserWorkload,budgetOuserWorkload,actNouserAt,actIuserAt,budgetIuserPrice,budgetOuserPrice,budgetOuserCnt,budgetIuserCnt,actRate,pstatus,actOuserAt,taskCnt,finishTaskCnt,iterationCnt,calcTime,taskBudgetWorkload,taskBudgetAt,mngUserid,mngUsername,milestone,pleaf,tagIds,tagNames,ntype,childrenCnt,ltime,isKeyPath,pidPaths,lvl,isTpl,phaseClass,productId,budgetAt,calcType,actAt;
- * 表 xm_phase 项目、产品计划表(将计划并入任务表,暂时作废),合并进任务表了的所有字段名:
- * id,name,remark,parent_id,branch_id,project_id,begin_date,end_date,budget_hours,budget_staff_nu,ctime,budget_nouser_at,budget_iuser_at,budget_ouser_at,baseline_id,biz_proc_inst_id,biz_flow_state,budget_workload,act_workload,act_iuser_workload,act_ouser_workload,task_type,plan_type,seq_no,budget_iuser_workload,budget_ouser_workload,act_nouser_at,act_iuser_at,budget_iuser_price,budget_ouser_price,budget_ouser_cnt,budget_iuser_cnt,act_rate,pstatus,act_out_user_at,task_cnt,finish_task_cnt,iteration_cnt,calc_time,task_budget_workload,task_budget_at,mng_userid,mng_username,milestone,pleaf,tag_ids,tag_names,ntype,children_cnt,ltime,is_key_path,pid_paths,lvl,is_tpl,phase_class,product_id,budget_at,calc_type,act_at;
- * 当前主键(包括多主键):
- * id;
- */ -@ApiModel(description="项目、产品计划表(将计划并入任务表,暂时作废),合并进任务表了") -public class XmPhase implements java.io.Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(notes="阶段主键,主键",allowEmptyValue=true,example="",allowableValues="") - String id; - - - @ApiModelProperty(notes="阶段名称",allowEmptyValue=true,example="",allowableValues="") - String name; - - @ApiModelProperty(notes="备注",allowEmptyValue=true,example="",allowableValues="") - String remark; - - @ApiModelProperty(notes="上级阶段编号",allowEmptyValue=true,example="",allowableValues="") - String parentId; - - @ApiModelProperty(notes="机构编号",allowEmptyValue=true,example="",allowableValues="") - String branchId; - - @ApiModelProperty(notes="当前项目编号,如果是项目计划,必填项目",allowEmptyValue=true,example="",allowableValues="") - String projectId; - - @ApiModelProperty(notes="开始时间",allowEmptyValue=true,example="",allowableValues="") - Date beginDate; - - @ApiModelProperty(notes="结束时间",allowEmptyValue=true,example="",allowableValues="") - Date endDate; - - @ApiModelProperty(notes="工时(上到下控制大于儿子总数)-应该大于或等于task中总工时",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetHours; - - @ApiModelProperty(notes="投入人员数(上到下控制大于儿子总数)-应该大于或等于task中总人数",allowEmptyValue=true,example="",allowableValues="") - Integer budgetStaffNu; - - @ApiModelProperty(notes="创建时间",allowEmptyValue=true,example="",allowableValues="") - Date ctime; - - @ApiModelProperty(notes="非人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中非人力总成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetNouserAt; - - @ApiModelProperty(notes="内部人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetIuserAt; - - @ApiModelProperty(notes="外购人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetOuserAt; - - @ApiModelProperty(notes="项目级基线",allowEmptyValue=true,example="",allowableValues="") - String baselineId; - - @ApiModelProperty(notes="当前流程实例编号",allowEmptyValue=true,example="",allowableValues="") - String bizProcInstId; - - @ApiModelProperty(notes="当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除",allowEmptyValue=true,example="",allowableValues="") - String bizFlowState; - - @ApiModelProperty(notes="总工作量单位人时上到下控制大于儿子总数-应该大于或者等于task中的预算总工作量",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetWorkload; - - @ApiModelProperty(notes="已完成工作量单位人时-从task中的实际工作量算出",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actWorkload; - - @ApiModelProperty(notes="实际内部人力工作量-来自任务表合计",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actIuserWorkload; - - @ApiModelProperty(notes="实际外购人力工作量-来自任务表合计",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actOuserWorkload; - - @ApiModelProperty(notes="0售前方案1投标2需求3设计4开发5测试6验收7部署8运维--来自基础数据表taskType",allowEmptyValue=true,example="",allowableValues="") - String taskType; - - @ApiModelProperty(notes="计划类型w1-周,w2-2周,w3-3周,m1-1月,m2-2月,q1-季,q2-半年,y1-年",allowEmptyValue=true,example="",allowableValues="") - String planType; - - @ApiModelProperty(notes="顺序号",allowEmptyValue=true,example="",allowableValues="") - String seqNo; - - @ApiModelProperty(notes="内部人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetIuserWorkload; - - @ApiModelProperty(notes="外购人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetOuserWorkload; - - @ApiModelProperty(notes="实际非人力成本-来自任务表合计",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actNouserAt; - - @ApiModelProperty(notes="实际内部人力成本-来自任务表合计",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actIuserAt; - - @ApiModelProperty(notes="内部人力成本单价元/人时",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetIuserPrice; - - @ApiModelProperty(notes="外购人力成本单价元/人时",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetOuserPrice; - - @ApiModelProperty(notes="外购人数",allowEmptyValue=true,example="",allowableValues="") - Integer budgetOuserCnt; - - @ApiModelProperty(notes="内部人数",allowEmptyValue=true,example="",allowableValues="") - Integer budgetIuserCnt; - - @ApiModelProperty(notes="实际进度0-100",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actRate; - - @ApiModelProperty(notes="阶段状态0初始1执行中2完工3关闭4删除中5已删除6暂停",allowEmptyValue=true,example="",allowableValues="") - String pstatus; - - @ApiModelProperty(notes="实际外部人力成本",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actOuserAt; - - @ApiModelProperty(notes="任务数",allowEmptyValue=true,example="",allowableValues="") - Integer taskCnt; - - @ApiModelProperty(notes="完成的任务数",allowEmptyValue=true,example="",allowableValues="") - Integer finishTaskCnt; - - @ApiModelProperty(notes="迭代数",allowEmptyValue=true,example="",allowableValues="") - Integer iterationCnt; - - @ApiModelProperty(notes="统计数据时间",allowEmptyValue=true,example="",allowableValues="") - Date calcTime; - - @ApiModelProperty(notes="从任务汇总的预算工作量",allowEmptyValue=true,example="",allowableValues="") - BigDecimal taskBudgetWorkload; - - @ApiModelProperty(notes="从任务汇总的预算金额",allowEmptyValue=true,example="",allowableValues="") - BigDecimal taskBudgetAt; - - @ApiModelProperty(notes="管理者编号",allowEmptyValue=true,example="",allowableValues="") - String mngUserid; - - @ApiModelProperty(notes="管理者姓名",allowEmptyValue=true,example="",allowableValues="") - String mngUsername; - - @ApiModelProperty(notes="是否里程碑0否1是",allowEmptyValue=true,example="",allowableValues="") - String milestone; - - @ApiModelProperty(notes="节点是否为叶子节点",allowEmptyValue=true,example="",allowableValues="") - String pleaf; - - @ApiModelProperty(notes="标签编号,逗号分割",allowEmptyValue=true,example="",allowableValues="") - String tagIds; - - @ApiModelProperty(notes="标签名称,逗号分割",allowEmptyValue=true,example="",allowableValues="") - String tagNames; - - @ApiModelProperty(notes="节点类型0-任务,1-任务集。任务集下建任务,任务下不允许建立任何子节点",allowEmptyValue=true,example="",allowableValues="") - String ntype; - - @ApiModelProperty(notes="儿子节点个数",allowEmptyValue=true,example="",allowableValues="") - Integer childrenCnt; - - @ApiModelProperty(notes="更新时间",allowEmptyValue=true,example="",allowableValues="") - Date ltime; - - @ApiModelProperty(notes="是否为关键路径上的节点",allowEmptyValue=true,example="",allowableValues="") - String isKeyPath; - - @ApiModelProperty(notes="父级id逗号分割,最后一个为本节点节点编号,以,号结尾",allowEmptyValue=true,example="",allowableValues="") - String pidPaths; - - @ApiModelProperty(notes="层级0-顶级,1-一级,2-二级,3-三级,4-四级。总共5级",allowEmptyValue=true,example="",allowableValues="") - Integer lvl; - - @ApiModelProperty(notes="是否为模板",allowEmptyValue=true,example="",allowableValues="") - String isTpl; - - @ApiModelProperty(notes="计划分类0项目1产品",allowEmptyValue=true,example="",allowableValues="") - String phaseClass; - - @ApiModelProperty(notes="如果是产品计划,必填产品编号,其它的可不填",allowEmptyValue=true,example="",allowableValues="") - String productId; - - @ApiModelProperty(notes="预算金额",allowEmptyValue=true,example="",allowableValues="") - BigDecimal budgetAt; - - @ApiModelProperty(notes="叶子节点数据收集方式0-不计算,1-由任务汇总,2-手工填报",allowEmptyValue=true,example="",allowableValues="") - String calcType; - - @ApiModelProperty(notes="实际金额,如手工填写,则为填写金额,否则为汇总金额",allowEmptyValue=true,example="",allowableValues="") - BigDecimal actAt; - - /**阶段主键**/ - public XmPhase(String id) { - this.id = id; - } - - /**项目、产品计划表(将计划并入任务表,暂时作废),合并进任务表了**/ - public XmPhase() { - } - - /** - * 阶段主键 - **/ - public void setId(String id) { - this.id = id; - } - /** - * 阶段名称 - **/ - public void setName(String name) { - this.name = name; - } - /** - * 备注 - **/ - public void setRemark(String remark) { - this.remark = remark; - } - /** - * 上级阶段编号 - **/ - public void setParentId(String parentId) { - this.parentId = parentId; - } - /** - * 机构编号 - **/ - public void setBranchId(String branchId) { - this.branchId = branchId; - } - /** - * 当前项目编号,如果是项目计划,必填项目 - **/ - public void setProjectId(String projectId) { - this.projectId = projectId; - } - /** - * 开始时间 - **/ - public void setBeginDate(Date beginDate) { - this.beginDate = beginDate; - } - /** - * 结束时间 - **/ - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - /** - * 工时(上到下控制大于儿子总数)-应该大于或等于task中总工时 - **/ - public void setBudgetHours(BigDecimal budgetHours) { - this.budgetHours = budgetHours; - } - /** - * 投入人员数(上到下控制大于儿子总数)-应该大于或等于task中总人数 - **/ - public void setBudgetStaffNu(Integer budgetStaffNu) { - this.budgetStaffNu = budgetStaffNu; - } - /** - * 创建时间 - **/ - public void setCtime(Date ctime) { - this.ctime = ctime; - } - /** - * 非人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中非人力总成本 - **/ - public void setBudgetNouserAt(BigDecimal budgetNouserAt) { - this.budgetNouserAt = budgetNouserAt; - } - /** - * 内部人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本 - **/ - public void setBudgetIuserAt(BigDecimal budgetIuserAt) { - this.budgetIuserAt = budgetIuserAt; - } - /** - * 外购人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本 - **/ - public void setBudgetOuserAt(BigDecimal budgetOuserAt) { - this.budgetOuserAt = budgetOuserAt; - } - /** - * 项目级基线 - **/ - public void setBaselineId(String baselineId) { - this.baselineId = baselineId; - } - /** - * 当前流程实例编号 - **/ - public void setBizProcInstId(String bizProcInstId) { - this.bizProcInstId = bizProcInstId; - } - /** - * 当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除 - **/ - public void setBizFlowState(String bizFlowState) { - this.bizFlowState = bizFlowState; - } - /** - * 总工作量单位人时上到下控制大于儿子总数-应该大于或者等于task中的预算总工作量 - **/ - public void setBudgetWorkload(BigDecimal budgetWorkload) { - this.budgetWorkload = budgetWorkload; - } - /** - * 已完成工作量单位人时-从task中的实际工作量算出 - **/ - public void setActWorkload(BigDecimal actWorkload) { - this.actWorkload = actWorkload; - } - /** - * 实际内部人力工作量-来自任务表合计 - **/ - public void setActIuserWorkload(BigDecimal actIuserWorkload) { - this.actIuserWorkload = actIuserWorkload; - } - /** - * 实际外购人力工作量-来自任务表合计 - **/ - public void setActOuserWorkload(BigDecimal actOuserWorkload) { - this.actOuserWorkload = actOuserWorkload; - } - /** - * 0售前方案1投标2需求3设计4开发5测试6验收7部署8运维--来自基础数据表taskType - **/ - public void setTaskType(String taskType) { - this.taskType = taskType; - } - /** - * 计划类型w1-周,w2-2周,w3-3周,m1-1月,m2-2月,q1-季,q2-半年,y1-年 - **/ - public void setPlanType(String planType) { - this.planType = planType; - } - /** - * 顺序号 - **/ - public void setSeqNo(String seqNo) { - this.seqNo = seqNo; - } - /** - * 内部人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本 - **/ - public void setBudgetIuserWorkload(BigDecimal budgetIuserWorkload) { - this.budgetIuserWorkload = budgetIuserWorkload; - } - /** - * 外购人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本 - **/ - public void setBudgetOuserWorkload(BigDecimal budgetOuserWorkload) { - this.budgetOuserWorkload = budgetOuserWorkload; - } - /** - * 实际非人力成本-来自任务表合计 - **/ - public void setActNouserAt(BigDecimal actNouserAt) { - this.actNouserAt = actNouserAt; - } - /** - * 实际内部人力成本-来自任务表合计 - **/ - public void setActIuserAt(BigDecimal actIuserAt) { - this.actIuserAt = actIuserAt; - } - /** - * 内部人力成本单价元/人时 - **/ - public void setBudgetIuserPrice(BigDecimal budgetIuserPrice) { - this.budgetIuserPrice = budgetIuserPrice; - } - /** - * 外购人力成本单价元/人时 - **/ - public void setBudgetOuserPrice(BigDecimal budgetOuserPrice) { - this.budgetOuserPrice = budgetOuserPrice; - } - /** - * 外购人数 - **/ - public void setBudgetOuserCnt(Integer budgetOuserCnt) { - this.budgetOuserCnt = budgetOuserCnt; - } - /** - * 内部人数 - **/ - public void setBudgetIuserCnt(Integer budgetIuserCnt) { - this.budgetIuserCnt = budgetIuserCnt; - } - /** - * 实际进度0-100 - **/ - public void setActRate(BigDecimal actRate) { - this.actRate = actRate; - } - /** - * 阶段状态0初始1执行中2完工3关闭4删除中5已删除6暂停 - **/ - public void setPstatus(String pstatus) { - this.pstatus = pstatus; - } - /** - * 实际外部人力成本 - **/ - public void setActOuserAt(BigDecimal actOuserAt) { - this.actOuserAt = actOuserAt; - } - /** - * 任务数 - **/ - public void setTaskCnt(Integer taskCnt) { - this.taskCnt = taskCnt; - } - /** - * 完成的任务数 - **/ - public void setFinishTaskCnt(Integer finishTaskCnt) { - this.finishTaskCnt = finishTaskCnt; - } - /** - * 迭代数 - **/ - public void setIterationCnt(Integer iterationCnt) { - this.iterationCnt = iterationCnt; - } - /** - * 统计数据时间 - **/ - public void setCalcTime(Date calcTime) { - this.calcTime = calcTime; - } - /** - * 从任务汇总的预算工作量 - **/ - public void setTaskBudgetWorkload(BigDecimal taskBudgetWorkload) { - this.taskBudgetWorkload = taskBudgetWorkload; - } - /** - * 从任务汇总的预算金额 - **/ - public void setTaskBudgetAt(BigDecimal taskBudgetAt) { - this.taskBudgetAt = taskBudgetAt; - } - /** - * 管理者编号 - **/ - public void setMngUserid(String mngUserid) { - this.mngUserid = mngUserid; - } - /** - * 管理者姓名 - **/ - public void setMngUsername(String mngUsername) { - this.mngUsername = mngUsername; - } - /** - * 是否里程碑0否1是 - **/ - public void setMilestone(String milestone) { - this.milestone = milestone; - } - /** - * 节点是否为叶子节点 - **/ - public void setPleaf(String pleaf) { - this.pleaf = pleaf; - } - /** - * 标签编号,逗号分割 - **/ - public void setTagIds(String tagIds) { - this.tagIds = tagIds; - } - /** - * 标签名称,逗号分割 - **/ - public void setTagNames(String tagNames) { - this.tagNames = tagNames; - } - /** - * 节点类型0-任务,1-任务集。任务集下建任务,任务下不允许建立任何子节点 - **/ - public void setNtype(String ntype) { - this.ntype = ntype; - } - /** - * 儿子节点个数 - **/ - public void setChildrenCnt(Integer childrenCnt) { - this.childrenCnt = childrenCnt; - } - /** - * 更新时间 - **/ - public void setLtime(Date ltime) { - this.ltime = ltime; - } - /** - * 是否为关键路径上的节点 - **/ - public void setIsKeyPath(String isKeyPath) { - this.isKeyPath = isKeyPath; - } - /** - * 父级id逗号分割,最后一个为本节点节点编号,以,号结尾 - **/ - public void setPidPaths(String pidPaths) { - this.pidPaths = pidPaths; - } - /** - * 层级0-顶级,1-一级,2-二级,3-三级,4-四级。总共5级 - **/ - public void setLvl(Integer lvl) { - this.lvl = lvl; - } - /** - * 是否为模板 - **/ - public void setIsTpl(String isTpl) { - this.isTpl = isTpl; - } - /** - * 计划分类0项目1产品 - **/ - public void setPhaseClass(String phaseClass) { - this.phaseClass = phaseClass; - } - /** - * 如果是产品计划,必填产品编号,其它的可不填 - **/ - public void setProductId(String productId) { - this.productId = productId; - } - /** - * 预算金额 - **/ - public void setBudgetAt(BigDecimal budgetAt) { - this.budgetAt = budgetAt; - } - /** - * 叶子节点数据收集方式0-不计算,1-由任务汇总,2-手工填报 - **/ - public void setCalcType(String calcType) { - this.calcType = calcType; - } - /** - * 实际金额,如手工填写,则为填写金额,否则为汇总金额 - **/ - public void setActAt(BigDecimal actAt) { - this.actAt = actAt; - } - - /** - * 阶段主键 - **/ - public String getId() { - return this.id; - } - /** - * 阶段名称 - **/ - public String getName() { - return this.name; - } - /** - * 备注 - **/ - public String getRemark() { - return this.remark; - } - /** - * 上级阶段编号 - **/ - public String getParentId() { - return this.parentId; - } - /** - * 机构编号 - **/ - public String getBranchId() { - return this.branchId; - } - /** - * 当前项目编号,如果是项目计划,必填项目 - **/ - public String getProjectId() { - return this.projectId; - } - /** - * 开始时间 - **/ - public Date getBeginDate() { - return this.beginDate; - } - /** - * 结束时间 - **/ - public Date getEndDate() { - return this.endDate; - } - /** - * 工时(上到下控制大于儿子总数)-应该大于或等于task中总工时 - **/ - public BigDecimal getBudgetHours() { - return this.budgetHours; - } - /** - * 投入人员数(上到下控制大于儿子总数)-应该大于或等于task中总人数 - **/ - public Integer getBudgetStaffNu() { - return this.budgetStaffNu; - } - /** - * 创建时间 - **/ - public Date getCtime() { - return this.ctime; - } - /** - * 非人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中非人力总成本 - **/ - public BigDecimal getBudgetNouserAt() { - return this.budgetNouserAt; - } - /** - * 内部人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本 - **/ - public BigDecimal getBudgetIuserAt() { - return this.budgetIuserAt; - } - /** - * 外购人力成本总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本 - **/ - public BigDecimal getBudgetOuserAt() { - return this.budgetOuserAt; - } - /** - * 项目级基线 - **/ - public String getBaselineId() { - return this.baselineId; - } - /** - * 当前流程实例编号 - **/ - public String getBizProcInstId() { - return this.bizProcInstId; - } - /** - * 当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除 - **/ - public String getBizFlowState() { - return this.bizFlowState; - } - /** - * 总工作量单位人时上到下控制大于儿子总数-应该大于或者等于task中的预算总工作量 - **/ - public BigDecimal getBudgetWorkload() { - return this.budgetWorkload; - } - /** - * 已完成工作量单位人时-从task中的实际工作量算出 - **/ - public BigDecimal getActWorkload() { - return this.actWorkload; - } - /** - * 实际内部人力工作量-来自任务表合计 - **/ - public BigDecimal getActIuserWorkload() { - return this.actIuserWorkload; - } - /** - * 实际外购人力工作量-来自任务表合计 - **/ - public BigDecimal getActOuserWorkload() { - return this.actOuserWorkload; - } - /** - * 0售前方案1投标2需求3设计4开发5测试6验收7部署8运维--来自基础数据表taskType - **/ - public String getTaskType() { - return this.taskType; - } - /** - * 计划类型w1-周,w2-2周,w3-3周,m1-1月,m2-2月,q1-季,q2-半年,y1-年 - **/ - public String getPlanType() { - return this.planType; - } - /** - * 顺序号 - **/ - public String getSeqNo() { - return this.seqNo; - } - /** - * 内部人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中内部人力总成本 - **/ - public BigDecimal getBudgetIuserWorkload() { - return this.budgetIuserWorkload; - } - /** - * 外购人力工作量总预算(上到下控制大于儿子总数)-应该大于或等于task中外购总成本 - **/ - public BigDecimal getBudgetOuserWorkload() { - return this.budgetOuserWorkload; - } - /** - * 实际非人力成本-来自任务表合计 - **/ - public BigDecimal getActNouserAt() { - return this.actNouserAt; - } - /** - * 实际内部人力成本-来自任务表合计 - **/ - public BigDecimal getActIuserAt() { - return this.actIuserAt; - } - /** - * 内部人力成本单价元/人时 - **/ - public BigDecimal getBudgetIuserPrice() { - return this.budgetIuserPrice; - } - /** - * 外购人力成本单价元/人时 - **/ - public BigDecimal getBudgetOuserPrice() { - return this.budgetOuserPrice; - } - /** - * 外购人数 - **/ - public Integer getBudgetOuserCnt() { - return this.budgetOuserCnt; - } - /** - * 内部人数 - **/ - public Integer getBudgetIuserCnt() { - return this.budgetIuserCnt; - } - /** - * 实际进度0-100 - **/ - public BigDecimal getActRate() { - return this.actRate; - } - /** - * 阶段状态0初始1执行中2完工3关闭4删除中5已删除6暂停 - **/ - public String getPstatus() { - return this.pstatus; - } - /** - * 实际外部人力成本 - **/ - public BigDecimal getActOuserAt() { - return this.actOuserAt; - } - /** - * 任务数 - **/ - public Integer getTaskCnt() { - return this.taskCnt; - } - /** - * 完成的任务数 - **/ - public Integer getFinishTaskCnt() { - return this.finishTaskCnt; - } - /** - * 迭代数 - **/ - public Integer getIterationCnt() { - return this.iterationCnt; - } - /** - * 统计数据时间 - **/ - public Date getCalcTime() { - return this.calcTime; - } - /** - * 从任务汇总的预算工作量 - **/ - public BigDecimal getTaskBudgetWorkload() { - return this.taskBudgetWorkload; - } - /** - * 从任务汇总的预算金额 - **/ - public BigDecimal getTaskBudgetAt() { - return this.taskBudgetAt; - } - /** - * 管理者编号 - **/ - public String getMngUserid() { - return this.mngUserid; - } - /** - * 管理者姓名 - **/ - public String getMngUsername() { - return this.mngUsername; - } - /** - * 是否里程碑0否1是 - **/ - public String getMilestone() { - return this.milestone; - } - /** - * 节点是否为叶子节点 - **/ - public String getPleaf() { - return this.pleaf; - } - /** - * 标签编号,逗号分割 - **/ - public String getTagIds() { - return this.tagIds; - } - /** - * 标签名称,逗号分割 - **/ - public String getTagNames() { - return this.tagNames; - } - /** - * 节点类型0-任务,1-任务集。任务集下建任务,任务下不允许建立任何子节点 - **/ - public String getNtype() { - return this.ntype; - } - /** - * 儿子节点个数 - **/ - public Integer getChildrenCnt() { - return this.childrenCnt; - } - /** - * 更新时间 - **/ - public Date getLtime() { - return this.ltime; - } - /** - * 是否为关键路径上的节点 - **/ - public String getIsKeyPath() { - return this.isKeyPath; - } - /** - * 父级id逗号分割,最后一个为本节点节点编号,以,号结尾 - **/ - public String getPidPaths() { - return this.pidPaths; - } - /** - * 层级0-顶级,1-一级,2-二级,3-三级,4-四级。总共5级 - **/ - public Integer getLvl() { - return this.lvl; - } - /** - * 是否为模板 - **/ - public String getIsTpl() { - return this.isTpl; - } - /** - * 计划分类0项目1产品 - **/ - public String getPhaseClass() { - return this.phaseClass; - } - /** - * 如果是产品计划,必填产品编号,其它的可不填 - **/ - public String getProductId() { - return this.productId; - } - /** - * 预算金额 - **/ - public BigDecimal getBudgetAt() { - return this.budgetAt; - } - /** - * 叶子节点数据收集方式0-不计算,1-由任务汇总,2-手工填报 - **/ - public String getCalcType() { - return this.calcType; - } - /** - * 实际金额,如手工填写,则为填写金额,否则为汇总金额 - **/ - public BigDecimal getActAt() { - return this.actAt; - } - -} \ No newline at end of file diff --git a/xm-core/src/main/java/com/xm/core/service/XmGroupService.java b/xm-core/src/main/java/com/xm/core/service/XmGroupService.java index 882de500..7bc32680 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmGroupService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmGroupService.java @@ -374,11 +374,11 @@ public class XmGroupService extends BaseService { /** * 检查某个人是否另外一个人的组长 * @param xmGroupVoList + * @param headUserid * @param memUserid - * @param headUserid * @return */ - public boolean checkUserIsOtherUserTeamHead(List xmGroupVoList, String memUserid, String headUserid){ + public boolean checkUserIsOtherUserTeamHead(List xmGroupVoList, String headUserid, String memUserid){ if(xmGroupVoList==null || xmGroupVoList.size()==0) { return false; } @@ -390,6 +390,17 @@ public class XmGroupService extends BaseService { for (XmGroupVo ug : userGroups) { if(headUserid.equals(ug.getLeaderUserid())){ return true; + }else{ + Optional optional=xmGroupVoList.stream().filter(i->i.getId().equals(ug.getPgroupId())).findAny(); + while (optional!=null && !optional.isPresent()){ + XmGroupVo g=optional.get(); + if(headUserid.equals(g.getLeaderUserid())){ + return true; + }else{ + optional=xmGroupVoList.stream().filter(i->i.getId().equals(g.getPgroupId())).findAny(); + } + + } } } return false; @@ -414,6 +425,17 @@ public class XmGroupService extends BaseService { for (XmGroupVo ug : userGroups) { if(headUserid.equals(ug.getLeaderUserid())||headUserid.equals(ug.getAssUserid())){ return true; + }else{ + Optional optional=xmGroupVoList.stream().filter(i->i.getId().equals(ug.getPgroupId())).findAny(); + while (optional!=null && !optional.isPresent()){ + XmGroupVo g=optional.get(); + if(headUserid.equals(g.getLeaderUserid())||headUserid.equals(g.getAssUserid())){ + return true; + }else{ + optional=xmGroupVoList.stream().filter(i->i.getId().equals(g.getPgroupId())).findAny(); + } + + } } } return false; diff --git a/xm-core/src/main/java/com/xm/core/service/XmPhaseService.java b/xm-core/src/main/java/com/xm/core/service/XmPhaseService.java deleted file mode 100644 index e7fd0525..00000000 --- a/xm-core/src/main/java/com/xm/core/service/XmPhaseService.java +++ /dev/null @@ -1,588 +0,0 @@ -package com.xm.core.service; - -import com.mdp.core.entity.Tips; -import com.mdp.core.service.BaseService; -import com.mdp.core.utils.NumberUtil; -import com.mdp.safe.client.entity.User; -import com.mdp.safe.client.utils.LoginUtils; -import com.xm.core.entity.XmPhase; -import com.xm.core.vo.XmGroupVo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.
- * 组织 com.qqkj 顶级模块 oa 大模块 xm 小模块
- * 实体 XmProjectPhase 表 XM.xm_phase 当前主键(包括多主键): id; - ***/ -@Service("xm.core.xmProjectPhaseService") -public class XmPhaseService extends BaseService { - - /** 请在此类添加自定义函数 */ - - @Autowired - XmRecordService xmRecordService; - - @Autowired - XmGroupService groupService; - /** - * 查询项目及计划总预算,用于判断是否超出预算 - */ - public Map selectTotalProjectAndPhaseBudgetCost(String projectId,List excludePhaseIds){ - Map p=new HashMap<>(); - p.put("projectId", projectId); - p.put("excludePhaseIds", excludePhaseIds); - return this.selectOne("selectTotalProjectAndPhaseBudgetCost", p); - } - public Tips checkUserHasQxToOperProjectPhase(String projectId,String mngUserid,String mngUsername,String myUserid){ - Tips tips = new Tips("成功"); - List groupVoList=groupService.getProjectGroupVoList(projectId); - User user = LoginUtils.getCurrentUserInfo(); - boolean meIsPm=groupService.checkUserIsProjectManager(groupVoList,user.getUserid()); - boolean meIsTeamHead=groupService.checkUserIsOtherUserTeamHead(groupVoList,user.getUserid(),user.getUserid()); - if( !meIsPm && !meIsTeamHead ){ - tips.setFailureMsg("您不是组长、也不是项目管理者,不允许设置计划负责人"); - return tips; - } - boolean meIsHisTeamHead=groupService.checkUserIsOtherUserTeamHead(groupVoList,mngUserid,myUserid); - if( !meIsPm && !meIsHisTeamHead ){ - tips.setFailureMsg("您不是"+mngUsername+"的组长,不允许设置其为计划负责人"); - return tips; - } - return tips; - } - @Transactional - public int insert(XmPhase parameter) { - int i= super.insert(parameter); - if(StringUtils.hasText(parameter.getParentId())){ - sumParents(parameter); - } - - return i; - } - - - @Transactional - public int deleteByPk(XmPhase parameter) { - int i= super.deleteByPk(parameter); - if(StringUtils.hasText(parameter.getParentId())){ - sumParents(parameter); - } - return i; - } - - /** - * 判断新增预算是否超出项目总预算 - * @param projectId - * @param addPhaseBudgetCost - * @param addBudgetIuserAt - * @param addBudgetOuserAt - * @param addBudgetNouserAt - * @param excludePhaseIds - * @return - */ - public Tips judgetProjectBudget(String projectId, BigDecimal addPhaseBudgetCost, BigDecimal addBudgetIuserAt, BigDecimal addBudgetOuserAt, BigDecimal addBudgetNouserAt, List excludePhaseIds){ - Tips tips=new Tips("检查预算成功"); - Map g=this.selectTotalProjectAndPhaseBudgetCost(projectId,excludePhaseIds); - BigDecimal phaseBudgetCost=BigDecimal.ZERO; - BigDecimal zero=BigDecimal.ZERO; - - if(addPhaseBudgetCost==null) { - addPhaseBudgetCost=BigDecimal.ZERO; - } - if(addBudgetIuserAt==null) { - addBudgetIuserAt=BigDecimal.ZERO; - } - if(addBudgetOuserAt==null) { - addBudgetOuserAt=BigDecimal.ZERO; - } - if(addBudgetNouserAt==null) { - addBudgetNouserAt=BigDecimal.ZERO; - } - if(g==null || g.isEmpty()){ - - } - BigDecimal phaseBudgetIuserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetIuserAt"),zero); - BigDecimal phaseBudgetOuserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetOuserAt"),zero); - BigDecimal phaseBudgetNouserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetNouserAt"),zero); - - BigDecimal planIuserAt=NumberUtil.getBigDecimal(g.get("planIuserAt"),zero); - BigDecimal planOuserAt=NumberUtil.getBigDecimal(g.get("planOuserAt"),zero); - BigDecimal planNouserAt=NumberUtil.getBigDecimal(g.get("planNouserAt"),zero); - BigDecimal planTotalCost=NumberUtil.getBigDecimal(g.get("planTotalCost"),zero); - - if(addBudgetIuserAt.add(phaseBudgetIuserAt).compareTo(planIuserAt)>0) { - tips.setFailureMsg("内部人力预算超出项目内部人力预算"+addBudgetIuserAt.add(phaseBudgetIuserAt).subtract(planIuserAt)+"元"); - return tips; - } - if(addBudgetOuserAt.add(phaseBudgetOuserAt).compareTo(planOuserAt)>0) { - tips.setFailureMsg("外部人力预算超出项目外部人力预算"+addBudgetOuserAt.add(phaseBudgetOuserAt).subtract(planOuserAt)+"元"); - return tips; - } - if(addBudgetNouserAt.add(phaseBudgetNouserAt).compareTo(planNouserAt)>0) { - tips.setFailureMsg("非人力预算超出项目非人力预算"+addBudgetNouserAt.add(phaseBudgetNouserAt).subtract(planNouserAt)+"元"); - return tips; - } - - BigDecimal phaseBudgetAt=phaseBudgetCost.add(phaseBudgetIuserAt).add(phaseBudgetOuserAt).add(phaseBudgetNouserAt); - phaseBudgetAt=phaseBudgetAt.add(addPhaseBudgetCost); - if(phaseBudgetAt.compareTo(planTotalCost)>0) { - tips.setFailureMsg("计划总体预算超出项目总预算"+phaseBudgetAt.subtract(planTotalCost)+"元"); - return tips; - }else { - return tips; - } - - } - @Transactional - public int[] doBatchDelete(List batchValues) { - int[] result= super.batchDelete(batchValues); - batchSumParents(batchValues); - return result; - } - - public XmPhase autoCalcWorkload(XmPhase phase) { - BigDecimal phaseBudgetHours=NumberUtil.getBigDecimal(phase.getBudgetHours(),BigDecimal.ZERO); - BigDecimal phaseBudgetIuserCnt=NumberUtil.getBigDecimal(phase.getBudgetIuserCnt(),BigDecimal.ZERO); - BigDecimal phaseBudgetOuserCnt=NumberUtil.getBigDecimal(phase.getBudgetOuserCnt(),BigDecimal.ZERO); - phase.setBudgetIuserWorkload(phaseBudgetIuserCnt.multiply(phaseBudgetHours)); - phase.setBudgetOuserWorkload(phaseBudgetOuserCnt.multiply(phaseBudgetHours)); - phase.setBudgetWorkload(phase.getBudgetIuserWorkload().add(phase.getBudgetOuserWorkload())); - return phase; - - } - /** - * 计算bug、task、测试案例、等数据 - * @param projectId - * @return - */ - public int loadTasksToXmProjectPhase(String projectId) { - - return this.update("loadTasksToXmProjectPhase", projectId); - } - - /** - * 计算bug、task、测试案例、等数据 - * @param productId - * @return - */ - public int loadTasksToXmProductPhase(String productId) { - - return this.update("loadTasksToXmProductPhase", productId); - } - public Long checkExistsTask(String phaseId) { - Long i= this.selectOne("checkExistsTask", phaseId); - return i; - } - public void updateChildrenCntByIds(List ids) { - super.update("updateChildrenCntByIds",ids); - } - - public void updatePhaseChildrenCntByPhaseId(String phaseId){ - super.update("updatePhaseChildrenCntByPhaseId",phaseId); - } - - public Long checkExistsChildren(String phaseId) { - Long i= this.selectOne("checkExistsChildren", phaseId); - return i; - } - - /** - * 检查是否能删除干净所有儿子孙子节点。 - * @param delNode 当前删除节点 - * @param delNodes 本批量需要删除的全部节点 - * @return - */ - public boolean checkCanDelAllChild(XmPhase delNode, List delNodes) { - if(delNode==null){ - return true; - } - if(delNode.getChildrenCnt()==null||delNode.getChildrenCnt()<=0){ - return true; - } - List childList=delNodes.stream().filter(i->delNode.getId().equals(i.getParentId())).collect(Collectors.toList()); - if(childList==null||childList.size() inserts, List updates) { - List addList=inserts; - List editList=updates; - List all=new ArrayList<>(); - if(addList.size()>0) { - all.addAll(addList); - this.batchInsert(addList); - - } - if(editList.size()>0) { - all.addAll(editList); - this.batchUpdate(editList); - } - this.batchSumParents(all); - } - - public void calcKeyPaths(String projectId) { - - } - - @Transactional - public void doBatchInsert(List xmProjectPhases) { - for (XmPhase xmProjectPhase : xmProjectPhases) { - long childrenCnt=xmProjectPhases.stream().filter(i->xmProjectPhase.getId().equals(i.getParentId())).count(); - xmProjectPhase.setChildrenCnt(Integer.valueOf(childrenCnt+"")); - if(childrenCnt>0){ - xmProjectPhase.setNtype("1"); - } - } - super.batchInsert(xmProjectPhases); - batchSumParents(xmProjectPhases); - } - - - public List parentIdPathsCalcBeforeSave(List nodes) { - List noExistsList=nodes.stream().filter(i->!nodes.stream().filter(k->k.getId().equals(i.getParentId())).findAny().isPresent()).collect(Collectors.toList()); - noExistsList=noExistsList.stream().filter(i->StringUtils.hasText(i.getParentId())).collect(Collectors.toList()); - Map hadCalcMap=new HashMap<>(); - for (XmPhase node : noExistsList) { - if(hadCalcMap.containsKey(node.getParentId())){ - String idPaths=hadCalcMap.get(node.getParentId()); - node.setPidPaths(idPaths+node.getId()+","); - }else{ - this.parentIdPathsCalcBeforeSave(node); - String idPaths=node.getPidPaths(); - idPaths=idPaths.substring(0,idPaths.length()-node.getId().length()-1); - hadCalcMap.put(node.getParentId(),idPaths); - } - } - for (XmPhase node : nodes) { - if(!StringUtils.hasText(node.getParentId())){ - node.setPidPaths("0,"+node.getId()+","); - continue; - } - if(hadCalcMap.containsKey(node.getParentId())){ - String idPaths=hadCalcMap.get(node.getParentId()); - node.setPidPaths(idPaths+node.getId()+","); - }else{ - List pnodeList=this.getParentList(node,nodes); - if(pnodeList==null ||pnodeList.size()==0){ - node.setPidPaths("0,"+node.getParentId()+","+node.getId()+","); - continue; - } - XmPhase topParent=pnodeList.get(pnodeList.size()-1); - String idPath="0,"; - if(hadCalcMap.containsKey(topParent.getParentId())){ - idPath=hadCalcMap.get(topParent.getParentId()); - } - for (int i = pnodeList.size() - 1; i >= 0; i--) { - idPath=idPath+pnodeList.get(i).getId()+","; - } - node.setPidPaths(idPath+node.getId()+","); - } - } - for (XmPhase node : nodes) { - String idPaths=node.getPidPaths(); - String[] idpss=idPaths.split(","); - node.setLvl(idpss.length-1); - } - return nodes; - } - - public static void main(String[] args) { - String idpaths="0,1,2,3,"; - String[] idpss=idpaths.split(","); - int lvl=idpss.length; - - } - - public Tips parentIdPathsCalcBeforeSave(XmPhase currNode) { - Tips tips = new Tips("成功"); - if (!StringUtils.hasText(currNode.getParentId()) || "0".equals(currNode.getParentId())) { - currNode.setPidPaths("0," + currNode.getId() + ","); - currNode.setLvl(1); - return tips; - } else { - List parentList=this.getParentList(currNode); - if(parentList==null ||parentList.size()==0){ - currNode.setPidPaths("0,"+currNode.getParentId()+","+currNode.getId()+","); - currNode.setLvl(2); - return tips; - } - String idPath="0,"; - for (int i = parentList.size() - 1; i >= 0; i--) { - idPath=idPath+parentList.get(i).getId()+","; - } - currNode.setPidPaths(idPath+currNode.getId()+","); - - String idPaths=currNode.getPidPaths(); - String[] idpss=idPaths.split(","); - currNode.setLvl(idpss.length-1); - } - return tips; - } - - private List getParentList(XmPhase currNode){ - List parentList=new ArrayList<>(); - XmPhase current=currNode; - while (true){ - if(!StringUtils.hasText(current.getParentId()) || "0".equals(current.getParentId())){ - return parentList; - } - XmPhase query=new XmPhase(); - query.setId(current.getParentId()); - current=this.selectOneObject(query); - if(current==null){ - return parentList; - } - parentList.add(current); - } - } - - private List getParentList(XmPhase currNode, List nodes){ - List parentList=new ArrayList<>(); - XmPhase current=currNode; - while (true){ - if(!StringUtils.hasText(current.getParentId()) || "0".equals(current.getParentId())){ - return parentList; - } - XmPhase query=new XmPhase(); - query.setId(current.getParentId()); - Optional optional=nodes.stream().filter(i->i.getId().equals(query.getId())).findFirst(); - if(!optional.isPresent()){ - current=optional.get(); - parentList.add(current); - }else { - return parentList; - } - } - } - - - @Transactional - public void sumParents(XmPhase node){ - String id=node.getId(); - String pidPaths=node.getPidPaths(); - if(!StringUtils.hasText(pidPaths)){ - return; - } - if(!pidPaths.startsWith("0,")){ - return; - } - if("0".equals(node.getNtype())){ - pidPaths=pidPaths.substring(2,pidPaths.indexOf(id)); - }else{ - pidPaths=pidPaths.substring(2); - } - - if(!StringUtils.hasText(pidPaths)){ - return; - } - String[] pidPathss=pidPaths.split(","); - List pidPathsList=new ArrayList<>(); - for (int i = pidPathss.length-1; i >=0; i--) { - pidPathsList.add(pidPathss[i]); - } - if(pidPathsList.size()>0){ - super.update("sumParents",pidPathsList ); - } - - } - @Transactional - public void batchSumParents(List xmProjectPhases) { - List> list=new ArrayList<>(); - for (XmPhase node : xmProjectPhases) { - String id=node.getId(); - String pidPaths=node.getPidPaths(); - if(!StringUtils.hasText(pidPaths)){ - continue; - } - if(!pidPaths.startsWith("0,")){ - continue; - } - if("0".equals(node.getNtype())){ - pidPaths=pidPaths.substring(2,pidPaths.indexOf(id)); - }else{ - pidPaths=pidPaths.substring(2); - } - - if(!StringUtils.hasText(pidPaths)){ - continue; - } - String[] pidPathss=pidPaths.split(","); - for (int i = 0; i ()); - } - Set set=list.get(i); - set.add(pidPathss[i]); - } - if(list.size()<=0){ - return; - } - Set allSet=new HashSet<>(); - for (int i = list.size() - 1; i >= 0; i--) { - Set set=list.get(i); - if(set.size()>0){ - List ids=set.stream().filter(k->!allSet.contains(k)).collect(Collectors.toList()); - if(ids.size()>0){ - allSet.addAll(ids.stream().collect(Collectors.toSet())); - super.update("batchSumParents", ids); - } - - } - - } - - - } - - } - - @Transactional - public void editByPk(XmPhase xmProjectPhase) { - super.updateByPk(xmProjectPhase); - this.sumParents(xmProjectPhase); - } - - - /** - * 判断新增预算是否超出产品总预算 - * @param productId - * @param addPhaseBudgetCost - * @param addBudgetIuserAt - * @param addBudgetOuserAt - * @param addBudgetNouserAt - * @param excludePhaseIds - * @return - */ - public Tips judgetProductBudget(String productId,BigDecimal addPhaseBudgetCost,BigDecimal addBudgetIuserAt,BigDecimal addBudgetOuserAt,BigDecimal addBudgetNouserAt,List excludePhaseIds){ - Tips tips=new Tips("检查预算成功"); - Map g=this.selectTotalProductAndPhaseBudgetCost(productId,excludePhaseIds); - BigDecimal phaseBudgetCost=BigDecimal.ZERO; - BigDecimal zero=BigDecimal.ZERO; - - if(addPhaseBudgetCost==null) { - addPhaseBudgetCost=BigDecimal.ZERO; - } - if(addBudgetIuserAt==null) { - addBudgetIuserAt=BigDecimal.ZERO; - } - if(addBudgetOuserAt==null) { - addBudgetOuserAt=BigDecimal.ZERO; - } - if(addBudgetNouserAt==null) { - addBudgetNouserAt=BigDecimal.ZERO; - } - BigDecimal phaseBudgetIuserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetIuserAt"),zero); - BigDecimal phaseBudgetOuserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetOuserAt"),zero); - BigDecimal phaseBudgetNouserAt=NumberUtil.getBigDecimal(g.get("phaseBudgetNouserAt"),zero); - - /** - * - p.pbudget_workload, - p.pbudget_amount, - p.pmenu_budget_workload, - p.pmenu_budget_amount - */ - BigDecimal pbudgetWorkload=NumberUtil.getBigDecimal(g.get("pbudgetWorkload"),zero); - BigDecimal planTotalCost=NumberUtil.getBigDecimal(g.get("pbudgetAmount"),zero); - - - BigDecimal phaseBudgetAt=phaseBudgetCost.add(phaseBudgetIuserAt).add(phaseBudgetOuserAt).add(phaseBudgetNouserAt); - phaseBudgetAt=phaseBudgetAt.add(addPhaseBudgetCost); - if(phaseBudgetAt.compareTo(planTotalCost)>0) { - tips.setFailureMsg("计划总体预算超出产品总预算"+phaseBudgetAt.subtract(planTotalCost)+"元"); - return tips; - }else { - return tips; - } - - } - - /** - * 查询产品及计划总预算,用于判断是否超出预算 - */ - public Map selectTotalProductAndPhaseBudgetCost(String productId,List excludePhaseIds){ - Map p=new HashMap<>(); - p.put("productId", productId); - p.put("excludePhaseIds", excludePhaseIds); - return this.selectOne("selectTotalProductAndPhaseBudgetCost", p); - } - public Map selectPhaseBudgetCost(String phaseId,List excludePhaseIds){ - Map p=new HashMap<>(); - p.put("id", phaseId); - p.put("excludePhaseIds", excludePhaseIds); - return this.selectOne("selectPhaseBudgetCost", p); - } - - public void calcPhaseBudgetAmount(XmPhase phase){ - if(phase.getBudgetIuserAt()==null){ - phase.setBudgetIuserAt(BigDecimal.ZERO); - } - if(phase.getBudgetNouserAt()==null){ - phase.setBudgetNouserAt(BigDecimal.ZERO); - } - if(phase.getBudgetOuserAt()==null){ - phase.setBudgetOuserAt(BigDecimal.ZERO); - } - if(phase.getBudgetAt()==null){ - phase.setBudgetAt(BigDecimal.ZERO); - } - phase.setBudgetAt(phase.getBudgetIuserAt().add(phase.getBudgetNouserAt()).add(phase.getBudgetOuserAt())); - } - - /** - * res2.id, - * res2.phase_budget_workload, - * res2.phase_budget_nouser_at, - * res2.phase_budget_iuser_at, - * res2.phase_budget_ouser_at, - * res2.phase_budget_at, - * res0.child_phase_budget_workload, - * res0.child_phase_budget_nouser_at, - * res0.child_phase_budget_iuser_at, - * res0.child_phase_budget_ouser_at, - * res0.child_phase_budget_at - * @param parentPhaseId - * @param phaseBudgetCost - * @param phaseBudgetIuserAt - * @param phaseBudgetOuserAt - * @param phaseBudgetNouserAt - * @param excludePhaseIds - * @return - */ - public Tips judgetPhaseBudget(String parentPhaseId, BigDecimal phaseBudgetCost, BigDecimal phaseBudgetIuserAt, BigDecimal phaseBudgetOuserAt, BigDecimal phaseBudgetNouserAt, List excludePhaseIds) { - Tips tips= new Tips("检查通过"); - Map phaseBudget=this.selectPhaseBudgetCost(parentPhaseId,excludePhaseIds); - if(phaseBudget==null || phaseBudget.isEmpty()){ - tips.setFailureMsg("计划不存在"); - }else{ - BigDecimal childBudgetAt=NumberUtil.getBigDecimal(phaseBudget.get("childBudgetAt"),BigDecimal.ZERO); - - BigDecimal phaseBudgetAt=NumberUtil.getBigDecimal(phaseBudget.get("phaseBudgetAt"),BigDecimal.ZERO); - - if(childBudgetAt.add(phaseBudgetCost).compareTo(phaseBudgetAt)>0){ - tips.setFailureMsg("预算金额超出剩余预算金额"+childBudgetAt.add(phaseBudgetCost).subtract(phaseBudgetAt)+"元"); - } - } - return tips; - } - - public int loaMenusToXmProductPhase(String productId) { - return super.update("loaMenusToXmProductPhase",productId); - } -} - diff --git a/xm-core/src/main/java/com/xm/core/service/XmProductService.java b/xm-core/src/main/java/com/xm/core/service/XmProductService.java index 80476c60..c4b100e3 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmProductService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmProductService.java @@ -44,10 +44,6 @@ public class XmProductService extends BaseService { @Autowired XmGroupUserService groupUserService; - - @Autowired - XmPhaseService xmProjectPhaseService; - @Autowired XmProductProjectLinkService linkService; diff --git a/xm-core/src/main/java/com/xm/core/service/XmProjectService.java b/xm-core/src/main/java/com/xm/core/service/XmProjectService.java index bd499433..24f132e0 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmProjectService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmProjectService.java @@ -58,8 +58,6 @@ public class XmProjectService extends BaseService { @Autowired XmProjectCacheService xmProjectCacheService; - @Autowired - XmPhaseService xmProjectPhaseService; @Autowired XmGroupService groupService; diff --git a/xm-core/src/main/java/com/xm/core/vo/XmPhaseVo.java b/xm-core/src/main/java/com/xm/core/vo/XmPhaseVo.java deleted file mode 100644 index 51175336..00000000 --- a/xm-core/src/main/java/com/xm/core/vo/XmPhaseVo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.xm.core.vo; - -import com.xm.core.entity.XmPhase; - -public class XmPhaseVo extends XmPhase { - private static final long serialVersionUID = 1534268338972176747L; - - /** - * addSub,edit,delete - */ - String opType=""; - - public String getOpType() { - return opType; - } - - public void setOpType(String opType) { - this.opType = opType; - } - -}