蔡德晨 5 年 前
コミット
2b6cc43704

+ 45 - 14
src/main/java/com/jeeplus/common/utils/excel/ExportExcel.java

@@ -19,6 +19,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Comment;
@@ -180,6 +181,7 @@ public class ExportExcel {
 	public ExportExcel(String title, List<String> headerList) {
 		initialize(title, headerList);
 	}
+
 	
 	/**
 	 * 初始化函数
@@ -187,7 +189,7 @@ public class ExportExcel {
 	 * @param headerList 表头列表
 	 */
 	private void initialize(String title, List<String> headerList) {
-		this.wb = new SXSSFWorkbook(500);
+		this.wb = new SXSSFWorkbook(700);
 		this.sheet = wb.createSheet("Export");
 		this.styles = createStyles(wb);
 		// Create title
@@ -205,9 +207,39 @@ public class ExportExcel {
 			throw new RuntimeException("headerList not null!");
 		}
 		Row headerRow = sheet.createRow(rownum++);
-		headerRow.setHeightInPoints(16);
+		headerRow.setHeightInPoints(30);
+		Row headerRow1 = sheet.createRow(rownum++);
+		headerRow1.setHeightInPoints(30);
+//		sheet.addMergedRegion(new CellRangeAddress(1, 0, 0, 0));
+//		sheet.addMergedRegion(new CellRangeAddress(1, 0, 1, 1));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
+		sheet.addMergedRegion(new CellRangeAddress(0, 0, 4, 5));
+		sheet.addMergedRegion(new CellRangeAddress(0, 0, 7, 8));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 8, 8));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 9, 9));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 10, 10));
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 11, 11));
+		sheet.setColumnWidth(0, 2000);
+		sheet.setColumnWidth(1, 3000);
+		sheet.setColumnWidth(2, 2000);
+		sheet.setColumnWidth(3, 12000);
+		sheet.setColumnWidth(4, 2000);
+		sheet.setColumnWidth(5, 2000);
+		sheet.setColumnWidth(6, 2000);
+		sheet.setColumnWidth(7, 2000);
+		sheet.setColumnWidth(8, 3000);
+		sheet.setColumnWidth(9, 3000);
+		sheet.setColumnWidth(10, 3000);
+		sheet.setColumnWidth(11, 3000);
+		Cell tempCell1 = headerRow.createCell(4);
+		tempCell1.setCellValue("建筑工程费");
+		tempCell1.setCellStyle(styles.get("header"));
+		Cell tempCell = headerRow.createCell(7);
+		tempCell.setCellStyle(styles.get("header"));
+		tempCell.setCellValue("安装工程费");
 		for (int i = 0; i < headerList.size(); i++) {
-			Cell cell = headerRow.createCell(i);
+			Cell cell = headerRow1.createCell(i);
 			cell.setCellStyle(styles.get("header"));
 			String[] ss = StringUtils.split(headerList.get(i), "**", 2);
 			if (ss.length==2){
@@ -221,12 +253,17 @@ public class ExportExcel {
 			}
 			sheet.autoSizeColumn(i);
 		}
-		for (int i = 0; i < headerList.size(); i++) {  
+		for (int i = 0; i < headerList.size(); i++) {
 			int colWidth = sheet.getColumnWidth(i)*2;
-	        sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);  
+	        sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);
 		}
+//		sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
+//		sheet.addMergedRegion(new CellRangeAddress(1, 0, 1, 1));
+//		sheet.addMergedRegion(new CellRangeAddress(1, 0, 2, 2));
+//		sheet.addMergedRegion(new CellRangeAddress(1, 0, 3, 3));
 		log.debug("Initialize success.");
 	}
