|
@@ -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); // 将提示函泛函添加上传的操作记录信息插入到操作记录表中
|
|
|
}
|
|
|
}
|