Bladeren bron

new update

ylx 7 jaren geleden
bovenliggende
commit
4f302b3e7e
19 gewijzigde bestanden met toevoegingen van 847 en 674 verwijderingen
  1. 3 3
      ccb_fund_trusteeship/pom.xml
  2. 2 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/constant/HintMSG.java
  3. 6 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/AttachmentDao.java
  4. 18 2
      ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/BusinessDeclareDao.java
  5. 1 1
      ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/BusinessCheck.java
  6. 19 15
      ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/BusinessDeclare.java
  7. 7 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/AttachmentMapper.xml
  8. 127 1
      ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/BusinessDeclareMapper.xml
  9. 3 7
      ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/ValuationAccountingMapper.xml
  10. 5 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/AttachmentMapper.java
  11. 9 1
      ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/BusinessDeclareMapper.java
  12. 38 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/service/AttachmentService.java
  13. 169 472
      ccb_fund_trusteeship/src/main/java/com/fuzamei/service/BusinessDeclareService.java
  14. 4 3
      ccb_fund_trusteeship/src/main/java/com/fuzamei/service/ValuationAccountingService.java
  15. 63 0
      ccb_fund_trusteeship/src/main/java/com/fuzamei/utils/ExcelUtil.java
  16. 1 1
      ccb_fund_trusteeship/src/main/java/com/fuzamei/utils/RelativePathUtil.java
  17. 307 137
      ccb_fund_trusteeship/src/main/java/com/fuzamei/web/BusinessDeclareAction.java
  18. 2 2
      ccb_fund_trusteeship/src/main/java/com/fuzamei/web/ProjectFileAction.java
  19. 63 29
      ccb_fund_trusteeship/src/main/java/com/fuzamei/web/ValuationAccountingAction.java

+ 3 - 3
ccb_fund_trusteeship/pom.xml

@@ -206,20 +206,20 @@
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi</artifactId>
-			<version>3.7</version>
+			<version>3.15</version>
 		</dependency>
 
 		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi-ooxml</artifactId>
-			<version>3.7</version>
+			<version>3.15</version>
 		</dependency>
 		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi-ooxml-schemas</artifactId>
-			<version>3.7</version>
+			<version>3.15</version>
 		</dependency>
 		<!-- excel jar end…… -->
 		<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->

+ 2 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/constant/HintMSG.java

@@ -19,4 +19,6 @@ public class HintMSG {
 	public static final String CHECK_FAIL="查看失败";
 	public static final String FILE_NOT_FOUND="文件不存在";
 	public static final String FILE_CANT_BE_NULL="文件不能为空";
+	public static final String OPERATION_SUCCESS="操作成功";
+	public static final String OPERATION_FAIL="操作失败";
 }

+ 6 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/AttachmentDao.java

@@ -1,5 +1,7 @@
 package com.fuzamei.dao;
 
+import java.util.Set;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
@@ -15,4 +17,8 @@ public class AttachmentDao {
 		return attachmentMapper.queryIfHasTheSameAttachmentId(attachmentId);
 	}
 
+	public int queryIfHasTheSameAttachmentIdS(Set<Integer> set) {
+		return attachmentMapper.queryIfHasTheSameAttachmentIdS(set);
+	}
+
 }

+ 18 - 2
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/BusinessDeclareDao.java

@@ -24,8 +24,8 @@ public class BusinessDeclareDao {
 		businessDeclareMapper.insertAttachmentInformationToDaoByBranchBank(map);
 	}
 
