浏览代码

更新报告

jihs 4 年之前
父节点
当前提交
90507ad31c
共有 20 个文件被更改,包括 402 次插入113 次删除
  1. 24 0
      src/main/java/org/jeecg/common/dto/invoice/PurchaseDataDTO.java
  2. 36 0
      src/main/java/org/jeecg/common/dto/payment/SlipAllListDTO.java
  3. 7 3
      src/main/java/org/jeecg/common/dto/report/ProStatisticsThreeRespDTO.java
  4. 2 2
      src/main/java/org/jeecg/modules/archives/service/impl/projectManageBusinessOtherServiceImpl.java
  5. 4 0
      src/main/java/org/jeecg/modules/invoice/entity/InvoiceManagePurchase.java
  6. 5 6
      src/main/java/org/jeecg/modules/invoice/mapper/InvoiceManagePurchaseMapper.java
  7. 13 0
      src/main/java/org/jeecg/modules/invoice/mapper/xml/InvoiceManagePurchaseMapper.xml
  8. 7 0
      src/main/java/org/jeecg/modules/invoice/service/InvoiceManagePurchaseService.java
  9. 11 0
      src/main/java/org/jeecg/modules/invoice/service/impl/InvoiceManagePurchaseServiceImpl.java
  10. 4 0
      src/main/java/org/jeecg/modules/payment/entity/ManagerPaymentAndReceiptSlip.java
  11. 8 0
      src/main/java/org/jeecg/modules/payment/mapper/ManagerPaymentAndReceiptSlipMapper.java
  12. 20 0
      src/main/java/org/jeecg/modules/payment/mapper/xml/ManagerPaymentAndReceiptSlipMapper.xml
  13. 5 0
      src/main/java/org/jeecg/modules/payment/service/ManagerPaymentAndReceiptSlipService.java
  14. 14 0
      src/main/java/org/jeecg/modules/payment/service/impl/ManagerPaymentAndReceiptSlipServiceImpl.java
  15. 4 0
      src/main/java/org/jeecg/modules/prowork/entity/ProWorkMilestone.java
  16. 6 0
      src/main/java/org/jeecg/modules/prowork/service/ProWorkMilestoneService.java
  17. 10 0
      src/main/java/org/jeecg/modules/prowork/service/impl/ProWorkMilestoneServiceImpl.java
  18. 40 0
      src/main/java/org/jeecg/modules/report/entity/ChoosePlanTypeEnum.java
  19. 10 10
      src/main/java/org/jeecg/modules/report/mapper/xml/ProReportMapper.xml
  20. 172 92
      src/main/java/org/jeecg/modules/report/service/impl/ProReportServiceImpl.java

+ 24 - 0
src/main/java/org/jeecg/common/dto/invoice/PurchaseDataDTO.java

@@ -0,0 +1,24 @@
+package org.jeecg.common.dto.invoice;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.math.BigDecimal;
+
+@ApiModel("采购发票,销售发票主子表数据")
+@Data
+public class PurchaseDataDTO {
+    private String type;
+    @ApiModelProperty("项目档案--子表id(里程碑信息表)")
+    private String coArchivesId;
+    @ApiModelProperty("收付款条线")
+    private String coArchivesName;
+    @ApiModelProperty("里程碑档案id")
+    private String proBusinessId;
+    @ApiModelProperty("项目档案里程碑(项目档案—商务,页签中的收款计划)")
+    private String proArchivesMilestone;
+    private BigDecimal coPrice;
+
+    public PurchaseDataDTO() {
+    }
+}

+ 36 - 0
src/main/java/org/jeecg/common/dto/payment/SlipAllListDTO.java

@@ -0,0 +1,36 @@
+package org.jeecg.common.dto.payment;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.math.BigDecimal;
+
+@Data
+@ApiModel("收付单主子表数据")
+public class SlipAllListDTO {
+    @ApiModelProperty("id")
+    private String id;
+    @ApiModelProperty("单据编号")
+    private String billcode;
+    @ApiModelProperty("1.收款单 2.付款单")
+    private String type;
+    @ApiModelProperty("项目id")
+    private String proId;
+    @ApiModelProperty("项目名称")
+    private String proName;
+    @ApiModelProperty("项目编码")
+    private String proCode;
+    @ApiModelProperty("项目档案--里程碑id")
+    private String proArchivesId;
+    @ApiModelProperty("项目档案--里程碑")
+    private String proArchivesMilestone;
+    @ApiModelProperty("收款条线档案id")
+    private String coArchivesId;
+    @ApiModelProperty("收付款条线档案名称")
+    private String coArchivesName;
+    @ApiModelProperty("收款金额")
+    private BigDecimal coPrvice;
+
+    public SlipAllListDTO() {
+    }
+}

+ 7 - 3
src/main/java/org/jeecg/common/dto/report/ProStatisticsThreeRespDTO.java

@@ -3,6 +3,8 @@ package org.jeecg.common.dto.report;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.modules.archives.entity.ProjectManageBusinessOther;
 import java.math.BigDecimal;
