Browse Source

new updated

ylx 7 years ago
parent
commit
7329cd4c2c

+ 1 - 0
ccb_fund_trusteeship/src/main/java/com/fuzamei/constant/OperationTypeId.java

@@ -30,5 +30,6 @@ public class OperationTypeId {
 	public static final Integer CHARGE_BUSINESS_ACCOUNTING =1019;        //待核算主管岗审核
 	public static final Integer CHARGE_BUSINESS_ACCOUNTING_YES =1020;     //核算主管岗通过
 	public static final Integer CHARGE_BUSINESS_ACCOUNTING_NO =1021;      //核算主管岗审核不通过
+	public static final Integer CHECK_TRUE_OR_FALSE =1022;      			//真伪查询
 	
 }

+ 0 - 3
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/TrueFalseSelectDao.java

@@ -12,9 +12,6 @@ public class TrueFalseSelectDao {
 	@Autowired
 	private TrueFalseSelectMapper trueFalseSelectMapper;
 	
-	public void insertTrueFalseSelect(Map<String, Object> map) {//真伪查询   记录插入到附件表
-		trueFalseSelectMapper.insertTrueFalseSelect(map);
-	}
 	public void insertOperationHistory(Map<String, Object> map) {// 真为查询 插入到操作记录表    
 		trueFalseSelectMapper.insertOperationHistory(map);
 	}

+ 0 - 15
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/TrueFalseSelect.xml

@@ -1,21 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fuzamei.mapperInterface.TrueFalseSelectMapper"> 
-	<!-- 真伪查询  往附件表插入数据 -->
-	<insert id="insertTrueFalseSelect" parameterType="java.util.Map">
-		   insert into attachment (
-	                attachment_id,
-	                attachment_name,
-	                url,
-	                upload_person_id,
-	                create_time) 
-	          values(
-	               #{attachment_id},
-	               #{attachment_name},
-	               #{url},
-	               #{upload_person_id},
-	               #{create_time} );
-	</insert>
    <!--真伪查询往操作记录表插入一天信息  -->
    <insert id="insertOperationHistory">
 		insert into 

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

@@ -3,6 +3,5 @@ package com.fuzamei.mapperInterface;
 import java.util.Map;
 
 public interface TrueFalseSelectMapper {
-	public void insertTrueFalseSelect(Map<String, Object> map);//真伪查询   记录插入到附件表
 	public void insertOperationHistory(Map<String, Object> map);//真伪查询  往操作记录表查询
 }

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

@@ -1,19 +1,14 @@
 package com.fuzamei.service;
 
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
 import com.fuzamei.constant.Role;
 import com.fuzamei.dao.OperationHistoryDao;
 import com.fuzamei.dao.UserAuthoricationDao;
 import com.fuzamei.entity.OperationHistory;
-import com.fuzamei.entity.OperationHistoryBO;
 import com.fuzamei.entity.UserDetail;
-import com.fuzamei.utils.DateUtil;
 import com.fuzamei.utils.PageDTO;
 import com.fuzamei.utils.StringUtil;
 
@@ -27,7 +22,6 @@ public class OperationHistoryService {
 	private UserAuthoricationDao userAuthoricationDao;
 
 	/**
-	 * 
 	* @Title: queryOperationHistoryInformation
 	* @Description: TODO(根据用户的id号查询操作记录,但是现在只做了风管岗可以查看所有的信息,)
 	* @param @param map
@@ -68,10 +62,7 @@ public class OperationHistoryService {
 		return pageDto;
 	}
 
-	
-
 	/**
-	 * 
 	* @Title: queryOperationHistoryInformation
 	* @Description: TODO(controller层通过对象的形式传入信息查询)
 	* @param @param operationHistoryBO
@@ -126,5 +117,4 @@ public class OperationHistoryService {
 		map.put("Account", account);
 		informationList = operationHistoryDao.queryOperationHistoryInformationByUser(map); 
 	}*/
-
-}
+}

+ 30 - 42
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/TrueFalseSelectService.java

@@ -7,62 +7,50 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.fuzamei.constant.OperationTypeId;
 import com.fuzamei.dao.TrueFalseSelectDao;
+import com.fuzamei.entity.UserDetail;
 
 @Service
 public class TrueFalseSelectService {
 
 	   @Autowired
-	   private TrueFalseSelectDao  trueFalseSelectDao;
+	   private TrueFalseSelectDao trueFalseSelectDao;
 	   
 	   /**
 		 * 真伪查询
 		 * @param map
 		 */
-		@Transactional
-		public void insertTrueFalseSelect(Map<String, Object> map) {
-		    String attachment_id="";    //附件id
-		    String attachment_name="";  //附件名称
-		    String url="";              //附件url
-		    String upload_person_id=""; //附件上传人的id
-		    long create_time=0;         //附件添加的时间
-		  
-		    String fileName="";
-			if (!"".equals(map.get("attachment_id")) && map.get("attachment_id") != null) { 
-				attachment_id = (String) map.get("attachment_id");
-			}
-			if (!"".equals(map.get("attachment_name")) && map.get("attachment_name") != null) { 
-				attachment_name = (String) map.get("attachment_name");
-			}
-			if (!"".equals(map.get("url")) && map.get("url") != null) { 
-				url = (String) map.get("url");
-			}
-			if (!"".equals(map.get("upload_person_id")) && map.get("upload_person_id") != null) {   
-				upload_person_id = (String) map.get("upload_person_id");
-			}
-			if (!"".equals(map.get("create_time")) && map.get("create_time") != null) { 
-				create_time = (Long) map.get("create_time");
-			}
-		    
-	         
-			Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
-			  mapToDao.put("attachment_id",Math.round(Math.random()*8999+1000000));//附件id  目前写随机数
-			  mapToDao.put("attachment_name", attachment_name);//附件名称    
-			  mapToDao.put("url", url);//附件url   后面有下载的   需要地址
-			  mapToDao.put("upload_person_id", 223346);//附件人上传的id这里写的是死值   待修改
-			  mapToDao.put("create_time", System.currentTimeMillis());//附件添加时间,这里应该写添加得到的当前系统时间  
-			  trueFalseSelectDao.insertTrueFalseSelect(mapToDao);//把数据插入到 (附件表)里
-			  
+		@Transactional(rollbackFor=Exception.class)
+		public boolean insertTrueFalseSelect(Map<String, Object> map) {
+			long currentTime = System.currentTimeMillis();
+			UserDetail userDetail=(UserDetail) map.get("userDetail");
+			
+			
+			
+			
+			
+			/*boolean flag=false;
+			 * 根据controller层传过来的hash值去查询该hash值是否有效=============================================>>待定TODO
+			 * 
+			 * */
+			boolean flag=false;
+			
+			
+			
+			
+			
 			//还要将真伪查询上传的这个操作信息插入到操作记录表中
 			Map<String, Object> mapToOperationHistory = new LinkedHashMap<String,Object>();
-				mapToOperationHistory.put("operatorTypeId", 1002);						//id应该是写死的目前
-				mapToOperationHistory.put("operatorAccount", 600000289);				//操作账号先定死,到时候再改
-				mapToOperationHistory.put("operatorRole", "经办支行8");					//创建这个操作的角色只能是经办支行
-				mapToOperationHistory.put("operatorPerson", "张八");						//操作人先写死
-				mapToOperationHistory.put("operatorTime", mapToDao.get("create_time")); //操作时间为当前操作时间
-				mapToOperationHistory.put("hash", "222aa5d8c8c7s8s7");	                //写的时死值
-				trueFalseSelectDao.insertOperationHistory(mapToOperationHistory);           //操作记录信息插入到操作记录表中     
+			mapToOperationHistory.put("operatorTypeId", OperationTypeId.CHECK_TRUE_OR_FALSE);	//id写活♥
+			mapToOperationHistory.put("operatorAccount", userDetail.getAccount());				//操作账号写活♥
+			mapToOperationHistory.put("operatorRole", userDetail.getRole_name().get(0));		//操作角色暂定为一个账号只对应一个角色========>>待定TODO
+			mapToOperationHistory.put("operatorPerson", userDetail.getPerson_name());			//操作人死活
+			mapToOperationHistory.put("operatorTime", currentTime); //操作时间为当前操作时间
+			mapToOperationHistory.put("hash", "to be calculated");	                //写的时死值
+			trueFalseSelectDao.insertOperationHistory(mapToOperationHistory);       //操作记录信息插入到操作记录表中     
 		
+			return flag;
 		}
 	
 	

+ 6 - 2
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/UserAuthoricationService.java

@@ -32,8 +32,12 @@ public class UserAuthoricationService {
 		}
 		List<String> roleList = userDetail.getRole_name();
 		boolean temp = false;
-		for (String string : authority) {
-			temp=roleList.contains(string)||temp;
+		if(authority.length!=0){
+			for (String string : authority) {
+				temp=roleList.contains(string)||temp;
+			}
+		}else{
+			return userDetail;
 		}
 		if(!temp){
 			throw new RuntimeException("无权操作");

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

@@ -65,8 +65,6 @@ public class BusinessDeclareAction {
 	@Autowired
 	private AttachmentService attachmentService;
 	
-	private static final String SP=File.separator;
-	
 	private static final int ROW_NUM = 10; // 分页每页显示数据的数量
 	/**
 	 * 
@@ -208,13 +206,13 @@ public class BusinessDeclareAction {
 	* @Description: TODO(业务申报的查看,将所有信息返还给界面)
 	* @param @param data
 	* 				前端传来的数据json格式为
-	* 				{
-	* 					"userId":XXX,
-	* 					"businessName":"",
-	* 					"page":"",
-	* 					"startTime":"",
-	* 					"endTime":""
-	* 				}
+	 				{
+	 					"userId":"XXX",
+	 					"businessName":"",
+	 					"page":"1",
+	 					"startTime":"",
+	 					"endTime":""
+	 				}
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
 	* @author ylx
@@ -242,11 +240,10 @@ public class BusinessDeclareAction {
 			mapToService.put("startPage", (page - 1) * ROW_NUM);
 			mapToService.put("businessName", businessName);
 			//如果时间顺序错位,要重新进行排位
+			mapToService.put("startTime", startTime);
 			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条,可根据需求修改分页数量
@@ -302,12 +299,12 @@ public class BusinessDeclareAction {
 	* @Description: TODO(审核意见的提交)
 	* @param @param data	
 	* 数据json包含
-	* 		{ 
-	* 		 	"checkResult":结果(同意5或者不同意6---数字以状态表为准),
-	* 		 	"checkOpinion":审核意见,
-	* 		 	"businessId":业务id,
-	* 			"userId":XXX
-	* 		}
+	 		{ 
+	 		 	"checkResult":结果(同意5或者不同意6---数字以状态表为准),
+	 		 	"checkOpinion":审核意见,
+	 		 	"businessId":业务id,
+	 			"userId":XXX
+	 		}
 	* @param @return    设定文件
 	* @return Map<String,Object>    返回类型
 	* @author ylx

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

@@ -77,11 +77,10 @@ public class OperationHistoryAction {
 			mapToService.put("account", account);
 			mapToService.put("role", role);
 			mapToService.put("type", type);
+			mapToService.put("startTime", startTime);
 			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条,可根据需求修改分页数量

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

@@ -86,11 +86,10 @@ public class ProjectFileAction {
 			mapToService.put("userId", userId);					//用户id用于查询权限或者角色信息
 			mapToService.put("startPage", (page - 1) * ROW_NUM);
 			mapToService.put("projectName", projectName);
+			mapToService.put("startTime", startTime);
 			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条,可根据需求修改分页数量

+ 53 - 35
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/TrueFalseSelectAction.java

@@ -15,59 +15,77 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
 
+import com.fuzamei.constant.HintMSG;
+import com.fuzamei.entity.UserDetail;
 import com.fuzamei.service.TrueFalseSelectService;
+import com.fuzamei.service.UserAuthoricationService;
 import com.fuzamei.utils.HashXiZhiUtil;
 import com.fuzamei.utils.JSONUtil;
+import com.fuzamei.utils.ValidationUtil;
 
+/**
+ * 
+ * @author chb & ylx
+ * @describe 真伪查询模块
+ * @date 2018-1-4 12:17
+ */
 @Controller
-@RequestMapping(value = "/TrueFalseSelect")
+@RequestMapping(value = "/query_true_or_false")
 public class TrueFalseSelectAction {
+	
 	@Autowired
 	private TrueFalseSelectService trueFalseSelectService;
+	
+	private static final String SP = File.separator;
+
+	@Autowired
+	private UserAuthoricationService userAuthoricationService;
 	/**  
      * 真伪查询 上传文件  产生一条哈希值
+     * 判断hash值是否有效???
      * @param  
      * @param   
      * @throws Exception  
      */  
     @RequestMapping(value="/trueFalseSelect",method=RequestMethod.POST)  
     @ResponseBody  
-    public Map<String,Object> trueFalseSelect(@RequestParam("file") MultipartFile file,HttpServletRequest request) throws IOException{  
+    public Map<String,Object> trueFalseSelect(@RequestParam("file") MultipartFile file,
+    										  HttpServletRequest request,
+    										  @RequestParam("userId") Object uId) throws IOException{  
        try {
-    	   String path = "D:\\tomcate\\apache-tomcat-8.5.24\\webapps"+request.getServletContext().getContextPath()+"\\Ceshi";  
-           File dir = new File(path);          
-           if(!dir.exists()){  
-               dir.mkdirs();  
-           }  
-           //MultipartFile自带的解析方法  
-           String fileName = file.getOriginalFilename();  
-           String pathFile=path+"/"+fileName;
-           File newfile = new File(pathFile); 
-           file.transferTo(newfile);
-           
-   		   Map<String, Object> map = new LinkedHashMap<String, Object>();
-   		   map.put("attachment_name", fileName);
-   		   map.put("url",fileName);
-   		   trueFalseSelectService.insertTrueFalseSelect(map);
-           
-           //是上传文件之后才会产生一条哈希值的  然后在对哈希值做操作
-          // HashXiZhiUtil.getMd5("D:\\xiangnu\\123.doc");
-         String hash=HashXiZhiUtil.getMD5Checksum(pathFile);//调用方法 对(文件)产生一条哈希值
-        
-        System.out.println( HashXiZhiUtil.getMD5Checksum(pathFile)+"--哈希值");//测试
-       	Map<String, Object> mapResult=JSONUtil.getJsonMap(200, true, "上传成功", null);//将查询出来的结果封装成map数据返回
-       	//mapResult.put("hash", hash);返回哈希值给前端
-       	 return mapResult ;
-		}
-       catch (Exception e) {
-			Map<String, Object> mapResult=JSONUtil.getJsonMap(500, true, "上传失败"+e.getMessage(), null);
-			return mapResult ;
+    	   	//非空校验
+		   	if(file.isEmpty()){
+		   		throw new RuntimeException("上传文件不能为空");
+		   	}
+		   	int userId = ValidationUtil.checkAndAssignInt(uId);//对用户id进行校验
+		   	UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId);//获取用户详细信息
+		   	
+		   	String path = request.getServletContext().getRealPath("")+SP+"content"; //==>>待定TODO
+	       	
+	       	//MultipartFile自带的解析方法  
+	       	String fileName = file.getOriginalFilename();  
+	       	String pathFile=path+"/"+fileName;
+	       	File newfile = new File(pathFile);
+	       	File dir = new File(path);
+	       	//======文件开始上传=======
+	       	if(!dir.exists()){  
+	           	dir.mkdirs();  
+	       	}  
+	       	file.transferTo(newfile);
+	       	//======文件上传结束=======
+	       	//是上传文件之后才会产生一条哈希值的  然后在对哈希值做操作
+	       	// HashXiZhiUtil.getMd5("D:\\xiangnu\\123.doc");
+	       	String hash=HashXiZhiUtil.getMD5Checksum(pathFile);//调用方法 对(文件)产生一条哈希值
+	      	newfile.delete();
+		  	Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+		  	mapToService.put("hash", hash);
+		  	mapToService.put("userDetail", userDetail);
+		  	boolean flag=trueFalseSelectService.insertTrueFalseSelect(mapToService);
+		  	System.out.println(hash);
+       	 	return JSONUtil.getJsonMap(200, true, HintMSG.CHECK_SUCCESS, flag);
+		}catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.CHECK_FAIL+":"+e.getMessage(), null);
 		}
     }  
 	
-	
-	
-	
-	
-	
 }

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

@@ -100,11 +100,10 @@ public class ValuationAccountingAction {
 			mapToService.put("fundName", fundName);
 			mapToService.put("battleResult", battleResult);
 			//如果时间顺序错位,要重新进行排位
+			mapToService.put("startTime", startTime);
 			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条,可根据需求修改分页数量