Explorar el Código

Merge remote-tracking branch 'origin/master'

guojing hace 5 años
padre
commit
9ffd21faee

+ 12 - 12
admin-ui/app/whepi/scan/qrImg.js

@@ -84,18 +84,18 @@ define(function (require) {
                                 xtype: 'toolbar',
                                 title: '小区大门详情',
                                 items: [
-                                    // {
-                                    //     text: '添加大门', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
-                                    //         $.yvan.showDialog(this,
-                                    //             require('/app/whepi/scan/addDoor.js')({
-                                    //                 isEdit: false,
-                                    //                 confirm: function () {
-                                    //                     queryGrid1();
-                                    //                 }
-                                    //             })
-                                    //         );
-                                    //     }
-                                    // },
+                                    {
+                                        text: '添加大门', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
+                                            $.yvan.showDialog(this,
+                                                require('/app/whepi/scan/addDoor.js')({
+                                                    isEdit: false,
+                                                    confirm: function () {
+                                                        queryGrid1();
+                                                    }
+                                                })
+                                            );
+                                        }
+                                    },
                                     // {
                                     //     text: '编辑大门', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
                                     //         var row = $grid1.rowData();

BIN
whepi-ui/static/adminHelp_1.jpg


BIN
whepi-ui/static/homeHelp.jpg


BIN
whepi-ui/static/homeHelp_1.jpg


+ 19 - 0
whepi-ui/templates/home/adminHelp.ftl

@@ -0,0 +1,19 @@
+<#assign title="管理员手册"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="page__bd" style="height: 300px">
+    <div class="container">
+        <img src="/static/adminHelp_1.jpg" style="width: 100%"/>
+</div>
+
+
+<#include "/home/frag.foot.ftl" />
+
+<script>
+
+    (function ($) {
+
+    })(jQuery);
+
+
+</script>

+ 2 - 2
whepi-ui/templates/home/homeHelp.ftl

@@ -1,9 +1,9 @@
-<#assign title="操作帮助"/>
+<#assign title="家庭手册"/>
 <#include "/home/frag.head.ftl" />
 
 <div class="page__bd" style="height: 300px">
     <div class="container">
-        <img src="/static/homeHelp.jpg" style="width: 100%"/>
+        <img src="/static/homeHelp_1.jpg" style="width: 100%"/>
 </div>
 
 

+ 192 - 0
whepi-web/src/main/java/com/bofeng/controller/EpiLYExportController.java

@@ -0,0 +1,192 @@
+package com.bofeng.controller;
+
+import com.bofeng.word.WordUtils;
+import com.google.common.collect.Lists;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class EpiLYExportController {
+
+    @ApiOperation("导出单个健康及旅居申报表")
+    @GetMapping("/whepi/export/lyReport")
+    public @ResponseBody
+    void exportSellPlan(HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userName", "张山");
+        map.put("workPlace", "武汉");
+        map.put("telPhone", "13245452345");
+        map.put("isLeave", "是");
+        map.put("trip", "北京、上海、武汉");
+        map.put("backTime", "2020-03-10");
+        map.put("vehicle", "火箭");
+
+        Map<String, Object> rt = new HashMap<String, Object>();
+        map.put("rt", rt);
+        rt.put("d1", "02-20");
+        rt.put("d2", "02-21");
+        rt.put("d3", "02-22");
+        rt.put("d4", "02-23");
+        rt.put("d5", "02-24");
+        rt.put("t1", "-");
+        rt.put("t2", "37.0");
+        rt.put("t3", "36.6");
+        rt.put("t4", "36.6");
+        rt.put("t5", "36.8");
+
+        map.put("otherSymptom", "ee");
+        map.put("isTrue", "否");
+
+        WordUtils.exportWord("word/健康及旅居申报表_20200221.docx", "temp", "健康及旅居申报表.docx", map, request, response);
+    }
+
+    @ApiOperation("导出多个健康及旅居申报表")
+    @GetMapping("/whepi/export/lyReports")
+    public @ResponseBody
+    void exportSellPlan2(HttpServletRequest request, HttpServletResponse response) {
+
+        List<Map<String, Object>> list = Lists.newArrayList();
+        for (int i = 0; i < 5; i++) {
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("userName", "张山");
+            map.put("workPlace", "武汉");
+            map.put("telPhone", "13245452345");
+            map.put("isLeave", "是");
+            map.put("trip", "北京、上海、武汉");
+            map.put("backTime", "2020-03-10");
+            map.put("vehicle", "火箭");
+
+            Map<String, Object> rt = new HashMap<String, Object>();
+            map.put("rt", rt);
+            rt.put("d1", "02-20");
+            rt.put("d2", "02-21");
+            rt.put("d3", "02-22");
+            rt.put("d4", "02-23");
+            rt.put("d5", "02-24");
+            rt.put("t1", "-");
+            rt.put("t2", "37.0");
+            rt.put("t3", "36.6");
+            rt.put("t4", "36.6");
+            rt.put("t5", "36.8");
+
+            map.put("otherSymptom", "ee");
+            map.put("isTrue", "否");
+            list.add(map);
+        }
+
+
+        WordUtils.exportWord("word/健康及旅居申报表_20200221.docx", "temp", "健康及旅居申报表.docx", list, request, response);
+    }
+
+    @ApiOperation("导出单个隔离人员解除隔离审批表")
+    @GetMapping("/whepi/export/lyApprove")
+    public @ResponseBody
+    void lyApprove(HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userName", "张山");
+        map.put("gander", "男");
+        map.put("org", "研发部");
+        map.put("bAddr", "北京");
+        map.put("backDate", "2020-03-10");
+
+        Map<String, Object> rt = new HashMap<String, Object>();
+        map.put("rt", rt);
+        rt.put("d1", "02-20");
+        rt.put("d2", "02-21");
+        rt.put("d3", "02-22");
+        rt.put("d4", "02-23");
+        rt.put("d5", "02-24");
+        rt.put("d6", "02-25");
+        rt.put("d7", "02-26");
+        rt.put("d8", "02-27");
+        rt.put("d9", "02-28");
+        rt.put("d10", "02-29");
+        rt.put("d11", "03-01");
+        rt.put("d12", "03-02");
+        rt.put("d13", "03-03");
+        rt.put("d14", "03-04");
+        rt.put("d15", "03-05");
+        rt.put("t1", "-");
+        rt.put("t2", "37.0");
+        rt.put("t3", "36.6");
+        rt.put("t4", "36.6");
+        rt.put("t5", "36.8");
+        rt.put("t6", "-");
+        rt.put("t7", "37.0");
+        rt.put("t8", "36.6");
+        rt.put("t9", "36.6");
+        rt.put("t10", "36.8");
+        rt.put("t11", "-");
+        rt.put("t12", "37.0");
+        rt.put("t13", "36.6");
+        rt.put("t14", "36.6");
+        rt.put("t15", "36.8");
+
+        map.put("otherSymptom", "无");
+
+        WordUtils.exportWord("word/隔离人员解除隔离审批表_20200221.docx", "temp", "隔离人员解除隔离审批表.docx", map, request, response);
+    }
+
+    @ApiOperation("导出多个隔离人员解除隔离审批表")
+    @GetMapping("/whepi/export/lyApproves")
+    public @ResponseBody
+    void lyApproves(HttpServletRequest request, HttpServletResponse response) {
+
+        List<Map<String, Object>> list = Lists.newArrayList();
+        for (int i = 0; i < 5; i++) {
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("userName", "张山");
+            map.put("gander", "男");
+            map.put("org", "研发部");
+            map.put("bAddr", "北京");
+            map.put("backDate", "2020-03-10");
+
+            Map<String, Object> rt = new HashMap<String, Object>();
+            map.put("rt", rt);
+            rt.put("d1", "02-20");
+            rt.put("d2", "02-21");
+            rt.put("d3", "02-22");
+            rt.put("d4", "02-23");
+            rt.put("d5", "02-24");
+            rt.put("d6", "02-25");
+            rt.put("d7", "02-26");
+            rt.put("d8", "02-27");
+            rt.put("d9", "02-28");
+            rt.put("d10", "02-29");
+            rt.put("d11", "03-01");
+            rt.put("d12", "03-02");
+            rt.put("d13", "03-03");
+            rt.put("d14", "03-04");
+            rt.put("d15", "03-05");
+            rt.put("t1", "-");
+            rt.put("t2", "37.0");
+            rt.put("t3", "36.6");
+            rt.put("t4", "36.6");
+            rt.put("t5", "36.8");
+            rt.put("t6", "-");
+            rt.put("t7", "37.0");
+            rt.put("t8", "36.6");
+            rt.put("t9", "36.6");
+            rt.put("t10", "36.8");
+            rt.put("t11", "-");
+            rt.put("t12", "37.0");
+            rt.put("t13", "36.6");
+            rt.put("t14", "36.6");
+            rt.put("t15", "36.8");
+
+            map.put("otherSymptom", "无");
+            list.add(map);
+        }
+
+        WordUtils.exportWord("word/隔离人员解除隔离审批表_20200221.docx", "temp", "隔离人员解除隔离审批表.docx", list, request, response);
+    }
+}

+ 124 - 0
whepi-web/src/main/java/com/bofeng/word/WordUtils.java

@@ -0,0 +1,124 @@
+package com.bofeng.word;
+
+
+import java.io.*;
+import java.net.URLEncoder;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.afterturn.easypoi.word.WordExportUtil;
+import com.yvan.DateUtils;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.utility.DateUtil;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.springframework.beans.factory.annotation.Value;
+
+public class WordUtils {
+
+    /**
+     * 导出word
+     * <p>第一步生成替换后的word文件,只支持docx</p>
+     * <p>第二步下载生成的文件</p>
+     * <p>第三步删除生成的临时文件</p>
+     * 模版变量中变量格式:{{foo}}
+     * @param templatePath word模板地址
+     * @param temDir 生成临时文件存放地址
+     * @param fileName 文件名
+     * @param params 替换的参数
+     * @param request HttpServletRequest
+     * @param response HttpServletResponse
+     */
+    public static void exportWord(String templatePath, String temDir, String fileName, Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
+//        Assert.notNull(templatePath,"模板路径不能为空");
+//        Assert.notNull(temDir,"临时文件路径不能为空");
+//        Assert.notNull(fileName,"导出文件名不能为空");
+//        Assert.isTrue(fileName.endsWith(".docx"),"word导出请使用docx格式");
+        if (!temDir.endsWith("/")){
+            temDir = temDir + File.separator;
+        }
+        File dir = new File(temDir);
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        try {
+            String userAgent = request.getHeader("user-agent").toLowerCase();
+            if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
+                fileName = URLEncoder.encode(fileName, "UTF-8");
+            } else {
+                fileName = new String(fileName.getBytes("utf-8"), "ISO-8859-1");
+            }
+            XWPFDocument doc = WordExportUtil.exportWord07(templatePath, params);
+            String tmpPath = temDir + fileName;
+            FileOutputStream fos = new FileOutputStream(tmpPath);
+            doc.write(fos);
+            // 设置强制下载不打开
+            response.setContentType("application/force-download");
+            // 设置文件名
+            response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
+            OutputStream out = response.getOutputStream();
+            doc.write(out);
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+//            delAllFile(temDir);//这一步看具体需求,要不要删
+        }
+
+    }
+
+    /**
+     * 导出word
+     * <p>第一步生成替换后的word文件,只支持docx</p>
+     * <p>第二步下载生成的文件</p>
+     * <p>第三步删除生成的临时文件</p>
+     * 模版变量中变量格式:{{foo}}
+     * @param templatePath word模板地址
+     * @param temDir 生成临时文件存放地址
+     * @param fileName 文件名
+     * @param paramList 替换的参数
+     * @param request HttpServletRequest
+     * @param response HttpServletResponse
+     */
+    public static void exportWord(String templatePath, String temDir, String fileName, List<Map<String, Object>> paramList, HttpServletRequest request, HttpServletResponse response) {
+//        Assert.notNull(templatePath,"模板路径不能为空");
+//        Assert.notNull(temDir,"临时文件路径不能为空");
+//        Assert.notNull(fileName,"导出文件名不能为空");
+//        Assert.isTrue(fileName.endsWith(".docx"),"word导出请使用docx格式");
+        if (!temDir.endsWith("/")){
+            temDir = temDir + File.separator;
+        }
+        File dir = new File(temDir);
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        try {
+            String userAgent = request.getHeader("user-agent").toLowerCase();
+            if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
+                fileName = URLEncoder.encode(fileName, "UTF-8");
+            } else {
+                fileName = new String(fileName.getBytes("utf-8"), "ISO-8859-1");
+            }
+            XWPFDocument doc = WordExportUtil.exportWord07(templatePath, paramList);
+            String tmpPath = temDir + fileName;
+            FileOutputStream fos = new FileOutputStream(tmpPath);
+            doc.write(fos);
+            // 设置强制下载不打开
+            response.setContentType("application/force-download");
+            // 设置文件名
+            response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
+            OutputStream out = response.getOutputStream();
+            doc.write(out);
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+//            delAllFile(temDir);//这一步看具体需求,要不要删
+        }
+
+    }
+}