@@ -12,6 +14,8 @@ import java.util.List;
 @ApiModel("项目情况统计表--里程碑响应数据")
 public class ProStatisticsThreeRespDTO {
     @ApiModelProperty("里程碑名称")
+    @Getter
+    @Setter
     private String milesName;
     @ApiModelProperty("里程碑计划开始时间")
     private Date mileStartDate;
@@ -34,7 +38,7 @@ public class ProStatisticsThreeRespDTO {
     @ApiModelProperty("里程碑计划付款")
     private BigDecimal milePayPlan;
     @ApiModelProperty("里程碑收票金额")
-    private String mileTicket;
+    private BigDecimal mileTicket;
     @ApiModelProperty("里程碑实际付款")
     private BigDecimal mileRealPayment;
     @ApiModelProperty("title")
@@ -143,11 +147,11 @@ public class ProStatisticsThreeRespDTO {
         this.milePayPlan = milePayPlan;
     }
 
-    public String getMileTicket() {
+    public BigDecimal getMileTicket() {
         return mileTicket;
     }
 
-    public void setMileTicket(String mileTicket) {
+    public void setMileTicket(BigDecimal mileTicket) {
         this.mileTicket = mileTicket;
     }
 

+ 2 - 2
src/main/java/org/jeecg/modules/archives/service/impl/projectManageBusinessOtherServiceImpl.java

@@ -39,10 +39,10 @@ public class projectManageBusinessOtherServiceImpl extends ServiceImpl<ProjectMa
     @Override
     public List<ProjectManageBusinessOther> getAll(ProjectManageBusinessOther other) {
         LambdaQueryWrapper<ProjectManageBusinessOther> lambdaQueryWrapper = new LambdaQueryWrapper<ProjectManageBusinessOther>()
-                .eq(ProjectManageBusinessOther::getDelFlag, "0");
+                .eq(ProjectManageBusinessOther::getDelFlag, "0").eq(ProjectManageBusinessOther::getParentId, "0");
         if(StringUtils.isNotBlank(other.getId())){
             lambdaQueryWrapper.eq(ProjectManageBusinessOther::getId, other.getId());
         }
-        return list();
+        return list(lambdaQueryWrapper);
     }
 }

+ 4 - 0
src/main/java/org/jeecg/modules/invoice/entity/InvoiceManagePurchase.java

@@ -76,4 +76,8 @@ public class InvoiceManagePurchase implements Serializable {
 		this.delFlag = "0";
 		this.pkOrg = reqDTO.getPkOrg();
 	}
+
+	public InvoiceManagePurchase(String proArchivesId) {
+		this.proArchivesId = proArchivesId;
+	}
 }

+ 5 - 6
src/main/java/org/jeecg/modules/invoice/mapper/InvoiceManagePurchaseMapper.java

@@ -1,12 +1,11 @@
 package org.jeecg.modules.invoice.mapper;
 
-import java.math.BigDecimal;
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
+import org.jeecg.common.dto.invoice.PurchaseDataDTO;
 import org.jeecg.modules.invoice.entity.InvoiceManagePurchase;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
 
 /**
  * @Description: 采购,销售发票
@@ -17,7 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 @Mapper
 public interface InvoiceManagePurchaseMapper extends BaseMapper<InvoiceManagePurchase> {
     /**
-     * @desc 将相同里程碑id与收付款条线的数据
+     * @desc 获取主子表数据
      */
-    void updateOrgData(String proBusinessId, String coArchivesId, BigDecimal uncoPrice);
+    List<PurchaseDataDTO> getAll(QueryWrapper<InvoiceManagePurchase> queryWrapper);
 }

+ 13 - 0
src/main/java/org/jeecg/modules/invoice/mapper/xml/InvoiceManagePurchaseMapper.xml

@@ -1,5 +1,18 @@
 <?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="org.jeecg.modules.invoice.mapper.InvoiceManagePurchaseMapper">
+   <select id="getAll" resultType="org.jeecg.common.dto.invoice.PurchaseDataDTO">
+       SELECT
+			 a.type,
+			 b.co_archives_id,
+			 b.co_archives_name,
+			 b.pro_business_id,
+			 b.pro_archives_milestone,
+			 b.co_price
+       FROM invoice_manage_purchase a
+       JOIN invoice_manage_pirchase_detail b
+       ON a.id = b.purchase_id
+       WHERE a.del_flag = '0' AND b.del_flag = '0'
+   </select>
 
 </mapper>

+ 7 - 0
src/main/java/org/jeecg/modules/invoice/service/InvoiceManagePurchaseService.java

@@ -1,9 +1,11 @@
 package org.jeecg.modules.invoice.service;
 
 import org.jeecg.common.dto.invoice.PurchaseAddReqDTO;
+import org.jeecg.common.dto.invoice.PurchaseDataDTO;
 import org.jeecg.common.dto.invoice.PurchaseRespDTO;
 import org.jeecg.modules.invoice.entity.InvoiceManagePurchase;
 import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
 
 /**
  * @Description: 采购,销售发票
@@ -28,4 +30,9 @@ public interface InvoiceManagePurchaseService extends IService<InvoiceManagePurc
      * @desc 通过id查询
      */
     PurchaseRespDTO queryById(String id);
+
+    /**
+     * @desc 获取列表数据
+     */
+    List<PurchaseDataDTO> getAll(InvoiceManagePurchase purchase);
 }

