|
@@ -23,10 +23,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import com.fuzamei.service.AccountOpenService;
|
|
|
+import com.fuzamei.service.PromptLetterService;
|
|
|
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
|
|
@@ -37,51 +39,7 @@ import com.fuzamei.utils.JSONUtil;
|
|
|
@RequestMapping(value = "/PromptLetter")
|
|
|
public class PromptLetterAction {
|
|
|
@Autowired
|
|
|
- private AccountOpenService accountService;
|
|
|
-
|
|
|
-
|
|
|
- @ResponseBody
|
|
|
- public Map<String,Object> upload(@RequestParam("file") MultipartFile file,HttpServletRequest request) throws IOException{
|
|
|
- String path = "D:\\tomcate\\apache-tomcat-8.5.24\\webapps"+request.getServletContext().getContextPath()+"\\UploadCeshi";
|
|
|
- String fileName = file.getOriginalFilename();
|
|
|
- File dir = new File(path+"/"+fileName);
|
|
|
- if(!dir.exists()){
|
|
|
- dir.mkdirs();
|
|
|
- }
|
|
|
-
|
|
|
- file.transferTo(dir);
|
|
|
- Map<String, Object> mapResult=JSONUtil.getJsonMap(200, true, "上传成功", null);
|
|
|
- return mapResult ;
|
|
|
-
|
|
|
- } */
|
|
|
-
|
|
|
- * 文件下载功能
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
-
|
|
|
- public void down(HttpServletRequest request,HttpServletResponse response) throws Exception{
|
|
|
-
|
|
|
- String fileName = request.getSession().getServletContext().getRealPath("upload")+"/aa.txt";
|
|
|
-
|
|
|
- InputStream bis = new BufferedInputStream(new FileInputStream(new File(fileName)));
|
|
|
-
|
|
|
- String filename = "下载文件.txt";
|
|
|
-
|
|
|
- filename = URLEncoder.encode(filename,"UTF-8");
|
|
|
-
|
|
|
- response.addHeader("Content-Disposition", "attachment;filename=" + filename);
|
|
|
-
|
|
|
- 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();
|
|
|
- } */
|
|
|
+ private PromptLetterService promptLetterService;
|
|
|
|
|
|
* 风险提示函发函 上传
|
|
|
* @param file
|
|
@@ -113,7 +71,7 @@ public class PromptLetterAction {
|
|
|
|
|
|
map.put("url","/Content/"+fileName);
|
|
|
map.put("attachmentName", fileName);
|
|
|
- accountService.insertTiShiHanOrUserOrOtherTable(map);
|
|
|
+ promptLetterService.insertTiShiHanOrUserOrOtherTable(map);
|
|
|
|
|
|
Map<String, Object> mapResult=JSONUtil.getJsonMap(200, true, "上传提示函成功", null);
|
|
|
return mapResult;
|
|
@@ -123,85 +81,75 @@ public class PromptLetterAction {
|
|
|
return mapResult;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- * 账户开立下载 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 {
|
|
|
-
|
|
|
- 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);
|
|
|
-
|
|
|
- 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();
|
|
|
-
|
|
|
- return JSONUtil.getJsonMap(200, true, "下载成功",null);
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- return JSONUtil.getJsonMap(500, false, "下载失败:"+e.getMessage(),null);
|
|
|
+
|
|
|
+
|
|
|
+ * 查询提示函 管理人接收列表
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/selectPromptLetter", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String, Object> selectPromptLetter(@RequestBody String data) {
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 查询提示函 发送人的列表
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/selectTishihan", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String, Object> selectTishihan(@RequestBody String data) {
|
|
|
+
|
|
|
+ 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);
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 真伪查询 上传文件 产生一条哈希值
|
|
|
- * @param
|
|
|
- * @param
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @RequestMapping(value="/trueFalseSelect",method=RequestMethod.POST)
|
|
|
- @ResponseBody
|
|
|
- public Map<String,Object> trueFalseSelect(@RequestParam("file") MultipartFile file,HttpServletRequest request) 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();
|
|
|
- }
|
|
|
-
|
|
|
- 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("fileName", fileName);
|
|
|
- map.put("url",fileName);
|
|
|
- accountService.insertTrueFalseSelect(map);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String hash=HashXiZhiUtil.getMD5Checksum(pathFile);
|
|
|
- System.out.println( HashXiZhiUtil.getMD5Checksum(pathFile)+"--哈希值");
|
|
|
- Map<String, Object> mapResult=JSONUtil.getJsonMap(200, true, "上传成功", null);
|
|
|
- return mapResult ;
|
|
|
- }
|
|
|
- catch (Exception e) {
|
|
|
- Map<String, Object> mapResult=JSONUtil.getJsonMap(500, true, "上传失败"+e.getMessage(), null);
|
|
|
- return mapResult ;
|
|
|
+ return mapResult;
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ * 提示函下载 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 {
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ 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();
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, "下载成功",null);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, "下载失败:"+e.getMessage(),null);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|