ylx 7 rokov pred
rodič
commit
25c7677c54

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

@@ -19,8 +19,8 @@ public class OperationHistoryDao {
 		return dao.queryOperationHistoryInformation(map);
 	}
 	
-	public int findAllInformation(){
-		return dao.findAllInformation();
+	public int findAllInformation(Map<String, Object> map){
+		return dao.findAllInformation(map);
 	}
 
 	public List<OperationHistory> queryOperationHistoryInformationByUser(Map<String, Object> map) {

+ 2 - 3
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/ProjectFileDao.java

@@ -15,8 +15,8 @@ public class ProjectFileDao {
 	@Autowired
 	private ProjectFileMapper projectFileMapper;
 
-	public int findAllInformation() {
-		return projectFileMapper.findAllInformation();
+	public int findAllInformation(Map<String, Object> map) {
+		return projectFileMapper.findAllInformation(map);
 	}
 
 	public List<ProjectFile> queryProjectFileInformation(Map<String, Object> mapToDao) {
@@ -25,7 +25,6 @@ public class ProjectFileDao {
 	}
 
 	public List<ProjectFile> checkoutProjectFiles(Map<String, Object> mapToDao) {
-		
 		return projectFileMapper.checkoutProjectFiles(mapToDao);
 	}
 

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

@@ -15,8 +15,8 @@ public class ValuationAccountingDao {
 	@Autowired
 	private ValuationAccountingMapper valuationAccountingMapper;
 
-	public int findAllInformations() {
-		return valuationAccountingMapper.findAllInformations();
+	public int findAllInformations(Map<String, Object> map) {
+		return valuationAccountingMapper.findAllInformations(map);
 	}
 
 	public List<ValuationAccount> queryValuationAccountingInformation(Map<String, Object> map) {

+ 42 - 5
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/OperationHistoryMapper.xml

@@ -40,7 +40,43 @@
 	
 	<!-- 返回总页数 -->
 	<select id="findAllInformation" resultType="int">
-		select count(*) from operation_history
+		select
+			count(*)
+		from
+			(select 
+				oh.id,
+				oh.operator_type_id,
+				ot.operator_name,
+				oh.operator_account,
+				oh.operator_role,
+				oh.operator_person,
+				oh.operator_time,
+				oh.hash
+			from 
+				operation_history oh 
+			left join 
+				operation_type ot 
+			on 
+				oh.operator_type_id=ot.operator_type_id 
+			<where>
+				<if test="account!='' and account!=null">
+					oh.operator_account=#{account} 
+				</if>
+				<if test="role!='' and role!=null">
+					and oh.operator_role=#{role} 
+				</if>
+				<if test="type!='' and type!=null">
+					and ot.operator_name=#{type}
+				</if>
+				<if test="startTime!=null and endTime!=null">
+					and oh.operator_time between #{startTime} and #{endTime}
+				</if>
+			</where>) temp
+		<where>
+				<if test="Account!='' and Account!=null">
+					temp.operator_account=#{Account} 
+				</if>
+		</where>
 	</select>
 	
 	<!-- 根据操作记录给的条件查询分页数据,但是还要根据用户的账号名来查询 -->
@@ -83,11 +119,12 @@
 				<if test="startTime!=null and endTime!=null">
 					and oh.operator_time between #{startTime} and #{endTime}
 				</if>
-			</where>
-			order by oh.id asc  
-			limit #{startPage},#{rowNum}) temp
+			</where>) temp
 		where 
-			operator_account=#{Account}
+			temp.operator_account=#{Account}
+		order by 
+			temp.id asc  
+		limit #{startPage},#{rowNum}
 	</select>
 	
 </mapper>

+ 12 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/ProjectFileMapper.xml

@@ -34,7 +34,18 @@
 	
 	<!-- 分页用查询总记录条数 -->
 	<select id="findAllInformation" resultType="int">
-		select count(*) from project_file
+		select 
+			count(*) 
+		from 
+			project_file
+		<where>
+			<if test="projectName!='' and projectName!=null">
+				project_name=#{projectName}
+			</if>
+			<if test="startTime!=null and endTime!=null">
+				and update_time between #{startTime} and #{endTime}
+			</if>
+		</where>
 	</select>
 	
 	<select id="checkoutProjectFiles" resultType="com.fuzamei.entity.ProjectFile">

+ 15 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/ValuationAccountingMapper.xml

@@ -6,7 +6,21 @@
 	
 	<!-- 分页查询所有数据量,用于分页使用 -->
 	<select id="findAllInformations" resultType="int">
-		select count(*) from valuation_accounting
+		select 
+			count(*) 
+		from 
+			valuation_accounting
+		<where>
+			<if test="fundName!='' and fundName!=null">
+				fund_name=#{fundName}
+			</if>
+			<if test="battleResult!='' and battleResult!=null">
+				and battle_result=#{battleResult}
+			</if>
+			<if test="startTime!=null and endTime!=null">
+				and update_time between #{startTime} and #{endTime}
+			</if>
+		</where>
 	</select>
 	
 	<!-- 根据条件查询估值核算的信息 -->

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

@@ -7,7 +7,7 @@ import com.fuzamei.entity.OperationHistory;
 
 public interface OperationHistoryMapper {
 
-	int findAllInformation();
+	int findAllInformation(Map<String, Object> map);
 	
 	List<OperationHistory> queryOperationHistoryInformation(Map<String, Object> map);
 

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

@@ -7,7 +7,7 @@ import com.fuzamei.entity.ProjectFile;
 
 public interface ProjectFileMapper {
 
-	int findAllInformation();
+	int findAllInformation(Map<String, Object> map);
 
 	List<ProjectFile> queryProjectFileInformation(Map<String, Object> mapToDao);
 

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

@@ -9,7 +9,7 @@ import com.fuzamei.entity.ValuationAccount;
 
 public interface ValuationAccountingMapper {
 
-	int findAllInformations();
+	int findAllInformations(Map<String, Object> map);
 
 	List<ValuationAccount> queryValuationAccountingInformation(Map<String, Object> map);
 

+ 3 - 1
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/OperationHistoryService.java

@@ -54,13 +54,15 @@ public class OperationHistoryService {
 			//根据用户id号查询出用户的账号account信息
 			//这里还有上下级关系查看的问题还没解决============================================================>>>>>>待定TODO
 			String account = userDetail.getAccount();
+			System.out.println(account);
 			if(StringUtil.isEmpty(account)){
 				throw new RuntimeException("用户账号信息不存在");
 			}
 			map.put("Account", account);
 			informationList = operationHistoryDao.queryOperationHistoryInformationByUser(map); 
 		}
-		int count = operationHistoryDao.findAllInformation();
+		//定义一个查询出来的信息条数
+		int count = operationHistoryDao.findAllInformation(map);
 		pageDto.setTotal(count);
 		pageDto.setRows(informationList);
 		return pageDto;

+ 1 - 2
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/ProjectFileService.java

@@ -36,12 +36,11 @@ public class ProjectFileService {
 	* @throws
 	 */
 	public PageDTO queryProjectFileInformation(Map<String, Object> map) {
-		
 		PageDTO pageDto = new PageDTO(); // 创建分页对象
 		int userId = (Integer) map.get("userId");
 		userAuthoricationService.checkUserAuthority(userId,Role.SUPERVISION_AGENCY,Role.ARCHIVE_KEEPING_POS_OF_PBBTBC);		//查看用户非空和权限
 		List<ProjectFile> informationList = projectFileDao.queryProjectFileInformation(map);
-		int count = projectFileDao.findAllInformation();
+		int count = projectFileDao.findAllInformation(map);
 		pageDto.setRows(informationList);
 		pageDto.setTotal(count);
 		return pageDto;

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

@@ -41,7 +41,7 @@ public class ValuationAccountingService {
 	public PageDTO queryValuationAccountingInformation(Map<String, Object> map) {
 		PageDTO pageDTO=new PageDTO();
 		List<ValuationAccount> informationList=valuationAccountingDao.queryValuationAccountingInformation(map);	//从service层中获取分页的对象信息
-		int count=valuationAccountingDao.findAllInformations();													//获取总的信息数量
+		int count=valuationAccountingDao.findAllInformations(map);													//获取总的信息数量
 		pageDTO.setTotal(count);
 		pageDTO.setRows(informationList);
 		return pageDTO;

+ 62 - 12
ccb_fund_trusteeship/src/main/java/com/fuzamei/utils/ValidationUtil.java

@@ -1,6 +1,7 @@
 package com.fuzamei.utils;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -76,7 +77,13 @@ public class ValidationUtil {
 			}
 			number = String.class.cast(obj);
 			try {
-				Integer.parseInt(number);
+				Integer num = Integer.parseInt(number);
+				if (num < min) {
+					throw new OutOfRangeException("最小值应该大于等于"+min);
+				}
+				if(num > max){
+					throw new OutOfRangeException("最大值应该小于等于"+max);
+				}
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -87,6 +94,9 @@ public class ValidationUtil {
 			if (e instanceof NumberFormatException) {
 				throw new RuntimeException("数据类型解析异常");
 			}
+			if (e instanceof OutOfRangeException) {
+				throw new OutOfRangeException(e.getMessage());
+			}
 			Integer num = null;
 			try {
 				num = Integer.class.cast(obj);
@@ -168,7 +178,13 @@ public class ValidationUtil {
 			}
 			number = String.class.cast(obj);
 			try {
-				Long.parseLong(number);
+				Long num = Long.parseLong(number);
+				if (num < min) {
+					throw new OutOfRangeException("最小值应该大于等于"+min);
+				}
+				if(num > max){
+					throw new OutOfRangeException("最大值应该小于等于"+max);
+				}
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -179,9 +195,12 @@ public class ValidationUtil {
 			if (e instanceof NumberFormatException) {
 				throw new RuntimeException("数据类型解析异常");
 			}
+			if (e instanceof OutOfRangeException) {
+				throw new OutOfRangeException(e.getMessage());
+			}
 			Long num = null;
 			try {
-				num=Long.parseLong(""+obj);
+				num=Long.parseLong(String.valueOf(obj));
 			} catch (Exception e1) {
 				throw new RuntimeException("数字解析异常");
 			}
@@ -259,7 +278,14 @@ public class ValidationUtil {
 			}
 			number = String.class.cast(obj);
 			try {
-				return Integer.parseInt(number);
+				Integer num = Integer.parseInt(number);
+				if (num < min) {
+					throw new OutOfRangeException("最小值应该大于等于"+min);
+				}
+				if(num > max){
+					throw new OutOfRangeException("最大值应该小于等于"+max);
+				}
+				return num;
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -270,6 +296,9 @@ public class ValidationUtil {
 			if (e instanceof NumberFormatException) {
 				throw new RuntimeException("数据类型解析异常");
 			}
+			if (e instanceof OutOfRangeException) {
+				throw new OutOfRangeException(e.getMessage());
+			}
 			Integer num = null;
 			try {
 				num = Integer.class.cast(obj);
@@ -300,7 +329,10 @@ public class ValidationUtil {
 	public static int checkMinAndAssignInt(final Object obj, int min) {
 		return checkRangeAndAssignInt(obj,min,Integer.MAX_VALUE);
 	}
-	
+	public static void main(String[] args) {
+		int checkMinAndAssignInt = checkMinAndAssignInt(-1,1);
+		System.out.println(checkMinAndAssignInt);
+	}
 	/**
 	 * @Title: checkMaxAndAssignInt
 	 * @Description: 针对传入的参数进行校验--->Integer类型
@@ -350,7 +382,14 @@ public class ValidationUtil {
 			}
 			number = String.class.cast(obj);
 			try {
-				return Long.parseLong(number);
+				Long num = Long.parseLong(number);
+				if (num < min) {
+					throw new OutOfRangeException("最小值应该大于等于"+min);
+				}
+				if(num > max){
+					throw new OutOfRangeException("最大值应该小于等于"+max);
+				}
+				return num;
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -361,9 +400,12 @@ public class ValidationUtil {
 			if (e instanceof NumberFormatException) {
 				throw new RuntimeException("数据类型解析异常");
 			}
+			if (e instanceof OutOfRangeException) {
+				throw new OutOfRangeException(e.getMessage());
+			}
 			Long num = null;
 			try {
-				num=Long.parseLong(""+obj);
+				num=Long.parseLong(String.valueOf(obj));
 			} catch (Exception e1) {
 				throw new RuntimeException("数字解析异常");
 			}
@@ -575,7 +617,7 @@ public class ValidationUtil {
 				return defaultInt;
 			}
 			try {
-				return Integer.parseInt(number);
+				return Integer.parseInt(number.trim());
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -615,7 +657,7 @@ public class ValidationUtil {
 				return defaultLong;
 			}
 			try {
-				return Long.parseLong(number);
+				return Long.parseLong(number.trim());
 			} catch (NumberFormatException e) {
 				throw new NumberFormatException();
 			}
@@ -625,15 +667,13 @@ public class ValidationUtil {
 			}
 			Long num = null;
 			try {
-				num=Long.parseLong(""+obj);
+				num=Long.parseLong(String.valueOf(obj));
 			} catch (Exception e1) {
 				throw new RuntimeException("Long解析异常");
 			}
 			return num;
 		}
 	}
-	
-
 	/*public static void main(String[] args) {
 		String json="{'KEY1':'12','KEY2':23,'KEY3':null}";
 		Map parseObject = JSON.parseObject(json, Map.class);
@@ -644,5 +684,15 @@ public class ValidationUtil {
 //		Long cast = Long.class.cast(1L);
 //		System.out.println(checkAndAssignDefaultLong);
 	}*/
+}
 
+class OutOfRangeException extends RuntimeException{
+	public OutOfRangeException() {}
+	public OutOfRangeException(String message) {
+		super(message);
+	}
+	@Override
+	public String getMessage() {
+		return super.getMessage();
+	}
 }

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

@@ -419,8 +419,6 @@ public class BusinessDeclareAction {
 			return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(), null);
 		}
 	}
-			
-	
 	
 	/**
 	* @Title: download

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

@@ -57,7 +57,7 @@ public class ProjectFileAction {
 	 * TODO(获取项目文档信息,用于展示项目文档基本信息展示) 
 	 * 			以下为前端传递过来的参数
 				 {
-				 	"userId":"XXX"
+				 	"userId":"XXX",
 					"page":"1",
 					"projectName":"",
 					"startTime":"",
@@ -70,12 +70,12 @@ public class ProjectFileAction {
 	 * @author ylx 
 	 * @date 2017年12月15日下午1:24:40
 	 */
-	@SuppressWarnings("unchecked")
 	@RequestMapping(value = "/queryProjectFileInformation")
 	@ResponseBody
 	public Map<String, Object> queryProjectFileInformation(@RequestBody String data) {
 		try {
 			System.out.println("查询项目文档记录信息....");
+			@SuppressWarnings("unchecked")
 			Map<String, String> map = JSON.parseObject(data, Map.class);	//将前端传过来的json数据转化为map对象,并将map对象传入service层进行数据校验
 			int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));	//userId只要是一个int类型即可
 			int page = ValidationUtil.checkMinAndAssignInt(map.get("page"), 1); // 默认页数是第一页
@@ -106,10 +106,11 @@ public class ProjectFileAction {
 	* @Title: checkoutProjectFiles
 	* @Description: TODO--------------->>显示下载文件的提示框
 	* 				以下为前端传递过来的参数
+	* 			注意:projectId和projectName必须要传两个且都要传正确,否则不会返回任何结果
 				 {
-				 	"userId":"XXX"
+				 	"userId":"XXX",
 					"projectId":"",
-					"projectName":"",
+					"projectName":""
 				}
 	* @param @param data
 	* @param @return    设定文件
@@ -132,7 +133,7 @@ public class ProjectFileAction {
 			mapToService.put("userId", userId);
 			mapToService.put("projectId", projectId);
 			mapToService.put("projectName", projectName);
-			Map<String, Object> mapFromService = projectFileService.checkoutProjectFiles(map); //由于这里不需要分页,只要service传过来一个map对象即可
+			Map<String, Object> mapFromService = projectFileService.checkoutProjectFiles(mapToService); //由于这里不需要分页,只要service传过来一个map对象即可
 			return JSONUtil.getJsonMap(200, true, HintMSG.CHECK_SUCCESS, mapFromService); //将从service返回回来的map对象通过map对象直接返回给前端
 		} catch (Exception e) {
 			return JSONUtil.getJsonMap(500, false, HintMSG.CHECK_FAIL+":"+e.getMessage(), null); 
@@ -187,7 +188,7 @@ public class ProjectFileAction {
 	* @Description: TODO------------->>显示项目文档上传的界面
 	* 			以下为前端传递过来的参数
 				 {
-				 	"userId":"XXX"
+				 	"userId":"XXX",
 					"projectId":"",
 					"projectName":"",
 				}