+ 11 - 0
src/main/java/org/jeecg/modules/invoice/service/impl/InvoiceManagePurchaseServiceImpl.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.invoice.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
 import org.jeecg.common.dto.invoice.PurchaseAddReqDTO;
+import org.jeecg.common.dto.invoice.PurchaseDataDTO;
 import org.jeecg.common.dto.invoice.PurchaseDetailAddReqDTO;
 import org.jeecg.common.dto.invoice.PurchaseDetailListRespDTO;
 import org.jeecg.common.dto.invoice.PurchaseRespDTO;
@@ -137,6 +138,16 @@ public class InvoiceManagePurchaseServiceImpl extends ServiceImpl<InvoiceManageP
         return respDTO;
     }
 
+    /**
+     * @desc 获取主子表数据
+     */
+    @Override
+    public List<PurchaseDataDTO> getAll(InvoiceManagePurchase purchase) {
+        QueryWrapper<InvoiceManagePurchase> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("pro_archives_id", purchase.getProArchivesId());
+        return invoiceManagePurchaseMapper.getAll(queryWrapper);
+    }
+
 
 
     /**

+ 4 - 0
src/main/java/org/jeecg/modules/payment/entity/ManagerPaymentAndReceiptSlip.java

@@ -81,4 +81,8 @@ public class ManagerPaymentAndReceiptSlip implements Serializable {
         this.delFlag = "0";
         this.pkOrg = reqDTO.getPkOrg();
     }
+
+    public ManagerPaymentAndReceiptSlip(String proId) {
+        this.proId = proId;
+    }
 }

+ 8 - 0
src/main/java/org/jeecg/modules/payment/mapper/ManagerPaymentAndReceiptSlipMapper.java

@@ -1,7 +1,11 @@
 package org.jeecg.modules.payment.mapper;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
+import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.modules.payment.entity.ManagePaymentAndReceiptContent;
 import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -15,4 +19,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface ManagerPaymentAndReceiptSlipMapper extends BaseMapper<ManagerPaymentAndReceiptSlip> {
 
     List<ManagePaymentAndReceiptContent> getExpensePrice(ExpensePriceReqDTO reqDTO);
+    /**
+     * @desc 主子表列表数据
+     */
+    List<SlipAllListDTO> getAll(@Param("ew") QueryWrapper<ManagerPaymentAndReceiptSlip> queryWrapper);
 }

+ 20 - 0
src/main/java/org/jeecg/modules/payment/mapper/xml/ManagerPaymentAndReceiptSlipMapper.xml

@@ -8,4 +8,24 @@
 			ON t.id = b.slip_id
 			where t.del_flag = '0'  AND b.del_flag = '0' AND t.pro_id = #{proId} AND t.type =#{type} and b.pro_archives_id = #{proArchivesId}
       </select>
+      <select id="getAll" resultType="org.jeecg.common.dto.payment.SlipAllListDTO">
+       SELECT * FROM (
+           SELECT a.id,
+                  a.billcode,
+                  'type',
+                  a.pro_id,
+                  a.pro_code,
+                  a.pro_name ,
+                  b.pro_archives_id,
+                  b.pro_archives_milestone,
+                  b.co_archives_id,
+                  b.co_archives_name,
+                  b.co_prvice
+            FROM manager_payment_and_receipt_slip a
+            JOIN manage_payment_and_receipt_content b
+            ON a.id = b.slip_id
+            WHERE a.del_flag = '0' AND b.del_flag = '0'
+            ) T
+            ${ew.customSqlSegment}
+      </select>
 </mapper>

+ 5 - 0
src/main/java/org/jeecg/modules/payment/service/ManagerPaymentAndReceiptSlipService.java

@@ -5,6 +5,7 @@ import org.jeecg.common.dto.archives.ExpensePriceRespDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveRespDTO;
 import org.jeecg.common.dto.payment.SlipAddReqDTO;
+import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.common.dto.payment.SlipRespDTO;
 import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -41,4 +42,8 @@ public interface ManagerPaymentAndReceiptSlipService extends IService<ManagerPay
      * @desc 获取项目档案的名称与编码
      */
     List<ProjectArchiveRespDTO>  getProNameAndCode(ProjectArchiveReqDTO reqDTO);
+    /**
+     * @desc 主子表列表数据
+     */
+    List<SlipAllListDTO> getAll(ManagerPaymentAndReceiptSlip managerPaymentAndReceiptSlip);
 }

+ 14 - 0
src/main/java/org/jeecg/modules/payment/service/impl/ManagerPaymentAndReceiptSlipServiceImpl.java

@@ -2,11 +2,13 @@ package org.jeecg.modules.payment.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
 import org.jeecg.common.dto.archives.ExpensePriceRespDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveReqDTO;
 import org.jeecg.common.dto.payment.ProjectArchiveRespDTO;
 import org.jeecg.common.dto.payment.SlipAddReqDTO;
+import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.common.dto.payment.SlipContentAddReqDTO;
 import org.jeecg.common.dto.payment.SlipContentRespDTO;
 import org.jeecg.common.dto.payment.SlipRespDTO;