+
 	
 	/**
 	 * 创建表格样式
@@ -285,22 +322,16 @@ public class ExportExcel {
 		style.setFillPattern(CellStyle.SOLID_FOREGROUND);
 		Font headerFont = wb.createFont();
 		headerFont.setFontName("Arial");
-		headerFont.setFontHeightInPoints((short) 10);
+		headerFont.setFontHeightInPoints((short) 15);
 		headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-		headerFont.setColor(IndexedColors.WHITE.getIndex());
+		headerFont.setColor(IndexedColors.BLACK.getIndex());
 		style.setFont(headerFont);
 		styles.put("header", style);
-		
 		return styles;
 	}
 
 
-//	private Map<String, CellStyle> createStyles(Workbook wb) {
-//
-//
-//
-//
-//	}
+
 
 	/**
 	 * 添加一行

+ 100 - 3
src/main/java/com/jeeplus/modules/sg/overheadline/entity/JkxlDetailFee.java

@@ -38,6 +38,34 @@ public class JkxlDetailFee {
     private String subjectAllocate;  //科目分配
     private String feeType;   //1:主体部分  2:其他部分
 
+    private double sbFee;      //设备费
+    private double jzFee;      //建筑费
+    private double sbgzFee;    //设备购置费
+    private double azFee;      //安装费
+    private double zcFee;     //装材费
+    private double qtFee;    //其他费用
+    private double jsFee;    //结算价
+    private double cFee;      //差额
+    private String hierarchy;  //层级
+    private Integer index;    //序号
+
+    @ExcelField(title="设备费", align=1, sort=6)
+    public double getSbFee() {
+        return sbFee;
+    }
+
+    public void setSbFee(double sbFee) {
+        this.sbFee = sbFee;
+    }
+
+    @ExcelField(title="建筑费", align=1, sort=5)
+    public double getJzFee() {
+        return jzFee;
+    }
+
+    public void setJzFee(double jzFee) {
+        this.jzFee = jzFee;
+    }
 
     public Double getGxFee() {
         return gxFee;
@@ -107,7 +135,7 @@ public class JkxlDetailFee {
         this.projectId = projectId;
     }
 
-    @ExcelField(title="元素描述", align=1, sort=2)
+    @ExcelField(title="元素描述", align=1, sort=4)
     public String getDescribe() {
         return describe;
     }
@@ -123,7 +151,7 @@ public class JkxlDetailFee {
     public void setParentNode(String parentNode) {
         this.parentNode = parentNode;
     }
-    @ExcelField(title="WBS识别码", align=2, sort=1)
+    @ExcelField(title="WBS识别码", align=2, sort=2)
     public String getWbsCode() {
         return wbsCode;
     }
@@ -132,7 +160,7 @@ public class JkxlDetailFee {
         this.wbsCode = wbsCode;
     }
 
-    @ExcelField(title="结算金额", align=2, sort=3)
+    @ExcelField(title="合计", align=2, sort=11)
     public Double getTotalFee() {
         return totalFee;
     }
@@ -313,5 +341,74 @@ public class JkxlDetailFee {
         this.tex = tex;
     }
 
+    @ExcelField(title="设备购置费", align=2, sort=7)
+    public double getSbgzFee() {
+        return sbgzFee;
+    }
 
+    public void setSbgzFee(double sbgzFee) {
+        this.sbgzFee = sbgzFee;
+    }
+    @ExcelField(title="安装费", align=2, sort=8)
+    public double getAzFee() {
+        return azFee;
+    }
+
+    public void setAzFee(double azFee) {
+        this.azFee = azFee;
+    }
+
+    @ExcelField(title="装材费", align=2, sort=9)
+    public double getZcFee() {
+        return zcFee;
+    }
+
+    public void setZcFee(double zcFee) {
+        this.zcFee = zcFee;
+    }
+
+    @ExcelField(title="其他费用", align=2, sort=10)
+    public double getQtFee() {
+        return qtFee;
+    }
+
+    public void setQtFee(double qtFee) {
+        this.qtFee = qtFee;
+    }
+
+    @ExcelField(title="结算价", align=2, sort=12)
+    public double getJsFee() {
+        return jsFee;
+    }
+
+    public void setJsFee(double jsFee) {
+        this.jsFee = jsFee;
+    }
+
+    @ExcelField(title="差额", align=2, sort=13)
+    public double getcFee() {
+        return cFee;
+    }
+
+    public void setcFee(double cFee) {
+        this.cFee = cFee;
+    }
+
+    @ExcelField(title="层级", align=2, sort=3)
+    public String getHierarchy() {
+        return hierarchy;
+    }
+
+    public void setHierarchy(String hierarchy) {
+        this.hierarchy = hierarchy;
+    }
+
+    @ExcelField(title="序号", align=2, sort=1)
+    public Integer getIndex() {
+        return index;
+    }
+
+    public void setIndex(Integer index) {
+        this.index = index;
+    }
 }

+ 15 - 0
src/main/java/com/jeeplus/modules/sg/overheadline/mapper/xml/OverheadLineMapper.xml

@@ -84,6 +84,21 @@
          a.mount_matter as mountMatter,
          a.mount_server as mountServer,
          b.original_total_cost as originalTotalCost,
+		b.original_rg_cost as originalRgCost,
+		b.original_cbr_cost as originalCbrCost,
+		b.original_fbr_cost as originalFbrCost,
+		b.original_jx_cost as originalJxCost,
+		b.rg_cost as rgCost,
+		b.cbr_cost as cbrCost,
+		b.fbr_cost as fbrCost,
+		b.jx_cost as jxCost,
+		b.measures_fee1 as measuresFee1,
+		b.measures_fee2 as measuresFee2,
+		b.measures_fee3 as measuresFee3,
+		b.other_cost as otherCost,
+		b.tex as tex,
+		b.fees as fees,
+		b.zjgc_fee as zjgcFee,
          b.total_fee as totalFee
          FROM sg_wbs_elements a LEFT JOIN sg_fee_detail_jkxl b on a.short_id = b.wbs_code
          and b.id = #{id}

+ 36 - 0
src/main/java/com/jeeplus/modules/sg/overheadline/service/OverheadLineService.java

@@ -43,12 +43,38 @@ public class OverheadLineService {
 
    public List<JkxlDetailFee> findList(String id){
        List<JkxlDetailFee> list = overheadLineMapper.findList(id);
+       JkxlAdjustFee jkxlAdjustFee = new JkxlAdjustFee();
+       jkxlAdjustFee.setId(id);
+       jkxlAdjustFee.setType(BashInfo.CE);
+       List<JkxlAdjustFee> jkxlAdjustFees = feeAdjustService.getTzFee(jkxlAdjustFee);
+       JkxlAdjustFee jkxlAdjustFee1 = jkxlAdjustFees.get(0);
+       double cFee = jkxlAdjustFee1.getFee();
        double btTotal = 0.00;
        double qtTotal = 0.00;
+       double azTotal = 0.00;
+       double otherTotal = 0.00;
+       for(JkxlDetailFee jkxlDetailFee : list){
+           double measuresFee1 = jkxlDetailFee.getMeasuresFee1()!=null? jkxlDetailFee.getMeasuresFee1():0.00;
+           double measuresFee2 = jkxlDetailFee.getMeasuresFee2()!=null? jkxlDetailFee.getMeasuresFee2():0.00;
+           double measuresFee3 = jkxlDetailFee.getMeasuresFee3()!=null? jkxlDetailFee.getMeasuresFee3():0.00;
+           double otherCost = jkxlDetailFee.getTex()!=null? jkxlDetailFee.getTex():0.00;
+           double Fees = jkxlDetailFee.getOtherCost()!=null? jkxlDetailFee.getOtherCost():0.00;
+           double Tex = jkxlDetailFee.getFees()!=null? jkxlDetailFee.getFees():0.00;
+           double qtFee = measuresFee1 + measuresFee2 + measuresFee3 + otherCost + Fees + Tex;
+           double rgFee = jkxlDetailFee.getRgCost()!=null? jkxlDetailFee.getRgCost():0.00;
+           double cbrFee = jkxlDetailFee.getCbrCost()!=null? jkxlDetailFee.getCbrCost():0.00;
+           double fbrFee = jkxlDetailFee.getFbrCost()!=null? jkxlDetailFee.getFbrCost():0.00;
+           double jxFee = jkxlDetailFee.getJxCost()!=null? jkxlDetailFee.getJxCost():0.00;
+           double azFee = rgFee + cbrFee + fbrFee + jxFee;
+           jkxlDetailFee.setQtFee(qtFee);
+           jkxlDetailFee.setAzFee(azFee);
+       }
        for(JkxlDetailFee jkxlDetailFee : list){
            //本体费用求和
            if(jkxlDetailFee.getOriginalTotalCost() != null){
                btTotal += jkxlDetailFee.getTotalFee();
+               azTotal += jkxlDetailFee.getAzFee();
+               otherTotal += jkxlDetailFee.getQtFee();
            }
            //其他费用求和
            if(jkxlDetailFee.getOriginalTotalCost() == null && jkxlDetailFee.getTotalFee() != null){
@@ -58,14 +84,24 @@ public class OverheadLineService {
        for(JkxlDetailFee jkxlDetailFee : list){
            if(jkxlDetailFee.getWbsCode().equals("30000000")){
                jkxlDetailFee.setTotalFee(btTotal+qtTotal);
+               jkxlDetailFee.setAzFee(azTotal);
+               jkxlDetailFee.setQtFee(otherTotal);
+               jkxlDetailFee.setcFee(cFee);
+               jkxlDetailFee.setJsFee(btTotal+qtTotal+cFee);
            }
            if(jkxlDetailFee.getWbsCode().equals("39000000")){
                jkxlDetailFee.setTotalFee(btTotal);
+               jkxlDetailFee.setAzFee(azTotal);
+               jkxlDetailFee.setQtFee(otherTotal);
            }
            if(jkxlDetailFee.getWbsCode().equals("34000000")){
                jkxlDetailFee.setTotalFee(qtTotal);
+
            }
        }
+       for (int i=0;i<list.size();i++){
+           list.get(i).setIndex(i+1);
+       }
        return list;
 
    }

+ 1 - 0
src/main/java/com/jeeplus/modules/sg/overheadline/util/BashInfo.java

@@ -409,4 +409,5 @@ public class BashInfo {
         return list;
     }
 
+
 }

+ 25 - 3
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -1,11 +1,16 @@
 package com.jeeplus.modules.sg.project.web;
 
 import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.overheadline.entity.JkxlDetailFee;
+import com.jeeplus.modules.sg.overheadline.service.OverheadLineService;
+import com.jeeplus.modules.sg.project.entity.WbsItem;
 import com.jeeplus.modules.sg.project.entity.WbsProject;
 import com.jeeplus.modules.sg.project.entity.WbsSelection;
 import com.jeeplus.modules.sg.project.service.ProjectService;
+import com.jeeplus.modules.sg.project.util.ExportUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -17,6 +22,7 @@ import org.springframework.ui.Model;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -28,6 +34,9 @@ public class ProjectController extends BaseController {
     private HttpServletRequest request;
     @Autowired
     private ProjectService projectService;
+    @Autowired
+    private OverheadLineService overheadLineService;
+
 
     @ModelAttribute
     public WbsProject get(@RequestParam(required=false) String id) {
@@ -84,10 +93,23 @@ public class ProjectController extends BaseController {
     }
 
     //项目编辑
-    @RequestMapping("/toList")
-    public String toList(HttpServletRequest request,Model model){
+    @RequestMapping("/export")
+    public String toList(HttpServletRequest request,Model model,HttpServletResponse response) throws IOException {
         String id = request.getParameter("id");
-        return "redirect:/a/jkxl/list?id="+id;
+        WbsProject wbsProject = projectService.get(id);
+        String fileName = wbsProject.getProjectName()+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+        List<WbsItem> wbsItems = wbsProject.getWbsItems();
+        String[] sts = new String[wbsItems.size()];
+        for (int i=0;i<wbsItems.size();i++){
+            sts[i] = wbsItems.get(i).getItemName();
+        }
+        ExportUtil exportUtil = new ExportUtil(null, JkxlDetailFee.class,sts);
+        for(WbsItem wbsItem : wbsItems){
+            List<JkxlDetailFee> jkxlDetailFees = overheadLineService.findList(wbsItem.getId());
+            exportUtil.setDataList(jkxlDetailFees);
+        }
+        exportUtil.write(response,fileName).dispose();
+        return "redirect:/a/project/list";
     }
 
     //项目删除

+ 1 - 1
src/main/webapp/webpage/modules/sg/project/management.jsp

@@ -197,7 +197,7 @@
                                 xml += "<a class='layui-btn layui-btn-primary layui-btn-xs' onclick=\"look( '${ctx}/project/form?id=" + d.id + "&tabId=1')\">查看</a>"
                                     +"<a class='layui-btn layui-btn-xs'  onclick=\"update( '${ctx}/project/form?id=" + d.id + "&tabId=2')\">修改</a>"
                                     +"<a class='layui-btn layui-btn-normal layui-btn-xs' lay-event='add'>添加项目</a>"
-                                    +"<a class='layui-btn layui-btn-warm layui-btn-xs' lay-event=''>导出</a>";
+                                    +"<a class='layui-btn layui-btn-warm layui-btn-xs' lay-event=''href=\"${ctx}/project/export?id=" + d.id+"\">导出</a>";
                             }
                             if(d.status==2){
                                 xml +="<span class='myspan'>操作</span>";