|
|
@@ -1,40 +1,78 @@
|
|
|
package me.zhengjie.application.admin.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import me.zhengjie.base.AppBaseResponse;
|
|
|
-import me.zhengjie.application.admin.service.NotaryNoteService;
|
|
|
+import me.zhengjie.annotation.rest.AnonymousGetMapping;
|
|
|
import me.zhengjie.application.admin.controller.vo.NotaryNoteVo;
|
|
|
+import me.zhengjie.application.admin.service.NotaryNoteService;
|
|
|
+import me.zhengjie.base.AppBaseResponse;
|
|
|
+import me.zhengjie.base.util.HtmlConvertPdf;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.IOException;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/api/note")
|
|
|
public class NotaryNoteController {
|
|
|
- @Autowired
|
|
|
- NotaryNoteService notaryNoteService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询面谈笔录
|
|
|
- * @param notary
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("/question")
|
|
|
- public JSONObject question(@Valid @RequestBody NotaryNoteVo notary) {
|
|
|
- return notaryNoteService.getNotaryNoteByType(notary);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存面谈笔录
|
|
|
- *
|
|
|
- * @param notary
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("/save")
|
|
|
- public AppBaseResponse<?> save(@Valid @RequestBody NotaryNoteVo notary) {
|
|
|
- return notaryNoteService.saveNotaryNote(notary);
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ NotaryNoteService notaryNoteService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询面谈笔录
|
|
|
+ *
|
|
|
+ * @param notary
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/question")
|
|
|
+ public JSONObject question(@Valid @RequestBody NotaryNoteVo notary) {
|
|
|
+ return notaryNoteService.getNotaryNoteByType(notary);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存面谈笔录
|
|
|
+ *
|
|
|
+ * @param notary
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/save")
|
|
|
+ public AppBaseResponse<?> save(@Valid @RequestBody NotaryNoteVo notary) {
|
|
|
+ return notaryNoteService.saveNotaryNote(notary);
|
|
|
+ }
|
|
|
+
|
|
|
+ @AnonymousGetMapping("/test-pdf")
|
|
|
+ public String generateTestPdf(@RequestParam String modelId, @RequestParam String businessNo) {
|
|
|
+ return notaryNoteService.generateTestPdf(modelId, businessNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ try {
|
|
|
+ String html = readString("/Users/sakuya/Downloads/notary-model.html");
|
|
|
+ HtmlConvertPdf.createPdfFile(html, "/Users/sakuya/Downloads/notary-model.pdf");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String readString(String filePath) {
|
|
|
+ String str = "";
|
|
|
+ File file = new File(filePath);
|
|
|
+ try {
|
|
|
+ FileInputStream in = new FileInputStream(file);
|
|
|
+ // size 为字串的长度 ,这里一次性读完
|
|
|
+ int size = in.available();
|
|
|
+ byte[] buffer = new byte[size];
|
|
|
+ in.read(buffer);
|
|
|
+ in.close();
|
|
|
+ str = new String(buffer, "UTF-8");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ }
|
|
|
}
|