ImageUploadController.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. package com.ygj.yuemum.controller.admin;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.ygj.yuemum.component.Constant;
  4. import com.ygj.yuemum.domain.admin.Photo;
  5. import com.ygj.yuemum.domain.admin.Resume;
  6. import com.ygj.yuemum.domain.maternitymatron.JlServiceUser;
  7. import com.ygj.yuemum.domain.pay.CustomerPayVoucher;
  8. import com.ygj.yuemum.service.admin.PhotoService;
  9. import com.ygj.yuemum.service.admin.ResumeService;
  10. import com.ygj.yuemum.service.maternitymatron.JlServiceUserService;
  11. import com.ygj.yuemum.service.pay.CustomerPayVoucherService;
  12. import io.swagger.annotations.Api;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.core.io.ResourceLoader;
  15. import org.springframework.util.ResourceUtils;
  16. import org.springframework.web.bind.annotation.*;
  17. import org.springframework.web.multipart.MultipartFile;
  18. import java.io.*;
  19. import java.text.DateFormat;
  20. import java.text.ParseException;
  21. import java.text.SimpleDateFormat;
  22. import java.util.Date;
  23. import java.util.List;
  24. @Api(tags = "图片、简历相关接口")
  25. @RestController
  26. public class ImageUploadController {
  27. @Autowired
  28. private PhotoService photoService;
  29. @Autowired
  30. private JlServiceUserService jlServiceUserService;
  31. @Autowired
  32. private ResumeService resumeService;
  33. @Autowired
  34. private CustomerPayVoucherService customerPayVoucherService;
  35. private ResourceLoader resourceLoader;
  36. public static final String ROOT = Constant.ROOT;
  37. public static final String ResumeFile = Constant.RESUMEFILE;
  38. public static final String httpRoot = Constant.HTTPROOT;
  39. public static final String httphtmlRoot = Constant.HTTPHTMLROOT;
  40. public static final String modulePath = Constant.MODULEPATH;
  41. public static final String payvoucher = Constant.PAYVOUCHER;
  42. public static final String httppayvoucher = Constant.HTTPPAYVOUCHER;
  43. public static final String promotionvoucher = Constant.PROMOTIONVOUCHER;
  44. public static final String httppromotionvoucher = Constant.HTTPPROMOTIONVOUCHER;
  45. @RequestMapping(value = "/upload", method = RequestMethod.GET)
  46. public String upload() {
  47. return "/fileupload";
  48. }
  49. @RequestMapping(value = "/uploadImg", method = RequestMethod.POST)
  50. @ResponseBody
  51. public int uploadImg(@RequestParam("file") MultipartFile file,
  52. @RequestParam(value = "id") Integer id,
  53. @RequestParam(value = "type") Integer type) {
  54. // 照片类型 1:display 2:certificate 3:comment 4:service 5:meal
  55. // 删除display
  56. if (type == 1) {
  57. List<Photo> photos = photoService.queryDisplays(id);
  58. for (Photo photo : photos) {
  59. photoService.deletePhoto(photo);
  60. }
  61. }
  62. String folder = "";
  63. int dot = file.getOriginalFilename().lastIndexOf('.');
  64. String newName = file.getOriginalFilename().substring(dot);
  65. String path = ROOT + getpathtype(type) + "Img";
  66. Photo photo = new Photo();
  67. if (file.isEmpty()) {
  68. return 0;
  69. }
  70. Date date = new Date();
  71. DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
  72. File dest = new File(path + "/" + getpathtype(type) + id + type + sdf.format(date) + newName);
  73. try {
  74. file.transferTo(dest); //保存文件
  75. photo.setServant_code(id);
  76. photo.setPhoto_type(type);
  77. photo.setPhoto_name(getpathtype(type) + id + type + sdf.format(date) + newName);
  78. photo.setPhoto_path(httpRoot + getpathtype(type) + "Img/" + dest.getName());
  79. photoService.addPhoto(photo);
  80. return 1;
  81. } catch (IllegalStateException e) {
  82. // TODO Auto-generated catch block
  83. e.printStackTrace();
  84. return 0;
  85. } catch (IOException e) {
  86. // TODO Auto-generated catch block
  87. e.printStackTrace();
  88. return 0;
  89. }
  90. }
  91. @PostMapping("/deletePhoto")
  92. public int deletePhoto(@ModelAttribute Photo photo) throws ParseException {
  93. try {
  94. String path = ROOT + getpathtype(photo.getPhoto_type()) + "Img/" + photo.getPhoto_name();
  95. File dest = new File(path);
  96. dest.delete();
  97. return photoService.deletePhoto(photo);
  98. } catch (Exception ex) {
  99. ex.printStackTrace();
  100. return 0;
  101. }
  102. }
  103. @PostMapping("/queryPhoto")
  104. public String queryPhoto(@ModelAttribute Photo photo) throws ParseException {
  105. List<Photo> photos = photoService.queryPhoto(photo);
  106. String jso = JSONObject.toJSONString(photos);
  107. jso = jso.replaceAll("photo_path", "url");
  108. jso = jso.replaceAll("servant_code", "name");
  109. return jso;
  110. }
  111. @PostMapping("/createResume")
  112. public String createResume(@ModelAttribute Photo photo) {
  113. String urlName = "";
  114. try {
  115. JlServiceUser jlServiceUser = jlServiceUserService.getResume(photo.getServant_code());
  116. urlName = String.valueOf(jlServiceUser.getId());
  117. File file = ResourceUtils.getFile(modulePath);
  118. BufferedReader br = new BufferedReader(new FileReader(file));
  119. Resume resume = new Resume();
  120. Resume resumeold = new Resume();
  121. StringBuilder stringHtml = new StringBuilder();
  122. String str = "";
  123. String photoDisplay = "";
  124. String certificate = "";
  125. String certificatehref = "";
  126. String service = "";
  127. String servicehref = "";
  128. String meal = "";
  129. String mealhref = "";
  130. String comment = "";
  131. String littcomm = "";
  132. if (photo.getComment() == null) {
  133. photo.setComment(" ");
  134. }
  135. List<Photo> photos = photoService.queryPhoto(photo);
  136. if (photos.size() > 0) {
  137. int stepcertificate = 0;
  138. int stepservice = 0;
  139. int stepmeal = 0;
  140. String certificatestart = "<div class=\"resume-certificate-image\">" + "\r\n"
  141. + "<span class=\"resume-item-title\">相关证件</span>" + "\r\n"
  142. + "<div class=\"lb_gl_certificate\">" + "\r\n"
  143. + "<div class=\"container\">" + "\r\n"
  144. + "<div class=\"pictureSlider-certificate poster-main \">" + "\r\n"
  145. + "<div class=\"left-modal modal-certificate\"></div>" + "\r\n"
  146. + "<ul id=\"zturn-certificate\" class=\"poster-list\">" + "\r\n"
  147. + "<div class=\"poster-btn poster-certificate-prev-btn certificate\"></div>" + "\r\n";
  148. String certificateend = "<div class=\"poster-btn poster-certificate-next-btn\"></div>" + "\r\n"
  149. + "</ul>" + "\r\n"
  150. + "<div class=\"right-modal modal-certificate\"></div>" + "\r\n"
  151. + "<div class=\"indicator-list indicator-list-cer\">" + "\r\n"
  152. + "$cfstyle" + "\r\n"
  153. + "</div>" + "\r\n"
  154. + "</div>" + "\r\n"
  155. + "</div>" + "\r\n"
  156. + "</div>" + "\r\n"
  157. + "</div>" + "\r\n";
  158. String mealstart = "<div class=\"resume-service-image\">" + "\r\n"
  159. + "<span class=\"resume-item-title\">月子餐照片</span>" + "\r\n"
  160. + "<div class=\"lb_gl\">" + "\r\n"
  161. + "<div class=\"container\">" + "\r\n"
  162. + "<div class=\"pictureSlider poster-main poster-main-yzfood\">" + "\r\n"
  163. + "<div class=\"left-modal\"></div>" + "\r\n"
  164. + "<ul id=\"yzfood\" class=\"poster-list\">" + "\r\n"
  165. + "<div class=\"poster-btn poster-prev-btn poster-prev-btn-yzfood\"></div>" + "\r\n";
  166. String mealend = "<div class=\"poster-btn poster-next-btn poster-next-btn-yzfood\"></div>" + "\r\n"
  167. + "</ul>" + "\r\n"
  168. + "<div class=\"right-modal\"></div>" + "\r\n"
  169. + "<div class=\"indicator-list indicator-list-service\">" + "\r\n"
  170. + "$smstyle" + "\r\n"
  171. + "</div>" + "\r\n"
  172. + "</div>" + "\r\n"
  173. + "</div>" + "\r\n"
  174. + "</div>" + "\r\n"
  175. + "</div>" + "\r\n";
  176. String commentstart = "<div class=\"resume-comments\">" + "\r\n"
  177. + "<span class=\"resume-item-title\">最新评论</span>" + "\r\n"
  178. + "<div class=\"resume-comments-div\" id=\"resume-comments\">" + "\r\n"
  179. + "<div class=\"box_4\" id=\"box-comments\">" + "\r\n"
  180. + "<div class=\"roll\" id=\"roll\">" + "\r\n"
  181. + "<div class=\"roll_list\">" + "\r\n"
  182. + "<div class=\"ul_box\" id=\"ul_box\">" + "\r\n";
  183. String commentend = "</div>"
  184. + "<div class=\"ul_box\" id=\"ul_box2\"></div>"
  185. + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>";
  186. String servicestart = "<div class=\"resume-service-image\">" + "\r\n"
  187. + "<span class=\"resume-item-title\">服务照片</span>" + "\r\n"
  188. + "<div class=\"left-modal\" id=\"left-modal-service\"></div>" + "\r\n"
  189. + "<div class=\"lb_gl\">" + "\r\n"
  190. + "<div class=\"container\">" + "\r\n"
  191. + "<div class=\"pictureSlider poster-main poster-main-services\">" + "\r\n"
  192. + "<ul id=\"zturn\" class=\"poster-list\">" + "\r\n"
  193. + "<div class=\"poster-btn poster-prev-btn poster-prev-btn-service\"></div>" + "\r\n";
  194. String serviceend = "<div class=\"poster-btn poster-next-btn poster-next-btn-service\"></div>" + "\r\n"
  195. + "</ul>" + "\r\n"
  196. + "<div class=\"right-modal\"></div>" + "\r\n"
  197. + "<div class=\"indicator-list indicator-list-service\">" + "\r\n"
  198. + "$scstyle" + "\r\n"
  199. + "</div>" + "\r\n"
  200. + "</div>" + "\r\n"
  201. + "</div>" + "\r\n"
  202. + "</div>" + "\r\n"
  203. + "</div>" + "\r\n";
  204. for (Photo onePhoto : photos) {
  205. if (onePhoto.getPhoto_type() == 1) {
  206. if (onePhoto.getPhoto_path() != null) {
  207. photoDisplay = "<image class=\"resume-header-left-image\" src='" + onePhoto.getPhoto_path() + "'></image>" + "\r\n";
  208. }
  209. }
  210. if (onePhoto.getPhoto_type() == 2) {
  211. if (onePhoto.getPhoto_path() != null) {
  212. certificate = certificate + "<li class=\"poster-item zturn-item\">" + "\r\n"
  213. + "<image class=\"zturn-item-image-cer\" src='" + onePhoto.getPhoto_path() + "'></image>" + "\r\n"
  214. + "</li>" + "\r\n";
  215. if (stepcertificate == 0) {
  216. certificatehref = certificatehref + "<a href=\"javascript:void(0);\" value='" + stepcertificate + "' class=\"indicator-list-item selected\"></a>" + "\r\n";
  217. } else {
  218. certificatehref = certificatehref + "<a href=\"javascript:void(0);\" value='" + stepcertificate + "' class=\"indicator-list-item \"></a>" + "\r\n";
  219. }
  220. stepcertificate++;
  221. }
  222. }
  223. if (onePhoto.getPhoto_type() == 4) {
  224. if (onePhoto.getPhoto_path() != null) {
  225. service = service + "<li class=\"poster-item zturn-item\">" + "\r\n"
  226. + "<image class=\"zturn-item-image\" src='" + onePhoto.getPhoto_path() + "'></image>" + "\r\n"
  227. + "</li>" + "\r\n";
  228. if (stepservice == 0) {
  229. servicehref = servicehref + " <a href=\"javascript:void(0);\" value='" + stepservice + "' class=\"indicator-list-item-service selected\"></a>" + "\r\n";
  230. } else {
  231. servicehref = servicehref + " <a href=\"javascript:void(0);\" value='" + stepservice + "' class=\"indicator-list-item-service\"></a>" + "\r\n";
  232. }
  233. stepservice++;
  234. }
  235. }
  236. if (onePhoto.getPhoto_type() == 5) {
  237. if (onePhoto.getPhoto_path() != null) {
  238. meal = meal + "<li class=\"poster-item zturn-item\">" + "\r\n"
  239. + "<image class=\"zturn-item-image\" src='" + onePhoto.getPhoto_path() + "'></image>" + "\r\n"
  240. + "</li>" + "\r\n";
  241. if (stepmeal == 0) {
  242. mealhref = mealhref + " <a href=\"javascript:void(0);\" value='" + stepmeal + "' class=\"indicator-list-item-yzfood selected\"></a>" + "\r\n";
  243. } else {
  244. mealhref = mealhref + " <a href=\"javascript:void(0);\" value='" + stepmeal + "' class=\"indicator-list-item-yzfood\"></a>" + "\r\n";
  245. }
  246. stepmeal++;
  247. }
  248. }
  249. if (onePhoto.getPhoto_type() == 3) {
  250. comment = comment + "<a href=\"\"><img src='" + onePhoto.getPhoto_path() + "'/></a>" + "\r\n";
  251. littcomm = littcomm + "<image class=\"resume-comments-list\" src=\"" + onePhoto.getPhoto_path() + "\"/>";
  252. }
  253. }
  254. if (comment != "") {
  255. comment = commentstart + comment + commentend;
  256. }
  257. if (meal != "") {
  258. meal = mealstart + meal + mealend;
  259. }
  260. if (service != "") {
  261. service = servicestart + service + serviceend;
  262. }
  263. if (certificate != "") {
  264. certificate = certificatestart + certificate + certificateend;
  265. }
  266. }
  267. while ((str = br.readLine()) != null) {
  268. str = str.replace("$name", jlServiceUser.getTruename());
  269. str = str.replace("$np", jlServiceUser.getNp());
  270. str = str.replace("$age", jlServiceUser.getAge() + "岁");
  271. str = str.replace("$ethnicgroup", jlServiceUser.getEthnicgroup());
  272. str = str.replace("$constellation", jlServiceUser.getConstellation());
  273. str = str.replace("$seniority", jlServiceUser.getSeniority());
  274. str = str.replace("$babynumber", jlServiceUser.getBabynumber());
  275. str = str.replace("$education", jlServiceUser.getEducation());
  276. str = str.replace("$weight", jlServiceUser.getWeight());
  277. str = str.replace("$marriage", jlServiceUser.getMarriage());
  278. str = str.replace("$highlight", jlServiceUser.getHighlight());
  279. str = str.replace("$resumecomment", photo.getComment());
  280. str = str.replace("$zodiac", "属" + jlServiceUser.getZodiac());
  281. str = str.replace("$height", jlServiceUser.getHeight());
  282. str = str.replace("$starts", String.valueOf(jlServiceUser.getGender()));
  283. str = str.replace("$display", photoDisplay);
  284. str = str.replace("$credentials", certificate);
  285. str = str.replace("$cfstyle", certificatehref);
  286. str = str.replace("$service", service);
  287. str = str.replace("$scstyle", servicehref);
  288. str = str.replace("$meal", meal);
  289. str = str.replace("$smstyle", mealhref);
  290. str = str.replace("$comment", comment);
  291. str = str.replace("$littcomm", littcomm);
  292. str = str.replace("$ystitle", "悦所-月嫂简历:" + jlServiceUser.getTruename());
  293. str = str.replace("$yuesaohref", httphtmlRoot + urlName + ".html");
  294. stringHtml.append(str + "\r\n");
  295. }
  296. resumeold = resumeService.getResume(photo.getServant_code());
  297. if (resumeold != null) {
  298. resumeService.deleteResume(resumeold.getId());
  299. File fileDel = new File(resumeold.getRqcode_path());
  300. if (file.exists()) {
  301. fileDel.delete();
  302. }
  303. }
  304. resume.setServant_code(photo.getServant_code());
  305. resume.setResume_comment(photo.getComment());
  306. resume.setResume_path(httphtmlRoot + urlName + ".html");
  307. resume.setRqcode_path(ResumeFile + urlName + ".html");
  308. resumeService.addResume(resume);
  309. File newResume = new File(ResumeFile + urlName + ".html");
  310. FileWriter fileWriter = new FileWriter(newResume);
  311. fileWriter.write(stringHtml.toString());
  312. fileWriter.close();
  313. } catch (Exception ex) {
  314. ex.printStackTrace();
  315. return "error";
  316. }
  317. return httphtmlRoot + urlName + ".html";
  318. }
  319. public String getpathtype(int type) {
  320. switch (type) {
  321. case 1:
  322. return "display";
  323. case 2:
  324. return "certificate";
  325. case 3:
  326. return "comment";
  327. case 4:
  328. return "service";
  329. case 5:
  330. return "meal";
  331. }
  332. return "error";
  333. }
  334. @GetMapping("/reBulidResume")
  335. public int reBulidResume(@RequestParam("servant_code") String servant_code) {
  336. return photoService.reBuildResume(servant_code);
  337. }
  338. @RequestMapping(value = "/uploadPayImg", method = RequestMethod.POST)
  339. @ResponseBody
  340. public int uploadPayImg(@RequestParam("file") MultipartFile file,
  341. @RequestParam(value = "eh_code") String eh_code,
  342. @RequestParam(value = "cv_orderstaus") Integer cv_orderstaus) {
  343. int dot = file.getOriginalFilename().lastIndexOf('.');
  344. String newName = file.getOriginalFilename().substring(dot);
  345. CustomerPayVoucher customerPayVoucher = new CustomerPayVoucher();
  346. if (file.isEmpty()) {
  347. return 0;
  348. }
  349. Date date = new Date();
  350. DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
  351. File dest = new File(payvoucher + "/" + eh_code + sdf.format(date) + newName);
  352. // 删除
  353. try {
  354. file.transferTo(dest); //保存文件
  355. customerPayVoucher.setEh_code(eh_code);
  356. customerPayVoucher.setCv_filename(eh_code + sdf.format(date) + newName);
  357. customerPayVoucher.setCv_orderstaus(cv_orderstaus);
  358. customerPayVoucher.setCv_filepath(httppayvoucher + "/" + eh_code + sdf.format(date) + newName);
  359. customerPayVoucherService.insertCustomerPayVoucher(customerPayVoucher);
  360. return 1;
  361. } catch (IllegalStateException e) {
  362. // TODO Auto-generated catch block
  363. e.printStackTrace();
  364. return 0;
  365. } catch (IOException e) {
  366. // TODO Auto-generated catch block
  367. e.printStackTrace();
  368. return 0;
  369. }
  370. }
  371. @GetMapping("/deletePayPhoto")
  372. public int deletePayPhoto(@RequestParam("cv_filename") String cv_filename) throws ParseException {
  373. try {
  374. String path = payvoucher + "/" + cv_filename;
  375. File dest = new File(path);
  376. dest.delete();
  377. return customerPayVoucherService.deleteCustomerPayVoucher(cv_filename);
  378. } catch (Exception ex) {
  379. ex.printStackTrace();
  380. return 0;
  381. }
  382. }
  383. @GetMapping("/deleteCustomerPayVoucherAll")
  384. public int deleteCustomerPayVoucherAll(@RequestParam("eh_code") String eh_code) throws ParseException {
  385. try {
  386. List<CustomerPayVoucher> customerPays = customerPayVoucherService.selectCustomerPayVoucher(eh_code);
  387. for (CustomerPayVoucher cpv : customerPays) {
  388. String path = payvoucher + "/" + cpv.getCv_filename();
  389. File dest = new File(path);
  390. dest.delete();
  391. }
  392. return customerPayVoucherService.deleteCustomerPayVoucherAll(eh_code);
  393. } catch (Exception ex) {
  394. ex.printStackTrace();
  395. return 0;
  396. }
  397. }
  398. @GetMapping("/queryPayPhoto")
  399. public String queryPayPhoto(@RequestParam("eh_code") String eh_code) throws ParseException {
  400. List<CustomerPayVoucher> customerPays = customerPayVoucherService.selectCustomerPayVoucher(eh_code);
  401. String jso = JSONObject.toJSONString(customerPays);
  402. jso = jso.replaceAll("cv_filepath", "url");
  403. jso = jso.replaceAll("cv_filename", "name");
  404. return jso;
  405. }
  406. @PostMapping("/queryOrderPayPhoto")
  407. public String queryOrderPayPhoto(@ModelAttribute CustomerPayVoucher customerPayVoucher) throws ParseException {
  408. List<CustomerPayVoucher> customerPays = customerPayVoucherService.queryOrderPayPhoto(customerPayVoucher);
  409. String jso = JSONObject.toJSONString(customerPays);
  410. jso = jso.replaceAll("cv_filepath", "url");
  411. jso = jso.replaceAll("cv_filename", "name");
  412. return jso;
  413. }
  414. @PostMapping("/deleteOrderPayPhoto")
  415. public int deleteOrderPayPhoto(@ModelAttribute CustomerPayVoucher customerPayVoucher) throws ParseException {
  416. try {
  417. List<CustomerPayVoucher> customerPays = customerPayVoucherService.queryOrderPayPhoto(customerPayVoucher);
  418. for (CustomerPayVoucher cpv : customerPays) {
  419. String path = payvoucher + "/" + cpv.getCv_filename();
  420. File dest = new File(path);
  421. dest.delete();
  422. }
  423. return customerPayVoucherService.deleteOrderPayPhoto(customerPayVoucher);
  424. } catch (Exception ex) {
  425. ex.printStackTrace();
  426. return 0;
  427. }
  428. }
  429. @RequestMapping(value = "/uploadPromotionImg", method = RequestMethod.POST)
  430. @ResponseBody
  431. public String uploadPromotionImg(@RequestParam(value = "file", required = false) MultipartFile file) {
  432. int dot = file.getOriginalFilename().lastIndexOf('.');
  433. String newName = file.getOriginalFilename().substring(dot);
  434. if (file.isEmpty()) {
  435. return "";
  436. }
  437. Date date = new Date();
  438. DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
  439. String fileUrl = promotionvoucher + "/" + sdf.format(date) + newName;
  440. String httpfileUrl = httppromotionvoucher + "/" + sdf.format(date) + newName;
  441. File dest = new File(fileUrl);
  442. // 删除
  443. try {
  444. file.transferTo(dest); //保存文件
  445. return httpfileUrl;
  446. } catch (Exception ex) {
  447. ex.printStackTrace();
  448. return "";
  449. }
  450. }
  451. @GetMapping("/deletePromotionImg")
  452. public int deletePromotionImg(@RequestParam("cv_filename") String cv_filename) throws ParseException {
  453. try {
  454. String path = promotionvoucher + "/" + cv_filename;
  455. File dest = new File(path);
  456. dest.delete();
  457. return 1;
  458. } catch (Exception ex) {
  459. ex.printStackTrace();
  460. return 0;
  461. }
  462. }
  463. }