浏览代码

Merge remote-tracking branch 'origin/master'

xs 5 年之前
父节点
当前提交
9fa38721cb

+ 0 - 16
.idea/misc.xml

@@ -13,20 +13,4 @@
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/classes" />
   </component>
-  <component name="masterDetails">
-    <states>
-      <state key="ProjectJDKs.UI">
-        <settings>
-          <last-edited>1.8</last-edited>
-          <splitter-proportions>
-            <option name="proportions">
-              <list>
-                <option value="0.2" />
-              </list>
-            </option>
-          </splitter-proportions>
-        </settings>
-      </state>
-    </states>
-  </component>
 </project>

+ 20 - 0
src/main/java/com/jeeplus/common/utils/excel/ImportExcel.java

@@ -226,6 +226,26 @@ public class ImportExcel {
 		}
 		return val;
 	}
+
+	public Double getDouble(int rowNum,int column){
+		Row row = this.sheet.getRow(rowNum);
+		Double d =0.00;
+		Object val = getCellValue(row,column);
+		if(!val.equals("")){
+		    d=Double.parseDouble(val.toString());
+        }
+		return d;
+	}
+
+    public String getValue(int rowNum,int column){
+        Row row = this.sheet.getRow(rowNum);
+        String str = "";
+        Object val = getCellValue(row,column);
+        if(!val.equals("")){
+            str = val.toString();
+        }
+        return str;
+    }
 	
 	/**
 	 * 获取导入数据列表

+ 175 - 0
src/main/java/com/jeeplus/modules/sg/entity/JkxlData.java

@@ -0,0 +1,175 @@
+package com.jeeplus.modules.sg.entity;
+
+public class JkxlData {
+    private String id;
+    private Double originalTotalCost;
+    private Double originalRgCost;
+    private Double originalCbrCost;
+    private Double originalFbrCost;
+    private Double originalZgj;
+    private Double originalJxCost;
+    private Double totalCost;
+    private Double rgCost;
+    private Double cbrCost;
+    private Double fbrCost;
+    private Double zgj;
+    private Double jxCost;
+    private Double measuresFee1;
+    private Double measuresFee2;
+    private Double otherCost;
+    private Double fees;
+    private Double tax;
+    private Double totalFee;
+
+    public Double getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(Double totalFee) {
+        this.totalFee = totalFee;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Double getOriginalTotalCost() {
+        return originalTotalCost;
+    }
+
+    public void setOriginalTotalCost(Double originalTotalCost) {
+        this.originalTotalCost = originalTotalCost;
+    }
+
+    public Double getOriginalRgCost() {
+        return originalRgCost;
+    }
+
+    public void setOriginalRgCost(Double originalRgCost) {
+        this.originalRgCost = originalRgCost;
+    }
+
+    public Double getOriginalCbrCost() {
+        return originalCbrCost;
+    }
+
+    public void setOriginalCbrCost(Double originalCbrCost) {
+        this.originalCbrCost = originalCbrCost;
+    }
+
+    public Double getOriginalFbrCost() {
+        return originalFbrCost;
+    }
+
+    public void setOriginalFbrCost(Double originalFbrCost) {
+        this.originalFbrCost = originalFbrCost;
+    }
+
+    public Double getOriginalZgj() {
+        return originalZgj;
+    }
+
+    public void setOriginalZgj(Double originalZgj) {
+        this.originalZgj = originalZgj;
+    }
+
+    public Double getOriginalJxCost() {
+        return originalJxCost;
+    }
+
+    public void setOriginalJxCost(Double originalJxCost) {
+        this.originalJxCost = originalJxCost;
+    }
+
+    public Double getTotalCost() {
+        return totalCost;
+    }
+
+    public void setTotalCost(Double totalCost) {
+        this.totalCost = totalCost;
+    }
+
+    public Double getRgCost() {
+        return rgCost;
+    }
+
+    public void setRgCost(Double rgCost) {
+        this.rgCost = rgCost;
+    }
+
+    public Double getCbrCost() {
+        return cbrCost;
+    }
+
+    public void setCbrCost(Double cbrCost) {
+        this.cbrCost = cbrCost;
+    }
+
+    public Double getFbrCost() {
+        return fbrCost;
+    }
+
+    public void setFbrCost(Double fbrCost) {
+        this.fbrCost = fbrCost;
+    }
+
+    public Double getZgj() {
+        return zgj;
+    }
+
+    public void setZgj(Double zgj) {
+        this.zgj = zgj;
+    }
+
+    public Double getJxCost() {
+        return jxCost;
+    }
+
+    public void setJxCost(Double jxCost) {
+        this.jxCost = jxCost;
+    }
+
+    public Double getMeasuresFee1() {
+        return measuresFee1;
+    }
+
+    public void setMeasuresFee1(Double measuresFee1) {
+        this.measuresFee1 = measuresFee1;
+    }
+
+    public Double getMeasuresFee2() {
+        return measuresFee2;
+    }
+
+    public void setMeasuresFee2(Double measuresFee2) {
+        this.measuresFee2 = measuresFee2;
+    }
+
+    public Double getOtherCost() {
+        return otherCost;
+    }
+
+    public void setOtherCost(Double otherCost) {
+        this.otherCost = otherCost;
+    }
+
+    public Double getFees() {
+        return fees;
+    }
+
+    public void setFees(Double fees) {
+        this.fees = fees;
+    }
+
+    public Double getTax() {
+        return tax;
+    }
+
+    public void setTax(Double tax) {
+        this.tax = tax;
+    }
+}

+ 40 - 0
src/main/java/com/jeeplus/modules/sg/entity/RuleRatio.java

@@ -0,0 +1,40 @@
+package com.jeeplus.modules.sg.entity;
+
+public class RuleRatio {
+    private String id;
+    private String editionNo;
+    private String ratioName;
+    private Double value;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getEditionNo() {
+        return editionNo;
+    }
+
+    public void setEditionNo(String editionNo) {
+        this.editionNo = editionNo;
+    }
+
+    public String getRatioName() {
+        return ratioName;
+    }
+
+    public void setRatioName(String ratioName) {
+        this.ratioName = ratioName;
+    }
+
+    public Double getValue() {
+        return value;
+    }
+
+    public void setValue(Double value) {
+        this.value = value;
+    }
+}

+ 76 - 0
src/main/java/com/jeeplus/modules/sg/entity/WbsElements.java

@@ -0,0 +1,76 @@
+package com.jeeplus.modules.sg.entity;
+
+public class WbsElements {
+    private String id;
+    private String shortId;
+    private String projectId;
+    private String describe;
+    private String subjectAllocate;
+    private String mountMatter;
+    private String mountServer;
+    private String parentNode;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getShortId() {
+        return shortId;
+    }
+
+    public void setShortId(String shortId) {
+        this.shortId = shortId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getDescribe() {
+        return describe;
+    }
+
+    public void setDescribe(String describe) {
+        this.describe = describe;
+    }
+
+    public String getSubjectAllocate() {
+        return subjectAllocate;
+    }
+
+    public void setSubjectAllocate(String subjectAllocate) {
+        this.subjectAllocate = subjectAllocate;
+    }
+
+    public String getMountMatter() {
+        return mountMatter;
+    }
+
+    public void setMountMatter(String mountMatter) {
+        this.mountMatter = mountMatter;
+    }
+
+    public String getMountServer() {
+        return mountServer;
+    }
+
+    public void setMountServer(String mountServer) {
+        this.mountServer = mountServer;
+    }
+
+    public String getParentNode() {
+        return parentNode;
+    }
+
+    public void setParentNode(String parentNode) {
+        this.parentNode = parentNode;
+    }
+}

+ 9 - 0
src/main/java/com/jeeplus/modules/sg/mapper/JkxlMapper.java

@@ -0,0 +1,9 @@
+package com.jeeplus.modules.sg.mapper;
+
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.entity.RuleRatio;
+
+@MyBatisMapper
+public interface JkxlMapper {
+    RuleRatio getValue(String ratioName);
+}

+ 12 - 0
src/main/java/com/jeeplus/modules/sg/mapper/xml/JkxlMapper.xml

@@ -0,0 +1,12 @@
+<?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="com.jeeplus.modules.sg.mapper.JkxlMapper">
+	<select id="getValue" parameterType="String" resultType="com.jeeplus.modules.sg.entity.RuleRatio">
+		select a,value from sg_rule_ratio
+		<where>
+			ratio_name = #{ratioName}
+		</where>
+	</select>
+
+	
+</mapper>

+ 17 - 0
src/main/java/com/jeeplus/modules/sg/service/JkxlService.java

@@ -0,0 +1,17 @@
+package com.jeeplus.modules.sg.service;
+
+import com.jeeplus.modules.sg.entity.RuleRatio;
+import com.jeeplus.modules.sg.mapper.JkxlMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class JkxlService {
+    @Autowired
+    private JkxlMapper jkxlMapper;
+
+
+   public RuleRatio getValueByName(String ratioName){
+       return jkxlMapper.getValue(ratioName);
+   }
+}

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

@@ -0,0 +1,10 @@
+package com.jeeplus.modules.sg.util;
+
+public class BashInfo {
+    public static final String RATIO_RGTC = "人工调差系数";
+    public static final String RATIO_CLTC = "材料调差系数";
+    public static final String RATIO_JXTC = "机械调差系数";
+    public static final String RATIO_CCRGTC = "拆除人工调差系数";
+    public static final String RATIO_CCCLTC = "拆除材料调差系数";
+    public static final String RATIO_CCJXTC = "拆除机械调差系数";
+}

+ 62 - 0
src/main/java/com/jeeplus/modules/sg/util/JkxlExcel.java

@@ -0,0 +1,62 @@
+package com.jeeplus.modules.sg.util;
+
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.sg.entity.JkxlData;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class JkxlExcel {
+    public static List<JkxlData> getData(MultipartFile  file,Double[] rate) throws IOException, InvalidFormatException {
+        ImportExcel importExcel = new ImportExcel(file,1,3);
+        List<JkxlData> list = new ArrayList<>();
+        int lastRow = importExcel.getLastDataRowNum();
+        int[] row = new int[6];
+        for(int i=0;i<lastRow;i++){
+            String type =  importExcel.getValue(i+1,2);
+            if(type.equals("1 基础工程")){
+                row[0] = i+1;
+            }
+            if(type.equals("2 杆塔工程")){
+                row[1] = i+1;
+            }
+            if(type.equals("3 接地工程")){
+                row[2] = i+1;
+            }
+            if(type.equals("4 架线工程")){
+                row[3] = i+1;
+            }
+            if(type.equals("5 附件安装工程")){
+                row[4] = i+1;
+            }
+            if(type.equals("6 辅助工程")){
+                row[5] = i+1;
+            }
+        }
+        for(int i=0;i<6;i++){
+            JkxlData jkxlData = new JkxlData();
+            Double originalRgCost = importExcel.getDouble(row[i],13);
+            Double rgCost = originalRgCost/(1+rate[0]);
+            Double originalCbrCost = importExcel.getDouble(row[i],14);
+            Double cbrCost = originalCbrCost/(1+rate[1]);
+            Double originalFbrCost = importExcel.getDouble(row[i],15);
+            Double fbrCost = originalFbrCost/(1+rate[1]);
+            Double originalJxrCost = importExcel.getDouble(row[i],17);
+            Double jxCost = originalJxrCost/(1+rate[2]);
+            jkxlData.setOriginalTotalCost(importExcel.getDouble(row[i],12));
+            jkxlData.setOriginalRgCost(originalRgCost);
+            jkxlData.setRgCost(rgCost);
+            jkxlData.setOriginalCbrCost(originalCbrCost);
+            jkxlData.setCbrCost(cbrCost);
+            jkxlData.setOriginalFbrCost(originalFbrCost);
+            jkxlData.setFbrCost(fbrCost);
+            jkxlData.setOriginalJxCost(originalJxrCost);
+            jkxlData.setJxCost(jxCost);
+            list.add(jkxlData);
+        }
+        return list;
+    }
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/sg/util/Text.java

@@ -0,0 +1,18 @@
+package com.jeeplus.modules.sg.util;
+
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.sg.entity.JkxlData;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.hibernate.validator.constraints.EAN;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+public class Text {
+ @Test
+  public void text() throws IOException, InvalidFormatException {
+      String file = "target/1.xls";
+//      List<JkxlData> list = JkxlExcel.getData(file);
+  }
+}

+ 43 - 0
src/main/java/com/jeeplus/modules/sg/web/JkxlController.java

@@ -0,0 +1,43 @@
+package com.jeeplus.modules.sg.web;
+
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.sg.entity.JkxlData;
+import com.jeeplus.modules.sg.service.JkxlService;
+import com.jeeplus.modules.sg.util.BashInfo;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 架空线路
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/jkxl")
+public class JkxlController extends BaseController {
+  @Autowired
+  private JkxlService jkxlService;
+
+  @RequestMapping("/import")
+  public String importFile(MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request, Model model){
+    try {
+       Double value = jkxlService.getValueByName(BashInfo.RATIO_RGTC).getValue();
+
+
+    } catch (Exception e){
+      addMessage(redirectAttributes, "导入失败");
+    }
+
+    addMessage(redirectAttributes, "导入成功");
+    return "";
+  }
+
+}