Browse Source

new updated

ylx 7 years ago
parent
commit
48e5a5af90

+ 23 - 22
ccb_fund_trusteeship/src/main/java/com/fuzamei/constant/OperationTypeId.java

@@ -8,28 +8,29 @@ public class OperationTypeId {
 	private OperationTypeId() {
 		throw new AssertionError("禁止实例化");
 	}
-	public static final Integer BUSINESS_APPLY =1001;						//业务申报
-	public static final Integer BUSINESS_FIRST_TRIAL_AGREED =1002;			//业务初审通过
-	public static final Integer BUSINESS_REEXAMINE_REJECTED =1003;			//业务复审拒绝
-	public static final Integer CONTRACT_UPLOAD =1004;						//合同上传
-	public static final Integer CONTRACT_CONFIRM =1005;						//合同确认
-	public static final Integer CAPITAL_TRANSFER_FIRST_TRIAL =1006;			//资金划转初审
-	public static final Integer CAPITAL_TRANSFER_REEXAMINE =1007;			//资金划转复审
-	public static final Integer CAPITAL_TRANSFER_REEXAMINE_REJECTED =1008;	//资金划转复审拒绝
-	public static final Integer CAPITAL_TRANSFER_FINAL_JUDGE =1009;			//资金划转终审
-	public static final Integer UPLOAD_VALUATION_CHECK =1010;				//上传估值核算表
-	public static final Integer UPLOAD_PROJECT_FILE =1011;					//上传项目文档
-	public static final Integer BUSINESS_FIRST_TRIAL_REJECTED =1012;		//业务初审拒绝
-	public static final Integer BUSINESS_REEXAMINE_AGREED =1013;			//业务复审通过
+	public static final Integer BUSINESS_APPLY =1001;								//业务申报
+	public static final Integer BUSINESS_FIRST_TRIAL_AGREED =1002;					//业务初审通过
+	public static final Integer BUSINESS_REEXAMINE_REJECTED =1003;					//业务复审拒绝
+	public static final Integer CONTRACT_UPLOAD =1004;								//合同上传
+	public static final Integer CONTRACT_CONFIRM =1005;								//合同确认
+	public static final Integer CAPITAL_TRANSFER_FIRST_TRIAL =1006;					//资金划转初审
+	public static final Integer CAPITAL_TRANSFER_REEXAMINE =1007;					//资金划转复审
+	public static final Integer CAPITAL_TRANSFER_REEXAMINE_REJECTED =1008;			//资金划转复审拒绝
+	public static final Integer CAPITAL_TRANSFER_FINAL_JUDGE =1009;					//资金划转终审
+	public static final Integer UPLOAD_VALUATION_CHECK =1010;						//上传估值核算表
+	public static final Integer UPLOAD_PROJECT_FILE =1011;							//上传项目文档
+	public static final Integer BUSINESS_FIRST_TRIAL_REJECTED =1012;				//业务初审拒绝
+	public static final Integer BUSINESS_REEXAMINE_AGREED =1013;					//业务复审通过
 	
-	public static final Integer CAPITAL_TRANSFER_REEXAMINE_REJECTED_NO =1014;          //资金划转终身拒绝
-	public static final Integer INSTRUCT_BUSINESS_ACCOUNTING =1015;      //待指令业务岗审核
-	public static final Integer INSTRUCT_BUSINESS_ACCOUNTING_NO =1016;    //指令业务岗审核不通过
-	public static final Integer CHECK_BUSINESS_ACCOUNTING =1017;        //待核算业务岗岗审核
-	public static final Integer CHECK_BUSINESS_ACCOUNTING_NO =1018;      //核算业务岗审核不通过
-	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;      			//真伪查询
+	public static final Integer CAPITAL_TRANSFER_REEXAMINE_REJECTED_NO =1014;       //资金划转终身拒绝
+	public static final Integer INSTRUCT_BUSINESS_ACCOUNTING =1015;      			//待指令业务岗审核
+	public static final Integer INSTRUCT_BUSINESS_ACCOUNTING_NO =1016;    			//指令业务岗审核不通过
+	public static final Integer CHECK_BUSINESS_ACCOUNTING =1017;        			//待核算业务岗岗审核
+	public static final Integer CHECK_BUSINESS_ACCOUNTING_NO =1018;      			//核算业务岗审核不通过
+	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;      					//真伪查询
+	public static final Integer UPLOAD_PROMPT_LETTER =1023;      					//上传提示函
 	
 }

+ 6 - 9
ccb_fund_trusteeship/src/main/java/com/fuzamei/dao/PromptLetterDao.java

