Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

yue 5 tahun lalu
induk
melakukan
c3c2b6d76e
37 mengubah file dengan 2450 tambahan dan 713 penghapusan
  1. 27 18
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCredit.java
  2. 3 15
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCreditChild1.java
  3. 3 14
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCreditChild2.java
  4. 31 0
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpJudge.java
  5. 3 3
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/ErpCreditChild1Mapper.java
  6. 4 4
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/ErpCreditChild2Mapper.java
  7. 15 15
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditChild1Mapper.xml
  8. 10 4
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditMapper.xml
  9. 15 15
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditChild2Mapper.xml
  10. 149 52
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/service/ErpCreditService.java
  11. 21 12
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ErpInfo.java
  12. 0 462
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil.java
  13. 53 29
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil1.java
  14. 2 5
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil2.java
  15. 81 0
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Result.java
  16. 13 4
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Test.java
  17. 68 18
      src/main/java/com/jeeplus/modules/sg/financial/erpcredit/web/ErpCreditController.java
  18. 202 0
      src/main/java/com/jeeplus/modules/sg/financial/project/entity/Project.java
  19. 19 0
      src/main/java/com/jeeplus/modules/sg/financial/project/mapper/ProjectMapper.java
  20. 169 0
      src/main/java/com/jeeplus/modules/sg/financial/project/mapper/xml/ProjectMapper.xml
  21. 49 0
      src/main/java/com/jeeplus/modules/sg/financial/project/service/ProjectService.java
  22. 394 0
      src/main/java/com/jeeplus/modules/sg/financial/project/util/ImportUtil.java
  23. 57 0
      src/main/java/com/jeeplus/modules/sg/financial/project/util/ProExcelInfo.java
  24. 203 0
      src/main/java/com/jeeplus/modules/sg/financial/project/web/ProjectController.java
  25. 1 1
      src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/DataMaintenanceMapper.java
  26. 1 8
      src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/xml/DataMaintenanceMapper.xml
  27. 41 6
      src/main/java/com/jeeplus/modules/sg/financial/settlement/service/DataMaintenanceService.java
  28. 227 2
      src/main/java/com/jeeplus/modules/sg/financial/settlement/util/ExcelWriter.java
  29. 3 5
      src/main/java/com/jeeplus/modules/sg/financial/settlement/web/DataMaintenanceController.java
  30. TEMPAT SAMPAH
      src/main/resources/freemarker/excelmodel/竣工决算模板.xlsx
  31. 15 7
      src/main/webapp/webpage/modules/sg/financial/erp/erpCreditList.js
  32. 28 0
      src/main/webapp/webpage/modules/sg/financial/erp/erpCreditTips.jsp
  33. 119 0
      src/main/webapp/webpage/modules/sg/financial/project/projectForm.jsp
  34. 311 0
      src/main/webapp/webpage/modules/sg/financial/project/projectList.js
  35. 89 0
      src/main/webapp/webpage/modules/sg/financial/project/projectList.jsp
  36. 8 4
      src/main/webapp/webpage/modules/sg/financial/settlement/dataMaintenanceList.js
  37. 16 10
      src/main/webapp/webpage/modules/sg/financial/settlement/dataMaintenanceList.jsp

+ 27 - 18
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCredit.java

