Browse Source

new updated

ylx 7 years ago
parent
commit
ef97473ee1

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

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

+ 81 - 173
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/BusinessDeclareMapper.xml

@@ -62,7 +62,18 @@
 	
 	<!-- 返回总页数 -->
 	<select id="findAllInfromations" resultType="int">
-		select count(*) from business_declare
+		select 
+			count(*) 
+		from 
+			business_declare
+		<where>
+			<if test="businessName!='' and businessName!=null">
+				business_name=#{businessName} 
+			</if>
+			<if test="startTime!=null and endTime!=null">
+				and declare_time between #{startTime} and #{endTime}
+			</if>
+		</where>
 	</select>
 	
 	<!-- 根据条件或不根据条件查询业务申请信息,并返回给前端,需要进行6表关联查询,1张业务申请表,4张附件表,1张状态表 -->
@@ -71,97 +82,39 @@
 			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,
+			a1.attachment_name as business_approval_name,
+			a1.url as business_approval_url,
+			a2.attachment_name as responsible_investigation_name,
+			a2.url as responsible_investigation_url,
+			a3.attachment_name as product_approval_name,
+			a3.url as product_approval_url,
+			a4.attachment_name as basic_data_name,
+			a4.url as basic_data_url,
 			bd.declare_time,
-			s.status_name as status_name,
+			s.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
+			business_declare bd
+		left join 
+			attachment a1
+		on 
+			a1.attachment_id=bd.business_approval_id
+		left join 
+			attachment a2
+		on 
+			a2.attachment_id=bd.responsible_investigation_id
+		left join 
+			attachment a3
+		on 
+			a3.attachment_id=bd.product_approval_id
+		left join 
+			attachment a4
+		on 
+			a4.attachment_id=bd.basic_data_id
 		left join 
 			status s
 		on 
-			bd.status_id=s.status_id
+			s.status_id=bd.status_id
 		<where>
 			<if test="businessName!='' and businessName!=null">
 				bd.business_name=#{businessName} 
@@ -178,7 +131,20 @@
 	
 	<!-- 返回省分行查询时的总条数 -->
 	<select id="findAllInfromationsByPBB" resultType="int">
-		select count(*) from business_declare where status_id not in (1,2)
+		select 
+			count(*) 
+		from 
+			business_declare 
+		<where>
+			<!-- 省分行能看到的要排除待二级分行审核和二级分行审核不通过的业务 -->
+			status_id not in (1,2)
+			<if test="businessName!='' and businessName!=null">
+				and business_name=#{businessName} 
+			</if>
+			<if test="startTime!=null and endTime!=null">
+				and declare_time between #{startTime} and #{endTime}
+			</if>
+		</where>
 	</select>
 	
 	<!-- 当省分行来查看业务申报表的时候给展现的数据,要除去状态1和状态2【分别对应待二级分行审核和二级分行审核不通过】 -->
@@ -187,99 +153,41 @@
 			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,
+			a1.attachment_name as business_approval_name,
+			a1.url as business_approval_url,
+			a2.attachment_name as responsible_investigation_name,
+			a2.url as responsible_investigation_url,
+			a3.attachment_name as product_approval_name,
+			a3.url as product_approval_url,
+			a4.attachment_name as basic_data_name,
+			a4.url as basic_data_url,
 			bd.declare_time,
-			bd.status_id,
-			s.status_name as status_name,
+			s.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
+			business_declare bd
+		left join 
+			attachment a1
+		on 
+			a1.attachment_id=bd.business_approval_id
+		left join 
+			attachment a2
+		on 
+			a2.attachment_id=bd.responsible_investigation_id
+		left join 
+			attachment a3
+		on 
+			a3.attachment_id=bd.product_approval_id
+		left join 
+			attachment a4
+		on 
+			a4.attachment_id=bd.basic_data_id
 		left join 
 			status s
 		on 
-			bd.status_id=s.status_id
+			s.status_id=bd.status_id
 		<where>
+			<!-- 省分行能看到的要排除待二级分行审核和二级分行审核不通过的业务 -->
 			bd.status_id not in (1,2)
 			<if test="businessName!='' and businessName!=null">
 				and bd.business_name=#{businessName} 

+ 2 - 2
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 findAllInfromations();
+	int findAllInfromations(Map<String, Object> map);
 
 	List<BusinessDeclare> queryBusinessDeclareInformation(Map<String, Object> map);
 
@@ -34,7 +34,7 @@ public interface BusinessDeclareMapper {
 
 	List<BusinessDeclare> queryBusinessDeclareInformationByPBB(Map<String, Object> map);
 
-	int findAllInfromationsByPBB();
+	int findAllInfromationsByPBB(Map<String, Object> map);
 
 	Integer getStatusIdByBusinessId(Integer businessId);
 

+ 9 - 11
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/BusinessDeclareService.java

@@ -129,24 +129,22 @@ public class BusinessDeclareService {
 		PageDTO pageDTO = new PageDTO();
 		UserDetail userDetail = (UserDetail) map.get("userDetail");
 		List<String> roleList = userDetail.getRole_name();
+		List<BusinessDeclare> informationList=null;
+		int count=0;
 		//经办支行和二级支行可以查看所有的信息
 		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;
+			informationList=businessDeclareDao.queryBusinessDeclareInformation(map);
+			count=businessDeclareDao.findAllInfromations(map);
 		}
 		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;
+			informationList=businessDeclareDao.queryBusinessDeclareInformationByPBB(map);
+			count=businessDeclareDao.findAllInfromationsByPBB(map);
 		}
-		throw new RuntimeException("无权操作");
+		pageDTO.setRows(informationList);
+		pageDTO.setTotal(count);
+		return pageDTO;
 	}
 
 

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

@@ -250,7 +250,7 @@ public class BusinessDeclareAction {
 				mapToService.put("endTime", Long.MAX_VALUE);
 			}
 			mapToService.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
-			PageDTO pageDto = businessDeclareService.queryBusinessDeclareInformation(map);
+			PageDTO pageDto = businessDeclareService.queryBusinessDeclareInformation(mapToService);
 			return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
 		} catch (Exception e) {
 			return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
@@ -264,7 +264,7 @@ public class BusinessDeclareAction {
 	* 这个信息要去业务审核总表中去查询
 	* 			前端传过来的json格式
 				{
-					"businessId":32323
+					"businessId":32323,
 					"userId":xxx
 				}
 	* @param @param data