@@ -139,6 +141,18 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
         return respDTOS;
     }
 
+    /**
+     * @desc 收付款单主子表列表数据
+     */
+    @Override
+    public List<SlipAllListDTO> getAll(ManagerPaymentAndReceiptSlip managerPaymentAndReceiptSlip) {
+        QueryWrapper<ManagerPaymentAndReceiptSlip> queryWrapper = new QueryWrapper();
+        if(StringUtils.isNotBlank(managerPaymentAndReceiptSlip.getProId())){
+            queryWrapper.lambda().eq(ManagerPaymentAndReceiptSlip::getProId, managerPaymentAndReceiptSlip.getProId());
+        }
+        return managerPaymentAndReceiptSlipMapper.getAll(queryWrapper);
+    }
+
 
 
     /**

+ 4 - 0
src/main/java/org/jeecg/modules/prowork/entity/ProWorkMilestone.java

@@ -99,4 +99,8 @@ public class ProWorkMilestone implements Serializable {
 		this.delFlag = "0";
 		this.pkOrg = reqDTO.getPkOrg();
 	}
+
+	public ProWorkMilestone(String proId) {
+		this.proId = proId;
+	}
 }

+ 6 - 0
src/main/java/org/jeecg/modules/prowork/service/ProWorkMilestoneService.java

@@ -6,6 +6,8 @@ import org.jeecg.common.dto.prowork.ProWorkMilestoneRespDTO;
 import org.jeecg.common.dto.prowork.ProWorkUpdateFileRespDTO;
 import org.jeecg.modules.prowork.entity.ProWorkMilestone;
 
+import java.util.List;
+
 /**
  * @Description: 项目工作--里程碑确认单
  * @author: jeecg-boot
@@ -30,4 +32,8 @@ public interface ProWorkMilestoneService extends IService<ProWorkMilestone> {
      * @desc 通过id查询
      */
     ProWorkMilestoneRespDTO queryById(String id);
+    /**
+     * @desc 列表数据
+     */
+    List<ProWorkMilestone> getAll(ProWorkMilestone proWorkMilestone);
 }

+ 10 - 0
src/main/java/org/jeecg/modules/prowork/service/impl/ProWorkMilestoneServiceImpl.java

@@ -92,6 +92,16 @@ public class ProWorkMilestoneServiceImpl extends ServiceImpl<ProWorkMilestoneMap
         return proWorkMilestoneRespDTO;
     }
 
+    @Override
+    public List<ProWorkMilestone> getAll(ProWorkMilestone proWorkMilestone) {
+        QueryWrapper<ProWorkMilestone> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("del_flag", "0");
+        if(StringUtils.isNotBlank(proWorkMilestone.getProId())){
+            queryWrapper.eq("pro_id", proWorkMilestone.getProId());
+        }
+        return list(queryWrapper);
+    }
+
 
 
     /**

+ 40 - 0
src/main/java/org/jeecg/modules/report/entity/ChoosePlanTypeEnum.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.report.entity;
+
+import lombok.Getter;
+
+/**
+ * @desc 生产计划类型
+ */
+public enum  ChoosePlanTypeEnum {
+    //1.开发 2.实施 3.服务
+    IM_PLANTYPE(1, "2"),
+    DE_PLANTYPE(2, "1"),
+    SE_PLANTYPE(3, "3");
+
+    @Getter
+    private Integer key;
+    private String planType;
+
+    ChoosePlanTypeEnum() {
+    }
+
+    ChoosePlanTypeEnum(Integer key, String planType) {
+        this.key = key;
+        this.planType = planType;
+    }
+
+    public String getPlanType(){
+         return planType;
+    }
+
+    public static ChoosePlanTypeEnum match(int key){
+        ChoosePlanTypeEnum choosePlanTypeEnum = null;
+        for(ChoosePlanTypeEnum value : values()){
+            if(value.getKey() == key){
+                choosePlanTypeEnum = value;
+                break;
+            }
+        }
+         return choosePlanTypeEnum;
+    }
+}

+ 10 - 10
src/main/java/org/jeecg/modules/report/mapper/xml/ProReportMapper.xml

@@ -22,16 +22,16 @@
             a.pro_code,
             a.pro_name,
             t.pro_archives_id,