@@ -31,8 +31,17 @@ public class ErpCredit extends DataEntity<ErpCredit>{
     private Double tenKvItsLine;//10kv线路
     private Double tenKvItesFhvFollow;//400v以下
     private String supplierName;//供应商名称
-    private List<ErpCreditChild1> erpCreditChild1s = new ArrayList<ErpCreditChild1>();
-    private List<ErpCreditChild2> erpCreditChild2s = new ArrayList<ErpCreditChild2>();
+    private String status;//状态
+    private List<ErpCreditEquipment> erpCreditChild1s = new ArrayList<ErpCreditEquipment>();
+    private List<ErpCreditMaterial> erpCreditChild2s = new ArrayList<ErpCreditMaterial>();
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
 
     public static long getSerialVersionUID() {
         return serialVersionUID;
@@ -214,22 +223,6 @@ public class ErpCredit extends DataEntity<ErpCredit>{
         this.supplierName = supplierName;
     }
 
-    public List<ErpCreditChild1> getErpCreditChild1s() {
-        return erpCreditChild1s;
-    }
-
-    public void setErpCreditChild1s(List<ErpCreditChild1> erpCreditChild1s) {
-        this.erpCreditChild1s = erpCreditChild1s;
-    }
-
-    public List<ErpCreditChild2> getErpCreditChild2s() {
-        return erpCreditChild2s;
-    }
-
-    public void setErpCreditChild2s(List<ErpCreditChild2> erpCreditChild2s) {
-        this.erpCreditChild2s = erpCreditChild2s;
-    }
-
     @Override
     public String toString() {
         return "ErpCredit{" +
@@ -259,4 +252,20 @@ public class ErpCredit extends DataEntity<ErpCredit>{
                 ", erpCreditChild2s=" + erpCreditChild2s +
                 '}';
     }
+
+    public List<ErpCreditEquipment> getErpCreditChild1s() {
+        return erpCreditChild1s;
+    }
+
+    public void setErpCreditChild1s(List<ErpCreditEquipment> erpCreditChild1s) {
+        this.erpCreditChild1s = erpCreditChild1s;
+    }
+
+    public List<ErpCreditMaterial> getErpCreditChild2s() {
+        return erpCreditChild2s;
+    }
+
+    public void setErpCreditChild2s(List<ErpCreditMaterial> erpCreditChild2s) {
+        this.erpCreditChild2s = erpCreditChild2s;
+    }
 }

+ 3 - 15
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCreditChild1.java

@@ -2,7 +2,7 @@ package com.jeeplus.modules.sg.financial.erpcredit.entity;
 
 import com.jeeplus.core.persistence.DataEntity;
 
-public class ErpCreditChild1 extends DataEntity<ErpCreditChild1> {//设备费实体类
+public class ErpCreditEquipment extends DataEntity<ErpCreditEquipment> {//设备费实体类
     private static final long serialVersionUID = 1L;
 
     private String eqmMaterialDetails1;//设备物料描述
@@ -13,10 +13,10 @@ public class ErpCreditChild1 extends DataEntity<ErpCreditChild1> {//设备费实
     private String eqmSupplierName;//供应商
     private ErpCredit erpCredit;//父类
 
-    public ErpCreditChild1(){
+    public ErpCreditEquipment(){
 
     }
-    public ErpCreditChild1(ErpCredit erpCredit) {
+    public ErpCreditEquipment(ErpCredit erpCredit) {
         this.erpCredit = erpCredit;
     }
 
@@ -80,16 +80,4 @@ public class ErpCreditChild1 extends DataEntity<ErpCreditChild1> {//设备费实
         this.erpCredit = erpCredit;
     }
 
-    @Override
-    public String toString() {
-        return "ErpCreditChild1{" +
-                "eqmMaterialDetails1='" + eqmMaterialDetails1 + '\'' +
-                ", eqmUnit='" + eqmUnit + '\'' +
-                ", eqmNumbers=" + eqmNumbers +
-                ", eqmTotalCapacity='" + eqmTotalCapacity + '\'' +
-                ", eqmBookedFee1=" + eqmBookedFee1 +
-                ", eqmSupplierName='" + eqmSupplierName + '\'' +
-                ", erpCredit=" + erpCredit +
-                '}';
-    }
 }

+ 3 - 14
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpCreditChild2.java

@@ -2,7 +2,7 @@ package com.jeeplus.modules.sg.financial.erpcredit.entity;
 
 import com.jeeplus.core.persistence.DataEntity;
 
-public class ErpCreditChild2 extends DataEntity<ErpCreditChild2> {//材料费实体类
+public class ErpCreditMaterial extends DataEntity<ErpCreditMaterial> {//材料费实体类
     private static final long serialVersionUID = 1L;
     private Double mtlBookedFee2;//材料 入账金额
     private String eqmMaterialDetails2;//设备物料描述
@@ -11,10 +11,10 @@ public class ErpCreditChild2 extends DataEntity<ErpCreditChild2> {//材料费实
     private String mtlSupplierName;//供应商
     private ErpCredit erpCredit;//父类
 
-    public ErpCreditChild2(ErpCredit erpCredit) {
+    public ErpCreditMaterial(ErpCredit erpCredit) {
         this.erpCredit = erpCredit;
     }
-    public ErpCreditChild2(){
+    public ErpCreditMaterial(){
 
     }
     public static long getSerialVersionUID() {
@@ -69,15 +69,4 @@ public class ErpCreditChild2 extends DataEntity<ErpCreditChild2> {//材料费实
         this.erpCredit = erpCredit;
     }
 
-    @Override
-    public String toString() {
-        return "ErpCreditChild2{" +
-                "mtlBookedFee2=" + mtlBookedFee2 +
-                ", eqmMaterialDetails2='" + eqmMaterialDetails2 + '\'' +
-                ", mtlUnit='" + mtlUnit + '\'' +
-                ", mtlNumbers=" + mtlNumbers +
-                ", mtlSupplierName='" + mtlSupplierName + '\'' +
-                ", erpCredit=" + erpCredit +
-                '}';
-    }
 }

+ 31 - 0
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/entity/ErpJudge.java

@@ -0,0 +1,31 @@
+package com.jeeplus.modules.sg.financial.erpcredit.entity;
+
+public class ErpJudge {
+    private String itemId;
+    private String mainFlag;
+    private String infoFlag;
+
+    public String getItemId() {
+        return itemId;
+    }
+
+    public void setItemId(String itemId) {
+        this.itemId = itemId;
+    }
+
+    public String getMainFlag() {
+        return mainFlag;
+    }
+
+    public void setMainFlag(String mainFlag) {
+        this.mainFlag = mainFlag;
+    }
+
+    public String getInfoFlag() {
+        return infoFlag;
+    }
+
+    public void setInfoFlag(String infoFlag) {
+        this.infoFlag = infoFlag;
+    }
+}

+ 3 - 3
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/ErpCreditChild1Mapper.java

@@ -4,12 +4,12 @@ import com.jeeplus.core.persistence.BaseEntity;
 import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
 import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCredit;
-import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditChild1;
+import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditEquipment;
 
 import java.util.List;
 
 @MyBatisMapper
-public interface ErpCreditChild1Mapper extends BaseMapper<ErpCreditChild1> {
+public interface ErpCreditEquipmentMapper extends BaseMapper<ErpCreditEquipment> {
 
-    public List<ErpCreditChild1> findErpCreditChild1List(List<String> strings);
+    public List<ErpCreditEquipment> findErpCreditChild1List(List<String> strings);
 }

+ 4 - 4
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/ErpCreditChild2Mapper.java

@@ -6,14 +6,14 @@ package com.jeeplus.modules.sg.financial.erpcredit.mapper;
 import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
 import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCredit;
-import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditChild1;
-import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditChild2;
+
+import com.jeeplus.modules.sg.financial.erpcredit.entity.ErpCreditMaterial;
 
 import java.util.List;
 
 
 @MyBatisMapper
-public interface ErpCreditChild2Mapper extends BaseMapper<ErpCreditChild2> {
+public interface ErpCreditMaterialMapper extends BaseMapper<ErpCreditMaterial> {
 
-    public List<ErpCreditChild2> findErpCreditChild2List(List<String> strings);
+    public List<ErpCreditMaterial> findErpCreditChild2List(List<String> strings);
 }

+ 15 - 15
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditChild1Mapper.xml

@@ -1,6 +1,6 @@
 <?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.financial.erpcredit.mapper.ErpCreditChild1Mapper">
+<mapper namespace="com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditEquipmentMapper">
     
 	<sql id="erpChild1Columns">
 		a.id AS "id",
@@ -19,17 +19,17 @@
 		a.eqm_supplier_name As "eqmSupplierName"
 	</sql>
 
-	<select id="get" resultType="ErpCreditChild1" >
+	<select id="get" resultType="erpCreditEquipment" >
 		SELECT 
 			<include refid="erpChild1Columns"/>
-		FROM js_erp_credit_child1 a
+		FROM js_erp_credit_equipment a
 		WHERE a.erp_credit_id = #{erpCredit.id}
 	</select>
 	
-	<select id="findList" resultType="ErpCreditChild1" >
+	<select id="findList" resultType="erpCreditEquipment" >
 		SELECT 
 			<include refid="erpChild1Columns"/>
-		FROM js_erp_credit_child1 a
+		FROM js_erp_credit_equipment a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -47,10 +47,10 @@
 		</choose>
 	</select>
 	
-	<select id="findAllList" resultType="ErpCreditChild1" >
+	<select id="findAllList" resultType="erpCreditEquipment" >
 		SELECT 
 			<include refid="erpChild1Columns"/>
-		FROM js_erp_credit_child1 a
+		FROM js_erp_credit_equipment a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -66,7 +66,7 @@
 	</select>
 	
 	<insert id="insert">
-		INSERT INTO js_erp_credit_child1(
+		INSERT INTO js_erp_credit_equipment(
 			id,
 			create_by,
 			create_date,
@@ -100,7 +100,7 @@
 	</insert>
 	
 	<update id="update">
-		UPDATE js_erp_credit_child1 SET
+		UPDATE js_erp_credit_equipment SET
 			update_by = #{updateBy.id},
 			update_date = #{updateDate},
 			remarks = #{remarks},
@@ -117,7 +117,7 @@
 	
 	<!--物理删除-->
 	<update id="delete">
-		DELETE FROM js_erp_credit_child1
+		DELETE FROM js_erp_credit_equipment
 		<choose>
 			<when test="id !=null and id != ''">
 				WHERE id = #{id}
@@ -130,7 +130,7 @@
 	
 	<!--逻辑删除-->
 	<update id="deleteByLogic">
-		UPDATE js_erp_credit_child1 SET
+		UPDATE js_erp_credit_equipment SET
 			del_flag = #{DEL_FLAG_DELETE}
 		<choose>
 			<when test="id !=null and id != ''">
@@ -144,14 +144,14 @@
 	
 	
 	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
-	<select id="findUniqueByProperty" resultType="TestDataChild11" statementType="STATEMENT">
-		select * FROM js_erp_credit_child1  where ${propertyName} = '${value}'
+	<select id="findUniqueByProperty" resultType="erpCreditEquipment" statementType="STATEMENT">
+		select * FROM js_erp_credit_equipment  where ${propertyName} = '${value}'
 	</select>
 	<!--查找多个条件-->
-	<select id="findErpCreditChild1List" parameterType="java.util.List" resultType="erpCreditChild1">
+	<select id="findErpCreditChild1List" parameterType="java.util.List" resultType="erpCreditEquipment">
 		select
 		<include refid="erpChild1Columns"/>
-		FROM js_erp_credit_child1 a
+		FROM js_erp_credit_equipment a
 		WHERE a.del_flag = '0'
 		and a.erp_credit_id in
 		<if test="list != null">

+ 10 - 4
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditMapper.xml

@@ -31,7 +31,8 @@
 		a.tenkv_its_line As "tenKvItsLine",
 		a.tenkv_ites_fhv_follow As "tenKvItesFhvFollow",
 		a.the_input_tax As "theInputTax",
-		a.ten_supplier_name As "supplierName"
+		a.ten_supplier_name As "supplierName",
+		a.status As "status"
 	</sql>
 
 	<select id="get" resultType="ErpCredit" >
@@ -51,6 +52,9 @@
 			<if test="itemId != null and itemId != ''">
 				AND a.item_id = #{itemId}
 			</if>
+			<if test="status!=null and status !=''">
+				AND a.status = #{status}
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -110,7 +114,8 @@
 			tenkv_its_line,
 			tenkv_ites_fhv_follow,
 			the_input_tax,
-			ten_supplier_name
+			ten_supplier_name,
+			status
 		) VALUES (
 			#{id},
 			#{createBy.id},
@@ -140,7 +145,8 @@
     		#{tenKvItsLine},
     		#{tenKvItesFhvFollow},
     		#{theInputTax},
-    		#{supplierName}
+    		#{supplierName},
+    		#{status}
 		)
 	</insert>
 
@@ -200,7 +206,7 @@
 		<include refid="erpColumns"/>
 		FROM js_erp_credit a
 		WHERE a.del_flag = '0'
-		and a.id in
+		and a.item_id in
 		<if test="list !=null">
 			<foreach collection="list" index="index" item="item" open="("
 					 separator="," close=")">

+ 15 - 15
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/mapper/xml/ErpCreditChild2Mapper.xml

@@ -1,6 +1,6 @@
 <?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.financial.erpcredit.mapper.ErpCreditChild2Mapper">
+<mapper namespace="com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMaterialMapper">
     
 	<sql id="erpChild2Columns">
 		a.id AS "id",
@@ -18,17 +18,17 @@
 		a.mtl_supplier_name As "mtlSupplierName"
 	</sql>
 
-	<select id="get" resultType="ErpCreditChild2" >
+	<select id="get" resultType="erpCreditMaterial" >
 		SELECT 
 			<include refid="erpChild2Columns"/>
-		FROM js_erp_credit_child2 a
+		FROM js_erp_credit_material a
 		WHERE a.erp_credit_id = #{erpCredit.id}
 	</select>
 	
-	<select id="findList" resultType="ErpCreditChild2" >
+	<select id="findList" resultType="erpCreditMaterial" >
 		SELECT 
 			<include refid="erpChild2Columns"/>
-		FROM js_erp_credit_child2 a
+		FROM js_erp_credit_material a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -46,10 +46,10 @@
 		</choose>
 	</select>
 	
-	<select id="findAllList" resultType="ErpCreditChild2" >
+	<select id="findAllList" resultType="erpCreditMaterial" >
 		SELECT 
 			<include refid="erpChild2Columns"/>
-		FROM js_erp_credit_child2 a
+		FROM js_erp_credit_material a
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
 			${dataScope}
@@ -65,7 +65,7 @@
 	</select>
 	
 	<insert id="insert">
-		INSERT INTO js_erp_credit_child2(
+		INSERT INTO js_erp_credit_material(
 			id,
 			create_by,
 			create_date,
@@ -93,7 +93,7 @@
 	</insert>
 	
 	<update id="update">
-		UPDATE js_erp_credit_child2 SET
+		UPDATE js_erp_credit_material SET
 			update_by = #{updateBy.id},
 			update_date = #{updateDate},
 			remarks = #{remarks},
@@ -107,7 +107,7 @@
 	
 	<!--物理删除-->
 	<update id="delete">
-		DELETE FROM js_erp_credit_child2
+		DELETE FROM js_erp_credit_material
 		<choose>
 			<when test="id !=null and id != ''">
 				WHERE id = #{id}
@@ -120,7 +120,7 @@
 	
 	<!--逻辑删除-->
 	<update id="deleteByLogic">
-		UPDATE js_erp_credit_child2 SET
+		UPDATE js_erp_credit_material SET
 			del_flag = #{DEL_FLAG_DELETE}
 		<choose>
 			<when test="id !=null and id != ''">
@@ -134,14 +134,14 @@
 	
 	
 	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
-	<select id="findUniqueByProperty" resultType="ErpCreditChild2" statementType="STATEMENT">
-		select * FROM js_erp_credit_child2  where ${propertyName} = '${value}'
+	<select id="findUniqueByProperty" resultType="erpCreditMaterial" statementType="STATEMENT">
+		select * FROM js_erp_credit_material  where ${propertyName} = '${value}'
 	</select>
 	<!--查找多个条件-->
-	<select id="findErpCreditChild2List" parameterType="java.util.List" resultType="erpCreditChild2">
+	<select id="findErpCreditChild2List" parameterType="java.util.List" resultType="erpCreditMaterial">
 		select
 		<include refid="erpChild2Columns"/>
-		FROM js_erp_credit_child2 a
+		FROM js_erp_credit_material a
 		WHERE a.del_flag = '0'
 		and a.erp_credit_id in
 		<if test="list !=null">

+ 149 - 52
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/service/ErpCreditService.java

@@ -10,13 +10,15 @@ import com.jeeplus.core.service.CrudService;
 import com.jeeplus.modules.sg.audit.information.entity.Information;
 import com.jeeplus.modules.sg.audit.information.service.InformationService;
 import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
-import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditChild1Mapper;
-import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditChild2Mapper;
+import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditEquipmentMapper;
 import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMapper;
+import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMaterialMapper;
+import com.jeeplus.modules.sg.financial.erpcredit.util.ErpInfo;
 import com.jeeplus.modules.sg.financial.erpcredit.util.ExportTemplate;
 import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil2;
 import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
 import com.jeeplus.modules.sg.financial.settlement.mapper.DataMaintenanceMapper;
+import com.jeeplus.modules.sg.financial.settlement.service.DataMaintenanceService;
 import org.apache.poi.hssf.usermodel.HSSFFont;
 import org.apache.poi.xssf.usermodel.XSSFFont;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -29,39 +31,46 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLEncoder;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 
 @Service
 @Transactional(readOnly = true)
 public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
     @Autowired
-    private ErpCreditChild1Mapper erpCreditChild1Mapper;
+    private ErpCreditEquipmentMapper erpCreditEquipmentMapper;
     @Autowired
-    private ErpCreditChild2Mapper erpCreditChild2Mapper;
+    private ErpCreditMaterialMapper erpCreditMaterialMapper;
     @Autowired
     private ErpCreditMapper erpCreditMapper;
     @Autowired
     private DataMaintenanceMapper dataMaintenanceMapper;
-
     @Autowired
     private InformationService informationService;
+    @Autowired
+    private DataMaintenanceService dataMaintenanceService;
 
-    public List<ErpCredit> getListErpCredit(List<String> strings){
-        List<ErpCredit> erpCreditList = erpCreditMapper.findErpCreditList(strings);
-        List<ErpCreditChild1> erpCreditChild1List = erpCreditChild1Mapper.findErpCreditChild1List(strings);
-        List<ErpCreditChild2> erpCreditChild2List = erpCreditChild2Mapper.findErpCreditChild2List(strings);
+    public List<ErpCredit> getListErpCredit(List<String> itemId){
+        List<ErpCredit> erpCreditList = erpCreditMapper.findErpCreditList(itemId);
+        List<String> strings = new ArrayList<String>();
+        for (ErpCredit erpCredit:erpCreditList){
+            strings.add(erpCredit.getId());
+        }
+        List<ErpCreditEquipment> erpCreditChild1List = erpCreditEquipmentMapper.findErpCreditChild1List(strings);
+        List<ErpCreditMaterial> erpCreditChild2List = erpCreditMaterialMapper.findErpCreditChild2List(strings);
         if (null!=erpCreditList&&erpCreditList.size()>0){
             for (ErpCredit erpCredit:erpCreditList){
                 if (null!=erpCreditChild1List&&erpCreditChild1List.size()>0){
-                    for (ErpCreditChild1 erpCreditChild1:erpCreditChild1List){
-                        if (erpCredit.getId().equals(erpCreditChild1.getErpCredit().getId())){
-                            erpCredit.getErpCreditChild1s().add(erpCreditChild1);
+                    for (ErpCreditEquipment erpCreditEquipment:erpCreditChild1List){
+                        if (erpCredit.getId().equals(erpCreditEquipment.getErpCredit().getId())){
+                            erpCredit.getErpCreditChild1s().add(erpCreditEquipment);
                         }
                     }
                 }
                 if (null!=erpCreditChild2List&&erpCreditChild2List.size()>0){
-                    for (ErpCreditChild2 erpCreditChild2:erpCreditChild2List){
+                    for (ErpCreditMaterial erpCreditChild2:erpCreditChild2List){
                         if (erpCredit.getId().equals(erpCreditChild2.getErpCredit().getId())){
                             erpCredit.getErpCreditChild2s().add(erpCreditChild2);
                         }
@@ -73,8 +82,8 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
     }
     public ErpCredit get(String id) {
         ErpCredit erpCredit = super.get(id);
-        erpCredit.setErpCreditChild1s(erpCreditChild1Mapper.findList(new ErpCreditChild1(erpCredit)));
-        erpCredit.setErpCreditChild2s(erpCreditChild2Mapper.findList(new ErpCreditChild2(erpCredit)));
+        erpCredit.setErpCreditChild1s(erpCreditEquipmentMapper.findList(new ErpCreditEquipment(erpCredit)));
+        erpCredit.setErpCreditChild2s(erpCreditMaterialMapper.findList(new ErpCreditMaterial(erpCredit)));
 //        erpCredit.setErpCreditChild3s(erpCreditChild3Mapper.findList(new ErpCreditChild3(erpCredit)));
         return erpCredit;
     }
@@ -88,34 +97,35 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
     }
 
     @Transactional(readOnly = false)
-    public void save(ErpCredit erpCredit) {
+    public void save(ErpCredit erpCredit,String string) {
+        erpCredit.setStatus(string);
         super.save(erpCredit);
-        for (ErpCreditChild1 erpCreditChild1 : erpCredit.getErpCreditChild1s()){
-            if (ErpCreditChild1.DEL_FLAG_NORMAL.equals(erpCredit.getDelFlag())){
+        for (ErpCreditEquipment erpCreditChild1 : erpCredit.getErpCreditChild1s()){
+            if (ErpCreditEquipment.DEL_FLAG_NORMAL.equals(erpCredit.getDelFlag())){
                 if (StringUtils.isBlank(erpCreditChild1.getId())) {
                     erpCreditChild1.setErpCredit(erpCredit);
                     erpCreditChild1.preInsert();
-                    erpCreditChild1Mapper.insert(erpCreditChild1);
+                    erpCreditEquipmentMapper.insert(erpCreditChild1);
                 }else {
                     erpCreditChild1.preUpdate();
-                    erpCreditChild1Mapper.update(erpCreditChild1);
+                    erpCreditEquipmentMapper.update(erpCreditChild1);
                 }
             }else {
-                erpCreditChild1Mapper.delete(erpCreditChild1);
+                erpCreditEquipmentMapper.delete(erpCreditChild1);
             }
         }
-        for (ErpCreditChild2 erpCreditChild2 : erpCredit.getErpCreditChild2s()){
-            if (ErpCreditChild2.DEL_FLAG_NORMAL.equals(erpCreditChild2.getDelFlag())){
+        for (ErpCreditMaterial erpCreditChild2 : erpCredit.getErpCreditChild2s()){
+            if (ErpCreditMaterial.DEL_FLAG_NORMAL.equals(erpCreditChild2.getDelFlag())){
                 if (StringUtils.isBlank(erpCreditChild2.getId())){
                     erpCreditChild2.setErpCredit(erpCredit);
                     erpCreditChild2.preInsert();
-                    erpCreditChild2Mapper.insert(erpCreditChild2);
+                    erpCreditMaterialMapper.insert(erpCreditChild2);
                 }else {
                     erpCreditChild2.preUpdate();
-                    erpCreditChild2Mapper.update(erpCreditChild2);
+                    erpCreditMaterialMapper.update(erpCreditChild2);
                 }
             }else {
-                erpCreditChild2Mapper.delete(erpCreditChild2);
+                erpCreditMaterialMapper.delete(erpCreditChild2);
             }
         }
 //        for (ErpCreditChild3 erpCreditChild3 : erpCredit.getErpCreditChild3s()){
@@ -137,20 +147,25 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
     @Transactional(readOnly = false)
     public void delete(ErpCredit erpCredit) {
         super.delete(erpCredit);
-        erpCreditChild1Mapper.delete(new ErpCreditChild1(erpCredit));
-        erpCreditChild2Mapper.delete(new ErpCreditChild2(erpCredit));
+        erpCreditEquipmentMapper.delete(new ErpCreditEquipment(erpCredit));
+        erpCreditMaterialMapper.delete(new ErpCreditMaterial(erpCredit));
 //        erpCreditChild3Mapper.delete(new ErpCreditChild3(erpCredit));
     }
 
     //维护表
     public List<MaintainData> getFindListMain(List<String> strings){
-        return dataMaintenanceMapper.getFindListMain(strings);
+        return dataMaintenanceMapper.findListMain();
     }
 
     //导出
-    public void getExport(List<String> strings, HttpServletResponse response){
-        List<ErpCredit> erpCreditList = getListErpCredit(strings);
-        List<MaintainData> maintainDatas = getFindListMain(strings);
+    public void getExport(String ids, HttpServletResponse response){
+        String[] strings = ids.split(",");
+        List<String> strs = new ArrayList<String>();
+        for (String str:strings){
+            strs.add(str);
+        }
+        List<ErpCredit> erpCreditList = getListErpCredit(strs);
+        List<MaintainData> maintainDatas = getFindListMain(strs);
         ExportTemplate exportTemplate = new ExportTemplate();
         File newFile = exportTemplate.createNewFile();
         // 新文件写入数据,并下载
@@ -229,41 +244,123 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
         // this.deleteFile(newFile);
     }
 
+    public List<ErpJudge> getCheck1(List<ErpCredit> erpCredits){
+        List<ErpJudge> erpJudges = new ArrayList<>();
+        ErpJudge erpJudge = null;
+        Map<String,List> map = new  HashMap<String,List>();
+        List<String> strings = new ArrayList<String>();
+        for (ErpCredit erpCredit:erpCredits){
+            strings.add(erpCredit.getItemId());
+        }
+        List<Information> informationList = informationService.findNoFinishList(strings);
+        List<String> maintainDataList = dataMaintenanceService.getJudge(strings);
+        if (null!=informationList&&informationList.size()>0){
+            for (Information information:informationList){
+                erpJudge=new ErpJudge();
+                erpJudge.setItemId(information.getProjectId());
+                erpJudge.setMainFlag("有");
+                erpJudge.setInfoFlag("否");
+            }
+            erpJudges.add(erpJudge);
+        }
+        if (null!=maintainDataList&&maintainDataList.size()>0){
+            Boolean flag = true;
+            for (String maintain:maintainDataList){
+                flag=true;
+                if (null!=informationList&&informationList.size()>0){
+                    for (ErpJudge erpJudge1:erpJudges){
+                       if (erpJudge1.getItemId().equals(maintain)){
+                           erpJudge1.setMainFlag("无");
+                           flag = false;
+                           break;
+                       }
+                    }
+                }
+                if (flag){
+                    erpJudge=new ErpJudge();
+                    erpJudge.setItemId(maintain);
+                    erpJudge.setMainFlag("无");
+                    erpJudge.setInfoFlag("是");
+                    erpJudges.add(erpJudge);
+                }
+            }
+        }
+        return erpJudges;
+    }
     /**
      * 判断
      * @return
      */
     public List getCheck(String ids){
         List<String> lists = new ArrayList<String>();
-        boolean flag = true;
+//        Map<String,String> map = new HashMap<String, String>();
+//        List<String> itemIdList = new ArrayList<String>();
+//        List<String> sortList = null;
+//        List<String> sortList2=null;
+//        boolean flag = false;
         String[] idArray =ids.split(",");
-        for (String str:idArray){
-            lists.add(str);
-        }
-//        List<MaintainData> maintainDatas = getFindListMain(lists);
-        List<Information> informationList = informationService.findNoFinishList(lists);
+        for (String str:idArray){ lists.add(str); }
+//        List<ErpCredit> erpCreditList = getListErpCredit(lists);
+//        for (ErpCredit erpCredit:erpCreditList){
+//            map.put(erpCredit.getId(),erpCredit.getItemId());
+//            itemIdList.add(erpCredit.getItemId());
+//        }
+//        List<MaintainData> maintainDatas =getFindListMain(itemIdList);//维护数据集合
+//        List<Information> informationList = informationService.findNoFinishList(itemIdList);
 //        if (null!=informationList&&informationList.size()>0){
-//            for (int k = 0; k < lists.size(); k++) {
-//                flag = true;
+//            sortList = new ArrayList<String>();
+//            sortList2=new ArrayList<String>();
+//            for (String list2:itemIdList) {
 //                for(Information information:informationList){
-//                    if (information.getProjectId().equals(lists.get(k))){
-//                        flag=false;
+//                    if (information.getProjectId().equals(list2)){
+//                        sortList.add(list2);
 //                        break;
 //                    }
 //                }
-//                if (flag){
-//                    lists.remove(k);
-//                    k--;
+//            }
+//            for(Map.Entry<String, String> entry : map.entrySet()){
+//                String mapKey = entry.getKey();
+//                String mapValue = entry.getValue();
+//                for (String str : sortList){
+//                    if (mapValue.equals(str)){
+//                        sortList2.add(mapKey);
+//                    }
+//                }
+//            }
+//            for (int i = 0; i < lists.size(); i++) {
+//                for (String str2:sortList2){
+//                    if (str2.equals(lists.get(i))){
+//                        lists.remove(i);
+//                        i--;
+//                        break;
+//                    }
 //                }
 //            }
-//        }else {
-//            lists=new ArrayList<String>();
 //        }
 //        if (null!=maintainDatas&&maintainDatas.size()>0){
-//             for (int i = 0; i < lists.size(); i++) {
-//                flag=true;
-//                for (MaintainData maintainData:maintainDatas){
-//                    if (maintainData.getProjectId().equals(lists.get(i))){
+//            sortList = new ArrayList<String>();
+//            sortList2 = new ArrayList<String>();
+//            for (MaintainData maintainData:maintainDatas){
+//               for (String str3:itemIdList){
+//                   if (maintainData.getProjectId().equals(str3)){
+//                       sortList.add(str3);//有数据
+//                       break;
+//                   }
+//               }
+//            }
+//            for(Map.Entry<String, String> entry : map.entrySet()){
+//                String mapKey1 = entry.getKey();
+//                String mapValue1 = entry.getValue();
+//                for (String str4: sortList){
+//                    if (mapValue1.equals(str4)){
+//                        sortList2.add(mapKey1);
+//                    }
+//                }
+//            }
+//            for (int i = 0; i < lists.size(); i++) {
+//                flag = true;
+//                for (String str2:sortList2){
+//                    if (str2.equals(lists.get(i))){
 //                        flag=false;
 //                        break;
 //                    }
@@ -272,7 +369,7 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
 //                    lists.remove(i);
 //                    i--;
 //                }
-//             }
+//            }
 //        }else {
 //            lists=null;
 //        }

+ 21 - 12
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ErpInfo.java

@@ -6,6 +6,7 @@ import org.apache.poi.ss.usermodel.Row;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.UUID;
 
 public  class ErpInfo {
     public final static String CON_PROJECT = "工程成本";
@@ -110,9 +111,9 @@ public  class ErpInfo {
         //获取erpCredit对象 list集合
         List<ErpCredit> erpCredits = getListErpCredit(list);
         //获取ErpCreditChild1对象 list集合 (设备费)
-        List<ErpCreditChild1> erpCreditChild1s = getListErpCreditChild1(list);
+        List<ErpCreditEquipment> erpCreditChild1s = getListErpCreditChild1(list);
         //获取ErpCreditChild2对象 list集合  (材料费)
-        List<ErpCreditChild2> erpCreditChild2s = getListErpCreditChild2(list);
+        List<ErpCreditMaterial> erpCreditChild2s = getListErpCreditChild2(list);
         //循环erpCredit对象 list集合
         for (ErpCredit erpCredit:erpCredits){
             tenKvLineLength=0.0;
@@ -127,7 +128,7 @@ public  class ErpInfo {
                 flag=true;
             }
             //设备费 集合 循环
-            for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
+            for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
                 //判断 erpCredit对象项目定义编号  与  ErpCreditChild1对象项目定义编号
                 if (erpCredit.getItemId().equals(erpCreditChild1.getErpCredit().getItemId())){
                     //把erpCreditChild1对象 添加到 List<ErpCredit>的List<ErpCreditChild1>中
@@ -136,7 +137,7 @@ public  class ErpInfo {
                 }
             }
             //材料费 集合 循环
-            for (ErpCreditChild2 erpCreditChild2:erpCreditChild2s){
+            for (ErpCreditMaterial erpCreditChild2:erpCreditChild2s){
                 //判断 erpCredit对象项目定义编号  与  ErpCreditChild2对象项目定义编号
                 if (erpCreditChild2.getErpCredit().getItemId().equals(erpCredit.getItemId())){
                     //把erpCreditChild1对象 添加到 List<ErpCredit>的List<ErpCreditChild2>中
@@ -473,15 +474,15 @@ public  class ErpInfo {
      * @param list 导入的表格 bean对象
      * @return 设备的list集合
      */
-    public static List<ErpCreditChild1> getListErpCreditChild1(List<ErpAccount> list){
+    public static List<ErpCreditEquipment> getListErpCreditChild1(List<ErpAccount> list){
         Double eqmNumbers=0.0;//设备台数
         Double eqmBookedFee=0.0;//设备入账金额
         String materialDetails="";//筛选kva
         boolean flag = true;//开关:判断集合是否重复 true-物料描述不同 false-项目定义编号相同且物料描述相同
-        ErpCreditChild1 erpCreditChild1;//设备对象
+        ErpCreditEquipment erpCreditChild1;//设备对象
         ErpCredit erpCredit;//设备父类
         ErpAccount erpAccount;//数据集合
-        List<ErpCreditChild1> creditListChild1 = new ArrayList<ErpCreditChild1>();
+        List<ErpCreditEquipment> creditListChild1 = new ArrayList<ErpCreditEquipment>();
         for (int i = 0; i < list.size(); i++) {
             flag=true;
             erpAccount=list.get(i);
@@ -517,7 +518,7 @@ public  class ErpInfo {
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_RNB)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_BST)||
                         erpAccount.getMaterialDetails().contains(ErpInfo.CON_HVS)){
-                    erpCreditChild1 = new ErpCreditChild1();//获取设备对象
+                    erpCreditChild1 = new ErpCreditEquipment();//获取设备对象
                     erpCredit=new ErpCredit();//获取设备 父类 主类
                     materialDetails = erpAccount.getMaterialDetails();//获取物料描述
                     //截取总容量kVA前数字
@@ -550,12 +551,12 @@ public  class ErpInfo {
      * @param erpAccounts 导入的表格 bean对象
      * @return 材料 list金额
      */
-    public static List<ErpCreditChild2> getListErpCreditChild2(List<ErpAccount> erpAccounts){
-        List<ErpCreditChild2> creditListChild2 = new ArrayList<ErpCreditChild2>();
+    public static List<ErpCreditMaterial> getListErpCreditChild2(List<ErpAccount> erpAccounts){
+        List<ErpCreditMaterial> creditListChild2 = new ArrayList<ErpCreditMaterial>();
         boolean flag = true;//判断 材料费 true-物料描述不同或者项目定义编号不同 false-仙姑定义编号物料描述相同
         double eqmBookedFee2=0.0;//材料入账金额
         double eqmNumber2=0.0;//设备台数
-        ErpCreditChild2 erpCreditChild2=null;
+        ErpCreditMaterial erpCreditChild2=null;
         ErpCredit erpCredit = null;
         ErpAccount erpAccount=null;
         for (int i = 0; i < erpAccounts.size(); i++) {
@@ -595,7 +596,7 @@ public  class ErpInfo {
                             !erpAccount.getMaterialDetails().contains(ErpInfo.CON_RNB) &&
                             !erpAccount.getMaterialDetails().contains(ErpInfo.CON_BST) &&
                             !erpAccount.getMaterialDetails().contains(ErpInfo.CON_HVS)) {
-                        erpCreditChild2 = new ErpCreditChild2();//获取材料费对象
+                        erpCreditChild2 = new ErpCreditMaterial();//获取材料费对象
                         erpCredit = new ErpCredit();//获取材料 父类 对象
                         erpCredit.setItemId(erpAccount.getProjectDefinitionCode());//添加项目id
                         erpCreditChild2.setEqmMaterialDetails2(erpAccount.getMaterialDetails());//添加物料描述
@@ -611,4 +612,12 @@ public  class ErpInfo {
         }
         return creditListChild2;
     }
+    public static String getStatus(){
+        int machineId = 1;
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        if (hashCodeV<0){
+            hashCodeV=-hashCodeV;
+        }
+        return  (machineId+String.format("%015d",hashCodeV));
+    }
 }

+ 0 - 462
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil.java

@@ -1,462 +0,0 @@
-/**
- * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
- */
-package com.jeeplus.modules.sg.financial.erpcredit.util;
-
-import com.google.common.collect.Lists;
-import com.jeeplus.common.utils.Encodes;
-import com.jeeplus.common.utils.Reflections;
-import com.jeeplus.common.utils.excel.annotation.ExcelField;
-import com.jeeplus.modules.sys.utils.DictUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.*;
-
-/**
- * 导出Excel文件(导出“XLSX”格式,支持大数据量导出   @see org.apache.poi.ss.SpreadsheetVersion)
- * @author jeeplus
- * @version 2016-04-21
- */
-public class ExportUtil {
-
-	private static Logger log = LoggerFactory.getLogger(ExportUtil.class);
-
-	/**
-	 * 工作薄对象
-	 */
-	private SXSSFWorkbook wb;
-
-	/**
-	 * 工作表对象
-	 */
-	private Sheet sheet;
-
-	/**
-	 * 样式列表
-	 */
-	private Map<String, CellStyle> styles;
-
-	/**
-	 * 当前行号
-	 */
-	private int rownum;
-
-	/**
-	 * 注解列表(Object[]{ ExcelField, Field/Method })
-	 */
-	List<Object[]> annotationList = Lists.newArrayList();
-
-	/**
-	 * 构造函数
-	 * @param title 表格标题,传“空值”,表示无标题
-	 * @param cls 实体对象,通过annotation.ExportField获取标题
-	 */
-	public ExportUtil(String title, Class<?> cls){
-		this(title, cls, 1);
-	}
-
-	/**
-	 * 构造函数
-	 * @param title 表格标题,传“空值”,表示无标题
-	 * @param cls 实体对象,通过annotation.ExportField获取标题
-	 * @param type 导出类型(1:导出数据;2:导出模板)
-	 * @param groups 导入分组
-	 */
-	public ExportUtil(String title, Class<?> cls, int type, int... groups){
-		// Get annotation field
-		Field[] fs = cls.getDeclaredFields();
-		for (Field f : fs){
-			ExcelField ef = f.getAnnotation(ExcelField.class);
-			if (ef != null && (ef.type()==0 || ef.type()==type)){
-				if (groups!=null && groups.length>0){
-					boolean inGroup = false;
-					for (int g : groups){
-						if (inGroup){
-							break;
-						}
-						for (int efg : ef.groups()){
-							if (g == efg){
-								inGroup = true;
-								annotationList.add(new Object[]{ef, f});
-								break;
-							}
-						}
-					}
-				}else{
-					annotationList.add(new Object[]{ef, f});
-				}
-			}
-		}
-		// Get annotation method
-		Method[] ms = cls.getDeclaredMethods();
-		for (Method m : ms){
-			ExcelField ef = m.getAnnotation(ExcelField.class);
-			if (ef != null && (ef.type()==0 || ef.type()==type)){
-				if (groups!=null && groups.length>0){
-					boolean inGroup = false;
-					for (int g : groups){
-						if (inGroup){
-							break;
-						}
-						for (int efg : ef.groups()){
-							if (g == efg){
-								inGroup = true;
-								annotationList.add(new Object[]{ef, m});
-								break;
-							}
-						}
-					}
-				}else{
-					annotationList.add(new Object[]{ef, m});
-				}
-			}
-		}
-		// Field sorting
-		Collections.sort(annotationList, new Comparator<Object[]>() {
-			public int compare(Object[] o1, Object[] o2) {
-				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
-						new Integer(((ExcelField)o2[0]).sort()));
-			};
-		});
-		// Initialize
-		List<String> headerList = Lists.newArrayList();
-		for (Object[] os : annotationList){
-			String t = ((ExcelField)os[0]).title();
-			// 如果是导出,则去掉注释
-			if (type==1){
-				String[] ss = StringUtils.split(t, "**", 2);
-				if (ss.length==2){
-					t = ss[0];
-				}
-			}
-			headerList.add(t);
-		}
-		initialize(title, headerList);
-	}
-
-	/**
-	 * 构造函数
-	 * @param title 表格标题,传“空值”,表示无标题
-	 * @param headers 表头数组
-	 */
-	public ExportUtil(String title, String[] headers) {
-		initialize(title, Lists.newArrayList(headers));
-	}
-
-	/**
-	 * 构造函数
-	 * @param title 表格标题,传“空值”,表示无标题
-	 * @param headerList 表头列表
-	 */
-	public ExportUtil(String title, List<String> headerList) {
-		initialize(title, headerList);
-	}
-	
-	/**
-	 * 初始化函数
-	 * @param title 表格标题,传“空值”,表示无标题
-	 * @param headerList 表头列表
-	 */
-	private void initialize(String title, List<String> headerList) {
-		this.wb = new SXSSFWorkbook(500);
-		this.sheet = wb.createSheet("Export");
-		this.styles = createStyles(wb);
-		// Create title
-		if (StringUtils.isNotBlank(title)){
-			Row titleRow = sheet.createRow(rownum++);
-			titleRow.setHeightInPoints(30);
-			Cell titleCell = titleRow.createCell(0);
-			titleCell.setCellStyle(styles.get("title"));
-			titleCell.setCellValue(title);
-			sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(),
-					titleRow.getRowNum(), titleRow.getRowNum(), headerList.size()-1));
-		}
-		// Create header
-		if (headerList == null){
-			throw new RuntimeException("headerList not null!");
-		}
-		Row headerRow = sheet.createRow(rownum++);
-		headerRow.setHeightInPoints(16);
-		for (int i = 0; i < headerList.size(); i++) {
-			Cell cell = headerRow.createCell(i);
-			cell.setCellStyle(styles.get("header"));
-			String[] ss = StringUtils.split(headerList.get(i), "**", 2);
-			if (ss.length==2){
-				cell.setCellValue(ss[0]);
-				Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
-						new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
-				comment.setString(new XSSFRichTextString(ss[1]));
-				cell.setCellComment(comment);
-			}else{
-				cell.setCellValue(headerList.get(i));
-			}
-			sheet.autoSizeColumn(i);
-		}
-		for (int i = 0; i < headerList.size(); i++) {  
-			int colWidth = sheet.getColumnWidth(i)*2;
-	        sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);  
-		}
-		log.debug("Initialize success.");
-	}
-	
-	/**
-	 * 创建表格样式
-	 * @param wb 工作薄对象
-	 * @return 样式列表
-	 */
-	private Map<String, CellStyle> createStyles(Workbook wb) {
-		Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
-		
-		CellStyle style = wb.createCellStyle();
-		style.setAlignment(CellStyle.ALIGN_CENTER);
-		style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
-		Font titleFont = wb.createFont();
-		titleFont.setFontName("Arial");
-		titleFont.setFontHeightInPoints((short) 16);
-		titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-		style.setFont(titleFont);
-		styles.put("title", style);
-
-		style = wb.createCellStyle();
-		style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
-		style.setBorderRight(CellStyle.BORDER_THIN);
-		style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
-		style.setBorderLeft(CellStyle.BORDER_THIN);
-		style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
-		style.setBorderTop(CellStyle.BORDER_THIN);
-		style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
-		style.setBorderBottom(CellStyle.BORDER_THIN);
-		style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
-		Font dataFont = wb.createFont();
-		dataFont.setFontName("Arial");
-		dataFont.setFontHeightInPoints((short) 10);
-		style.setFont(dataFont);
-		styles.put("data", style);
-		
-		style = wb.createCellStyle();
-		style.cloneStyleFrom(styles.get("data"));
-		style.setAlignment(CellStyle.ALIGN_LEFT);
-		styles.put("data1", style);
-
-		style = wb.createCellStyle();
-		style.cloneStyleFrom(styles.get("data"));
-		style.setAlignment(CellStyle.ALIGN_CENTER);
-		styles.put("data2", style);
-
-		style = wb.createCellStyle();
-		style.cloneStyleFrom(styles.get("data"));
-		style.setAlignment(CellStyle.ALIGN_RIGHT);
-		styles.put("data3", style);
-		
-		style = wb.createCellStyle();
-		style.cloneStyleFrom(styles.get("data"));
-//		style.setWrapText(true);
-		style.setAlignment(CellStyle.ALIGN_CENTER);
-		style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
-		style.setFillPattern(CellStyle.SOLID_FOREGROUND);
-		Font headerFont = wb.createFont();
-		headerFont.setFontName("Arial");
-		headerFont.setFontHeightInPoints((short) 10);
-		headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
-		headerFont.setColor(IndexedColors.WHITE.getIndex());
-		style.setFont(headerFont);
-		styles.put("header", style);
-		
-		return styles;
-	}
-
-	/**
-	 * 添加一行
-	 * @return 行对象
-	 */
-	public Row addRow(){
-		return sheet.createRow(rownum++);
-	}
-	
-
-	/**
-	 * 添加一个单元格
-	 * @param row 添加的行
-	 * @param column 添加列号
-	 * @param val 添加值
-	 * @return 单元格对象
-	 */
-	public Cell addCell(Row row, int column, Object val){
-		return this.addCell(row, column, val, 0, Class.class);
-	}
-	
-	/**
-	 * 添加一个单元格
-	 * @param row 添加的行
-	 * @param column 添加列号
-	 * @param val 添加值
-	 * @param align 对齐方式(1:靠左;2:居中;3:靠右)
-	 * @return 单元格对象
-	 */
-	public Cell addCell(Row row, int column, Object val, int align, Class<?> fieldType){
-		Cell cell = row.createCell(column);
-		CellStyle style = styles.get("data"+(align>=1&&align<=3?align:""));
-		try {
-			if (val == null){
-				cell.setCellValue("");
-			} else if (val instanceof String) {
-				cell.setCellValue((String) val);
-			} else if (val instanceof Integer) {
-				cell.setCellValue((Integer) val);
-			} else if (val instanceof Long) {
-				cell.setCellValue((Long) val);
-			} else if (val instanceof Double) {
-				cell.setCellValue((Double) val);
-			} else if (val instanceof Float) {
-				cell.setCellValue((Float) val);
-			} else if (val instanceof Date) {
-				DataFormat format = wb.createDataFormat();
-	            style.setDataFormat(format.getFormat("yyyy-MM-dd"));
-				cell.setCellValue((Date) val);
-			} else {
-				if (fieldType != Class.class){
-					cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
-				}else{
-					cell.setCellValue((String)Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), 
-						"fieldtype."+val.getClass().getSimpleName()+"Type")).getMethod("setValue", Object.class).invoke(null, val));
-				}
-			}
-		} catch (Exception ex) {
-			log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
-			cell.setCellValue(val.toString());
-		}
-		cell.setCellStyle(style);
-		return cell;
-	}
-
-	/**
-	 * 添加数据(通过annotation.ExportField添加数据)
-	 * @return list 数据列表
-	 */
-	public <E> ExportUtil setDataList(List<E> list){
-		for (E e : list){
-			int colunm = 0;
-			Row row = this.addRow();
-			StringBuilder sb = new StringBuilder();
-			for (Object[] os : annotationList){
-				ExcelField ef = (ExcelField)os[0];
-				Object val = null;
-				// Get entity value
-				try{
-					if (StringUtils.isNotBlank(ef.value())){
-						val = Reflections.invokeGetter(e, ef.value());
-					}else{
-						if (os[1] instanceof Field){
-							val = Reflections.invokeGetter(e, ((Field)os[1]).getName());
-						}else if (os[1] instanceof Method){
-							val = Reflections.invokeMethod(e, ((Method)os[1]).getName(), new Class[] {}, new Object[] {});
-						}
-					}
-					// If is dict, get dict label
-					if (StringUtils.isNotBlank(ef.dictType())){
-						val = DictUtils.getDictLabel(val==null?"":val.toString(), ef.dictType(), "");
-					}
-				}catch(Exception ex) {
-					// Failure to ignore
-					log.info(ex.toString());
-					val = "";
-				}
-				this.addCell(row, colunm++, val, ef.align(), ef.fieldType());
-				sb.append(val + ", ");
-			}
-			log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
-		}
-		return this;
-	}
-	
-	/**
-	 * 输出数据流
-	 * @param os 输出数据流
-	 */
-	public ExportUtil write(OutputStream os) throws IOException{
-		wb.write(os);
-		return this;
-	}
-	
-	/**
-	 * 输出到客户端
-	 * @param fileName 输出文件名
-	 */
-	public ExportUtil write(HttpServletResponse response, String fileName) throws IOException{
-		response.reset();
-        response.setContentType("application/octet-stream; charset=utf-8");
-        response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName));
-		write(response.getOutputStream());
-		return this;
-	}
-	
-	/**
-	 * 输出到文件
-	 * @param name 输出文件名
-	 */
-	public ExportUtil writeFile(String name) throws FileNotFoundException, IOException{
-		FileOutputStream os = new FileOutputStream(name);
-		this.write(os);
-		return this;
-	}
-	
-	/**
-	 * 清理临时文件
-	 */
-	public ExportUtil dispose(){
-		wb.dispose();
-		return this;
-	}
-	
-//	/**
-//	 * 导出测试
-//	 */
-//	public static void main(String[] args) throws Throwable {
-//		
-//		List<String> headerList = Lists.newArrayList();
-//		for (int i = 1; i <= 10; i++) {
-//			headerList.add("表头"+i);
-//		}
-//		
-//		List<String> dataRowList = Lists.newArrayList();
-//		for (int i = 1; i <= headerList.size(); i++) {
-//			dataRowList.add("数据"+i);
-//		}
-//		
-//		List<List<String>> dataList = Lists.newArrayList();
-//		for (int i = 1; i <=1000000; i++) {
-//			dataList.add(dataRowList);
-//		}
-//
-//		ExportExcel ee = new ExportExcel("表格标题", headerList);
-//		
-//		for (int i = 0; i < dataList.size(); i++) {
-//			Row row = ee.addRow();
-//			for (int j = 0; j < dataList.get(i).size(); j++) {
-//				ee.addCell(row, j, dataList.get(i).get(j));
-//			}
-//		}
-//		
-//		ee.writeFile("target/export.xlsx");
-//
-//		ee.dispose();
-//		
-//		log.debug("Export success.");
-//		
-//	}
-
-}

+ 53 - 29
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil1.java

@@ -5,6 +5,7 @@ import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
 
 import javax.xml.crypto.Data;
 import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 public class ExportUtil1 {
@@ -74,8 +75,8 @@ public class ExportUtil1 {
     //获取:一览表 实际价值
     public static Schedule getScheduleActual(Schedule schedule,ErpCredit erpCredit){
         boolean flag = false;
-        List<ErpCreditChild2> erpCreditChild2s = null;//得到材料费金额
-        List<ErpCreditChild1> erpCreditChild1s = null;//得到设备费金额
+        List<ErpCreditMaterial> erpCreditChild2s = null;//得到材料费金额
+        List<ErpCreditEquipment> erpCreditChild1s = null;//得到设备费金额
         double netAmount=0.0;//入账金额:设备费,材料费
         double actualTotalFee=0.0;//合计金额
         //循环erpCredit集合
@@ -89,7 +90,7 @@ public class ExportUtil1 {
         erpCreditChild2s = erpCredit.getErpCreditChild2s();//得到材料费
         //判断材料费
         if (erpCreditChild2s!=null&&erpCreditChild2s.size()>0){
-            for (ErpCreditChild2 erpCreditChild2:erpCreditChild2s){
+            for (ErpCreditMaterial erpCreditChild2:erpCreditChild2s){
                 if (null!=erpCreditChild2.getMtlBookedFee2()){
                     netAmount+=erpCreditChild2.getMtlBookedFee2();//得到材料费入账金额
                     flag = true;
@@ -105,7 +106,7 @@ public class ExportUtil1 {
         erpCreditChild1s = erpCredit.getErpCreditChild1s();//得到设备费
         //判断设备费
         if (null!=erpCreditChild1s&&erpCreditChild1s.size()>0){
-            for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
+            for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
                 if (null!=erpCreditChild1.getEqmBookedFee1()){
                     netAmount+=erpCreditChild1.getEqmBookedFee1();//得到
                     flag=true;
@@ -134,6 +135,7 @@ public class ExportUtil1 {
      * @return
      */
     public static ScheduleOther getScheduleOfOtherExpenses(List<ErpCredit> erpCreditList,List<MaintainData> maintainDataList){
+        DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         ScheduleOther scheduleOther = new ScheduleOther();
         Double requisitionSite=0.0;//建设场地征用及清理费
         Double  compensationAcquisition=0.0;//土地征用补偿费
@@ -161,8 +163,8 @@ public class ExportUtil1 {
                 cleaningFees+=maintainData.getDamages();//清理费
                 preWorkingFee+=maintainData.getPreliminaryWorkFee();//项目前期工作费
             }
-            scheduleOther.setCleaningFees(String.valueOf(cleaningFees));
-            scheduleOther.setPreWorkingFee(String.valueOf(preparationFee));
+            scheduleOther.setCleaningFees(decimalFormat.format(cleaningFees));
+            scheduleOther.setPreWorkingFee(decimalFormat.format(preparationFee));
         }
         if (null!=erpCreditList&&erpCreditList.size()>0){
             for (ErpCredit erpCredit:erpCreditList){
@@ -196,15 +198,15 @@ public class ExportUtil1 {
         requisitionSite=compensationAcquisition+compensateFee;
         //合计
         totalFee=requisitionSite+managementFee+technicalFee+inspectionFee+preparationFee+basicFee+reserveFee;
-        scheduleOther.setCompensateFee(String.valueOf(compensateFee));//土地征用补偿费
-        scheduleOther.setItemManageFee(String.valueOf(itemManageFee));//项目管理经费
-        scheduleOther.setSupervisionFee(String.valueOf(supervisionFee));//工程监理费
-        scheduleOther.setDesignFee(String.valueOf(designFee));//工程设计费
-        scheduleOther.setReserveFee(String.valueOf(reserveFee));//资本化利息
-        scheduleOther.setTechnicalFee(String.valueOf(technicalFee));//项目设计技术服务费
-        scheduleOther.setManagementFee(String.valueOf(managementFee));//项目建设管理费
-        scheduleOther.setRequisitionSite(String.valueOf(requisitionSite));//建设场地征用费
-        scheduleOther.setTotalFee(String.valueOf(totalFee));//合计
+        scheduleOther.setCompensateFee(decimalFormat.format(compensateFee));//土地征用补偿费
+        scheduleOther.setItemManageFee(decimalFormat.format(itemManageFee));//项目管理经费
+        scheduleOther.setSupervisionFee(decimalFormat.format(supervisionFee));//工程监理费
+        scheduleOther.setDesignFee(decimalFormat.format(designFee));//工程设计费
+        scheduleOther.setReserveFee(decimalFormat.format(reserveFee));//资本化利息
+        scheduleOther.setTechnicalFee(decimalFormat.format(technicalFee));//项目设计技术服务费
+        scheduleOther.setManagementFee(decimalFormat.format(managementFee));//项目建设管理费
+        scheduleOther.setRequisitionSite(decimalFormat.format(requisitionSite));//建设场地征用费
+        scheduleOther.setTotalFee(decimalFormat.format(totalFee));//合计
         return scheduleOther;
     }
 
@@ -219,14 +221,14 @@ public class ExportUtil1 {
         Double count = 0.0;
         List<MaterialEquipment> materialEquipments = new ArrayList<MaterialEquipment>();
         MaterialEquipment materialEquipment = null;
-        List<ErpCreditChild1> erpCreditChild1s = null;
-        List<ErpCreditChild2> erpCreditChild2s = null;
+        List<ErpCreditEquipment> erpCreditChild1s = null;
+        List<ErpCreditMaterial> erpCreditChild2s = null;
         for (ErpCredit erpCredit:erpCredits){
             erpCreditChild1s=erpCredit.getErpCreditChild1s();
             erpCreditChild2s=erpCredit.getErpCreditChild2s();
             //设备详情
             if (null!=erpCreditChild1s&&erpCreditChild1s.size()>0){
-                for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
+                for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
                     count=0.0;
                     materialEquipment=new MaterialEquipment();
                     materialEquipment.setId(erpCredit.getItemId());
@@ -261,9 +263,10 @@ public class ExportUtil1 {
             }
             //材料详情
             if (null!=erpCreditChild2s&&erpCreditChild2s.size()>0){
-                for (ErpCreditChild2 erpCreditChild2:erpCreditChild2s){
+                for (ErpCreditMaterial erpCreditChild2:erpCreditChild2s){
                     count=0.0;
-                    //得到材料费项目定义好
+                    materialEquipment=new MaterialEquipment();
+                    //得到材料费项目定义号
                     materialEquipment.setId(erpCredit.getItemId());
                     //得到材料费名称
                     materialEquipment.setMeName(erpCreditChild2.getEqmMaterialDetails2());
@@ -306,7 +309,7 @@ public class ExportUtil1 {
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         List<TransferOfPower1> transferOfPower1s = new ArrayList<TransferOfPower1>();
         TransferOfPower1 transferOfPower1 = null;
-        List<ErpCreditChild1> erpCreditChild1s = null;
+        List<ErpCreditEquipment> erpCreditChild1s = null;
         Double eqmNumbers = 0.0;//获取总数量
         Double eqmValue = 0.0;//相同项目定义号合计
         Double standInFee=0.0;//摊入费用
@@ -321,7 +324,7 @@ public class ExportUtil1 {
             erpCreditChild1s = erpCredit.getErpCreditChild1s();//获取集合
             if (null!=erpCreditChild1s&&erpCreditChild1s.size()>=0){
                 eqmNumbers = 0.0;
-                for (ErpCreditChild1 erpCreditChild11:erpCreditChild1s){
+                for (ErpCreditEquipment erpCreditChild11:erpCreditChild1s){
                     if (null!=erpCreditChild11.getEqmNumbers()){//当前项目定义号所有的台数合计
                         eqmNumbers+=erpCreditChild11.getEqmNumbers();
                     }
@@ -329,7 +332,7 @@ public class ExportUtil1 {
                 if (null!=erpCredit.getConsInstallFee()){//得到分摊后安装费
                     eqmNumbers=erpCredit.getConsTotalFee()/eqmNumbers;
                 }
-                for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
+                for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
                     if (null!=erpCredit.getTenKvModel()){//若10KV电缆、架空导线型号为空:得到设备价值
                         eqmValue = erpCreditChild1.getEqmBookedFee1()+eqmNumbers+eqmValue;//设备H6的和
                     }
@@ -394,7 +397,7 @@ public class ExportUtil1 {
         DecimalFormat decimalFormat   = new DecimalFormat("#0.00");
         DecimalFormat decimalFormat1   = new DecimalFormat("#0");
         List<TransferOfPower2> transferOfPower2s =  new ArrayList<TransferOfPower2>();
-        List<ErpCreditChild1> erpCreditChild1s = null;
+        List<ErpCreditEquipment> erpCreditChild1s = null;
         TransferOfPower2 transferOfPower2 = null;
         Double powerValue = 0.0;
         Double eqmNumbers = 0.0;//获取总数量
@@ -414,7 +417,7 @@ public class ExportUtil1 {
             }
             if (null!=erpCreditChild1s && erpCreditChild1s.size()>=0){
                 eqmNumbers = 0.0;
-                for (ErpCreditChild1 erpCreditChild11:erpCreditChild1s){
+                for (ErpCreditEquipment erpCreditChild11:erpCreditChild1s){
                     if (null!=erpCreditChild11.getEqmNumbers()){//当前项目定义号所有的台数合计
                         eqmNumbers+=erpCreditChild11.getEqmNumbers();
                     }
@@ -422,7 +425,7 @@ public class ExportUtil1 {
                 if (null!=erpCredit.getConsInstallFee()){//得到分摊后安装费
                     eqmNumbers=eqmNumbers/erpCredit.getConsTotalFee();
                 }
-                for (ErpCreditChild1 erpCreditChild1:erpCreditChild1s){
+                for (ErpCreditEquipment erpCreditChild1:erpCreditChild1s){
                     powerDeliveredAssets=0.0;
                     transferOfPower2 = new TransferOfPower2();
                     transferOfPower2.setPowerId(erpCredit.getItemId());
@@ -488,12 +491,15 @@ public class ExportUtil1 {
     }
     //概况表
     public static GeneralSituation getFeneraSituation(List<ErpCredit> erpCredits, List<MaintainData> maintainDataList){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         GeneralSituation generalSituation = new GeneralSituation();
         Double lineLength=0.0;//线路长度
         Double tenKvLength=0.0;//其中:10kv线路
         Double fourKvLength=0.0;//400v及以下
         List<String> organDataList = new ArrayList<String>();//预算批准机关、日期、文号
         List<Date> commencementDateList =new ArrayList<Date>();//开工日期
+        Date beforeDate=null;
+        Date endDate = null;
         List<Date> completionDateList = new ArrayList<Date>();//竣工日期
         String organData = "";//文号
         Double investmentBudget=0.0;//预算投资
@@ -529,7 +535,7 @@ public class ExportUtil1 {
                 if (null!=maintainData.getApprovalNumber()){//如果审批文号不为空
                     organDataList.add(maintainData.getApprovalNumber());
                 }
-                if (maintainData.getStartDate().toString()!=null&&maintainData.getStartDate().toString().length()>0){
+                if (null!=maintainData.getStartDate()&&maintainData.getEndDate().toString().length()>0){
                     commencementDateList.add(maintainData.getStartDate());
                 }
                 if (null!=maintainData.getEndDate()&&maintainData.getEndDate().toString().length()>0){
@@ -552,10 +558,28 @@ public class ExportUtil1 {
                 generalSituation.setOrganDataNumber(organData);
             }
             if (null!=commencementDateList&&commencementDateList.size()>0){
-                generalSituation.setCommencementDate(Collections.min(commencementDateList).toString());
+                for (Date date:commencementDateList){
+                    beforeDate = date;
+                    if (beforeDate!=null){
+                        if (date.before(beforeDate)){
+                            beforeDate=date;
+                        }
+                    }
+                }
+                generalSituation.setCommencementDate(sdf.format(beforeDate));
+//                generalSituation.setCommencementDate(sdf.format(Collections.min(commencementDateList)));
             }
             if (null!=completionDateList&&completionDateList.size()>0){
-                generalSituation.setCompletionDate(Collections.max(completionDateList).toString());
+                for (Date date:commencementDateList){
+                    endDate = date;
+                    if (endDate!=null){
+                        if (date.after(endDate)){
+                            endDate=date;
+                        }
+                    }
+                }
+                generalSituation.setCompletionDate(sdf.format(endDate));
+//                generalSituation.setCompletionDate(sdf.format(Collections.max(completionDateList)));
             }
             generalSituation.setInvestmentBudget(String.valueOf(investmentBudget));
         }

+ 2 - 5
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/ExportUtil2.java

@@ -24,7 +24,7 @@ public class ExportUtil2 {
             XSSFRow row = (XSSFRow) sheet.getRow(0);
             XSSFCell cell = row.getCell(3);
             List<Schedule> scheduleList = ExportUtil1.getScheduleList(erpCredits, maintainDataList);
-            for (int i = 0; i <scheduleList.size(); i++) {
+            for (int i = 0; i <10; i++) {
                 schedule = scheduleList.get(i);
                 row=(XSSFRow)sheet.getRow(i+6);
                 cell=row.getCell(0);
@@ -297,10 +297,7 @@ public class ExportUtil2 {
             XSSFCell cell = row.getCell(0);
             TransferOfPower2 transferOfPower2 = null;
             List<TransferOfPower2> transferOfPower2s = ExportUtil1.getTransferOfPower2(erpCredits);
-            for (TransferOfPower2 transferOfPower21:transferOfPower2s){
-                System.out.println(transferOfPower21);
-            }
-            for (int i = 0; i < transferOfPower2s.size(); i++) {
+            for (int i = 0; i <transferOfPower2s.size(); i++) {
                 transferOfPower2=transferOfPower2s.get(i);
                 row = (XSSFRow) sheet.getRow((int)i+5);
                 cell=row.getCell(0);

+ 81 - 0
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Result.java

@@ -0,0 +1,81 @@
+package com.jeeplus.modules.sg.financial.erpcredit.util;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jeeplus.core.mapper.JsonMapper;
+
+import java.util.LinkedHashMap;
+
+public class Result {
+    private boolean success = true;// 是否成功
+    private String errorCode = "-1";//错误代码
+    private String msg = "操作成功";// 提示信息
+    private String list= "";
+    private boolean flag = false;
+
+    public boolean isFlag() {
+        return flag;
+    }
+
+    public void setFlag(boolean flag) {
+        this.flag = flag;
+    }
+
+    public String getList() {
+        return list;
+    }
+
+    public void setList(String list) {
+        this.list = list;
+    }
+
+    private LinkedHashMap<String, Object> body = new LinkedHashMap<String, Object>();//封装json的map
+
+    public LinkedHashMap<String, Object> getBody() {
+        return body;
+    }
+
+    public void setBody(LinkedHashMap<String, Object> body) {
+        this.body = body;
+    }
+
+    public void put(String key, Object value){//向json中添加属性,在js中访问,请调用data.map.key
+        body.put(key, value);
+    }
+
+    public void remove(String key){
+        body.remove(key);
+    }
+
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {//向json中添加属性,在js中访问,请调用data.msg
+        this.msg = msg;
+    }
+
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    @JsonIgnore//返回对象时忽略此属性
+    public String getJsonStr() {//返回json字符串数组,将访问msg和key的方式统一化,都使用data.key的方式直接访问。
+
+        String json = JsonMapper.getInstance().toJson(this);
+        return json;
+    }
+
+    public void setErrorCode(String errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    public String getErrorCode() {
+        return errorCode;
+    }
+}

+ 13 - 4
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/util/Test.java

@@ -10,11 +10,10 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLEncoder;
+import java.text.DateFormat;
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 public class Test {
     public void getTest() {
@@ -156,4 +155,14 @@ public class Test {
         // 删除创建的新文件
         // this.deleteFile(newFile);
     }
+    @org.junit.Test
+    public void getTest5(){
+         int machineId = 1;
+         int hashCodeV = UUID.randomUUID().toString().hashCode();
+         if (hashCodeV<0){
+             hashCodeV=-hashCodeV;
+          }
+            System.out.println(machineId+String.format("%010d",hashCodeV));
+
+    }
 }

+ 68 - 18
src/main/java/com/jeeplus/modules/sg/financial/erpcredit/web/ErpCreditController.java

@@ -13,18 +13,17 @@ import com.jeeplus.modules.sg.audit.information.entity.Information;
 import com.jeeplus.modules.sg.audit.information.service.InformationService;
 import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
 import com.jeeplus.modules.sg.financial.erpcredit.service.ErpCreditService;
-import com.jeeplus.modules.sg.financial.erpcredit.util.ErpInfo;
-import com.jeeplus.modules.sg.financial.erpcredit.util.ExportTemplate;
-import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil2;
-import com.jeeplus.modules.sg.financial.erpcredit.util.ImportUtil;
+import com.jeeplus.modules.sg.financial.erpcredit.util.*;
 import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
 import com.jeeplus.modules.sg.financial.settlement.service.DataMaintenanceService;
+import groovy.util.IFileNameFinder;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpRequest;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -35,10 +34,13 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 import javax.validation.ConstraintViolationException;
 import java.io.*;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -81,7 +83,13 @@ public class ErpCreditController extends BaseController {
 //	@RequiresPermissions("sg:financial:erpCredit:list")
 	@RequestMapping(value = "data")
 	public Map<String, Object> data(ErpCredit erpCredit, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<ErpCredit> page = erpCreditService.findPage(new Page<ErpCredit>(request, response), erpCredit);
+		HttpSession session = request.getSession();
+		String attribute = (String) session.getAttribute("erpStatus");
+		Page<ErpCredit> page = null;
+		if (attribute!=null){
+			erpCredit.setStatus(attribute);
+			page = erpCreditService.findPage(new Page<ErpCredit>(request, response), erpCredit);
+		}
 		return getBootstrapData(page);
 	}
 
@@ -95,6 +103,34 @@ public class ErpCreditController extends BaseController {
 		return "modules/sg/financial/erp/erpCreditForm";
 	}
 
+	@RequestMapping(value = "tips")
+	public String Tips(String str,Model model, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
+		str = (String)request.getParameter("str");
+		str = URLDecoder.decode(str,"UTF-8");
+		String[] strings2;
+		List<ErpJudge> erpJudges = new ArrayList<ErpJudge>();
+		ErpJudge erpJudge = null;
+		if (str.contains("-")){
+			String[] strings =  str.split("-");
+			for (String str1 :strings){
+				strings2 = str1.split(",");
+				erpJudge = new ErpJudge();
+				erpJudge.setItemId(strings2[0]);
+				erpJudge.setMainFlag(strings2[1]);
+				erpJudge.setInfoFlag(strings2[2]);
+				erpJudges.add(erpJudge);
+			}
+		}else {
+			String[] strings3 = str.split(",");
+			erpJudge = new ErpJudge();
+			erpJudge.setItemId(strings3[0]);
+			erpJudge.setMainFlag(strings3[1]);
+			erpJudge.setInfoFlag(strings3[2]);
+			erpJudges.add(erpJudge);
+		}
+		model.addAttribute("erpList",erpJudges);
+		return "modules/sg/financial/erp/erpCreditTips";
+	}
 	/**
 	 * 保存表单
 	 */
@@ -154,16 +190,10 @@ public class ErpCreditController extends BaseController {
 	@ResponseBody
 //	@RequiresPermissions("sg:financial:erpCredit:export")
 	@RequestMapping(value = "export")
-	public AjaxJson exportFile(String ids, HttpServletRequest request, HttpServletResponse response){
-		AjaxJson j = new AjaxJson();
-		List<String> strings = erpCreditService.getCheck(ids);
-		if (null==strings&&strings.size()<=0){
-			j.setSuccess(false);
-			j.setMsg("导出失败!失败信:"+"不符合条件");
-			return j;
-		}
+	public Result exportFile(String ids,HttpServletRequest request, HttpServletResponse response){
+		Result j = new Result();
 		try {
-			erpCreditService.getExport(strings,response);
+			erpCreditService.getExport(ids,response);
 			j.setSuccess(true);
 			j.setMsg("导出成功!");
 		}catch (Exception e){
@@ -183,8 +213,9 @@ public class ErpCreditController extends BaseController {
 	@ResponseBody
 //	@RequiresPermissions("sg:financial:erpCredit:import")
 	@RequestMapping(value = "import")
-	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request){
-		AjaxJson j = new AjaxJson();
+	public Result importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request,Model model) throws IOException, InvalidFormatException {
+		Result j = new Result();
+		String str = "";
 		try {
 			int successNum = 0;
 			int failureNum = 0;
@@ -192,10 +223,28 @@ public class ErpCreditController extends BaseController {
 			ImportUtil importUtil = new ImportUtil(file, 0, 0);
 			List<ErpAccount> erpAccounts = ErpInfo.getErpAccount(importUtil);//获取表格数据
 			List<ErpCredit> erpCredits = ErpInfo.getAllErpCreditList(erpAccounts);//获取单条数据
+			//判断条件
+			List<ErpJudge> erpJudges  = erpCreditService.getCheck1(erpCredits);
+			if (null!=erpJudges&&erpJudges.size()>0){
+				String judge = "";
+				for (ErpJudge erpJudge:erpJudges){
+					judge = erpJudge.getItemId()+","+erpJudge.getMainFlag()+","+erpJudge.getInfoFlag()+"-";
+				}
+				judge = judge.substring(0,judge.length()-1);
+				j.setList(judge);
+				j.setFlag(true);
+				j.setSuccess(false);
+				return j;
+			}
+			for (ErpCredit erpCredit:erpCredits){
+				str+=erpCredit.getItemId()+",";
+			}
+			str = str.substring(0,str.length()-1);
+			String random = ErpInfo.getStatus();
+			request.getSession().setAttribute("erpStatus",random);
 			for (ErpCredit erpCredit : erpCredits){
-				System.out.println(erpCredit);
 				try{
-					erpCreditService.save(erpCredit);
+					erpCreditService.save(erpCredit,random);
 					successNum++;
 				}catch(ConstraintViolationException ex){
 					failureNum++;
@@ -207,6 +256,7 @@ public class ErpCreditController extends BaseController {
 				failureMsg.insert(0, ",失败 "+failureNum+" 条ERP账户记录。");
 			}
 			j.setMsg( "已成功导入 "+successNum+" 条ERP账户记录"+failureMsg);
+			j.setList(str);
 		} catch (Exception e) {
 			j.setSuccess(false);
 			j.setMsg("导入ERP失败!失败信息:"+e.getMessage());

+ 202 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/entity/Project.java

@@ -0,0 +1,202 @@
+package com.jeeplus.modules.sg.financial.project.entity;
+
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.core.persistence.DataEntity;
+
+public class Project extends DataEntity<Project> {
+    private static final long serialVersionUID = 1L;
+    private String type;//类型
+    private String demandUnit;//需求提出单位
+    private String bdzName;//变电站名称
+    private String lineName;//线路名称
+    private String requireName;//项目需求名称
+    private String bulidClassificationResons;//建设理由分类
+    private String bulbidResons;//建设理由
+    private String asicEquipment;//设备基本情况
+    private String runTheClass;//运行班
+    private String projectTeam;//项目组
+    private Double costEstimate;//费用估算
+    private String whetherRheUpwind;//是否迎风期度夏项目
+    private String sureDaDate;//确定下达时间
+    private String textRemark;//备注
+    private String status;
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+    @ExcelField(title="类型", align=2, sort=1)
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+    @ExcelField(title="需求提出单位", align=2, sort=1)
+    public String getDemandUnit() {
+        return demandUnit;
+    }
+
+    public void setDemandUnit(String demandUnit) {
+        this.demandUnit = demandUnit;
+    }
+    @ExcelField(title="变电站名称", align=2, sort=1)
+    public String getBdzName() {
+        return bdzName;
+    }
+
+    public void setBdzName(String bdzName) {
+        this.bdzName = bdzName;
+    }
+    @ExcelField(title="线路名称", align=2, sort=1)
+    public String getLineName() {
+        return lineName;
+    }
+
+    public void setLineName(String lineName) {
+        this.lineName = lineName;
+    }
+    @ExcelField(title="项目需求名称", align=2, sort=1)
+    public String getRequireName() {
+        return requireName;
+    }
+
+    public void setRequireName(String requireName) {
+        this.requireName = requireName;
+    }
+    @ExcelField(title="建设理由分类", align=2, sort=1)
+    public String getBulidClassificationResons() {
+        return bulidClassificationResons;
+    }
+
+    public void setBulidClassificationResons(String bulidClassificationResons) {
+        this.bulidClassificationResons = bulidClassificationResons;
+    }
+    @ExcelField(title="建设理由", align=2, sort=1)
+    public String getBulbidResons() {
+        return bulbidResons;
+    }
+
+    public void setBulbidResons(String bulbidResons) {
+        this.bulbidResons = bulbidResons;
+    }
+    @ExcelField(title="设备基本情况", align=2, sort=1)
+    public String getAsicEquipment() {
+        return asicEquipment;
+    }
+
+    public void setAsicEquipment(String asicEquipment) {
+        this.asicEquipment = asicEquipment;
+    }
+    @ExcelField(title="运行班", align=2, sort=1)
+    public String getRunTheClass() {
+        return runTheClass;
+    }
+
+    public void setRunTheClass(String runTheClass) {
+        this.runTheClass = runTheClass;
+    }
+    @ExcelField(title="项目组", align=2, sort=1)
+    public String getProjectTeam() {
+        return projectTeam;
+    }
+
+    public void setProjectTeam(String projectTeam) {
+        this.projectTeam = projectTeam;
+    }
+    @ExcelField(title="费用估算", align=2, sort=1)
+    public Double getCostEstimate() {
+        return costEstimate;
+    }
+
+    public void setCostEstimate(Double costEstimate) {
+        this.costEstimate = costEstimate;
+    }
+    @ExcelField(title="是否迎风期度夏项目", align=2, sort=1)
+    public String getWhetherRheUpwind() {
+        return whetherRheUpwind;
+    }
+
+    public void setWhetherRheUpwind(String whetherRheUpwind) {
+        this.whetherRheUpwind = whetherRheUpwind;
+    }
+    @ExcelField(title="确定下达时间", align=2, sort=1)
+    public String getSureDaDate() {
+        return sureDaDate;
+    }
+
+    public void setSureDaDate(String sureDaDate) {
+        this.sureDaDate = sureDaDate;
+    }
+    @ExcelField(title="备注", align=2, sort=1)
+    public String getTextRemark() {
+        return textRemark;
+    }
+
+    public void setTextRemark(String textRemark) {
+        this.textRemark = textRemark;
+    }
+    //    private String powerLine;//停电线路
+//    private String itemType;//项目类型
+//    private String prowerPagerItem;//是否为停电打包项目
+//    private String officeJudgment;//证处初步判断
+//    private String includedCivil;//是否含土建
+//    private String steelTube;//钢管杆基础类型
+//    private String bulidResons;//是否需要规划报批
+//    private String equipmentModificationType;//设备改造类型
+//    private String changeTheSize;//改造设备尺寸及间隔数
+//    private String canBecustomized;//是否可定制设备
+//    private String newDeviceName;//是否含新设备命名
+//    private String headOperationOf;//是否含变电站新间隔头运
+//    private String nonSetElectrical;//是否含非设电电气点电器施工
+//    private String automationIncluded;//是否含自动化
+//    private String twoOfThree;//二摇或三遥
+//    private String phoneStyle;//通信方式
+//    private String openCentralizedOr;//柱开集中或就地
+//    private String networkCabinet;//环网柜
+//    private String rightrOfWayDtu;//站房DTU
+//    private String checkHomeWork;//是否需要带带你作业查探
+//    private String constructionOfChannel;//施工通道
+//    private String canBexpanded;//设备基础是否可以扩容
+//    private String fieldEquipmentSize;//现场设备尺寸
+//    private String maximumCapacitySize;//最多可狂容尺寸
+//    private String programSecurityRisks;//方案安全隐患
+//    private String constructionImpact;//是否存在低压或同心县等施工影响
+//    private String projectToRepeat;//立项重复
+//    private String beenImplemented;//是否已经实施
+//    private String transformerNoLoad;//变压器无负荷
+//    private String LineConsistency;//线路名称一致性
+//    private String quantityConsistent;//工程量是否一致
+//    private String dryConsistency;//设备开光干好一致性
+//    private String thePlaceType;//证处类型
+//    private String precondition;//前置条件
+//    private String dtuEmplacement;//DTU安放核查
+//    private String dateOfProduction;//核查环网生产日期
+//    private String integrationModule;//二次是否集成模块
+//    private String ptReplaced;//PT是否需要更换
+//    private String overallTransformation;//设备是否有整体改造必要
+
+    @Override
+    public String toString() {
+        return "Project{" +
+                "type='" + type + '\'' +
+                ", demandUnit='" + demandUnit + '\'' +
+                ", bdzName='" + bdzName + '\'' +
+                ", lineName='" + lineName + '\'' +
+                ", requireName='" + requireName + '\'' +
+                ", bulidClassificationResons='" + bulidClassificationResons + '\'' +
+                ", bulbidResons='" + bulbidResons + '\'' +
+                ", asicEquipment='" + asicEquipment + '\'' +
+                ", runTheClass='" + runTheClass + '\'' +
+                ", projectTeam='" + projectTeam + '\'' +
+                ", costEstimate=" + costEstimate +
+                ", whetherRheUpwind='" + whetherRheUpwind + '\'' +
+                ", sureDaDate='" + sureDaDate + '\'' +
+                ", textRemark='" + textRemark + '\'' +
+                '}';
+    }
+}

+ 19 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/mapper/ProjectMapper.java

@@ -0,0 +1,19 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.project.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.financial.project.entity.Project;
+import com.jeeplus.modules.test.one.dialog.entity.Leave1;
+
+/**
+ * 请假表单MAPPER接口
+ * @author lgf
+ * @version 2018-06-12
+ */
+@MyBatisMapper
+public interface ProjectMapper extends BaseMapper<Project> {
+	
+}

+ 169 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/mapper/xml/ProjectMapper.xml

@@ -0,0 +1,169 @@
+<?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.financial.project.mapper.ProjectMapper">
+    
+	<sql id="projectColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.pro_type As "type",
+		a.demand_unit AS "demandUnit",
+		a.bdz_name As "bdzName",
+	  	a.line_name As "lineName",
+	  	a.require_name AS "requireName",
+		a.build_classification_resons As "bulidClassificationResons",
+		a.bulbid_resons As "bulbidResons",
+		a.asic_equipment AS "asicEquipment",
+		a.run_the_class As "runTheClass",
+		a.project_team AS "projectTeam",
+		a.cost_estimate As "costEstimate",
+		a.whether_rhe_upwind AS "whetherRheUpwind",
+		a.sure_da_date As "sureDaDate",
+		a.text_remark As "textRemark",
+		a.status As "a.status"
+	</sql>
+    
+	<select id="get" resultType="Project" >
+		SELECT 
+			<include refid="projectColumns"/>
+		FROM js_project_detail a
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="Project" >
+		SELECT 
+			<include refid="projectColumns"/>
+		FROM js_project_detail a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+			<if test="id != null and  id != ''">
+				AND a.id = #{id}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="Project" >
+		SELECT
+		<include refid="projectColumns"/>
+		FROM js_project_detail a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			${dataScope}
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO js_project_detail(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			pro_type,
+			demand_unit,
+			bdz_name,
+			line_name,
+			require_name,
+			build_classification_resons,
+			bulbid_resons,
+			asic_equipment,
+			run_the_class,
+			project_team,
+			cost_estimate,
+			whether_rhe_upwind,
+			sure_da_date,
+			text_remark,
+			status
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{type},
+			#{demandUnit},
+			#{bdzName},
+			#{lineName},
+    		#{requireName},
+    		#{bulidClassificationResons},
+    		#{bulbidResons},
+    		#{asicEquipment},
+    		#{runTheClass},
+    		#{projectTeam},
+    		#{costEstimate},
+    		#{whetherRheUpwind},
+    		#{sureDaDate},
+    		#{textRemark},
+    		#{status}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE js_project_detail SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			del_flag = #{delFlag},
+			pro_type = #{type},
+			demand_unit = #{demandUnit},
+			bdz_name = #{bdzName},
+			line_name = #{lineName},
+			require_name = #{requireName},
+			build_classification_resons = #{bulidClassificationResons},
+			bulbid_resons = #{bulbidResons},
+			asic_equipment = #{asicEquipment},
+			run_the_class = #{runTheClass},
+			project_team = #{projectTeam},
+			cost_estimate = #{costEstimate},
+			whether_rhe_upwind = #{whetherRheUpwind},
+			sure_da_date = #{sureDaDate},
+			text_remark = #{textRemark}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM js_project_detail
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE js_project_detail SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="Project" statementType="STATEMENT">
+		select * FROM js_project_detail  where ${id} = '${value}'
+	</select>
+	
+</mapper>

+ 49 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/service/ProjectService.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.project.service;
+
+import java.util.List;
+
+import com.jeeplus.modules.sg.financial.project.entity.Project;
+import com.jeeplus.modules.sg.financial.project.mapper.ProjectMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.test.one.dialog.entity.Leave1;
+import com.jeeplus.modules.test.one.dialog.mapper.Leave1Mapper;
+
+/**
+ * 请假表单Service
+ * @author lgf
+ * @version 2018-06-12
+ */
+@Service
+@Transactional(readOnly = true)
+public class ProjectService extends CrudService<ProjectMapper, Project> {
+
+	public Project get(String id) {
+		return super.get(id);
+	}
+	
+	public List<Project> findList(Project project) {
+		return super.findList(project);
+	}
+	
+	public Page<Project> findPage(Page<Project> page, Project project) {
+		return super.findPage(page, project);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(Project project) {
+		super.save(project);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(Project project) {
+		super.delete(project);
+	}
+	
+}

+ 394 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/util/ImportUtil.java

@@ -0,0 +1,394 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.project.util;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.Reflections;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.DictUtils;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 导入Excel文件(支持“XLS”和“XLSX”格式)
+ * @author jeeplus
+ * @version 2016-03-10
+ */
+public class ImportUtil {
+
+	private static Logger log = LoggerFactory.getLogger(ImportUtil.class);
+
+	/**
+	 * 工作薄对象
+	 */
+	private Workbook wb;
+
+	/**
+	 * 工作表对象
+	 */
+	private Sheet sheet;
+
+	/**
+	 * 标题行号
+	 */
+	private int headerNum;
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象,读取第一个工作表
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum)
+			throws InvalidFormatException, IOException {
+		this(file, headerNum, 0);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(new File(fileName), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(File file, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(file.getName(), new FileInputStream(file), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param file 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(MultipartFile multipartFile, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
+	}
+
+	/**
+	 * 构造函数
+	 * @param path 导入文件对象
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public ImportUtil(String fileName, InputStream is, int headerNum, int sheetIndex)
+			throws InvalidFormatException, IOException {
+		if (StringUtils.isBlank(fileName)){
+			throw new RuntimeException("导入文档为空!");
+		}else if(fileName.toLowerCase().endsWith("xls")){    
+			this.wb = new HSSFWorkbook(is);    
+        }else if(fileName.toLowerCase().endsWith("xlsx")){  
+        	this.wb = new XSSFWorkbook(is);
+        }else{  
+        	throw new RuntimeException("文档格式不正确!");
+        }  
+		if (this.wb.getNumberOfSheets()<sheetIndex){
+			throw new RuntimeException("文档中没有工作表!");
+		}
+		this.sheet = this.wb.getSheetAt(sheetIndex);
+		this.headerNum = headerNum;
+		log.debug("Initialize success.");
+	}
+	
+	/**
+	 * 获取行对象
+	 * @param rownum
+	 * @return
+	 */
+	public Row getRow(int rownum){
+		return this.sheet.getRow(rownum);
+	}
+
+	/**
+	 * 获取数据行号
+	 * @return
+	 */
+	public int getDataRowNum(){
+		return headerNum+1;
+	}
+	
+	/**
+	 * 获取最后一个数据行号
+	 * @return
+	 */
+	public int getLastDataRowNum(){
+		return this.sheet.getLastRowNum()+headerNum;
+	}
+	
+	/**
+	 * 获取最后一个列号
+	 * @return
+	 */
+	public int getLastCellNum(){
+		return this.getRow(headerNum).getLastCellNum();
+	}
+	
+	/**
+	 * 获取单元格值
+	 * @param row 获取的行
+	 * @param column 获取单元格列号
+	 * @return 单元格值
+	 */
+	public Object getCellValue(Row row, int column) {
+		Object val = "";
+		try {
+			Cell cell = row.getCell(column);
+			if (cell != null) {
+				if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
+					// val = cell.getNumericCellValue();
+					// 当excel 中的数据为数值或日期是需要特殊处理
+					if (HSSFDateUtil.isCellDateFormatted(cell)) {
+						double d = cell.getNumericCellValue();
+						Date date = HSSFDateUtil.getJavaDate(d);
+						SimpleDateFormat dformat = new SimpleDateFormat(
+								"yyyy-MM-dd");
+						val = dformat.format(date);
+					} else {
+						NumberFormat nf = NumberFormat.getInstance();
+						nf.setGroupingUsed(false);// true时的格式:1,234,567,890
+						val = nf.format(cell.getNumericCellValue());// 数值类型的数据为double,所以需要转换一下
+					}
+				} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
+					val = cell.getStringCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
+					val = cell.getCellFormula();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
+					val = cell.getBooleanCellValue();
+				} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {
+					val = cell.getErrorCellValue();
+				}
+			}
+		} catch (Exception e) {
+			return val;
+		}
+		return val;
+	}
+	
+	/**
+	 * 获取导入数据列表
+	 * @param cls 导入对象类型
+	 * @param groups 导入分组
+	 */
+	public <E> List<E> getDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{
+		List<Object[]> annotationList = Lists.newArrayList();
+		// Get annotation field 
+		Field[] fs = cls.getDeclaredFields();
+		for (Field f : fs){
+			ExcelField ef = f.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, f});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, f});
+				}
+			}
+		}
+		// Get annotation method
+		Method[] ms = cls.getDeclaredMethods();
+		for (Method m : ms){
+			ExcelField ef = m.getAnnotation(ExcelField.class);
+			if (ef != null && (ef.type()==0 || ef.type()==2)){
+				if (groups!=null && groups.length>0){
+					boolean inGroup = false;
+					for (int g : groups){
+						if (inGroup){
+							break;
+						}
+						for (int efg : ef.groups()){
+							if (g == efg){
+								inGroup = true;
+								annotationList.add(new Object[]{ef, m});
+								break;
+							}
+						}
+					}
+				}else{
+					annotationList.add(new Object[]{ef, m});
+				}
+			}
+		}
+		// Field sorting
+		Collections.sort(annotationList, new Comparator<Object[]>() {
+			public int compare(Object[] o1, Object[] o2) {
+				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
+						new Integer(((ExcelField)o2[0]).sort()));
+			};
+		});
+		//log.debug("Import column count:"+annotationList.size());
+		// Get excel data
+		List<E> dataList = Lists.newArrayList();
+		for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) {
+			E e = (E)cls.newInstance();
+			int column = 0;
+			Row row = this.getRow(i);
+			StringBuilder sb = new StringBuilder();
+			for (Object[] os : annotationList){
+				Object val = this.getCellValue(row, column++);
+				if (val != null){
+					ExcelField ef = (ExcelField)os[0];
+					// If is dict type, get dict value
+					if (StringUtils.isNotBlank(ef.dictType())){
+						val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
+						//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
+					}
+					// Get param type and type cast
+					Class<?> valType = Class.class;
+					if (os[1] instanceof Field){
+						valType = ((Field)os[1]).getType();
+					}else if (os[1] instanceof Method){
+						Method method = ((Method)os[1]);
+						if ("get".equals(method.getName().substring(0, 3))){
+							valType = method.getReturnType();
+						}else if("set".equals(method.getName().substring(0, 3))){
+							valType = ((Method)os[1]).getParameterTypes()[0];
+						}
+					}
+					//log.debug("Import value type: ["+i+","+column+"] " + valType);
+					try {
+						//如果导入的java对象,需要在这里自己进行变换。
+						if (valType == String.class){
+							String s = String.valueOf(val.toString());
+							if(StringUtils.endsWith(s, ".0")){
+								val = StringUtils.substringBefore(s, ".0");
+							}else{
+								val = String.valueOf(val.toString());
+							}
+						}else if (valType == Integer.class){
+							val = Double.valueOf(val.toString()).intValue();
+						}else if (valType == Long.class){
+							val = Double.valueOf(val.toString()).longValue();
+						}else if (valType == Double.class){
+							val = Double.valueOf(val.toString());
+						}else if (valType == Float.class){
+							val = Float.valueOf(val.toString());
+						}else if (valType == Date.class){
+							SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
+							val=sdf.parse(val.toString()); 
+						}else if (valType == User.class){
+							val = UserUtils.getByUserName(val.toString());
+						}else if (valType == Office.class){
+							val = UserUtils.getByOfficeName(val.toString());
+						}else if (valType == Area.class){
+							val = UserUtils.getByAreaName(val.toString());
+						}else{
+							if (ef.fieldType() != Class.class){
+								val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
+							}else{
+								val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(), 
+										"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
+							}
+						}
+					} catch (Exception ex) {
+						log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
+						val = null;
+					}
+					// set entity value
+					if (os[1] instanceof Field){
+						Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
+					}else if (os[1] instanceof Method){
+						String mthodName = ((Method)os[1]).getName();
+						if ("get".equals(mthodName.substring(0, 3))){
+							mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
+						}
+						Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
+					}
+				}
+				sb.append(val+", ");
+			}
+			dataList.add(e);
+			log.debug("Read success: ["+i+"] "+sb.toString());
+		}
+		return dataList;
+	}
+
+//	/**
+//	 * 导入测试
+//	 */
+//	public static void main(String[] args) throws Throwable {
+//		
+//		ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
+//		
+//		for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
+//			Row row = ei.getRow(i);
+//			for (int j = 0; j < ei.getLastCellNum(); j++) {
+//				Object val = ei.getCellValue(row, j);
+//				System.out.print(val+", ");
+//			}
+//			System.out.print("\n");
+//		}
+//		
+//	}
+}

+ 57 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/util/ProExcelInfo.java

@@ -0,0 +1,57 @@
+package com.jeeplus.modules.sg.financial.project.util;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.sg.financial.project.entity.Project;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Row;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public  class ProExcelInfo {
+    /**
+     * 获取表格数据
+     * @param importUtil
+     * @return List<ErpAccount> 导入表格数据
+     */
+    public static List<Project> getProjectUtil(ImportUtil importUtil)  {
+        int lastRow = importUtil.getLastDataRowNum();
+        List<Project> list = new ArrayList<Project>();
+        Project project = null;
+        String costEstimate="";//费用估算
+        for(int i=2; i<lastRow;i++){
+            project = new Project();
+            Row row = importUtil.getRow(i);
+            String requireCode = (String) importUtil.getCellValue(row,5);
+            if(StringUtils.isNotBlank(requireCode)) {
+                project.setRequireName(requireCode);
+                project.setType((String)importUtil.getCellValue(row,1));//类型
+                project.setDemandUnit((String)importUtil.getCellValue(row,2));//需求提出单位
+                project.setBdzName((String)importUtil.getCellValue(row,3));//变电站名称
+                project.setLineName((String)importUtil.getCellValue(row,4));//线路名称
+                project.setBulidClassificationResons((String)importUtil.getCellValue(row,6));//建设理由分类
+                project.setBulbidResons((String)importUtil.getCellValue(row,7));//建设理由
+                project.setAsicEquipment((String)importUtil.getCellValue(row,8));//设备基本状况
+                project.setRunTheClass((String)importUtil.getCellValue(row,9));//运行班
+                project.setProjectTeam((String)importUtil.getCellValue(row,10));//项目组
+                costEstimate = (String) importUtil.getCellValue(row,11);
+                project.setCostEstimate(Double.parseDouble(costEstimate));//费用估算
+                project.setWhetherRheUpwind((String)importUtil.getCellValue(row,12));//是否迎风期度夏项目
+                project.setSureDaDate((String)importUtil.getCellValue(row,13));//确定下达时间
+                project.setTextRemark((String)importUtil.getCellValue(row,14));//备注
+                project.setStatus(getStatus());
+                list.add(project);
+            }
+        }
+        return list;
+    }
+
+    public static String getStatus(){
+        int machineId = 1;
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        if (hashCodeV<0){
+            hashCodeV=-hashCodeV;
+        }
+        return  (machineId+String.format("%015d",hashCodeV));
+    }
+}

+ 203 - 0
src/main/java/com/jeeplus/modules/sg/financial/project/web/ProjectController.java

@@ -0,0 +1,203 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.financial.project.web;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+
+import com.jeeplus.modules.sg.financial.project.entity.Project;
+import com.jeeplus.modules.sg.financial.project.service.ProjectService;
+import com.jeeplus.modules.sg.financial.project.util.ImportUtil;
+import com.jeeplus.modules.sg.financial.project.util.ProExcelInfo;
+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.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.web.BaseController;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.modules.test.one.dialog.entity.Leave1;
+
+/**
+ * 表单Controller
+ * @author lgf
+ * @version 2018-06-12
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/sg/financial/project")
+public class ProjectController extends BaseController {
+
+	@Autowired
+	private ProjectService projectService;
+	
+	@ModelAttribute
+	public Project get(@RequestParam(required=false) String id) {
+		Project entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = projectService.get(id);
+		}
+		if (entity == null){
+			entity = new Project();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 工程管理表单列表页面
+	 */
+//	@RequiresPermissions("test:one:dialog:leave1:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(Project project, Model model) {
+		model.addAttribute("leave1", project);
+		return "modules/sg/financial/project/projectList";
+	}
+	
+		/**
+	 * 表单列表数据
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:list")
+	@RequestMapping(value = "data")
+	public Map<String, Object> data(Project project, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<Project> page = projectService.findPage(new Page<Project>(request, response), project);
+		return getBootstrapData(page);
+	}
+
+	/**
+	 * 查看,增加,编辑表单表单页面
+	 */
+//	@RequiresPermissions(value={"test:one:dialog:leave1:view","test:one:dialog:leave1:add","test:one:dialog:leave1:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(Project project, Model model) {
+		model.addAttribute("leave1", project);
+		return "modules/sg/financial/project/projectForm";
+	}
+
+	/**
+	 * 保存表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions(value={"test:one:dialog:leave1:add","test:one:dialog:leave1:edit"},logical=Logical.OR)
+	@RequestMapping(value = "save")
+	public AjaxJson save(Project project, Model model) throws Exception{
+		AjaxJson j = new AjaxJson();
+		/**
+		 * 后台hibernate-validation插件校验
+		 */
+		String errMsg = beanValidator(project);
+		if (StringUtils.isNotBlank(errMsg)){
+			j.setSuccess(false);
+			j.setMsg(errMsg);
+			return j;
+		}
+		//新增或编辑表单保存
+		projectService.save(project);//保存
+		j.setSuccess(true);
+		j.setMsg("保存项目明细数据成功");
+		return j;
+	}
+	
+	/**
+	 * 删除表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:del")
+	@RequestMapping(value = "delete")
+	public AjaxJson delete(Project project) {
+		AjaxJson j = new AjaxJson();
+		projectService.delete(project);
+		j.setMsg("删除项目明细数据成功");
+		return j;
+	}
+	
+	/**
+	 * 批量表单
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:del")
+	@RequestMapping(value = "deleteAll")
+	public AjaxJson deleteAll(String ids) {
+		AjaxJson j = new AjaxJson();
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			projectService.delete(projectService.get(id));
+		}
+		j.setMsg("删除项目明细数据成功");
+		return j;
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:export")
+    @RequestMapping(value = "export")
+    public AjaxJson exportFile(Project project, HttpServletRequest request, HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+            String fileName = "项目明细表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<Project> page = projectService.findPage(new Page<Project>(request, response, -1), project);
+    		new ExportExcel("项目明细表", Project.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		j.setSuccess(true);
+    		j.setMsg("导出成功!");
+    		return j;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导出项目明细表表单记录失败!失败信息:"+e.getMessage());
+		}
+			return j;
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@ResponseBody
+//	@RequiresPermissions("test:one:dialog:leave1:import")
+    @RequestMapping(value = "import")
+   	public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
+		AjaxJson j = new AjaxJson();
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportUtil importUtil = new ImportUtil(file, 0, 0);
+			List<Project> projects = ProExcelInfo.getProjectUtil(importUtil);
+			for (Project project : projects){
+				try{
+					projectService.save(project);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条项目表单记录。");
+			}
+			j.setMsg( "已成功导入 "+successNum+" 条项目表单记录"+failureMsg);
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导入项目表单失败!失败信息:"+e.getMessage());
+		}
+		return j;
+    }
+}

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/DataMaintenanceMapper.java

@@ -15,5 +15,5 @@ import java.util.List;
 public interface DataMaintenanceMapper extends BaseMapper<MaintainData> {
 	int insertList(@Param("list") List<MaintainData> list);
 	void deleteData(String projectId);
-	List<MaintainData> getFindListMain(List<String> strings);
+	List<MaintainData> findListMain();
 }

+ 1 - 8
src/main/java/com/jeeplus/modules/sg/financial/settlement/mapper/xml/DataMaintenanceMapper.xml

@@ -248,17 +248,10 @@
 		select * FROM js_maintain_data  where ${propertyName} = '${value}'
 	</select>
 
-	<select id="getFindListMain" parameterType="java.util.List" resultType="maintainData">
+	<select id="findListMain" parameterType="java.util.List" resultType="MaintainData">
 		select
 		<include refid="infoColumns"/>
 		FROM js_maintain_data a
 		WHERE a.del_flag = '0'
-		and a.project_id in
-		<if test="list!=null">
-			<foreach collection="list" index="index" item="item" open="("
-					 separator="," close=")">
-				#{item}
-			</foreach>
-		</if>
 	</select>
 </mapper>

+ 41 - 6
src/main/java/com/jeeplus/modules/sg/financial/settlement/service/DataMaintenanceService.java

@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -61,6 +62,27 @@ public class DataMaintenanceService extends CrudService<DataMaintenanceMapper, M
         dataMaintenanceMapper.deleteData(projectId);
     }
 
+    //判断erp是否存在
+    public List<String> getJudge(List<String> strings){
+		Boolean flag = false;
+		List<String> list = new ArrayList<>();//定义一个集合
+		List<MaintainData> maintainDatas = dataMaintenanceMapper.findListMain();//得到维护表所有数据
+		if (null!=strings&&strings.size()>0){
+			for (MaintainData maintainData:maintainDatas){
+				flag = true;
+				for (String str:strings){
+					if (maintainData.getProjectId().equals(str)){
+						flag=false;
+						break;
+					}
+				}
+				if (flag){
+					list.add(maintainData.getProjectId());
+				}
+			}
+		}
+		return list;
+	}
 
 	public void export(MaintainData maintainData , HttpServletResponse response){
 		Workbook workbook = null;
@@ -81,13 +103,26 @@ public class DataMaintenanceService extends CrudService<DataMaintenanceMapper, M
 			e.printStackTrace();
 		} finally {
 		}
+        	}
 
 
-
-
-
-
-
-        	}
+	public void exportHeard( HttpServletResponse response){
+		Workbook workbook = null;
+		try {
+			workbook = ExcelWriter.exportHeard();
+			long time = System.currentTimeMillis();
+			String outFile = time + ".xlsx";
+			OutputStream outputStream = response.getOutputStream();
+			response.reset();
+			response.setHeader("Content-Disposition", "attachment;filename="+outFile);
+			response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+			workbook.write(outputStream);
+			outputStream.flush();
+			outputStream.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+		}
+	}
 	
 }

+ 227 - 2
src/main/java/com/jeeplus/modules/sg/financial/settlement/util/ExcelWriter.java

@@ -9,6 +9,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  *
@@ -44,6 +45,26 @@ public class ExcelWriter {
         return workbook;
     }
 
+
+    public static Workbook exportHeard(){
+        // 生成xlsx的Excel
+        Workbook workbook = new SXSSFWorkbook();
+        // 生成Sheet表,写入第一行的列头
+        Sheet sheet = buildHerd(workbook);
+        List<MaintainData> dataList = new LinkedList<>();
+        int rowNum = 3;
+        for (Iterator<MaintainData> it = dataList.iterator(); it.hasNext(); ) {
+            MaintainData data = it.next();
+            if (data == null) {
+                continue;
+            }
+            //输出行数据
+            Row row = sheet.createRow(rowNum++);
+            convertDataToRow(data, row);
+        }
+        return workbook;
+    }
+
     /**
      * 生成sheet表,并写入第一行数据(列头)
      * @param workbook 工作簿对象
@@ -72,6 +93,7 @@ public class ExcelWriter {
         sheet.addMergedRegion(new CellRangeAddress(2, 1, 11, 11));
         sheet.addMergedRegion(new CellRangeAddress(2, 1, 12, 12));
         sheet.addMergedRegion(new CellRangeAddress(1, 1, 13, 18));
+        sheet.addMergedRegion(new CellRangeAddress(2, 1, 19, 19));
         // 构建头单元格样式
         styles = createStyles(sheet.getWorkbook());
         CellStyle cellStyle = buildHeadCellStyle(sheet.getWorkbook());
@@ -205,6 +227,12 @@ public class ExcelWriter {
         Cell celll = row3.createCell(11);
         celll.setCellValue("");
         celll.setCellStyle(styles.get("header"));
+        Cell celll1 = row3.createCell(19);
+        celll1.setCellValue("");
+        celll1.setCellStyle(styles.get("header"));
+        Cell celll11 = row1.createCell(19);
+        celll11.setCellValue("");
+        celll11.setCellStyle(styles.get("header"));
 
         Cell cell9 = row2.createCell(12);
         cell9.setCellValue("主材费");
@@ -212,6 +240,9 @@ public class ExcelWriter {
         Cell cell10 = row2.createCell(13);
         cell10.setCellValue("其他费用");
         cell10.setCellStyle(styles.get("header"));
+        Cell cell101 = row2.createCell(19);
+        cell101.setCellValue("合计");
+        cell101.setCellStyle(styles.get("header"));
         Cell cell11 = row3.createCell(13);
         cell11.setCellValue("设计费");
         cell11.setCellStyle(styles.get("header"));
@@ -228,7 +259,7 @@ public class ExcelWriter {
         cell15.setCellValue("法人管理费(余物清理费)");
         cell15.setCellStyle(styles.get("header"));
         Cell cell16 = row3.createCell(18);
-        cell16.setCellValue("计");
+        cell16.setCellValue("计");
         cell16.setCellStyle(styles.get("header"));
         return sheet;
     }
@@ -463,10 +494,204 @@ public class ExcelWriter {
         cell = row.createCell(cellNum++);
         cell.setCellStyle(styles.get("data"));
         if (null != maintainData.getTotalFee()) {
-            cell.setCellValue(maintainData.getTotalFee());
+            cell.setCellValue(maintainData.getDesignFee()+maintainData.getSupervisionFee()+maintainData.getPreliminaryWorkFee()
+                              +maintainData.getDamages()+maintainData.getManagementFee());
+        } else {
+            cell.setCellValue("");
+        }
+        cell = row.createCell(cellNum++);
+        cell.setCellStyle(styles.get("data"));
+        if (null != maintainData.getTotalFee()) {
+            cell.setCellValue(maintainData.getDesignFee()+maintainData.getSupervisionFee()+maintainData.getPreliminaryWorkFee()
+                    +maintainData.getDamages()+maintainData.getManagementFee()+maintainData.getBuildingFee()+maintainData.getInstallFee()
+                    +maintainData.getEquipmentFee()+maintainData.getMaterialFee());
         } else {
             cell.setCellValue("");
         }
 
     }
+
+    private static Sheet buildHerd(Workbook workbook) {
+        Sheet sheet = workbook.createSheet();
+        // 设置列头宽度
+//        for (int i=0; i<CELL_HEADS.size(); i++) {
+//            sheet.setColumnWidth(i, 4000);
+//        }
+        // 设置默认行高
+        sheet.setDefaultRowHeight((short) 400);
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 0, 0));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 1, 1));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 2, 2));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 3, 3));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 4, 4));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 5, 5));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 6, 6));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 7, 7));
+        sheet.addMergedRegion(new CellRangeAddress(2, 0, 8, 8));
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 9, 17));
+        sheet.addMergedRegion(new CellRangeAddress(2, 1, 9, 9));
+        sheet.addMergedRegion(new CellRangeAddress(2, 1, 10, 10));
+        sheet.addMergedRegion(new CellRangeAddress(2, 1, 11, 11));
+        sheet.addMergedRegion(new CellRangeAddress(2, 1, 12, 12));
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 13, 17));
+        // 构建头单元格样式
+        styles = createStyles(sheet.getWorkbook());
+        CellStyle cellStyle = buildHeadCellStyle(sheet.getWorkbook());
+
+
+
+        // 写入第一行各列的数据
+        Row row1 = sheet.createRow(0);
+        Row row2 = sheet.createRow(1);
+        Row row3 = sheet.createRow(2);
+        Cell cell1 = row1.createCell(0);
+        cell1.setCellValue("项目定义编码");
+        cell1.setCellStyle(styles.get("header"));
+        Cell cella1 = row1.createCell(1);
+        cella1.setCellValue("设计单位");
+        cella1.setCellStyle(styles.get("header"));
+        Cell cellb1 = row1.createCell(2);
+        cellb1.setCellValue("施工单位");
+        cellb1.setCellStyle(styles.get("header"));
+        Cell cellc1 = row1.createCell(3);
+        cellc1.setCellValue("建筑地址");
+        cellc1.setCellStyle(styles.get("header"));
+        Cell celld1 = row1.createCell(4);
+        celld1.setCellValue("建筑属性");
+        celld1.setCellStyle(styles.get("header"));
+        Cell celle1 = row1.createCell(5);
+        celle1.setCellValue("发文总投资");
+        celle1.setCellStyle(styles.get("header"));
+        Cell cell2 = row1.createCell(6);
+        cell2.setCellValue("开工时间");
+        cell2.setCellStyle(styles.get("header"));
+        Cell cell3 = row1.createCell(7);
+        cell3.setCellValue("竣工时间");
+        cell3.setCellStyle(styles.get("header"));
+        Cell cell4 = row1.createCell(8);
+        cell4.setCellValue("批准文号");
+        cell4.setCellStyle(styles.get("header"));
+
+
+        Cell cella = row2.createCell(0);
+        cella.setCellValue("");
+        cella.setCellStyle(styles.get("header"));
+        Cell cella2 = row2.createCell(1);
+        cella2.setCellValue("");
+        cella2.setCellStyle(styles.get("header"));
+        Cell cella3 = row2.createCell(2);
+        cella3.setCellValue("");
+        cella3.setCellStyle(styles.get("header"));
+        Cell cella4 = row2.createCell(3);
+        cella4.setCellValue("");
+        cella4.setCellStyle(styles.get("header"));
+        Cell cella5 = row2.createCell(4);
+        cella5.setCellValue("");
+        cella5.setCellStyle(styles.get("header"));
+        Cell cella6 = row2.createCell(5);
+        cella6.setCellValue("");
+        cella6.setCellStyle(styles.get("header"));
+        Cell cellb = row2.createCell(6);
+        cellb.setCellValue("");
+        cellb.setCellStyle(styles.get("header"));
+        Cell cellc = row2.createCell(7);
+        cellc.setCellValue("");
+        cellc.setCellStyle(styles.get("header"));
+        Cell celld = row2.createCell(8);
+        celld.setCellValue("");
+        celld.setCellStyle(styles.get("header"));
+
+        Cell cellm = row2.createCell(14);
+        cellm.setCellValue("");
+        cellm.setCellStyle(styles.get("header"));
+        Cell celln = row2.createCell(15);
+        celln.setCellValue("");
+        celln.setCellStyle(styles.get("header"));
+        Cell cello = row2.createCell(16);
+        cello.setCellValue("");
+        cello.setCellStyle(styles.get("header"));
+        Cell cellp = row2.createCell(17);
+        cellp.setCellValue("");
+        cellp.setCellStyle(styles.get("header"));
+
+        Cell celle = row3.createCell(0);
+        celle.setCellValue("");
+        celle.setCellStyle(styles.get("header"));
+        Cell celle6 = row3.createCell(1);
+        celle6.setCellValue("");
+        celle6.setCellStyle(styles.get("header"));
+        Cell celle2 = row3.createCell(2);
+        celle2.setCellValue("");
+        celle2.setCellStyle(styles.get("header"));
+        Cell celle3 = row3.createCell(3);
+        celle3.setCellValue("");
+        celle3.setCellStyle(styles.get("header"));
+        Cell celle4 = row3.createCell(4);
+        celle4.setCellValue("");
+        celle4.setCellStyle(styles.get("header"));
+        Cell celle5 = row3.createCell(5);
+        celle5.setCellValue("");
+        celle5.setCellStyle(styles.get("header"));
+        Cell cellf = row3.createCell(6);
+        cellf.setCellValue("");
+        cellf.setCellStyle(styles.get("header"));
+        Cell cellg = row3.createCell(7);
+        cellg.setCellValue("");
+        cellg.setCellStyle(styles.get("header"));
+        Cell cellh = row3.createCell(8);
+        cellh.setCellValue("");
+        cellh.setCellStyle(styles.get("header"));
+
+        Cell cell5 = row1.createCell(9);
+        cell5.setCellValue("概算数");
+        cell5.setCellStyle(styles.get("header"));
+        Cell cell6 = row2.createCell(9);
+        cell6.setCellValue("建筑费");
+        cell6.setCellStyle(styles.get("header"));
+        Cell cell7 = row2.createCell(10);
+        cell7.setCellValue("安装费");
+        cell7.setCellStyle(styles.get("header"));
+        Cell cell8 = row2.createCell(11);
+        cell8.setCellValue("设备购置费");
+        cell8.setCellStyle(styles.get("header"));
+
+        Cell cellj = row3.createCell(9);
+        cellj.setCellValue("");
+        cellj.setCellStyle(styles.get("header"));
+        Cell cellk = row3.createCell(10);
+        cellk.setCellValue("");
+        cellk.setCellStyle(styles.get("header"));
+        Cell celll = row3.createCell(11);
+        celll.setCellValue("");
+        celll.setCellStyle(styles.get("header"));
+        Cell celll1 = row3.createCell(12);
+        celll1.setCellValue("");
+        celll1.setCellStyle(styles.get("header"));
+
+
+        Cell cell9 = row2.createCell(12);
+        cell9.setCellValue("主材费");
+        cell9.setCellStyle(styles.get("header"));
+        Cell cell10 = row2.createCell(13);
+        cell10.setCellValue("其他费用");
+        cell10.setCellStyle(styles.get("header"));
+        Cell cell11 = row3.createCell(13);
+        cell11.setCellValue("设计费");
+        cell11.setCellStyle(styles.get("header"));
+        Cell cell12 = row3.createCell(14);
+        cell12.setCellValue("监理费");
+        cell12.setCellStyle(styles.get("header"));
+        Cell cell13 = row3.createCell(15);
+        cell13.setCellValue("项目前期工作费");
+        cell13.setCellStyle(styles.get("header"));
+        Cell cell14 = row3.createCell(16);
+        cell14.setCellValue("线路施工赔偿费");
+        cell14.setCellStyle(styles.get("header"));
+        Cell cell15 = row3.createCell(17);
+        cell15.setCellValue("法人管理费(余物清理费)");
+        cell15.setCellStyle(styles.get("header"));
+        return sheet;
+    }
+
 }
+

+ 3 - 5
src/main/java/com/jeeplus/modules/sg/financial/settlement/web/DataMaintenanceController.java

@@ -241,10 +241,9 @@ public class DataMaintenanceController extends BaseController {
      public AjaxJson importFileTemplate(HttpServletResponse response) {
 		AjaxJson j = new AjaxJson();
 		try {
-            String fileName = "维护数据导入模板.xlsx";
-    		List<MaintainData> list = Lists.newArrayList();
-    		new ExportExcel(null, MaintainData.class, 1).setDataList(list).write(response, fileName).dispose();
-    		return null;
+			dataMaintenanceService.exportHeard(response);
+			j.setSuccess(true);
+			j.setMsg("导出成功!");
 		} catch (Exception e) {
 			j.setSuccess(false);
 			j.setMsg( "导入模板下载失败!失败信息:"+e.getMessage());
@@ -282,7 +281,6 @@ public class DataMaintenanceController extends BaseController {
 				maintainData.setPreliminaryWorkFee(getDouble(importExcel,row,15));
 				maintainData.setDamages(getDouble(importExcel,row,16));
 				maintainData.setManagementFee(getDouble(importExcel,row,17));
-				maintainData.setTotalFee(getDouble(importExcel,row,18));
 				list.add(maintainData);
 			}
 		}

TEMPAT SAMPAH
src/main/resources/freemarker/excelmodel/竣工决算模板.xlsx


+ 15 - 7
src/main/webapp/webpage/modules/sg/financial/erp/erpCreditList.js

@@ -276,7 +276,7 @@ $(document).ready(function() {
             $('#remove').prop('disabled', ! $('#erpTable').bootstrapTable('getSelections').length);
             $('#view,#edit').prop('disabled', $('#erpTable').bootstrapTable('getSelections').length!=1);
         });
-		  
+    	var str = "";
 		$("#btnImport").click(function(){
 			jp.open({
 			    type: 2,
@@ -293,22 +293,30 @@ $(document).ready(function() {
 						iframeWin.contentWindow.importExcel('${ctx}/sg/financial/erpCredit/import', function (data) {
 							if(data.success){
 								jp.success(data.msg);
+								// jp.success(data.strings);
+								str = data.list;
+                                jp.downloadFile('${ctx}/sg/financial/erpCredit/export?ids='+ data.list);
 								refresh();
-							}else{
-								jp.error(data.msg);
+							}else if (data.flag) {
+                                jp.success("导入失败");
+                                var str1 =encodeURI(encodeURI(data.list));
+                                jp.openViewDialog('不符合导出条件项目', "${ctx}/sg/financial/erpCredit/tips?str="+str1,'800px', '500px');
+							}else {
+                                jp.error(data.msg);
 							}
                             jp.close(index);
                         });//调用保存事件
                     return false;
 				  },
-				 
+
 				  btn2: function(index){
 					  jp.close(index);
 	    	       }
-			}); 
+			});
+            getExport(flag,str)
 		});
 	  $("#export").click(function(){//导出Excel文件
-			jp.downloadFile('${ctx}/sg/financial/erpCredit/export?ids='+ getIdSelections());
+			jp.downloadFile('${ctx}/sg/financial/erpCredit/export?ids='+ str);
 	  });
 	  $("#search").click("click", function() {// 绑定查询按扭
 		  $('#erpTable').bootstrapTable('refresh');
@@ -348,7 +356,6 @@ $(document).ready(function() {
          	  			jp.error(data.msg);
          	  		}
          	  	})
-          	   
 		})
   }
   
@@ -358,6 +365,7 @@ $(document).ready(function() {
   }
   function add(){
 	  jp.openSaveDialog('新增记录', "${ctx}/sg/financial/erpCredit/form",'800px', '500px');
+      // jp.openSaveDialog('新增记录', "${ctx}/sg/financial/erpCredit/tips",'800px', '500px');
   }
   
    function edit(id){//没有权限时,不显示确定按钮

+ 28 - 0
src/main/webapp/webpage/modules/sg/financial/erp/erpCreditTips.jsp

@@ -0,0 +1,28 @@
+<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false"%>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title></title>
+	<meta name="decorator" content="ani"/>
+</head>
+<body class="bg-white">
+<table class="ani table">
+	<thead>
+	<tr>
+		<th width="35%">项目定义编号</th>
+		<th width="30%">有无维护数据</th>
+		<th width="30%">物料是否完成</th>
+	</tr>
+	</thead>
+	<tbody>
+		<c:forEach var="erp" items="${erpList}">
+			<tr>
+				<td>${erp.itemId}</td>
+				<td>${erp.mainFlag}</td>
+				<td>${erp.infoFlag}</td>
+			</tr>
+		</c:forEach>
+	</tbody>
+</table>
+</body>
+</html>

+ 119 - 0
src/main/webapp/webpage/modules/sg/financial/project/projectForm.jsp

@@ -0,0 +1,119 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>工程表单管理</title>
+	<meta name="decorator" content="ani"/>
+	<script type="text/javascript">
+
+		$(document).ready(function() {
+
+	        $('#beginDate').datetimepicker({
+				 format: "YYYY-MM-DD HH:mm:ss"
+		    });
+	        $('#endDate').datetimepicker({
+				 format: "YYYY-MM-DD HH:mm:ss"
+		    });
+		});
+		function save() {
+            var isValidate = jp.validateForm('#inputForm');//校验表单
+            if(!isValidate){
+                return false;
+			}else{
+                jp.loading();
+                jp.post("${ctx}/sg/financial/project/save",$('#inputForm').serialize(),function(data){
+                    if(data.success){
+                        jp.getParent().refresh();
+                        var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
+                        parent.layer.close(dialogIndex);
+                        jp.success(data.msg)
+
+                    }else{
+                        jp.error(data.msg);
+                    }
+                })
+			}
+
+        }
+	</script>
+</head>
+<body class="bg-white">
+		<form:form id="inputForm" modelAttribute="project" class="form-horizontal">
+		<form:hidden path="id"/>	
+		<table class="table table-bordered">
+			<tbody>
+				<tr>
+					<td class="width-15 active"><label class="pull-right" style="float: left">类型:</label></td>
+					<td class="width-35">
+						<form:input path="type" htmlEscape="false" class="form-control required"/>
+					</td>
+					<td class="width-15 active"><label class="pull-right">需求提出单位:</label></td>
+					<td class="width-35">
+						<form:input path="demandUnit" htmlEscape="false"   class="form-control required"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">变电站名称:</label></td>
+					<td class="width-35">
+						<form:input path="bdzName" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">线路名称:</label></td>
+					<td class="width-35">
+						<form:input path="lineName" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">项目需求名称:</label></td>
+					<td class="width-35">
+						<form:input path="requireName" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">建设理由分类:</label></td>
+					<td class="width-35">
+						<form:input path="bulidClassificationResons" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">建设理由:</label></td>
+					<td class="width-35">
+						<form:textarea path="bulbidResons" htmlEscape="false" rows="4"    class="form-control "/>
+					</td>
+					<td class="width-15 active"><label class="">设备基本情况:</label></td>
+					<td class="width-35">
+						<form:input path="asicEquipment" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">运行班:</label></td>
+					<td class="width-35">
+						<form:input path="runTheClass" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">项目组:</label></td>
+					<td class="width-35">
+						<form:input path="projectTeam" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">费用估算:</label></td>
+					<td class="width-35">
+						<form:input path="costEstimate" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">是否迎风期度夏项目:</label></td>
+					<td class="width-35">
+						<form:input path="whetherRheUpwind" htmlEscape="false"    class="form-control"/>
+					</td>
+				</tr>
+				<tr>
+					<td class="width-15 active"><label class="">确定下达时间:</label></td>
+					<td class="width-35">
+						<form:input path="sureDaDate" htmlEscape="false"    class="form-control"/>
+					</td>
+					<td class="width-15 active"><label class="">备注:</label></td>
+					<td class="width-35">
+						<form:textarea path="textRemark" htmlEscape="false" rows="4"    class="form-control "/>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</form:form>
+</body>
+</html>

+ 311 - 0
src/main/webapp/webpage/modules/sg/financial/project/projectList.js

@@ -0,0 +1,311 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#projectTable').bootstrapTable({
+		  //请求方法
+               method: 'post',
+               //类型json
+               dataType: "json",
+               contentType: "application/x-www-form-urlencoded",
+               //显示检索按钮
+	           showSearch: true,
+               //显示刷新按钮
+               showRefresh: true,
+               //显示切换手机试图按钮
+               showToggle: true,
+               //显示 内容列下拉框
+    	       showColumns: true,
+    	       //显示到处按钮
+    	       showExport: true,
+    	       //显示切换分页按钮
+    	       showPaginationSwitch: true,
+    	       //最低显示2行
+    	       minimumCountColumns: 2,
+               //是否显示行间隔色
+               striped: true,
+               //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)     
+               cache: false,    
+               //是否显示分页(*)  
+               pagination: true,   
+                //排序方式 
+               sortOrder: "asc",  
+               //初始化加载第一页,默认第一页
+               pageNumber:1,   
+               //每页的记录行数(*)   
+               pageSize: 5,
+               //可供选择的每页的行数(*)    
+               pageList: [5,10, 25, 50, 100],
+               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
+               url: "${ctx}/sg/financial/project/data",
+               //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
+               //queryParamsType:'',   
+               ////查询参数,每次调用是会带上这个参数,可自定义                         
+               queryParams : function(params) {
+               	var searchParam = $("#searchForm").serializeJSON();
+               	searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
+               	searchParam.pageSize = params.limit === undefined? -1 : params.limit;
+               	searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
+                   return searchParam;
+               },
+               //分页方式:client客户端分页,server服务端分页(*)
+               sidePagination: "server",
+               contextMenuTrigger:"right",//pc端 按右键弹出菜单
+               contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
+               contextMenu: '#context-menu',
+               onContextMenuItem: function(row, $el){
+                   if($el.data("item") == "edit"){
+                   		edit(row.id);
+                   }else if($el.data("item") == "view"){
+                       view(row.id);
+                   } else if($el.data("item") == "delete"){
+                        jp.confirm('确认要删除该请假表单记录吗?', function(){
+                       	jp.loading();
+                       	jp.get("${ctx}/sg/financial/project/delete?id="+row.id, function(data){
+                   	  		if(data.success){
+                   	  			$('#projectTable').bootstrapTable('refresh');
+                   	  			jp.success(data.msg);
+                   	  		}else{
+                   	  			jp.error(data.msg);
+                   	  		}
+                   	  	})
+                   	   
+                   	});
+                      
+                   } 
+               },
+              
+               onClickRow: function(row, $el){
+               },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [{
+		        checkbox: true
+		       
+		    }
+			,{
+		        field: 'type',
+		        title: '类型',
+		        sortName: 'type'
+		        ,formatter:function(value, row , index){
+
+			   if(value == null || value ==""){
+				   value = "-";
+			   }
+			   <c:choose>
+				   <c:when test="${fns:hasPermission('sg:financial:project:edit')}">
+				      return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
+			      </c:when>
+				  <c:when test="${fns:hasPermission('sg:financial:project:view')}">
+				      return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
+			      </c:when>
+				  <c:otherwise>
+				      return value;
+			      </c:otherwise>
+			   </c:choose>
+
+		        }
+		       
+		    }
+			,{
+		        field: 'demandUnit',
+		        title: '需求提出单位',
+		        sortName: 'demandUnit'
+		       
+		    }
+			,{
+		        field: 'bdzName',
+		        title: '变电站名称',
+		        sortName: 'bdzName'
+		       
+		    }
+			,{
+		        field: 'lineName',
+		        title: '线路名称',
+		        sortName: 'lineName'
+		       
+		    }
+			,{
+		        field: 'requireName',
+		        title: '项目需求名称',
+		        sortName: 'requireName'
+		       
+		    }
+			,{
+		        field: 'bulidClassificationResons',
+		        title: '建设理由分类',
+		        sortable: true,
+		        sortName: 'bulidClassificationResons'
+		       
+		    }
+                   ,{
+                       field: 'bulbidResons',
+                       title: '建设理由',
+                       sortName: 'bulbidResons'
+
+                   }
+                   ,{
+                       field: 'asicEquipment',
+                       title: '设备基本情况',
+                       sortName: 'asicEquipment'
+
+                   }
+                   ,{
+                       field: 'runTheClass',
+                       title: '运行班',
+                       sortName: 'runTheClass'
+
+                   }
+                   ,{
+                       field: 'projectTeam',
+                       title: '项目组',
+                       sortName: 'projectTeam'
+
+                   }
+                   ,{
+                       field: 'costEstimate',
+                       title: '费用估算',
+                       sortName: 'costEstimate'
+
+                   }
+                   ,{
+                       field: 'whetherRheUpwind',
+                       title: '是否迎风期度夏项目',
+                       sortName: 'whetherRheUpwind'
+
+                   }
+                   ,{
+                       field: 'sureDaDate',
+                       title: '确定下达时间',
+                       sortName: 'sureDaDate'
+
+                   }
+                   ,{
+                       field: 'textRemark',
+                       title: '备注',
+                       sortName: 'textRemark'
+                   }
+		     ]
+		
+		});
+		
+		  
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#projectTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#projectTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#projectTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#projectTable').bootstrapTable('getSelections').length!=1);
+        });
+		  
+		$("#btnImport").click(function(){
+			jp.open({
+			    type: 2,
+                area: [500, 200],
+                auto: true,
+			    title:"导入数据",
+			    content: "${ctx}/tag/importExcel" ,
+			    btn: ['确定', '关闭'],
+			    	btn1: function(index, layero){
+				        var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+						iframeWin.contentWindow.importExcel('${ctx}/sg/financial/project/import', function (data) {
+							if(data.success){
+								jp.success(data.msg);
+								refresh();
+							}else{
+								jp.error(data.msg);
+							}
+                            jp.close(index);
+						});//调用保存事件
+						return false;
+				  	},
+
+				  btn2: function(index){
+					//  jp.close(index);
+	    	       }
+			}); 
+		});
+		
+		
+	 $("#export").click(function(){//导出Excel文件
+			jp.downloadFile('${ctx}/sg/financial/project/export');
+	  });
+
+		    
+	  $("#search").click("click", function() {// 绑定查询按扭
+		  $('#projectTable').bootstrapTable('refresh');
+		});
+	 
+	 $("#reset").click("click", function() {// 绑定查询按扭
+		  $("#searchForm  input").val("");
+		  $("#searchForm  select").val("");
+		  $("#searchForm  .select-item").html("");
+		  $('#projectTable').bootstrapTable('refresh');
+		});
+		
+		$('#beginBeginDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		$('#endBeginDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		$('#endDate').datetimepicker({
+			 format: "YYYY-MM-DD HH:mm:ss"
+		});
+		
+	});
+		
+  function getIdSelections() {
+        return $.map($("#projectTable").bootstrapTable('getSelections'), function (row) {
+            return row.id
+        });
+    }
+  
+  function deleteAll(){
+
+		jp.confirm('确认要删除该项目管理表单记录吗?', function(){
+			jp.loading();  	
+			jp.get("${ctx}/sg/financial/project/deleteAll?ids=" + getIdSelections(), function(data){
+         	  		if(data.success){
+         	  			$('#projectTable').bootstrapTable('refresh');
+         	  			jp.success(data.msg);
+         	  		}else{
+         	  			jp.error(data.msg);
+         	  		}
+         	  	})
+          	   
+		})
+  }
+
+    //刷新列表
+  function refresh(){
+  	$('#projectTable').bootstrapTable('refresh');
+  }
+  
+   function add(){
+	  jp.openSaveDialog('新增项目管理表单', "${ctx}/sg/financial/project/form",'800px', '500px');
+  }
+
+
+  
+   function edit(id){//没有权限时,不显示确定按钮
+       if(id == undefined){
+	      id = getIdSelections();
+	}
+	jp.openSaveDialog('编辑项目管理表单', "${ctx}/sg/financial/project/form?id=" + id, '800px', '500px');
+  }
+  
+ function view(id){//没有权限时,不显示确定按钮
+      if(id == undefined){
+             id = getIdSelections();
+      }
+        jp.openViewDialog('查看项目管理表单', "${ctx}/sg/financial/project/form?id=" + id, '800px', '500px');
+ }
+
+
+
+</script>

+ 89 - 0
src/main/webapp/webpage/modules/sg/financial/project/projectList.jsp

@@ -0,0 +1,89 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>工程表单管理</title>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="decorator" content="ani"/>
+	<%@ include file="/webpage/include/bootstraptable.jsp"%>
+	<%@include file="/webpage/include/treeview.jsp" %>
+	<%@include file="projectList.js" %>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+	<div class="panel panel-primary">
+	<div class="panel-heading">
+		<h3 class="panel-title">工程表单列表</h3>
+	</div>
+	<div class="panel-body">
+		<!-- 搜索 -->
+		<div id="search-collapse" class="collapse">
+			<div class="accordion-inner">
+				<form:form id="searchForm" modelAttribute="project" class="form form-horizontal well clearfix">
+					<div class="col-xs-12 col-sm-6 col-md-4">
+						<label class="label-item single-overflow pull-left" title="项目需求名称:">项目需求名称:</label>
+						<form:input path="requireName" htmlEscape="false" maxlength="100"  class=" form-control"/>
+					</div>
+					<div class="col-xs-12 col-sm-6 col-md-4">
+						<div style="margin-top:26px">
+							<a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
+							<a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
+						</div>
+					</div>
+				</form:form>
+			</div>
+		</div>
+	
+	<!-- 工具栏 -->
+	<div id="toolbar">
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:add">--%>
+				<button id="add" class="btn btn-primary" onclick="add()">
+					<i class="glyphicon glyphicon-plus"></i> 新建
+				</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:edit">--%>
+			    <button id="edit" class="btn btn-success" disabled onclick="edit()">
+	            	<i class="glyphicon glyphicon-edit"></i> 修改
+	        	</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:del">--%>
+				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+	            	<i class="glyphicon glyphicon-remove"></i> 删除
+	        	</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:import">--%>
+				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:one:dialog:leave1:export">--%>
+	        		<button id="export" class="btn btn-warning">
+					<i class="fa fa-file-excel-o"></i> 导出
+				</button>
+			 <%--</shiro:hasPermission>--%>
+	                 <%--<shiro:hasPermission name="test:one:dialog:leave1:view">--%>
+				<button id="view" class="btn btn-default" disabled onclick="view()">
+					<i class="fa fa-search-plus"></i> 查看
+				</button>
+			<%--</shiro:hasPermission>--%>
+		    </div>
+		
+	<!-- 表格 -->
+	<table id="projectTable"   data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+    <ul id="context-menu" class="dropdown-menu">
+    	<%--<shiro:hasPermission name="test:one:dialog:leave1:view">--%>
+        <li data-item="view"><a>查看</a></li>
+        <%--</shiro:hasPermission>--%>
+    	<%--<shiro:hasPermission name="test:one:dialog:leave1:edit">--%>
+        <li data-item="edit"><a>编辑</a></li>
+        <%--</shiro:hasPermission>--%>
+        <%--<shiro:hasPermission name="test:one:dialog:leave1:del">--%>
+        <li data-item="delete"><a>删除</a></li>
+        <%--</shiro:hasPermission>--%>
+        <li data-item="action1"><a>取消</a></li>
+    </ul>  
+	</div>
+	</div>
+	</div>
+</body>
+</html>

+ 8 - 4
src/main/webapp/webpage/modules/sg/financial/settlement/dataMaintenanceList.js

@@ -175,10 +175,10 @@ $(document).ready(function() {
 					   field: 'managementFee',
 					   title: '法人管理费'
                }
-             ,{
-					   field: 'totalFee',
-					   title: '合计'
-               }
+             // ,{
+				// 	   field: 'totalFee',
+				// 	   title: '合计'
+             //   }
 		     ]
 		
 		});
@@ -256,6 +256,10 @@ $(document).ready(function() {
 			jp.downloadFile('${ctx}/sg/settlement/export');
 	  });
 
+    $("#export1").click(function(){//导出Excel文件
+        jp.downloadFile('${ctx}/sg/settlement/import/template');
+     });
+
 		    
 	  $("#search").click("click", function() {// 绑定查询按扭
 		  $('#dataTable').bootstrapTable('refresh');

+ 16 - 10
src/main/webapp/webpage/modules/sg/financial/settlement/dataMaintenanceList.jsp

@@ -43,16 +43,26 @@
 					<i class="glyphicon glyphicon-plus"></i> 新建
 				</button>
 			</shiro:hasPermission>
+		<shiro:hasPermission name="sg:settlement:del">
+			<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
+				<i class="glyphicon glyphicon-remove"></i> 删除
+			</button>
+		</shiro:hasPermission>
 			<shiro:hasPermission name="sg:settlement:edit">
 			    <button id="edit" class="btn btn-success" disabled onclick="edit()">
 	            	<i class="glyphicon glyphicon-edit"></i> 修改
 	        	</button>
 			</shiro:hasPermission>
-			<shiro:hasPermission name="sg:settlement:del">
-				<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">
-	            	<i class="glyphicon glyphicon-remove"></i> 删除
-	        	</button>
-			</shiro:hasPermission>
+		<shiro:hasPermission name="sg:settlement:view">
+			<button id="view" class="btn btn-default" disabled onclick="view()">
+				<i class="fa fa-search-plus"></i> 查看
+			</button>
+		</shiro:hasPermission>
+		<shiro:hasPermission name="sg:settlement:export">
+			<button id="export1" class="btn btn-warning">
+				<i class="fa fa-file-excel-o"></i> 导出模板
+			</button>
+		</shiro:hasPermission>
 			<shiro:hasPermission name="sg:settlement:import">
 				<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>
 			</shiro:hasPermission>
@@ -61,11 +71,7 @@
 					<i class="fa fa-file-excel-o"></i> 导出
 				</button>
 			 </shiro:hasPermission>
-	                 <shiro:hasPermission name="sg:settlement:view">
-				<button id="view" class="btn btn-default" disabled onclick="view()">
-					<i class="fa fa-search-plus"></i> 查看
-				</button>
-			</shiro:hasPermission>
+
 		    <shiro:hasPermission name="sg:settlement:import">
 					<button id="btnSearch" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入查询
 			    </button>