+ 11 - 2
whepi-web/src/main/java/com/bofeng/wx/WxController.java

@@ -152,7 +152,7 @@ public class WxController {
         val btnDesc = new WxMenuButton();
         btnDesc.setName("平台简介");
         val btn31 = new WxMenuButton();
-        btn31.setName("帮助");
+        btn31.setName("家庭手册");
         btn31.setType(WxConsts.MenuButtonType.VIEW);
         btn31.setUrl(
                 wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
@@ -160,15 +160,24 @@ public class WxController {
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
         val btn32 = new WxMenuButton();
-        btn32.setName("简介");
+        btn32.setName("管理员手册");
         btn32.setType(WxConsts.MenuButtonType.VIEW);
         btn32.setUrl(
                 wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
+                                "/home/adminHelp.html",
+                        WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
+        );
+        val btn33 = new WxMenuButton();
+        btn33.setName("简介");
+        btn33.setType(WxConsts.MenuButtonType.VIEW);
+        btn33.setUrl(
+                wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
                                 "/home/desc.html",
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
         btnDesc.getSubButtons().add(btn31);
         btnDesc.getSubButtons().add(btn32);
+        btnDesc.getSubButtons().add(btn33);
 //        btn3.getSubButtons().add(btnDesc);
 //        btn3.getSubButtons().add(btnHelp);
 

+ 2 - 2
whepi-web/src/main/java/com/bofeng/wx/controller/ScanController.java

@@ -139,7 +139,7 @@ public class ScanController {
                     model.put("into", "禁止外出");
                     model.put("errorMsg", "根据武汉市小区封闭管理规定,非特殊人员禁止出行!");
                     scanService.saveOutScan(userOpen.getUserId(), inType, uptownDoor.getUptownId(), uptownDoor.getDoorId(), -1, model.get("errorMsg").toString());
-                    return new ModelAndView("/user/goOut.ftl", model);
+                    return new ModelAndView("/user/scan.ftl", model);
                 }
                 OutScan outScan = outScanMapper.getOutScanThreeday(userOpen.getUserId(), 2, outScanConf.getGoOutFre());
                 if (outScan != null) {
@@ -223,7 +223,7 @@ public class ScanController {
                 model.put("into", "禁止外出");
                 model.put("errorMsg", "根据武汉市小区封闭管理规定,非特殊人员禁止出行!");
                 scanService.saveOutScanEstate(userOpen.getUserId(), -1, model.get("errorMsg").toString());
-                return new ModelAndView("/user/goOut.ftl", model);
+                return new ModelAndView("/user/scanEstate.ftl", model);
             }
             List<MsReport> msReports = msReportMapper.selectMsReportLate(userOpen.getUserId());
             if (msReports.size() != 3) {

+ 5 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -242,6 +242,11 @@ public class UserOpenController {
         return new ModelAndView("/home/homeHelp.ftl", model);
     }
 
+    @GetMapping("/home/adminHelp.html")
+    public ModelAndView adminHelp(ModelMap model) {
+        return new ModelAndView("/home/adminHelp.ftl", model);
+    }
+
     @GetMapping("/home/testOk.html")
     public ModelAndView testOk(ModelMap model, HttpServletResponse response) {
         response.setHeader("Access-Control-Allow-Credentials", "true");

+ 5 - 2
whepi-web/src/main/resources/application-xielianghe.yml

@@ -65,8 +65,11 @@ spring:
     #driverClassName: com.mysql.jdbc.Driver
     #url: jdbc:mysql://localhost:3306/bofeng_test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
     driverClassName: net.sf.log4jdbc.DriverSpy
-    url: jdbc:log4jdbc:mysql://39.99.148.1:3306/whepi_test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
-    username: whepi_test
+#    url: jdbc:log4jdbc:mysql://39.99.148.1:3306/whepi_test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+#    username: whepi_test
+#    password: 123456
+    url: jdbc:log4jdbc:mysql://localhost:3306/test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+    username: root
     password: 123456
 
   redis:

BIN
whepi-web/src/main/resources/word/健康及旅居申报表_20200221.docx


BIN
whepi-web/src/main/resources/word/隔离人员解除隔离审批表_20200221.docx