@@ -13,11 +13,8 @@ import com.fuzamei.mapperInterface.PromptLetterMapper;
 public class PromptLetterDao {
 	@Autowired
 	private PromptLetterMapper  promptLetterMapper;
-	public List<PromptLetter> selectPromptLetter(Map<String, Object> map){//查询风险提示函  管理人接收人
-		return promptLetterMapper.selectPromptLetter(map);
-	}
-	public List<PromptLetter> selectTishihan(Map<String, Object> map){//查询风险提示函3   发送人
-		return promptLetterMapper.selectTishihan(map);
+	public List<PromptLetter> queryPromptLetterByAdmin(Map<String, Object> map){//查询风险提示函  管理人接收人
+		return promptLetterMapper.queryPromptLetterByAdmin(map);
 	}
 	public void insertIntoPromptLetterTable(Map<String, Object> map) {//数据往提示函插入
 		promptLetterMapper.insertIntoPromptLetterTable(map);
@@ -28,11 +25,11 @@ public class PromptLetterDao {
 	public void insertOperationHistory(Map<String, Object> map) {//也插入一条数据到操作记录表   
 		promptLetterMapper.insertOperationHistory(map);
 	}
-	public  int  serchCountPage2(Map<String, Object> map){//提示函 列返回总页数   发送
-		return  promptLetterMapper.serchCountPage2(map);
+	public int findAllInformation(Map<String, Object> map) {
+		return promptLetterMapper.findAllInformation(map);
 	}
-	public  int  serchCountPage3(Map<String, Object> map){//提示函 列返回总页数   接收
-		return  promptLetterMapper.serchCountPage3(map);
+	public List<PromptLetter> queryPromptLetterByVenture(Map<String, Object> map) {
+		return promptLetterMapper.queryPromptLetterByVenture(map);
 	}
 	
 }

+ 57 - 39
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapper/PromptLetter.xml

@@ -2,17 +2,43 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fuzamei.mapperInterface.PromptLetterMapper"> 
 	<!--提示函  管理人接收列表  -->
-	<select id="selectPromptLetter" parameterType="java.util.Map" resultType="com.fuzamei.entity.PromptLetter">
-	   select   t.prompt_letter_id,
-	            f.attachment_name, 
-			    f.url,
-			    t.receive_time 
-		 from   prompt_letter t left join attachment f on t.prompt_letter_id=f.attachment_id  
+	<select id="queryPromptLetterByAdmin" resultType="com.fuzamei.entity.PromptLetter">
+	   	select   
+	   		t.prompt_letter_id,
+	        f.attachment_name, 
+			f.url,
+			t.receive_time 
+		from   
+			prompt_letter t 
+		left join 
+			attachment f 
+		on 
+			t.prompt_letter_id=f.attachment_id  
 		 <where>
-		     receive_time between #{startTime} and #{endTime}
+		 	receive_person=#{receiverId}
+		 	<if test="startTime!=null and endTime != null">
+		    	and receive_time between #{startTime} and #{endTime}
+		 	</if>
+		 </where>
+		 order by 
+		     receive_time desc  
+		 limit #{startPage},#{rowNum}	
+	</select>
+	
+	<!-- 根据条件查出符合条件的所有信息条数 -->
+	<select id="findAllInformation" resultType="int">
+		select 
+			count(*)
+		from 
+			prompt_letter
+		<where>
+			<if test="receiverId!=null">
+				receive_person=#{receiverId}
+			</if>
+		 	<if test="startTime!=null and endTime != null">
+		    	and receive_time between #{startTime} and #{endTime}
+		 	</if>
 		 </where>
-		     order by receive_time desc  limit #{startPage},#{rowNum}	
-		 
 	</select>
 	
 	<!--提示函上传 插入数据到提示函表  -->
@@ -66,38 +92,30 @@
 			   #{hash})
 	</insert>
     <!--发送记录查询风险提示函 ,省分行托管中心风管岗   发送时间列biao-->
-	<select id="selectTishihan" parameterType="java.util.Map" resultType="com.fuzamei.entity.PromptLetter">
-	    select  t.prompt_letter_id , 
-	            y.person_name , 
-	            f.attachment_name,
-	            f.url,
-	            t.send_time    
-	     from   prompt_letter t left  join  attachment f  on t.prompt_letter_id=f.attachment_id left  join t_user y on  t.send_person=f.attachment_id	     
+	<select id="queryPromptLetterByVenture" resultType="com.fuzamei.entity.PromptLetter">
+	   	select 
+	   		t.prompt_letter_id, 
+	        y.person_name, 
+	        f.attachment_name,
+	        f.url,
+	        t.send_time    
+	   	from   
+			prompt_letter t 
+		left  join  
+			attachment f  
+		on 
+			t.prompt_letter_id=f.attachment_id 
+		left  join 
+			t_user y 
+		on  
+			t.receive_person=y.user_id   
 		<where>
-		    <if test="startTime!='' and endTime != ''">
-		    	t.send_time  between #{startTime} and #{endTime}
+		    <if test="startTime!=null and endTime != null">
+		    	t.send_time between #{startTime} and #{endTime}
 		   </if>
 		</where>
-		      order by send_time desc
-	          limit #{startPage},#{rowNum}
-	</select>
-	<!--查询提示函  返回总页数   发送列表待条件分页-->
-	 <select id="serchCountPage2" resultType="int">
-	     select count(*)  from prompt_letter 
-	  <where>
-	        <if test="startTime!=null and endTime!=null">
-				 send_time between #{startTime} and #{endTime}
-			</if>
-	  </where>
-	</select>
-	<!--查询提示函  返回总页数   接收列表待条件分页-->
-	 <select id="serchCountPage3" resultType="int">
-	     select count(*)  from prompt_letter 
-	  <where>
-	        <if test="startTime!=null and endTime!=null">
-				 receive_time between #{startTime} and #{endTime}
-			</if>
-	  </where>
+		order by 
+			send_time desc
+	    limit #{startPage},#{rowNum}
 	</select>
-
 </mapper>

+ 4 - 4
ccb_fund_trusteeship/src/main/java/com/fuzamei/mapperInterface/PromptLetterMapper.java

@@ -6,12 +6,12 @@ import java.util.Map;
 import com.fuzamei.entity.PromptLetter;
 
 public interface PromptLetterMapper {
-	public List<PromptLetter> selectPromptLetter(Map<String, Object> map);//查询风险提示函     接收人列表
-	public List<PromptLetter> selectTishihan(Map<String, Object> map);//查询风险提示函 ,省分行拓托管中心风管岗    发送列表
+	
+	public List<PromptLetter> queryPromptLetterByAdmin(Map<String, Object> map);//查询风险提示函     接收人列表
 	public void insertIntoPromptLetterTable(Map<String, Object> map);//提示函插入数据信息
 	public void insertIntoAttachmentTable(Map<String, Object> map);//提示函数据在往附件表也插入
 	public void insertOperationHistory(Map<String, Object> map);//提示函也往操作记录表李插入
-	public  int serchCountPage2(Map<String, Object> map);//提示函列表返回总页数or带条件查询分页   发送
-	public  int serchCountPage3(Map<String, Object> map);//提示函列表返回总页数or带条件查询分页   接收
+	public int findAllInformation(Map<String, Object> map);//根据条件查询所有符合的信息条数
+	public List<PromptLetter> queryPromptLetterByVenture(Map<String, Object> map);
 	
 }

+ 64 - 166
ccb_fund_trusteeship/src/main/java/com/fuzamei/service/PromptLetterService.java

@@ -8,187 +8,85 @@ 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.constant.Role;
 import com.fuzamei.dao.PromptLetterDao;
 import com.fuzamei.entity.PromptLetter;
+import com.fuzamei.entity.UserDetail;
 import com.fuzamei.utils.PageDTO;
 
 @Service
 public class PromptLetterService {
 	@Autowired
 	private PromptLetterDao promptLetterDao;
-	private static final int ROW_NUM = 10; // 分页每页显示数据的数量
+
 	/**
-	 * 提示函  管理人接收列表
+	 * 提示函 管理人接收列表
+	 * 
 	 * @param map
 	 * @return
 	 */
-    public PageDTO selectPromptLetter(Map<String, Object> map){//查询风险提示函
-		int page = 1; // 默认页是第一页
-		
-		long startTime = 0L; // 开始时间默认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("startTime")) && map.get("startTime") != null) { // 等于空就直接取空值
-			try {
-				startTime = Long.parseLong((String) map.get("startTime"));
-			} catch (NumberFormatException e) {
-				startTime = 0L; // 数据解析异常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
-			}
-		}
+	public PageDTO selectPromptLetter(Map<String, Object> map) {// 查询风险提示函
 		PageDTO pageDto = new PageDTO(); // 创建分页对象
-		Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
-		mapToDao.put("startPage", (page - 1) * ROW_NUM);
-		if (startTime <= endTime) {
-			mapToDao.put("startTime", startTime);
-			mapToDao.put("endTime", endTime);
-		} else {
-			mapToDao.put("startTime", startTime);
-			mapToDao.put("endTime", Long.MAX_VALUE);
+		UserDetail userDetail = (UserDetail) map.get("userDetail");
+		if(userDetail.getRole_name().contains(Role.ADMIN)){
+			//将管理员的id号封装进map到数据库查询
+			map.put("receiverId", userDetail.getUser_id());
+			List<PromptLetter> list = promptLetterDao.queryPromptLetterByAdmin(map);
+			int count = promptLetterDao.findAllInformation(map);
+			pageDto.setTotal(count);
+			pageDto.setRows(list);
+			return pageDto;
+		}
+		if(userDetail.getRole_name().contains(Role.VENTURE_MANAGEMENT_POS)){
+			List<PromptLetter> list = promptLetterDao.queryPromptLetterByVenture(map);
+			int count = promptLetterDao.findAllInformation(map);
+			pageDto.setTotal(count);
+			pageDto.setRows(list);
+			return pageDto;
 		}
-		mapToDao.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
-		int count = promptLetterDao.serchCountPage3(mapToDao);
-		List<PromptLetter> list=promptLetterDao.selectPromptLetter(mapToDao);
-		pageDto.setTotal(count);
-		pageDto.setRows(list);
-		return pageDto;
+		throw new RuntimeException("无权限操作");
 	}
-    //////////////////////////////////////////////////////////////////////////////////////////////
-    /**
-     * 提示函  风管岗发送列表查询
-     * @param map
-     * @return
-     */
- 	public PageDTO selectTishihan(Map<String, Object> map){//查询风险提示函
- 		int page = 1; // 默认页是第一页
- 		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("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; 
- 			}
- 		}
- 		PageDTO pageDto = new PageDTO(); // 创建分页对象
- 		Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
- 		mapToDao.put("startPage", (page - 1) * ROW_NUM);
- 		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条,可根据需求修改分页数量
- 		int count = promptLetterDao.serchCountPage2(mapToDao);
- 		List<PromptLetter> list=promptLetterDao.selectTishihan(mapToDao);
- 		pageDto.setTotal(count);
- 		pageDto.setRows(list);
- 		return pageDto;
- 	}
- 	///////////////////////////////////////////////////////////////////////////////////////////////////
- 	 /**
-     * 提示函  发函  上传文件
-     * @param map
-     */
-	@Transactional
+
+	/**
+	 * 提示函 发函 上传文件
+	 * 
+	 * @param map
+	 */
+	@Transactional(rollbackFor = Exception.class)
 	public void insertTiShiHanOrUserOrOtherTable(Map<String, Object> map) {
-	    Integer prompt_letter_id=null;
-	    String prompt_letter_name="";
-	    Integer  send_person=null;
-	    Integer receive_person=null;
-	    long send_time=0;
-	    long receive_time=0;
-	    String hash="";
-		String url="";					//url路径名称
-		String attachmentName="";		//附件名称
-		 if (!"".equals(map.get("url")) && map.get("url") != null) { 
-			 url = (String) map.get("url");
-			}
-	    if (!"".equals(map.get("attachmentName")) && map.get("attachmentName") != null) { 
-	    	attachmentName = (String) map.get("attachmentName");
-		}
-	    if (!"".equals(map.get("prompt_letter_id")) && map.get("prompt_letter_id") != null) { 
-	    	prompt_letter_id = Integer.parseInt((String) map.get("prompt_letter_id"));
-		}
-	    if (!"".equals(map.get("prompt_letter_name")) && map.get("prompt_letter_name") != null) { 
-	    	prompt_letter_name = (String) map.get("prompt_letter_name");
-		}
-	    if (!"".equals(map.get("send_person")) && map.get("send_person") != null) { 
-	    	send_person = Integer.parseInt((String) map.get("send_person"));
-		}
-	    if (!"".equals(map.get("receive_person")) && map.get("receive_person") != null) { 
-	    	receive_person = Integer.parseInt((String) map.get("receive_person"));
-		}
-	    if (!"".equals(map.get("receive_time")) && map.get("receive_time") != null) { 
-	    	receive_time = (Long) map.get("receive_time");
-		}
-	    if (!"".equals(map.get("send_time")) && map.get("send_time") != null) { 
-	    	send_time = (Long) map.get("send_time");
-		}
-	    if (!"".equals(map.get("hash")) && map.get("hash") != null) { 
-	    	hash = (String) map.get("hash");
-		}
-	    	//Math.round(Math.random()*8999+1000)随机数
-		 Map<String, Object> mapToDao2 = new LinkedHashMap<String, Object>();
-		  mapToDao2.put("prompt_letter_id", prompt_letter_id);//提示函 id
-		  mapToDao2.put("prompt_letter_name",attachmentName);//提示函名称    目前写的是文件名称   
-		  mapToDao2.put("send_person",123456789);//发送人暂时写死的  ??  是不是应该获取登陆人的id???? ////??????
-		  mapToDao2.put("receive_person",prompt_letter_id);//接收人应该是?? ??? 接收人写哪个  不是很清楚// 产品说写死 ,目前就往一个人那里发函上传文件////暂时写的就是输入提示函的那个id
-		  mapToDao2.put("send_time",System.currentTimeMillis());//发送时间 
-		  mapToDao2.put("receive_time", System.currentTimeMillis());//接收时间
-		  mapToDao2.put("hash",hash);//hash值可以插入了
-		  promptLetterDao.insertIntoPromptLetterTable(mapToDao2);//将账号插入提示函表
-		  
-		  Map<String, Object> mapToDao = new LinkedHashMap<String, Object>();
-		  mapToDao.put("attachmentId",prompt_letter_id);//附件id   目前写的是上面输入的管理人账号一样
-		  mapToDao.put("attachmentName",attachmentName );//附件名称  拿到了
-		  mapToDao.put("url", url);//附件url   后面有下载的   需要地址
-		  mapToDao.put("upload_person_id", 10121);//附件人上传的id这里写的是死值   待改动  先将上传人的id号写死,到时候需要动态获取这个信息   应该写谁这个附件上传人id
-		  mapToDao.put("create_time", (Long)mapToDao2.get("send_time") );//附件添加时间,这里应该写发送时间       //System.currentTimeMillis()
-		  promptLetterDao.insertIntoAttachmentTable(mapToDao);//将数据添加到附件表数据库里
-		  
-		  Map<String, Object> mapToOperation = new LinkedHashMap<String,Object>();
-			mapToOperation.put("operatorTypeId", 1009);						//写死目前
-			mapToOperation.put("operatorAccount", 60000289);				//操作账号先写的是死值
-			mapToOperation.put("operatorRole", "经办支行4");						//创建这个操作的角色  目前是写死
-			mapToOperation.put("operatorPerson", "操作人小王");						//操作人先写死
-			mapToOperation.put("operatorTime",(Long)mapToDao2.get("send_time")); //操作时间为当前操作时间
-			mapToOperation.put("hash", hash);//这里的哈希值和上面插入提示函的哈希值一样	                    //写的时死值
-			promptLetterDao.insertOperationHistory(mapToOperation);           //将提示函泛函添加上传的操作记录信息插入到操作记录表中     
+		long currentTime = System.currentTimeMillis();
+		UserDetail userDetailOfVenture = (UserDetail) map.get("userDetailOfVenture");
+		UserDetail userDetailOfAdmin = (UserDetail) map.get("userDetailOfAdmin");
+		int attachmentId = (Integer) map.get("attachmentId");
+		String attachmentName = (String) map.get("attachmentName");
+		String hash = (String) map.get("hash");
+		String url = (String) map.get("url");
+		Map<String, Object> mapToDao4PromptLetter = new LinkedHashMap<String, Object>();
+		mapToDao4PromptLetter.put("prompt_letter_id", attachmentId);// 提示函 id
+		mapToDao4PromptLetter.put("prompt_letter_name", attachmentName);// 提示函名称 目前写的是文件名称
+		mapToDao4PromptLetter.put("send_person", userDetailOfVenture.getUser_id());// 发送人暂时写死的 ?? 是不是应该获取登陆人的id????
+		mapToDao4PromptLetter.put("receive_person", userDetailOfAdmin.getUser_id());// 接收人应该是?? ??? 接收人写哪个
+		mapToDao4PromptLetter.put("send_time", currentTime);// 发送时间
+		mapToDao4PromptLetter.put("receive_time", currentTime);// 接收时间
+		mapToDao4PromptLetter.put("hash", hash);// hash值可以插入了
+		promptLetterDao.insertIntoPromptLetterTable(mapToDao4PromptLetter);// 将账号插入提示函表
+
+		Map<String, Object> mapToDao4Attachment = new LinkedHashMap<String, Object>();
+		mapToDao4Attachment.put("attachmentId", attachmentId);// 附件id 目前写的是上面输入的管理人账号一样
+		mapToDao4Attachment.put("attachmentName", attachmentName);// 附件名称 拿到了
+		mapToDao4Attachment.put("url", url);// 附件url 后面有下载的 需要地址
+		mapToDao4Attachment.put("upload_person_id", userDetailOfVenture.getUser_id());// 附件人上传的id这里写的是死值 待改动
+		mapToDao4Attachment.put("create_time", currentTime);// 附件添加时间,这里应该写发送时间
+		promptLetterDao.insertIntoAttachmentTable(mapToDao4Attachment);// 将数据添加到附件表数据库里
+
+		Map<String, Object> mapToOperation = new LinkedHashMap<String, Object>();
+		mapToOperation.put("operatorTypeId", OperationTypeId.UPLOAD_PROMPT_LETTER); //1023上传提示函
+		mapToOperation.put("operatorAccount", userDetailOfVenture.getAccount()); // 操作账号先写的是死值
+		mapToOperation.put("operatorRole", Role.VENTURE_MANAGEMENT_POS); //操作角色必定是【风管岗】
+		mapToOperation.put("operatorPerson", userDetailOfVenture.getPerson_name()); // 操作人先写死
+		mapToOperation.put("operatorTime", currentTime); // 操作时间为当前操作时间
+		mapToOperation.put("hash", "hash");//=============================================================>>待定TODO
+		promptLetterDao.insertOperationHistory(mapToOperation); // 将提示函泛函添加上传的操作记录信息插入到操作记录表中
 	}
 }

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

@@ -36,7 +36,11 @@ import com.fuzamei.utils.HashXiZhiUtil;
 import com.fuzamei.utils.JSONUtil;
 import com.fuzamei.utils.PageDTO;
 import com.fuzamei.utils.ValidationUtil;
-
+/**
+ * 项目文档模块
+ * @author ylx
+ * 
+ */
 @Controller
 @RequestMapping("/project_file")
 public class ProjectFileAction {

+ 167 - 115
ccb_fund_trusteeship/src/main/java/com/fuzamei/web/PromptLetterAction.java

@@ -22,134 +22,186 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 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.UserDetail;
 import com.fuzamei.service.AccountOpenService;
+import com.fuzamei.service.AttachmentService;
 import com.fuzamei.service.PromptLetterService;
+import com.fuzamei.service.UserAuthoricationService;
 import com.fuzamei.theromus.utils.HexUtils;
 import com.fuzamei.utils.HashCodeUtil;
 import com.fuzamei.utils.HashXiZhiUtil;
 import com.fuzamei.utils.JSONUtil;
 import com.fuzamei.utils.PageDTO;
-/**  
- * 文件上传功能  
- * @param file  
- * @return  
- * @throws IOException   
- */  
+import com.fuzamei.utils.ValidationUtil;
+
+/**
+ * 提示函模块类
+ * 
+ * @param file
+ * @author chb & ylx
+ * @throws IOException
+ */
 @Controller
-@RequestMapping(value = "/PromptLetter")
+@RequestMapping(value = "/prompt_letter")
 public class PromptLetterAction {
 	@Autowired
-	private PromptLetterService  promptLetterService;//注入service
-		/**
-		 * 风险提示函发函  上传
-		 * @param file
-		 * @param request
-		 * @param prompt_letter_id
-		 * @return
-		 * @throws IOException
-		 */
-	    @RequestMapping(value="/uploadFile",method=RequestMethod.POST)  
-	    @ResponseBody  
-	    public Map<String,Object> upload(@RequestParam("file") MultipartFile file,HttpServletRequest request,@RequestParam("prompt_letter_id") String prompt_letter_id) throws IOException{  
-	        try {
-	        	String path = "D:\\tomcate\\apache-tomcat-8.5.24\\webapps"+request.getServletContext().getContextPath()+"\\Content";  
-	            File dir = new File(path);          
-	            if(!dir.exists()){  
-	                dir.mkdirs();  
-	            } 
-	            String fileName = file.getOriginalFilename();  
-	            String pathFile=path+"/"+fileName;
-	            File newfile = new File(pathFile); 
-	            file.transferTo(newfile);
-	          String hash = HashXiZhiUtil.getMD5Checksum(pathFile);//上传(文件)之后产生哈希值      是对文件产生哈希值
-	          System.out.println(hash+"上传提示函的哈希值是");
-	            //MultipartFile自带的解析方法 
-	    		Map<String, Object> map = new LinkedHashMap<String, Object>();
-	    		map.put("prompt_letter_id",prompt_letter_id);//有问题   待改动 
-	    		map.put("hash", hash);//上传文件后产生的哈希值插入到提示函表
-	    		
-	    		//map.put("fileName", fileName);
-	    		map.put("url","/Content/"+fileName);
-				map.put("attachmentName", fileName);
-				promptLetterService.insertTiShiHanOrUserOrOtherTable(map);//在插入数据库
-	    	    
-	            Map<String, Object>	mapResult=JSONUtil.getJsonMap(200, true, "上传提示函成功", null);
-				return mapResult;
+	private PromptLetterService promptLetterService;// 注入service
+
+	private static final String SP = File.separator;
+	
+	@Autowired
+	private UserAuthoricationService userAuthoricationService;
+
+	@Autowired
+	private AttachmentService attachmentService;
+	
+	private static final int ROW_NUM = 10; // 分页每页显示数据的数量
+	
+	/**
+	 * 风险提示函发函 上传
+	 * 
+	 * @param file
+	 * @param request
+	 * @param prompt_letter_id
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/uploadPromptLetterFile", method = RequestMethod.POST)
+	@ResponseBody
+	public Map<String, Object> uploadPromptLetterFile(@RequestParam("file") MultipartFile file,
+													  HttpServletRequest request, 
+													  @RequestParam("receiverId") Object rId,
+													  @RequestParam("userId") Object uId) throws IOException {
+		try {
+			// 非空校验
+			if (file.isEmpty()) {
+				throw new RuntimeException("上传文件不能为空");
 			}
-	       catch (Exception e) {
-				Map<String, Object> mapResult=JSONUtil.getJsonMap(500, true, "上传提示函失败"+e.getMessage(), null);
-				return mapResult;
+			int userId = ValidationUtil.checkAndAssignInt(uId);		//对用户id进行校验
+			int receiverId = ValidationUtil.checkAndAssignInt(rId);	//对接受用户id进行校验
+			UserDetail userDetailOfVenture = userAuthoricationService.checkUserAuthority(userId, Role.VENTURE_MANAGEMENT_POS);//获取操作用户详细信息和权限判断
+			UserDetail userDetailOfAdmin = userAuthoricationService.checkUserAuthority(receiverId, Role.ADMIN);//获取接收人详细信息和权限判断
+
+			String path = request.getServletContext().getRealPath("")+SP+"content"; //================================>>待定TODO
+			
+			String fileName = file.getOriginalFilename();
+			String pathFile = path + SP + fileName;
+			File newfile = new File(pathFile);
+			//======文件开始上传=======
+			File dir = new File(path);
+			if (!dir.exists()) {
+				dir.mkdirs();
 			}
-	    }  
-	    
-	    /**
-		 * 查询提示函   管理人接收列表
-		 * @param data
-		 * @return
-		 */
-		@RequestMapping(value = "/selectPromptLetter", method = RequestMethod.POST)
-		@ResponseBody
-		public Map<String, Object> selectPromptLetter(@RequestBody String data) {
-			//System.out.println("管理人查询风险提示函信息列表");
-			Map<String, Object> mapResult = new LinkedHashMap<String, Object>();
-			Map<String, Object> map = JSONUtil.jsonToMap(data);
-			PageDTO pageDto=  promptLetterService.selectPromptLetter(map);
-			mapResult = JSONUtil.getJsonMap(200, true, "操作成功", pageDto);
-			return mapResult;
+			file.transferTo(newfile);
+			//======文件上传结束=======
+			String hash = HashXiZhiUtil.getMD5Checksum(pathFile);// 上传(文件)之后产生哈希值====================>>待定TODO
+			//将文件暂时删除,防止产生垃圾数据
+			newfile.delete();
+			
+			int prompt_letter_id = attachmentService.generateAtachmentId();//产生一条不重复的附件id号
+			
+			Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+			mapToService.put("userDetailOfVenture", userDetailOfVenture);
+			mapToService.put("userDetailOfAdmin", userDetailOfAdmin);
+			mapToService.put("attachmentId", prompt_letter_id);// 有问题 待改动
+			mapToService.put("hash", hash);// 上传文件后产生的哈希值插入到提示函表//================================>>待定TODO
+			mapToService.put("url", "/content/" + fileName);//================================>>待定TODO
+			mapToService.put("attachmentName", fileName);
+			promptLetterService.insertTiShiHanOrUserOrOtherTable(mapToService);// 在插入数据库
+			
+			//如果没有报错将文件上传上服务器
+			file.transferTo(newfile);
+			return JSONUtil.getJsonMap(200, true, HintMSG.UPLOAD_SUCCESS, null);
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.UPLOAD_FAIL+":"+e.getMessage(), null);
 		}
-		
-		/**
-		 * 查询提示函 发送人的列表   
-		 * @param data
-		 * @return
-		 */
-		@RequestMapping(value = "/selectTishihan", method = RequestMethod.POST)
-		@ResponseBody
-		public Map<String, Object> selectTishihan(@RequestBody String data) {
-			//System.out.println("查询风险提示函信息列表3 ,省分行托管中心风管岗");
-			Map<String, Object> mapResult = new LinkedHashMap<String, Object>();
-			Map<String, Object> map = JSONUtil.jsonToMap(data);
-			PageDTO pageDto=  promptLetterService.selectTishihan(map);
-			mapResult = JSONUtil.getJsonMap(200, true, "操作成功", pageDto);
-	
-			return mapResult;
+	}
+
+	/**
+	 * 查询提示函 管理人接收列表
+	 {
+	 	"userId":"xxx",
+	 	"page":"1",
+	 	"startTime":"",
+	 	"endTime":""
+	 }
+	 * @param data
+	 * @return
+	 */
+	@RequestMapping(value = "/queryPromptLetter", method = RequestMethod.POST)
+	@ResponseBody
+	public Map<String, Object> selectPromptLetter(@RequestBody String data) {
+		try {
+			// System.out.println("管理人查询风险提示函信息列表");
+			@SuppressWarnings("unchecked")
+			Map<String, Object> map = JSON.parseObject(data,Map.class);
+			int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
+			UserDetail userDetail = userAuthoricationService.checkUserAuthority(userId,Role.ADMIN, Role.VENTURE_MANAGEMENT_POS);//获取操作用户详细信息和权限判断
+			int page = ValidationUtil.checkMinAndAssignInt(map.get("page"), 1);
+			long startTime = ValidationUtil.checkAndAssignDefaultLong(map.get("startTime"), 0L);
+			long endTime = ValidationUtil.checkAndAssignDefaultLong(map.get("endTime"), Long.MAX_VALUE);
+			Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
+			mapToService.put("userDetail", userDetail);
+			mapToService.put("startPage", (page - 1) * ROW_NUM);
+			mapToService.put("startTime", startTime);
+			if(startTime<=endTime){
+				mapToService.put("endTime", endTime);
+			}else{
+				mapToService.put("endTime", Long.MAX_VALUE);
+			}
+			mapToService.put("rowNum",  ROW_NUM);
+			PageDTO pageDto = promptLetterService.selectPromptLetter(mapToService);
+			return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
 		}
-	
-		/**  
-		 * 提示函下载 doc文档
-		 * @param request  
-		 * @param response  
-		 * @throws Exception  
-		 */  
-		@RequestMapping(value="/downloadFile")  
-		@ResponseBody 
-		public Map<String,Object> downloadFile(HttpServletRequest request,HttpServletResponse response,@RequestParam("url") String url) throws Exception{  
-		    try {
-		    	  //模拟文件,456.doc为需要下载的文件  
-		        String fileName = request.getSession().getServletContext().getRealPath("")+url;  
-		        //获取输入流  
-		        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);    
-		        //1.设置文件ContentType类型,这样设置,会自动判断下载文件类型    
-		        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(); 
-		        //返给前端map进行前端提示
-		    	return JSONUtil.getJsonMap(200, true, "下载成功",null); 
-				
-			} catch (Exception e) {
-				return JSONUtil.getJsonMap(500, false, "下载失败:"+e.getMessage(),null); 
+	}
+
+
+	/**
+	 * 提示函下载 doc文档
+	 * 
+	 * @param request
+	 * @param response
+	 * @throws Exception
+	 */
+	@RequestMapping(value = "/downloadFile")
+	@ResponseBody
+	public Map<String, Object> downloadFile(HttpServletRequest request, 
+											HttpServletResponse response,
+											@RequestParam("url") String url,
+											@RequestParam("userId") Object uId) throws Exception {
+		try {
+			int userId = ValidationUtil.checkAndAssignInt(uId);
+			userAuthoricationService.checkUserAuthority(userId,Role.ADMIN, Role.VENTURE_MANAGEMENT_POS);//权限判断
+			// 模拟文件,456.doc为需要下载的文件
+			String fileName = request.getSession().getServletContext().getRealPath("") + url;
+			// 获取输入流
+			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);
+			// 1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
+			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();
+			// 返给前端map进行前端提示
+			return JSONUtil.getJsonMap(200, true, "下载成功", null);
+		} catch (Exception e) {
+			return JSONUtil.getJsonMap(500, false, "下载失败:" + e.getMessage(), null);
+		}
+	}
+
 }