-        MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '产品' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as proIncome,
-        MAX( IF(t.plan_type = '2' ,	CASE t.plan_name WHEN '实施' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as imIncome,
-        MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '开发' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as deIncome,
-        MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '服务' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as seIncome,
-        MAX( IF(t.plan_type = '2' , CASE t.plan_name when '其他' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as otherIncome,
-        MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '产品' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as proPayment,
-        MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '实施' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as imPayment,
-        MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '开发' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as dePayment,
-        MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '服务' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as sePayment,
-        MAX( IF(t.plan_type = '4' , CASE t.plan_name when '其他' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as otherPayment
+            MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '产品' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as proIncome,
+            MAX( IF(t.plan_type = '2' ,	CASE t.plan_name WHEN '实施' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as imIncome,
+            MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '开发' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as deIncome,
+            MAX( IF(t.plan_type = '2' , CASE t.plan_name WHEN '服务' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as seIncome,
+            MAX( IF(t.plan_type = '2' , CASE t.plan_name when '其他' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as otherIncome,
+            MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '产品' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as proPayment,
+            MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '实施' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as imPayment,
+            MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '开发' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as dePayment,
+            MAX( IF(t.plan_type = '4' , CASE t.plan_name WHEN '服务' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as sePayment,
+            MAX( IF(t.plan_type = '4' , CASE t.plan_name when '其他' THEN (t.price1 + t.price2 + t.price3 + t.price4 + t.price5) END , 0 ))as otherPayment
         FROM project_manage_archives_and_business t
         JOIN project_manage_archives a
         ON   t.pro_archives_id = a.id

+ 172 - 92
src/main/java/org/jeecg/modules/report/service/impl/ProReportServiceImpl.java

@@ -2,7 +2,10 @@ package org.jeecg.modules.report.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
+import io.swagger.annotations.ApiModel;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.dto.invoice.PurchaseDataDTO;
+import org.jeecg.common.dto.payment.SlipAllListDTO;
 import org.jeecg.common.dto.report.CostAccountingReqDTO;
 import org.jeecg.common.dto.report.CostAccountingRespDTO;
 import org.jeecg.common.dto.report.ProStatisticsRespDTO;
@@ -15,10 +18,15 @@ import org.jeecg.modules.archives.service.ProjectManageArchivesAndBusinessServic
 import org.jeecg.modules.archives.service.ProjectManageArchivesService;
 import org.jeecg.modules.archives.service.ProjectManageBusinessOtherService;
 import org.jeecg.modules.basedata.service.IBaseArchivesCollectionLineService;
+import org.jeecg.modules.invoice.entity.InvoiceManagePurchase;
+import org.jeecg.modules.invoice.service.InvoiceManagePurchaseService;
+import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
+import org.jeecg.modules.payment.service.ManagerPaymentAndReceiptSlipService;
 import org.jeecg.modules.prowork.entity.ProWorkLogic;
 import org.jeecg.modules.prowork.entity.ProWorkMilestone;
 import org.jeecg.modules.prowork.service.ProWorkLogicService;
 import org.jeecg.modules.prowork.service.ProWorkMilestoneService;
+import org.jeecg.modules.report.entity.ChoosePlanTypeEnum;
 import org.jeecg.modules.report.entity.MeberDepartEnum;
 import org.jeecg.modules.report.mapper.ProReportMapper;
 import org.jeecg.modules.report.service.ProReportService;
@@ -50,6 +58,10 @@ public class ProReportServiceImpl implements ProReportService {
     private ProWorkLogicService proWorkLogicService;
     @Autowired
     private ProWorkMilestoneService proWorkMilestoneService;
+    @Autowired
+    private InvoiceManagePurchaseService invoiceManagePurchaseService;
+    @Autowired
+    private ManagerPaymentAndReceiptSlipService managerPaymentAndReceiptSlipService;
     /**
      * @desc 获取成本核算数据
      */
@@ -72,19 +84,29 @@ public class ProReportServiceImpl implements ProReportService {
      @Override
      public List<ProStatisticsRespDTO> getProStatistics(CostAccountingReqDTO reqDTO) {
          QueryWrapper<ProjectManageArchives> queryWrapper = new QueryWrapper();
-         queryWrapper.eq("del_flag", "0").eq("id", reqDTO.getId());
+         queryWrapper.eq("del_flag", "0");
+         if(StringUtils.isNotBlank(reqDTO.getId())){
+             queryWrapper.eq("id", reqDTO.getId());
+         }
          if(StringUtils.isNotBlank(reqDTO.getPkOrg())){
              queryWrapper.eq("pk_org", reqDTO.getPkOrg());
          }
          List<ProjectManageArchives> archives = projectManageArchivesService.list(queryWrapper);
+
+
+         List<ProStatisticsRespDTO> list = Lists.newArrayList();
          //获取树形数据
-         return getProStatisticsDatas(archives, reqDTO.getId());
+        for(ProjectManageArchives projectManageArchives : archives){
+            list.add(getProStatisticsDatas(projectManageArchives,  projectManageArchives.getId()));
+        }
+
+         return list;
      }
 
      /**
       * @desc 获取树形数据
       */
-     private List<ProStatisticsRespDTO> getProStatisticsDatas( List<ProjectManageArchives> archives, String id) {
+     private ProStatisticsRespDTO getProStatisticsDatas( ProjectManageArchives archives, String id) {
          //获取项目档案里程碑信息表数据
          List<ProjectManageArchivesAndBusiness> businesses = getBusinessData(id);
          //项目档案计划信息表Map
@@ -93,20 +115,26 @@ public class ProReportServiceImpl implements ProReportService {
          Map<String, String> CoLineMap = baseArchivesCollectionLineService.getDataMap();
         //获取项目档案计划信息表数据
          List<ProjectManageBusinessOther> otherList = projectManageBusinessOtherService.getAll(new ProjectManageBusinessOther(id));
+         //获取里程碑确认单
+         List<ProWorkMilestone> milestones = proWorkMilestoneService.getAll(new ProWorkMilestone(id));
+         Map<String, List<ProWorkMilestone>> milestoneMap = milestones.stream().collect(Collectors.groupingBy(t ->t.getType()));
+         //销售发票,采购发票主子表数据
+         List<PurchaseDataDTO> purchaseDataDTOS = invoiceManagePurchaseService.getAll(new InvoiceManagePurchase(id));
+         Map<String, List<PurchaseDataDTO>> purchaseDataMap = purchaseDataDTOS.stream().collect(Collectors.groupingBy(t -> t.getType()));
+         //收付款单主子表
+         List<SlipAllListDTO> slipAllListDTOS = managerPaymentAndReceiptSlipService.getAll(new ManagerPaymentAndReceiptSlip(id));
+         Map<String, List<SlipAllListDTO>> slipMap = slipAllListDTOS.stream().collect(Collectors.groupingBy(t -> t.getType()));
 
          //项目日志
          Map<String, List<ProWorkLogic>>  logicMap = getProLogic(id);
 
-         List<ProStatisticsRespDTO> list = Lists.newArrayList();
-         for(ProjectManageArchives projectManageArchives : archives){
-             ProStatisticsRespDTO respDTO =  new ProStatisticsRespDTO(projectManageArchives.getId(), projectManageArchives.getProName(),
-             projectManageArchives.getProCode(), projectManageArchives.getProName(), "0");
+         //逻辑处理
+             ProStatisticsRespDTO respDTO =  new ProStatisticsRespDTO(archives.getId(), archives.getProName(),
+                     archives.getProCode(), archives.getProName(), "0");
              //配置收付款条线数据
-             setSecondChildren(businesses, respDTO, CoLineMap, otherList, businessMap, logicMap);
-                 list.add(respDTO);
-         }
+             setSecondChildren(businesses, respDTO, CoLineMap, otherList, businessMap, logicMap, milestoneMap, purchaseDataMap, slipMap);
 
-         return list;
+         return respDTO;
      }
 
     /**
@@ -126,83 +154,86 @@ public class ProReportServiceImpl implements ProReportService {
      * @desc 配置收付款线条数据
      */
     private void setSecondChildren(List<ProjectManageArchivesAndBusiness> businesses, ProStatisticsRespDTO respDTO, Map<String, String> CoLineMap,
-        List<ProjectManageBusinessOther> otherList, Map<String, List<ProjectManageArchivesAndBusiness>> otherMap, Map<String, List<ProWorkLogic>> logicMap) {
+        List<ProjectManageBusinessOther> otherList, Map<String, List<ProjectManageArchivesAndBusiness>> otherMap, Map<String, List<ProWorkLogic>> logicMap,
+        Map<String, List<ProWorkMilestone>> milestoneMap,  Map<String, List<PurchaseDataDTO>> purchaseDataMap, Map<String, List<SlipAllListDTO>> slipMap) {
         List<ProStatisticsTwoRespDTO> list = Lists.newArrayList();
         //i: 1代表实施, 2代表开发, 3代表服务
         for(int i = 1; i <=4 ; i++) {
             if(!CollectionUtils.isEmpty(businesses)){
                 List<ProjectManageArchivesAndBusiness> businesseses = selectSecondChildren(i, businesses);
-
-                for(ProjectManageArchivesAndBusiness business : businesseses){
-                    //只处理收款计划
-                    if(business.getPlanType() == 3){
-                        break;
-                    }
-
-                    if(StringUtils.isNotBlank(business.getMileId1())){
-                        ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
-                        twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
-                        twoRespDTO.setMileId(business.getMileId1());
-                        List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
-                        if(!CollectionUtils.isEmpty(others)){
-                            twoRespDTO.setMileCoPrice(others.get(0).getPrice1());
+                if(!CollectionUtils.isEmpty(businesseses)){
+                    for(ProjectManageArchivesAndBusiness business : businesseses){
+                        //只处理收款计划
+                        if(business.getPlanType() == 3){
+                            break;
                         }
 
-                        twoRespDTO.setMilePrice(business.getPrice1());
+                        if(StringUtils.isNotBlank(business.getMileId1())){
+                            ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
+                            twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
+                            twoRespDTO.setMileId(business.getMileId1());
+                            List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
+                            if(!CollectionUtils.isEmpty(others)){
+                                twoRespDTO.setMileCoPrice(others.get(0).getPrice1());
+                            }
 
-                        setThreeChildren(twoRespDTO, otherList, i, logicMap);
-                        list.add(twoRespDTO);
-                    }
-                    if(StringUtils.isNotBlank(business.getMileId2())){
-                        ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
-                        twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
-                        twoRespDTO.setMileId(business.getMileId2());
-                        List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
-                        if(!CollectionUtils.isEmpty(others)){
-                            twoRespDTO.setMileCoPrice(others.get(0).getPrice2());
+                            twoRespDTO.setMilePrice(business.getPrice1());
+
+                            setThreeChildren(twoRespDTO, otherList, i, logicMap, milestoneMap, purchaseDataMap, slipMap);
+                            list.add(twoRespDTO);
                         }
-                        setThreeChildren(twoRespDTO, otherList, i, logicMap);
-                        list.add(twoRespDTO);
-                    }
-                    if(StringUtils.isNotBlank(business.getMileId3())){
-                        ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
-                        twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
-                        twoRespDTO.setMileId(business.getMileId3());
-                        twoRespDTO.setMilePrice(business.getPrice3());
-                        List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
-                        if(!CollectionUtils.isEmpty(others)){
-                            twoRespDTO.setMileCoPrice(others.get(0).getPrice3());
+                        if(StringUtils.isNotBlank(business.getMileId2())){
+                            ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
+                            twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
+                            twoRespDTO.setMileId(business.getMileId2());
+                            List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
+                            if(!CollectionUtils.isEmpty(others)){
+                                twoRespDTO.setMileCoPrice(others.get(0).getPrice2());
+                            }
+                            setThreeChildren(twoRespDTO, otherList, i, logicMap, milestoneMap, purchaseDataMap, slipMap);
+                            list.add(twoRespDTO);
                         }
-                        setThreeChildren(twoRespDTO, otherList, i, logicMap);
-                        list.add(twoRespDTO);
-                    }
-                    if(StringUtils.isNotBlank(business.getMileId4())){
-                        ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
-                        twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
-                        twoRespDTO.setMileId(business.getMileId4());
-                        List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
-                        if(!CollectionUtils.isEmpty(others)) {
-                            twoRespDTO.setMileCoPrice(others.get(0).getPrice4());
+                        if(StringUtils.isNotBlank(business.getMileId3())){
+                            ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
+                            twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
+                            twoRespDTO.setMileId(business.getMileId3());
+                            twoRespDTO.setMilePrice(business.getPrice3());
+                            List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
+                            if(!CollectionUtils.isEmpty(others)){
+                                twoRespDTO.setMileCoPrice(others.get(0).getPrice3());
+                            }
+                            setThreeChildren(twoRespDTO, otherList, i, logicMap, milestoneMap, purchaseDataMap, slipMap);
+                            list.add(twoRespDTO);
                         }
-                        setThreeChildren(twoRespDTO, otherList, i, logicMap);
-                        list.add(twoRespDTO);
-                    }
-                    if(StringUtils.isNotBlank(business.getMileId5())){
-                        ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
-                        twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
-                        twoRespDTO.setMileId(business.getMileId5());
-                        twoRespDTO.setMilePrice(business.getPrice5());
-                        List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
-                        if(!CollectionUtils.isEmpty(others)) {
-
-                            twoRespDTO.setMileCoPrice(others.get(0).getPrice5());
+                        if(StringUtils.isNotBlank(business.getMileId4())){
+                            ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
+                            twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
+                            twoRespDTO.setMileId(business.getMileId4());
+                            List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
+                            if(!CollectionUtils.isEmpty(others)) {
+                                twoRespDTO.setMileCoPrice(others.get(0).getPrice4());
+                            }
+                            setThreeChildren(twoRespDTO, otherList, i, logicMap, milestoneMap, purchaseDataMap, slipMap);
+                            list.add(twoRespDTO);
+                        }
+                        if(StringUtils.isNotBlank(business.getMileId5())){
+                            ProStatisticsTwoRespDTO twoRespDTO = new ProStatisticsTwoRespDTO(business, MeberDepartEnum.match(i).getName(), respDTO.getId());
+                            twoRespDTO.setCoArchivesCode(CoLineMap.get(business.getPlanId()));
+                            twoRespDTO.setMileId(business.getMileId5());
+                            twoRespDTO.setMilePrice(business.getPrice5());
+                            List<ProjectManageArchivesAndBusiness> others = otherMap.get("3&"+business.getPlanId());
+                            if(!CollectionUtils.isEmpty(others)) {
+
+                                twoRespDTO.setMileCoPrice(others.get(0).getPrice5());
+                            }
+                            setThreeChildren(twoRespDTO, otherList, i, logicMap, milestoneMap, purchaseDataMap, slipMap);
+                            list.add(twoRespDTO);
                         }
-                        setThreeChildren(twoRespDTO, otherList, i, logicMap);
-                        list.add(twoRespDTO);
-                    }
 
+                    }
                 }
 
+
             } else {
               respDTO.setChildren(null);
               respDTO.setIsLeaf(true);
@@ -216,42 +247,91 @@ public class ProReportServiceImpl implements ProReportService {
     //配置计划信息表的数据
 
     private void setThreeChildren(ProStatisticsTwoRespDTO twoRespDTO, List<ProjectManageBusinessOther> otherList, int i,
-         Map<String, List<ProWorkLogic>> logicMap) {
+         Map<String, List<ProWorkLogic>> logicMap, Map<String, List<ProWorkMilestone>> milestoneMap, Map<String, List<PurchaseDataDTO>> purchaseDataMap,
+          Map<String, List<SlipAllListDTO>> slipMap) {
+
+        List<ProStatisticsThreeRespDTO> respDTOS = Lists.newArrayList();
         //计划类型 1.商务 2.实施 3.开发 4.服务
          ++i;
          for(ProjectManageBusinessOther other : otherList){
              if(other.getPlanType() == i && other.getMuilesId().equals(twoRespDTO.getMileId())){
                  ProStatisticsThreeRespDTO threeRespDTO = new ProStatisticsThreeRespDTO(other, twoRespDTO);
                  //获取实际开始时间
-                 String planType = choosePlanType(i);
+                 String planType = ChoosePlanTypeEnum.match(i) != null ? ChoosePlanTypeEnum.match(i).getPlanType() : null;
                  List<ProWorkLogic> logics = logicMap.get(planType);
                  if(!CollectionUtils.isEmpty(logics)){
                      threeRespDTO.setMileRealStartDate(logics.get(0).getStartDate());
                  }
-                 //TODO 确认单 , 销售发票等
+
+                 //配置里程碑确认单--实际结束时间
+                 List<ProWorkMilestone> proWorkMilestones = milestoneMap.get(ChoosePlanTypeEnum.match(i) != null ?
+                         ChoosePlanTypeEnum.match(i).getPlanType() : null);
+                 if(!CollectionUtils.isEmpty(proWorkMilestones)){
+                     for(ProWorkMilestone proWorkMilestone : proWorkMilestones){
+                         if(proWorkMilestone.getMileId().equals(other.getMuilesId())){
+                             threeRespDTO.setMileRealEndtDate(proWorkMilestone.getConfirmTime());
+                             break;
+                         }
+                     }
+                 }
+
+                 //配置 里程碑开票金额(销售发票)
+                 List<PurchaseDataDTO> purchaseDataDTOS = purchaseDataMap.get("2");
+                 if(!CollectionUtils.isEmpty(purchaseDataDTOS)) {
+                     for(PurchaseDataDTO purchaseDataDTO : purchaseDataDTOS) {
+                         if(twoRespDTO.getCoArchivesName().equals(purchaseDataDTO.getCoArchivesName()) &&
+                                 threeRespDTO.getMilesName().equals(purchaseDataDTO.getProArchivesMilestone())) {
+                             threeRespDTO.setMileInvoice(purchaseDataDTO.getCoPrice());
+                             break;
+                         }
+                     }
+                 }
+
+               //配置 里程碑收票(采购发票)
+                 List<PurchaseDataDTO> purchaseDataDTOS2 = purchaseDataMap.get("1");
+                 if(!CollectionUtils.isEmpty(purchaseDataDTOS2)) {
+                     for(PurchaseDataDTO purchaseDataDTO : purchaseDataDTOS2) {
+                         if(twoRespDTO.getCoArchivesName().equals(purchaseDataDTO.getCoArchivesName()) &&
+                                 threeRespDTO.getMilesName().equals(purchaseDataDTO.getProArchivesMilestone())) {
+                             threeRespDTO.setMileTicket(purchaseDataDTO.getCoPrice());
+                         }
+                     }
+                 }
+               //里程碑实际收款 (收款单)
+                 List<SlipAllListDTO> slipAllListDTOS = slipMap.get("1");
+                 if(!CollectionUtils.isEmpty(slipAllListDTOS)) {
+                     for(SlipAllListDTO slipAllListDTO : slipAllListDTOS) {
+                         if(slipAllListDTO.getCoArchivesName().equals(twoRespDTO.getCoArchivesName()) &&
+                                 slipAllListDTO.getProArchivesMilestone().equals(threeRespDTO.getMilesName())) {
+                             threeRespDTO.setMileRealCollecion(slipAllListDTO.getCoPrvice());
+                         }
+                         break;
+                     }
+                 }
+                 //里程碑实际收款 (收款单)
+                 List<SlipAllListDTO> slipAllListDTOS2 = slipMap.get("2");
+                 if(!CollectionUtils.isEmpty(slipAllListDTOS2)) {
+                     for(SlipAllListDTO slipAllListDTO : slipAllListDTOS2) {
+                         if(slipAllListDTO.getCoArchivesName().equals(twoRespDTO.getCoArchivesName()) &&
+                                 slipAllListDTO.getProArchivesMilestone().equals(threeRespDTO.getMilesName())) {
+                             threeRespDTO.setMileRealPayment(slipAllListDTO.getCoPrvice());
+                         }
+                         break;
+                     }
+                 }
+                 threeRespDTO.setIsLeaf(true);
+                 threeRespDTO.setChilderen(null);
+
+                 respDTOS.add(threeRespDTO);
              } else {
                  twoRespDTO.setLeaf(true);
                  twoRespDTO.setChildren(null);
              }
          }
-
+        twoRespDTO.setChildren(CollectionUtils.isEmpty(respDTOS)? null : respDTOS);
     }
 
-    /**
-     * @desc 选择计划类型 1.开发 2.实施 3.服务
-     */
-    private String choosePlanType(int i) {
-        switch(i){
-            //代表实施
-            case 1:
-                return "2";
-            case 2:
-                return "1";
-            case 3:
-                return  "3";
-        }
-        return null;
-    }
+
 
     //根据首付款条线获取指定的数据
     private List<ProjectManageArchivesAndBusiness> selectSecondChildren(int i, List<ProjectManageArchivesAndBusiness> businesses) {