Forráskód Böngészése

word导出,导入原因类型还未完成

yue 5 éve
szülő
commit
c3b696413c

+ 139 - 3
src/main/java/com/jeeplus/modules/sg/information/entity/Information.java

@@ -50,6 +50,26 @@ public class Information extends DataEntity<Information>  {
 	private String secondUnits;
 //	一级单位
 	private String firstUnits;
+	//是否完成甲供物资领退料(第1次)
+	private String firstFinish;
+	//完成甲供物资领退料的日期(第1次)
+	private Date firstFinishDate;
+	//是否完成甲供物资领退料(第2次)
+	private String secondFinish;
+	//完成甲供物资领退料的日期(第2次)
+	private Date secondFinishDate;
+	//完成甲供物资领退料的时间
+	private String finishDate;
+	//是否超期
+	private String overdue;
+	//是否决算送审
+	private String trial;
+	//施工单位
+	private String construction;
+	//外包施工单位
+	private String outConstruction;
+	//结算单位
+	private String settlement;
 
 	public Information(){
 		super();
@@ -73,6 +93,7 @@ public class Information extends DataEntity<Information>  {
 		this.projectName = projectName;
 	}
 
+	@ExcelField(title="施工单位", align=2, sort=9)
 	public String getDepartment() {
 		return department;
 	}
@@ -81,6 +102,7 @@ public class Information extends DataEntity<Information>  {
 		this.department = department;
 	}
 
+	@ExcelField(title="审定日期", align=2, sort=15)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getApprovalDate() {
 		return approvalDate;
@@ -91,6 +113,7 @@ public class Information extends DataEntity<Information>  {
 		this.approvalDate = approvalDate;
 	}
 
+	@ExcelField(title="二级单位", align=2, sort=16)
 	public String getSecondUnits() {
 		return secondUnits;
 	}
@@ -99,6 +122,7 @@ public class Information extends DataEntity<Information>  {
 		this.secondUnits = secondUnits;
 	}
 
+	@ExcelField(title="一级单位", align=2, sort=17)
 	public String getFirstUnits() {
 		return firstUnits;
 	}
@@ -107,6 +131,7 @@ public class Information extends DataEntity<Information>  {
 		this.firstUnits = firstUnits;
 	}
 
+	@ExcelField(title="项目类型", align=2, sort=3)
 	public String getProjectType() {
 		return projectType;
 	}
@@ -115,6 +140,7 @@ public class Information extends DataEntity<Information>  {
 		this.projectType = projectType;
 	}
 
+	@ExcelField(title="电压等级", align=2, sort=4)
 	public String getProjectGrade() {
 		return projectGrade;
 	}
@@ -123,6 +149,7 @@ public class Information extends DataEntity<Information>  {
 		this.projectGrade = projectGrade;
 	}
 
+	@ExcelField(title="项目预算年度", align=2, sort=5)
 	public String getProjectYear() {
 		return projectYear;
 	}
@@ -131,6 +158,7 @@ public class Information extends DataEntity<Information>  {
 		this.projectYear = projectYear;
 	}
 
+	@ExcelField(title="项目总投资(元)", align=2, sort=6)
 	public Double getProjectTotal() {
 		return projectTotal;
 	}
@@ -138,15 +166,21 @@ public class Information extends DataEntity<Information>  {
 	public void setProjectTotal(Double projectTotal) {
 		this.projectTotal = projectTotal;
 	}
+
+	@ExcelField(title="实际开工日期", align=2, sort=7)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getProjectStart() {
 		return projectStart;
 	}
+
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public void setProjectStart(Date projectStart) {
 		this.projectStart = projectStart;
 	}
+
+	@ExcelField(title="实际竣工日期", align=2, sort=8)
 	@JsonFormat(pattern = "yyyy-MM-dd")
+
 	public Date getProjectStop() {
 		return projectStop;
 	}
@@ -155,6 +189,7 @@ public class Information extends DataEntity<Information>  {
 		this.projectStop = projectStop;
 	}
 
+	@ExcelField(title="事务所名称", align=2, sort=10)
 	public String getProjectFirm() {
 		return projectFirm;
 	}
@@ -162,37 +197,138 @@ public class Information extends DataEntity<Information>  {
 	public void setProjectFirm(String projectFirm) {
 		this.projectFirm = projectFirm;
 	}
+
+	@ExcelField(title="提交送审日期", align=2, sort=11)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getSubDate() {
 		return subDate;
 	}
 
+
+	@JsonFormat(pattern = "yyyy-MM-dd")
 	public void setSubDate(Date subDate) {
 		this.subDate = subDate;
 	}
+
+	@ExcelField(title="审计任务下达日期", align=2, sort=12)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getReleaseDate() {
 		return releaseDate;
 	}
-
+	@JsonFormat(pattern = "yyyy-MM-dd")
 	public void setReleaseDate(Date releaseDate) {
 		this.releaseDate = releaseDate;
 	}
+
+	@ExcelField(title="审计应结束日时间", align=2, sort=13)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getEndDate() {
 		return endDate;
 	}
-
+	@JsonFormat(pattern = "yyyy-MM-dd")
 	public void setEndDate(Date endDate) {
 		this.endDate = endDate;
 	}
+
+	@ExcelField(title="结果上传时间", align=2, sort=14)
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	public Date getResultDate() {
 		return resultDate;
 	}
-
+	@JsonFormat(pattern = "yyyy-MM-dd")
 	public void setResultDate(Date resultDate) {
 		this.resultDate = resultDate;
 	}
 
+	@ExcelField(title="是否完成甲供物资领退料(第1次)", align=2, sort=18)
+	public String getFirstFinish() {
+		return firstFinish;
+	}
+
+	public void setFirstFinish(String firstFinish) {
+		this.firstFinish = firstFinish;
+	}
+
+	@ExcelField(title="完成甲供物资领退料的日期(第1次)", align=2, sort=19)
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	public Date getFirstFinishDate() {
+		return firstFinishDate;
+	}
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	public void setFirstFinishDate(Date firstFinishDate) {
+		this.firstFinishDate = firstFinishDate;
+	}
+
+	@ExcelField(title="是否完成甲供物资领退料(第2次)", align=2, sort=20)
+	public String getSecondFinish() {
+		return secondFinish;
+	}
+
+	public void setSecondFinish(String secondFinish) {
+		this.secondFinish = secondFinish;
+	}
+
+	@ExcelField(title="完成甲供物资领退料的日期(第2次)", align=2, sort=21)
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	public Date getSecondFinishDate() {
+		return secondFinishDate;
+	}
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	public void setSecondFinishDate(Date secondFinishDate) {
+		this.secondFinishDate = secondFinishDate;
+	}
+
+	@ExcelField(title="完成甲供物资领退料的时间", align=2, sort=22)
+	public String getFinishDate() {
+		return finishDate;
+	}
+
+	public void setFinishDate(String finishDate) {
+		this.finishDate = finishDate;
+	}
+
+	@ExcelField(title="是否超期", align=2, sort=23)
+	public String getOverdue() {
+		return overdue;
+	}
+
+	public void setOverdue(String overdue) {
+		this.overdue = overdue;
+	}
+
+	@ExcelField(title="是否决算送审", align=2, sort=24)
+	public String getTrial() {
+		return trial;
+	}
+
+	public void setTrial(String trial) {
+		this.trial = trial;
+	}
+
+	@ExcelField(title="施工单位", align=2, sort=25)
+	public String getConstruction() {
+		return construction;
+	}
+
+	public void setConstruction(String construction) {
+		this.construction = construction;
+	}
+
+	@ExcelField(title="外包施工单位", align=2, sort=26)
+	public String getOutConstruction() {
+		return outConstruction;
+	}
+
+	public void setOutConstruction(String outConstruction) {
+		this.outConstruction = outConstruction;
+	}
+
+	@ExcelField(title="结算单位", align=2, sort=27)
+	public String getSettlement() {
+		return settlement;
+	}
+
+	public void setSettlement(String settlement) {
+		this.settlement = settlement;
+	}
 }

+ 29 - 0
src/main/java/com/jeeplus/modules/sg/information/entity/InformationDto.java

@@ -0,0 +1,29 @@
+package com.jeeplus.modules.sg.information.entity;
+
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+public class InformationDto {
+
+    //项目定义号
+    private String projectId;
+    //	项目名称
+    private String projectName;
+
+    @ExcelField(title="项目定义号", align=2, sort=1)
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    @ExcelField(title="项目名称", align=2, sort=2)
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+}

+ 62 - 0
src/main/java/com/jeeplus/modules/sg/information/entity/append.java

@@ -0,0 +1,62 @@
+package com.jeeplus.modules.sg.information.entity;
+
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+
+public class append {
+    //项目定义号
+    private String projectId;
+    //是否决算送审
+    private String trial;
+    //施工单位
+    private String construction;
+    //外包施工单位
+    private String outConstruction;
+    //结算单位
+    private String settlement;
+
+
+    @ExcelField(title = "项目定义号", align = 2, sort = 1)
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    @ExcelField(title = "是否决算送审", align = 2, sort = 2)
+    public String getTrial() {
+        return trial;
+    }
+
+    public void setTrial(String trial) {
+        this.trial = trial;
+    }
+
+    @ExcelField(title = "施工单位", align = 2, sort = 3)
+    public String getConstruction() {
+        return construction;
+    }
+
+    public void setConstruction(String construction) {
+        this.construction = construction;
+    }
+
+    @ExcelField(title = "外包施工单位", align = 2, sort = 4)
+    public String getOutConstruction() {
+        return outConstruction;
+    }
+
+    public void setOutConstruction(String outConstruction) {
+        this.outConstruction = outConstruction;
+    }
+
+    @ExcelField(title = "结算单位", align = 2, sort = 5)
+    public String getSettlement() {
+        return settlement;
+    }
+
+    public void setSettlement(String settlement) {
+        this.settlement = settlement;
+    }
+}

+ 12 - 1
src/main/java/com/jeeplus/modules/sg/information/mapper/InformationMapper.java

@@ -6,6 +6,8 @@ package com.jeeplus.modules.sg.information.mapper;
 import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
 import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.information.entity.append;
+import com.jeeplus.modules.sg.material.entity.Material;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -21,7 +23,6 @@ public interface InformationMapper extends BaseMapper<Information> {
 
     int insertInfor(Information information);
 
-    int successCount();
 
     Information findListById(@Param("projectId") String projectId);
 
@@ -30,7 +31,17 @@ public interface InformationMapper extends BaseMapper<Information> {
 
     int updateInformationDate(Information information);
 
+    int updateDate(List<Material> material);
+
     Information findInformationByID(Information information);
 
+    int updateAppend(List<append> list);
+
+    List<Material> allNoBack(List<Information> list);
+
+    List<Material> allNo(List<Information> list);
+
+    List<Information> exportInfor(List<Information> list);
 
+    List<Information> export(List<Information> list);
 }

+ 166 - 12
src/main/java/com/jeeplus/modules/sg/information/mapper/xml/InformationMapper.xml

@@ -20,7 +20,40 @@
 		resultDate,
 		approvalDate,
 		second_units,
-		first_units
+		first_units,
+		firstFinish,
+		firstFinishDate,
+		secondFinish,
+		secondFinishDate,
+		finishDate,
+		overdue
+	</sql>
+
+	<sql id="newInformationColumns">
+		a.id,
+		a.project_id,
+		a.project_name,
+		a.project_type,
+		a.project_grade,
+		a.project_year,
+		a.project_total,
+		a.project_start,
+		a.project_stop,
+		a.department,
+		a.project_firm,
+		a.subDate,
+		a.releaseDate,
+		a.endDate,
+		a.resultDate,
+		a.approvalDate,
+		a.second_units,
+		a.first_units,
+		a.firstFinish,
+		a.firstFinishDate,
+		a.secondFinish,
+		a.secondFinishDate,
+		a.finishDate,
+		a.overdue
 	</sql>
     <select id="findAllInformationList" resultType="com.jeeplus.modules.sg.information.entity.Information">
 		select project_id,project_name from project_information
@@ -101,9 +134,7 @@
 		del_flag = #{delFlag}
 	</insert>
 
-	<select id="successCount" resultType="int">
-		select count(*) from project_information
-	</select>
+
 
 	<insert id="insertInfor">
 	INSERT INTO project_information(
@@ -185,6 +216,16 @@
 		approvalDate = #{approvalDate}
 		where project_Id = #{projectId} and project_Name = #{projectName}
 	</update>
+	
+	<update id="updateDate">
+		update project_information set firstFinishDate = CURDATE(),firstFinish = '是'
+		where project_Id in(
+		<foreach collection="list" item="item" separator=",">
+			#{item.projectId}
+		</foreach>
+		)
+		and firstFinishDate is null
+	</update>
 
     <select id="findInformationByID" resultType="com.jeeplus.modules.sg.information.entity.Information">
 		select * from project_information where project_Id = #{projectId} and project_Name = #{projectName}
@@ -192,28 +233,32 @@
 
     <select id="findList" resultType="Information">
         SELECT
-        <include refid="informationColumns"/>
-        FROM project_information
+        a.*,b.trial,b.construction,b.outConstruction,b.settlement
+        FROM project_information as a
+		left JOIN project_append as b on a.project_id = b.project_id
         <where>
-            1 = 1
+			1=1
             <if test="projectId != null and projectId != ''">
-                AND project_Id = #{projectId}
+                AND a.project_Id = #{projectId}
             </if>
             <if test="projectName != null and projectName != ''">
-                AND project_Name LIKE
+                AND a.project_Name LIKE
                 <if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
                 <if test="dbName == 'mssql'">'%'+#{projectName}+'%'</if>
                 <if test="dbName == 'mysql'">concat('%',#{projectName},'%')</if>
             </if>
             <if test="department != null and department != ''">
-                AND department = #{department}
+                AND a.department = #{department}
             </if>
             <if test="secondUnits != null and secondUnits != '' ">
-                AND second_Units #{secondUnits}
+                AND a.second_Units=#{secondUnits}
             </if>
             <if test="firstUnits != null and firstUnits != '' ">
-                AND first_Units #{firstUnits}
+                AND a.first_Units=#{firstUnits}
             </if>
+        	<if test="projectType !=null and projectType != ''">
+				and a.project_type = #{projectType}
+			</if>
         </where>
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -259,6 +304,7 @@
 		approvalDate,
 		second_units,
 		first_units,
+		firstFinish,
 		create_by,
 		create_date,
 		update_by,
@@ -285,6 +331,7 @@
 			#{item.approvalDate},
 			#{item.secondUnits},
 			#{item.firstUnits},
+		 	#{item.firstFinish},
 			#{item.createBy.id},
 			#{item.createDate},
 			#{item.updateBy.id},
@@ -321,4 +368,111 @@
 		select project_id,project_name from project_information where project_Id=#{projectId}
 	</select>
 
+	<insert id="updateAppend">
+		replace into project_append(
+			project_id,
+			trial,
+			construction,
+			outConstruction,
+			settlement
+		)
+		VALUES
+		<foreach collection="list" item="item" separator="," >
+			(
+			#{item.projectId},
+			#{item.trial},
+			#{item.construction},
+			#{item.outConstruction},
+			#{item.settlement}
+			)
+		</foreach>
+	</insert>
+
+	<select id="allNoBack" resultType="com.jeeplus.modules.sg.material.entity.Material">
+		select *
+		from material_information
+		where project_Id in(
+		<foreach collection="list" item="item" index="index" separator=",">
+			#{item.projectId}
+		</foreach>
+		    )
+	</select>
+
+	<select id="allNo" resultType="com.jeeplus.modules.sg.material.entity.Material">
+		select *
+		from material_information
+		where project_Id in(
+		SELECT
+		project_Id
+		FROM project_information as a
+		<where>
+			1=1
+		<foreach collection="list" item="items" index="index">
+			<if test="items.projectId != null and items.projectId != ''">
+				AND a.project_Id = #{items.projectId}
+			</if>
+			<if test="items.projectName != null and items.projectName != ''">
+				AND a.project_Name LIKE
+				concat('%',#{items.projectName},'%')
+			</if>
+			<if test="items.department != null and items.department != ''">
+				AND a.department = #{items.department}
+			</if>
+			<if test="items.secondUnits != null and items.secondUnits != '' ">
+				AND a.second_Units=#{items.secondUnits}
+			</if>
+			<if test="items.firstUnits != null and items.firstUnits != '' ">
+				AND a.first_Units=#{items.firstUnits}
+			</if>
+			<if test="items.projectType !=null and items.projectType != ''">
+				and a.project_type = #{items.projectType}
+			</if>
+		</foreach>
+		</where>
+
+		)
+	</select>
+
+	<select id="exportInfor" resultType="com.jeeplus.modules.sg.information.entity.Information">
+		SELECT
+		a.*,b.trial,b.construction,b.outConstruction,b.settlement
+		FROM project_information as a
+		left JOIN project_append as b on a.project_id = b.project_id
+		where a.project_Id in(
+		    <foreach collection="list" item="items" index="index" separator=",">
+				#{items.projectId}
+			</foreach>
+			)
+	</select>
+	
+	<select id="export" resultType="com.jeeplus.modules.sg.information.entity.Information">
+		SELECT
+		a.*,b.trial,b.construction,b.outConstruction,b.settlement
+		FROM project_information as a
+		left JOIN project_append as b on a.project_id = b.project_id
+		where 1=1
+		<foreach collection="list" item="items" index="index">
+			<if test="items.projectId != null and items.projectId != ''">
+				AND a.project_Id = #{items.projectId}
+			</if>
+			<if test="items.projectName != null and items.projectName != ''">
+				AND a.project_Name LIKE
+				concat('%',#{items.projectName},'%')
+			</if>
+			<if test="items.department != null and items.department != ''">
+				AND a.department = #{items.department}
+			</if>
+			<if test="items.secondUnits != null and items.secondUnits != '' ">
+				AND a.second_Units=#{items.secondUnits}
+			</if>
+			<if test="items.firstUnits != null and items.firstUnits != '' ">
+				AND a.first_Units=#{items.firstUnits}
+			</if>
+			<if test="items.projectType !=null and items.projectType != ''">
+				and a.project_type = #{items.projectType}
+			</if>
+		</foreach>
+
+	</select>
+
 </mapper>

+ 32 - 4
src/main/java/com/jeeplus/modules/sg/information/service/InformationService.java

@@ -6,7 +6,9 @@ package com.jeeplus.modules.sg.information.service;
 import java.util.List;
 
 import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.information.entity.append;
 import com.jeeplus.modules.sg.information.mapper.InformationMapper;
+import com.jeeplus.modules.sg.material.entity.Material;
 import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -50,7 +52,10 @@ public class InformationService extends CrudService<InformationMapper, Informati
 		return super.findListBy(entity);
 	}
 
-
+	@Transactional(readOnly = false)
+	public int updateDate(List<Material> material){
+		return informationMapper.updateDate(material);
+	}
 /*	@Transactional(readOnly = false)
 	public void insert(List<Information> entity) {
 		for (int i = 0; i < entity.size(); i++) {
@@ -76,9 +81,7 @@ public class InformationService extends CrudService<InformationMapper, Informati
 		return informationMapper.saveInfo(entity);
 	}
 
-	public int successCount() {
-		return informationMapper.successCount();
-	}
+
 
 	public  List<Information> findAllInformationList() {
 		return informationMapper.findAllInformationList();
@@ -92,4 +95,29 @@ public class InformationService extends CrudService<InformationMapper, Informati
 	public Information findInformationByID(Information information) {
 		return informationMapper.findInformationByID(information);
 	}
+
+	@Transactional(readOnly = false)
+	public int updateAppend(List<append> list) {
+		return informationMapper.updateAppend(list);
+	}
+
+
+	public List<Material> allNoBack(List<Information> page) {
+		List<Material> materialList = informationMapper.allNoBack(page);
+		return materialList;
+	}
+
+	public List<Material> allNo(List<Information> page) {
+		List<Material> materialList = informationMapper.allNo(page);
+		return materialList;
+	}
+
+	public List<Information> exportInfor(List<Information> list) {
+		List<Information> informationList = informationMapper.exportInfor(list);
+		return informationList;
+	}
+
+	public List<Information> export(List<Information> list) {
+		return informationMapper.export(list);
+	}
 }

+ 84 - 22
src/main/java/com/jeeplus/modules/sg/information/utils/ImportInformation.java

@@ -4,6 +4,7 @@ import com.jeeplus.common.utils.IdGen;
 import com.jeeplus.common.utils.SpringContextHolder;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.information.entity.append;
 import com.jeeplus.modules.sg.information.service.InformationService;
 import com.jeeplus.modules.sg.material.entity.Material;
 import com.jeeplus.modules.sg.material.service.MaterialService;
@@ -22,13 +23,16 @@ public  class ImportInformation {
     @Autowired
     private static MaterialService materialService = SpringContextHolder.getBean(MaterialService.class);
 
+    /**
+     * 导入欠供物资Excel数据
+     */
     public static Map<String,Object> importmation(ImportExcel ei,int lastDataRowNum){
         HashMap<String,Object> hashMap = new HashMap<String,Object>();
         int successNum = 0;
         int failureNum = 0;
-        List<Information> informations = new ArrayList<Information>();
         List<Material> materials = new ArrayList<Material>();
         List<Material> errorMaterial = new ArrayList<Material>();
+        List<Material> noDifferent = new ArrayList<>();
         User user = UserUtils.getUser();
         Double difference = 0.0;
         for (int i = 1; i < lastDataRowNum; i++) {
@@ -36,12 +40,10 @@ public  class ImportInformation {
             try {
                 Row row = ei.getRow(i);
                 Object projectId = ei.getCellValue(row, 1);
-//                Object projectName = ei.getCellValue(row, 2);
                 Object inforId = ei.getCellValue(row, 3);
                 Object materialName = ei.getCellValue(row, 4);
                 Object outboundAmount = ei.getCellValue(row, 5);
                 Object authorizedAmount = ei.getCellValue(row, 6);
-//                Object difference = ei.getCellValue(row, 7);
                 Object outboundNumber = ei.getCellValue(row, 8);
                 Object authorizedNumber = ei.getCellValue(row, 9);
                 Object price = ei.getCellValue(row, 11);
@@ -49,16 +51,9 @@ public  class ImportInformation {
                 Object materialSmall = ei.getCellValue(row, 13);
                 Object materialMid = ei.getCellValue(row, 14);
                 Object materialBig = ei.getCellValue(row, 15);
-                Object Flag = ei.getCellValue(row, 10);
-/*                Object department = ei.getCellValue(row, 16);
-                Object secondUnits = ei.getCellValue(row, 17);
-                Object firstUnits = ei.getCellValue(row, 18);*/
+
                 String isBack = "";
-                if (Flag.equals("0")) {
-                    isBack = "是";
-                } else {
-                    isBack = "否";
-                }
+
 
                 if (outboundAmount.equals("")) {
                     outboundAmount = "0.0";
@@ -77,15 +72,16 @@ public  class ImportInformation {
                 }
                 difference = Double.parseDouble(outboundNumber.toString()) - Double.parseDouble(authorizedNumber.toString());
 
-                Material myMaterial = materialService.findByProIn(projectId.toString(), inforId.toString());
+
+/*                Material myMaterial = materialService.findByProIn(projectId.toString(), inforId.toString());
                 if (myMaterial != null) {
-                    if (myMaterial.getDifference() != Double.parseDouble(difference.toString())) {
+                    if (!myMaterial.getOutboundNumber().equals(Double.parseDouble(outboundNumber.toString()))) {
                         material.setInforId(inforId.toString());
                         material.setProjectId(projectId.toString());
                         material.setMaterialName(materialName.toString());
                         material.setOutboundAmount(Double.parseDouble(outboundAmount.toString()));
                         material.setAuthorizedAmount(Double.parseDouble(authorizedAmount.toString()));;
-                        material.setDifference(Double.parseDouble(difference.toString()));
+                        material.setDifference(difference);
                         material.setOutboundNumber(Double.parseDouble(outboundNumber.toString()));
                         material.setAuthorizedNumber(Double.parseDouble(authorizedNumber.toString()));
                         material.setPrice(Double.parseDouble(price.toString()));
@@ -100,7 +96,13 @@ public  class ImportInformation {
                         material.setUpdateBy(user);
                         material.setUpdateDate(new Date());
                         errorMaterial.add(material);
+                        continue;
                     }
+                }*/
+                if (difference == 0.0) {
+                    isBack = "是";
+                } else {
+                    isBack = "否";
                 }
 
 
@@ -109,7 +111,7 @@ public  class ImportInformation {
                 material.setMaterialName(materialName.toString());
                 material.setOutboundAmount(Double.parseDouble(outboundAmount.toString()));
                 material.setAuthorizedAmount(Double.parseDouble(authorizedAmount.toString()));;
-                material.setDifference(Double.parseDouble(difference.toString()));
+                material.setDifference(difference);
                 material.setOutboundNumber(Double.parseDouble(outboundNumber.toString()));
                 material.setAuthorizedNumber(Double.parseDouble(authorizedNumber.toString()));
                 material.setPrice(Double.parseDouble(price.toString()));
@@ -125,10 +127,16 @@ public  class ImportInformation {
                 material.setUpdateDate(new Date());
                 materials.add(material);
 
-                    successNum++;
+                successNum++;
 
                 if (materials.size() == 1000) {
                     materialService.saveMater(materials);
+                    List<Material> materials1 = materialService.projectNeed(materials);
+                    if (materials1.size() >0) {
+                        for (Material m : materials1) {
+                            noDifferent.add(m);
+                        }
+                    }
                     materials.clear();
                 }
             }catch (Exception ex) {
@@ -139,22 +147,36 @@ public  class ImportInformation {
         }
         if (materials.size() != 0) {
             materialService.saveMater(materials);
+            List<Material> materials1 = materialService.projectNeed(materials);
+            if (materials1.size() >0) {
+                for (Material m : materials1) {
+                    noDifferent.add(m);
+                }
+            }
+        }
+        if (noDifferent.size()>0){
+            informationService.updateDate(noDifferent);
         }
 
+
         hashMap.put("errorMaterial", errorMaterial);
         hashMap.put("successNum",successNum);
         hashMap.put("failureNum",failureNum);
         return hashMap;
     }
 
+
+    /**
+     *	导入综合信息Excel数据
+     * */
     public static Map<String,Integer> importCom(ImportExcel ei,int lastDataRowNum) {
         HashMap<String,Integer> hashMap = new HashMap<String,Integer>();
         int successNum = 0;
         int failureNum = 0;
-        int startNum = informationService.successCount();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         List<Information> informationList = new ArrayList<>();
         User user = UserUtils.getUser();
+        String firstFinish = "";
         for (int i = 2; i < lastDataRowNum; i++) {
             Information information = new Information();
             try {
@@ -162,6 +184,7 @@ public  class ImportInformation {
                 Object projectId = ei.getCellValue(row, 1);
                 Object projectName = ei.getCellValue(row, 2);
                 Object projectType = ei.getCellValue(row, 3);
+                if (projectType.equals("配网建设改造项目")||projectType.equals("配网专项成本")){
                 Object projectGrade = ei.getCellValue(row, 4);
                 Object projectYear = ei.getCellValue(row, 6);
                 Object projectTotal = ei.getCellValue(row, 7);
@@ -176,7 +199,7 @@ public  class ImportInformation {
                 Object approvalDate = ei.getCellValue(row, 44);
                 Object secondUnits = ei.getCellValue(row, 53);
                 Object firstUnits = ei.getCellValue(row, 54);
-
+                firstFinish = "否";
 
                 if (projectTotal.equals("")) {
                     projectTotal = "0.0";
@@ -215,13 +238,15 @@ public  class ImportInformation {
                 }
                 information.setSecondUnits(secondUnits.toString());
                 information.setFirstUnits(firstUnits.toString());
+                information.setFirstFinish(firstFinish);
                 information.preInsert();
                 information.setCreateBy(user);
                 information.setCreateDate(new Date());
                 information.setUpdateBy(user);
                 information.setUpdateDate(new Date());
                 informationList.add(information);
-
+                successNum++;
+            }
                 if (informationList.size() == 1000) {
                     informationService.saveInfo(informationList);
                     informationList.clear();
@@ -234,13 +259,50 @@ public  class ImportInformation {
         if (informationList.size() != 0) {
             informationService.saveInfo(informationList);
         }
-        int successCount = informationService.successCount();
-        successNum = successCount - startNum;
         hashMap.put("successNum",successNum);
         hashMap.put("failureNum",failureNum);
         return hashMap;
     }
 
 
+    public static Map<String,Integer> importInTrial(ImportExcel ei,int lastDataRowNum) {
+        HashMap<String,Integer> hashMap = new HashMap<String,Integer>();
+        List<append> appendList = new ArrayList<>();
+        int successNum = 0;
+        int failureNum = 0;
+        for (int i = 1; i < lastDataRowNum; i++) {
+            try {
+                append append = new append();
+                Row row = ei.getRow(i);
+                Object projectId = ei.getCellValue(row, 0);
+                Object trial = ei.getCellValue(row, 1);
+                Object construction = ei.getCellValue(row, 2);
+                Object outConstruction = ei.getCellValue(row, 3);
+                Object settlement = ei.getCellValue(row, 4);
+
+                append.setProjectId(projectId.toString());
+                append.setTrial(trial.toString());
+                append.setConstruction(construction.toString());
+                append.setOutConstruction(outConstruction.toString());
+                append.setSettlement(settlement.toString());
+                appendList.add(append);
+                if (appendList.size() == 1000) {
+                    informationService.updateAppend(appendList);
+                    successNum = successNum + appendList.size();
+                    appendList.clear();
+                }
+            } catch (Exception e) {
+                failureNum++;
+            }
+        }
+        if (appendList.size() != 0) {
+            informationService.updateAppend(appendList);
+            successNum = successNum + appendList.size();
+        }
+        hashMap.put("successNum",successNum);
+        hashMap.put("failureNum",failureNum);
+        return hashMap;
+    }
+
 
 }

+ 268 - 18
src/main/java/com/jeeplus/modules/sg/information/web/InformationController.java

@@ -3,22 +3,32 @@
  */
 package com.jeeplus.modules.sg.information.web;
 
+import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
+import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.information.entity.InformationDto;
+import com.jeeplus.modules.sg.information.entity.append;
 import com.jeeplus.modules.sg.information.service.InformationService;
 import com.jeeplus.modules.sg.information.utils.ImportInformation;
+import com.jeeplus.modules.sg.material.entity.Material;
 import com.jeeplus.modules.sg.material.service.MaterialService;
 import io.swagger.models.auth.In;
+import net.sf.ehcache.util.concurrent.ConcurrentHashMap;
 import org.apache.poi.ss.usermodel.Row;
+import org.apache.shiro.session.Session;
 import org.h2.util.New;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.method.P;
@@ -79,6 +89,8 @@ public class InformationController extends BaseController {
 	//@RequiresPermissions("test:onetomany:dialog:testDataMain1:list")
 	@RequestMapping(value = "data")
 	public Map<String, Object> data(Information information, HttpServletRequest request, HttpServletResponse response, Model model) {
+		HttpSession session = request.getSession();
+		session.removeAttribute("path");
 		Page<Information> page = informationService.findPage(new Page<Information>(request, response), information);
 		return getBootstrapData(page);
 	}
@@ -94,7 +106,7 @@ public class InformationController extends BaseController {
 
 
 	/**
-	 * 导入供物资Excel数据
+	 * 导入供物资Excel数据
 	 */
 	//@RequiresPermissions("test:onetomany:dialog:information:import")
 	@ResponseBody
@@ -111,19 +123,19 @@ public class InformationController extends BaseController {
 			Map<String, Object> information = ImportInformation.importmation(ei, lastDataRowNum);
 			int failureNum = Integer.parseInt(information.get("failureNum").toString());
 			int successNum = Integer.parseInt(information.get("successNum").toString());
-			List<Information> informationList= (List<Information>)information.get("importmation");
+			List<Material> informationList= (List<Material>)information.get("errorMaterial");
 			if (failureNum>0){
 				failureMsg.insert(0, ",失败 "+failureNum+" 项目管理记录。");
 			}
 			if (informationList != null) {
 				if (informationList.size() >0) {
-					for (Information in :informationList) {
-						failInformation.append(in.getProjectName()+";");
+					for (Material in :informationList) {
+						failInformation.append(in.getMaterialName()+";");
 					}
 					failInformation.append("以上物料因出库数量与数据库中不一致未能插入");
 				}
 			}
-			j.setMsg( "已成功导入 "+successNum+" 项目管理记录"+failureMsg+failInformation);
+			j.setMsg( "已成功导入 "+successNum+" 项目管理记录;"+failureMsg+failInformation);
 		} catch (Exception e) {
 			j.setSuccess(false);
 			j.setMsg("导入项目管理信息失败!失败信息:"+e.getMessage());
@@ -156,22 +168,27 @@ public class InformationController extends BaseController {
 		return j;
 	}
 
-	/**
-	 * 批量导入模板
-	 * */
+
+
+
 	@ResponseBody
-//	@RequiresPermissions("test:onetomany:form:testDataMain2:import")
-	@RequestMapping(value = "import/template")
-	public AjaxJson importFileTemplate(HttpServletResponse response) {
+	@RequestMapping(value = "importInTrial")
+	public AjaxJson importInTrial(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
 		AjaxJson j = new AjaxJson();
 		try {
-			String fileName = "批量项目查询导入模板.xlsx";
-			List<Information> list = Lists.newArrayList();
-			new ExportExcel("", Information.class, 1).setDataList(list).write(response, fileName).dispose();
-			return null;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			int lastDataRowNum = ei.getLastDataRowNum();
+			Map<String, Integer> importInTrial = ImportInformation.importInTrial(ei, lastDataRowNum);
+			int failureNum = importInTrial.get("failureNum");
+			int successNum = importInTrial.get("successNum");
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 项目管理记录。");
+			}
+			j.setMsg( "已成功导入 "+successNum+" 条记录"+failureMsg);
 		} catch (Exception e) {
 			j.setSuccess(false);
-			j.setMsg( "批量项目查询下载失败!失败信息:"+e.getMessage());
+			j.setMsg("导入项审定日期失败!失败信息:"+e.getMessage());
 		}
 		return j;
 	}
@@ -183,6 +200,7 @@ public class InformationController extends BaseController {
 		AjaxJson j = new AjaxJson();
 			StringBuilder failureMsg = new StringBuilder();
 			ImportExcel ei = null;
+			String canonicalPath = "";
 			try {
 				ei = new ImportExcel(file, 1, 0);
 			}catch (Exception e) {
@@ -201,14 +219,246 @@ public class InformationController extends BaseController {
 				infor.add(information1);
 			}
 			List<Information> listBy = informationService.findListBy(infor);
+		try {
+			File temp =new File("C:\\Users\\lem\\AppData\\Local\\Temp\\information");
+			/**
+			 * 在临时文件中写入内容
+			 */
+			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(temp));
+			for (Information items :
+					listBy) {
+				String a = items.getProjectId();
+				bufferedWriter.write(a+"\r");
+			}
+			bufferedWriter.close();
+
+/*			*//**
+			 * 读取临时文件中的内容
+			 *//*
+			BufferedReader bufferedReader = new BufferedReader(new FileReader(temp));
+			String string;
+			List list1 = new ArrayList();
+			while ((string=bufferedReader.readLine()) != null){
+				System.out.println(string);
+				list1.add(string);
+			}
+			bufferedReader.close();*/
+			canonicalPath = temp.getCanonicalPath();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
 			String listCount = String.valueOf(listBy.size());
 			long l = Long.parseLong(listCount);
 		Page<Information> page = new Page(1, listBy.size(), l, listBy);
-		List<Information> list = page.getList();
-		long count = page.getCount();
+		HttpSession session = request.getSession();
+		session.setAttribute("path",canonicalPath);
 		return getBootstrapData(page);
 		}
 
+
+
+	/**
+	 * 批量导入模板
+	 * */
+	@ResponseBody
+//	@RequiresPermissions("test:onetomany:form:testDataMain2:import")
+	@RequestMapping(value = "import/template")
+	public AjaxJson importFileTemplate(HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+			String fileName = "批量项目查询导入模板.xlsx";
+			List<Information> list = Lists.newArrayList();
+			new ExportExcel("", InformationDto.class, 1).setDataList(list).write(response, fileName).dispose();
+			return null;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg( "批量项目查询下载失败!失败信息:"+e.getMessage());
+		}
+		return j;
+	}
+
+
+	@ResponseBody
+//	@RequiresPermissions("test:onetomany:form:testDataMain2:import")
+	@RequestMapping(value = "import/templates")
+	public AjaxJson importFileTemplateS(HttpServletResponse response) {
+		AjaxJson j = new AjaxJson();
+		try {
+			String fileName = "导入送审.xlsx";
+			List<append> list = Lists.newArrayList();
+			new ExportExcel("", append.class, 1).setDataList(list).write(response, fileName).dispose();
+			return null;
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg( "导入送审下载失败!失败信息:"+e.getMessage());
+		}
+		return j;
+	}
+
+
+	public static Map<String, ExportExcel> excelParamCache = new ConcurrentHashMap<>();
+	@ResponseBody
+	//@RequiresPermissions("test:onetomany:dialog:testDataMain1:export")
+	@RequestMapping(value = "exportMaterial")
+	public AjaxJson exportMaterial(Information information,HttpServletRequest request, HttpServletResponse response) {
+		String projectId = "";
+		String projectName = "";
+		String projectType = "";
+		String projectYear = "";
+		String firstUnits = "";
+		String secondUnits = "";
+
+		try {
+		projectId = request.getParameter("projectId");
+		projectName = request.getParameter("projectName");
+			projectName = new String(projectName.getBytes("iso8859-1"),"utf-8");
+		projectType = request.getParameter("projectType");
+			projectType = new String(projectType.getBytes("iso8859-1"),"utf-8");
+		projectYear = request.getParameter("projectYear");
+			projectYear = new String(projectYear.getBytes("iso8859-1"),"utf-8");
+		firstUnits= request.getParameter("firstUnits");
+			firstUnits = new String(firstUnits.getBytes("iso8859-1"),"utf-8");
+		secondUnits= request.getParameter("secondUnits");
+			secondUnits = new String(secondUnits.getBytes("iso8859-1"),"utf-8");
+
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		HttpSession session = request.getSession();
+		Object path = session.getAttribute("path");
+		List<Information> tList = new ArrayList<>();
+		AjaxJson j = new AjaxJson();
+		if (path != null && path != "") {
+//			 * 读取临时文件中的内容
+			BufferedReader bufferedReader = null;
+			try {
+				bufferedReader = new BufferedReader(new FileReader(path.toString()));
+				String string;
+				while ((string=bufferedReader.readLine()) != null){
+					Information information1 = new Information();
+					information1.setProjectId(string);
+					tList.add(information1);
+				}
+				bufferedReader.close();
+				try {
+					String fileName = "导出物料清单"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+					List<Material> materialList = informationService.allNoBack(tList);
+					new ExportExcel("导出物料清单", Material.class).setDataList(materialList).write(response, fileName).dispose();
+					j.setSuccess(true);
+					j.setMsg("导出成功!");
+					return j;
+				} catch (Exception e) {
+					j.setSuccess(false);
+					j.setMsg("导出物料清单!失败信息:"+e.getMessage());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		} else {
+			Information information1 = new Information();
+			information1.setProjectId(projectId);
+			information1.setProjectName(projectName);
+			information1.setProjectType(projectType);
+			information1.setProjectYear(projectYear);
+			information1.setFirstUnits(firstUnits);
+			information1.setSecondUnits(secondUnits);
+			tList.add(information1);
+			try {
+				String fileName = "导出物料清单"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+				List<Material> materialList = informationService.allNo(tList);
+				new ExportExcel("导出物料清单", Material.class).setDataList(materialList).write(response, fileName).dispose();
+				j.setSuccess(true);
+				j.setMsg("导出成功!");
+				return j;
+			} catch (Exception e) {
+				j.setSuccess(false);
+				j.setMsg("导出物料清单!失败信息:"+e.getMessage());
+			}
+		}
+		return j;
+	}
+
+
+	@ResponseBody
+	//@RequiresPermissions("test:onetomany:dialog:testDataMain1:export")
+	@RequestMapping(value = "export")
+	public AjaxJson export(Information information,HttpServletRequest request, HttpServletResponse response) {
+		String projectId = "";
+		String projectName = "";
+		String projectType = "";
+		String projectYear = "";
+		String firstUnits = "";
+		String secondUnits = "";
+
+		try {
+			projectId = request.getParameter("projectId");
+			projectName = request.getParameter("projectName");
+			projectName = new String(projectName.getBytes("iso8859-1"),"utf-8");
+			projectType = request.getParameter("projectType");
+			projectType = new String(projectType.getBytes("iso8859-1"),"utf-8");
+			projectYear = request.getParameter("projectYear");
+			projectYear = new String(projectYear.getBytes("iso8859-1"),"utf-8");
+			firstUnits= request.getParameter("firstUnits");
+			firstUnits = new String(firstUnits.getBytes("iso8859-1"),"utf-8");
+			secondUnits= request.getParameter("secondUnits");
+			secondUnits = new String(secondUnits.getBytes("iso8859-1"),"utf-8");
+
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		HttpSession session = request.getSession();
+		Object path = session.getAttribute("path");
+		List<Information> tList = new ArrayList<>();
+		AjaxJson j = new AjaxJson();
+		if (path != null && path != "") {
+//			 * 读取临时文件中的内容
+			BufferedReader bufferedReader = null;
+			try {
+				bufferedReader = new BufferedReader(new FileReader(path.toString()));
+				String string;
+				while ((string=bufferedReader.readLine()) != null){
+					Information information1 = new Information();
+					information1.setProjectId(string);
+					tList.add(information1);
+				}
+				bufferedReader.close();
+				try {
+					String fileName = "导出项目清单"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+					List<Information> informationList = informationService.exportInfor(tList);
+					new ExportExcel("导出项目清单", Information.class).setDataList(informationList).write(response, fileName).dispose();
+					j.setSuccess(true);
+					j.setMsg("导出成功!");
+					return j;
+				} catch (Exception e) {
+					j.setSuccess(false);
+					j.setMsg("导出项目清单!失败信息:"+e.getMessage());
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		} else {
+			Information information1 = new Information();
+			information1.setProjectId(projectId);
+			information1.setProjectName(projectName);
+			information1.setProjectType(projectType);
+			information1.setProjectYear(projectYear);
+			information1.setFirstUnits(firstUnits);
+			information1.setSecondUnits(secondUnits);
+			tList.add(information1);
+			try {
+				String fileName = "导出项目清单"+ DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+				List<Information> informationList = informationService.export(tList);
+				new ExportExcel("导出项目清单", Information.class).setDataList(informationList).write(response, fileName).dispose();
+				j.setSuccess(true);
+				j.setMsg("导出成功!");
+				return j;
+			} catch (Exception e) {
+				j.setSuccess(false);
+				j.setMsg("导出项目清单!失败信息:"+e.getMessage());
+			}
+		}
+		return j;
+	}
 }
 
 

+ 16 - 16
src/main/java/com/jeeplus/modules/sg/material/entity/Material.java

@@ -50,7 +50,7 @@ public class Material extends DataEntity<Material>  {
     private String info;
 
 
-    @ExcelField(title="是否完成领退料", align=2, sort=13)
+    @ExcelField(title="是否完成领退料", align=2, sort=14)
     public String getIsBack() {
         return isBack;
     }
@@ -58,7 +58,7 @@ public class Material extends DataEntity<Material>  {
     public void setIsBack(String isBack) {
         this.isBack = isBack;
     }
-
+    @ExcelField(title="物料编号", align=2, sort=1)
     public String getProjectId() {
         return projectId;
     }
@@ -67,7 +67,7 @@ public class Material extends DataEntity<Material>  {
         this.projectId = projectId;
     }
 
-    @ExcelField(title="物料编号", align=2, sort=1)
+    @ExcelField(title="物料编号", align=2, sort=2)
     public String getInforId() {
         return inforId;
     }
@@ -76,7 +76,7 @@ public class Material extends DataEntity<Material>  {
         this.inforId = inforId;
     }
 
-    @ExcelField(title="物料描述", align=2, sort=2)
+    @ExcelField(title="物料描述", align=2, sort=3)
     public String getMaterialName() {
         return materialName;
     }
@@ -85,7 +85,7 @@ public class Material extends DataEntity<Material>  {
         this.materialName = materialName;
     }
 
-    @ExcelField(title="出库金额", align=2, sort=3)
+    @ExcelField(title="出库金额", align=2, sort=4)
     public Double getOutboundAmount() {
         return outboundAmount;
     }
@@ -94,7 +94,7 @@ public class Material extends DataEntity<Material>  {
         this.outboundAmount = outboundAmount;
     }
 
-    @ExcelField(title="审定金额", align=2, sort=4)
+    @ExcelField(title="审定金额", align=2, sort=5)
     public Double getAuthorizedAmount() {
         return authorizedAmount;
     }
@@ -103,7 +103,7 @@ public class Material extends DataEntity<Material>  {
         this.authorizedAmount = authorizedAmount;
     }
 
-    @ExcelField(title="差额", align=2, sort=5)
+    @ExcelField(title="差额", align=2, sort=6)
     public Double getDifference() {
         return difference;
     }
@@ -112,7 +112,7 @@ public class Material extends DataEntity<Material>  {
         this.difference = difference;
     }
 
-    @ExcelField(title="出库数量", align=2, sort=6)
+    @ExcelField(title="出库数量", align=2, sort=7)
     public Double getOutboundNumber() {
         return outboundNumber;
     }
@@ -121,7 +121,7 @@ public class Material extends DataEntity<Material>  {
         this.outboundNumber = outboundNumber;
     }
 
-    @ExcelField(title="审定数量", align=2, sort=7)
+    @ExcelField(title="审定数量", align=2, sort=8)
     public Double getAuthorizedNumber() {
         return authorizedNumber;
     }
@@ -130,7 +130,7 @@ public class Material extends DataEntity<Material>  {
         this.authorizedNumber = authorizedNumber;
     }
 
-    @ExcelField(title="平均价单价", align=2, sort=8)
+    @ExcelField(title="平均价单价", align=2, sort=9)
     public Double getPrice() {
         return price;
     }
@@ -139,7 +139,7 @@ public class Material extends DataEntity<Material>  {
         this.price = price;
     }
 
-    @ExcelField(title="单位", align=2, sort=9)
+    @ExcelField(title="单位", align=2, sort=10)
     public String getUnit() {
         return unit;
     }
@@ -148,7 +148,7 @@ public class Material extends DataEntity<Material>  {
         this.unit = unit;
     }
 
-    @ExcelField(title="物料小类", align=2, sort=10)
+    @ExcelField(title="物料小类", align=2, sort=11)
     public String getMaterialSmall() {
         return materialSmall;
     }
@@ -157,7 +157,7 @@ public class Material extends DataEntity<Material>  {
         this.materialSmall = materialSmall;
     }
 
-    @ExcelField(title="物料中类", align=2, sort=11)
+    @ExcelField(title="物料中类", align=2, sort=12)
     public String getMaterialMid() {
         return materialMid;
     }
@@ -166,7 +166,7 @@ public class Material extends DataEntity<Material>  {
         this.materialMid = materialMid;
     }
 
-    @ExcelField(title="物料大类", align=2, sort=12)
+    @ExcelField(title="物料大类", align=2, sort=13)
     public String getMaterialBig() {
         return materialBig;
     }
@@ -175,7 +175,7 @@ public class Material extends DataEntity<Material>  {
         this.materialBig = materialBig;
     }
 
-    @ExcelField(title="原因类型", align=2, sort=14)
+    @ExcelField(title="原因类型", align=2, sort=15)
     public String getStatus() {
         return status;
     }
@@ -184,7 +184,7 @@ public class Material extends DataEntity<Material>  {
         this.status = status;
     }
 
-    @ExcelField(title="备注说明", align=2, sort=15)
+    @ExcelField(title="备注说明", align=2, sort=16)
     public String getInfo() {
         return info;
     }

+ 2 - 0
src/main/java/com/jeeplus/modules/sg/material/mapper/MaterialMapper.java

@@ -23,5 +23,7 @@ public interface MaterialMapper extends BaseMapper<Material> {
 
     void saveMater(List<Material> list);
 
+    List<Material> projectNeed(List<Material> list);
+
     Material findByProIn(@Param("projectId") String projectId, @Param("inforId") String infoId);
 }

+ 11 - 0
src/main/java/com/jeeplus/modules/sg/material/mapper/xml/MaterialMapper.xml

@@ -71,6 +71,17 @@
     <select id="get" resultType="Material">
 		select id,status,info from material_information where id = #{id}
 	</select>
+    <select id="projectNeed" resultType="com.jeeplus.modules.sg.material.entity.Material">
+        select project_id  from material_information where project_id
+        in(
+            <foreach collection="list" index="index" item="material" separator=",">
+                #{material.projectId}
+            </foreach>
+        )
+        GROUP BY project_id HAVING SUM(difference) = 0
+
+    </select>
+    
     <insert id="saveMater">
         replace into material_information(
         id,

+ 4 - 0
src/main/java/com/jeeplus/modules/sg/material/service/MaterialService.java

@@ -39,6 +39,10 @@ public class MaterialService extends CrudService<MaterialMapper, Material> {
 		return super.findPage(page, entity);
 	}
 
+	public List<Material> projectNeed(List<Material> list) {
+		return materialMapper.projectNeed(list);
+	}
+
 	@Override
 	public List<Material> findListBy(List<Material> entity) {
 		return super.findListBy(entity);

+ 5 - 5
src/main/webapp/webpage/modules/sg/information/informationForm.jsp

@@ -21,27 +21,27 @@
 				<tr>
 					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>项目定义号:</label></td>
 					<td class="width-35">
-						<form:input path="projectId" htmlEscape="false" cssClass="form-control"/>
+						<form:input id="projectId" path="projectId" htmlEscape="false" cssClass="form-control"/>
 					</td>
 					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>项目名称:</label></td>
 					<td class="width-35">
-						<form:input path="projectName" htmlEscape="false" cssClass="form-control"/>
+						<form:input id="projectName" path="projectName" htmlEscape="false" cssClass="form-control"/>
 					</td>
 				</tr>
 				<tr>
 					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>送审部门:</label></td>
 					<td class="width-35">
-						<form:input path="department" htmlEscape="false" cssClass="form-control"/>
+						<form:input id="department" path="department" htmlEscape="false" cssClass="form-control"/>
 					</td>
 				</tr>
 				<tr>
 					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>二级单位:</label></td>
 					<td class="width-35">
-						<form:input path="secondUnits" htmlEscape="false" cssClass="form-control"/>
+						<form:input id="secondUnits" path="secondUnits" htmlEscape="false" cssClass="form-control"/>
 					</td>
 					<td class="width-15 active"><label class="pull-right"><font color="red">*</font>一级单位:</label></td>
 					<td class="width-35">
-						<form:input path="firstUnits" htmlEscape="false" cssClass="form-control"/>
+						<form:input id="firstUnits" path="firstUnits" htmlEscape="false" cssClass="form-control"/>
 					</td>
 				</tr>
 				<tr>

+ 132 - 15
src/main/webapp/webpage/modules/sg/information/informationList.js

@@ -8,9 +8,9 @@ $(document).ready(function() {
 			jp.openTab("${ctx}/sg/material?projectId="+row.projectId,'查看《'+row.projectName+'》物料情况', true);
 		}
 	};
+	var h = $(window).height() - 100;
 
 	$('#informationTable').bootstrapTable({
-
 		  //请求方法
                method: 'post',
                //类型json
@@ -18,6 +18,7 @@ $(document).ready(function() {
                contentType: "application/x-www-form-urlencoded",
                //显示检索按钮
 	       		showSearch: true,
+				height:h,
                //显示刷新按钮
                showRefresh: true,
                //显示切换手机试图按钮
@@ -35,7 +36,7 @@ $(document).ready(function() {
                //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
                cache: false,
                //是否显示分页(*)
-               pagination: true,
+               pagination: false,
                 //排序方式
                sortOrder: "asc",
                //初始化加载第一页,默认第一页
@@ -66,10 +67,8 @@ $(document).ready(function() {
                	onShowSearch: function () {
 			$("#search-collapse").slideToggle();
 		},
-               columns: [{
-		        checkbox: true
-		    }
-			,{
+               columns: [
+               	{
 		        field: 'projectId',
 		        title: '项目定义号',
 		        sortable: true,
@@ -165,6 +164,66 @@ $(document).ready(function() {
 					   sortable: true,
 					   sortName: 'firstUnits'
 				   }
+				   ,{
+					   field: 'firstFinish',
+					   title: '是否完成甲供物资领退料(第1次)',
+					   sortable: true,
+					   sortName: 'firstFinish'
+				   }
+				   ,{
+					   field: 'firstFinishDate',
+					   title: '完成甲供物资领退料的日期(第1次)',
+					   sortable: true,
+					   sortName: 'firstFinishDate'
+				   }
+				   ,{
+					   field: 'secondFinish',
+					   title: '是否完成甲供物资领退料(第2次)',
+					   sortable: true,
+					   sortName: 'secondFinish'
+				   }
+				   ,{
+					   field: 'secondFinishDate',
+					   title: '完成甲供物资领退料的日期(第2次)',
+					   sortable: true,
+					   sortName: 'secondFinishDate'
+				   }
+				   ,{
+					   field: 'finishDate',
+					   title: '完成甲供物资领退料的时间',
+					   sortable: true,
+					   sortName: 'finishDate'
+				   }
+				   ,{
+					   field: 'overdue',
+					   title: '是否超期',
+					   sortable: true,
+					   sortName: 'overdue'
+				   }
+				   ,{
+					   field: 'trial',
+					   title: '是否决算送审',
+					   sortable: true,
+					   sortName: 'trial'
+				   }
+				   ,{
+					   field: 'construction',
+					   title: '施工单位',
+					   sortable: true,
+					   sortName: 'construction'
+				   }
+				   ,{
+					   field: 'outConstruction',
+					   title: '外包施工单位',
+					   sortable: true,
+					   sortName: 'outConstruction'
+				   }
+				   ,{
+					   field: 'settlement',
+					   title: '结算单位',
+					   sortable: true,
+					   sortName: 'settlement'
+				   }
 		    ,{
 					   field: 'operate',
 					   title: '操作',
@@ -192,6 +251,7 @@ $(document).ready(function() {
             $('#view,#edit').prop('disabled', $('#informationTable').bootstrapTable('getSelections').length!=1);
         });
 
+
 	  	$("#btnInformation").click(function () {
 			jp.open({
 				type: 2,
@@ -203,11 +263,12 @@ $(document).ready(function() {
 				btn1: function(index, layero){
 					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
 					iframeWin.contentWindow.importExcel('${ctx}/sg/information/import', function (data) {
+						console.log(data);
 						if(data.success){
-							jp.success(data.msg);
-							refresh();
+						jp.success(data.msg);
+						refresh();
 						}else{
-							jp.error(data.msg);
+						jp.error(data.msg);
 						}
 						jp.close(index);
 					});//调用保存事件
@@ -219,6 +280,35 @@ $(document).ready(function() {
 			})
 		})
 
+	$("#btnInTrial").click(function () {
+		jp.open({
+			type: 2,
+			area: [500, 200],
+			auto: true,
+			title:"导入数据",
+			content: "${ctx}/tag/importExcel" ,
+			btn: ['下载模板','确定', '关闭'],
+			btn1: function(index, layero){
+				jp.downloadFile('${ctx}/sg/information/import/templates');
+			},
+			btn2: function(index, layero){
+				var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+				iframeWin.contentWindow.importExcel('${ctx}/sg/information/importInTrial', function (data) {
+					if(data.success){
+						jp.success(data.msg);
+						refresh();
+					}else{
+						jp.error(data.msg);
+					}
+					jp.close(index);
+				});//调用保存事件
+				return false;
+			},
+			btn3: function(index){
+				jp.close(index);
+			}
+		})
+	})
 	$("#btnCom").click(function () {
 		jp.open({
 			type: 2,
@@ -260,12 +350,9 @@ $(document).ready(function() {
             btn2: function(index, layero){
                 var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
                 iframeWin.contentWindow.importExcel('${ctx}/sg/information/btnSearch', function (data) {
-					if(data.success){
-						jp.success(data.msg);
-						refresh();
-					}else{
-						jp.error(data.msg);
-					}
+						top.layer.msg('成功', {icon:1})
+					console.log(data);
+					$('#informationTable').bootstrapTable('load',data);
 					jp.close(index);
                 });//调用保存事件
                 return false;
@@ -276,7 +363,37 @@ $(document).ready(function() {
         })
     })
 
+	$("#export").click(function(){//导出物料清单
+		var projectId = $("#projectId").val();
+		var projectName = $("#projectName").val();
+		var projectType = $("#projectType").val();
+		var projectYear = $("#projectYear").val();
+		var firstUnits = $("#firstUnits").val();
+		var secondUnits = $("#secondUnits").val();
+		console.log(projectId);
+		console.log(projectName);
+		console.log(projectType);
+		console.log(projectYear);
+		console.log(firstUnits);
+		console.log(secondUnits);
+		jp.downloadFile('${ctx}/sg/information/exportMaterial?projectId='+projectId+'&projectName='+projectName+'&projectType='+projectType+'&projectYear='+projectYear+'&firstUnits='+firstUnits+'&secondUnits='+secondUnits);
+	});
+
+
+	$("#exportMaterial").click(function(){//导出项目清单
+		var projectId = $("#projectId").val();
+		var projectName = $("#projectName").val();
+		var projectType = $("#projectType").val();
+		var projectYear = $("#projectYear").val();
+		var firstUnits = $("#firstUnits").val();
+		var secondUnits = $("#secondUnits").val();
+		jp.downloadFile('${ctx}/sg/information/export?projectId='+projectId+'&projectName='+projectName+'&projectType='+projectType+'&projectYear='+projectYear+'&firstUnits='+firstUnits+'&secondUnits='+secondUnits);
+
+	});
+
+
 	  $("#search").click("click", function() {// 绑定查询按扭
+		  sessionStorage.removeItem("path");
 		  $('#informationTable').bootstrapTable('refresh');
 		});
 

+ 29 - 6
src/main/webapp/webpage/modules/sg/information/informationList.jsp

@@ -8,6 +8,7 @@
 	<%@ include file="/webpage/include/bootstraptable.jsp"%>
 	<%@include file="/webpage/include/treeview.jsp" %>
 	<%@include file="informationList.js" %>
+	<script src="/${ctx}/act/rest/js/common/jquery-1.8.3.js"></script>
 </head>
 <body>
 	<div class="wrapper wrapper-content">
@@ -31,19 +32,25 @@
 			</div>
 			 <div class="col-xs-12 col-sm-6 col-md-4">
 				<div class="form-group">
-					<label class="label-item single-overflow pull-left" title="送审部门:">&nbsp;送审部门:</label>
-					<form:input path="department" htmlEscape="false" maxlength="100"  class=" form-control"/>
+					<label class="label-item single-overflow pull-left" title="项目类型:">&nbsp;项目类型:</label>
+					<form:input path="projectType" htmlEscape="false" maxlength="100"  class=" form-control"/>
 				</div>
 			</div>
+				<div class="col-xs-12 col-sm-6 col-md-4">
+					<div class="form-group">
+						<label class="label-item single-overflow pull-left" title="项目预算年度:">&nbsp;项目预算年度:</label>
+						<form:input path="projectYear" htmlEscape="false" maxlength="100"  class=" form-control"/>
+					</div>
+				</div>
 			 <div class="col-xs-12 col-sm-6 col-md-4">
 				 <div class="form-group">
-					<label class="label-item single-overflow pull-left" title="审定日期:">&nbsp;一级单位:</label>
+					<label class="label-item single-overflow pull-left" title="一级单位:">&nbsp;一级单位:</label>
 					 <form:input path="firstUnits" htmlEscape="false" maxlength="100"  class=" form-control"/>
 				</div>
 			</div>
 				<div class="col-xs-12 col-sm-6 col-md-4">
 					<div class="form-group">
-						<label class="label-item single-overflow pull-left" title="审定日期:">&nbsp;二级单位:</label>
+						<label class="label-item single-overflow pull-left" title="二级单位:">&nbsp;二级单位:</label>
 						<form:input path="secondUnits" htmlEscape="false" maxlength="100"  class=" form-control"/>
 					</div>
 				</div>
@@ -66,14 +73,30 @@
 		</shiro:hasPermission>
 			<shiro:hasPermission name="test:onetomany:dialog:testDataMain1:add">
 				<button id="btnInformation" class="btn btn-info">
-					<i class="fa fa-folder-open-o"></i> 导入欠供物资
+					<i class="fa fa-folder-open-o"></i> 导入甲供材
 				</button>
 			</shiro:hasPermission>
 		<shiro:hasPermission name="test:onetomany:dialog:testDataMain1:add">
+			<button id="btnInReason" class="btn btn-info">
+				<i class="fa fa-folder-open-o"></i> 导入原因类型
+			</button>
+		</shiro:hasPermission>
+		<shiro:hasPermission name="test:onetomany:dialog:testDataMain1:add">
+			<button id="btnInTrial" class="btn btn-info">
+				<i class="fa fa-folder-open-o"></i> 导入送审
+			</button>
+		</shiro:hasPermission>
+		<shiro:hasPermission name="test:onetomany:dialog:testDataMain1:add">
 			<button id="btnSearch" class="btn btn-info">
-				<i class="fa fa-folder-open-o"></i> 导入批量项目查询
+				<i class="fa fa-folder-open-o"></i> 导入查询
 			</button>
 		</shiro:hasPermission>
+		<button id="exportMaterial" class="btn btn-warning">
+			<i class="fa fa-file-excel-o"></i> 导出项目
+		</button>
+		<button id="export" class="btn btn-warning">
+			<i class="fa fa-file-excel-o"></i> 导出物料清单
+		</button>
 		    </div>
 		
 	<!-- 表格 -->