-	public int findAddInfromations() {
-		return businessDeclareMapper.findAddInfromations();
+	public int findAllInfromations() {
+		return businessDeclareMapper.findAllInfromations();
 	}
 
 	public List<BusinessDeclare> queryBusinessDeclareInformation(Map<String, Object> map) {
@@ -59,6 +59,22 @@ public class BusinessDeclareDao {
 	public void insertOperationHistoryInformationToDaoByBranchBank(Map<String, Object> map) {
 		businessDeclareMapper.insertOperationHistoryInformationToDaoByBranchBank(map);
 	}
+
+	public int queryIfHasTheSameBusinessId(Integer businessId) {
+		return businessDeclareMapper.queryIfHasTheSameBusinessId(businessId);
+	}
+
+	public List<BusinessDeclare> queryBusinessDeclareInformationByPBB(Map<String, Object> map) {
+		return businessDeclareMapper.queryBusinessDeclareInformationByPBB(map);
+	}
+
+	public int findAllInfromationsByPBB() {
+		return businessDeclareMapper.findAllInfromationsByPBB();
+	}
+
+	public Integer getStatusIdByBusinessId(Integer businessId) {
+		return businessDeclareMapper.getStatusIdByBusinessId(businessId);
+	}
 	
 	
 }

+ 1 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/BusinessCheck.java

@@ -8,7 +8,7 @@ public class BusinessCheck {
 	private Long check_time;				//审核时间
 	private String result;					//审核结果,需要关联状态表查询出状态的status_name------>varchar类型
 	
-	private String task;					//llx给添加的任务栏,审核记录表中多加一个任务栏,经办支行写成发起,其它都是审核状态【贼特么鸡肋的一个字段】
+	private String task;					//llx给添加的任务栏,审核记录表中多加一个任务栏,经办支行写成发起,其它都是审核状态
 	
 	
 	public String getTask() {

+ 19 - 15
ccb_fund_trusteeship/src/main/java/com/fuzamei/entity/BusinessDeclare.java

@@ -14,20 +14,8 @@ public class BusinessDeclare {
 	private String basic_data_url;					//基础性资料url
 	private Long declare_time;						//申报时间
 	private String status_name;						//状态名称
+	private Integer status_id;						//状态id号
 	private String hash;							//hash值
-	
-	public String getBasic_data_name() {
-		return basic_data_name;
-	}
-	public void setBasic_data_name(String basic_data_name) {
-		this.basic_data_name = basic_data_name;
-	}
-	public String getBasic_data_url() {
-		return basic_data_url;
-	}
-	public void setBasic_data_url(String basic_data_url) {
-		this.basic_data_url = basic_data_url;
-	}
 	public Integer getBusiness_id() {
 		return business_id;
 	}
@@ -82,6 +70,18 @@ public class BusinessDeclare {
 	public void setProduct_approval_url(String product_approval_url) {
 		this.product_approval_url = product_approval_url;
 	}
+	public String getBasic_data_name() {
+		return basic_data_name;
+	}
+	public void setBasic_data_name(String basic_data_name) {
+		this.basic_data_name = basic_data_name;
+	}
+	public String getBasic_data_url() {
+		return basic_data_url;
+	}
+	public void setBasic_data_url(String basic_data_url) {
+		this.basic_data_url = basic_data_url;
+	}
 	public Long getDeclare_time() {
 		return declare_time;
 	}
@@ -94,6 +94,12 @@ public class BusinessDeclare {
 	public void setStatus_name(String status_name) {
 		this.status_name = status_name;
 	}
+	public Integer getStatus_id() {
+		return status_id;
+	}
+	public void setStatus_id(Integer status_id) {
+		this.status_id = status_id;
+	}
 	public String getHash() {
 		return hash;
 	}
@@ -101,6 +107,4 @@ public class BusinessDeclare {
 		this.hash = hash;
 	}
 	
-	
-	
 }

+ 7 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/AttachmentMapper.xml

@@ -6,4 +6,11 @@
 		select count(*) from attachment where attachment_id=#{attachmentId}
 	</select>
 	
+	<select id="queryIfHasTheSameAttachmentIdS" resultType="int">
+		select count(*) from attachment where attachment_id in
+		<foreach collection="set" item="item" open="(" close=")" separator=",">
+			#{item}
+		</foreach>
+	</select>
+	
 </mapper>

+ 127 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/BusinessDeclareMapper.xml

@@ -61,7 +61,7 @@
 	</insert>
 	
 	<!-- 返回总页数 -->
-	<select id="findAddInfromations" resultType="int">
+	<select id="findAllInfromations" resultType="int">
 		select count(*) from business_declare
 	</select>
 	
@@ -176,6 +176,124 @@
 			#{startPage},#{rowNum}
 	</select>
 	
+	<!-- 返回省分行查询时的总条数 -->
+	<select id="findAllInfromationsByPBB" resultType="int">
+		select count(*) from business_declare where status_id not in (1,2)
+	</select>
+	
+	<!-- 当省分行来查看业务申报表的时候给展现的数据,要除去状态1和状态2【分别对应待二级分行审核和二级分行审核不通过】 -->
+	<select id="queryBusinessDeclareInformationByPBB" resultType="com.fuzamei.entity.BusinessDeclare">
+		select 
+			bd.business_id,
+			bd.bank_id,
+			bd.business_name,
+			bd.business_approval_name,
+			bd.business_approval_url,
+			bd.responsible_investigation_name,
+			bd.responsible_investigation_url,
+			bd.product_approval_name,
+			bd.product_approval_url,
+			bd.basic_data_name,
+			bd.basic_data_url,
+			bd.declare_time,
+			bd.status_id,
+			s.status_name as status_name,
+			bd.hash
+		from 
+			(select
+				bd.business_id,
+				bd.bank_id,
+				bd.business_name,
+				bd.business_approval_name,
+				bd.business_approval_url,
+				bd.responsible_investigation_name,
+				bd.responsible_investigation_url,
+				bd.product_approval_name,
+				bd.product_approval_url,
+				att.attachment_name as basic_data_name,
+				att.url as basic_data_url,
+				bd.declare_time,
+				bd.status_id,
+				bd.hash
+			from 
+				(select
+				bd.business_id,
+				bd.bank_id,
+				bd.business_name,
+				bd.business_approval_name,
+				bd.business_approval_url,
+				bd.responsible_investigation_name,
+				bd.responsible_investigation_url,
+				att.attachment_name as product_approval_name,
+				att.url as product_approval_url,
+				bd.basic_data_id,
+				bd.declare_time,
+				bd.status_id,
+				bd.hash
+			from 	
+				(select 
+					bd.business_id,
+					bd.bank_id,
+					bd.business_name,
+					bd.business_approval_name,
+					bd.business_approval_url,
+					att.attachment_name as responsible_investigation_name,
+					att.url as responsible_investigation_url,
+					bd.product_approval_id,
+					bd.basic_data_id,
+					bd.declare_time,
+					bd.status_id,
+					bd.hash
+				from 
+					(select 
+						bd.business_id,
+						bd.bank_id,
+						bd.business_name,
+						att.attachment_name as business_approval_name,
+						att.url as business_approval_url,
+						bd.responsible_investigation_id,
+						bd.product_approval_id,
+						bd.basic_data_id,
+						bd.declare_time,
+						bd.status_id,
+						bd.hash
+					from 
+						business_declare bd 
+					left join 
+						attachment att 
+					on 
+						bd.business_approval_id=att.attachment_id) bd
+				left join 
+					attachment att 
+				on 
+					bd.responsible_investigation_id=att.attachment_id) bd
+			left join 
+				attachment att
+			on 
+				bd.product_approval_id=att.attachment_id) bd
+			left join 
+				attachment att
+			on 
+				bd.basic_data_id=att.attachment_id) bd
+		left join 
+			status s
+		on 
+			bd.status_id=s.status_id
+		<where>
+			bd.status_id not in (1,2)
+			<if test="businessName!='' and businessName!=null">
+				and bd.business_name=#{businessName} 
+			</if>
+			<if test="startTime!=null and endTime!=null">
+				and bd.declare_time between #{startTime} and #{endTime}
+			</if>
+		</where>
+		order by 
+			bd.declare_time desc 
+		limit 
+			#{startPage},#{rowNum}
+	</select>
+	
 	<!-- 查看审核记录的sql语句 -->
 	<select id="queryBusinessCheckInformation" resultType="com.fuzamei.entity.BusinessCheck">
 		select
@@ -298,5 +416,13 @@
 			   #{createTime})
 	</insert>
 	
+	<!-- 对业务id进行查重 -->
+	<select id="queryIfHasTheSameBusinessId" resultType="int">
+		select count(*) from business_declare where business_id=#{businessId}
+	</select>
 	
+	<!-- 根据业务id查询状态id值 -->
+	<select id="getStatusIdByBusinessId" resultType="int">
+		select status_id from business_declare where business_id=#{businessId}
+	</select>
 </mapper>

+ 3 - 7
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/ValuationAccountingMapper.xml

@@ -99,11 +99,7 @@
 			update_time=#{updateTime},
 			battle_result=#{battleResult}
 		where 
-				fund_id=#{fundId} 
-			and
-				fund_name=#{fundName}
-			and
-				assets_under_custody=#{assets}
+				fund_id=#{fundId}
 	</update>
 	
 	<!-- 省分行上传估值核算文件,在操作记录中要插入这个数据 -->
@@ -231,7 +227,7 @@
 			upload_person_id=#{userId},
 			create_time=#{addTime}
 		where 
-			attachment_id==#{attachmentId}
+			attachment_id=#{attachmentId}
 	</update>
 	
 	<!-- 银行修改附件信息 -->
@@ -244,7 +240,7 @@
 			upload_person_id=#{userId},
 			create_time=#{addTime}
 		where 
-			attachment_id==#{attachmentId}
+			attachment_id=#{attachmentId}
 	</update>
 	
 </mapper>

+ 5 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/AttachmentMapper.java

@@ -1,8 +1,13 @@
 package com.fuzamei.mapperInterface;
 
+import java.util.Set;
+
+import org.apache.ibatis.annotations.Param;
 
 public interface AttachmentMapper {
 
 	int queryIfHasTheSameAttachmentId(Integer attachmentId);
+
+	int queryIfHasTheSameAttachmentIdS(@Param("set")Set<Integer> set);
 	
 }

+ 9 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/BusinessDeclareMapper.java

@@ -12,7 +12,7 @@ public interface BusinessDeclareMapper {
 
 	void insertAttachmentInformationToDaoByBranchBank(Map<String, Object> map);
 
-	int findAddInfromations();
+	int findAllInfromations();
 
 	List<BusinessDeclare> queryBusinessDeclareInformation(Map<String, Object> map);
 
@@ -30,4 +30,12 @@ public interface BusinessDeclareMapper {
 
 	void insertOperationHistoryInformationToDaoByBranchBank(Map<String, Object> map);
 
+	int queryIfHasTheSameBusinessId(Integer businessId);
+
+	List<BusinessDeclare> queryBusinessDeclareInformationByPBB(Map<String, Object> map);
+
+	int findAllInfromationsByPBB();
+
+	Integer getStatusIdByBusinessId(Integer businessId);
+
 }

+ 38 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/AttachmentService.java

@@ -1,7 +1,12 @@
 package com.fuzamei.service;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,4 +29,37 @@ public class AttachmentService {
 		}
 		return attachmentId;
 	}
+	
+	/**
+	 * 
+	* @Title: generateMultiAttachmentIds
+	* @Description: TODO(一次性生成多个附件id值)
+	* @param @param n
+	* @param @return    设定文件
+	* @return List<Integer>    返回类型
+	* @author ylx
+	* @date 2018年1月2日 下午8:23:50
+	* @throws
+	 */
+	public List<Integer> generateMultiAttachmentIds(int n){
+		while(true){
+			Set<Integer> set=new HashSet<Integer>();
+			for (int i = 0; i < n; i++) {
+				Integer attachmentId=(int)(Math.random()*1000000000);								//=========================>>>产生附件id号的机制要改的TODO
+				set.add(attachmentId);
+			}
+			if(set.size()!=n){
+				continue;
+			}
+			int same = attachmentDao.queryIfHasTheSameAttachmentIdS(set);
+			if(same==0){
+				List<Integer> list = new ArrayList<Integer>();
+				for (Integer integer : set) {
+					list.add(integer);
+				}
+				return list;
+			}
+		}
+		
+	}
 }

+ 169 - 472
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/BusinessDeclareService.java

@@ -14,9 +14,13 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.fuzamei.constant.OperationTypeId;
+import com.fuzamei.constant.Role;
+import com.fuzamei.constant.StatusId;
 import com.fuzamei.dao.BusinessDeclareDao;
 import com.fuzamei.entity.BusinessCheck;
 import com.fuzamei.entity.BusinessDeclare;
+import com.fuzamei.entity.UserDetail;
 import com.fuzamei.utils.PageDTO;
 
 @Service
@@ -39,225 +43,74 @@ public class BusinessDeclareService {
 	 */
 	@Transactional(rollbackFor=Exception.class)
 	public void insertInformationIntoTableByBranchBank(Map<String, Object> map) {
-		Integer businessId=null;						//业务申报的id号
-		String bank="";									//银行名称,但是表的字段是银行id?????。。。。。。。TODO
-		String businessName="";							//业务名称
-		Integer busineeApprovalId=null;					//业务核准表的id号
-		String busineeApprovalName="";					//业务员核准表的文件名
-		String urlOfBusineeApproval="";					//业务核准表的url地址
-		Integer responsibleInvestigationId=null;		//尽职调查表id号
-		String responsibleInvestigationName="";			//尽职调查表的文件名
-		String urlOfResponsibleInvestigation="";		//尽职调查表的url地址
-		Integer productApprovalId=null;					//产品核准表的id号
-		String productApprovalName="";					//产品核准表的文件名
-		String urlOfProductApproval="";					//产品核准表的url地址
-		Integer basicDataId=null;						//基础性资料的id号
-		String basicDataName="";						//基础性资料的文件名
-		String urlOfBasicData="";						//基础性资料的url地址
-		if (map.get("businessId") != null) { // 等于空就直接取空值
-			try {
-				businessId = (Integer) map.get("businessId");
-			} catch (Exception e) {
-				throw new RuntimeException("businessId类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务申报的id号为空");
-		}
-		if (!"".equals(map.get("bank")) && map.get("bank") != null) { // 等于空就直接取空值
-			try {
-				bank = (String) map.get("bank");
-			} catch (Exception e) {
-				throw new RuntimeException("bank类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("银行名称为空");
-		}
-		if (!"".equals(map.get("businessName")) && map.get("businessName") != null) { // 等于空就直接取空值
-			try {
-				businessName = (String) map.get("businessName");
-			} catch (Exception e) {
-				throw new RuntimeException("businessName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务名称为空");
-		}
-		if (map.get("busineeApprovalId") != null) { // 等于空就直接取空值
-			try {
-				busineeApprovalId = (Integer) map.get("busineeApprovalId");
-			} catch (Exception e) {
-				throw new RuntimeException("busineeApprovalId类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务核准表的id号为空");
-		}
-		if (!"".equals(map.get("busineeApprovalName")) && map.get("busineeApprovalName") != null) { // 等于空就直接取空值
-			try {
-				busineeApprovalName = (String) map.get("busineeApprovalName");
-			} catch (Exception e) {
-				throw new RuntimeException("busineeApprovalName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务员核准表的文件名为空");
-		}
-		if (!"".equals(map.get("urlOfBusineeApproval")) && map.get("urlOfBusineeApproval") != null) { // 等于空就直接取空值
-			try {
-				urlOfBusineeApproval = (String) map.get("urlOfBusineeApproval");
-			} catch (Exception e) {
-				throw new RuntimeException("urlOfBusineeApproval类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务核准表的url地址");
-		}
-		if (map.get("responsibleInvestigationId") != null) { // 等于空就直接取空值
-			try {
-				responsibleInvestigationId = (Integer) map.get("responsibleInvestigationId");
-			} catch (Exception e) {
-				throw new RuntimeException("responsibleInvestigationId类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("尽职调查表id号为空");
-		}
-		if (!"".equals(map.get("responsibleInvestigationName")) && map.get("responsibleInvestigationName") != null) { // 等于空就直接取空值
-			try {
-				responsibleInvestigationName = (String) map.get("responsibleInvestigationName");
-			} catch (Exception e) {
-				throw new RuntimeException("responsibleInvestigationName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("尽职调查表的文件名为空");
-		}
-		if (!"".equals(map.get("urlOfResponsibleInvestigation")) && map.get("urlOfResponsibleInvestigation") != null) { // 等于空就直接取空值
-			try {
-				urlOfResponsibleInvestigation = (String) map.get("urlOfResponsibleInvestigation");
-			} catch (Exception e) {
-				throw new RuntimeException("urlOfResponsibleInvestigation类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("尽职调查表的url为空");
-		}
-		if (map.get("productApprovalId") != null) { // 等于空就直接取空值
-			try {
-				productApprovalId = (Integer) map.get("productApprovalId");
-			} catch (Exception e) {
-				throw new RuntimeException("productApprovalId类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("产品核准表的id号为空");
-		}
-		if (!"".equals(map.get("productApprovalName")) && map.get("productApprovalName") != null) { // 等于空就直接取空值
-			try {
-				productApprovalName = (String) map.get("productApprovalName");
-			} catch (Exception e) {
-				throw new RuntimeException("productApprovalName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("产品核准表的文件名为空");
-		}
-		if (!"".equals(map.get("urlOfProductApproval")) && map.get("urlOfProductApproval") != null) { // 等于空就直接取空值
-			try {
-				urlOfProductApproval = (String) map.get("urlOfProductApproval");
-			} catch (Exception e) {
-				throw new RuntimeException("urlOfProductApproval类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("产品核准表的url为空");
-		}
-		if (map.get("basicDataId") != null) { // 等于空就直接取空值
-			try {
-				basicDataId = (Integer) map.get("basicDataId");
-			} catch (Exception e) {
-				throw new RuntimeException("basicDataId类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("基础性资料的id号为空");
-		}
-		if (!"".equals(map.get("basicDataName")) && map.get("basicDataName") != null) { // 等于空就直接取空值
-			try {
-				basicDataName = (String) map.get("basicDataName");
-			} catch (Exception e) {
-				throw new RuntimeException("basicDataName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("基础性资料的文件名为空");
-		}
-		if (!"".equals(map.get("urlOfBasicData")) && map.get("urlOfBasicData") != null) { // 等于空就直接取空值
-			try {
-				urlOfBasicData = (String) map.get("urlOfBasicData");
-			} catch (Exception e) {
-				throw new RuntimeException("urlOfBasicData类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("基础性资料的url为空");
-		}
-		
+		long currentTime = System.currentTimeMillis();//获取当前系统时间
+		UserDetail userDetail = (UserDetail) map.get("userDetail");//获取用户信息对象
+	//---------------------------------------------------------------------------------------------------------------
 		Map<String, Object> mapToDaoForBusinessDeclare = new LinkedHashMap<String,Object>();		//这个map是将数据插入业务申报表中的
-		mapToDaoForBusinessDeclare.put("businessId", businessId);									//业务申报id
-		mapToDaoForBusinessDeclare.put("bank", bank);												//申报支行名称
-		mapToDaoForBusinessDeclare.put("businessName", businessName);								//业务名称
-		mapToDaoForBusinessDeclare.put("busineeApprovalId", busineeApprovalId);						//业务核准表id号
-		mapToDaoForBusinessDeclare.put("responsibleInvestigationId", responsibleInvestigationId);	//尽职调查报告id号
-		mapToDaoForBusinessDeclare.put("productApprovalId", productApprovalId);						//产品核准表id号
-		mapToDaoForBusinessDeclare.put("basicDataId", basicDataId);									//基础性资料id号
-		mapToDaoForBusinessDeclare.put("declareTime", System.currentTimeMillis());					//申报时间以系统当前时间为准
-		mapToDaoForBusinessDeclare.put("statusId",1);												//刚刚申请的时候状态应该是【待二级分行审核】,这里以1表示,到时候可能还会进行修。。TODO
-		mapToDaoForBusinessDeclare.put("hash", "to be calaulated from file on server");				//hash值先写死,到时候要从文件中获取并计算出来
+		mapToDaoForBusinessDeclare.put("businessId", map.get("businessId"));						//业务申报id
+		mapToDaoForBusinessDeclare.put("bank", map.get("bank"));									//申报支行名称
+		mapToDaoForBusinessDeclare.put("businessName", map.get("businessName"));					//业务名称
+		mapToDaoForBusinessDeclare.put("busineeApprovalId", map.get("busineeApprovalId"));			//业务核准表id号
+		mapToDaoForBusinessDeclare.put("responsibleInvestigationId", map.get("responsibleInvestigationId"));//尽职调查报告id号
+		mapToDaoForBusinessDeclare.put("productApprovalId", map.get("productApprovalId"));			//产品核准表id号
+		mapToDaoForBusinessDeclare.put("basicDataId", map.get("basicDataId"));						//基础性资料id号
+		mapToDaoForBusinessDeclare.put("declareTime", currentTime);									//申报时间以系统当前时间为准
+		mapToDaoForBusinessDeclare.put("statusId",StatusId.TO_BE_CHECKED_BY_SECONDARY_BRANCH_BANK);	//刚刚申请的时候状态应该是【待二级分行审核】,这里以1表示,到时候可能还会进行修。。TODO
+		mapToDaoForBusinessDeclare.put("hash", "to be calaulated");									//hash值先写死=====================================================>>待定TODO
 		businessDeclareDao.insertBusinessDeclareInformationToDaoByBranchBank(mapToDaoForBusinessDeclare);	//将业务申请的数据插入数据库
-		
-		Map<String, Object> mapToDaoForAttachmentOfBusineeApproval = new LinkedHashMap<String,Object>();		//这个map是将数据插入业务核准表中
-		mapToDaoForAttachmentOfBusineeApproval.put("attachmentId", responsibleInvestigationId);				//业务核准表id号就是附件的id号
-		mapToDaoForAttachmentOfBusineeApproval.put("attachmentName", responsibleInvestigationName);			//业务核准表文件名就当是附件名
-		mapToDaoForAttachmentOfBusineeApproval.put("url", urlOfResponsibleInvestigation);					//业务核准表的url地址就是附件url地址
-		mapToDaoForAttachmentOfBusineeApproval.put("userId", 300000001);							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
-		mapToDaoForAttachmentOfBusineeApproval.put("createTime", mapToDaoForBusinessDeclare.get("declareTime"));	//创建时间以插入业务申请表的时间为准
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+		Map<String, Object> mapToDaoForAttachmentOfBusineeApproval = new LinkedHashMap<String,Object>();		//这个map是将数据插入【业务核准表】中
+		mapToDaoForAttachmentOfBusineeApproval.put("attachmentId", map.get("busineeApprovalId"));				//业务核准表id号就是附件的id号
+		mapToDaoForAttachmentOfBusineeApproval.put("attachmentName", map.get("busineeApprovalName"));			//业务核准表文件名就当是附件名
+		mapToDaoForAttachmentOfBusineeApproval.put("url", map.get("urlOfBusineeApproval"));					//业务核准表的url地址就是附件url地址
+		mapToDaoForAttachmentOfBusineeApproval.put("userId", userDetail.getUser_id());							//上传人的id号写活♥
+		mapToDaoForAttachmentOfBusineeApproval.put("createTime", currentTime);	//创建时间以插入业务申请表的时间为准
 		businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfBusineeApproval);	//将附件---【业务核准表】---申请的数据插入数据库
-		
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 		Map<String, Object> mapToDaoForAttachmentOfResponsibleInvestigation = new LinkedHashMap<String,Object>();		//这个map是将数据插入尽职调查表中的
-		mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentId", busineeApprovalId);				//尽职调查表id号就是附件的id号
-		mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentName", busineeApprovalName);			//尽职调查表文件名就当是附件名
-		mapToDaoForAttachmentOfResponsibleInvestigation.put("url", urlOfBusineeApproval);					//尽职调查表的url地址就是附件url地址
-		mapToDaoForAttachmentOfResponsibleInvestigation.put("userId", 300000001);							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
-		mapToDaoForAttachmentOfResponsibleInvestigation.put("createTime", mapToDaoForBusinessDeclare.get("declareTime"));	//创建时间以插入尽职调查表的时间为准
+		mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentId", map.get("responsibleInvestigationId"));		//尽职调查表id号就是附件的id号
+		mapToDaoForAttachmentOfResponsibleInvestigation.put("attachmentName", map.get("responsibleInvestigationName"));			//尽职调查表文件名就当是附件名
+		mapToDaoForAttachmentOfResponsibleInvestigation.put("url", map.get("urlOfResponsibleInvestigation"));					//尽职调查表的url地址就是附件url地址
+		mapToDaoForAttachmentOfResponsibleInvestigation.put("userId", userDetail.getUser_id());							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
+		mapToDaoForAttachmentOfResponsibleInvestigation.put("createTime", currentTime);	//创建时间以插入尽职调查表的时间为准
 		businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfResponsibleInvestigation);	//将附件---【尽职调查表】---申请的数据插入数据库
-		
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 		Map<String, Object> mapToDaoForAttachmentOfProductApproval = new LinkedHashMap<String,Object>();		//这个map是将数据插入产品核准表中的
-		mapToDaoForAttachmentOfProductApproval.put("attachmentId", productApprovalId);				//产品核准表id号就是附件的id号
-		mapToDaoForAttachmentOfProductApproval.put("attachmentName", productApprovalName);			//产品核准表文件名就当是附件名
-		mapToDaoForAttachmentOfProductApproval.put("url", urlOfProductApproval);					//产品核准表的url地址就是附件url地址
-		mapToDaoForAttachmentOfProductApproval.put("userId", 300000001);							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
-		mapToDaoForAttachmentOfProductApproval.put("createTime", mapToDaoForBusinessDeclare.get("declareTime"));	//创建时间以插入产品核准表的时间为准
+		mapToDaoForAttachmentOfProductApproval.put("attachmentId", map.get("productApprovalId"));				//产品核准表id号就是附件的id号
+		mapToDaoForAttachmentOfProductApproval.put("attachmentName", map.get("productApprovalName"));			//产品核准表文件名就当是附件名
+		mapToDaoForAttachmentOfProductApproval.put("url", map.get("urlOfProductApproval"));					//产品核准表的url地址就是附件url地址
+		mapToDaoForAttachmentOfProductApproval.put("userId", userDetail.getUser_id());							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
+		mapToDaoForAttachmentOfProductApproval.put("createTime", currentTime);	//创建时间以插入产品核准表的时间为准
 		businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfProductApproval);	//将附件---【产品核准表】---申请的数据插入数据库
-		
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 		Map<String, Object> mapToDaoForAttachmentOfBasicData = new LinkedHashMap<String,Object>();		//这个map是将数据插入基础性资料中的
-		mapToDaoForAttachmentOfBasicData.put("attachmentId", basicDataId);				//基础性资料id号就是附件的id号
-		mapToDaoForAttachmentOfBasicData.put("attachmentName", basicDataName);			//基础性资料文件名就当是附件名
-		mapToDaoForAttachmentOfBasicData.put("url", urlOfBasicData);					//基础性资料的url地址就是附件url地址
-		mapToDaoForAttachmentOfBasicData.put("userId", 300000001);							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
-		mapToDaoForAttachmentOfBasicData.put("createTime", mapToDaoForBusinessDeclare.get("declareTime"));	//创建时间以插入基础性资料的时间为准
+		mapToDaoForAttachmentOfBasicData.put("attachmentId", map.get("basicDataId"));				//基础性资料id号就是附件的id号
+		mapToDaoForAttachmentOfBasicData.put("attachmentName", map.get("basicDataName"));			//基础性资料文件名就当是附件名
+		mapToDaoForAttachmentOfBasicData.put("url", map.get("urlOfBasicData"));					//基础性资料的url地址就是附件url地址
+		mapToDaoForAttachmentOfBasicData.put("userId", userDetail.getUser_id());							//上传人的id号先写死,到时候还需要根据请求查询上传人的id号。。。。。。TODO
+		mapToDaoForAttachmentOfBasicData.put("createTime", currentTime);	//创建时间以插入基础性资料的时间为准
 		businessDeclareDao.insertAttachmentInformationToDaoByBranchBank(mapToDaoForAttachmentOfBasicData);	//将附件---【基础性资料】---申请的数据插入数据库
-		
-		
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 		Map<String, Object> mapToDaoForBusinessCheck = new LinkedHashMap<String,Object>();		//这个map是将数据插入【审核记录】中的二级分行刚刚上传也要在审核记录中插入一条数据
-		mapToDaoForBusinessCheck.put("organizationName", "经办支行");								//经办支行提交写死审核部门为--经办支行--
-		mapToDaoForBusinessCheck.put("checkPerson", "张三");										//经办支行的某个人,先写死
-		mapToDaoForBusinessCheck.put("checkResult", 5);											//经办支行提交肯定通过
+		mapToDaoForBusinessCheck.put("organizationName", userDetail.getOrganization_name());	//经办支行提交写死审核部门为--经办支行--
+		mapToDaoForBusinessCheck.put("checkPerson", userDetail.getPerson_name());				//经办支行的某个人,先写死
+		mapToDaoForBusinessCheck.put("checkResult", StatusId.AGREE);							//经办支行提交肯定通过
 		mapToDaoForBusinessCheck.put("checkOpinion", "--");										//审核意见空着
-		mapToDaoForBusinessCheck.put("businessId", businessId);									//业务id从前面获取
-		mapToDaoForBusinessCheck.put("checkTime", mapToDaoForBusinessDeclare.get("declareTime"));//获取的是当前时间
-		mapToDaoForBusinessCheck.put("task", 10);												//需要通过status表获取状态信息,10表示发起,经办支行刚开始一定是发起状态
+		mapToDaoForBusinessCheck.put("businessId", map.get("businessId"));						//业务id从前面获取
+		mapToDaoForBusinessCheck.put("checkTime", currentTime);//获取的是当前时间
+		mapToDaoForBusinessCheck.put("task", StatusId.LAUNCHING);								//需要通过status表获取状态信息,10表示发起,经办支行刚开始一定是发起状态
 		//将封装到map的审核意见数据传入dao层中将结果导入【业务审核总表】中-------->insert操作
 		businessDeclareDao.businessDeclareCheckedBy(mapToDaoForBusinessCheck);
-		
-		
+	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 		//此外,还要将业务申报的这个操作信息插入到操作记录表中【】
 		Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
-		mapToOperationHistory.put("operatorTypeId", 1001);								//刚刚创立业务申报,操作类型为业务申报
-		mapToOperationHistory.put("operatorAccount", 300000001);						//操作账号先定死
-		mapToOperationHistory.put("operatorRole", "经办支行");							//创建这个操作的角色只能是经办支行
-		mapToOperationHistory.put("operatorPerson", "张三");								//操作人先写死
-		mapToOperationHistory.put("operatorTime", mapToDaoForBusinessDeclare.get("declareTime"));//操作时间为当前操作时间
-		mapToOperationHistory.put("hash", "to be calculated from operation");			//如何计算操作的hash值????
+		mapToOperationHistory.put("operatorTypeId", OperationTypeId.BUSINESS_APPLY);	//刚刚创立业务申报,操作类型为业务申报1001
+		mapToOperationHistory.put("operatorAccount", userDetail.getAccount());			//操作账号写活♥
+		mapToOperationHistory.put("operatorRole", Role.TRAN_BRANCH_BANK);				//创建这个操作的角色只能是经办支行
+		mapToOperationHistory.put("operatorPerson", userDetail.getPerson_name());		//操作人写活♥
+		mapToOperationHistory.put("operatorTime", currentTime);							//操作时间为当前操作时间
+		mapToOperationHistory.put("hash", "to be calculated");							//如何计算操作的hash值===========================================>>。。。。。。TODO
 		businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
-		
 	}
 
 	
@@ -273,54 +126,27 @@ public class BusinessDeclareService {
 	* @throws
 	 */
 	public PageDTO queryBusinessDeclareInformation(Map<String, Object> map) {
-		int page = 1; 					// 默认页是第一页
-		String businessName = ""; 		// 业务名称默认空值
-		long startTime = 0; 			//开始时间默认0
-		long endTime=Long.MAX_VALUE;	//结束时间默认Long最大值
-		if (!"".equals(map.get("page")) && map.get("page") != null) { // 等于空就直接取第一页
-			try {
-				page = Integer.parseInt((String) map.get("page"));
-				if (page < 1) {
-					page = 1;
-				}
-			} catch (NumberFormatException e) {
-				page = 1; // 数据解析异常page还是1
-			}
-		}
-		if (!"".equals(map.get("businessName")) && map.get("businessName") != null) { // 等于空就直接取空值
-			businessName = (String) map.get("businessName");
-		}
-		if (!"".equals(map.get("startTime")) && map.get("startTime") != null) { // 等于空就直接取空值
-			try {
-				startTime = Long.parseLong((String) map.get("startTime"));
-			} catch (NumberFormatException e) {
-				startTime = 0; // 数据解析异常startTime还是0
-			}
-		}
-		if (!"".equals(map.get("endTime")) && map.get("endTime") != null) { // 等于空就直接取空值
-			try {
-				endTime = Long.parseLong((String) map.get("endTime"));
-			} catch (NumberFormatException e) {
-				endTime = Long.MAX_VALUE; // 数据解析异常endTime还是9223372036854775807L
-			}
-		}
 		PageDTO pageDTO = new PageDTO();
-		Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
-		mapToDao.put("startPage", (page - 1) * ROW_NUM);
-		mapToDao.put("businessName", businessName);
-		if (startTime <= endTime) {
-			mapToDao.put("startTime", startTime);
-			mapToDao.put("endTime", endTime);
-		} else {
-			mapToDao.put("startTime", startTime);
-			mapToDao.put("endTime", Long.MAX_VALUE);
-		}
-		mapToDao.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
-		List<BusinessDeclare> informationList=businessDeclareDao.queryBusinessDeclareInformation(mapToDao);
-		int count=businessDeclareDao.findAddInfromations();
-		pageDTO.setRows(informationList);
-		pageDTO.setTotal(count);
-		return pageDTO;
+		UserDetail userDetail = (UserDetail) map.get("userDetail");
+		List<String> roleList = userDetail.getRole_name();
+		//经办支行和二级支行可以查看所有的信息
+		if(roleList.contains(Role.TRAN_BRANCH_BANK)||roleList.contains(Role.SEC_BRANCH_BANK)){
+			List<BusinessDeclare> informationList=businessDeclareDao.queryBusinessDeclareInformation(map);
+			int count=businessDeclareDao.findAllInfromations();
+			pageDTO.setRows(informationList);
+			pageDTO.setTotal(count);
+			return pageDTO;
+		}
+		if(roleList.contains(Role.BUSINESS_DEP_OF_PBB)){
+			//省分行营业部能看到的信息只有二级分行审核通过以后的信息才会显示,未通过或者是发起状态的都不会显示
+			//而且分页的话查询所有信息的条数也是按照之前的条件进行查询的
+			List<BusinessDeclare> informationList=businessDeclareDao.queryBusinessDeclareInformationByPBB(map);
+			int count=businessDeclareDao.findAllInfromationsByPBB();
+			pageDTO.setRows(informationList);
+			pageDTO.setTotal(count);
+			return pageDTO;
+		}
+		throw new RuntimeException("无权操作");
 	}
 
 
@@ -336,20 +162,22 @@ public class BusinessDeclareService {
 	* @throws
 	 */
 	public List<BusinessCheck> queryBusinessCheckInformation(Map<String, Object> map) {
-		Integer check_business_id=null;		//被审核的业务id号需要先被进行校验
-		if (map.get("businessId") != null) { // 等于空就直接取第一页
-			try {
-				check_business_id = (Integer) map.get("businessId");
-			} catch (Exception e) {
-				check_business_id=null;		//如果解析出错或者类型转换异常,还是以null去数据库查询
-			}
-		}
-		
-		Map<String, Object> mapToDao =new LinkedHashMap<String, Object>();
-		mapToDao.put("businessId", check_business_id);
-		List<BusinessCheck> businessCheckList = businessDeclareDao.queryBusinessCheckInformation(mapToDao);
-		
-		return businessCheckList;
+		UserDetail userDetail = (UserDetail) map.get("userDetail");
+		List<String> roleList = userDetail.getRole_name();
+		Integer businessId = (Integer) map.get("businessId");
+		Integer statusId = businessDeclareDao.getStatusIdByBusinessId(businessId);
+		//经办支行和二级支行可以查看所有的信息
+		if(roleList.contains(Role.TRAN_BRANCH_BANK)||roleList.contains(Role.SEC_BRANCH_BANK)){
+			return businessDeclareDao.queryBusinessCheckInformation(map);
+		}
+		if(roleList.contains(Role.TRAN_BRANCH_BANK)||roleList.contains(Role.SEC_BRANCH_BANK)){
+			//如果是待二级分行审核或者是二级分行审核不通过则返回一个空值
+			if(statusId==1||statusId==2){
+				return null;
+			}
+			return businessDeclareDao.queryBusinessCheckInformation(map);
+		}
+		throw new RuntimeException("无权操作");
 	}
 
 	/**
@@ -370,88 +198,41 @@ public class BusinessDeclareService {
 	 */
 	@Transactional(rollbackFor=Exception.class)
 	public void businessDeclareCheckedBy(Map<String, Object> map) {
-		String organizationName="";		//审核部门
-		String checkPerson="";			//审核人
-		Integer checkResult=null;			//审核结果
-		String checkOpinion="";			//审核意见
-		Integer businessId=null;			//业务申报的id号,要根据这个更新业务审核的状态的
-		Integer statusId=null;			//业务申报表中状态id号,这个要根据checkResult审核结果来决定
-		
-		Integer operatorTypeId=null;		//操作类型id号------>放到操作记录表中去的
-		
-		if (!"".equals(map.get("organizationName")) && map.get("organizationName") != null) { // 等于空就直接取空值
-			try {
-				organizationName = (String) map.get("organizationName");
-			} catch (Exception e) {
-				throw new RuntimeException("organizationName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("审核部门不能为空");
-		}
-		if (!"".equals(map.get("checkPerson")) && map.get("checkPerson") != null) { // 等于空就直接取空值
-			try {
-				checkPerson = (String) map.get("checkPerson");
-			} catch (Exception e) {
-				throw new RuntimeException("checkPerson类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("审人不能为空");
-		}
-		if (!"".equals(map.get("checkResult")) && map.get("checkResult") != null) { // 等于空就直接取空值
-			String result=null;
-			try {
-				result = (String) map.get("checkResult");                       	//定义一个局部变量result(保存审核结果,以String类型接收),来看是否会出现类型转换异常
-			} catch (Exception e) {
-				throw new RuntimeException("checkResult类型转换异常");
-			}			
-			if("agree".equals(result)){
-				checkResult=5;														//5表示审核结果为同意(根据status表决定数字)
-				if("二级分行".equals(organizationName)){
-					statusId=3;														//3表示二级分行审核通过 转为【待省分行业务部门审核】(根据status表决定数字)
-					operatorTypeId=1002;											//1002在操作类型中表示【业务初审通过】
-				}else if("省分行业务部门".equals(organizationName)){
-					statusId=5;														//5表示省分行审核通过 转为【通过】(根据status表决定数字)
-					operatorTypeId=1013;											//1013在操作类型中表示【业务复审通过】
-				}else{
-					throw new RuntimeException("审核部门参数非法");
-				}
-			}else if("disagree".equals(result)){
-				checkResult=6;														//6表示审核结果为不同意(根据status表决定数字)
-				if("二级分行".equals(organizationName)){
-					statusId=2;														//2表示二级分行审核不通过(根据status表决定数字)
-					operatorTypeId=1012;											//1012在操作类型中表示【业务初审拒绝】
-				}else if("省分行业务部门".equals(organizationName)){
-					statusId=4;														//4表示省分行审核不通过(根据status表决定数字)
-					operatorTypeId=1003;											//1003在操作类型中表示【业务复审拒绝】
-				}else{
-					throw new RuntimeException("审核部门参数非法");
-				}														
-			}else{																
-				throw new RuntimeException("审核结果参数非法");						//传过来的参数如果不符合要求直接报错给前台
+		long currentTime = System.currentTimeMillis();
+		UserDetail userDetail = (UserDetail) map.get("userDetail");
+		List<String> roleList = userDetail.getRole_name();
+		String organizationName=userDetail.getOrganization_name();							//审核部门
+		String checkPerson=userDetail.getPerson_name();										//审核人
+		Integer checkResult=(Integer) map.get("checkResult");								//审核结果(5表示同意,6表示不同意)
+		String checkOpinion=(String) map.get("checkOpinion");								//审核意见
+		Integer businessId=(Integer) map.get("businessId");									//业务申报的id号,要根据这个更新业务审核的状态的
+		Integer statusId=businessDeclareDao.getStatusIdByBusinessId(businessId);			//根据业务id号获取当前的状态id值
+		Integer operatorTypeId=null;														//操作类型id号------>放到操作记录表中去的
+		if(roleList.contains(Role.SEC_BRANCH_BANK)&&statusId==StatusId.TO_BE_CHECKED_BY_SECONDARY_BRANCH_BANK){
+			//如果是二级分行操作,且当前状态id必须是1
+			if(checkResult==StatusId.AGREE){
+				statusId=StatusId.TO_BE_CHECKED_BY_PROVINCIAL_BRANCH_BANK;
+				operatorTypeId=OperationTypeId.BUSINESS_FIRST_TRIAL_AGREED;
+			}else if(checkResult==StatusId.REJECTED){
+				statusId=StatusId.REJECTED_BY_SECONDARY_BRANCH_BANK;
+				operatorTypeId=OperationTypeId.BUSINESS_FIRST_TRIAL_REJECTED;
+			}else{
+				throw new RuntimeException("审核结果参数非法");
+			}
+		}else if(roleList.contains(Role.BUSINESS_DEP_OF_PBB)&&statusId==StatusId.TO_BE_CHECKED_BY_PROVINCIAL_BRANCH_BANK){
+			//如果是省分行业务部门,且当前状态id必须是3
+			if(checkResult==StatusId.AGREE){
+				statusId=StatusId.AGREE;
+				operatorTypeId=OperationTypeId.BUSINESS_REEXAMINE_AGREED;
+			}else if(checkResult==StatusId.REJECTED){
+				statusId=StatusId.REJECTED_BY_PROVINCIAL_BRANCH_BANK;
+				operatorTypeId=OperationTypeId.BUSINESS_REEXAMINE_REJECTED;
+			}else{
+				throw new RuntimeException("审核结果参数非法");
 			}
 		}else{
-			throw new RuntimeException("审核人不能为空");
+			throw new RuntimeException("无权操作");
 		}
-		
-		if (!"".equals(map.get("checkOpinion")) && map.get("checkOpinion") != null) { // 等于空就直接取空值
-			try {
-				checkOpinion = (String) map.get("checkOpinion");
-			} catch (Exception e) {
-				throw new RuntimeException("checkOpinion类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("审核意见不能为空");
-		}
-		if (!"".equals(map.get("businessId")) && map.get("businessId") != null) { // 等于空就直接取空值
-			try {
-				businessId = Integer.parseInt((String) map.get("businessId"));
-			} catch (Exception e) {
-				throw new RuntimeException("businessId解析异常或类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("businessId不能为空");
-		}
-		
 		//将审核已将数据封装到map中
 		Map<String, Object> mapToDaoOfBusinessCheck=new LinkedHashMap<String, Object>();
 		mapToDaoOfBusinessCheck.put("organizationName", organizationName);
@@ -459,8 +240,8 @@ public class BusinessDeclareService {
 		mapToDaoOfBusinessCheck.put("checkResult", checkResult);
 		mapToDaoOfBusinessCheck.put("checkOpinion", checkOpinion);
 		mapToDaoOfBusinessCheck.put("businessId", businessId);
-		mapToDaoOfBusinessCheck.put("checkTime", System.currentTimeMillis());
-		mapToDaoOfBusinessCheck.put("task", 11);								//这里必定写死,11在状态表中对应的是审核状态
+		mapToDaoOfBusinessCheck.put("checkTime", currentTime);
+		mapToDaoOfBusinessCheck.put("task", StatusId.CHECKING);								//这里必定写死,11在状态表中对应的是审核状态
 		//将封装到map的审核意见数据传入dao层中将结果导入【业务审核总表】中-------->insert操作
 		businessDeclareDao.businessDeclareCheckedBy(mapToDaoOfBusinessCheck);
 		
@@ -471,20 +252,16 @@ public class BusinessDeclareService {
 		//将审核结果更新到【业务申报表】这个businessId的【业务申报结果字段】中去-------->update操作
 		businessDeclareDao.updateBusinessDeclareStatus(mapToDaoOfBusinessDeclare);
 		
-		
 		//此外,还要将审核的这个操作信息插入到操作记录表中【】
 		Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
 		mapToOperationHistory.put("operatorTypeId", operatorTypeId);							//operatorTypeId根据前面的判断决定
 		mapToOperationHistory.put("operatorRole", organizationName);							//创建这个操作的角色根据前面的organizationName决定
-		mapToOperationHistory.put("operatorAccount", 300000001);						//操作账号先定死??????
-		mapToOperationHistory.put("operatorPerson", "张三");								//操作人先写死???????
-		mapToOperationHistory.put("operatorTime", mapToDaoOfBusinessCheck.get("checkTime"));//操作时间为当前操作时间
-		mapToOperationHistory.put("hash", "to be calculated from operation");			//如何计算操作的hash值????
+		mapToOperationHistory.put("operatorAccount", userDetail.getAccount());					//操作账号写活♥
+		mapToOperationHistory.put("operatorPerson", userDetail.getPerson_name());				//操作人先写活♥
+		mapToOperationHistory.put("operatorTime", currentTime);									//操作时间为当前操作时间
+		mapToOperationHistory.put("hash", "to be calculated from operation");					//如何计算操作的hash值????
 		businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
-		
 	}
-
-	
 	
 	/**
 	 * 
@@ -501,148 +278,68 @@ public class BusinessDeclareService {
 	 */
 	@Transactional(rollbackFor=Exception.class)
 	public void uploadContractByProvincialBranchBank(Map<String, Object> map) {
-		Integer businessId=null;					//业务的id号
-		Integer contractId=null;					//合同id号,当作附件的id号
-		String contractName="";						//合同名,暂时理解为文件名,也当作附件名进行存储
-		String contractParty="";					//签约双方的名字
-		String uploadDepartment="";					//这里暂时写死是省分行业务部门
-		String uploadPerson="";						//上传人
-		String url="";								//合同的url地址	
-		String hash="";								//合同的hash值
-		Integer userId=null;						//上传人的id号
-		if (!"".equals(map.get("businessId")) && map.get("businessId") != null) { // 等于空就直接取空值
-			try {
-				businessId = Integer.parseInt((String) map.get("businessId"));
-			} catch (Exception e) {
-				throw new RuntimeException("业务id解析异常或类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("业务id不能为空");
-		}
-		if (!"".equals(map.get("contractId")) && map.get("contractId") != null) { // 等于空就直接取空值
-			try {
-				contractId = Integer.parseInt((String) map.get("contractId"));
-			} catch (Exception e) {
-				throw new RuntimeException("合同id解析异常或类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("合同id不能为空");
-		}
-		if (!"".equals(map.get("contractName")) && map.get("contractName") != null) { // 等于空就直接取空值
-			try {
-				contractName = (String) map.get("contractName");
-			} catch (Exception e) {
-				throw new RuntimeException("contractName类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("合同名不能为空");
-		}
-		if (!"".equals(map.get("contractParty")) && map.get("contractParty") != null) { // 等于空就直接取空值
-			try {
-				contractParty = (String) map.get("contractParty");
-			} catch (Exception e) {
-				throw new RuntimeException("contractParty类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("签约双方的名不能为空");
-		}
-		if (!"".equals(map.get("uploadDepartment")) && map.get("uploadDepartment") != null) { // 等于空就直接取空值
-			try {
-				uploadDepartment = (String) map.get("uploadDepartment");
-			} catch (Exception e) {
-				throw new RuntimeException("uploadDepartment类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("上传部门名不能为空");
-		}
-		if (!"".equals(map.get("uploadPerson")) && map.get("uploadPerson") != null) { // 等于空就直接取空值
-			try {
-				uploadPerson = (String) map.get("uploadPerson");
-			} catch (Exception e) {
-				throw new RuntimeException("uploadPerson类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("上传人不能为空");
-		}
-		if (!"".equals(map.get("url")) && map.get("url") != null) { // 等于空就直接取空值
-			try {
-				url = (String) map.get("url");
-			} catch (Exception e) {
-				throw new RuntimeException("url类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("合同的url地址不能为空");
-		}
-		if (!"".equals(map.get("hash")) && map.get("hash") != null) { // 等于空就直接取空值
-			try {
-				hash = (String) map.get("hash");
-			} catch (Exception e) {
-				throw new RuntimeException("hash类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("合同的hash值不能为空");
-		}
-		if (!"".equals(map.get("userId")) && map.get("userId") != null) { // 等于空就直接取空值
-			try {
-				userId = Integer.parseInt((String) map.get("userId"));
-			} catch (Exception e) {
-				throw new RuntimeException("上传人id解析异常或类型转换异常");
-			}
-		}else{
-			throw new RuntimeException("上传人id不能为空");
-		}
-		
-		
+		long currentTime = System.currentTimeMillis();
+		UserDetail userDetail = (UserDetail) map.get("userDetail");
+		Integer businessId=(Integer) map.get("businessId");
+		Integer contractId=(Integer) map.get("contractId");
+		String contractName=(String) map.get("contractName");
+		String contractParty=(String) map.get("contractParty");
+		String hash=(String) map.get("hash");
+		String url=(String) map.get("url");
 		//将合同信息封装到mapToContractRecord
 		Map<String, Object> mapToContractRecord=new LinkedHashMap<String, Object>();
 		mapToContractRecord.put("businessId", businessId);
 		mapToContractRecord.put("contractId", contractId);
 		mapToContractRecord.put("contractName", contractName);
-		mapToContractRecord.put("version", "v1.0");
+		mapToContractRecord.put("version", "v1.0");						//版本号先写死
 		mapToContractRecord.put("contractParty", contractParty);
-		mapToContractRecord.put("uploadDepartment", uploadDepartment);
-		mapToContractRecord.put("uploadPerson", uploadPerson);
-		mapToContractRecord.put("modifyOpinion", "初始版本合同");
-		mapToContractRecord.put("comfirmDepartment", "管理人");
-		mapToContractRecord.put("commitTime", System.currentTimeMillis());
+		mapToContractRecord.put("uploadDepartment", userDetail.getOrganization_name());
+		mapToContractRecord.put("uploadPerson", userDetail.getPerson_name());
+		mapToContractRecord.put("modifyOpinion", "初始版本合同");			//这个先写死
+		mapToContractRecord.put("comfirmDepartment", "管理人");			//这个先写死
+		mapToContractRecord.put("commitTime", currentTime);
 		mapToContractRecord.put("hash", hash);
-		
+		businessDeclareDao.insertContractInformationToContractRecord(mapToContractRecord);					//将合同信息插入到【合同提交记录表】
 		
 		//将合同信息封装到mapToContractStatusTracking
 		Map<String, Object> mapToContractStatusTracking=new LinkedHashMap<String, Object>();
 		mapToContractStatusTracking.put("businessId", businessId);
 		mapToContractStatusTracking.put("contractName", contractName);
 		mapToContractStatusTracking.put("contractParty", contractParty);
-		mapToContractStatusTracking.put("updateTime", mapToContractRecord.get("commitTime"));
-		mapToContractStatusTracking.put("statusId", 7);												//省分行刚上传合同状态肯定是将状态变成修订中
-		
+		mapToContractStatusTracking.put("updateTime", currentTime);
+		mapToContractStatusTracking.put("statusId", StatusId.MODIFYING);						//省分行刚上传合同状态肯定是将状态变成修订中(7)
+		businessDeclareDao.insertContractInformationToContractStatusTracking(mapToContractStatusTracking);	//将合同信息插入到【合同状态跟踪表】
 		
 		//将合同信息封装到mapToAttachment
 		Map<String, Object> mapToAttachment=new LinkedHashMap<String, Object>();
 		mapToAttachment.put("attachmentId", contractId);
 		mapToAttachment.put("attachmentName", contractName);
 		mapToAttachment.put("url", url);
-		mapToAttachment.put("userId", userId);
-		mapToAttachment.put("createTime", mapToContractRecord.get("commitTime"));
-		
-		businessDeclareDao.insertContractInformationToContractRecord(mapToContractRecord);					//将合同信息插入到【合同提交记录表】
-		businessDeclareDao.insertContractInformationToContractStatusTracking(mapToContractStatusTracking);	//将合同信息插入到【合同状态跟踪表】
+		mapToAttachment.put("userId", userDetail.getUser_id());
+		mapToAttachment.put("createTime", currentTime);
 		businessDeclareDao.insertContractInformationToAttachment(mapToAttachment);							//将信息插入到【附件表】
 		
-		
-		
-		
 		//此外,还要将审核的这个操作信息插入到操作记录表中【】
 		Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
-		mapToOperationHistory.put("operatorTypeId", 1004);							//operatorTypeId=1004表示【合同上传】
-		mapToOperationHistory.put("operatorRole", "省分行业务部门");					//创建这个操作的角色只能是省分行业务部门
-		mapToOperationHistory.put("operatorAccount", 300000001);					//操作账号先定死??????
-		mapToOperationHistory.put("operatorPerson", "张三");							//操作人先写死???????
-		mapToOperationHistory.put("operatorTime", mapToContractRecord.get("commitTime"));//操作时间为当前操作时间
-		mapToOperationHistory.put("hash", "to be calculated from operation");			//如何计算操作的hash值????
-		businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到操作记录表中
-		
-		
+		mapToOperationHistory.put("operatorTypeId", OperationTypeId.CONTRACT_UPLOAD);		//operatorTypeId=1004表示【合同上传】
+		mapToOperationHistory.put("operatorRole", userDetail.getOrganization_name());		//创建这个操作的角色只能是省分行业务部门
+		mapToOperationHistory.put("operatorAccount", userDetail.getAccount());				//操作账号写活♥
+		mapToOperationHistory.put("operatorPerson", userDetail.getPerson_name());			//操作人先写活♥
+		mapToOperationHistory.put("operatorTime", currentTime);								//操作时间为当前操作时间
+		mapToOperationHistory.put("hash", "to be calculated from operation");				//如何计算操作的hash值????============================>>待定TODO
+		businessDeclareDao.insertOperationHistoryInformationToDaoByBranchBank(mapToOperationHistory);//将操作记录信息插入到【操作记录表】中
+	}
+
+	//初始创建一个新生成业务id号(不和已有的id号重复)
+	public Integer generateBusinessId() {
+		int same = -1;
+		Integer businessId = null;
+		//如果有重复的继续查,直到查不出重复的fundId号为止
+		while(same != 0){
+			businessId=(int)(Math.random()*1000000000);								//=========================>>>产生附件id号的机制要改的TODO
+			same = businessDeclareDao.queryIfHasTheSameBusinessId(businessId);
+		}
+		return businessId;
 	}
 
 	

+ 4 - 3
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/ValuationAccountingService.java

@@ -156,7 +156,8 @@ public class ValuationAccountingService {
 		long currentTime=System.currentTimeMillis();
 		UserDetail userDetail = (UserDetail) map.get("userDetail");   //获取用户详细信息
 		Integer attachmentId = (Integer) map.get("attachmentId");
-		String battleResult = (String) map.get("battleResult");		//获取比对结果
+		String battleResult = (String) map.get("battleResult");		//获取比对结果(这个是要进行修改的对账结果值)
+		String judgeResult = ((ValuationAccount)map.get("valuationAccount")).getBattle_result();
 		
 		//更新估值核算表中的信息
 		Map<String, Object> mapToDaoForValuationAccounting = new LinkedHashMap<String,Object>();
@@ -168,7 +169,7 @@ public class ValuationAccountingService {
 		
 		
 		//待对账银行是插入一个新数据
-		if(BattleResult.TO_BE_MATCHED.equals(battleResult)){
+		if(BattleResult.TO_BE_MATCHED.equals(judgeResult)){
 			//将附件信息封装到mapToDaoForAttachment并传入数据库中
 			Map<String, Object> mapToDaoForAttachment = new LinkedHashMap<String,Object>();
 			mapToDaoForAttachment.put("attachmentId", attachmentId);						
@@ -181,7 +182,7 @@ public class ValuationAccountingService {
 		}
 		
 		//不一致说明银行要修改附件中的信息
-		if(BattleResult.INCONSISTENT.equals(battleResult)){
+		if(BattleResult.INCONSISTENT.equals(judgeResult)){
 			//将附件信息封装到mapToDaoForAttachment并传入数据库中
 			Map<String, Object> mapToDaoForAttachment = new LinkedHashMap<String,Object>();
 			mapToDaoForAttachment.put("attachmentId", attachmentId);						

+ 63 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/utils/ExcelUtil.java

@@ -0,0 +1,63 @@
+package com.fuzamei.utils;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+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;
+
+public class ExcelUtil {
+	
+	public static final boolean matchExcel(File file1,File file2){
+		boolean flag=false;
+		InputStream is=null;
+		InputStream is2=null;
+		Workbook wb=null;
+		Workbook wb2=null;
+		try {
+			is = new FileInputStream(file1);
+			is2 = new FileInputStream(file2);
+		} catch (FileNotFoundException e2) {
+			throw new RuntimeException("未找到文件");
+		}
+		try {
+			wb=new XSSFWorkbook(is);
+			wb2=new XSSFWorkbook(is2);
+		} catch (IOException e) {
+			try {
+				wb=new HSSFWorkbook(is);
+				wb2=new HSSFWorkbook(is2);
+			} catch (IOException e1) {
+				throw new RuntimeException("非Excel文件");
+			}
+		}
+		Sheet sheet = wb.getSheet("Sheet1");
+		Sheet sheet2 = wb2.getSheet("Sheet1");
+		Row row = sheet.getRow(1);
+		Row row2 = sheet2.getRow(1);
+		Cell cell = row.getCell(0);
+		Cell cell2 = row2.getCell(0);
+		double numericCellValue = cell.getNumericCellValue();
+		double numericCellValue2 = cell2.getNumericCellValue();
+		flag = (numericCellValue==numericCellValue2);
+		try {
+			wb.close();
+			wb2.close();
+		} catch (IOException e) {
+			throw new RuntimeException("流关闭异常");
+		}
+		
+		return flag;
+	}
+	
+}

+ 1 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/utils/RelativePathUtil.java

@@ -62,7 +62,7 @@ public class RelativePathUtil {
 	* @throws
 	 */
 	public static final String formatPath(String prefix,String sufix){
-		return formatPath(new Date(),prefix+"/yyyy/MM/dd/HH/mm/ss/"+sufix);
+		return prefix+formatPath()+sufix;
 	}
 	
 }

+ 307 - 137
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/BusinessDeclareAction.java

@@ -8,6 +8,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URLEncoder;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,10 +40,17 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.alibaba.fastjson.JSON;
+import com.fuzamei.constant.HintMSG;
+import com.fuzamei.constant.Role;
 import com.fuzamei.entity.BusinessCheck;
+import com.fuzamei.entity.UserDetail;
+import com.fuzamei.service.AttachmentService;
 import com.fuzamei.service.BusinessDeclareService;
+import com.fuzamei.service.UserAuthoricationService;
 import com.fuzamei.utils.JSONUtil;
 import com.fuzamei.utils.PageDTO;
+import com.fuzamei.utils.RelativePathUtil;
+import com.fuzamei.utils.ValidationUtil;
 
 @Controller
 @RequestMapping("/business_declare")
@@ -51,7 +59,15 @@ public class BusinessDeclareAction {
 	@Autowired
 	private BusinessDeclareService businessDeclareService;
 	
+	@Autowired
+	private UserAuthoricationService userAuthoricationService;
+	
+	@Autowired
+	private AttachmentService attachmentService;
+	
 	private static final String SP=File.separator;
+	
+	private static final int ROW_NUM = 10; // 分页每页显示数据的数量
 	/**
 	 * 
 	* @Title: uploadValuationPOIByBank
@@ -73,101 +89,172 @@ public class BusinessDeclareAction {
 	 */
 	@RequestMapping(value="/uploadBusinessMaterialsByBranchBank",method=RequestMethod.POST)
 	@ResponseBody
-	public Map<String, Object> uploadValuationPOIByBank(@RequestParam("businessApproval") MultipartFile file1,
+	private Map<String, Object> uploadValuationPOIByBank(@RequestParam("businessApproval") MultipartFile file1,
 			@RequestParam("responsibleInvestigation") MultipartFile file2,
 			@RequestParam("productApproval") MultipartFile file3,
 			@RequestParam("basicData") MultipartFile file4,
 			HttpServletRequest request,
-			@RequestParam("businessName") String businessName) {
+			@RequestParam("businessName") String businessName,
+			@RequestParam("userId") Object uId) {
 		try {
-			String path = request.getServletContext().getRealPath("")+SP+"content";			//SP是系统分隔符
-			File dir=new File(path);
-			if(!dir.exists()){
-				dir.mkdirs();
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(uId);
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.TRAN_BRANCH_BANK);//查看用户非空和权限(只有【经办支行】有这个权限操作)
+			
+			//首先保证文件不能为空
+			if(file1.isEmpty()||file2.isEmpty()||file3.isEmpty()||file4.isEmpty()){
+				throw new RuntimeException("上传文件不能为空");
+			}
+			String filename1 = file1.getOriginalFilename();				//业务核准表的文件名
+			String filename2 = file2.getOriginalFilename();				//尽职调查表的文件名
+			String filename3 = file3.getOriginalFilename();				//产品核准表的文件名
+			String filename4 = file4.getOriginalFilename();				//基础资料的文件名
+			//判断上传文件格式是否正确
+			if(!(filename1.endsWith(".xls")||filename1.endsWith("xlsx"))&&
+			   !(filename2.endsWith(".xls")||filename2.endsWith("xlsx"))&&
+			   !(filename3.endsWith(".xls")||filename3.endsWith("xlsx"))&&
+			   !(filename4.endsWith(".xls")||filename4.endsWith("xlsx"))){
+				throw new RuntimeException("上传文件格式不对");
+			}
+			//四个文件名不能有相同的两个文件名(暂时考虑是将四个文件放在一个文件夹下面)
+			if(filename1.equals(filename2)||
+			   filename1.equals(filename3)||
+			   filename1.equals(filename4)||
+			   filename2.equals(filename3)||
+			   filename2.equals(filename4)||
+			   filename3.equals(filename4)){
+				throw new RuntimeException("文件名不能相同");
 			}
+			//确定好上传的文件的顶级父级路径=======================================================================>>待定TODO
+			String path = request.getServletContext().getRealPath("");			//SP是系统分隔符
+			String relativePath = RelativePathUtil.formatPath("/"+userId, "");	//生成文件的相对保存路径
 			
+			Integer businessId=businessDeclareService.generateBusinessId();						//新创建的业务申报生成的不重复id号=============================>>生成id号的机制要改TODO
+			String bank=userDetail.getOrganization_name();										//银行名称,但是表的字段是银行id?????。。。。。。。=======>>暂且按照当前用户的组织名进行录入TODO
+			businessName=ValidationUtil.checkBlankAndAssignString(businessName);				//校验前端传过来的业务名称并进行赋值
+			String busineeApprovalName=filename1;												//业务员核准表的文件名
+			String urlOfBusineeApproval=relativePath+filename1;									//业务核准表的url地址
+			String responsibleInvestigationName=filename2;										//尽职调查表的文件名
+			String urlOfResponsibleInvestigation=relativePath+filename2;						//尽职调查表的url地址
+			String productApprovalName=filename3;												//产品核准表的文件名
+			String urlOfProductApproval=relativePath+filename3;									//产品核准表的url地址
+			String basicDataName=filename4;														//基础性资料的文件名
+			String urlOfBasicData=relativePath+filename4;										//基础性资料的url地址
+			//一次性返回4个不同的id号,且不会和数据库中的重复
+			List<Integer> attachmentIds = attachmentService.generateMultiAttachmentIds(4);
+			Integer busineeApprovalId=attachmentIds.get(0);										//业务核准表的id号=====================================>>生成id号的机制要改TODO
+			Integer responsibleInvestigationId=attachmentIds.get(1);							//尽职调查表id号=====================================>>生成id号的机制要改TODO
+			Integer productApprovalId=attachmentIds.get(2);										//产品核准表的id号=====================================>>生成id号的机制要改TODO
+			Integer basicDataId=attachmentIds.get(3);											//基础性资料的id号=====================================>>生成id号的机制要改TODO
+	//---------------------------------------------------------------------------------------------------------------	
+			//处理整个业务生报表的一些信息
 			Map<String, Object> map =new LinkedHashMap<String, Object>();		//这个map用于存储所有要去service的数据
-			map.put("businessId", 32323);					//将业务id先写死,到时候还要再进行修改。。。。。TODO
-			map.put("bank", "杭州文三路支行");				//先将申报的支行名字写死,到时候还要进行修改。。。。。数据库的字段是bank_id???。。。。。TODO
-			map.put("businessName", businessName);			//将业务名称先写入map,这个只是用于创建一条业务申请表中的信息,数据来自客户端创建的名称
-			
-			
-			//处理businessApproval(业务核准表)文件的上传功能
-			String filename1 = file1.getOriginalFilename();
-			String pathFile1=path+SP+filename1;
-			File newFile1=new File(pathFile1);
-			file1.transferTo(newFile1);						//将---业务核准表---文件上传到制定的文件夹下,目前这个文件夹路径是写死的	
-			map.put("busineeApprovalId", 400001);			//将业务核准表的id先写死,和attachment表中表id一致
-			map.put("busineeApprovalName",filename1);		//业务核准表名称,用于存在attachment中的附件名
-			map.put("urlOfBusineeApproval", SP+"content"+SP+filename1);		//将文件下载路径url通过map传到service层进行校验
-			
+			map.put("userDetail", userDetail);									//用户详细信息
+			map.put("businessId", businessId);									//将业务id活♥
+			map.put("bank", bank);												//先将申报的支行名字写活♥
+			map.put("businessName", businessName);								//业务名称
+	//---------------------------------------------------------------------------------------------------------------		
+			//处理businessApproval(业务核准表)文件信息
+			map.put("busineeApprovalId", busineeApprovalId);								//将业务核准表的id写活
+			map.put("busineeApprovalName",busineeApprovalName);								//业务核准表名称,用于存在attachment中的附件名
+			map.put("urlOfBusineeApproval", urlOfBusineeApproval);							//文件下载相对路径url
 	//---------------------------------------------------------------------------------------------------------------			
-				
-			//处理responsibleInvestigation(尽职调查报告)文件的上传功能
-			String filename2 = file2.getOriginalFilename();
-			String pathFile2=path+SP+filename2;
-			File newFile2=new File(pathFile2);
-			file2.transferTo(newFile2);													//将---尽职调查报告---文件上传到制定的文件夹下,目前这个文件夹路径是写死的
-			map.put("responsibleInvestigationId", 500001);								//将尽职调查报告的id先写死,和attachment表中表id一致
-			map.put("responsibleInvestigationName",filename2);							//业务核准表名称,用于存在attachment中的附件名
-			map.put("urlOfResponsibleInvestigation", SP+"content"+SP+filename2);		//将文件下载路径url通过map传到service层进行校验
-			
+			//处理responsibleInvestigation(尽职调查报告)文件信息
+			map.put("responsibleInvestigationId", responsibleInvestigationId);								//将尽职调查报告的id先写活♥
+			map.put("responsibleInvestigationName",responsibleInvestigationName);							//业务核准表名称,用于存在attachment中的附件名
+			map.put("urlOfResponsibleInvestigation", urlOfResponsibleInvestigation);						//文件下载相对路径url
 	//---------------------------------------------------------------------------------------------------------------		
-			
-			//处理productApproval(产品核准表)文件的上传功能
-			String filename3 = file3.getOriginalFilename();
-			String pathFile3=path+SP+filename3;
-			File newFile3=new File(pathFile3);
-			file3.transferTo(newFile3);											//将---产品核准表---文件上传到制定的文件夹下,目前这个文件夹路径是写死的
-			map.put("productApprovalId", 600001);								//将产品核准表的id先写死,和attachment表中表id一致
-			map.put("productApprovalName",filename3);							//业务核准表名称,用于存在attachment中的附件名
-			map.put("urlOfProductApproval", SP+"content"+SP+filename3);			//将文件下载路径url通过map传到service层进行校验
-
+			//处理productApproval(产品核准表)文件信息
+			map.put("productApprovalId", productApprovalId);								//将产品核准表的id先写活♥
+			map.put("productApprovalName",productApprovalName);								//业务核准表名称,用于存在attachment中的附件名
+			map.put("urlOfProductApproval", urlOfProductApproval);							//文件下载相对路径url
 	//---------------------------------------------------------------------------------------------------------------		
-			
 			//处理basicData(基础性资料)文件的上传功能
-			String filename4 = file4.getOriginalFilename();
-			String pathFile4=path+SP+filename4;
-			File newFile4=new File(pathFile4);
-			file4.transferTo(newFile4);													//将---基础性资料---文件上传到制定的文件夹下,目前这个文件夹路径是写死的
-			map.put("basicDataId", 700001);								//将业务核准表的id先写死,和attachment表中表id一致
-			map.put("basicDataName",filename4);							//业务核准表名称,用于存在attachment中的附件名
-			map.put("urlOfBasicData", SP+"content"+SP+filename4);		//将文件下载路径url通过map传到service层进行校验
-				
+			map.put("basicDataId", basicDataId);											//将业务核准表的id先写活♥
+			map.put("basicDataName",basicDataName);											//业务核准表名称,用于存在attachment中的附件名
+			map.put("urlOfBasicData", urlOfBasicData);										//文件下载相对路径url
 	//---------------------------------------------------------------------------------------------------------------		
-			
-			//将经办支行提交的所有数据信息通过map传入service层先进行校验
+			//将经办支行提交的所有数据信息通过map传入service层
 			businessDeclareService.insertInformationIntoTableByBranchBank(map);
-			
-			return JSONUtil.getJsonMap(200, true, "上传成功",null); //返回给前端一个map进行前段提示
+	//---------------------------------------------------------------------------------------------------------------			
+			String pathFile1=path+relativePath+filename1;
+			String pathFile2=path+relativePath+filename2;
+			String pathFile3=path+relativePath+filename3;
+			String pathFile4=path+relativePath+filename4;
+			File newFile1=new File(pathFile1);
+			File newFile2=new File(pathFile2);
+			File newFile3=new File(pathFile3);
+			File newFile4=new File(pathFile4);
+			//==============文件上传开始================
+			//文件夹和文件最后进行创建和创建,不然一旦事物报错,这些文件就变成垃圾数据了
+			File dir=new File(path+relativePath);
+			if(!dir.exists()){
+				dir.mkdirs();
+			}
+			file1.transferTo(newFile1);		
+			file2.transferTo(newFile2);		
+			file3.transferTo(newFile3);		
+			file4.transferTo(newFile4);
+			//==============文件上传结束================
+			return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null); //返回给前端一个map进行前段提示
 		} catch (Exception e) {
-			return JSONUtil.getJsonMap(500, false, "上传出现异常"+e.getMessage(),null); //返回给前端一个map进行前段提示
+			return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(),null); //返回给前端一个map进行前段提示
 		}
 	}
 	
-	
-	
 	/**
 	 * 
 	* @Title: queryBusinessDeclareInformation
 	* @Description: TODO(业务申报的查看,将所有信息返还给界面)
 	* @param @param data
+	* 				前端传来的数据json格式为
+	* 				{
+	* 					"userId":XXX,
+	* 					"businessName":"",
+	* 					"page":"",
+	* 					"startTime":"",
+	* 					"endTime":""
+	* 				}
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
 	* @author ylx
 	* @date 2017年12月19日 下午4:01:02
-	* @throws
+	* @authority: 经办支行,二级支行,省分行
 	 */
 	@RequestMapping(value="/queryBusinessDeclareInformation",method=RequestMethod.POST)
 	@ResponseBody
-	public Map<String,Object> queryBusinessDeclareInformation(@RequestBody String data){
-		
-		System.out.println("查询业务申请信息....");
-		Map<String, Object> map = JSONUtil.jsonToMap(data);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
-		
-		PageDTO pageDto = businessDeclareService.queryBusinessDeclareInformation(map);
-		
-		return JSONUtil.getJsonMap(200, true, "操作成功", pageDto);
+	private Map<String,Object> queryBusinessDeclareInformation(@RequestBody String data){
+		try {
+			System.out.println("查询业务申请信息....");
+			@SuppressWarnings("unchecked")
+			Map<String, Object> map = JSON.parseObject(data, Map.class);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(map.get("userId"));
+			//查看用户非空和权限(只有【经办支行,二级支行和省分行】有这个权限操作)
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.TRAN_BRANCH_BANK,Role.SEC_BRANCH_BANK,Role.BUSINESS_DEP_OF_PBB);
+			int page = ValidationUtil.checkMinAndAssignInt(map.get("page"), 1); 									// 默认页是第一页
+			String businessName=ValidationUtil.checkBlankStringAndAssignEmptyIfIsBlank(map.get("businessName"));	//业务名默认为空
+			long startTime = ValidationUtil.checkAndAssignDefaultLong(map.get("startTime"), 0L); 					//开始时间默认0
+			long endTime = ValidationUtil.checkAndAssignDefaultLong(map.get("endTime"), Long.MAX_VALUE); 			//结束时间默认Long最大值
+			
+			Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+			mapToService.put("userDetail", userDetail);
+			mapToService.put("startPage", (page - 1) * ROW_NUM);
+			mapToService.put("businessName", businessName);
+			//如果时间顺序错位,要重新进行排位
+			if (startTime <= endTime) {
+				mapToService.put("startTime", startTime);
+				mapToService.put("endTime", endTime);
+			} else {
+				mapToService.put("startTime", startTime);
+				mapToService.put("endTime", Long.MAX_VALUE);
+			}
+			mapToService.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
+			PageDTO pageDto = businessDeclareService.queryBusinessDeclareInformation(map);
+			return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
+		}
 	}
 	
 	/**
@@ -178,28 +265,37 @@ public class BusinessDeclareAction {
 	* 			前端传过来的json格式
 				{
 					"businessId":32323
+					"userId":xxx
 				}
 	* @param @param data
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
 	* @author ylx
 	* @date 2017年12月19日 下午7:46:44
-	* @throws
+	* @authority: 经办支行,二级支行,省分行
 	 */
 	@RequestMapping(value="/queryBusinessCheckInformation",method=RequestMethod.POST)
 	@ResponseBody
-	public Map<String,Object> queryBusinessCheckInformation(@RequestBody String data){
-		
-		System.out.println("查询业务审核总表信息....");
-		
-		Map<String, Object> map = JSONUtil.jsonToMap(data);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
-		
-		List<BusinessCheck> businessCheckList = businessDeclareService.queryBusinessCheckInformation(map);
-		
-		return JSONUtil.getJsonMap(200, true, "操作成功", businessCheckList);
+	private Map<String,Object> queryBusinessCheckInformation(@RequestBody String data){
+		try {
+			System.out.println("查询业务审核总表信息....");
+			@SuppressWarnings("unchecked")
+			Map<String, Object> map = JSON.parseObject(data, Map.class);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(map.get("userId"));
+			//查看用户非空和权限(只有【经办支行,二级支行和省分行】有这个权限操作)
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.TRAN_BRANCH_BANK,Role.SEC_BRANCH_BANK,Role.BUSINESS_DEP_OF_PBB);
+			Integer businessId=ValidationUtil.checkAndAssignInt(map.get("businessId"));		//被审核的业务id号需要先被进行校验
+			Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+			mapToService.put("userDetail", userDetail);
+			mapToService.put("businessId", businessId);
+			List<BusinessCheck> businessCheckList = businessDeclareService.queryBusinessCheckInformation(mapToService);
+			return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, businessCheckList);
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
+		}
 	}
 	
-	
 	/**
 	 * 
 	* @Title: businessDeclareCheckedBy
@@ -207,11 +303,10 @@ public class BusinessDeclareAction {
 	* @param @param data	
 	* 数据json包含
 	* 		{ 
-	* 		 organizationName:二级分行或省分行
-	* 		 checkPerson:审核人员
-	* 		 checkResult:结果放入check_result字段
-	* 		 checkOpinion:审核意见
-	* 		 businessId:业务id
+	* 		 	"checkResult":结果(同意5或者不同意6---数字以状态表为准),
+	* 		 	"checkOpinion":审核意见,
+	* 		 	"businessId":业务id,
+	* 			"userId":XXX
 	* 		}
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
@@ -221,25 +316,38 @@ public class BusinessDeclareAction {
 	 */
 	@RequestMapping(value="/businessDeclareCheckedBy",method=RequestMethod.POST)
 	@ResponseBody
-	public Map<String,Object> businessDeclareCheckedBy(@RequestBody String data){
-		
+	private Map<String,Object> businessDeclareCheckedBy(@RequestBody String data){
 		try {
 			System.out.println("添加到业务审核总表信息....");
 			
-			Map<String, Object> map = JSONUtil.jsonToMap(data);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
-			
-			businessDeclareService.businessDeclareCheckedBy(map);
+			@SuppressWarnings("unchecked")
+			Map<String, Object> map = JSON.parseObject(data, Map.class);		//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(map.get("userId"));
+			//查看用户非空和权限(只有【二级支行和省分行】有这个权限操作)
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.SEC_BRANCH_BANK,Role.BUSINESS_DEP_OF_PBB);
+			//审核结果进行校验并赋值
+			Integer checkResult = ValidationUtil.checkAndAssignInt(map.get("checkResult"));
+			if(!(checkResult==5||checkResult==6)){
+				throw new RuntimeException("审核结果参数非法");
+			}
+			//审核意见进行校验并赋值
+			String checkOpinion = ValidationUtil.checkBlankAndAssignString(map.get("checkOpinion"));
+			//被审核的业务id号需要先被进行校验
+			Integer businessId=ValidationUtil.checkAndAssignInt(map.get("businessId"));		
+			Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+			mapToService.put("userDetail", userDetail);
+			mapToService.put("checkResult", checkResult);
+			mapToService.put("checkOpinion", checkOpinion);
+			mapToService.put("businessId", businessId);
+			businessDeclareService.businessDeclareCheckedBy(mapToService);
 			
-			return JSONUtil.getJsonMap(200, true, "增加审核意见成功", null);
+			return JSONUtil.getJsonMap(200, true, HintMSG.OPERATION_SUCCESS, null);
 		} catch (Exception e) {
-			return JSONUtil.getJsonMap(500, false, "增加审核意见失败:"+e.getMessage(), null);
+			return JSONUtil.getJsonMap(500, false, HintMSG.OPERATION_FAIL+":"+e.getMessage(), null);
 		}
 	}
 	
-	
-	
-	                 
-	
 	/**
 	 * 
 	* @Title: uploadContractByProvincialBranchBank
@@ -259,39 +367,56 @@ public class BusinessDeclareAction {
 	 */
 	@RequestMapping(value="/uploadContractByProvincialBranchBank",method=RequestMethod.POST)
 	@ResponseBody
-	public Map<String, Object> uploadContractByProvincialBranchBank(@RequestParam("contract") MultipartFile file,HttpServletRequest request,
-			@RequestParam("businessId") String businessId) {
+	private Map<String, Object> uploadContractByProvincialBranchBank(@RequestParam("contract") MultipartFile file,
+																	HttpServletRequest request,
+																	@RequestParam("businessId") Object bId,
+																	@RequestParam("userId") Object uId) {
 		try {
-			String path = request.getServletContext().getRealPath("")+SP+"content";			//SP是系统分隔符	
-			File dir=new File(path);
-			if(!dir.exists()){
-				dir.mkdirs();
+			//首先校验用户权限问题
+			int userId=ValidationUtil.checkAndAssignInt(uId);
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.BUSINESS_DEP_OF_PBB);//查看用户非空和权限(只有【经办支行】有这个权限操作)
+			//首先保证文件不能为空
+			if(file.isEmpty()){
+				throw new RuntimeException("上传文件不能为空");
 			}
+			//合同文件名
+			String filename = file.getOriginalFilename();				
+			//判断上传文件格式是否正确
+			if(!(filename.endsWith(".xls")||filename.endsWith("xlsx"))){
+				throw new RuntimeException("上传文件格式不对");
+			}
+			//确定好上传的文件的顶级父级路径=======================================================================>>待定TODO
+			String path = request.getServletContext().getRealPath("");			//SP是系统分隔符
+			String relativePath = RelativePathUtil.formatPath("/"+userId, "");	//生成文件的相对保存路径
 			
-			Map<String, Object> map =new LinkedHashMap<String, Object>();		//这个map用于存储所有要去service的数据
-			map.put("businessId", businessId);					//将业务id先写死,到时候还要再进行修改。。。。。TODO
-			map.put("contractParty", "建行省分行&信托公司");	//合同的签约方。。。。。。。。。。。。。。。。。TODO。。。。。。。。。。。。。。。【这里先写死,可能通过上传的合同文件获取签约方的信息】
-			map.put("uploadDepartment", "省分行业务部门");	//上传部门。。。。。。。。。。。。。。。。。。。TODO。。。。。。。【这里先写死,到底是通过session获取还是通过客户端传过来获取?】
-			map.put("uploadPerson", "张三丰");				//上传人员。。。。。。。。。。。。。。。。。。。TODO。。。。。。。【这里先写死,到底如何获取上传人的姓名????】
-			
-			
-			String filename = file.getOriginalFilename();
-			String pathFile = path+SP+filename;
-			File newFile = new File(pathFile);
-			file.transferTo(newFile);											//将---合同---文件上传到制定的文件夹下,目前这个文件夹路径是写死的	
-			
-			map.put("contractId", "800001");									//将合同的id先写死,和attachment表中表id一致
-			map.put("contractName",filename);									//合同名称,用于存在attachment中的附件名
-			map.put("url", "/content/"+filename);								//将文件下载路径url通过map传到service层进行校验
-			map.put("hash", "to be calculated from file on server");			//文件hash值先写死,到时候需要从服务器上的文件获取
+			Integer businessId = ValidationUtil.checkAndAssignInt(bId);			//校验业务id并赋值
+			Integer attachmentId = attachmentService.generateAtachmentId();		//生成不重复的附件id号
 			
-			map.put("userId", "900000011");											//先将上传人的id号写死,到时候需要动态获取这个信息。。。TODO
+			Map<String, Object> mapToService =new LinkedHashMap<String, Object>();		//这个map用于存储所有要去service的数据
+			mapToService.put("businessId", businessId);									//将业务id先写死,到时候还要再进行修改。。。。。TODO
+			mapToService.put("contractParty", "建行省分行&信托公司");						//合同的签约方。。。TODO。。。。【这里先写死,可能通过上传的合同文件获取签约方的信息】
+//			mapToService.put("uploadDepartment", userDetail.getOrganization_name());		//上传部门按照组织名来写
+//			mapToService.put("uploadPerson", userDetail.getPerson_name());				//上传人员写活♥
+			mapToService.put("contractId", attachmentId);								//将合同的id写活♥
+			mapToService.put("contractName",filename);									//合同名称,用于存在attachment中的附件名
+			mapToService.put("url", relativePath+filename);								//将文件下载路径url通过map传到service层进行校验
+			mapToService.put("hash", "to be calculated");								//文件hash值先写死,到时候需要从服务器上的文件获取
+			mapToService.put("userDetail", userDetail);									//直接将用户详细信息传到service层
 			
-			businessDeclareService.uploadContractByProvincialBranchBank(map);	//将合同信息插入到【合同提交记录表contract_record、合同状态跟踪表contract_status_tracking、附件表attachment】
+			businessDeclareService.uploadContractByProvincialBranchBank(mapToService);	//将合同信息插入到【合同提交记录表contract_record、合同状态跟踪表contract_status_tracking、附件表attachment】
 			
-			return JSONUtil.getJsonMap(200, true, "合同上传成功", null);
+			String pathFile=path+relativePath+filename;
+			File newFile = new File(pathFile);
+			//==========文件上传开始============
+			File dir=new File(path+relativePath);
+			if(!dir.exists()){
+				dir.mkdirs();
+			}
+			file.transferTo(newFile);											//将---合同---文件上传到指定的文件夹下
+			//==========文件上传结束============
+			return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS, null);
 		}catch (Exception e) {
-			return JSONUtil.getJsonMap(500, false, "合同上传失败:"+e.getMessage(), null);
+			return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(), null);
 		}
 	}
 			
@@ -299,10 +424,10 @@ public class BusinessDeclareAction {
 	
 	/**
 	* @Title: download
-	* @Description: TODO(实现所有上传的文件的下载功能)
-	* @param @param request
-	* @param @param response
-	* @param @param url
+	* @Description: TODO(实现所有上传的文件的下载功能)=====>>仅局限于业务审核表,尽职调查表,产品核准表和基础性资料这4个文件的下载
+	* 				前段以【表单】的形式传过来一组数据:
+	* @param 		url:下载地址
+	* 				userId:用户id号
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
 	* @author ylx
@@ -311,9 +436,18 @@ public class BusinessDeclareAction {
 	 */
 	@RequestMapping(value="/downloadBusinessDeclareFiles")
 	@ResponseBody
-	public Map<String, Object> download(HttpServletRequest request,HttpServletResponse response,@RequestParam("url") String url) {
+	private Map<String, Object> downloadBusinessDeclareFiles(HttpServletRequest request,HttpServletResponse response,
+										@RequestParam("url") String url,
+										@RequestParam("userId") Object uId) {
 		try {
+			int userId=ValidationUtil.checkAndAssignInt(uId);
+			userAuthoricationService.checkUserAuthority(userId,Role.TRAN_BRANCH_BANK,Role.SEC_BRANCH_BANK,Role.BUSINESS_DEP_OF_PBB);	//查看用户非空和权限(经办支行,二级分行,省分行都有这个权限操作)
+			url=ValidationUtil.checkBlankAndAssignString(url);							//对传过来的url进行非空校验
 			String fileName = request.getServletContext().getRealPath("")+url; 		//SP是系统分隔符
+			//如果文件不存在直接抛出异常
+			if(!new File(fileName).exists()){
+				throw new RuntimeException(HintMSG.FILE_NOT_FOUND);
+			}
 			InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName)));  
 			String filename = url.substring(url.lastIndexOf("/")+1);  //截取文件名
 			filename = URLEncoder.encode(filename,"UTF-8");
@@ -327,30 +461,67 @@ public class BusinessDeclareAction {
 			}  
 			out.close();
 			bis.close();
-			return JSONUtil.getJsonMap(200, true, "下载成功",null); //返回给前端一个map进行前段提示
+			return JSONUtil.getJsonMap(200, true, HintMSG.DOWNLOAD_SUCCESS, null); //返回给前端一个map进行前段提示
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.DOWNLOAD_FAIL+":"+e.getMessage(), null); //返回给前端一个map进行前段提示
+		}
+	}
+	/**
+	 * @Title: download
+	 * @Description: TODO(实现托管合同的下载功能)=====>>仅局限于托管合同这1个文件的下载
+	 * 				前段以【表单】的形式传过来一组数据:
+	 * @param 		url:下载地址
+	 * 				userId:用户id号
+	 * @param @return    设定文件
+	 * @return Map<String,Object>    返回类型
+	 * @author ylx
+	 * @date 2017年12月21日 下午2:05:13
+	 * @throws
+	 */
+	@RequestMapping(value="/downloadContractFiles")
+	@ResponseBody
+	private Map<String, Object> downloadContractFiles(HttpServletRequest request,HttpServletResponse response,
+			@RequestParam("url") String url,
+			@RequestParam("userId") Object uId) {
+		try {
+			int userId=ValidationUtil.checkAndAssignInt(uId);
+			userAuthoricationService.checkUserAuthority(userId,Role.BUSINESS_DEP_OF_PBB);	//查看用户非空和权限(在业务申报的模块中只有省分行才有权限下载这个合同)
+			url=ValidationUtil.checkBlankAndAssignString(url);							//对传过来的url进行非空校验
+			String fileName = request.getServletContext().getRealPath("")+url; 		//SP是系统分隔符
+			//如果文件不存在直接抛出异常
+			if(!new File(fileName).exists()){
+				throw new RuntimeException(HintMSG.FILE_NOT_FOUND);
+			}
+			InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName)));  
+			String filename = url.substring(url.lastIndexOf("/")+1);  //截取文件名
+			filename = URLEncoder.encode(filename,"UTF-8");
+			response.addHeader("Content-Disposition", "attachment;filename=" + filename);    
+			response.setContentType("multipart/form-data");   
+			BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
+			int len = 0;  
+			while((len = bis.read()) != -1){  
+				out.write(len);  
+				out.flush(); 
+			}  
+			out.close();
+			bis.close();
+			return JSONUtil.getJsonMap(200, true, HintMSG.DOWNLOAD_SUCCESS, null); //返回给前端一个map进行前段提示
 		} catch (Exception e) {
-			return JSONUtil.getJsonMap(500, true, "下载出现异常",null); //返回给前端一个map进行前段提示
+			return JSONUtil.getJsonMap(500, false, HintMSG.DOWNLOAD_FAIL+":"+e.getMessage(), null); //返回给前端一个map进行前段提示
 		}
 	}
 	
 	
-	/*@RequestMapping(value="/test")
+	@RequestMapping(value="/test")
 	@ResponseBody
 	public Map<String, Object> test(@RequestBody String data){
 		try {
-			TestBO testBO = JSON.parseObject(data, TestBO.class);
-			List<String> list=validate(testBO);
-			if(!list.isEmpty()){
-				throw new RuntimeException(list.get(0));
-			}
-			return JSONUtil.getJsonMap(200, true, "成功",null);
+			List<Integer> generateMultiAttachmentIds = attachmentService.generateMultiAttachmentIds(4);
+			return JSONUtil.getJsonMap(200, true, "成功",generateMultiAttachmentIds);
 		} catch (Exception e) {
 			return JSONUtil.getJsonMap(200, true, "失败:"+e.getMessage(),null);
 		}
-	}*/
-	
-	
-	
+	}
 	
 	/**
 	 * 上传文件功能模块
@@ -411,7 +582,6 @@ public class BusinessDeclareAction {
 	}
 	*/
 	
-	
 	/**
 	 * 
 	* @Title: download

+ 2 - 2
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/ProjectFileAction.java

@@ -153,9 +153,9 @@ public class ProjectFileAction {
 	 */
 	@RequestMapping(value="/downloadProjectFile")
 	@ResponseBody
-	public Map<String, Object> download(HttpServletRequest request,HttpServletResponse response,@RequestParam("url") String url,@RequestParam("userId") Object id) {
+	public Map<String, Object> download(HttpServletRequest request,HttpServletResponse response,@RequestParam("url") String url,@RequestParam("userId") Object uId) {
 		try {
-			int userId=ValidationUtil.checkAndAssignInt(id);
+			int userId=ValidationUtil.checkAndAssignInt(uId);
 			userAuthoricationService.checkUserAuthority(userId,Role.SUPERVISION_AGENCY,Role.ARCHIVE_KEEPING_POS_OF_PBBTBC);//查看用户是否为空及是否有权限下载项目文档文件
 			String fileName = request.getServletContext().getRealPath("")+url;  		//SP是系统分隔符
 			//如果文件不存在直接抛出异常

+ 63 - 29
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/ValuationAccountingAction.java

@@ -33,9 +33,11 @@ import com.fuzamei.entity.ValuationAccount;
 import com.fuzamei.service.AttachmentService;
 import com.fuzamei.service.UserAuthoricationService;
 import com.fuzamei.service.ValuationAccountingService;
+import com.fuzamei.utils.ExcelUtil;
 import com.fuzamei.utils.JSONUtil;
 import com.fuzamei.utils.MapUtil;
 import com.fuzamei.utils.PageDTO;
+import com.fuzamei.utils.RelativePathUtil;
 //import com.fuzamei.utils.RelativePathUtil;
 import com.fuzamei.utils.ValidationUtil;
 
@@ -269,18 +271,12 @@ public class ValuationAccountingAction {
 			Integer attachmentId = attachmentService.generateAtachmentId();					//生成一个不重复的附件Id号==================>>生成id号的机制待定TODO
 			
 			String path = request.getServletContext().getRealPath("");							//上传文件顶级父类的绝对路径============================>>路径机制待定TODO	
-			//String relativePath = RelativePathUtil.formatPath("/"+userId,"");					//生成默认的相对路径格式================================>>路径机制待定TODO
+			String relativePath = RelativePathUtil.formatPath("/"+userId,"");					//生成默认的相对路径格式================================>>路径机制待定TODO
 			
-			
-			
-			File dir=new File(path);
-			if(!dir.exists()){
-				dir.mkdirs();
-			}
 			String filename = file.getOriginalFilename();
-			String url = "/content/"+ValidationUtil.checkBlankAndAssignString(filename);	//url路径名称被赋值之前先进行filename的校验
+			String url = relativePath+ValidationUtil.checkBlankAndAssignString(filename);	//url路径名称被赋值之前先进行filename的校验
 			String attachmentName = filename;												//附件名称,已经校验过,不需要再进行校验了
-			String pathFile=path+SP+filename;
+			String pathFile=path+relativePath+filename;
 			File newFile=new File(pathFile);
 			
 			
@@ -297,6 +293,10 @@ public class ValuationAccountingAction {
 			valuationAccountingService.insertInformationIntoTableByAdminForTheFirstTime(mapToService);		//将获取到的数据插入到表中
 			
 			//文件最后上传到服务器
+			File dir=new File(path+relativePath);
+			if(!dir.exists()){
+				dir.mkdirs();
+			}
 			file.transferTo(newFile);														//此时文件已经上传成功---->upload file success
 			
 			return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null); //返回给前端一个map进行前段提示
@@ -333,12 +333,8 @@ public class ValuationAccountingAction {
 				throw new RuntimeException("上传文件不能为空");
 			}
 			//确定好上传的文件的顶级父级路径=======================================================================>>待定TODO
-			String path = request.getServletContext().getRealPath("")+SP+"content";			//SP是系统分隔符
-			File dir=new File(path);
-			if(!dir.exists()){
-				dir.mkdirs();
-			}
-			String filename = file.getOriginalFilename();
+			String path = request.getServletContext().getRealPath("");			//SP是系统分隔符
+			String filename = file.getOriginalFilename();						//获取文件名
 			if(!(filename.endsWith(".xls")||filename.endsWith("xlsx"))){
 				throw new RuntimeException("上传文件格式不对");
 			}
@@ -355,6 +351,8 @@ public class ValuationAccountingAction {
 			if(BattleResult.CONSISTENT.equals(battleResult)){
 				throw new RuntimeException("对账结果一致,无法继续上传文件");
 			}
+			
+			
 			//判断是否是管理岗
 			if(roleList.contains(Role.ADMIN)){
 				if(BattleResult.TO_BE_MATCHED.equals(battleResult)){
@@ -368,22 +366,34 @@ public class ValuationAccountingAction {
 				if(!oldFile.exists()){
 					throw new RuntimeException("之前上传的文件丢失");
 				}
-				//切断旧路径,拼接成新路径
-				String custodianNewFilePath = custodianOldFilePath.substring(0, custodianOldFilePath.lastIndexOf("/")+1)+filename;
-				File newFile=new File(custodianNewFilePath);
+				//切断旧路径,拼接成新路径(生成一个临时文件)
+				String custodianTempFilePath = custodianOldFilePath.substring(0, custodianOldFilePath.lastIndexOf("/")+1)+"temp~~~~~~~~~~~"+filename;
+				File tempFile=new File(custodianTempFilePath);
+				//新文件的相对路径
+				String urlOfCustodianNewFile = valuationAccount.getUrl_of_custodian().substring(0, valuationAccount.getUrl_of_custodian().lastIndexOf("/")+1)+filename;
 				
 				//再获取银行之前上传的文件路径
 				String bankFilePath = path+valuationAccount.getUrl_of_bank();
+				File bankFile = new File(bankFilePath);
 				/*
 				 * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了
 				 * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
 				 */
+//				oldFile.delete();
+				file.transferTo(tempFile);
+				
+				boolean matchResult = ExcelUtil.matchExcel(tempFile, bankFile);
+				
+				//比对完之后暂时先这个文件删除
+				tempFile.delete();
+				
+				
 				//获取比对结果
-				String result = "????";
+				String result = matchResult?BattleResult.CONSISTENT:BattleResult.INCONSISTENT;
 				Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
 				mapToService.put("userDetail", userDetail);			//将用户的全部信息传入service层
 				mapToService.put("fundId", fundId);
-				mapToService.put("url", custodianNewFilePath);		//将文件下载路径url通过map传到service层进行校验
+				mapToService.put("url", urlOfCustodianNewFile);		//将文件下载路径url通过map传到service层进行校验
 				mapToService.put("attachmentName", filename);			//将文件以附件名的形式通过map传递到service层中进行校验
 				mapToService.put("battleResult", result);			//将文件比对结果封装进去
 				mapToService.put("attachmentId", valuationAccount.getAttachment_id_of_custodian());	//获取之前上传的附件id号在附件表中修改
@@ -391,6 +401,9 @@ public class ValuationAccountingAction {
 				
 				//文件的覆盖放到最后操作(重要!!!)
 				oldFile.delete();
+//				file.transferTo(newFile);
+				String custodianNewFilePath = custodianOldFilePath.substring(0, custodianOldFilePath.lastIndexOf("/")+1)+filename;
+				File newFile=new File(custodianNewFilePath);
 				file.transferTo(newFile);
 				
 				return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null); //返回给前端一个成功提示
@@ -402,29 +415,41 @@ public class ValuationAccountingAction {
 				//待审核的状态说明文件是一个新的文件上传上去
 				
 				//先获取管理员之前上传的文件
-				String custodianOldFilePath = path+SP+valuationAccount.getUrl_of_custodian();
+				String custodianOldFilePath = path+valuationAccount.getUrl_of_custodian();
 				//核查文件是否还在
 				File oldFile = new File(custodianOldFilePath);
 				if(!oldFile.exists()){
 					throw new RuntimeException("管理员上传的文件丢失");
 				}
+				
+				String relativePath = RelativePathUtil.formatPath("/"+userId,"");
+				
 				//银行上传文件的新路径
-				String bankNewFilePath = path + SP + filename;								//=========================>>新上传的文件路径怎么确定到时候再说TODO
-				File newFile=new File(bankNewFilePath);
+				String bankNewFilePath = path + relativePath + filename;			//=========================>>新上传的文件路径怎么确定到时候再说TODO
+				File dir=new File(path + relativePath);
+				if(!dir.exists()){
+					dir.mkdirs();
+				}
 				
+				File newFile=new File(bankNewFilePath);
+				file.transferTo(newFile);
 				/*
 				 * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了
 				 * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
 				 */
+				boolean matchResult = ExcelUtil.matchExcel(newFile, oldFile);
+				newFile.delete();
+				
 				//获取比对结果
-				String result = "????";
+				String result = matchResult?BattleResult.CONSISTENT:BattleResult.INCONSISTENT;
 				
 				Integer attachmentId = attachmentService.generateAtachmentId();					//生成一个不重复的附件Id号==================>>生成id号的机制待定TODO
 				
 				Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
+				mapToService.put("valuationAccount", valuationAccount);  //将valuationAccount对象传过去,对其中的对账结果进行判断
 				mapToService.put("userDetail", userDetail);			//将用户的全部信息传入service层
 				mapToService.put("fundId", fundId);
-				mapToService.put("url", "/content/"+filename);		//将文件下载路径url通过map传到service层进行校验//=================>>新上传的文件路径怎么确定到时候再说TODO
+				mapToService.put("url", relativePath + filename);		//将文件下载路径url通过map传到service层进行校验//=================>>新上传的文件路径怎么确定到时候再说TODO
 				mapToService.put("attachmentName", filename);		//将文件以附件名的形式通过map传递到service层中进行校验
 				mapToService.put("battleResult", result);			//将文件比对结果封装进去
 				mapToService.put("attachmentId", attachmentId);		
@@ -456,20 +481,26 @@ public class ValuationAccountingAction {
 				}
 				
 				//切断旧路径,拼接成新路径
-				String bankNewFilePath = banckOldFilePath.substring(0, banckOldFilePath.lastIndexOf("/")+1)+filename;
-				File newBankFile=new File(bankNewFilePath);
+				String bankTempFilePath = banckOldFilePath.substring(0, banckOldFilePath.lastIndexOf("/")+1)+"temp~~~~~~~~~~~"+filename;
+				File tempBankFile=new File(bankTempFilePath);
+//				oldBankFile.delete();
+				file.transferTo(tempBankFile);
 				
 				/*
 				 * 如过不是excel文件类型,导入也会报错,然后就把这个新上传的文件删了(这里旧文件不能先删了)
 				 * 这里对两份文件进行估值报价的比对得出比对的结果是一致还是不一致
 				 */
+				boolean matchResult = ExcelUtil.matchExcel(tempBankFile, oldCustodianFile);
+				tempBankFile.delete();
+				
 				//获取比对结果
-				String result = "????";
+				String result = matchResult?BattleResult.CONSISTENT:BattleResult.INCONSISTENT;
 				
 				Map<String, Object> mapToService =new LinkedHashMap<String, Object>();
+				mapToService.put("valuationAccount", valuationAccount);  //将valuationAccount对象传过去,对其中的对账结果进行判断
 				mapToService.put("userDetail", userDetail);			//将用户的全部信息传入service层
 				mapToService.put("fundId", fundId);
-				mapToService.put("url", "/content/"+filename);		//将文件下载路径url通过map传到service层进行校验//=================>>新上传的文件路径怎么确定到时候再说TODO
+				mapToService.put("url", valuationAccount.getUrl_of_bank().substring(0, valuationAccount.getUrl_of_bank().lastIndexOf("/")+1)+filename);		//将文件下载路径url通过map传到service层进行校验//=================>>新上传的文件路径怎么确定到时候再说TODO
 				mapToService.put("attachmentName", filename);		//将文件以附件名的形式通过map传递到service层中进行校验
 				mapToService.put("battleResult", result);			//将文件比对结果封装进去
 				mapToService.put("attachmentId", valuationAccount.getAttachment_id_of_bank());	//获取之前银行上传的附件id号	
@@ -477,6 +508,9 @@ public class ValuationAccountingAction {
 				
 				//文件覆盖的这个操作放到最后操做(很重要!!!)
 				oldBankFile.delete();
+//				file.transferTo(newBankFile);
+				String bankNewFilePath = banckOldFilePath.substring(0, banckOldFilePath.lastIndexOf("/")+1)+filename;
+				File newBankFile=new File(bankNewFilePath);
 				file.transferTo(newBankFile);
 				
 				return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS,null); //返回给前端一个成功提示