Bladeren bron

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/jeeplus/modules/sg/overheadline/web/OverheadLineController.java
xs 5 jaren geleden
bovenliggende
commit
d9155e170c

+ 35 - 24
src/main/java/com/jeeplus/modules/sg/overheadline/entity/JkxlDetailFee.java

@@ -2,6 +2,8 @@ package com.jeeplus.modules.sg.overheadline.entity;
 
 import com.jeeplus.common.utils.excel.annotation.ExcelField;
 
+import java.util.Objects;
+
 public class JkxlDetailFee {
     private String id;  //项目ID
     private String wbsCode;  //WBS识别码
@@ -38,32 +40,32 @@ 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 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() {
+    public Double getSbFee() {
         return sbFee;
     }
 
-    public void setSbFee(double sbFee) {
+    public void setSbFee(Double sbFee) {
         this.sbFee = sbFee;
     }
 
     @ExcelField(title="建筑费", align=1, sort=5)
-    public double getJzFee() {
+    public Double getJzFee() {
         return jzFee;
     }
 
-    public void setJzFee(double jzFee) {
+    public void setJzFee(Double jzFee) {
         this.jzFee = jzFee;
     }
 
@@ -342,55 +344,55 @@ public class JkxlDetailFee {
     }
 
     @ExcelField(title="设备购置费", align=2, sort=7)
-    public double getSbgzFee() {
+    public Double getSbgzFee() {
         return sbgzFee;
     }
 
-    public void setSbgzFee(double sbgzFee) {
+    public void setSbgzFee(Double sbgzFee) {
         this.sbgzFee = sbgzFee;
     }
     @ExcelField(title="安装费", align=2, sort=8)
-    public double getAzFee() {
+    public Double getAzFee() {
         return azFee;
     }
 
-    public void setAzFee(double azFee) {
+    public void setAzFee(Double azFee) {
         this.azFee = azFee;
     }
 
     @ExcelField(title="装材费", align=2, sort=9)
-    public double getZcFee() {
+    public Double getZcFee() {
         return zcFee;
     }
 
-    public void setZcFee(double zcFee) {
+    public void setZcFee(Double zcFee) {
         this.zcFee = zcFee;
     }
 
     @ExcelField(title="其他费用", align=2, sort=10)
-    public double getQtFee() {
+    public Double getQtFee() {
         return qtFee;
     }
 
-    public void setQtFee(double qtFee) {
+    public void setQtFee(Double qtFee) {
         this.qtFee = qtFee;
     }
 
     @ExcelField(title="结算价", align=2, sort=12)
-    public double getJsFee() {
+    public Double getJsFee() {
         return jsFee;
     }
 
-    public void setJsFee(double jsFee) {
+    public void setJsFee(Double jsFee) {
         this.jsFee = jsFee;
     }
 
     @ExcelField(title="差额", align=2, sort=13)
-    public double getcFee() {
+    public Double getcFee() {
         return cFee;
     }
 
-    public void setcFee(double cFee) {
+    public void setcFee(Double cFee) {
         this.cFee = cFee;
     }
 
@@ -411,4 +413,13 @@ public class JkxlDetailFee {
     public void setIndex(Integer index) {
         this.index = index;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof JkxlDetailFee)) return false;
+        JkxlDetailFee that = (JkxlDetailFee) o;
+        return wbsCode.equals(that.wbsCode);
+    }
+
 }

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

@@ -65,7 +65,7 @@ public class OverheadLineService {
            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;
+           double azFee = rgFee + cbrFee + jxFee;
            jkxlDetailFee.setQtFee(qtFee);
            jkxlDetailFee.setAzFee(azFee);
        }
@@ -122,14 +122,14 @@ public class OverheadLineService {
    }
 
     @Transactional(readOnly = false)
-   public void save(MultipartFile file,String name,String id,String projectId) throws IOException, InvalidFormatException {
+   public void save(MultipartFile file,String name,String id,String projectId,String type) throws IOException, InvalidFormatException {
        WbsItem wbsItem = itemService.get(id);
        if(wbsItem == null){
            WbsItem wbsItem1 = new WbsItem();
            wbsItem1.setProjectId(projectId);
            wbsItem1.setId(id);
            wbsItem1.setItemName(name);
-//           wbsItem1.setType(type);
+           wbsItem1.setType(type);
            //保存项目
            itemService.save(wbsItem1);
        }

+ 10 - 10
src/main/java/com/jeeplus/modules/sg/overheadline/web/OverheadLineController.java

@@ -58,17 +58,17 @@ public class OverheadLineController extends BaseController {
     String projectId = request.getParameter("projectId");    //工程ID
     String type = request.getParameter("type");     //工程类型
     String id = getId();
-//    try {
+    try {
       //保存数据到数据库
-      overheadLineService.save(file,projectName,id,projectId);
-//    } catch (RuntimeException e) {
-//      addMessage(redirectAttributes, "导入失败,"+e.getMessage());
-//      return "redirect:/a/project/list";
-//    }   catch (Exception e){
-//      addMessage(redirectAttributes, "导入失败");
-//      return "redirect:/a/project/list";
-//    }
-//    addMessage(redirectAttributes, "导入成功");
+      overheadLineService.save(file,projectName,id,projectId,type);
+    } catch (RuntimeException e) {
+      addMessage(redirectAttributes, "导入失败,"+e.getMessage());
+      return "redirect:/a/project/list";
+    }   catch (Exception e){
+      addMessage(redirectAttributes, "导入失败");
+      return "redirect:/a/project/list";
+    }
+    addMessage(redirectAttributes, "导入成功");
     return "redirect:/a/jkxl/list?id="+id;
   }
 

+ 3 - 3
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ItemMapper.xml

@@ -32,13 +32,13 @@
 		FROM sg_wbs_item a
 		<where>
 			<if test="itemName != null and itemName != ''">
-				AND a.item_name = #{itemName}
+				AND a.item_name LIKE CONCAT(CONCAT('%',#{itemName},'%'))
 			</if>
 			<if test="type != null  and type != ''">
-				AND a.type= #{type}
+				AND a.type LIKE CONCAT(CONCAT('%',#{type},'%'))
 			</if>
 			<if test="unit != null  and unit != ''">
-				AND a.unit= #{unit}
+				AND a.unit LIKE CONCAT(CONCAT('%',#{unit},'%'))
 			</if>
 			<if test="itemStartDate != null and itemEndDate != ''">
 				AND a.create_date &gt;= #{itemStartDate}

+ 2 - 2
src/main/java/com/jeeplus/modules/sg/project/mapper/xml/ProjectMapper.xml

@@ -29,10 +29,10 @@
 		FROM sg_wbs_project a   left join sys_user b on a.create_by = b.id
 		<where>
 			<if test="projectName != null and projectName != ''">
-				AND a.project_name = #{projectName}
+				AND a.project_name LIKE CONCAT(CONCAT('%',#{projectName},'%'))
 			</if>
 			<if test="createBy != null  and createBy != ''">
-				AND b.name= #{createBy}
+				AND b.name LIKE CONCAT(CONCAT('%',#{createBy},'%'))
 			</if>
 			<if test="projectStartDate != null and projectEndDate != ''">
 				AND a.create_date &gt;= #{projectStartDate}

+ 15 - 14
src/main/java/com/jeeplus/modules/sg/project/util/ExportUtil.java

@@ -253,7 +253,7 @@ public class ExportUtil {
 		log.debug("Initialize success.");
 	}
 	private void initialize(String title, List<String> headerList ,String[] st) {
-		this.wb = new SXSSFWorkbook(700);
+		this.wb = new SXSSFWorkbook();
 		for(int j=0;j<st.length;j++) {
 			rownum=0;
 			this.sheet = wb.createSheet(st[j]);
@@ -286,18 +286,18 @@ public class ExportUtil {
 //		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);
+			sheet.setColumnWidth(0, 4000);
+			sheet.setColumnWidth(1, 6000);
+			sheet.setColumnWidth(2, 4000);
+			sheet.setColumnWidth(3, 24000);
+			sheet.setColumnWidth(4, 4000);
+			sheet.setColumnWidth(5, 4000);
+			sheet.setColumnWidth(6, 4000);
+			sheet.setColumnWidth(7, 4000);
+			sheet.setColumnWidth(8, 6000);
+			sheet.setColumnWidth(9, 6000);
+			sheet.setColumnWidth(10, 6000);
+			sheet.setColumnWidth(11, 6000);
 			Cell tempCell1 = headerRow.createCell(4);
 			tempCell1.setCellValue("建筑工程费");
 			tempCell1.setCellStyle(styles.get("header"));
@@ -403,7 +403,7 @@ public class ExportUtil {
 	 * 添加一行
 	 * @return 行对象
 	 */
-	public Row addRow(int i){
+	public Row addRow(int i ){
 		return wb.getSheetAt(i).createRow(rownum++);
 	}
 	
@@ -468,6 +468,7 @@ public class ExportUtil {
 	 * @return list 数据列表
 	 */
 	public <E> ExportUtil setDataList(List<E> list ,int i){
+		rownum = 2;
 		for (E e : list){
 			int colunm = 0;
 			Row row = this.addRow(i);

+ 54 - 4
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -92,26 +92,76 @@ public class ProjectController extends BaseController {
         return j;
     }
 
-    //项目编辑
+    //导出
     @RequestMapping("/export")
     public String toList(HttpServletRequest request,Model model,HttpServletResponse response) throws IOException {
         String id = request.getParameter("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()];
+        String[] sts = new String[wbsItems.size()+1];
+        sts[0] = "合计";
         for (int i=0;i<wbsItems.size();i++){
-            sts[i] = wbsItems.get(i).getItemName();
+            sts[i+1] = wbsItems.get(i).getItemName();
         }
+        List<JkxlDetailFee> list = new ArrayList<>();
+        for(WbsItem wbsItem :wbsItems){
+            List<JkxlDetailFee> jkxlDetailFees = overheadLineService.findList(wbsItem.getId());
+            list.addAll(jkxlDetailFees);
+        }
+        List<JkxlDetailFee> list1 = getNewList(list);
         ExportUtil exportUtil = new ExportUtil(null, JkxlDetailFee.class,sts);
+        exportUtil.setDataList(list1,0);
         for(int j=0;j<wbsItems.size();j++){
             List<JkxlDetailFee> jkxlDetailFees = overheadLineService.findList(wbsItems.get(j).getId());
-            exportUtil.setDataList(jkxlDetailFees,j);
+            exportUtil.setDataList(jkxlDetailFees,j+1);
         }
         exportUtil.write(response,fileName).dispose();
         return "redirect:/a/project/list";
     }
 
+    private List<JkxlDetailFee> getNewList(List<JkxlDetailFee> list) {
+       List<JkxlDetailFee> list1 = new ArrayList<>();
+       for(JkxlDetailFee jkxlDetailFee: list){
+           String wbsCode = jkxlDetailFee.getWbsCode();
+           if(!list1.contains(jkxlDetailFee)){
+               list1.add(jkxlDetailFee);
+           }else {
+               for(JkxlDetailFee jkxlDetailFee1 : list1){
+                   if(jkxlDetailFee1.getWbsCode().equals(wbsCode)){
+                      double azFee = jkxlDetailFee1.getAzFee()!=null? jkxlDetailFee1.getAzFee():0.00;
+                      double azFee1 = jkxlDetailFee.getAzFee()!=null? jkxlDetailFee.getAzFee():0.00;
+                       double qtFee = jkxlDetailFee1.getQtFee()!=null? jkxlDetailFee1.getQtFee():0.00;
+                       double qtFee1 = jkxlDetailFee.getQtFee()!=null? jkxlDetailFee.getQtFee():0.00;
+                       double totalFee = jkxlDetailFee1.getTotalFee()!=null? jkxlDetailFee1.getTotalFee():0.00;
+                       double totalFee1 = jkxlDetailFee.getTotalFee()!=null? jkxlDetailFee.getTotalFee():0.00;
+                       double jsFee = jkxlDetailFee1.getJsFee()!=null? jkxlDetailFee1.getJsFee():0.00;
+                       double jsFee1 = jkxlDetailFee.getJsFee()!=null? jkxlDetailFee.getJsFee():0.00;
+                       double cFee = jkxlDetailFee1.getcFee()!=null? jkxlDetailFee1.getcFee():0.00;
+                       double cFee1 = jkxlDetailFee.getcFee()!=null? jkxlDetailFee.getcFee():0.00;
+                       jkxlDetailFee1.setAzFee(azFee+azFee1);
+                       jkxlDetailFee1.setQtFee(qtFee+qtFee1);
+                       jkxlDetailFee1.setTotalFee(totalFee+totalFee1);
+                       jkxlDetailFee1.setJsFee(jsFee+jsFee1);
+                       jkxlDetailFee1.setcFee(cFee+cFee1);
+                   }
+               }
+           }
+//           for(JkxlDetailFee jkxlDetailFee1 : list1){
+//               if(wbsCode.equals(jkxlDetailFee1.getWbsCode())){
+//                   jkxlDetailFee1.setAzFee(jkxlDetailFee1.getAzFee()+jkxlDetailFee.getAzFee());
+//                   jkxlDetailFee1.setQtFee(jkxlDetailFee1.getQtFee()+jkxlDetailFee.getQtFee());
+//                   jkxlDetailFee1.setTotalFee(jkxlDetailFee1.getTotalFee()+jkxlDetailFee.getTotalFee());
+//                   jkxlDetailFee1.setJsFee(jkxlDetailFee1.getJsFee()+jkxlDetailFee.getJsFee());
+//                   jkxlDetailFee1.setcFee(jkxlDetailFee1.getcFee()+jkxlDetailFee.getcFee());
+//               }else {
+//                   list1.add(jkxlDetailFee);
+//               }
+//           }
+       }
+        return list1;
+    }
+
     //项目删除
     @ResponseBody
     @RequestMapping(value = "delete")