李天标 před 6 roky
rodič
revize
eca404678a
100 změnil soubory, kde provedl 12809 přidání a 0 odebrání
  1. 4 0
      app-backend-web/META-INF/persistence.xml
  2. 123 0
      app-backend-web/pom.xml
  3. 221 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AdController.java
  4. 286 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AdminAgencyController.java
  5. 379 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AdminController.java
  6. 315 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AdminMerchantController.java
  7. 268 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AdminPersonageController.java
  8. 259 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AlarmRecordController.java
  9. 97 0
      app-backend-web/src/main/java/com/hboxs/control/admin/ApkInfoController.java
  10. 105 0
      app-backend-web/src/main/java/com/hboxs/control/admin/AreaController.java
  11. 199 0
      app-backend-web/src/main/java/com/hboxs/control/admin/BaseController.java
  12. 247 0
      app-backend-web/src/main/java/com/hboxs/control/admin/CoinOrderController.java
  13. 213 0
      app-backend-web/src/main/java/com/hboxs/control/admin/CommonController.java
  14. 236 0
      app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentApplyController.java
  15. 333 0
      app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentController.java
  16. 191 0
      app-backend-web/src/main/java/com/hboxs/control/admin/FileController.java
  17. 60 0
      app-backend-web/src/main/java/com/hboxs/control/admin/GlobalConfigController.java
  18. 138 0
      app-backend-web/src/main/java/com/hboxs/control/admin/JoinPayMchController.java
  19. 147 0
      app-backend-web/src/main/java/com/hboxs/control/admin/MaintainingHistoryController.java
  20. 256 0
      app-backend-web/src/main/java/com/hboxs/control/admin/OrderController.java
  21. 921 0
      app-backend-web/src/main/java/com/hboxs/control/admin/OrderStatisticsController.java
  22. 74 0
      app-backend-web/src/main/java/com/hboxs/control/admin/ProductController.java
  23. 78 0
      app-backend-web/src/main/java/com/hboxs/control/admin/ProfileController.java
  24. 137 0
      app-backend-web/src/main/java/com/hboxs/control/admin/ProportionController.java
  25. 160 0
      app-backend-web/src/main/java/com/hboxs/control/admin/RoleController.java
  26. 172 0
      app-backend-web/src/main/java/com/hboxs/control/admin/TimeRuleController.java
  27. 344 0
      app-backend-web/src/main/java/com/hboxs/control/admin/TrusteeshipController.java
  28. 195 0
      app-backend-web/src/main/java/com/hboxs/template/directive/BaseDirective.java
  29. 42 0
      app-backend-web/src/main/java/com/hboxs/template/directive/ExecuteTimeDirective.java
  30. 53 0
      app-backend-web/src/main/java/com/hboxs/template/directive/FlashMessageDirective.java
  31. 166 0
      app-backend-web/src/main/java/com/hboxs/template/directive/PaginationDirective.java
  32. 85 0
      app-backend-web/src/main/java/com/hboxs/template/method/AbbreviateMethod.java
  33. 36 0
      app-backend-web/src/main/java/com/hboxs/template/method/AdminCountByEquipmentMethod.java
  34. 26 0
      app-backend-web/src/main/java/com/hboxs/template/method/AdminLevelMethod.java
  35. 36 0
      app-backend-web/src/main/java/com/hboxs/template/method/AdminMethod.java
  36. 32 0
      app-backend-web/src/main/java/com/hboxs/template/method/AlarmRecordMethod.java
  37. 35 0
      app-backend-web/src/main/java/com/hboxs/template/method/AreaMethod.java
  38. 46 0
      app-backend-web/src/main/java/com/hboxs/template/method/CommonParamMethod.java
  39. 56 0
      app-backend-web/src/main/java/com/hboxs/template/method/CurrencyMethod.java
  40. 53 0
      app-backend-web/src/main/java/com/hboxs/template/method/EntityTemplateMethodAdaptor.java
  41. 36 0
      app-backend-web/src/main/java/com/hboxs/template/method/EquipmentMethod.java
  42. 41 0
      app-backend-web/src/main/java/com/hboxs/template/method/MaintainHistoryMethod.java
  43. 43 0
      app-backend-web/src/main/java/com/hboxs/template/method/ManagerIdMethod.java
  44. 39 0
      app-backend-web/src/main/java/com/hboxs/template/method/MessageMethod.java
  45. binární
      app-backend-web/src/main/resources/admin设计解析.png
  46. 81 0
      app-backend-web/src/main/resources/applicationContext-mvc.xml
  47. 62 0
      app-backend-web/src/main/resources/applicationContext-redis.xml
  48. 55 0
      app-backend-web/src/main/resources/applicationContext-shiro.xml
  49. 171 0
      app-backend-web/src/main/resources/applicationContext.xml
  50. binární
      app-backend-web/src/main/resources/captcha/captcha_bg_0.jpg
  51. 13 0
      app-backend-web/src/main/resources/ehcache.xml
  52. binární
      app-backend-web/src/main/resources/keys/apiclient_cert.p12
  53. 90 0
      app-backend-web/src/main/resources/mvctemplate/control.data
  54. 15 0
      app-backend-web/src/main/resources/mvctemplate/dao.data
  55. 18 0
      app-backend-web/src/main/resources/mvctemplate/daoImpl.data
  56. 19 0
      app-backend-web/src/main/resources/mvctemplate/service.data
  57. 33 0
      app-backend-web/src/main/resources/mvctemplate/serviceImpl.data
  58. 54 0
      app-backend-web/src/main/resources/mvctemplate/webappAdd.data
  59. 55 0
      app-backend-web/src/main/resources/mvctemplate/webappEdit.data
  60. 117 0
      app-backend-web/src/main/resources/mvctemplate/webappList.data
  61. binární
      app-backend-web/src/main/resources/print/print_account.xls
  62. binární
      app-backend-web/src/main/resources/print/print_alarmRecord1.xls
  63. binární
      app-backend-web/src/main/resources/print/print_unionRecord.xls
  64. binární
      app-backend-web/src/main/resources/print/print_union_record.xls
  65. 23 0
      app-backend-web/src/main/webapp/404.html
  66. 3 0
      app-backend-web/src/main/webapp/META-INF/MANIFEST.MF
  67. 11 0
      app-backend-web/src/main/webapp/WEB-INF/language/admin/message_zh_CN.properties
  68. 0 0
      app-backend-web/src/main/webapp/WEB-INF/language/admin/message_zh_TW.properties
  69. 0 0
      app-backend-web/src/main/webapp/WEB-INF/language/asl/message_en_US.properties
  70. 0 0
      app-backend-web/src/main/webapp/WEB-INF/language/asl/message_zh_CN.properties
  71. 0 0
      app-backend-web/src/main/webapp/WEB-INF/language/common/message_zh_CN.properties
  72. 0 0
      app-backend-web/src/main/webapp/WEB-INF/language/common/message_zh_TW.properties
  73. 299 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/add.ftl
  74. 262 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/edit.ftl
  75. 176 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/list.ftl
  76. 153 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/add.ftl
  77. 145 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/edit.ftl
  78. 171 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/list.ftl
  79. 156 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/add.ftl
  80. 158 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/addMerchant.ftl
  81. 367 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/edit.ftl
  82. 192 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/list.ftl
  83. 157 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/add.ftl
  84. 158 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/addPersonage.ftl
  85. 344 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/edit.ftl
  86. 193 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/list.ftl
  87. 156 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/add.ftl
  88. 323 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/edit.ftl
  89. 192 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/list.ftl
  90. 231 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/alarmRecord/list.ftl
  91. 176 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/add.ftl
  92. 182 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/edit.ftl
  93. 142 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/list.ftl
  94. 86 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/area/add.ftl
  95. 85 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/area/edit.ftl
  96. 142 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/area/list.ftl
  97. 55 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/add.ftl
  98. 56 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/edit.ftl
  99. 249 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/list.ftl
  100. 0 0
      app-backend-web/src/main/webapp/WEB-INF/template/admin/common/error.ftl

+ 4 - 0
app-backend-web/META-INF/persistence.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+
+</persistence>

+ 123 - 0
app-backend-web/pom.xml

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>mianhuatang</artifactId>
+        <groupId>com.hboxs</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <packaging>war</packaging>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>app-backend-web</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-entity</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-dao</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-service</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-backend-myshiro</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-common-interceptor</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-common-listener</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-common-filter</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hboxs</groupId>
+            <artifactId>app-common-aop</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-base</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-web</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-annotation</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+            <resource>
+                <directory>../conf/${env.conf.dir}</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <!-- Maven Tomcat 7 Plugin -->
+            <plugin>
+                <groupId>org.apache.tomcat.maven</groupId>
+                <artifactId>tomcat7-maven-plugin</artifactId>
+                <version>2.2</version>
+                <configuration>
+                    <url>http://localhost:${tomcat.port}/manager/text</url>
+                    <!-- <server>TomcatServer</server> <update>true</update> -->
+                    <username>${tomcat.username}</username>
+                    <password>${tomcat.password}</password>
+                    <path>/</path>
+                </configuration>
+            </plugin>
+            <!-- Maven compiler plugin -->
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 221 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AdController.java

@@ -0,0 +1,221 @@
+package com.hboxs.control.admin;
+
+import com.hboxs.ViewObject.AreaVo;
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.common.utils.JsonUtils;
+import com.hboxs.common.utils.PushUtils;
+import com.hboxs.entity.AD;
+import com.hboxs.entity.Area;
+import com.hboxs.entity.Equipment;
+import com.hboxs.service.*;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Controller - 广告管理
+ */
+@Controller("adminADController")
+@RequestMapping("/asl-admin/ad")
+public class AdController extends BaseController {
+
+    @Resource(name = "aDServiceImpl")
+    private ADService aDService;
+
+    @Resource(name = "uploadServiceImpl")
+    private UploadService uploadService;
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Resource(name = "fileServiceImpl")
+    private FileService fileService;
+
+    @Resource(name = "areaServiceImpl")
+    private AreaService areaService;
+
+
+
+    /**
+     * 上传视频
+     */
+    @RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
+    public void uploadVideo(MultipartFile file, HttpServletResponse response, HttpSession session, HttpServletRequest request) {
+        Map<String, Object> data = new HashMap<>();
+        String url = uploadService.upload("/upload/file/${.now?string('yyyyMM')}/", file);
+        if (url == null) {
+            data.put("message", Message.warn("admin.upload.error"));
+        } else {
+
+            data.put("message", SUCCESS_MESSAGE);
+            data.put("url", url);
+        }
+        try {
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), data);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 上传图片
+     */
+    @RequestMapping(value = "/uploadImage", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
+    public void uploadImage(MultipartFile file, HttpServletResponse response, HttpSession session, HttpServletRequest request) {
+
+        Map<String, Object> data = new HashMap<>();
+        String url = uploadService.upload("/upload/video/${.now?string('yyyyMM')}/", file);
+        if (url == null) {
+            data.put("message", Message.warn("admin.upload.error"));
+        } else {
+            data.put("message", SUCCESS_MESSAGE);
+            data.put("url", url);
+        }
+        try {
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), data);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 上传视屏缩略图
+     */
+    @RequestMapping(value = "/uploadmediaPreview", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
+    public void uploadmediaPreview(MultipartFile file, HttpServletResponse response, HttpSession session, HttpServletRequest request) {
+
+        Map<String, Object> data = new HashMap<>();
+        String url = uploadService.upload("/upload/mediaPreview/${.now?string('yyyyMM')}/", file);
+        if (url == null) {
+            data.put("message", Message.warn("admin.upload.error"));
+        } else {
+            data.put("message", SUCCESS_MESSAGE);
+            data.put("url", url);
+        }
+        try {
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), data);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/ad/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(AD aD, RedirectAttributes redirectAttributes) {
+        aDService.save(aD);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+
+        model.addAttribute("aD", aDService.find(id));
+        return "/admin/ad/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(AD aD, RedirectAttributes redirectAttributes) {
+        aDService.update(aD, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Pageable pageable, ModelMap model) {
+        model.addAttribute("type", adminService.getCurrent().getType());
+        model.addAttribute("page", aDService.findPage(pageable));
+        return "/admin/ad/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        aDService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 推送广告
+     */
+    @RequestMapping(value = "/push", method = RequestMethod.GET)
+    public String push(RedirectAttributes redirectAttributes) {
+        List<AD> list = aDService.findAll();
+        for (AD ad : list) {
+            ad.setStatus("推送中");
+            aDService.update(ad);
+        }
+        List<Equipment> all = equipmentService.findAll();
+        for (Equipment e : all) {
+            PushUtils.push(e.getGtClientId(), "", "", PushUtils.buildJson("push", "更新广告").toString());
+        }
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    @RequestMapping(value = "/areaList", method = RequestMethod.GET)
+    public String areaList(Pageable pageable, ModelMap model){
+        List<Area> roots = areaService.findRoots();
+        ArrayList<AreaVo> areaVos = new ArrayList<>();
+        ArrayList<Filter> filters = new ArrayList<>();
+        for (Area root : roots) {
+            AreaVo areaVo = new AreaVo();
+            filters.add(Filter.eq("parent",root.getId()));
+            List<Area> list = areaService.findList(null, filters, null);
+            areaVo.setArea(root);
+            areaVo.setAreas(list);
+            areaVos.add(areaVo);
+            filters.clear();
+        }
+       model.addAttribute("page",areaVos);
+        return "/admin/ad/areaList";
+    }
+
+}

+ 286 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AdminAgencyController.java

@@ -0,0 +1,286 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.*;
+import com.hboxs.common.utils.CookieUtils;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Role;
+import com.hboxs.joinpay.entity.Mch;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.GlobalConfigService;
+import com.hboxs.service.MchService;
+import com.hboxs.service.RoleService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Controller - 代理商
+ */
+@Controller("adminAdminAgencyController")
+@RequestMapping("/asl-admin/adminAgency")
+public class AdminAgencyController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "roleServiceImpl")
+    private RoleService roleService;
+    @Resource(name = "globalConfigServiceImpl")
+    private GlobalConfigService globalConfigService;
+    @Resource(name = "mchServiceImpl")
+    private MchService mchService;
+
+
+    /**
+     * 自动登陆代理商系统
+     */
+    @RequestMapping(value = "/autoLogin", method = RequestMethod.GET)
+    public String autoLogin(Long agencyId , ModelMap model, HttpServletRequest request , HttpServletResponse response) {
+        if (agencyId==null) {
+            model.addAttribute("content" , "找不到代理商");
+            return ERROR_VIEW;
+        }
+
+        Admin agency = adminService.find(agencyId);
+
+        if (agency==null) {
+            model.addAttribute("content" , "找不到代理商");
+            return ERROR_VIEW;
+        }
+
+        Admin currentAdmin = adminService.getCurrent();
+
+        // 判断只有admin才能自动登陆代理商
+        if(currentAdmin.getType()!=Admin.Type.admin){
+            model.addAttribute("content" , "无权访问");
+            return ERROR_VIEW;
+        }
+
+        // 退出当前账户
+        SecurityUtils.getSubject().logout();
+
+
+        AuthenticationToken authenticationToken =
+                new com.hboxs.myshiro.AuthenticationToken(agency.getUsername(), agency.getPassword(), null,
+                        null, "agency", null , false, null);
+
+
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "localhost");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "app.sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "sunzee.com.cn");
+
+        CookieUtils.addCookie(request ,response , "type" , "agency");
+
+        SecurityUtils.getSubject().login(authenticationToken);
+        Principal principal = (Principal) SecurityUtils.getSubject().getPrincipal();
+
+        return "redirect:/asl-admin/login.jsp";
+    }
+
+
+    /**
+     * 检查用户名是否存在
+     */
+    @RequestMapping(value = "/check_username", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    boolean checkUsername(String username) {
+        if (StringUtils.isEmpty(username)) {
+            return false;
+        }
+
+        Admin admin = adminService.findByUsername(username, Admin.Type.agency);
+        if (admin != null) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model) {
+
+        return "/admin/adminAgency/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Admin admin, Long areaId, RedirectAttributes redirectAttributes) {
+        Set<Role> roles = new HashSet<>();
+        roles.add(roleService.find(Constant.ROLE_ID_AGENCY));
+        admin.setRoles(new HashSet<Role>(roles));
+
+        if (adminService.findByUsername(admin.getUsername(), Admin.Type.agency) != null) {
+            return ERROR_VIEW;
+        }
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setType(Admin.Type.agency);
+        admin.setAreaId(areaId);
+        admin.setParentId(adminService.getCurrent().getId());
+        admin.setIsAdmined(false);
+        adminService.save(admin);
+
+        admin.setAgencyId(admin.getId());
+        adminService.update(admin);
+
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+        model.addAttribute("admin", adminService.find(id));
+        Mch mch = mchService.getUniqueness(id);
+        model.addAttribute("mch", mch);
+        List<Admin> admins = adminService.findAllLowerAdminExcludSelf(id);
+        List<Admin> merchantAdmins = new ArrayList<>();
+        List<Admin> personageAdmins = new ArrayList<>();
+        for (Admin admin : admins) {
+            if (admin.getType() == Admin.Type.merchant) {
+                merchantAdmins.add(admin);
+            } else {
+                personageAdmins.add(admin);
+            }
+        }
+        Admin currentAdmin = adminService.getCurrent();
+        model.addAttribute("currentAdmin", currentAdmin);
+        model.addAttribute("merchantAdmins", merchantAdmins);
+        model.addAttribute("personageAdmins", personageAdmins);
+        model.addAttribute("orderStatus", JoinpayConstant.order_status);
+        return "/admin/adminAgency/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Admin admin,  RedirectAttributes redirectAttributes) {
+        Admin pAdmin = adminService.find(admin.getId());
+        if (pAdmin == null) {
+            return ERROR_VIEW;
+        }
+        if (StringUtils.isNotEmpty(admin.getPassword())) {
+            admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        } else {
+            admin.setPassword(pAdmin.getPassword());
+        }
+        if (pAdmin.getIsLocked() && !admin.getIsLocked()) {
+            admin.setLoginFailureCount(0);
+            admin.setLockedDate(null);
+        } else {
+            admin.setIsLocked(pAdmin.getIsLocked());
+            admin.setLoginFailureCount(pAdmin.getLoginFailureCount());
+            admin.setLockedDate(pAdmin.getLockedDate());
+        }
+        adminService.update(admin, "username", "loginDate", "loginIp", "orders", "type", "parentId", "agencyId", "merchantId", "personageId", "isAdmined", "roles");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String agencyList(Pageable pageable, ModelMap model) {
+        pageable.getFilters().add(Filter.eq("type", Admin.Type.agency));
+        pageable.getFilters().add(Filter.eq("isAdmined" , false));
+        model.addAttribute("page", adminService.findPage(pageable));
+        model.addAttribute("currentAdmin", adminService.getCurrent());
+        return "/admin/adminAgency/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        if (ids.length >= adminService.count()) {
+            return Message.error("admin.common.deleteAllNotAllowed");
+        }
+        adminService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 添加市级
+     */
+    @RequestMapping(value = "/addMerchant", method = RequestMethod.GET)
+    public String addMerchant(Long agencyId, ModelMap model) {
+        model.addAttribute("agencyId", agencyId);
+        return "/admin/adminAgency/addMerchant";
+    }
+
+    /**
+     * 保存市级
+     */
+    @RequestMapping(value = "/saveMerchat", method = RequestMethod.POST)
+    public String saveMerchant(Long agencyId, Admin admin, Long areaId, RedirectAttributes redirectAttributes) {
+        Set<Role> roles = new HashSet<>();
+        roles.add(roleService.find(Constant.ROLE_ID_MERCHANT));
+        admin.setRoles(new HashSet<Role>(roles));
+
+        boolean result = checkUsername(admin.getUsername());
+        if (!result) {
+            RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+            requestAttributes.setAttribute("content", "该账号已存在", RequestAttributes.SCOPE_REQUEST);
+            return ERROR_VIEW;
+        }
+
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setType(Admin.Type.merchant);
+        admin.setAreaId(areaId);
+        admin.setParentId(agencyId);
+
+        admin.setIsAdmined(false);
+
+        admin.setAgencyId(agencyId);
+        adminService.save(admin);
+
+        admin.setMerchantId(admin.getId());
+        adminService.update(admin);
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+}

+ 379 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AdminController.java

@@ -0,0 +1,379 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.BaseEntity.Save;
+import com.hboxs.entity.Role;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.GlobalConfigService;
+import com.hboxs.service.RoleService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * Controller - 管理员
+ */
+@Controller("adminAdminController")
+@RequestMapping("/asl-admin/admin")
+public class AdminController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "roleServiceImpl")
+    private RoleService roleService;
+    @Resource(name = "globalConfigServiceImpl")
+    private GlobalConfigService globalConfigService;
+
+    /**
+     * 检查用户名是否存在
+     */
+    @RequestMapping(value = "/check_username", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    boolean checkUsername(String username) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return false;
+        }
+
+
+
+        if (StringUtils.isEmpty(username)) {
+            return false;
+        }
+
+        List<Filter> fs = new ArrayList<>();
+
+        Admin.Type type = adminService.getCurrent().getType();
+        switch (type) {
+            case agency:
+                fs.add(Filter.eq("type", Admin.Type.agency));
+                fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+                break;
+            case merchant:
+                fs.add(Filter.eq("type", Admin.Type.merchant));
+                fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+                fs.add(Filter.isNotNull("merchantId"));
+                fs.add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+                break;
+            case personage:
+                fs.add(Filter.eq("type", Admin.Type.personage));
+                fs.add(Filter.eq("personageId", adminService.getCurrent().getPersonageId()));
+                break;
+            case admin:
+                fs.add(Filter.eq("type", Admin.Type.admin));
+        }
+        fs.add(Filter.eq("username" , username));
+
+
+        List<Admin> as = adminService.findList(1, fs , null);
+        if(as!=null&&as.size()>0){
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model , RedirectAttributes redirectAttributes) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return ERROR_VIEW;
+        }
+
+
+        List<Filter> fs = new ArrayList<>();
+
+
+        Admin.Type type = adminService.getCurrent().getType();
+        switch (type) {
+            case agency:
+                fs.add(Filter.eq("type", Role.Type.agency));
+                fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+                break;
+            case merchant:
+                fs.add(Filter.eq("type", Role.Type.merchant));
+                fs.add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+                break;
+            case personage:
+                fs.add(Filter.eq("type", Role.Type.personage));
+                fs.add(Filter.eq("personageId", adminService.getCurrent().getPersonageId()));
+                break;
+            case admin:
+                fs.add(Filter.eq("type", Role.Type.admin));
+        }
+
+        fs.add(Filter.eq("isSystem", false));
+
+        List<Role> roles = roleService.findList(null, fs, null);
+        if(roles==null || roles.size()==0){
+            addFlashMessage(redirectAttributes, Message.error("请先添加管理员角色"));
+            return "redirect:list.htm";
+        }
+
+        model.addAttribute("roles", roles);
+
+
+        return "/admin/admin/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Admin admin, Long[] roleIds, RedirectAttributes redirectAttributes) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return ERROR_VIEW;
+        }
+
+
+        admin.setRoles(new HashSet<Role>(roleService.findList(roleIds)));
+        if (!isValid(admin, Save.class)) {
+            return ERROR_VIEW;
+        }
+        boolean result = checkUsername(admin.getUsername());
+        if(!result){
+            RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+            requestAttributes.setAttribute("content" , "该账号已存在", RequestAttributes.SCOPE_REQUEST);
+            return ERROR_VIEW;
+        }
+
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setParentId(adminService.getCurrent().getId());
+
+        Admin.Type type = adminService.getCurrent().getType();
+        // admin的类型
+        admin.setType(type);
+        // 继承当前admin身上携带的代理商/经销商/个人商家的 id
+        switch (type) {
+            case agency:
+                admin.setAgencyId(adminService.getCurrent().getAgencyId());
+                break;
+            case merchant:
+                admin.setAgencyId(adminService.getCurrent().getAgencyId());
+                admin.setMerchantId(adminService.getCurrent().getMerchantId());
+                break;
+            case personage:
+                admin.setPersonageId(adminService.getCurrent().getPersonageId());
+                break;
+        }
+
+        admin.setIsAdmined(true);
+        adminService.save(admin);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return ERROR_VIEW;
+        }
+
+        // 当前登陆的管理员
+        Admin currentAdmin = adminService.getCurrent();
+        Admin.Type type = currentAdmin.getType();
+
+        Admin editAdmin = adminService.find(id);
+
+        List<Filter> fs = new ArrayList<>();
+
+
+        switch (type) {
+            case agency:
+                if(!editAdmin.getAgencyId().equals(currentAdmin.getAgencyId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                fs.add(Filter.eq("type", Role.Type.agency));
+                fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+                break;
+            case merchant:
+                if(!editAdmin.getMerchantId().equals(currentAdmin.getMerchantId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                fs.add(Filter.eq("type", Role.Type.merchant));
+                fs.add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+                break;
+            case personage:
+                if(!editAdmin.getPersonageId().equals(currentAdmin.getPersonageId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                fs.add(Filter.eq("type", Role.Type.personage));
+                fs.add(Filter.eq("personageId", adminService.getCurrent().getPersonageId()));
+                break;
+            case admin:
+                fs.add(Filter.eq("type", Role.Type.admin));
+        }
+
+        fs.add(Filter.eq("isSystem", false));
+        model.addAttribute("roles", roleService.findList(null, fs, null));
+        model.addAttribute("admin", editAdmin);
+        return "/admin/admin/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Admin admin, Long[] roleIds, RedirectAttributes redirectAttributes) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return ERROR_VIEW;
+        }
+
+
+        admin.setRoles(new HashSet<Role>(roleService.findList(roleIds)));
+
+
+        // 当前登陆的管理员
+        Admin currentAdmin = adminService.getCurrent();
+        Admin.Type type = currentAdmin.getType();
+
+        Admin pAdmin = adminService.find(admin.getId());
+
+        switch (type) {
+            case agency:
+                if(!pAdmin.getAgencyId().equals(currentAdmin.getAgencyId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                break;
+            case merchant:
+                if(!pAdmin.getMerchantId().equals(currentAdmin.getMerchantId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                break;
+            case personage:
+                if(!pAdmin.getPersonageId().equals(currentAdmin.getPersonageId())){
+                    RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                    requestAttributes.setAttribute("content" , "无权访问", RequestAttributes.SCOPE_REQUEST);
+                    return ERROR_VIEW;
+                }
+                break;
+            case admin:
+        }
+
+        
+        
+        if (pAdmin == null) {
+            return ERROR_VIEW;
+        }
+        if (StringUtils.isNotEmpty(admin.getPassword())) {
+            admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        } else {
+            admin.setPassword(pAdmin.getPassword());
+        }
+        if (pAdmin.getIsLocked() && !admin.getIsLocked()) {
+            admin.setLoginFailureCount(0);
+            admin.setLockedDate(null);
+        } else {
+            admin.setIsLocked(pAdmin.getIsLocked());
+            admin.setLoginFailureCount(pAdmin.getLoginFailureCount());
+            admin.setLockedDate(pAdmin.getLockedDate());
+        }
+        adminService.update(admin, "username", "loginDate", "loginIp", "orders", "type", "parent", "agencyId", "merchantId", "personageId" , "isAdmined");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Pageable pageable, ModelMap model) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return ERROR_VIEW;
+        }
+
+        Admin.Type type = adminService.getCurrent().getType();
+        switch (type) {
+            case agency:
+                pageable.getFilters().add(Filter.eq("type", Admin.Type.agency));
+                pageable.getFilters().add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+                pageable.getFilters().add(Filter.ne("id", adminService.getCurrent().getAgencyId()));
+                break;
+            case merchant:
+                pageable.getFilters().add(Filter.eq("type", Admin.Type.merchant));
+                pageable.getFilters().add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+                pageable.getFilters().add(Filter.ne("id", adminService.getCurrent().getMerchantId()));
+                break;
+            case personage:
+                pageable.getFilters().add(Filter.eq("type", Admin.Type.personage));
+                pageable.getFilters().add(Filter.eq("personageId", adminService.getCurrent().getPersonageId()));
+                pageable.getFilters().add(Filter.ne("id", adminService.getCurrent().getPersonageId()));
+                break;
+            case admin:
+                pageable.getFilters().add(Filter.eq("type", Admin.Type.admin));
+                break;
+        }
+
+        // 排除当前管理员里面,包含的代理商/经销商/个人商家本身。
+
+
+        pageable.getFilters().add(Filter.eq("isAdmined" , true));
+        model.addAttribute("page", adminService.findPage(pageable));
+        return "/admin/admin/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+
+        if(adminService.getCurrent().getType()  == Admin.Type.merchant || adminService.getCurrent().getType()  == Admin.Type.personage ){
+            return null;
+        }
+
+        if (ids.length >= adminService.count()) {
+            return Message.error("admin.common.deleteAllNotAllowed");
+        }
+        adminService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 315 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AdminMerchantController.java

@@ -0,0 +1,315 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.*;
+import com.hboxs.common.utils.AdminUtils;
+import com.hboxs.common.utils.CookieUtils;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Role;
+import com.hboxs.joinpay.entity.Mch;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.GlobalConfigService;
+import com.hboxs.service.MchService;
+import com.hboxs.service.RoleService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Controller - 经销商
+ */
+@Controller("adminAdminMerchantController")
+@RequestMapping("/asl-admin/adminMerchant")
+public class AdminMerchantController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "roleServiceImpl")
+    private RoleService roleService;
+    @Resource(name = "globalConfigServiceImpl")
+    private GlobalConfigService globalConfigService;
+    @Resource(name = "mchServiceImpl")
+    private MchService mchService;
+
+    /**
+     * 自动登陆经销商商系统
+     */
+    @RequestMapping(value = "/autoLogin", method = RequestMethod.GET)
+    public String autoLogin(Long merchantId, ModelMap model , HttpServletRequest request , HttpServletResponse response) {
+        if (merchantId == null) {
+            model.addAttribute("content", "找不到经销商");
+            return ERROR_VIEW;
+        }
+
+        Admin merchant = adminService.find(merchantId);
+
+        if (merchant == null) {
+            model.addAttribute("content", "找不到经销商");
+            return ERROR_VIEW;
+        }
+
+        Admin currentAdmin = adminService.getCurrent();
+
+        // 判断只有admin或者 所属代理商的 才能自动登陆经销商商 ,
+        if (currentAdmin.getType() != Admin.Type.admin && !currentAdmin.getAgencyId().equals(merchant.getAgencyId())) {
+            model.addAttribute("content", "无权访问");
+            return ERROR_VIEW;
+        }
+
+
+
+        // 退出当前账户
+        SecurityUtils.getSubject().logout();
+
+
+        AuthenticationToken authenticationToken =
+                new com.hboxs.myshiro.AuthenticationToken(merchant.getUsername(), merchant.getPassword(), null,
+                        null, "merchant", AdminUtils.encrypt(true, merchant.getAgencyId()), false, null);
+
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "localhost");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "app.sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "localhost");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "app.sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "sunzee.com.cn");
+
+        CookieUtils.addCookie(request ,response , "type" , "merchant");
+        CookieUtils.addCookie(request ,response , "p" , AdminUtils.encrypt(true, merchant.getAgencyId()));
+
+
+        SecurityUtils.getSubject().login(authenticationToken);
+        Principal principal = (Principal) SecurityUtils.getSubject().getPrincipal();
+
+        return "redirect:/asl-admin/login.jsp";
+    }
+
+    /**
+     * 检查用户名是否存在
+     */
+    @RequestMapping(value = "/check_username", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    boolean checkUsername(String username) {
+        if (StringUtils.isEmpty(username)) {
+            return false;
+        }
+
+        List<Filter> fs = new ArrayList<>();
+
+        fs.add(Filter.eq("type", Admin.Type.merchant));
+        fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+        fs.add(Filter.eq("username", username));
+
+        List<Admin> admins = adminService.findList(1, fs, null);
+        if (admins != null && admins.size() > 0) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model) {
+        return "/admin/adminMerchant/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Admin admin, Long areaId, RedirectAttributes redirectAttributes) {
+        Set<Role> roles = new HashSet<>();
+        roles.add(roleService.find(Constant.ROLE_ID_MERCHANT));
+        admin.setRoles(new HashSet<Role>(roles));
+
+        boolean result = checkUsername(admin.getUsername());
+        if (!result) {
+            RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+            requestAttributes.setAttribute("content", "该账号已存在", RequestAttributes.SCOPE_REQUEST);
+            return ERROR_VIEW;
+        }
+
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setType(Admin.Type.merchant);
+        admin.setAreaId(areaId);
+        admin.setParentId(adminService.getCurrent().getId());
+        admin.setIsAdmined(false);
+        admin.setAgencyId(adminService.getCurrent().getAgencyId());
+        adminService.save(admin);
+
+        admin.setMerchantId(admin.getId());
+        adminService.update(admin);
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+
+        Admin currentAdmin = adminService.getCurrent();
+
+        Admin editAdmin = adminService.find(id);
+        if (currentAdmin.getType() != Admin.Type.admin) {
+            if (!editAdmin.getAgencyId().equals(currentAdmin.getAgencyId())) {
+                RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                requestAttributes.setAttribute("content", "无权访问", RequestAttributes.SCOPE_REQUEST);
+                return ERROR_VIEW;
+            }
+        }
+        List<Admin> admins = adminService.findAllLowerAdminExcludSelf(id);
+        model.addAttribute("currentAdmin", currentAdmin);
+        model.addAttribute("personageAdmins", admins);
+        Mch mch = mchService.getUniqueness(id);
+        model.addAttribute("mch", mch);
+        model.addAttribute("admin", editAdmin);
+        model.addAttribute("orderStatus", JoinpayConstant.order_status);
+        return "/admin/adminMerchant/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Admin admin,  RedirectAttributes redirectAttributes) {
+        Admin currentAdmin = adminService.getCurrent();
+
+        Admin pAdmin = adminService.find(admin.getId());
+        if (currentAdmin.getType() != Admin.Type.admin) {
+            if (!pAdmin.getAgencyId().equals(currentAdmin.getAgencyId())) {
+                RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                requestAttributes.setAttribute("content", "无权访问", RequestAttributes.SCOPE_REQUEST);
+                return ERROR_VIEW;
+            }
+        }
+
+        if (pAdmin == null) {
+            return ERROR_VIEW;
+        }
+        if (StringUtils.isNotEmpty(admin.getPassword())) {
+            admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        } else {
+            admin.setPassword(pAdmin.getPassword());
+        }
+        if (pAdmin.getIsLocked() && !admin.getIsLocked()) {
+            admin.setLoginFailureCount(0);
+            admin.setLockedDate(null);
+        } else {
+            admin.setIsLocked(pAdmin.getIsLocked());
+            admin.setLoginFailureCount(pAdmin.getLoginFailureCount());
+            admin.setLockedDate(pAdmin.getLockedDate());
+        }
+        adminService.update(admin, "username", "loginDate", "loginIp", "orders", "type", "parentId", "agencyId", "merchantId", "personageId", "isAdmined", "roles");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String agencyList(Pageable pageable, ModelMap model) {
+        pageable.getFilters().add(Filter.eq("type", Admin.Type.merchant));
+        pageable.getFilters().add(Filter.eq("isAdmined", false));
+        Admin current = adminService.getCurrent();
+        pageable.getFilters().add(Filter.eq("agencyId", current.getAgencyId()));
+        model.addAttribute("page", adminService.findPage(pageable));
+        model.addAttribute("admin", current);
+        model.addAttribute("currentAdmin", current);
+        return "/admin/adminMerchant/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        if (ids.length >= adminService.count()) {
+            return Message.error("admin.common.deleteAllNotAllowed");
+        }
+        adminService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 添加终端
+     */
+    @RequestMapping(value = "/addPersonage", method = RequestMethod.GET)
+    public String addPersonage(Long merchantId, ModelMap model) {
+        model.addAttribute("merchantId", merchantId);
+        return "/admin/adminMerchant/addPersonage";
+    }
+
+    /**
+     * 保存终端
+     */
+    @RequestMapping(value = "/savePersonage", method = RequestMethod.POST)
+    public String savePersonage(Long merchantId, Admin admin, Long areaId, RedirectAttributes redirectAttributes) {
+        Set<Role> roles = new HashSet<>();
+        roles.add(roleService.find(Constant.ROLE_ID_PERSONAGE));
+        admin.setRoles(new HashSet<Role>(roles));
+
+        boolean result = checkUsername(admin.getUsername());
+        if (!result) {
+            RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+            requestAttributes.setAttribute("content", "该账号已存在", RequestAttributes.SCOPE_REQUEST);
+            return ERROR_VIEW;
+        }
+
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setType(Admin.Type.personage);
+        admin.setAreaId(areaId);
+        admin.setParentId(merchantId);
+        admin.setIsAdmined(false);
+        admin.setAgencyId(adminService.find(merchantId).getAgencyId());
+        admin.setMerchantId(merchantId);
+        adminService.save(admin);
+
+        admin.setPersonageId(admin.getId());
+        adminService.update(admin);
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+
+}

+ 268 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AdminPersonageController.java

@@ -0,0 +1,268 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.*;
+import com.hboxs.common.utils.AdminUtils;
+import com.hboxs.common.utils.CookieUtils;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Role;
+import com.hboxs.joinpay.entity.Mch;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.GlobalConfigService;
+import com.hboxs.service.MchService;
+import com.hboxs.service.RoleService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Controller - 个人商家
+ */
+@Controller("adminAdminPersonageController")
+@RequestMapping("/asl-admin/adminPersonage")
+public class AdminPersonageController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "roleServiceImpl")
+    private RoleService roleService;
+    @Resource(name = "globalConfigServiceImpl")
+    private GlobalConfigService globalConfigService;
+    @Resource(name = "mchServiceImpl")
+    private MchService mchService;
+
+    /**
+     * 自动登陆个人商家系统
+     */
+    @RequestMapping(value = "/autoLogin", method = RequestMethod.GET)
+    public String autoLogin(Long personageId, ModelMap model, HttpServletRequest request , HttpServletResponse response) {
+        if (personageId == null) {
+            model.addAttribute("content", "找不到个人商家");
+            return ERROR_VIEW;
+        }
+
+        Admin personage = adminService.find(personageId);
+
+        if (personage == null) {
+            model.addAttribute("content", "找不到个人商家");
+            return ERROR_VIEW;
+        }
+
+        Admin currentAdmin = adminService.getCurrent();
+
+        // 判断只有admin或者 所属经销商的 才能自动登陆个人商家 ,
+        if (currentAdmin.getType() != Admin.Type.admin && !currentAdmin.getMerchantId().equals(personage.getMerchantId())) {
+            model.addAttribute("content", "无权访问");
+            return ERROR_VIEW;
+        }
+
+
+        // 退出当前账户
+        SecurityUtils.getSubject().logout();
+
+
+        AuthenticationToken authenticationToken =
+                new com.hboxs.myshiro.AuthenticationToken(personage.getUsername(), personage.getPassword(), null,
+                        null, "personage", AdminUtils.encrypt(true, personage.getMerchantId()), false, null);
+
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "localhost");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "app.sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "type" , "/asl-admin" , "sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "localhost");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "app.sunzee.com.cn");
+        CookieUtils.removeCookie(request ,response , "p" , "/asl-admin" , "sunzee.com.cn");
+
+        CookieUtils.addCookie(request ,response , "type" , "personage");
+        CookieUtils.addCookie(request ,response , "p" , AdminUtils.encrypt(true, personage.getMerchantId()));
+
+        SecurityUtils.getSubject().login(authenticationToken);
+        Principal principal = (Principal) SecurityUtils.getSubject().getPrincipal();
+
+        return "redirect:/asl-admin/login.jsp";
+    }
+
+
+    /**
+     * 检查用户名是否存在
+     */
+    @RequestMapping(value = "/check_username", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    boolean checkUsername(String username) {
+        if (StringUtils.isEmpty(username)) {
+            return false;
+        }
+
+        List<Filter> fs = new ArrayList<>();
+
+        fs.add(Filter.eq("type", Admin.Type.personage));
+        fs.add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+        fs.add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+        fs.add(Filter.eq("username", username));
+
+        List<Admin> admins = adminService.findList(1, fs, null);
+        if (admins != null && admins.size() > 0) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model) {
+        return "/admin/adminPersonage/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Admin admin, Long areaId, RedirectAttributes redirectAttributes) {
+        Set<Role> roles = new HashSet<>();
+        roles.add(roleService.find(Constant.ROLE_ID_PERSONAGE));
+        admin.setRoles(new HashSet<Role>(roles));
+
+        boolean result = checkUsername(admin.getUsername());
+        if (!result) {
+            RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+            requestAttributes.setAttribute("content", "该账号已存在", RequestAttributes.SCOPE_REQUEST);
+            return ERROR_VIEW;
+        }
+
+        admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        admin.setIsLocked(false);
+        admin.setLoginFailureCount(0);
+        admin.setLockedDate(null);
+        admin.setLoginDate(null);
+        admin.setLoginIp(null);
+        admin.setType(Admin.Type.personage);
+        admin.setAreaId(areaId);
+        admin.setParentId(adminService.getCurrent().getId());
+        admin.setIsAdmined(false);
+        admin.setAgencyId(adminService.getCurrent().getAgencyId());
+        admin.setMerchantId(adminService.getCurrent().getMerchantId());
+        adminService.save(admin);
+
+        admin.setPersonageId(admin.getId());
+        adminService.update(admin);
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+
+        Admin currentAdmin = adminService.getCurrent();
+
+        Admin editAdmin = adminService.find(id);
+        if (currentAdmin.getType() != Admin.Type.admin) {
+            if (!editAdmin.getMerchantId().equals(currentAdmin.getMerchantId())) {
+                RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                requestAttributes.setAttribute("content", "无权访问", RequestAttributes.SCOPE_REQUEST);
+                return ERROR_VIEW;
+            }
+
+        }
+        model.addAttribute("currentAdmin", currentAdmin);
+
+        Mch mch = mchService.getUniqueness(id);
+        model.addAttribute("mch", mch);
+        model.addAttribute("admin", editAdmin);
+        model.addAttribute("orderStatus", JoinpayConstant.order_status);
+        return "/admin/adminPersonage/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Admin admin, RedirectAttributes redirectAttributes) {
+        Admin currentAdmin = adminService.getCurrent();
+
+        Admin pAdmin = adminService.find(admin.getId());
+        if (currentAdmin.getType() != Admin.Type.admin) {
+            if (!pAdmin.getAgencyId().equals(currentAdmin.getAgencyId())) {
+                RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+                requestAttributes.setAttribute("content", "无权访问", RequestAttributes.SCOPE_REQUEST);
+                return ERROR_VIEW;
+            }
+        }
+        if (pAdmin == null) {
+            return ERROR_VIEW;
+        }
+        if (StringUtils.isNotEmpty(admin.getPassword())) {
+            admin.setPassword(DigestUtils.md5Hex(admin.getPassword()));
+        } else {
+            admin.setPassword(pAdmin.getPassword());
+        }
+        if (pAdmin.getIsLocked() && !admin.getIsLocked()) {
+            admin.setLoginFailureCount(0);
+            admin.setLockedDate(null);
+        } else {
+            admin.setIsLocked(pAdmin.getIsLocked());
+            admin.setLoginFailureCount(pAdmin.getLoginFailureCount());
+            admin.setLockedDate(pAdmin.getLockedDate());
+        }
+        adminService.update(admin, "username", "loginDate", "loginIp", "orders", "type", "parentId", "agencyId", "merchantId", "personageId", "isAdmined", "roles");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String agencyList(Pageable pageable, ModelMap model) {
+        pageable.getFilters().add(Filter.eq("type", Admin.Type.personage));
+        pageable.getFilters().add(Filter.eq("isAdmined", false));
+        pageable.getFilters().add(Filter.eq("agencyId", adminService.getCurrent().getAgencyId()));
+        pageable.getFilters().add(Filter.eq("merchantId", adminService.getCurrent().getMerchantId()));
+        List<Admin> content = adminService.findPage(pageable).getContent();
+        model.addAttribute("page", adminService.findPage(pageable));
+        model.addAttribute("admin", adminService.getCurrent());
+        return "/admin/adminPersonage/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        if (ids.length >= adminService.count()) {
+            return Message.error("admin.common.deleteAllNotAllowed");
+        }
+        adminService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 259 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AlarmRecordController.java

@@ -0,0 +1,259 @@
+/*
+ *
+ *  AlarmRecordController
+ *
+ */
+package com.hboxs.control.admin;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.hboxs.common.Filter;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.AlarmRecord;
+import com.hboxs.excel.AlarmRecordTarget;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.AlarmRecordService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Controller - 报警记录
+ */
+@Controller("adminAlarmRecordController")
+@RequestMapping("/asl-admin/alarmRecord")
+public class AlarmRecordController extends BaseController {
+
+    @Resource(name = "alarmRecordServiceImpl")
+    private AlarmRecordService alarmRecordService;
+
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/alarmRecord/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(AlarmRecord alarmRecord, RedirectAttributes redirectAttributes) {
+        alarmRecordService.save(alarmRecord);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("alarmRecord", alarmRecordService.find(id));
+        return "/admin/alarmRecord/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(AlarmRecord alarmRecord, RedirectAttributes redirectAttributes) {
+        alarmRecordService.update(alarmRecord, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String clientId, String name, String adminUserName, String alarmContent, String beginEndDate,
+                       AlarmRecord.Type type, Pageable pageable, ModelMap model) {
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        List<Filter> filters = pageable.getFilters();
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+
+        if (!StringUtils.isEmpty(clientId)) {
+            filters.add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (!StringUtils.isEmpty(name)) {
+            filters.add(Filter.like("name", "%" + name + "%"));
+        }
+        if (!StringUtils.isEmpty(adminUserName)) {
+            filters.add(Filter.like("adminUserName", "%" + adminUserName + "%"));
+        }
+        if (!StringUtils.isEmpty(alarmContent)) {
+            filters.add(Filter.like("alarmContent", "%" + alarmContent + "%"));
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date begin = null;
+            Date end = null;
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            filters.add(Filter.geDate("occurrenceTime", begin));
+            filters.add(Filter.leDate("occurrenceTime", end));
+        }
+        if (type != null) {
+            filters.add(Filter.eq("type", type));
+        }
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("name", name);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("alarmContent", alarmContent);
+        model.addAttribute("admin", adminService.getCurrent());
+        model.addAttribute("page", alarmRecordService.findPage(pageable));
+        model.addAttribute("type", type);
+        return "/admin/alarmRecord/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        alarmRecordService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * Excel导出
+     */
+    @RequestMapping(value = "/export")
+    public Object export(HttpServletResponse response, String date, Long[] ids) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        List<Filter> filters = new ArrayList<>();
+
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+
+        try {
+            if (StringUtils.isNotBlank(date)) {
+                String[] datestring = date.split(" - ");
+                Date startDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[0]);
+                Date endDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[1]);
+                filters.add(Filter.geDate("createDate", startDate));
+                filters.add(Filter.leDate("createDate", DateUtils.addDays(endDate, 1)));
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return JsonMessage.success("日期格式错误");
+        }
+        List<AlarmRecord> alarmRecordList = alarmRecordService.findList(null, filters, null);
+        /*List<AlarmRecord> alarmRecordList = alarmRecordService.findList(ids);*/
+        /*List<AlarmRecord> alarmRecordList = alarmRecordService.findList(null, filters, null);*/
+        List<AlarmRecordTarget> recordTargets = new ArrayList<>();
+        for (AlarmRecord alarmRecord : alarmRecordList) {
+            AlarmRecordTarget recordTarget = new AlarmRecordTarget(alarmRecord);
+            recordTargets.add(recordTarget);
+        }
+
+        ExportParams params = new ExportParams("报警记录", "sheet1");
+        Workbook workbook = ExcelExportUtil.exportExcel(params, AlarmRecordTarget.class, recordTargets);
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("报警记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+
+            }
+        }
+        return JsonMessage.success("导出错误");
+    }
+}

+ 97 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/ApkInfoController.java

@@ -0,0 +1,97 @@
+/*
+ *
+ *  ApkInfoController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.ApkInfo;
+import com.hboxs.service.ApkInfoService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import java.util.List;
+
+/**
+ * Controller - apk信息
+ */
+@Controller("adminApkInfoController")
+@RequestMapping("/asl-admin/apkInfo")
+public class ApkInfoController extends BaseController {
+
+    @Resource(name = "apkInfoServiceImpl")
+    private ApkInfoService apkInfoService;
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/apkInfo/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(ApkInfo apkInfo, RedirectAttributes redirectAttributes) {
+        apkInfoService.save(apkInfo);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("apkInfo", apkInfoService.find(id));
+        return "/admin/apkInfo/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(ApkInfo apkInfo, RedirectAttributes redirectAttributes) {
+        apkInfoService.update(apkInfo, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Integer version, Pageable pageable, ModelMap model) {
+        List<Filter> filters = pageable.getFilters();
+        if (version != null) {
+            filters.add(Filter.eq("version", version));
+        }
+
+        model.addAttribute("page", apkInfoService.findPage(pageable));
+        model.addAttribute("version", version);
+        return "/admin/apkInfo/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        apkInfoService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 105 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/AreaController.java

@@ -0,0 +1,105 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Message;
+import com.hboxs.entity.Area;
+import com.hboxs.service.AreaService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+
+/**
+ * Controller - 地区
+ */
+@Controller("adminAreaController")
+@RequestMapping("/asl-admin/area")
+public class AreaController extends BaseController {
+
+    @Resource(name = "areaServiceImpl")
+    private AreaService areaService;
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(Long parentId, ModelMap model) {
+        model.addAttribute("parent", areaService.find(parentId));
+        return "/admin/area/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Area area, Long parentId, RedirectAttributes redirectAttributes) {
+        area.setParent(areaService.find(parentId));
+        if (!isValid(area)) {
+            return ERROR_VIEW;
+        }
+        area.setFullName(null);
+        area.setTreePath(null);
+        area.setChildren(null);
+        areaService.save(area);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+        model.addAttribute("area", areaService.find(id));
+        return "/admin/area/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Area area, RedirectAttributes redirectAttributes) {
+        if (!isValid(area)) {
+            return ERROR_VIEW;
+        }
+        areaService.update(area, "fullName", "treePath", "parent", "children");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Long parentId, ModelMap model) {
+        Area parent = areaService.find(parentId);
+        if (parent != null) {
+            model.addAttribute("parent", parent);
+            model.addAttribute("areas", new ArrayList<Area>(parent.getChildren()));
+        } else {
+            model.addAttribute("areas", areaService.findRoots());
+        }
+        return "/admin/area/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long id) {
+        areaService.delete(id);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 199 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/BaseController.java

@@ -0,0 +1,199 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.DateEditor;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.common.Message;
+import com.hboxs.common.Setting;
+import com.hboxs.template.directive.FlashMessageDirective;
+import com.hboxs.common.utils.SettingUtils;
+import com.hboxs.common.utils.SpringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.propertyeditors.StringTrimmerEditor;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * Controller - 基类
+ */
+public class BaseController {
+
+	/** 图片类型 , 用来分图片路径 */
+	public static final String IMAGE_TYPE = "imageType";
+
+	/**
+	 * 错误视图
+	 */
+	protected static final String ERROR_VIEW = "/admin/common/error";
+
+	/**
+	 * 错误消息
+	 */
+	protected static final Message ERROR_MESSAGE = Message.error("admin.message.error");
+
+	/**
+	 * 成功消息
+	 */
+	protected static final Message SUCCESS_MESSAGE = Message.success("admin.message.success");
+
+	/**
+	 * "验证结果"参数名称
+	 */
+	private static final String CONSTRAINT_VIOLATIONS_ATTRIBUTE_NAME = "constraintViolations";
+
+	@Resource(name = "validator")
+	private Validator validator;
+
+	/**
+	 * 数据绑定
+	 *
+	 * @param binder
+	 *            WebDataBinder
+	 */
+	@InitBinder
+	protected void initBinder(WebDataBinder binder) {
+		binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
+		binder.registerCustomEditor(Date.class, new DateEditor(true));
+	}
+
+	/**
+	 * 数据验证
+	 *
+	 * @param target
+	 *            验证对象
+	 * @param groups
+	 *            验证组
+	 * @return 验证结果
+	 */
+	protected boolean isValid(Object target, Class<?>... groups) {
+		Set<ConstraintViolation<Object>> constraintViolations = validator.validate(target, groups);
+		if (constraintViolations.isEmpty()) {
+			return true;
+		} else {
+			RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+			requestAttributes.setAttribute(CONSTRAINT_VIOLATIONS_ATTRIBUTE_NAME, constraintViolations, RequestAttributes.SCOPE_REQUEST);
+			return false;
+		}
+	}
+
+	/**
+	 * 数据验证
+	 *
+	 * @param type
+	 *            类型
+	 * @param property
+	 *            属性
+	 * @param value
+	 *            值
+	 * @param groups
+	 *            验证组
+	 * @return 验证结果
+	 */
+	protected boolean isValid(Class<?> type, String property, Object value, Class<?>... groups) {
+		Set<?> constraintViolations = validator.validateValue(type, property, value, groups);
+		if (constraintViolations.isEmpty()) {
+			return true;
+		} else {
+			RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+			requestAttributes.setAttribute(CONSTRAINT_VIOLATIONS_ATTRIBUTE_NAME, constraintViolations, RequestAttributes.SCOPE_REQUEST);
+			return false;
+		}
+	}
+
+	/**
+	 * 货币格式化
+	 *
+	 * @param amount
+	 *            金额
+	 * @param showSign
+	 *            显示标志
+	 * @param showUnit
+	 *            显示单位
+	 * @return 货币格式化
+	 */
+	protected String currency(BigDecimal amount, boolean showSign, boolean showUnit) {
+		Setting setting = SettingUtils.get();
+		String price = setting.setScale(amount).toString();
+		if (showSign) {
+			price = setting.getCurrencySign() + price;
+		}
+		if (showUnit) {
+			price += setting.getCurrencyUnit();
+		}
+		return price;
+	}
+
+	/**
+	 * 获取国际化消息
+	 *
+	 * @param code
+	 *            代码
+	 * @param args
+	 *            参数
+	 * @return 国际化消息
+	 */
+	protected String message(String code, Object... args) {
+		return SpringUtils.getMessage(code, args);
+	}
+
+	/**
+	 * 添加瞬时消息
+	 *
+	 * @param redirectAttributes
+	 *            RedirectAttributes
+	 * @param message
+	 *            消息
+	 */
+	protected void addFlashMessage(RedirectAttributes redirectAttributes, Message message) {
+		if (redirectAttributes != null && message != null) {
+			redirectAttributes.addFlashAttribute(FlashMessageDirective.FLASH_MESSAGE_ATTRIBUTE_NAME, message);
+		}
+	}
+
+
+	public void printJson(HttpServletResponse response, String jsonStr) throws IOException {
+		response.setContentType("text/plain; charset=UTF-8");
+		response.setHeader("Cache-Control", "no-cache");
+		response.setContentLength(jsonStr.getBytes("utf-8").length);
+		response.getWriter().write(jsonStr);
+		response.getWriter().flush();
+	}
+
+	public void printJson(HttpServletResponse response, JSONObject jsonObj) throws IOException {
+		String jsonStr = jsonObj.toString();
+		printJson(response, jsonStr);
+	}
+
+	/**
+	 * 统一处理异常抛出未知错误
+	 *
+	 * @param e 异常
+	 * @return json
+	 */
+	@ExceptionHandler
+	public
+	@ResponseBody
+	Object exp(Exception e) {
+		e.printStackTrace();
+		return JsonMessage.UNKNOWN_ERROR;
+	}
+
+}

+ 247 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/CoinOrderController.java

@@ -0,0 +1,247 @@
+/*
+ *
+ *  CoinOrderController
+ *
+ */
+package com.hboxs.control.admin;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.hboxs.common.Filter;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.CoinOrder;
+import com.hboxs.excel.CoinOrderTarget;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.CoinOrderService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Controller - 投币以及无需支付订单
+ */
+@Controller("adminCoinOrderController")
+@RequestMapping("/asl-admin/coinOrder")
+public class CoinOrderController extends BaseController {
+
+    @Resource(name = "coinOrderServiceImpl")
+    private CoinOrderService coinOrderService;
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/coinOrder/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(CoinOrder coinOrder, RedirectAttributes redirectAttributes) {
+        coinOrderService.save(coinOrder);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("coinOrder", coinOrderService.find(id));
+        return "/admin/coinOrder/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(CoinOrder coinOrder, RedirectAttributes redirectAttributes) {
+        coinOrderService.update(coinOrder, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String clientId, String sn, String productName, CoinOrder.Type type, Integer payType, String beginEndDate, Pageable pageable, ModelMap model) {
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date begin = null;
+            Date end = null;
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            pageable.getFilters().add(Filter.geDate("createDate", begin));
+            pageable.getFilters().add(Filter.leDate("createDate", end));
+        }
+
+        if (!StringUtils.isEmpty(sn)) {
+            pageable.getFilters().add(Filter.like("sn", "%" + sn + "%"));
+        }
+        if (!StringUtils.isEmpty(productName)) {
+            pageable.getFilters().add(Filter.like("productName", "%" + productName + "%"));
+        }
+        if (StringUtils.isNotEmpty(clientId)) {
+            pageable.getFilters().add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (payType != null) {
+            pageable.getFilters().add(Filter.eq("payType", payType));
+        }
+        if (type != null) {
+            pageable.getFilters().add(Filter.eq("type", type));
+        }
+
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("sn", sn);
+        model.addAttribute("productName", productName);
+        model.addAttribute("payType", payType);
+        model.addAttribute("type", type);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("page", coinOrderService.findPage(pageable));
+        return "/admin/coinOrder/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        coinOrderService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * Excel导出
+     */
+    @RequestMapping(value = "/export")
+    public Object export(HttpServletResponse response, Long[] ids, String date) {
+        Admin admin = adminService.getCurrent();
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        List<Filter> filters = new ArrayList<>();
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+        try {
+            if (StringUtils.isNotBlank(date)) {
+                String[] datestring = date.split(" - ");
+                Date startDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[0]);
+                Date endDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[1]);
+                filters.add(Filter.geDate("createDate", startDate));
+                filters.add(Filter.leDate("createDate", DateUtils.addDays(endDate, 1)));
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return JsonMessage.success("日期格式错误");
+        }
+        List<CoinOrder> list = coinOrderService.findList(null, filters, null);
+        List<CoinOrderTarget> coinOrderTargets = coinOrderService.findByCoinOrder(list);
+        ExportParams exportParams = new ExportParams("线下订单记录", "sheet1");
+        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CoinOrderTarget.class, coinOrderTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("线下订单记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+
+        return JsonMessage.success("导出错误");
+    }
+}

+ 213 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/CommonController.java

@@ -0,0 +1,213 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Area;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.AreaService;
+import com.hboxs.service.EquipmentService;
+import com.hboxs.service.MchService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.ServletContextAware;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Controller - 共用
+ */
+@Controller("adminCommonController")
+@RequestMapping("/asl-admin/common")
+public class CommonController implements ServletContextAware {
+
+    @Value("${system.name}")
+    private String systemName;
+    @Value("${system.version}")
+    private String systemVersion;
+    @Value("${system.description}")
+    private String systemDescription;
+    @Value("${system.show_powered}")
+    private Boolean systemShowPowered;
+    @Resource(name = "areaServiceImpl")
+    private AreaService areaService;
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+
+    /**
+     * servletContext
+     */
+    private ServletContext servletContext;
+
+    public void setServletContext(ServletContext servletContext) {
+        this.servletContext = servletContext;
+    }
+
+    /**
+     * 主页
+     */
+    @RequestMapping(value = "/main", method = RequestMethod.GET)
+    public String main(HttpServletRequest request, Model model) {
+        model.addAttribute("admin" , adminService.getCurrent());
+        return "/admin/common/main";
+    }
+
+    /**
+     * 首页
+     */
+    @RequestMapping(value = "/index", method = RequestMethod.GET)
+    public String index(ModelMap model) {
+        model.addAttribute("systemName", systemName);
+        model.addAttribute("systemVersion", systemVersion);
+        model.addAttribute("systemDescription", systemDescription);
+        model.addAttribute("systemShowPowered", systemShowPowered);
+        model.addAttribute("javaVersion", System.getProperty("java.version"));
+        model.addAttribute("javaHome", System.getProperty("java.home"));
+        model.addAttribute("osName", System.getProperty("os.name"));
+        model.addAttribute("osArch", System.getProperty("os.arch"));
+        model.addAttribute("serverInfo", servletContext.getServerInfo());
+        model.addAttribute("servletVersion", servletContext.getMajorVersion() + "." + servletContext.getMinorVersion());
+
+
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin" , admin);
+
+        Integer agencyCount = 0;
+        Integer merchantCount = 0;
+        Integer personageCount = 0;
+        long equipmentCount = 0;
+
+        List<Admin> lowers = null;
+        switch (admin.getType()){
+            case admin:
+                List<Admin> all = adminService.findAll();
+                for (Admin a : all){
+                    if(a.getIsAdmined()==false && a.getType()==Admin.Type.agency){
+                        agencyCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.merchant){
+                        merchantCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.personage){
+                        personageCount++;
+                    }
+                }
+
+                equipmentCount = equipmentService.count();
+                break;
+            case agency:
+                lowers = adminService.findAllLowerAdmin(admin.getId());
+                for (Admin a : lowers){
+                    if(a.getIsAdmined()==false && a.getType()==Admin.Type.agency){
+                        agencyCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.merchant){
+                        merchantCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.personage){
+                        personageCount++;
+                    }
+                }
+                equipmentCount = equipmentService.findByAdminId(admin.getId()).size();
+                break;
+
+            case merchant:
+                lowers = adminService.findAllLowerAdmin(admin.getId());
+                for (Admin a : lowers){
+                    if(a.getIsAdmined()==false && a.getType()==Admin.Type.agency){
+                        agencyCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.merchant){
+                        merchantCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.personage){
+                        personageCount++;
+                    }
+                }
+                equipmentCount = equipmentService.findByAdminId(admin.getId()).size();
+                break;
+
+            case personage:
+                lowers = adminService.findAllLowerAdmin(admin.getId());
+                for (Admin a : lowers){
+                    if(a.getIsAdmined()==false && a.getType()==Admin.Type.agency){
+                        agencyCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.merchant){
+                        merchantCount++;
+                    }else if(a.getIsAdmined()==false && a.getType()==Admin.Type.personage){
+                        personageCount++;
+                    }
+                }
+                equipmentCount = equipmentService.findByAdminId(admin.getId()).size();
+                break;
+        }
+        model.addAttribute("agencyCount" , agencyCount);
+        model.addAttribute("merchantCount" , merchantCount);
+        model.addAttribute("personageCount" , personageCount);
+        model.addAttribute("equipmentCount" ,equipmentCount);
+
+        return "/admin/common/index";
+    }
+
+    /**
+     * 地区
+     */
+    @RequestMapping(value = "/area", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    Map<Long, String> area(Long parentId) {
+        List<Area> areas = new ArrayList<Area>();
+        Area parent = areaService.find(parentId);
+        if (parent != null) {
+            areas = new ArrayList<Area>(parent.getChildren());
+        } else {
+            areas = areaService.findRoots();
+        }
+        Map<Long, String> options = new HashMap<Long, String>();
+        for (Area area : areas) {
+            options.put(area.getId(), area.getName());
+        }
+        return options;
+    }
+
+
+    /**
+     * 错误提示
+     */
+    @RequestMapping("/error")
+    public String error() {
+        return "/admin/common/error";
+    }
+
+    /**
+     * 权限错误
+     */
+    @RequestMapping("/unauthorized")
+    public String unauthorized(HttpServletRequest request, HttpServletResponse response) {
+        String requestType = request.getHeader("X-Requested-With");
+        if (requestType != null && requestType.equalsIgnoreCase("XMLHttpRequest")) {
+            response.addHeader("loginStatus", "unauthorized");
+            try {
+                response.sendError(HttpServletResponse.SC_FORBIDDEN);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            return null;
+        }
+        return "/admin/common/unauthorized";
+    }
+
+}

+ 236 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentApplyController.java

@@ -0,0 +1,236 @@
+/*
+ *
+ *  EquipmentApplyController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.common.utils.PushUtils;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Equipment;
+import com.hboxs.entity.EquipmentApply;
+import com.hboxs.entity.Product;
+import com.hboxs.service.*;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controller - 初始化申请表
+ */
+@Controller("adminEquipmentApplyController")
+@RequestMapping("/asl-admin/equipmentApply")
+public class EquipmentApplyController extends BaseController {
+
+    @Resource(name = "equipmentApplyServiceImpl")
+    private EquipmentApplyService equipmentApplyService;
+
+    @Resource(name = "productServiceImpl")
+    private ProductService productService;
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Resource(name = "timeRuleServiceImpl")
+    private TimeRuleService timeRuleService;
+
+    /**
+     * 设备初始化列表
+     *
+     * @param clientId
+     * @param managerId
+     * @param pageable
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "/listInit", method = RequestMethod.GET)
+    public String listInit(String clientId, String managerId, String adminUserName,
+                           EquipmentApply.StatusType statusType, EquipmentApply.Type type,
+                           Pageable pageable, ModelMap model) {
+
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+
+        List<Filter> filters = pageable.getFilters();
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+        if (!StringUtils.isEmpty(clientId)) {
+            filters.add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (!StringUtils.isEmpty(managerId)) {
+            filters.add(Filter.like("managerId", "%" + managerId + "%"));
+        }
+        if (!StringUtils.isEmpty(adminUserName)) {
+            filters.add(Filter.like("adminUserName", "%" + adminUserName + "%"));
+        }
+        if (statusType != null) {
+            filters.add(Filter.eq("statusType", statusType));
+        }
+        if (type != null) {
+            filters.add(Filter.eq("type", type));
+        }
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("managerId", managerId);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("statusType", statusType);
+        model.addAttribute("type", type);
+        model.addAttribute("admin", adminService.getCurrent());
+        model.addAttribute("page", equipmentApplyService.findPage(pageable));
+        return "/admin/equipmentApply/list";
+    }
+
+    /**
+     * 更新申请状态
+     */
+    @RequestMapping(value = "/changeStatus", method = RequestMethod.GET)
+    public String changeStatus(Long id, String status, RedirectAttributes redirectAttributes) {
+
+        if (null != id) {
+            EquipmentApply equipmentApply = equipmentApplyService.find(id);
+            if (equipmentApply != null) {
+                if (!StringUtils.isEmpty(status)) {
+                    if (status.equals("agreed")) {
+                        String clientId = equipmentApply.getClientId();
+                        //判端是否有默认规则
+                        if (timeRuleService.find(Long.valueOf(1)) == null) {
+                            addFlashMessage(redirectAttributes, Message.error("请先填写默认广告规则"));
+                            return "redirect:listInit.htm";
+                        }
+                        //判断是否设备初始化
+                        if (equipmentService.findByClientId(clientId) != null) {
+                            addFlashMessage(redirectAttributes, Message.error("该设备已经初始化"));
+                            return "redirect:listInit.htm";
+                        }
+                        Long adminId = equipmentApply.getAdminId();
+                        String adminLevel = equipmentApply.getAdminLevel();
+                        String adminUserName = equipmentApply.getAdminUserName();
+                        String type = equipmentApply.getType().toValue();
+                        String gtClientId = equipmentApply.getGtClientId();
+                        Long merchantId = equipmentApply.getMerchantId();
+                        Long agencyId = equipmentApply.getAgencyId();
+                        Long personageId = equipmentApply.getPersonageId();
+
+                        String old = "";
+                        ArrayList<Filter> filters = new ArrayList<>();
+                        filters.add(Filter.eq("clientId", clientId + "xxx"));
+                        List<Equipment> list = equipmentService.findList(null, filters, null);
+                        equipmentApply.setStatusType(EquipmentApply.StatusType.agreed);
+                        if (list.size() > 0) {
+                            //表示设备第二次申请了:主要为了区分脱离以及初始化
+                            old = "1";
+                            //重新修改设备名称
+                            Equipment equipment = list.get(0);
+                            equipment.setClientId(clientId);
+                            equipment.setGtClientId(gtClientId);
+                            equipment.setAdminId(adminId);
+                            equipment.setAdminLevel(adminLevel);
+                            equipment.setAdminUserName(adminUserName);
+                            equipment.setMerchantId(merchantId);
+                            equipment.setAgencyId(agencyId);
+                            equipment.setPersonageId(personageId);
+                            equipment.setType(Equipment.Type.forValue(type));
+                            equipmentService.update(equipment);
+                            addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+                            PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                            equipmentApplyService.update(equipmentApply);
+                            return "redirect:listInit.htm";
+                        }
+                        PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                        Equipment equipment = new Equipment();
+                        equipment.setClientId(clientId);
+                        equipment.setManagerId(equipmentApply.getManagerId());
+                        equipment.setAdminId(adminId);
+                        equipment.setAdminLevel(adminLevel);
+                        equipment.setAdminUserName(adminUserName);
+                        equipment.setIsUsing(true);
+                        equipment.setIsNetWork(true);
+                        equipment.setPayType(Equipment.PayType.onlinePayment);
+                        equipment.setGuestPwd("123456");
+                        equipment.setAdminPwd("123456");
+                        equipment.setMerchantId(merchantId);
+                        equipment.setAgencyId(agencyId);
+                        equipment.setPersonageId(personageId);
+                        equipment.setProductTotal(0);
+                        equipment.setType(Equipment.Type.forValue(type));
+                        //设置默认规则
+                        equipment.setTimeRuleId(Long.valueOf(1));
+                        equipmentService.save(equipment);
+                        //获取设备的id
+                        Long equipmentId = equipmentService.findByClientId(clientId).getId();
+                        if (!productService.exists(Filter.eq("equipmentId", equipmentId))) {
+                            saveProduct(equipmentId);
+                        }
+
+                    } else if (status.equals("rejected")) {
+                        equipmentApply.setStatusType(EquipmentApply.StatusType.rejected);
+                        PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
+                    }
+                    equipmentApplyService.update(equipmentApply);
+
+                    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+
+                }
+            }
+        }
+        return "redirect:listInit.htm";
+    }
+
+    /**
+     * 添加产品
+     *
+     * @param id
+     */
+    private void saveProduct(Long id) {
+        String[] str = {"玫瑰精灵", "童心未泯", "五彩缤纷", "天雪恋舞", "水中芙蓉", "烈焰红唇", "美梦成真", "一见钟情", "幽兰爱恋", "心之守护",
+                "夏日爱恋", "冰美人", "国色天香", "赤子之心", "海洋之心", "水晶之恋", "彩色精灵", "小棉袄"};
+
+        for (int i = 0; i < str.length; i++) {
+            Product product = new Product();
+            product.setEquipmentId(id);
+            product.setProductName(str[i]);
+            product.setRmbPrice(BigDecimal.ZERO);
+            product.setCodePrice(BigDecimal.ZERO);
+            productService.save(product);
+        }
+
+    }
+
+}

+ 333 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentController.java

@@ -0,0 +1,333 @@
+/*
+ *
+ *  EquipmentController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.ViewObject.CommonParamVo;
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.common.utils.PushUtils;
+import com.hboxs.entity.*;
+import com.hboxs.service.*;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controller - 设备管理器
+ */
+@Controller("adminEquipmentController")
+@RequestMapping("/asl-admin/equipment")
+public class EquipmentController extends BaseController {
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Resource(name = "productServiceImpl")
+    private ProductService productService;
+
+    @Resource(name = "alarmRecordServiceImpl")
+    private AlarmRecordService alarmRecordService;
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Resource(name = "equipmentApplyServiceImpl")
+    private EquipmentApplyService equipmentApplyService;
+
+
+    @Resource(name = "areaServiceImpl")
+    private AreaService areaService;
+
+    @Resource(name = "timeRuleServiceImpl")
+    private TimeRuleService timeRuleService;
+
+    @Resource(name = "orderServiceImpl")
+    private OrderService orderService;
+
+    @Resource(name = "coinOrderServiceImpl")
+    private CoinOrderService coinOrderService;
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session, Pageable pageable) {
+        List<Filter> filters = pageable.getFilters();
+        filters.add(Filter.eq("equipmentId", id));
+        model.addAttribute("products", productService.findPage(pageable));
+        List<Filter> filters1 = pageable.getFilters();
+        pageable.setFilters(filters1);
+        filters1.add(Filter.eq("equipmentId", id));
+        model.addAttribute("alarmRecordes", alarmRecordService.findPage(pageable));
+
+        Equipment equipment = equipmentService.find(id);
+        model.addAttribute("equipment", equipment);
+        List<TimeRule> timeRules = timeRuleService.findAll();
+        model.addAttribute("timeRules", timeRules);
+        String type = adminService.getCurrent().getType().toValue();
+        model.addAttribute("type", type);
+        Long timeRuleId = equipment.getTimeRuleId();
+        if (timeRuleId != null) {
+            TimeRule timeRule = timeRuleService.find(timeRuleId);
+            if (timeRule != null) {
+                model.addAttribute("ruleName", timeRule.getName());
+            }
+        }
+
+        return "/admin/equipment/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Equipment equipment, RedirectAttributes redirectAttributes) {
+        //获取修改前的设备
+        Equipment oldEquipment = equipmentService.find(equipment.getId());
+
+        oldEquipment.setSn(equipment.getSn());
+        oldEquipment.setName(equipment.getName());
+        oldEquipment.setAreaId(equipment.getAreaId());
+        oldEquipment.setContactName(equipment.getContactName());
+        oldEquipment.setContactPhone(equipment.getContactPhone());
+        oldEquipment.setOperator(equipment.getOperator());
+        oldEquipment.setSimNo(equipment.getSimNo());
+        oldEquipment.setTimeRuleId(equipment.getTimeRuleId());
+        oldEquipment.setPayType(Equipment.PayType.onlinePayment);
+        if (equipment.getAreaId() != null) {
+            oldEquipment.setFullName(areaService.find(equipment.getAreaId()).getFullName());
+        }
+        equipmentService.update(oldEquipment);
+
+        PushUtils.push(oldEquipment.getGtClientId(), "设备支付方式", "设备支付方式", PushUtils.buildJson("payType", equipment.getPayType().toString() + ":" + equipment.getTimeRuleId()).toString());
+
+        PushUtils.push(oldEquipment.getGtClientId(), "", "", PushUtils.buildJson("phone", equipment.getContactName() + ":" + equipment.getContactPhone().toString()).toString());
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String clientId, String name, String adminUserName, String fullName, String contactName, Integer contactPhone,
+                       Boolean isUsing, Equipment.PayType payType, Equipment.Type type,
+                       Pageable pageable, ModelMap model) {
+
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        List<Filter> filters = pageable.getFilters();
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+        if (!StringUtils.isEmpty(clientId)) {
+            filters.add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (!StringUtils.isEmpty(name)) {
+
+            filters.add(Filter.like("name", "%" + name + "%"));
+        }
+        if (!StringUtils.isEmpty(adminUserName)) {
+            filters.add(Filter.like("adminUserName", "%" + adminUserName + "%"));
+        }
+        if (!StringUtils.isEmpty(fullName)) {
+            filters.add(Filter.like("fullName", "%" + fullName + "%"));
+        }
+        if (!StringUtils.isEmpty(contactName)) {
+            filters.add(Filter.like("contactName", "%" + contactName + "%"));
+        }
+        if (contactPhone != null) {
+            filters.add(Filter.eq("contactPhone", contactPhone));
+        }
+        if (isUsing != null) {
+            filters.add(Filter.eq("isUsing", isUsing));
+        }
+        if (payType != null) {
+            filters.add(Filter.eq("payType", payType));
+        }
+        if (type != null) {
+            filters.add(Filter.eq("type", type));
+        }
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("name", name);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("fullName", fullName);
+        model.addAttribute("contactName", contactName);
+        model.addAttribute("contactPhone", contactPhone);
+        model.addAttribute("isUsing", isUsing);
+        model.addAttribute("payType", payType);
+        model.addAttribute("type", type);
+        model.addAttribute("page", equipmentService.findPage(pageable));
+        model.addAttribute("admin", adminService.getCurrent());
+        return "/admin/equipment/list";
+
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message DELETE(Long[] ids) {
+        if (ids.length == 0) {
+            return SUCCESS_MESSAGE;
+        }
+        ArrayList<Filter> filters = new ArrayList<>();
+        List<Equipment> list = equipmentService.findList(ids);
+        equipmentService.delete(ids);
+        for (Equipment equipment : list) {
+            filters.add(Filter.eq("equipmentId", equipment.getId()));
+            List<Product> products = productService.findList(null, filters, null);
+            //删除产品
+            for (Product product : products) {
+                productService.delete(product);
+            }
+            filters.clear();
+            //删除设备中的订单
+            filters.add(Filter.eq("clientId", equipment.getClientId()));
+            List<Order> orders = orderService.findList(null, filters, null);
+            for (Order order : orders) {
+                orderService.delete(order);
+            }
+            filters.clear();
+            filters.add(Filter.eq("clientId", equipment.getClientId()));
+            List<CoinOrder> coinOrders = coinOrderService.findList(null, filters, null);
+            for (CoinOrder coinOrder : coinOrders) {
+                coinOrderService.delete(coinOrder);
+            }
+            filters.clear();
+        }
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 更改密码
+     */
+    @RequestMapping(value = "/editPwd", method = RequestMethod.POST)
+    @ResponseBody
+    public Message editPwd(Equipment equipment, ModelMap model, RedirectAttributes redirectAttributes) {
+        Long id = equipment.getId();
+
+        Equipment equipment1 = equipmentService.find(id);
+
+        if (equipment != null) {
+
+            equipment1.setAdminPwd(equipment.getAdminPwd());
+            equipment1.setGuestPwd(equipment.getGuestPwd());
+            Equipment _newEquipment = equipmentService.update(equipment1);
+            PushUtils.push(_newEquipment.getGtClientId(), "【棉花糖】设备管理-更改密码", "修改guest密码", PushUtils.buildJson("guestPwd", equipment.getGuestPwd()).toString());
+            PushUtils.push(_newEquipment.getGtClientId(), "【棉花糖】设备管理-更改密码", "修改admin密码", PushUtils.buildJson("adminPwd", equipment.getAdminPwd()).toString());
+            addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+            return SUCCESS_MESSAGE;
+        }
+        addFlashMessage(redirectAttributes, ERROR_MESSAGE);
+        return ERROR_MESSAGE;
+    }
+
+    /**
+     * 远程修改设备状态
+     * 远程锁机1 解锁0
+     * 远程锁机,解锁
+     *
+     * @param code
+     * @param id
+     * @return
+     */
+    @PostMapping("/{url}")
+    @ResponseBody
+    public Message updateStatus(@PathVariable("url") String url, String code, Long id, RedirectAttributes redirectAttributes) {
+        Equipment equipment = equipmentService.find(id);
+        if (equipment == null) {
+            return ERROR_MESSAGE;
+        }
+        String eqeStatus = "0";
+        if (code.equals("1")) {
+            eqeStatus = "1";
+        }
+        switch (url) {
+            //
+            case "opera":
+                PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("eqeStatus", eqeStatus).toString());
+                break;
+            //远程锁机
+            case "block":
+                PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("block", eqeStatus).toString());
+                break;
+            //远程开启设备睡眠状态
+            case "sleep":
+                PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("is_sleep", eqeStatus).toString());
+            default:
+                break;
+        }
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 修改设备警报发送信息电话
+     *
+     * @param id
+     * @param messageReceiver
+     * @return
+     */
+    @PostMapping("/updateMessageReceiver")
+
+    public String updateMessageReceiver(Long id, String messageReceiver) {
+        Equipment equipment = equipmentService.find(id);
+        equipment.setMessageReceiver(messageReceiver);
+        equipmentService.update(equipment);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 推送设备共同以及/设备参数
+     *
+     * @param commonParamVo
+     * @return
+     */
+    @PostMapping("/updateCommonParam")
+    @ResponseBody
+    public Message updateCommonParam(@RequestBody CommonParamVo commonParamVo) {
+        String gtClientId = commonParamVo.getId();
+
+        PushUtils.push(gtClientId, "", "", PushUtils.buildJson("Param", commonParamVo.getName() + ":" + commonParamVo.getVal()).toString());
+
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 191 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/FileController.java

@@ -0,0 +1,191 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.FileInfo;
+import com.hboxs.common.FileInfo.FileType;
+import com.hboxs.common.FileInfo.OrderType;
+import com.hboxs.common.Message;
+import com.hboxs.common.utils.JsonUtils;
+import com.hboxs.service.FileService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Controller - 文件处理con
+ */
+@Controller("adminFileController")
+@RequestMapping("/asl-admin/file")
+public class FileController extends BaseController {
+
+    @Resource(name = "fileServiceImpl")
+    private FileService fileService;
+
+    protected Logger logger = Logger.getLogger(getClass());
+
+    /**
+     * ueditor上传
+     */
+    @RequestMapping(value = "/ueditor/upload", produces = "text/html; charset=UTF-8")
+    public void upload(String action, MultipartFile file, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
+        try {
+            Map<String, Object> retMap = new HashMap<>();
+            if (!StringUtils.isEmpty(action)) {
+                switch (action) {
+                    case "config":
+                        retMap.put("imageActionName", "uploadImage");
+                        retMap.put("imageUrlPrefix", "");
+                        retMap.put("imageFieldName", "file");
+                        retMap.put("imageMaxSize", 10485760);
+                        retMap.put("imageAllowFiles", new String[]{".png", ".jpg", ".jpeg", ".gif", ".bmp"});
+                        break;
+                    case "uploadImage":
+                        // 上传图片处理
+                        if (request.getMethod().equalsIgnoreCase("GET")) {
+                            retMap.put("state", "SUCCESS");
+                            break;
+                        }
+                        if (!fileService.isValid(FileType.image, file)) {
+                            retMap.put("state", Message.warn("admin.upload.invalid"));
+                        } else {
+                            Enum imageType = (Enum) session.getAttribute(IMAGE_TYPE);
+                            if (imageType == null) {
+                                imageType = FileInfo.imageType.defaultImage;
+                            }
+
+                            String url = fileService.upload(FileType.image, file, false, imageType.toString());
+                            if (url == null) {
+                                retMap.put("state", Message.warn("admin.upload.error"));
+                            } else {
+                                retMap.put("state", "SUCCESS");
+                                retMap.put("url", url);
+                            }
+                        }
+                        break;
+                    default:
+                }
+            }
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), retMap);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 上传
+     */
+    @RequestMapping(value = "/upload", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
+    public void upload(FileType fileType, MultipartFile file, HttpServletResponse response, HttpSession session) {
+        Map<String, Object> data = new HashMap<>();
+        if (!fileService.isValid(fileType, file)) {
+            data.put("message", Message.warn("admin.upload.invalid"));
+        } else {
+            Enum imageType = (Enum) session.getAttribute(IMAGE_TYPE);
+            if (imageType == null) {
+                imageType = FileInfo.imageType.defaultImage;
+            }
+            String url = fileService.upload(fileType, file, false, imageType.toString());
+            if (url == null) {
+                data.put("message", Message.warn("admin.upload.error"));
+            } else {
+                data.put("message", SUCCESS_MESSAGE);
+                data.put("url", url);
+            }
+        }
+        try {
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), data);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 浏览
+     */
+    @RequestMapping(value = "/browser", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    List<FileInfo> browser(String path, FileType fileType, OrderType orderType) {
+        return fileService.browser(path, fileType, orderType);
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String path, ModelMap model) {
+        FileType fileType = FileType.image;
+        OrderType orderType = OrderType.name;
+        List<FileInfo> fileInfos = fileService.browser(path, fileType, orderType);
+        model.addAttribute("fileInfos", fileInfos);
+        model.addAttribute("path", path);
+        return "/admin/file/list";
+    }
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message del(String[] ids, ModelMap model) {
+        FileType fileType = FileType.image;
+        OrderType orderType = OrderType.name;
+        for (int i = 0; i < ids.length; i++) {
+            fileService.del(fileType, ids[i]);
+        }
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 上传APK
+     */
+    @RequestMapping(value = "/uploadAPK", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")
+    public void uploadAPK(FileType fileType, MultipartFile file, HttpServletResponse response, HttpSession session) {
+        Map<String, Object> data = new HashMap<>();
+        if (!fileService.isValid(fileType, file)) {
+            data.put("message", Message.warn("admin.upload.invalid"));
+        } else {
+            Enum imageType = (Enum) session.getAttribute(IMAGE_TYPE);
+            if (imageType == null) {
+                imageType = FileInfo.imageType.defaultImage;
+            }
+            String url = fileService.upload(fileType, file, false, imageType.toString());
+            if (url == null) {
+                data.put("message", Message.warn("admin.upload.error"));
+            } else {
+                data.put("message", SUCCESS_MESSAGE);
+                data.put("url", url);
+                data.put("size",file.getSize()/1024);
+            }
+        }
+        try {
+            response.setContentType("text/html; charset=UTF-8");
+            JsonUtils.writeValue(response.getWriter(), data);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+}

+ 60 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/GlobalConfigController.java

@@ -0,0 +1,60 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Constant;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.entity.GlobalConfig;
+import com.hboxs.service.GlobalConfigService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import javax.ws.rs.GET;
+
+/**
+ * Controller - 全局变量设定
+ */
+@Controller("adminGlobalConfigController")
+@RequestMapping("/asl-admin/globalConfig")
+public class GlobalConfigController extends BaseController {
+
+    @Resource(name = "globalConfigServiceImpl")
+    private GlobalConfigService globalConfigService;
+
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("globalConfig", globalConfigService.getUniqueness());
+        return "/admin/global_config/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(GlobalConfig globalConfig, RedirectAttributes redirectAttributes) {
+        if (!isValid(globalConfig)) {
+            return ERROR_VIEW;
+        }
+
+        if(StringUtils.isBlank(globalConfig.getAccessCode())){
+            globalConfig.setAccessCode(Constant.ACCESS_CODE);
+        }
+        globalConfigService.update(globalConfig, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:edit.htm";
+    }
+}

+ 138 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/JoinPayMchController.java

@@ -0,0 +1,138 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Constant;
+import com.hboxs.common.JoinpayConstant;
+import com.hboxs.common.Message;
+import com.hboxs.joinpay.entity.Mch;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.MchService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+
+/**
+ * Controller - 汇聚支付 / 分销商
+ */
+@Controller("adminJoinPayMchController")
+@RequestMapping("/asl-admin/joinPayMch")
+public class JoinPayMchController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "mchServiceImpl")
+    private MchService mchService;
+
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(ModelMap model) throws InterruptedException {
+
+        Mch mch = mchService.getUniqueness(adminService.getCurrent().getId());
+
+        // 如果分销商商户状态 不为空,则要远程请求刷一下当前的用户order_status
+        if (!StringUtils.isBlank(mch.getOrder_status())) {
+            String result = mchService.refreshMch(mch);
+            mchService.refreshMyAccount(mch);
+
+
+            model.addAttribute("orderStatus", JoinpayConstant.order_status);
+            model.addAttribute("mch", mch);
+
+
+
+            return "/admin/joinpay/mch/edit";
+        } else {
+            return "/admin/joinpay/mch/add";
+        }
+
+    }
+
+    /**
+     * 创建新的
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Mch mch, RedirectAttributes redirectAttributes) {
+
+        Mch pMch = mchService.getUniqueness(adminService.getCurrent().getId());
+        String orderStatus = pMch.getOrder_status();
+
+        // 已创建更新
+        if (!StringUtils.isEmpty(orderStatus)) {
+            addFlashMessage(redirectAttributes, Message.error("该账号已创建"));
+            return "redirect:edit.htm";
+        } else {
+            // 未创建新增
+            mch.setId(pMch.getId());
+            mch.setAdminId(adminService.getCurrent().getId());
+
+            String result = mchService.createMch(mch);
+
+            if (!result.equals(Constant.correct_code)) {
+                addFlashMessage(redirectAttributes, Message.error(result));
+                return "redirect:edit.htm";
+            }
+        }
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:edit.htm";
+    }
+
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Mch mch, RedirectAttributes redirectAttributes) {
+
+        Mch pMch = mchService.getUniqueness(adminService.getCurrent().getId());
+
+        String orderStatus = pMch.getOrder_status();
+
+        // 已创建更新
+        if (StringUtils.isEmpty(orderStatus)) {
+            addFlashMessage(redirectAttributes, Message.error("该提现账号不存在"));
+            return "redirect:edit.htm";
+        } else {
+
+            Mch _tempMch = new Mch();
+            BeanUtils.copyProperties(pMch , _tempMch);
+
+            String result = mchService.updateMch(_tempMch, mch.getLegal_person(), mch.getId_card_no(),
+                    mch.getAlt_merchant_type(), mch.getBank_account_name(), mch.getBank_account_no(), mch.getBank_channel_no());
+
+
+            if (!result.equals(Constant.correct_code)) {
+                addFlashMessage(redirectAttributes, Message.error(result));
+                return "redirect:edit.htm";
+            }
+            pMch.setBank_account_type(mch.getBank_account_type());
+            pMch.setLegal_person(mch.getLegal_person());
+            pMch.setId_card_no(mch.getId_card_no());
+            pMch.setAlt_merchant_type(mch.getAlt_merchant_type());
+            pMch.setBank_account_name(mch.getBank_account_name());
+            pMch.setBank_account_no(mch.getBank_account_no());
+            pMch.setBank_channel_no(mch.getBank_channel_no());
+
+            mchService.update(pMch);
+
+            addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+            return "redirect:edit.htm";
+        }
+
+
+    }
+
+}

+ 147 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/MaintainingHistoryController.java

@@ -0,0 +1,147 @@
+/*
+ *
+ *  MaintainingHistoryController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Page;
+import com.hboxs.common.Pageable;
+import com.hboxs.dto.MainTainDTO;
+import com.hboxs.dto.MaintainingHistoryDTO;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.MaintainingHistory;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.MaintainingHistoryService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Controller - 维护历史
+ */
+@Controller("adminMaintainingHistoryController")
+@RequestMapping("/asl-admin/maintainingHistory")
+public class MaintainingHistoryController extends BaseController {
+
+    @Resource(name = "maintainingHistoryServiceImpl")
+    private MaintainingHistoryService maintainingHistoryService;
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/maintainingHistory/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(MaintainingHistory maintainingHistory, RedirectAttributes redirectAttributes) {
+        maintainingHistoryService.save(maintainingHistory);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session, Pageable pageable) {
+        MaintainingHistory maintainingHistory = maintainingHistoryService.find(id);
+        model.addAttribute("maintainingHistory", maintainingHistory);
+        List<Filter> filters = pageable.getFilters();
+        filters.add(Filter.like("clientId", maintainingHistory.getClientId()));
+        filters.add(Filter.like("administrator", maintainingHistory.getAdministrator()));
+        filters.add(Filter.eq("maintenanceTime", maintainingHistory.getMaintenanceTime()));
+
+        List<MaintainingHistory> content = maintainingHistoryService.findPage(pageable).getContent();
+        model.addAttribute("page", maintainingHistoryService.findPage(pageable));
+        List<MainTainDTO> mainTain = maintainingHistoryService.getMainTain(content);
+        model.addAttribute("maintainDTOs", mainTain);
+        return "/admin/maintainingHistory/edit";
+    }
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(MaintainingHistory maintainingHistory, RedirectAttributes redirectAttributes) {
+        maintainingHistoryService.update(maintainingHistory, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String clientId, String sn, String name, String adminUserName, String administrator, String beginEndDate, MaintainingHistory.Type type, Pageable pageable, ModelMap model) {
+
+        Admin admin = adminService.getCurrent();
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+        Date begin = null;
+        Date end = null;
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            /*filters.add(Filter.geDate("maintenanceTime", begin));
+            filters.add(Filter.leDate("maintenanceTime", end));*/
+
+        }
+
+
+        Page<MaintainingHistoryDTO> all = maintainingHistoryService.findAll(clientId, name, sn, adminUserName, administrator, begin, end, lowerIds, type, pageable);
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("name", name);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("sn", sn);
+        model.addAttribute("administrator", administrator);
+        model.addAttribute("page", all);
+
+        return "/admin/maintainingHistory/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        maintainingHistoryService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 256 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/OrderController.java

@@ -0,0 +1,256 @@
+/*
+ *
+ *  OrderController
+ *
+ */
+package com.hboxs.control.admin;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.hboxs.common.Filter;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Order;
+import com.hboxs.excel.OrderTarget;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.OrderService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Controller - 订单
+ */
+@Controller("adminOrderController")
+@RequestMapping("/asl-admin/order")
+public class OrderController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "orderServiceImpl")
+    private OrderService orderService;
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/order/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Order order, RedirectAttributes redirectAttributes) {
+        orderService.save(order);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("order", orderService.find(id));
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+        return "/admin/order/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Order order, RedirectAttributes redirectAttributes) {
+        orderService.update(order, "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String sn, String clientId, String productName, Order.Status status, Order.Type type, String beginEndDate, Pageable pageable, ModelMap model) {
+
+        Admin admin = adminService.getCurrent();
+        model.addAttribute("admin", admin);
+
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                pageable.getFilters().add(Filter.in("adminId", lowerIds));
+                break;
+        }
+
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date begin = null;
+            Date end = null;
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            pageable.getFilters().add(Filter.geDate("createDate" , begin));
+            pageable.getFilters().add(Filter.leDate("createDate" , end));
+        }
+
+        if (!StringUtils.isEmpty(sn)) {
+            pageable.getFilters().add(Filter.like("sn", "%" + sn + "%"));
+        }
+        if (!StringUtils.isEmpty(productName)) {
+            pageable.getFilters().add(Filter.like("productName", "%" + productName + "%"));
+        }
+        if (status != null) {
+            pageable.getFilters().add(Filter.eq("status", status));
+        }
+        if (type != null) {
+            pageable.getFilters().add(Filter.eq("type", type));
+        }
+        if (!StringUtils.isEmpty(clientId)) {
+            pageable.getFilters().add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        model.addAttribute("page", orderService.findPage(pageable));
+        model.addAttribute("beginEndDate" , beginEndDate);
+        model.addAttribute("sn", sn);
+        model.addAttribute("productName", productName);
+        model.addAttribute("status", status);
+        model.addAttribute("type", type);
+        model.addAttribute("clientId", clientId);
+        return "/admin/order/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        orderService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    @RequestMapping(value = "/export")
+    public Object export(HttpServletResponse response, Long[] ids, String date) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        List<Filter> filters = new ArrayList<>();
+
+        switch (admin.getType()) {
+            case admin:
+                break;
+            case agency:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case merchant:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+            case personage:
+                filters.add(Filter.in("adminId", lowerIds));
+                break;
+        }
+
+
+        try {
+            if (StringUtils.isNotBlank(date)) {
+                String[] datestring = date.split(" - ");
+                Date startDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[0]);
+                Date endDate = new SimpleDateFormat("yyyy-MM-dd").parse(datestring[1]);
+                filters.add(Filter.geDate("createDate", startDate));
+                filters.add(Filter.leDate("createDate", DateUtils.addDays(endDate, 1)));
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return JsonMessage.success("导出错误");
+        }
+
+        //List<Order> list = orderService.findList(ids);
+        List<Order> list = orderService.findList(null, filters, null);
+        List<OrderTarget> orderTargetList = orderService.findById(admin, list);
+
+
+
+        ExportParams exportParams = new ExportParams("订单记录", "sheet1");
+        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, OrderTarget.class, orderTargetList);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("订单记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+    }
+}

+ 921 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/OrderStatisticsController.java

@@ -0,0 +1,921 @@
+package com.hboxs.control.admin;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.hboxs.common.Filter;
+import com.hboxs.common.JsonMessage;
+import com.hboxs.common.Pageable;
+import com.hboxs.common.utils.AdminUtils;
+import com.hboxs.dto.AdminStatisticsDTO;
+import com.hboxs.dto.OrderStatisticsDTO;
+import com.hboxs.entity.Admin;
+import com.hboxs.excel.AdminStatisticsTarget;
+import com.hboxs.excel.CoinStaticsTarget;
+import com.hboxs.excel.OrderStaticsTarget;
+import com.hboxs.excel.ProductStaticTarget;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.CoinOrderService;
+import com.hboxs.service.OrderService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 统计数据
+ */
+@Controller("orderStatisticsController")
+@RequestMapping("/asl-admin/orderStatistics")
+public class OrderStatisticsController extends BaseController {
+
+    @Resource(name = "orderServiceImpl")
+    private OrderService orderService;
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Resource(name = "coinOrderServiceImpl")
+    private CoinOrderService coinOrderService;
+
+    /**
+     * 订单汇总统计,包括所有下级的下级
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String summaryStatistics(@RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName, String name, Pageable pageable, ModelMap model, String clientId) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findPage(pageable).getContent();
+        if (admins1.size() == 0) {
+            model.addAttribute("beginEndDate", beginEndDate);
+            model.addAttribute("type", type);
+            model.addAttribute("unit", unit);
+            model.addAttribute("productName", productName);
+            model.addAttribute("name", name);
+            model.addAttribute("clientId", clientId);
+            model.addAttribute("msg", "找不到此商家");
+            return "/admin/orderStatistics/summaryStatistics";
+
+        }
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+        List<OrderStatisticsDTO> list = orderService.findByTime(type, begin, end, unit, productName, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("type", type);
+        model.addAttribute("unit", unit);
+        model.addAttribute("productName", productName);
+        model.addAttribute("name", name);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("list", list);
+        return "/admin/orderStatistics/summaryStatistics";
+    }
+
+    /**
+     * 统计商家增长记录
+     *
+     * @param type
+     * @param beginEndDate
+     * @param unit
+     * @param pageable
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "/adminStatistics", method = RequestMethod.GET)
+    public String adminStatistics(@RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, Pageable pageable, ModelMap model) {
+        String admintype = adminService.getCurrent().getType().toValue();
+        model.addAttribute("adminType", admintype);
+        if (type == null) {
+            type = 2;
+        }
+
+        Admin admin = adminService.getCurrent();
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        List<AdminStatisticsDTO> list = adminService.findByTime(begin, end, type, unit, lowerIds);
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("type", type);
+        model.addAttribute("unit", unit);
+        model.addAttribute("list", list);
+        return "/admin/orderStatistics/adminStatistics";
+    }
+
+    //按花型统计
+    @RequestMapping(value = "/productStatistic", method = RequestMethod.GET)
+    public String productStatistic(@RequestParam(value = "statisticType", defaultValue = "0") Integer statisticType, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, Pageable pageable, ModelMap model, String clientId, String name) {
+        Admin admin = adminService.getCurrent();
+        String admintype = admin.getType().toValue();
+        model.addAttribute("adminType", admintype);
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findList(null, filters, null);
+        if (admins1.size() == 0) {
+            model.addAttribute("beginEndDate", beginEndDate);
+            model.addAttribute("type", type);
+            model.addAttribute("name", name);
+            model.addAttribute("clientId", clientId);
+            model.addAttribute("msg", "找不到此商家");
+            model.addAttribute("statisticType", statisticType);
+            return "/admin/orderStatistics/productStatistics";
+        }
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+
+        //List<OrderStatisticsDTO> list = orderService.findByTime(type, begin, end, unit, productName, lowerIds, longs.toArray(new Long[longs.size()]));
+        //List<OrderStatisticsDTO> list = orderService.findByProduct(type, begin, end, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+        List<OrderStatisticsDTO> list = orderService.findByProduct(statisticType, type, begin, end, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("type", type);
+        model.addAttribute("name", name);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("list", list);
+        model.addAttribute("statisticType", statisticType);
+        return "/admin/orderStatistics/productStatistics";
+    }
+
+    /**
+     * 订单统计,不包括下级
+     *
+     * @param beginEndDate
+     * @param pageable
+     * @param model
+     * @param managerId    管理系统ID
+     * @param clientId
+     * @param unit
+     * @param productName  产品名称
+     * @return
+     */
+    @RequestMapping(value = "/orderStatistic", method = RequestMethod.GET)
+    public String orderStatistic(String beginEndDate, Pageable pageable, ModelMap model, String managerId, String clientId, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName) {
+
+        Admin admin = adminService.getCurrent();
+        String admintype = admin.getType().toValue();
+        model.addAttribute("adminType", admintype);
+
+        if (StringUtils.isEmpty(managerId)) {
+            managerId = AdminUtils.encrypt(false, admin.getId());
+        }
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = new Long[1];
+        for (Admin admin1 : admins) {
+            if (admin1.getId() == AdminUtils.decrypt(false, managerId)) {
+                Long id = admin1.getId();
+                lowerIds[0] = admin1.getId();
+                break;
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        List<OrderStatisticsDTO> list = orderService.findByManagerId(unit, begin, end, lowerIds[0], clientId, productName);
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("managerId", managerId);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("unit", unit);
+        model.addAttribute("productName", productName);
+        model.addAttribute("list", list);
+        return "/admin/orderStatistics/orderStatistics";
+    }
+
+    /**
+     * 线下汇总统计
+     *
+     * @param type
+     * @param beginEndDate
+     * @param unit
+     * @param productName
+     * @param name
+     * @param pageable
+     * @param model
+     * @param clientId
+     * @return
+     */
+    @RequestMapping(value = "/coinStatistics/{payType}", method = RequestMethod.GET)
+    public String coinStatistics(@PathVariable Integer payType, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName, String name, Pageable pageable, ModelMap model, String clientId) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findPage(pageable).getContent();
+        if (admins1.size() == 0) {
+            model.addAttribute("beginEndDate", beginEndDate);
+            model.addAttribute("type", type);
+            model.addAttribute("unit", unit);
+            model.addAttribute("productName", productName);
+            model.addAttribute("name", name);
+            model.addAttribute("clientId", clientId);
+            model.addAttribute("msg", "找不到此商家");
+            model.addAttribute("payType", payType);
+
+            return "/admin/orderStatistics/coinStatistics";
+
+        }
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+        List<OrderStatisticsDTO> list = coinOrderService.findByTime(payType, type, begin, end, unit, productName, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("type", type);
+        model.addAttribute("unit", unit);
+        model.addAttribute("productName", productName);
+        model.addAttribute("name", name);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("list", list);
+        model.addAttribute("payType", payType);
+
+        return "/admin/orderStatistics/coinStatistics";
+    }
+
+    //线下花型统计
+    @RequestMapping(value = "/coinProductStatistics/{payType}", method = RequestMethod.GET)
+    public String coinProductStatistics(@PathVariable Integer payType, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, Pageable pageable, ModelMap model, String clientId, String name) {
+
+        Admin admin = adminService.getCurrent();
+        String admintype = admin.getType().toValue();
+        model.addAttribute("adminType", admintype);
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findList(null, filters, null);
+        if (admins1.size() == 0) {
+            model.addAttribute("beginEndDate", beginEndDate);
+            model.addAttribute("type", type);
+            model.addAttribute("name", name);
+            model.addAttribute("clientId", clientId);
+            model.addAttribute("msg", "找不到此商家");
+            model.addAttribute("payType", payType);
+            return "/admin/orderStatistics/coinProductStatistics";
+        }
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+
+        List<OrderStatisticsDTO> list = coinOrderService.findByProduct(payType, type, begin, end, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+        model.addAttribute("beginEndDate", beginEndDate);
+        model.addAttribute("type", type);
+        model.addAttribute("name", name);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("list", list);
+        model.addAttribute("payType", payType);
+
+        return "/admin/orderStatistics/coinProductStatistics";
+    }
+
+    //花型统计导出
+    @RequestMapping(value = "/export", method = RequestMethod.GET)
+    public Object export(HttpServletResponse response, @RequestParam(value = "statisticType", defaultValue = "0") Integer statisticType, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, Pageable pageable, ModelMap model, String clientId, String name) {
+
+        Admin admin = adminService.getCurrent();
+        String admintype = admin.getType().toValue();
+        model.addAttribute("adminType", admintype);
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findList(null, filters, null);
+
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+        List<OrderStatisticsDTO> list = orderService.findByProduct(statisticType, type, begin, end, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+        //判断是否是导出请求
+        ArrayList<ProductStaticTarget> productStaticTargets = new ArrayList<>();
+        for (OrderStatisticsDTO orderStatisticsDTO : list) {
+            ProductStaticTarget productStaticTarget = new ProductStaticTarget();
+            productStaticTarget.setProductName(orderStatisticsDTO.getProductName());
+            productStaticTarget.setTotalNumber(orderStatisticsDTO.getTotalNumber());
+            productStaticTarget.setStaticTime(beginEndDate);
+            productStaticTargets.add(productStaticTarget);
+        }
+        ExportParams params = new ExportParams("花型统计", beginEndDate);
+        Workbook workbook = ExcelExportUtil.exportExcel(params, ProductStaticTarget.class, productStaticTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("花型统计记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+    }
+
+
+    //商家增长统计导出
+    @RequestMapping(value = "/exportAdminStatics", method = RequestMethod.GET)
+    @ResponseBody
+    public Object exportAdminStatics(HttpServletResponse response, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, Pageable pageable, ModelMap model) {
+        String admintype = adminService.getCurrent().getType().toValue();
+        model.addAttribute("adminType", admintype);
+        if (type == null) {
+            type = 2;
+        }
+
+        Admin admin = adminService.getCurrent();
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        List<AdminStatisticsDTO> list = adminService.findByTime(begin, end, type, unit, lowerIds);
+        ArrayList<AdminStatisticsTarget> adminStatisticsTargets = new ArrayList<>();
+        for (AdminStatisticsDTO adminStatisticsDTO : list) {
+            AdminStatisticsTarget adminStatisticsTarget = new AdminStatisticsTarget();
+            adminStatisticsTarget.setsTime(adminStatisticsDTO.getsTime());
+            adminStatisticsTarget.setTotalNumber(adminStatisticsDTO.getTotalNumber());
+            adminStatisticsTargets.add(adminStatisticsTarget);
+        }
+
+
+        ExportParams params = new ExportParams("商家增长统计", beginEndDate);
+        Workbook workbook = ExcelExportUtil.exportExcel(params, AdminStatisticsTarget.class, adminStatisticsTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("商家增长统计记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+    }
+
+    //线下汇总统计导出
+    @RequestMapping(value = "/exportCoinStatistics/{payType}", method = RequestMethod.GET)
+    @ResponseBody
+    public Object exportCoinStatistics(HttpServletResponse response, @PathVariable Integer payType, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName, String name, Pageable pageable, ModelMap model, String clientId) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findPage(pageable).getContent();
+
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+
+
+        List<OrderStatisticsDTO> list = coinOrderService.findByTime(payType, type, begin, end, unit, productName, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+        ArrayList<CoinStaticsTarget> coinStaticsTargets = new ArrayList<>();
+        for (OrderStatisticsDTO orderStatisticsDTO : list) {
+            CoinStaticsTarget target = new CoinStaticsTarget();
+            target.setsTime(orderStatisticsDTO.getsTime());
+            target.setTotalNumber(orderStatisticsDTO.getTotalNumber());
+            target.setTotalPrice(orderStatisticsDTO.getTotalPrice());
+            coinStaticsTargets.add(target);
+
+        }
+        String title = payType == 0 ? "无需支付汇总统计" : "投币汇总统计";
+        ExportParams params = new ExportParams(title, beginEndDate);
+        Workbook workbook = ExcelExportUtil.exportExcel(params, CoinStaticsTarget.class, coinStaticsTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(title + "记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+
+    }
+
+    //订单统计导出
+    @RequestMapping(value = "/exportOrderStatistic", method = RequestMethod.GET)
+    @ResponseBody
+    public Object exportOrderStatistic(HttpServletResponse response, String beginEndDate, Pageable pageable, ModelMap model, String managerId, String clientId, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName) {
+
+        Admin admin = adminService.getCurrent();
+        String admintype = admin.getType().toValue();
+        model.addAttribute("adminType", admintype);
+
+        if (StringUtils.isEmpty(managerId)) {
+            managerId = AdminUtils.encrypt(false, admin.getId());
+        }
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+        Long[] lowerIds = new Long[1];
+        for (Admin admin1 : admins) {
+            if (admin1.getId() == AdminUtils.decrypt(false, managerId)) {
+                Long id = admin1.getId();
+                lowerIds[0] = admin1.getId();
+                break;
+            }
+        }
+
+        Date begin = null;
+        Date end = null;
+
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        List<OrderStatisticsDTO> list = orderService.findByManagerId(unit, begin, end, lowerIds[0], clientId, productName);
+        ArrayList<OrderStaticsTarget> orderStaticsTargets = new ArrayList<>();
+        for (OrderStatisticsDTO orderStatisticsDTO : list) {
+            OrderStaticsTarget orderStaticsTarget = new OrderStaticsTarget();
+            orderStaticsTarget.setsTime(orderStatisticsDTO.getsTime());
+            orderStaticsTarget.setTotalNumber(orderStatisticsDTO.getTotalNumber());
+            orderStaticsTarget.setTotalPrice(orderStatisticsDTO.getTotalPrice());
+            orderStaticsTargets.add(orderStaticsTarget);
+        }
+        ExportParams params = new ExportParams("订单统计", beginEndDate);
+        Workbook workbook = ExcelExportUtil.exportExcel(params, OrderStaticsTarget.class, orderStaticsTargets);
+
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("订单统计记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+    }
+
+    //订单汇总统计导出
+    @RequestMapping(value = "/exportSummaryStatistics", method = RequestMethod.GET)
+    @ResponseBody
+    public Object exportSummaryStatistics(HttpServletResponse response, @RequestParam(value = "type", defaultValue = "2") Integer type, String beginEndDate, @RequestParam(value = "unit", defaultValue = "0") Integer unit, String productName, String name, Pageable pageable, ModelMap model, String clientId) {
+
+        Admin admin = adminService.getCurrent();
+
+        List<Admin> admins = adminService.findAllLowerAdmin(admin.getId());
+
+        Long[] lowerIds = null;
+        if (admins == null) {
+            lowerIds = new Long[]{};
+        } else {
+            lowerIds = new Long[admins.size()];
+            for (int i = 0; i < admins.size(); i++) {
+                lowerIds[i] = admins.get(i).getId();
+            }
+        }
+        Date begin = null;
+        Date end = null;
+        if (StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+            Date date = new Date();
+            String startToday = simpleDateFormat.format(date);
+            SimpleDateFormat _format = new SimpleDateFormat("yyyy-MM-dd 24:00:00");
+            String endToday = _format.format(date);
+
+            beginEndDate = startToday + " - " + endToday;
+        }
+        if (!StringUtils.isEmpty(beginEndDate)) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+            try {
+                begin = simpleDateFormat.parse(beginEndDate.split(" - ")[0].trim());
+                end = simpleDateFormat.parse(beginEndDate.split(" - ")[1].trim());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        //查找商家名称
+        List<Filter> filters = pageable.getFilters();
+        //商家的所有id
+        List<Long> longs = new ArrayList<>();
+        List<Admin> admins1 = null;
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("username", "%" + name + "%"));
+        }
+        admins1 = adminService.findPage(pageable).getContent();
+
+        if (admins1 != null) {
+            for (Admin admin1 : admins1) {
+                longs.add(admin1.getId());
+            }
+        }
+        List<OrderStatisticsDTO> list = orderService.findByTime(type, begin, end, unit, productName, lowerIds, longs.toArray(new Long[longs.size()]), clientId);
+        ArrayList<OrderStaticsTarget> orderStaticsTargets = new ArrayList<>();
+        for (OrderStatisticsDTO orderStatisticsDTO : list) {
+            OrderStaticsTarget orderStaticsTarget = new OrderStaticsTarget();
+            orderStaticsTarget.setsTime(orderStatisticsDTO.getsTime());
+            orderStaticsTarget.setTotalNumber(orderStatisticsDTO.getTotalNumber());
+            orderStaticsTarget.setTotalPrice(orderStatisticsDTO.getTotalPrice());
+            orderStaticsTargets.add(orderStaticsTarget);
+        }
+        ExportParams params = new ExportParams("订单汇总统计", beginEndDate);
+        Workbook workbook = ExcelExportUtil.exportExcel(params, OrderStaticsTarget.class, orderStaticsTargets);
+        if (workbook != null) {
+            OutputStream os = null;
+            try {
+                os = response.getOutputStream();
+                SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+                response.setContentType("application/vnd.ms-excel;charset=utf-8");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("订单汇总统计记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
+                workbook.write(os);
+                return JsonMessage.success("导出成功");
+            } catch (Exception e) {
+                e.printStackTrace();
+                return JsonMessage.success("导出错误");
+            } finally {
+                try {
+                    os.close();
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return JsonMessage.success("导出错误");
+
+    }
+
+}

+ 74 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/ProductController.java

@@ -0,0 +1,74 @@
+/*
+ * 
+ *  ProductController
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.gexin.fastjson.JSON;
+import com.hboxs.ViewObject.ProductVo;
+import com.hboxs.common.Message;
+import com.hboxs.common.utils.PushUtils;
+import com.hboxs.entity.Product;
+import com.hboxs.service.EquipmentService;
+import com.hboxs.service.ProductService;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Controller - 第三方设备管理
+ */
+@Controller("adminProductController")
+@RequestMapping("/asl-admin/product")
+public class ProductController extends BaseController {
+
+    @Resource(name = "productServiceImpl")
+    private ProductService productService;
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    /**
+     * 更新商品
+     */
+        @RequestMapping(value = "/update", method = RequestMethod.POST)
+        @ResponseBody
+        public Message update(@RequestBody List<Map<String,String>> products, RedirectAttributes redirectAttributes) {
+            String equipmentId = "";
+            List<ProductVo> list = new ArrayList<>();
+            for (Map<String,String> map:products) {
+                Product product = new Product();
+
+                Product product1 = new Product();
+                ProductVo productVo = new ProductVo();
+                product1.setId(Long.valueOf(map.get("id")));
+                product1.setCodePrice(new BigDecimal(map.get("codePrice")));
+                product1.setRmbPrice(new BigDecimal( map.get("rmbPrice")));
+                equipmentId = map.get("equipmentId");
+
+                productService.update(product1, "equipmentId", "productName", "sellStatus");
+                productVo.setId(map.get("id"));
+                productVo.setCodePrice(new Double(map.get("codePrice")));
+                productVo.setRmbPrice(new Double(map.get("rmbPrice")));
+                list.add(productVo);
+            }
+            Collections.sort(list);
+            System.out.println(list);
+            PushUtils.push(equipmentService.find(Long.parseLong(equipmentId)).getGtClientId(), "更新棉花价格", "更新棉花价格", PushUtils.buildJson("products", JSON.toJSONString(list)).toString());
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return SUCCESS_MESSAGE;
+    }
+
+
+}

+ 78 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/ProfileController.java

@@ -0,0 +1,78 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.entity.Admin;
+import com.hboxs.service.AdminService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+
+/**
+ * Controller - 个人资料
+ */
+@Controller("adminProfileController")
+@RequestMapping("/asl-admin/profile")
+public class ProfileController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    /**
+     * 验证当前密码
+     */
+    @RequestMapping(value = "/check_current_password", method = RequestMethod.GET)
+    public
+    @ResponseBody
+    boolean checkCurrentPassword(String currentPassword) {
+        if (StringUtils.isEmpty(currentPassword)) {
+            return false;
+        }
+        Admin admin = adminService.getCurrent();
+        return StringUtils.equals(DigestUtils.md5Hex(currentPassword), admin.getPassword());
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(ModelMap model) {
+        model.addAttribute("admin", adminService.getCurrent());
+        return "/admin/profile/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(String currentPassword, String password, String email, RedirectAttributes redirectAttributes) {
+        if (!isValid(Admin.class, "email", email)) {
+            return ERROR_VIEW;
+        }
+        Admin pAdmin = adminService.getCurrent();
+        if (StringUtils.isNotEmpty(currentPassword) && StringUtils.isNotEmpty(password)) {
+            if (!isValid(Admin.class, "password", password)) {
+                return ERROR_VIEW;
+            }
+            if (!StringUtils.equals(DigestUtils.md5Hex(currentPassword), pAdmin.getPassword())) {
+                return ERROR_VIEW;
+            }
+            pAdmin.setPassword(DigestUtils.md5Hex(password));
+        }
+        pAdmin.setEmail(email);
+        adminService.update(pAdmin);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:edit.htm";
+    }
+
+}

+ 137 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/ProportionController.java

@@ -0,0 +1,137 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.*;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Proportion;
+import com.hboxs.entity.Role;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.GlobalConfigService;
+import com.hboxs.service.ProportionService;
+import com.hboxs.service.RoleService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * Controller - 分销比例
+ */
+@Controller("adminAdminProportionController")
+@RequestMapping("/asl-admin/proportion")
+public class ProportionController extends BaseController {
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+    @Resource(name = "proportionServiceImpl")
+    private ProportionService proportionService;
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String agencyList(ModelMap model) {
+
+        List<Filter> fs = new ArrayList<>();
+        fs.add(Filter.eq("isAdmined", false));
+        List<Order> orders = new ArrayList<>();
+        orders.add(Order.desc("createDate"));
+        List<Admin> admins = adminService.findList(null, fs, orders);
+
+        List<Admin> agencys = new ArrayList<>();
+        List<Admin> merchants = new ArrayList<>();
+        List<Admin> personages = new ArrayList<>();
+
+        for (Admin a : admins) {
+            switch (a.getType()) {
+                case agency:
+                    agencys.add(a);
+                    break;
+                case merchant:
+                    merchants.add(a);
+                    break;
+                case personage:
+                    personages.add(a);
+                    break;
+
+            }
+        }
+
+        model.addAttribute("agencys", agencys);
+        model.addAttribute("merchants", merchants);
+        model.addAttribute("personages", personages);
+
+
+        Map<Long, Proportion> proportionMap = new HashMap<>();
+        List<Proportion> proportions = proportionService.findAll();
+        for (Proportion p : proportions) {
+            proportionMap.put(p.getAdminId(), p);
+        }
+        model.addAttribute("proportionMap", proportionMap);
+
+        return "/admin/proportion/list";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public @ResponseBody
+    Object update(Admin.Type type, BigDecimal agencyProportion,
+                  BigDecimal merchantProportion, BigDecimal personageProportion, Long adminId, ModelMap model) {
+
+
+        Admin admin = adminService.find(adminId);
+        if (admin == null) {
+            return JsonMessage.error("无法找到商家");
+        }
+
+        if (admin.getType() != type) {
+            return JsonMessage.error("类型不正确");
+        }
+
+        Proportion proportion = proportionService.getUniqueness(adminId);
+
+        switch (type) {
+            case agency:
+                proportion.setAdminProportion(new BigDecimal(100).subtract(agencyProportion));
+                proportion.setAgencyProportion(agencyProportion);
+                proportion.setType(Proportion.Type.agency);
+                break;
+            case merchant:
+                proportion.setAdminProportion(new BigDecimal(100).subtract(agencyProportion).subtract(merchantProportion));
+                proportion.setAgencyProportion(agencyProportion);
+                proportion.setMerchantProportion(merchantProportion);
+                proportion.setType(Proportion.Type.merchant);
+                break;
+            case personage:
+                proportion.setAdminProportion(new BigDecimal(100).subtract(agencyProportion).subtract(merchantProportion).subtract(personageProportion));
+                proportion.setAgencyProportion(agencyProportion);
+                proportion.setMerchantProportion(merchantProportion);
+                proportion.setPersonageProportion(personageProportion);
+                proportion.setType(Proportion.Type.personage);
+                break;
+        }
+
+        proportionService.update(proportion);
+
+
+        return JsonMessage.success("更新成功");
+    }
+
+
+}

+ 160 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/RoleController.java

@@ -0,0 +1,160 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.control.admin;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Role;
+import com.hboxs.service.AdminService;
+import com.hboxs.service.RoleService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Controller - 角色
+ */
+@Controller("adminRoleController")
+@RequestMapping("/asl-admin/role")
+public class RoleController extends BaseController {
+
+    @Resource(name = "roleServiceImpl")
+    private RoleService roleService;
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model) {
+        model.addAttribute("admin" , adminService.getCurrent());
+        return "/admin/role/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Role role, RedirectAttributes redirectAttributes,HttpSession session) {
+        if (!isValid(role)) {
+            return ERROR_VIEW;
+        }
+        role.setIsSystem(false);
+        role.setAdmins(null);
+        role.setAdminId(adminService.getCurrent().getId());
+
+        Admin.Type type = adminService.getCurrent().getType();
+
+        switch (type){
+            case agency:
+                role.setType(Role.Type.agency);
+                role.setAgencyId(adminService.getCurrent().getAgencyId());
+                break;
+            case merchant:
+                role.setType(Role.Type.merchant);
+                role.setMerchantId(adminService.getCurrent().getMerchantId());
+                break;
+            case personage:
+                role.setType(Role.Type.personage);
+                role.setPersonageId(adminService.getCurrent().getPersonageId());
+                break;
+            case admin:
+                role.setType(Role.Type.admin);
+                break;
+        }
+
+
+        roleService.save(role);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model) {
+        model.addAttribute("admin" , adminService.getCurrent());
+        model.addAttribute("role", roleService.find(id));
+        return "/admin/role/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Role role, RedirectAttributes redirectAttributes) {
+        if (!isValid(role)) {
+            return ERROR_VIEW;
+        }
+        Role pRole = roleService.find(role.getId());
+        if (pRole == null || pRole.getIsSystem()) {
+            return ERROR_VIEW;
+        }
+        roleService.update(role, "isSystem", "admins" , "adminId" , "agencyId" , "merchantId" , "personageId" , "type");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Pageable pageable, ModelMap model) {
+        pageable.getFilters().add(Filter.eq("isSystem" ,false));
+        Admin.Type type = adminService.getCurrent().getType();
+        switch (type){
+            case agency:
+                pageable.getFilters().add(Filter.eq("type" ,Role.Type.agency));
+                pageable.getFilters().add(Filter.eq("agencyId" ,adminService.getCurrent().getAgencyId()));
+                break;
+            case merchant:
+                pageable.getFilters().add(Filter.eq("type" ,Role.Type.merchant));
+                pageable.getFilters().add(Filter.eq("merchantId" ,adminService.getCurrent().getMerchantId()));
+                break;
+            case personage:
+                pageable.getFilters().add(Filter.eq("type" ,Role.Type.personage));
+                pageable.getFilters().add(Filter.eq("personageId" ,adminService.getCurrent().getPersonageId()));
+                break;
+            case admin:
+                pageable.getFilters().add(Filter.eq("type" ,Role.Type.admin));
+                break;
+        }
+
+        model.addAttribute("page", roleService.findPage(pageable));
+        return "/admin/role/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        if (ids != null) {
+            for (Long id : ids) {
+                Role role = roleService.find(id);
+                if (role != null && (role.getIsSystem() || (role.getAdmins() != null && !role.getAdmins().isEmpty()))) {
+                    /*return Message.error("admin.role.deleteExistNotAllowed", role.getName());*/
+                    return Message.error("当前有"+role.getAdmins().size()+"位管理员选择该角色,请先对管理员进行编辑。", role.getName());
+                }
+            }
+            roleService.delete(ids);
+        }
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 172 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/TimeRuleController.java

@@ -0,0 +1,172 @@
+/*
+ *
+ *  TimeRuleController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.alibaba.fastjson.JSONArray;
+import com.gexin.fastjson.JSON;
+import com.hboxs.ViewObject.TimeRuleVo;
+import com.hboxs.common.Filter;
+import com.hboxs.common.Message;
+import com.hboxs.common.Pageable;
+import com.hboxs.common.utils.PushUtils;
+import com.hboxs.entity.AD;
+import com.hboxs.entity.Equipment;
+import com.hboxs.entity.TimeRule;
+import com.hboxs.service.ADService;
+import com.hboxs.service.EquipmentService;
+import com.hboxs.service.TimeRuleService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controller - 广告时间规则
+ */
+@Controller("adminTimeRuleController")
+@RequestMapping("/asl-admin/timeRule")
+public class TimeRuleController extends BaseController {
+
+    @Resource(name = "timeRuleServiceImpl")
+    private TimeRuleService timeRuleService;
+
+    @Resource(name = "aDServiceImpl")
+    private ADService aDService;
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    private static final String[] times = {"0-1", "1-2", "2-3", "3-4", "4-5", "5-6", "6-7", "7-8",
+            "8-9", "9-10", "10-11", "11-12", "12-13", "13-14", "14-15", "15-16", "16-17", "17-18", "18-19", "19-20"
+            , "20-21", "21-22", "22-23", "23-24"};
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+
+        List<TimeRuleVo> list = new ArrayList<>();
+
+        List<AD> adList = aDService.findAll();
+
+        for (int i = 0; i < times.length; i++) {
+            TimeRuleVo timeRuleVo = new TimeRuleVo();
+            timeRuleVo.setName("");
+            timeRuleVo.setTime(times[i]);
+            timeRuleVo.setAds(adList);
+            list.add(timeRuleVo);
+        }
+        model.addAttribute("list", list);
+        return "/admin/timeRule/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ResponseBody
+    public Message save(@RequestBody List<TimeRuleVo> timeRuleVos, RedirectAttributes redirectAttributes) {
+
+        //获取广告名称
+
+        String name = timeRuleVos.get(0).getName();
+        String rule = JSONArray.toJSONString(timeRuleVos);
+        /*String s = JsonUtil.objectToJson(timeRuleVos);
+        System.out.println(s);*/
+        TimeRule timeRule = new TimeRule();
+        timeRule.setName(name);
+        timeRule.setRule(rule);
+        timeRuleService.save(timeRule);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        List<AD> adList = aDService.findAll();
+
+        TimeRule timeRule = timeRuleService.find(id);
+        model.addAttribute("timeRule", timeRule);
+        String rule = timeRule.getRule();
+        //将json转换为list对象
+        List<TimeRuleVo> timeRuleVos = JSON.parseArray(rule, TimeRuleVo.class);
+        model.addAttribute("timeRules", timeRuleVos);
+        model.addAttribute("adList", adList);
+        return "/admin/timeRule/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Message update(@RequestBody List<TimeRuleVo> timeRuleVos, RedirectAttributes redirectAttributes) {
+
+        Long id = timeRuleVos.get(0).getId();
+        String rule = JSONArray.toJSONString(timeRuleVos);
+        TimeRule timeRule = timeRuleService.find(id);
+        timeRule.setRule(rule);
+        timeRule.setName(timeRuleVos.get(0).getName());
+        timeRuleService.update(timeRule);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Pageable pageable, ModelMap model) {
+        model.addAttribute("page", timeRuleService.findPage(pageable));
+        return "/admin/timeRule/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+
+        for (int i = 0; i < ids.length; i++) {
+            if (ids[i] == 1) {
+                return Message.error("默认规则不能删");
+            }
+        }
+        timeRuleService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 推送时间规则广告id
+     *
+     * @param id 规则id
+     * @return
+     */
+    @GetMapping(value = "/pullTimeRule")
+    @ResponseBody
+    public Message pullTimeRule(Long id, RedirectAttributes redirectAttributes) {
+        //查询出用这个广告规则的设备
+        ArrayList<Filter> filters = new ArrayList<>();
+        filters.add(Filter.eq("timeRuleId", id));
+        List<Equipment> list = equipmentService.findList(null, filters, null);
+        for (Equipment equipment : list) {
+            PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("pushTimeRule", id + "").toString());
+        }
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return SUCCESS_MESSAGE;
+    }
+}

+ 344 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/TrusteeshipController.java

@@ -0,0 +1,344 @@
+/*
+ *
+ *  TrusteeshipController
+ *
+ */
+package com.hboxs.control.admin;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.hboxs.common.*;
+import com.hboxs.entity.Admin;
+import com.hboxs.entity.Equipment;
+import com.hboxs.entity.Trusteeship;
+import com.hboxs.service.*;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpSession;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controller - 共享数据
+ */
+@Controller("adminTrusteeshipController")
+@RequestMapping("/asl-admin/trusteeship")
+public class TrusteeshipController extends BaseController {
+
+    @Resource(name = "trusteeshipServiceImpl")
+    private TrusteeshipService trusteeshipService;
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Resource(name = "productServiceImpl")
+    private ProductService productService;
+
+    @Resource(name = "orderServiceImpl")
+    private OrderService orderService;
+
+    @Resource(name = "alarmRecordServiceImpl")
+    private AlarmRecordService alarmRecordService;
+
+    /**
+     * 代理商
+     */
+    @RequestMapping(value = "/agencys", method = RequestMethod.GET)
+    public @ResponseBody Object agencys(ModelMap model, HttpSession session) {
+
+        List<Filter> fs = new ArrayList<>();
+        fs.add(Filter.eq("type", Admin.Type.agency));
+        fs.add(Filter.eq("isAdmined" , false));
+        List<Admin> agencys = adminService.findList(null , fs , null);
+
+
+        JSONArray rootAreaJson = new JSONArray();
+
+        for (Admin agency : agencys){
+            JSONObject rootJson = new JSONObject();
+            rootJson.put("name" , agency.getUsername() + "(" + agency.getName() + ")");
+            rootJson.put("value" , agency.getId());
+            rootAreaJson.add(rootJson);
+        }
+
+        return rootAreaJson;
+
+    }
+
+    /**
+     * 下级
+     */
+    @RequestMapping(value = "/findChildren", method = RequestMethod.GET)
+    public @ResponseBody Object findChildren(Long adminId, ModelMap model, HttpSession session) {
+
+
+        List<Admin> childrens = adminService.findAllLowerAdminExcludSelf(adminId);
+
+        JSONArray rootAreaJson = new JSONArray();
+
+
+        for (Admin child : childrens){
+            JSONObject rootJson = new JSONObject();
+            rootJson.put("name" , child.getUsername() + "(" + child.getName() + ")");
+            rootJson.put("value" , child.getId());
+            rootAreaJson.add(rootJson);
+        }
+
+        return JsonMessage.success(rootAreaJson);
+
+    }
+
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/trusteeship/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save(Trusteeship trusteeship, Long[] adminids, RedirectAttributes redirectAttributes, ModelMap model) {
+
+        String clientId = trusteeship.getClientId();
+
+        long size = trusteeshipService.count(Filter.eq("clientId", clientId));
+        long clientId1 = equipmentService.count(Filter.eq("clientId", clientId));
+        if (clientId1 < 1) {
+            model.addAttribute("exitMsg", "该设备不存在");
+            return "/admin/trusteeship/add";
+        }
+        if (size > 0) {
+            model.addAttribute("exitMsg", "该设备已被托管");
+            return "/admin/trusteeship/add";
+        }
+
+        if (trusteeship.getData().length() > 2) {
+            trusteeship.setData("2");
+        }
+
+        Equipment equipment = equipmentService.findByClientId(clientId);
+        trusteeship.setContactName(equipment.getContactName());
+        trusteeship.setContactPhone(equipment.getContactPhone());
+        trusteeship.setAdminUserName(equipment.getAdminUserName());
+        trusteeship.setName(equipment.getName());
+
+        List<Admin> list = adminService.findList(adminids);
+        trusteeship.setAdmins(list);
+        trusteeshipService.save(trusteeship);
+
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     *
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        Trusteeship trusteeship = trusteeshipService.find(id);
+        Equipment equipment = null;
+        if (trusteeship != null) {
+            equipment = equipmentService.findByClientId(trusteeship.getClientId());
+        }
+        model.addAttribute("equipment", equipment);
+        model.addAttribute("trusteeship", trusteeshipService.find(id));
+        return "/admin/trusteeship/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update(Trusteeship trusteeship, Long[] adminids, RedirectAttributes redirectAttributes) {
+        Trusteeship pTrusteeship = trusteeshipService.find(trusteeship.getId());
+
+
+        //判断是托管订单还是设备参数
+        if (trusteeship.getData().length() > 2) {
+            trusteeship.setData("2");
+        }
+        if(adminids==null || adminids.length==0){
+            trusteeship.setAdmins(pTrusteeship.getAdmins());
+        }else{
+
+            //获取新的托管商
+            List<Admin> list = adminService.findList(adminids);
+            //获取原来的托管商
+            List<Admin> admins = pTrusteeship.getAdmins();
+            if (admins.size() != 0) {
+                //将list 和 admins 的不同部分拿出来
+                for (Admin admin : admins) {
+                    if (list.contains(admin)) {
+                        list.remove(admin);
+                    }
+                }
+            }
+            admins.addAll(list);
+            trusteeship.setAdmins(admins);
+        }
+        trusteeshipService.update(trusteeship);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(String clientId, String name, String adminUserName, String fullName, String contactName, String contactPhone, Pageable pageable, ModelMap model) {
+        List<Filter> filters = pageable.getFilters();
+        if (StringUtils.isNotEmpty(clientId)) {
+            filters.add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("name", "%" + name + "%"));
+        }
+        if (StringUtils.isNotEmpty(adminUserName)) {
+            filters.add(Filter.like("adminUserName", "%" + adminUserName + "%"));
+        }
+        if (StringUtils.isNotEmpty(fullName)) {
+            filters.add(Filter.like("fullName", "%" + fullName + "%"));
+        }
+        if (StringUtils.isNotEmpty(contactName)) {
+            filters.add(Filter.like("contactName", "%" + contactName + "%"));
+        }
+        if (StringUtils.isNotEmpty(contactPhone)) {
+            filters.add(Filter.like("contactPhone", "%" + contactPhone + "%"));
+        }
+
+        model.addAttribute("page", trusteeshipService.findPage(pageable));
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("name", name);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("fullName", fullName);
+        model.addAttribute("contactName", contactName);
+        model.addAttribute("contactPhone", contactPhone);
+        return "/admin/trusteeship/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ResponseBody
+    public Message delete(Long[] ids) {
+
+        trusteeshipService.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+    /**
+     * 获取设备参数
+     */
+    @RequestMapping(value = "/getEquipment", method = RequestMethod.GET)
+    public String getEquipment(String clientId, ModelMap model) {
+
+        model.addAttribute("equipment", equipmentService.findByClientId(clientId));
+        return "/admin/trusteeship/add";
+    }
+
+    /**
+     * 非总后台展示托管的设备
+     */
+    @RequestMapping(value = "/listData", method = RequestMethod.GET)
+    public String listData(String clientId, String name, String adminUserName, String fullName, String contactName, String contactPhone, Pageable pageable, ModelMap model) {
+
+        Admin admin = adminService.getCurrent();
+        Long id = admin.getId();
+        List<Filter> filters = pageable.getFilters();
+        if (StringUtils.isNotEmpty(clientId)) {
+            filters.add(Filter.like("clientId", "%" + clientId + "%"));
+        }
+        if (StringUtils.isNotEmpty(name)) {
+            filters.add(Filter.like("name", "%" + name + "%"));
+        }
+        if (StringUtils.isNotEmpty(adminUserName)) {
+            filters.add(Filter.like("adminUserName", "%" + adminUserName + "%"));
+        }
+        if (StringUtils.isNotEmpty(fullName)) {
+            filters.add(Filter.like("fullName", "%" + fullName + "%"));
+        }
+        if (StringUtils.isNotEmpty(contactName)) {
+            filters.add(Filter.like("contactName", "%" + contactName + "%"));
+        }
+        if (StringUtils.isNotEmpty(contactPhone)) {
+            filters.add(Filter.like("contactPhone", "%" + contactPhone + "%"));
+        }
+        List<Trusteeship> list = new ArrayList<>();
+        List<Trusteeship> content = trusteeshipService.findPage(pageable).getContent();
+        for (Trusteeship trusteeship : content) {
+            List<Admin> admins = trusteeship.getAdmins();
+            for (Admin admin1 : admins) {
+                if (admin1.getId().equals(id)) {
+                    list.add(trusteeship);
+                    break;
+                }
+            }
+        }
+
+        Page<Trusteeship> trusteeshipPage = new Page<>(list, list.size(), pageable);
+        model.addAttribute("page", trusteeshipPage);
+        model.addAttribute("clientId", clientId);
+        model.addAttribute("name", name);
+        model.addAttribute("adminUserName", adminUserName);
+        model.addAttribute("fullName", fullName);
+        model.addAttribute("contactName", contactName);
+        model.addAttribute("contactPhone", contactPhone);
+        return "/admin/trusteeship/list_other";
+    }
+
+
+    //非总后台展示共享数据
+    @RequestMapping(value = "/findData", method = RequestMethod.GET)
+    public String findData(Long id, ModelMap model, HttpSession session) {
+        Pageable pageable = new Pageable();
+        List<Filter> filters = pageable.getFilters();
+
+        Trusteeship trusteeship = trusteeshipService.find(id);
+
+        if (trusteeship == null) {
+            return "/admin/trusteeship/edit_other";
+        }
+        String data = trusteeship.getData();
+        String clientId = trusteeship.getClientId();
+        if ("1".equals(data)) {
+            Equipment equipment = equipmentService.findByClientId(clientId);
+            Long equipmentId = equipment.getId();
+            filters.add(Filter.eq("equipmentId", equipmentId));
+            model.addAttribute("products", productService.findPage(pageable));
+            model.addAttribute("alarmRecordes", alarmRecordService.findPage(pageable));
+            model.addAttribute("equipment", equipment);
+            return "/admin/trusteeship/edit_other";
+        }
+        if ("0".equals(data)) {
+            filters.add(Filter.eq("clientId", clientId));
+            model.addAttribute("page", orderService.findList(null, filters, null));
+            return "/admin/trusteeship/edit_other";
+        }
+        Equipment equipment = equipmentService.findByClientId(clientId);
+        Long equipmentId = equipment.getId();
+
+        filters.add(Filter.eq("equipmentId", equipmentId));
+        model.addAttribute("products", productService.findPage(pageable));
+        model.addAttribute("equipment", equipment);
+        filters.clear();
+        filters.add(Filter.eq("clientId", clientId));
+        model.addAttribute("page", orderService.findList(null, filters, null));
+        return "/admin/trusteeship/edit_other";
+    }
+}

+ 195 - 0
app-backend-web/src/main/java/com/hboxs/template/directive/BaseDirective.java

@@ -0,0 +1,195 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.directive;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Order;
+import com.hboxs.common.utils.FreemarkerUtils;
+import freemarker.core.Environment;
+import freemarker.template.*;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+import java.beans.PropertyDescriptor;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 模板指令 - 基类
+ */
+public abstract class BaseDirective implements TemplateDirectiveModel {
+
+    /**
+     * "使用缓存"参数名称
+     */
+    private static final String USE_CACHE_PARAMETER_NAME = "useCache";
+    /**
+     * "缓存区域"参数名称
+     */
+    private static final String CACHE_REGION_PARAMETER_NAME = "cacheRegion";
+    /**
+     * "ID"参数名称
+     */
+    private static final String ID_PARAMETER_NAME = "id";
+    /**
+     * "数量"参数名称
+     */
+    private static final String COUNT_PARAMETER_NAME = "count";
+    /**
+     * "排序"参数名称
+     */
+    private static final String ORDER_BY_PARAMETER_NAME = "orderBy";
+    /**
+     * 排序项分隔符
+     */
+    private static final String ORDER_BY_ITEM_SEPARATOR = "\\s*,\\s*";
+    /**
+     * 排序字段分隔符
+     */
+    private static final String ORDER_BY_FIELD_SEPARATOR = "\\s+";
+
+    /**
+     * 使用缓存
+     *
+     * @param env    Environment
+     * @param params 参数
+     * @return 使用缓存
+     */
+    protected boolean useCache(Environment env, Map<String, TemplateModel> params) throws TemplateModelException {
+        Boolean useCache = FreemarkerUtils.getParameter(USE_CACHE_PARAMETER_NAME, Boolean.class, params);
+        return useCache != null ? useCache : true;
+    }
+
+    /**
+     * 获取缓存区域
+     *
+     * @param env    Environment
+     * @param params 参数
+     * @return 缓存区域
+     */
+    protected String getCacheRegion(Environment env, Map<String, TemplateModel> params) throws TemplateModelException {
+        String cacheRegion = FreemarkerUtils.getParameter(CACHE_REGION_PARAMETER_NAME, String.class, params);
+        return cacheRegion != null ? cacheRegion : env.getTemplate().getName();
+    }
+
+    /**
+     * 获取ID
+     *
+     * @param params 参数
+     * @return ID
+     */
+    protected Long getId(Map<String, TemplateModel> params) throws TemplateModelException {
+        return FreemarkerUtils.getParameter(ID_PARAMETER_NAME, Long.class, params);
+    }
+
+    /**
+     * 获取数量
+     *
+     * @param params 参数
+     * @return 数量
+     */
+    protected Integer getCount(Map<String, TemplateModel> params) throws TemplateModelException {
+        return FreemarkerUtils.getParameter(COUNT_PARAMETER_NAME, Integer.class, params);
+    }
+
+    /**
+     * 获取筛选
+     *
+     * @param params           参数
+     * @param type             参数类型
+     * @param ignoreProperties 忽略属性
+     * @return 筛选
+     */
+    protected List<Filter> getFilters(Map<String, TemplateModel> params, Class<?> type, String... ignoreProperties) throws TemplateModelException {
+        List<Filter> filters = new ArrayList<Filter>();
+        PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(type);
+        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+            String propertyName = propertyDescriptor.getName();
+            Class<?> propertyType = propertyDescriptor.getPropertyType();
+            if (!ArrayUtils.contains(ignoreProperties, propertyName) && params.containsKey(propertyName)) {
+                Object value = FreemarkerUtils.getParameter(propertyName, propertyType, params);
+                filters.add(Filter.eq(propertyName, value));
+            }
+        }
+        return filters;
+    }
+
+    /**
+     * 获取排序
+     *
+     * @param params           参数
+     * @param ignoreProperties 忽略属性
+     * @return 排序
+     */
+    protected List<Order> getOrders(Map<String, TemplateModel> params, String... ignoreProperties) throws TemplateModelException {
+        String orderBy = StringUtils.trim(FreemarkerUtils.getParameter(ORDER_BY_PARAMETER_NAME, String.class, params));
+        List<Order> orders = new ArrayList<Order>();
+        if (StringUtils.isNotEmpty(orderBy)) {
+            String[] orderByItems = orderBy.split(ORDER_BY_ITEM_SEPARATOR);
+            for (String orderByItem : orderByItems) {
+                if (StringUtils.isNotEmpty(orderByItem)) {
+                    String property = null;
+                    Order.Direction direction = null;
+                    String[] orderBys = orderByItem.split(ORDER_BY_FIELD_SEPARATOR);
+                    if (orderBys.length == 1) {
+                        property = orderBys[0];
+                    } else if (orderBys.length >= 2) {
+                        property = orderBys[0];
+                        try {
+                            direction = Order.Direction.valueOf(orderBys[1]);
+                        } catch (IllegalArgumentException e) {
+                            continue;
+                        }
+                    } else {
+                        continue;
+                    }
+                    if (!ArrayUtils.contains(ignoreProperties, property)) {
+                        orders.add(new Order(property, direction));
+                    }
+                }
+            }
+        }
+        return orders;
+    }
+
+    /**
+     * 设置局部变量
+     *
+     * @param name  名称
+     * @param value 变量值
+     * @param env   Environment
+     * @param body  TemplateDirectiveBody
+     */
+    protected void setLocalVariable(String name, Object value, Environment env, TemplateDirectiveBody body) throws TemplateException, IOException {
+        TemplateModel sourceVariable = FreemarkerUtils.getVariable(name, env);
+        FreemarkerUtils.setVariable(name, value, env);
+        body.render(env.getOut());
+        FreemarkerUtils.setVariable(name, sourceVariable, env);
+    }
+
+    /**
+     * 设置局部变量
+     *
+     * @param variables 变量
+     * @param env       Environment
+     * @param body      TemplateDirectiveBody
+     */
+    protected void setLocalVariables(Map<String, Object> variables, Environment env, TemplateDirectiveBody body) throws TemplateException, IOException {
+        Map<String, Object> sourceVariables = new HashMap<String, Object>();
+        for (String name : variables.keySet()) {
+            TemplateModel sourceVariable = FreemarkerUtils.getVariable(name, env);
+            sourceVariables.put(name, sourceVariable);
+        }
+        FreemarkerUtils.setVariables(variables, env);
+        body.render(env.getOut());
+        FreemarkerUtils.setVariables(sourceVariables, env);
+    }
+
+}

+ 42 - 0
app-backend-web/src/main/java/com/hboxs/template/directive/ExecuteTimeDirective.java

@@ -0,0 +1,42 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.directive;
+
+import com.hboxs.common.interceptor.ExecuteTimeInterceptor;
+import freemarker.core.Environment;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModel;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * 模板指令 - 执行时间
+ */
+@Component("executeTimeDirective")
+public class ExecuteTimeDirective extends BaseDirective {
+
+    /**
+     * 变量名称
+     */
+    private static final String VARIABLE_NAME = "executeTime";
+
+    @SuppressWarnings("rawtypes")
+    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
+        RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+        if (requestAttributes != null) {
+            Long executeTime = (Long) requestAttributes.getAttribute(ExecuteTimeInterceptor.EXECUTE_TIME_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
+            if (executeTime != null) {
+                setLocalVariable(VARIABLE_NAME, executeTime, env, body);
+            }
+        }
+    }
+
+}

+ 53 - 0
app-backend-web/src/main/java/com/hboxs/template/directive/FlashMessageDirective.java

@@ -0,0 +1,53 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.directive;
+
+import com.hboxs.common.Message;
+import freemarker.core.Environment;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModel;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Map;
+
+/**
+ * 模板指令 - 瞬时消息
+ */
+@Component("flashMessageDirective")
+public class FlashMessageDirective extends BaseDirective {
+
+    /**
+     * "瞬时消息"属性名称
+     */
+    public static final String FLASH_MESSAGE_ATTRIBUTE_NAME = FlashMessageDirective.class.getName() + ".FLASH_MESSAGE";
+
+    /**
+     * 变量名称
+     */
+    private static final String VARIABLE_NAME = "flashMessage";
+
+    @SuppressWarnings("rawtypes")
+    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
+        RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
+        if (requestAttributes != null) {
+            Message message = (Message) requestAttributes.getAttribute(FLASH_MESSAGE_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
+            if (body != null) {
+                setLocalVariable(VARIABLE_NAME, message, env, body);
+            } else {
+                if (message != null) {
+                    Writer out = env.getOut();
+                    out.write("$.message(\"" + message.getType() + "\", \"" + message.getContent() + "\");");
+                }
+            }
+        }
+    }
+
+}

+ 166 - 0
app-backend-web/src/main/java/com/hboxs/template/directive/PaginationDirective.java

@@ -0,0 +1,166 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.directive;
+
+import com.hboxs.common.utils.FreemarkerUtils;
+import freemarker.core.Environment;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModel;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 模板指令 - 分页
+ */
+@Component("paginationDirective")
+public class PaginationDirective extends BaseDirective {
+
+    /**
+     * "模式"参数名称
+     */
+    private static final String PATTERN_PARAMETER_NAME = "pattern";
+
+    /**
+     * "页码"参数名称
+     */
+    private static final String PAGE_NUMBER_PARAMETER_NAME = "pageNumber";
+
+    /**
+     * "总页数"参数名称
+     */
+    private static final String TOTAL_PAGES_PARAMETER_NAME = "totalPages";
+
+    /**
+     * "中间段页码数"参数名称
+     */
+    private static final String SEGMENT_COUNT_PARAMETER_NAME = "segmentCount";
+
+    /**
+     * "模式"变量名称
+     */
+    private static final String PATTERN_VARIABLE_NAME = "pattern";
+
+    /**
+     * "页码"变量名称
+     */
+    private static final String PAGE_NUMBER_VARIABLE_NAME = "pageNumber";
+
+    /**
+     * "总页数"变量名称
+     */
+    private static final String PAGE_COUNT_VARIABLE_NAME = "totalPages";
+
+    /**
+     * "中间段页码数"变量名称
+     */
+    private static final String SEGMENT_COUNT_VARIABLE_NAME = "segmentCount";
+
+    /**
+     * "是否存在上一页"变量名称
+     */
+    private static final String HAS_PREVIOUS_VARIABLE_NAME = "hasPrevious";
+
+    /**
+     * "是否存在下一页"变量名称
+     */
+    private static final String HAS_NEXT_VARIABLE_NAME = "hasNext";
+
+    /**
+     * "是否为首页"变量名称
+     */
+    private static final String IS_FIRST_VARIABLE_NAME = "isFirst";
+
+    /**
+     * "是否为末页"变量名称
+     */
+    private static final String IS_LAST_VARIABLE_NAME = "isLast";
+
+    /**
+     * "上一页页码"变量名称
+     */
+    private static final String PREVIOUS_PAGE_NUMBER_VARIABLE_NAME = "previousPageNumber";
+
+    /**
+     * "下一页页码"变量名称
+     */
+    private static final String NEXT_PAGE_NUMBER_VARIABLE_NAME = "nextPageNumber";
+
+    /**
+     * "首页页码"变量名称
+     */
+    private static final String FIRST_PAGE_NUMBER_VARIABLE_NAME = "firstPageNumber";
+
+    /**
+     * "末页页码"变量名称
+     */
+    private static final String LAST_PAGE_NUMBER_VARIABLE_NAME = "lastPageNumber";
+
+    /**
+     * "中间段页码"变量名称
+     */
+    private static final String SEGMENT_VARIABLE_NAME = "segment";
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
+        String pattern = FreemarkerUtils.getParameter(PATTERN_PARAMETER_NAME, String.class, params);
+        Integer pageNumber = FreemarkerUtils.getParameter(PAGE_NUMBER_PARAMETER_NAME, Integer.class, params);
+        Integer totalPages = FreemarkerUtils.getParameter(TOTAL_PAGES_PARAMETER_NAME, Integer.class, params);
+        Integer segmentCount = FreemarkerUtils.getParameter(SEGMENT_COUNT_PARAMETER_NAME, Integer.class, params);
+
+        if (pageNumber == null || pageNumber < 1) {
+            pageNumber = 1;
+        }
+        if (totalPages == null || totalPages < 1) {
+            totalPages = 1;
+        }
+        if (segmentCount == null || segmentCount < 1) {
+            segmentCount = 5;
+        }
+        boolean hasPrevious = pageNumber > 1;
+        boolean hasNext = pageNumber < totalPages;
+        boolean isFirst = pageNumber == 1;
+        boolean isLast = pageNumber.equals(totalPages);
+        int previousPageNumber = pageNumber - 1;
+        int nextPageNumber = pageNumber + 1;
+        int firstPageNumber = 1;
+        int lastPageNumber = totalPages;
+        int startSegmentPageNumber = pageNumber - (int) Math.floor((segmentCount - 1) / 2D);
+        int endSegmentPageNumber = pageNumber + (int) Math.ceil((segmentCount - 1) / 2D);
+        if (startSegmentPageNumber < 1) {
+            startSegmentPageNumber = 1;
+        }
+        if (endSegmentPageNumber > totalPages) {
+            endSegmentPageNumber = totalPages;
+        }
+        List<Integer> segment = new ArrayList<Integer>();
+        for (int i = startSegmentPageNumber; i <= endSegmentPageNumber; i++) {
+            segment.add(i);
+        }
+
+        Map<String, Object> variables = new HashMap<String, Object>();
+        variables.put(PATTERN_VARIABLE_NAME, pattern);
+        variables.put(PAGE_NUMBER_VARIABLE_NAME, pageNumber);
+        variables.put(PAGE_COUNT_VARIABLE_NAME, totalPages);
+        variables.put(SEGMENT_COUNT_VARIABLE_NAME, segmentCount);
+        variables.put(HAS_PREVIOUS_VARIABLE_NAME, hasPrevious);
+        variables.put(HAS_NEXT_VARIABLE_NAME, hasNext);
+        variables.put(IS_FIRST_VARIABLE_NAME, isFirst);
+        variables.put(IS_LAST_VARIABLE_NAME, isLast);
+        variables.put(PREVIOUS_PAGE_NUMBER_VARIABLE_NAME, previousPageNumber);
+        variables.put(NEXT_PAGE_NUMBER_VARIABLE_NAME, nextPageNumber);
+        variables.put(FIRST_PAGE_NUMBER_VARIABLE_NAME, firstPageNumber);
+        variables.put(LAST_PAGE_NUMBER_VARIABLE_NAME, lastPageNumber);
+        variables.put(SEGMENT_VARIABLE_NAME, segment);
+        setLocalVariables(variables, env, body);
+    }
+
+}

+ 85 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AbbreviateMethod.java

@@ -0,0 +1,85 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModelException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * 模板方法 - 字符串缩略
+ */
+@Component("abbreviateMethod")
+public class AbbreviateMethod implements TemplateMethodModel {
+
+    /**
+     * 中文字符配比
+     */
+    private static final Pattern PATTERN = Pattern.compile("[\\u4e00-\\u9fa5\\ufe30-\\uffa0]+$");
+
+    @SuppressWarnings("rawtypes")
+    public Object exec(List arguments) throws TemplateModelException {
+        if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null && StringUtils.isNotEmpty(arguments.get(0).toString())) {
+            Integer width = null;
+            String ellipsis = null;
+            if (arguments.size() == 2) {
+                if (arguments.get(1) != null) {
+                    width = Integer.valueOf(arguments.get(1).toString());
+                }
+            } else if (arguments.size() > 2) {
+                if (arguments.get(1) != null) {
+                    width = Integer.valueOf(arguments.get(1).toString());
+                }
+                if (arguments.get(2) != null) {
+                    ellipsis = arguments.get(2).toString();
+                }
+            }
+            return new SimpleScalar(abbreviate(arguments.get(0).toString(), width, ellipsis));
+        }
+        return null;
+    }
+
+    /**
+     * 字符串缩略
+     *
+     * @param str      原字符串
+     * @param width    宽度
+     * @param ellipsis 省略符
+     * @return 缩略字符
+     */
+    private String abbreviate(String str, Integer width, String ellipsis) {
+        if (width != null) {
+            int strLength = 0;
+            for (int strWidth = 0; strLength < str.length(); strLength++) {
+                strWidth = PATTERN.matcher(String.valueOf(str.charAt(strLength))).find() ? strWidth + 2 : strWidth + 1;
+                if (strWidth >= width) {
+                    break;
+                }
+            }
+            if (strLength < str.length()) {
+                if (ellipsis != null) {
+                    return str.substring(0, strLength + 1) + ellipsis;
+                } else {
+                    return str.substring(0, strLength + 1);
+                }
+            } else {
+                return str;
+            }
+        } else {
+            if (ellipsis != null) {
+                return str + ellipsis;
+            } else {
+                return str;
+            }
+        }
+    }
+
+}

+ 36 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AdminCountByEquipmentMethod.java

@@ -0,0 +1,36 @@
+/*
+ *
+ *
+ *
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.service.EquipmentService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 通过用户名来统计有多少个设备
+ */
+@Component("countMethod")
+public class AdminCountByEquipmentMethod extends EntityTemplateMethodAdaptor {
+
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+
+                return equipmentService.findByAdminId(id).size();
+            }
+        });
+    }
+
+}

+ 26 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AdminLevelMethod.java

@@ -0,0 +1,26 @@
+package com.hboxs.template.method;
+
+import com.hboxs.service.EquipmentService;
+import freemarker.template.TemplateModelException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 查询商家级别
+ */
+@Component("adminLevelMethod")
+public class AdminLevelMethod extends EntityTemplateMethodAdaptor {
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Override
+    public Object exec(List list) throws TemplateModelException {
+        if (StringUtils.isEmpty(list.get(0).toString())) {
+            return null;
+        }
+        return equipmentService.findByClientId(list.get(0).toString());
+    }
+}

+ 36 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AdminMethod.java

@@ -0,0 +1,36 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.service.AdminService;
+import com.hboxs.service.AreaService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 模板方法 - admin
+ */
+@Component("adminMethod")
+public class AdminMethod extends EntityTemplateMethodAdaptor {
+
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+                return adminService.find(id);
+            }
+        });
+    }
+
+}

+ 32 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AlarmRecordMethod.java

@@ -0,0 +1,32 @@
+package com.hboxs.template.method;
+
+import com.hboxs.common.Filter;
+import com.hboxs.common.Pageable;
+import com.hboxs.service.AlarmRecordService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 模板方法 - alarmRecord
+ */
+@Component("alarmRecordMethod")
+public class AlarmRecordMethod extends  EntityTemplateMethodAdaptor {
+
+    @Resource(name = "alarmRecordServiceImpl")
+    private AlarmRecordService alarmRecordService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+
+                return alarmRecordService.count(Filter.eq("equipmentId", id));
+            }
+
+        });
+    }
+}

+ 35 - 0
app-backend-web/src/main/java/com/hboxs/template/method/AreaMethod.java

@@ -0,0 +1,35 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.service.AreaService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 模板方法 - 地区详情
+ */
+@Component("areaMethod")
+public class AreaMethod extends EntityTemplateMethodAdaptor {
+
+
+    @Resource(name = "areaServiceImpl")
+    private AreaService areaService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+                return areaService.find(id);
+            }
+        });
+    }
+
+}

+ 46 - 0
app-backend-web/src/main/java/com/hboxs/template/method/CommonParamMethod.java

@@ -0,0 +1,46 @@
+package com.hboxs.template.method;
+
+import com.gexin.fastjson.JSON;
+import com.hboxs.ViewObject.CommonParamVo;
+import com.hboxs.entity.Equipment;
+import com.hboxs.service.EquipmentService;
+import freemarker.template.TemplateModelException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Component("paramMethod")
+public class CommonParamMethod extends EntityTemplateMethodAdaptor {
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        String name = arguments.get(0).toString();
+        String clientId = arguments.get(1).toString();
+        String code = arguments.get(2).toString();
+        Equipment equipment = equipmentService.findByClientId(clientId);
+        List<CommonParamVo> commonParamVos = null;
+        String commonParameters = equipment.getCommonParameters();
+        String advancedParameters = equipment.getAdvancedParameters();
+        if (StringUtils.isEmpty(commonParameters) || StringUtils.isEmpty(advancedParameters)) {
+            return 0;
+        }
+        if (code.equals("0")) {
+            commonParamVos = JSON.parseArray(commonParameters, CommonParamVo.class);
+
+        } else {
+
+            commonParamVos = JSON.parseArray(advancedParameters, CommonParamVo.class);
+        }
+        for (CommonParamVo commonParamVo : commonParamVos) {
+            if (commonParamVo.getName().equals(name)) {
+                return commonParamVo.getVal();
+            }
+        }
+        return 0;
+    }
+}

+ 56 - 0
app-backend-web/src/main/java/com/hboxs/template/method/CurrencyMethod.java

@@ -0,0 +1,56 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.common.Setting;
+import com.hboxs.common.utils.SettingUtils;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModelException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 模板方法 - 货币格式化
+ */
+@Component("currencyMethod")
+public class CurrencyMethod implements TemplateMethodModel {
+
+    @SuppressWarnings("rawtypes")
+    public Object exec(List arguments) throws TemplateModelException {
+        if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null && StringUtils.isNotEmpty(arguments.get(0).toString())) {
+            boolean showSign = false;
+            boolean showUnit = false;
+            if (arguments.size() == 2) {
+                if (arguments.get(1) != null) {
+                    showSign = Boolean.valueOf(arguments.get(1).toString());
+                }
+            } else if (arguments.size() > 2) {
+                if (arguments.get(1) != null) {
+                    showSign = Boolean.valueOf(arguments.get(1).toString());
+                }
+                if (arguments.get(2) != null) {
+                    showUnit = Boolean.valueOf(arguments.get(2).toString());
+                }
+            }
+            Setting setting = SettingUtils.get();
+            BigDecimal amount = new BigDecimal(arguments.get(0).toString());
+            String price = setting.setScale(amount).toString();
+            if (showSign) {
+                price = setting.getCurrencySign() + price;
+            }
+            if (showUnit) {
+                price += setting.getCurrencyUnit();
+            }
+            return new SimpleScalar(price);
+        }
+        return null;
+    }
+
+}

+ 53 - 0
app-backend-web/src/main/java/com/hboxs/template/method/EntityTemplateMethodAdaptor.java

@@ -0,0 +1,53 @@
+package com.hboxs.template.method;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.TemplateMethodModelEx;
+import freemarker.template.TemplateModelException;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 获取实体模板方法适配器
+ */
+public abstract class EntityTemplateMethodAdaptor implements TemplateMethodModelEx {
+
+    /**
+     * 基础处理代码
+     *
+     * @param handler 函数式接口
+     * @return entity
+     * @throws TemplateModelException
+     */
+    Object exec(List arguments, EntityMethodHandler handler) throws TemplateModelException {
+        Object arg;
+        if (arguments == null || arguments.size() == 0 || (arg = arguments.get(0)) == null) {
+            //前端需要null
+            return new SimpleHash(new HashMap(), null);
+        }
+        Long id;
+        try {
+            id = Long.valueOf(arg.toString());
+        } catch (Exception e) {
+            throw new TemplateModelException("获取实体失败:Id类型转换错误");
+        }
+        try {
+            return handler.findEntityById(id);
+        } catch (Exception e) {
+            throw new TemplateModelException("获取实体失败:对象转换为Map出现异常");
+        }
+
+    }
+
+
+    /**
+     * 函数式接口,命令模式
+     */
+    public interface EntityMethodHandler {
+
+        Object findEntityById(Long id);
+
+
+    }
+
+}

+ 36 - 0
app-backend-web/src/main/java/com/hboxs/template/method/EquipmentMethod.java

@@ -0,0 +1,36 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.service.AdminService;
+import com.hboxs.service.EquipmentService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 模板方法 - 设备
+ */
+@Component("equipmentMethod")
+public class EquipmentMethod extends EntityTemplateMethodAdaptor {
+
+
+    @Resource(name = "equipmentServiceImpl")
+    private EquipmentService equipmentService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+                return equipmentService.find(id);
+            }
+        });
+    }
+
+}

+ 41 - 0
app-backend-web/src/main/java/com/hboxs/template/method/MaintainHistoryMethod.java

@@ -0,0 +1,41 @@
+package com.hboxs.template.method;
+
+import com.hboxs.common.Filter;
+import com.hboxs.service.MaintainingHistoryService;
+import freemarker.ext.beans.DateModel;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Component("maintainHistoryMethod")
+public class MaintainHistoryMethod extends EntityTemplateMethodAdaptor {
+
+    @Resource(name = "maintainingHistoryServiceImpl")
+    private MaintainingHistoryService maintainingHistoryService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+
+        String clientId = arguments.get(0).toString();
+        String administrator = arguments.get(1).toString();
+        DateModel maintenanceTime = (DateModel) arguments.get(2);
+        if (clientId == "" || administrator == "" || maintenanceTime == null) {
+            return null;
+        }
+        ArrayList<Filter> filters = new ArrayList<>();
+        filters.add(Filter.like("clientId", clientId));
+        filters.add(Filter.like("administrator", administrator));
+        filters.add(Filter.eq("maintenanceTime", maintenanceTime.getAsDate()));
+        long seize = maintainingHistoryService.count(filters);
+        filters.add(Filter.eq("repairStatus", true));
+        //查询已经修复的个数
+        long count = maintainingHistoryService.count(filters);
+        //查询未修复的总个数
+        long count1 = seize - count;
+
+        return seize + ":" + count + ":" + count1;
+    }
+}

+ 43 - 0
app-backend-web/src/main/java/com/hboxs/template/method/ManagerIdMethod.java

@@ -0,0 +1,43 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.common.utils.AdminUtils;
+import com.hboxs.service.AdminService;
+import freemarker.template.TemplateModelException;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 模板方法 - admin 的 管理系统ID freemarker 自定义模板
+ */
+@Component("managerIdMethod")
+public class ManagerIdMethod extends EntityTemplateMethodAdaptor {
+
+
+    @Resource(name = "adminServiceImpl")
+    private AdminService adminService;
+
+    @Override
+    public Object exec(List arguments) throws TemplateModelException {
+
+        return exec(arguments, new EntityMethodHandler() {
+            @Override
+            public Object findEntityById(Long id) {
+
+                // 46
+                Long adminId = AdminUtils.decrypt(false , String.valueOf(id));
+
+                return adminService.find(adminId);
+
+            }
+        });
+
+    }
+
+}

+ 39 - 0
app-backend-web/src/main/java/com/hboxs/template/method/MessageMethod.java

@@ -0,0 +1,39 @@
+/*
+ * 
+ * 
+ * 
+ */
+package com.hboxs.template.method;
+
+import com.hboxs.common.utils.SpringUtils;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModelException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 模板方法 - 多语言
+ */
+@Component("messageMethod")
+public class MessageMethod implements TemplateMethodModel {
+
+    @SuppressWarnings("rawtypes")
+    public Object exec(List arguments) throws TemplateModelException {
+        if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null && StringUtils.isNotEmpty(arguments.get(0).toString())) {
+            String message = null;
+            String code = arguments.get(0).toString();
+            if (arguments.size() > 1) {
+                Object[] args = arguments.subList(1, arguments.size()).toArray();
+                message = SpringUtils.getMessage(code, args);
+            } else {
+                message = SpringUtils.getMessage(code);
+            }
+            return new SimpleScalar(message);
+        }
+        return null;
+    }
+
+}

binární
app-backend-web/src/main/resources/admin设计解析.png


+ 81 - 0
app-backend-web/src/main/resources/applicationContext-mvc.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
+       default-lazy-init="true">
+
+    <context:property-placeholder location="classpath*:/system.properties" ignore-resource-not-found="true"
+                                  ignore-unresolvable="true"/>
+
+    <context:component-scan base-package="com.hboxs" use-default-filters="false">
+        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
+    </context:component-scan>
+
+    <!-- aop -->
+    <aop:aspectj-autoproxy/>
+
+    <mvc:annotation-driven validator="validator" content-negotiation-manager="contentNegotiationManager"/>
+
+    <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
+        <property name="favorPathExtension" value="false"/>
+        <property name="favorParameter" value="false"/>
+        <property name="ignoreAcceptHeader" value="false"/>
+        <property name="mediaTypes">
+            <value>
+                atom=application/atom+xml
+                html=text/html
+                json=application/json
+                *=*/*
+            </value>
+        </property>
+    </bean>
+
+    <mvc:interceptors>
+        <mvc:interceptor>
+            <mvc:mapping path="/**"/>
+            <bean id="openSessionInViewInterceptor"
+                  class="org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor">
+                <property name="entityManagerFactory" ref="entityManagerFactory"/>
+            </bean>
+        </mvc:interceptor>
+        <mvc:interceptor>
+            <mvc:mapping path="/asl-admin/**"/>
+            <bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
+                <property name="cacheSeconds" value="0"/>
+            </bean>
+        </mvc:interceptor>
+        <mvc:interceptor>
+            <mvc:mapping path="/asl-admin/**"/>
+            <bean id="listInterceptor" class="com.hboxs.common.interceptor.ListInterceptor"/>
+        </mvc:interceptor>
+    </mvc:interceptors>
+
+    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
+        <property name="validationMessageSource" ref="messageSource"/>
+    </bean>
+
+    <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
+        <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/>
+        <property name="suffix" value="${template.suffix}"/>
+        <property name="contentType" value="text/html; charset=UTF-8"/>
+        <property name="exposeRequestAttributes" value="true"/>
+        <property name="exposeSessionAttributes" value="true"/>
+        <property name="exposeSpringMacroHelpers" value="true"/>
+        <property name="requestContextAttribute" value="request"/>
+        <property name="cache" value="true"/>
+        <property name="order" value="0"/>
+    </bean>
+
+    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
+        <property name="defaultEncoding" value="utf-8"/>
+    </bean>
+
+    <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
+        <property name="defaultErrorView" value="asl/common/error"/>
+    </bean>
+
+</beans>

+ 62 - 0
app-backend-web/src/main/resources/applicationContext-redis.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:cache="http://www.springframework.org/schema/cache"
+       xmlns:task="http://www.springframework.org/schema/task"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
+	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
+	http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd"
+       default-lazy-init="true">
+
+    <!-- redis -->
+    <bean id="jedisPool" class="redis.clients.jedis.JedisPoolConfig">
+        <property name="maxIdle" value="${redis.maxIdle}"/>
+        <property name="maxTotal" value="${redis.maxActive}"/>
+        <property name="maxWaitMillis" value="${redis.maxWait}"/>
+        <property name="testOnBorrow" value="true"/>
+    </bean>
+    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
+        <property name="usePool" value="true"></property>
+        <property name="hostName" value="${redis.host}"/>
+        <property name="port" value="${redis.port}"/>
+        <property name="password" value="${redis.pass}"/>
+        <property name="timeout" value="${redis.timeout}"/>
+        <!--   <property name="database" value="${redis.default.db}"></property> -->
+        <constructor-arg index="0" ref="jedisPool"/>
+    </bean>
+    <!-- redis 模板  -->
+    <bean id="stringRedisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
+        <property name="connectionFactory" ref="connectionFactory"/>
+        <property name="keySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="valueSerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="hashKeySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="hashValueSerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+    </bean>
+
+    <bean id="jdkRedisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
+        <property name="connectionFactory" ref="connectionFactory"/>
+        <property name="keySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="valueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+        <property name="hashKeySerializer">
+            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
+        </property>
+        <property name="hashValueSerializer">
+            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
+        </property>
+    </bean>
+
+</beans>

+ 55 - 0
app-backend-web/src/main/resources/applicationContext-shiro.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"
+       default-lazy-init="true">
+
+    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
+        <property name="securityManager" ref="securityManager"/>
+        <property name="loginUrl" value="/asl-admin/login.jsp"/>
+        <property name="successUrl" value="/asl-admin/common/main.htm"/>
+        <property name="unauthorizedUrl" value="/asl-admin/login.jsp"/>
+        <property name="filterChainDefinitions">
+            <value>
+                /asl-admin/logout.jsp = logout
+                /asl-admin/file/** = perms["admin:file"]
+                /asl-admin/global_config/** = perms["admin:setting"]
+                /asl-admin/admin/** = perms["admin:admin"]
+                /asl-admin/role/** = perms["admin:role"]
+
+
+                /asl-admin/** = authc
+            </value>
+        </property>
+        <property name="filters">
+            <map>
+                <entry key="authc" value-ref="authenticationFilter"/>
+                <entry key="logout" value-ref="authcLogoutFilter"/>
+            </map>
+        </property>
+    </bean>
+
+    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
+        <property name="realm" ref="authenticationRealm"/>
+        <property name="cacheManager" ref="shiroCacheManager"/>
+    </bean>
+
+    <bean id="authenticationRealm" class="com.hboxs.myshiro.AuthenticationRealm">
+        <property name="authorizationCacheName" value="authorization"/>
+    </bean>
+
+    <bean id="authcLogoutFilter" class="com.hboxs.myshiro.AuthcLogoutFilter"/>
+
+    <bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
+        <property name="cacheManager" ref="ehCacheManager"/>
+    </bean>
+
+    <bean id="authenticationFilter" class="com.hboxs.myshiro.AuthenticationFilter"/>
+
+    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+        <property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/>
+        <property name="arguments" ref="securityManager"/>
+    </bean>
+
+</beans>

+ 171 - 0
app-backend-web/src/main/resources/applicationContext.xml

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:cache="http://www.springframework.org/schema/cache"
+       xmlns:task="http://www.springframework.org/schema/task"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
+	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
+	http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd"
+       default-lazy-init="true">
+
+    <context:property-placeholder location="classpath*:/system.properties" ignore-resource-not-found="true"
+                                  ignore-unresolvable="true"/>
+
+    <context:component-scan base-package="com.hboxs">
+        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
+    </context:component-scan>
+
+    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
+        <property name="driverClass" value="${jdbc.driver}"/>
+        <property name="jdbcUrl" value="${jdbc.url}"/>
+        <property name="user" value="${jdbc.username}"/>
+        <property name="password" value="${jdbc.password}"/>
+        <property name="initialPoolSize" value="${connection_pools.initial_pool_size}"/>
+        <property name="minPoolSize" value="${connection_pools.min_pool_size}"/>
+        <property name="maxPoolSize" value="${connection_pools.max_pool_size}"/>
+        <property name="maxIdleTime" value="${connection_pools.max_idle_time}"/>
+        <property name="acquireIncrement" value="${connection_pools.acquire_increment}"/>
+        <property name="checkoutTimeout" value="${connection_pools.checkout_timeout}"/>
+    </bean>
+
+    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+        <property name="dataSource" ref="dataSource"/>
+        <property name="persistenceXmlLocation" value="classpath*:/persistence.xml"/>
+        <property name="persistenceUnitName" value="persistenceUnit"/>
+        <property name="packagesToScan">
+            <array>
+                <value>com.hboxs.entity</value>
+                <value>com.hboxs.joinpay.entity</value>
+            </array>
+        </property>
+        <property name="jpaVendorAdapter">
+            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+                <property name="showSql" value="false"/>
+                <property name="generateDdl" value="true"/>
+            </bean>
+        </property>
+        <property name="jpaProperties">
+            <props>
+                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
+                <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
+                <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
+                <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory_class}</prop>
+                <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
+                <prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
+                <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
+                <prop key="hibernate.connection.show_sql">${hibernate.connection.show_sql}</prop>
+                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
+                <prop key="hibernate.connection.isolation">3</prop>
+                <prop key="javax.persistence.validation.mode">none</prop>
+                <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider
+                </prop>
+                <prop key="hibernate.search.default.indexBase">${java.io.tmpdir}/${system.project_name}/index</prop>
+            </props>
+        </property>
+    </bean>
+
+    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+        <property name="entityManagerFactory" ref="entityManagerFactory"/>
+    </bean>
+
+    <tx:annotation-driven transaction-manager="transactionManager"/>
+
+    <cache:annotation-driven cache-manager="cacheManager"/>
+
+    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+        <property name="targetClass" value="java.lang.System"/>
+        <property name="targetMethod" value="setProperty"/>
+        <property name="arguments">
+            <list>
+                <value>system.project_name</value>
+                <value>${system.project_name}</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+        <property name="configLocation" value="classpath:/ehcache.xml"/>
+        <property name="shared" value="true"/>
+    </bean>
+
+    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
+        <property name="cacheManager" ref="ehCacheManager"/>
+    </bean>
+
+    <bean id="freeMarkerConfigurer" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
+        <property name="templateLoaderPaths" value="${template.loader_path}"/>
+        <property name="freemarkerSettings">
+            <props>
+                <prop key="defaultEncoding">${template.encoding}</prop>
+                <prop key="url_escaping_charset">${url_escaping_charset}</prop>
+                <prop key="locale">${locale}</prop>
+                <prop key="template_update_delay">${template.update_delay}</prop>
+                <prop key="tag_syntax">auto_detect</prop>
+                <prop key="whitespace_stripping">true</prop>
+                <prop key="classic_compatible">true</prop>
+                <prop key="number_format">${template.number_format}</prop>
+                <prop key="boolean_format">${template.boolean_format}</prop>
+                <prop key="datetime_format">${template.datetime_format}</prop>
+                <prop key="date_format">${template.date_format}</prop>
+                <prop key="time_format">${template.time_format}</prop>
+                <prop key="object_wrapper">freemarker.ext.beans.BeansWrapper</prop>
+            </props>
+        </property>
+        <property name="freemarkerVariables">
+            <map>
+                <entry key="systemName" value="${system.name}"/>
+                <entry key="systemVersion" value="${system.version}"/>
+                <entry key="systemDescription" value="${system.description}"/>
+                <entry key="systemShowPowered" value="${system.show_powered}"/>
+                <entry key="base" value="#{servletContext.contextPath}"/>
+                <entry key="static_base" value="#{servletContext.contextPath}/i"/>
+                <entry key="locale" value="${locale}"/>
+                <entry key="setting" value="#{T(com.hboxs.common.utils.SettingUtils).get()}"/>
+                <entry key="message" value-ref="messageMethod"/>
+                <entry key="abbreviate" value-ref="abbreviateMethod"/>
+                <entry key="currency" value-ref="currencyMethod"/>
+                <entry key="execute_time" value-ref="executeTimeDirective"/>
+                <entry key="flash_message" value-ref="flashMessageDirective"/>
+                <entry key="pagination" value-ref="paginationDirective"/>
+                <entry key="_Area" value-ref="areaMethod"/>
+                <entry key="_Admin" value-ref="adminMethod"/>
+                <entry key="_Equipment" value-ref="equipmentMethod"/>
+                <entry key="_ManagerId" value-ref="managerIdMethod"/>
+                <entry key="_alarmRecordId" value-ref="alarmRecordMethod"/>
+                <entry key="_maintainHistoryMethodId" value-ref="maintainHistoryMethod"/>
+                <entry key="_adminLevelMethod" value-ref="adminLevelMethod"/>
+                <entry key="_countMethod" value-ref="countMethod"/>
+                <entry key="_paramMethod" value-ref="paramMethod"/>
+            </map>
+        </property>
+    </bean>
+
+    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
+        <property name="cacheSeconds" value="${message.cache_seconds}"/>
+        <property name="useCodeAsDefaultMessage" value="true"/>
+        <property name="basenames">
+            <list>
+                <value>${message.common_path}</value>
+                <value>${message.shop_path}</value>
+                <value>${message.admin_path}</value>
+                <value>${message.asl_path}</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.FixedLocaleResolver">
+        <property name="defaultLocale" value="${locale}"/>
+    </bean>
+
+    <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
+        <property name="corePoolSize" value="${task.core_pool_size}"/>
+        <property name="maxPoolSize" value="${task.max_pool_size}"/>
+        <property name="queueCapacity" value="${task.queue_capacity}"/>
+        <property name="keepAliveSeconds" value="${task.keep_alive_seconds}"/>
+    </bean>
+
+    <task:annotation-driven/>
+
+</beans>

binární
app-backend-web/src/main/resources/captcha/captcha_bg_0.jpg


+ 13 - 0
app-backend-web/src/main/resources/ehcache.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
+
+    <diskStore path="${java.io.tmpdir}/${system.project_name}/cache"/>
+
+    <cache name="authorization" maxElementsInMemory="100" timeToLiveSeconds="3600" eternal="false"
+           overflowToDisk="false"/>
+    <cache name="setting" maxElementsInMemory="100" eternal="true" overflowToDisk="true"/>
+    <cache name="area" maxElementsInMemory="500" timeToIdleSeconds="3600" timeToLiveSeconds="86400" eternal="false"
+           overflowToDisk="true"/>
+
+</ehcache>

binární
app-backend-web/src/main/resources/keys/apiclient_cert.p12


+ 90 - 0
app-backend-web/src/main/resources/mvctemplate/control.data

@@ -0,0 +1,90 @@
+/*
+ * 
+ *  [entity_name]Controller
+ * 
+ */
+package [package_path]control.admin;
+
+import [package_path]common.Message;
+import [package_path]common.Pageable;
+import [package_path]entity.[entity_name];
+import [package_path]service.[entity_name]Service;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+import javax.servlet.http.HttpSession;
+
+import javax.annotation.Resource;
+
+/**
+ * Controller - [chinese_name]
+ */
+@Controller("admin[entity_name]Controller")
+@RequestMapping("/asl-admin/[webapp_entity]")
+public class [entity_name]Controller extends BaseController {
+
+    @Resource(name = "[entity_name_small]ServiceImpl")
+    private [entity_name]Service [entity_name_small]Service;
+
+    /**
+     * 添加
+     */
+    @RequestMapping(value = "/add", method = RequestMethod.GET)
+    public String add(ModelMap model, HttpSession session) {
+        return "/admin/[webapp_entity]/add";
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String save([entity_name] [entity_name_small], RedirectAttributes redirectAttributes) {
+        [entity_name_small]Service.save([entity_name_small]);
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 编辑
+     */
+    @RequestMapping(value = "/edit", method = RequestMethod.GET)
+    public String edit(Long id, ModelMap model, HttpSession session) {
+        model.addAttribute("[entity_name_small]", [entity_name_small]Service.find(id));
+        return "/admin/[webapp_entity]/edit";
+    }
+
+    /**
+     * 更新
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    public String update([entity_name] [entity_name_small], RedirectAttributes redirectAttributes) {
+        [entity_name_small]Service.update([entity_name_small], "");
+        addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
+        return "redirect:list.htm";
+    }
+
+    /**
+     * 列表
+     */
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public String list(Pageable pageable, ModelMap model) {
+        model.addAttribute("page", [entity_name_small]Service.findPage(pageable));
+        return "/admin/[webapp_entity]/list";
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    public
+    @ResponseBody
+    Message delete(Long[] ids) {
+        [entity_name_small]Service.delete(ids);
+        return SUCCESS_MESSAGE;
+    }
+
+}

+ 15 - 0
app-backend-web/src/main/resources/mvctemplate/dao.data

@@ -0,0 +1,15 @@
+/*
+ * 
+ *  [entity_name]Dao
+ * 
+ */
+package [package_path]dao;
+
+import [package_path]entity.[entity_name];
+
+/**
+* Dao - [chinese_name]
+*/
+public interface [entity_name]Dao extends BaseDao<[entity_name], Long> {
+
+}

+ 18 - 0
app-backend-web/src/main/resources/mvctemplate/daoImpl.data

@@ -0,0 +1,18 @@
+/*
+ * 
+ *  [entity_name]DaoImpl
+ *
+ */
+package [package_path]dao.impl;
+
+import [package_path]dao.[entity_name]Dao;
+import [package_path]entity.[entity_name];
+import org.springframework.stereotype.Repository;
+
+/**
+ * Dao - [chinese_name]
+ */
+@Repository("[entity_name_small]DaoImpl")
+public class [entity_name]DaoImpl extends BaseDaoImpl<[entity_name], Long> implements [entity_name]Dao {
+
+}

+ 19 - 0
app-backend-web/src/main/resources/mvctemplate/service.data

@@ -0,0 +1,19 @@
+/*
+ * 
+ * [entity_name]Service
+ *
+ */
+package [package_path]service;
+
+import [package_path]common.Filter;
+import [package_path]common.Order;
+import [package_path]entity.[entity_name];
+
+import java.util.List;
+
+/**
+ * Service - [chinese_name]
+ */
+public interface [entity_name]Service extends BaseService<[entity_name], Long> {
+
+}

+ 33 - 0
app-backend-web/src/main/resources/mvctemplate/serviceImpl.data

@@ -0,0 +1,33 @@
+/*
+ * 
+ *  [entity_name]ServiceImpl
+ * 
+ */
+package [package_path]service.impl;
+
+import [package_path]common.Filter;
+import [package_path]common.Order;
+import [package_path]dao.[entity_name]Dao;
+import [package_path]entity.[entity_name];
+import [package_path]service.[entity_name]Service;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Service - [chinese_name]
+ */
+@Service("[entity_name_small]ServiceImpl")
+public class [entity_name]ServiceImpl extends BaseServiceImpl<[entity_name], Long> implements [entity_name]Service {
+
+    @Resource(name = "[entity_name_small]DaoImpl")
+    private [entity_name]Dao [entity_name_small]Dao;
+
+    @Resource(name = "[entity_name_small]DaoImpl")
+    public void setBaseDao([entity_name]Dao [entity_name_small]Dao) {
+        super.setBaseDao([entity_name_small]Dao);
+    }
+
+
+}

+ 54 - 0
app-backend-web/src/main/resources/mvctemplate/webappAdd.data

@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>添加[webapp_entity_chinese]</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+    [@flash_message /]
+	var $inputForm = $("#inputForm");
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			xxx: "required"
+		}
+	});
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 添加[webapp_entity_chinese]
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		<table class="input">
+			<tr>
+				<th>
+					<span class="requiredField">*</span>xxx:
+				</th>
+				<td>
+					<input type="text" name="xxx" class="text" maxlength="200" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 55 - 0
app-backend-web/src/main/resources/mvctemplate/webappEdit.data

@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>编辑[webapp_entity_chinese]</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+    [@flash_message /]
+	var $inputForm = $("#inputForm");
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			xxx: "required"
+		}
+	});
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 编辑[webapp_entity_chinese]
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${[entity_name].id}" />
+		<table class="input">
+			<tr>
+				<th>
+					<span class="requiredField">*</span>xxx:
+				</th>
+				<td>
+					<input type="text" name="xxx" class="text" value="${[entity_name].xxx}" maxlength="200" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 117 - 0
app-backend-web/src/main/resources/mvctemplate/webappList.data

@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>[webapp_entity_chinese]列表</title>
+
+
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	[@flash_message /]
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; [webapp_entity_chinese]列表 <span>(总共${page.total}行)</span>
+	</div>
+	<form id="listForm" action="list.htm" method="get">
+		<div class="bar">
+			<a href="add.htm" class="iconButton" id="addButton">
+				<i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+			</a>
+			<div class="buttonWrap">
+				<a href="javascript:" id="deleteButton" class="iconButton disabled">
+					<i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+				</a>
+				<a href="javascript:" id="refreshButton" class="iconButton">
+					<i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+				</a>
+				<div class="menuWrap">
+					<a href="javascript:" id="pageSizeSelect" class="button">
+						每页行数<span class="arrow">&nbsp;</span>
+					</a>
+					<div class="popupMenu">
+						<ul id="pageSizeOption">
+							<li>
+								<a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+			</div>
+			<div class="menuWrap">
+				<div class="search">
+					<span id="searchPropertySelect" class="arrow"><i class="iconfont icon-xiala"></i></span>
+                    <input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
+                    <button type="submit"><i class="iconfont icon-sousuo"></i></button>
+				</div>
+				<div class="popupMenu">
+					<ul id="searchPropertyOption">
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "xxx1"] class="current"[/#if] val="xxx1">xxx1</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "xxx2"] class="current"[/#if] val="xxx2">xxx2</a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+		<table id="listTable" class="list">
+			<tr>
+				<th class="check">
+					<input type="checkbox" id="selectAll" />
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="xxx">xxx</a>
+				</th>
+				<th>
+                    <a href="javascript:" class="sort" name="createDate">创建时间</a>
+                </th>
+				<th>
+                    <span>操作</span>
+                </th>
+			</tr>
+			[#list page.content as [webapp_entity]]
+				<tr>
+					<td>
+						<input type="checkbox" name="ids" value="${[webapp_entity].id}" />
+					</td>
+					<td>
+						${[webapp_entity].xxx}
+					</td>
+					<td>
+                        ${[webapp_entity].createDate?string("yyyy-MM-dd HH:mm:ss")}
+                    </td>
+					<td>
+						<a href="edit.htm?id=${[webapp_entity].id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+					</td>
+				</tr>
+			[/#list]
+		</table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination[webapp_suffix]"]
+		[/@pagination]
+	</form>
+</body>
+</html>

binární
app-backend-web/src/main/resources/print/print_account.xls


binární
app-backend-web/src/main/resources/print/print_alarmRecord1.xls


binární
app-backend-web/src/main/resources/print/print_unionRecord.xls


binární
app-backend-web/src/main/resources/print/print_union_record.xls


+ 23 - 0
app-backend-web/src/main/webapp/404.html

@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>找不到页面</title>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
+    <style>
+        body div {
+            text-align: center;
+            font-size: 16px;
+            padding: 20px;
+        }
+    </style>
+</head>
+
+<body>
+<div>404</div>
+</body>
+
+</html>

+ 3 - 0
app-backend-web/src/main/webapp/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+

+ 11 - 0
app-backend-web/src/main/webapp/WEB-INF/language/admin/message_zh_CN.properties

@@ -0,0 +1,11 @@
+admin.login.unknownAccount=\u6B64\u8D26\u53F7\u4E0D\u5B58\u5728
+admin.login.disabledAccount=\u6B64\u8D26\u53F7\u5DF2\u88AB\u7981\u7528
+admin.login.lockedAccount=\u6B64\u8D26\u53F7\u5DF2\u88AB\u9501\u5B9A
+admin.login.accountLockCount=\u5BC6\u7801\u9519\u8BEF\uFF0C\u82E5\u8FDE\u7EED5\u6B21\u5BC6\u7801\u9519\u8BEF\u8D26\u53F7\u5C06\u88AB\u9501\u5B9A
+admin.login.incorrectCredentials=\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF
+admin.login.authentication=\u8D26\u53F7\u8BA4\u8BC1\u5931\u8D25
+admin.login.accessDenied=\u767B\u5F55\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55
+
+admin.message.success=\u64CD\u4F5C\u6210\u529F
+admin.message.error=\u64CD\u4F5C\u9519\u8BEF
+

+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/language/admin/message_zh_TW.properties


+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/language/asl/message_en_US.properties


+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/language/asl/message_zh_CN.properties


+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/language/common/message_zh_CN.properties


+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/language/common/message_zh_TW.properties


+ 299 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/add.ftl

@@ -0,0 +1,299 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>添加广告管理</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            var $inputForm = $("#inputForm");
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    xxx: "required"
+                }
+            });
+        });
+    </script>
+[#--   <script type="text/javascript">//--获取视频缩略图--
+
+   function vload(obj) {
+
+       $(obj).removeAttr("poster");
+
+       var vimg = $("<img/>")[0];
+
+       captureImage(obj, vimg);
+
+       $(obj).after(vimg);
+
+       $(obj).remove();
+
+   };
+
+   var scale = 0.8; //缩放
+
+   function captureImage(video, output) { //截图
+
+       try {
+
+           var videocanvas = $("<canvas/>")[0];
+
+           videocanvas.width = video.videoWidth * scale;
+
+           videocanvas.height = video.videoHeight * scale;
+           videocanvas.getContext('2d').drawImage(video, 0, 0, 20,20);
+
+           output.src = videocanvas.toDataURL("image/png");
+
+           delete videocanvas;
+
+       } catch(e) {
+
+           output.src = "加载动画.gif";
+
+       }
+
+
+
+   };
+
+   //--获取视频缩略图--
+
+   </script>--]
+
+
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 添加广告管理
+</div>
+<form id="addForm" action="save.htm" method="post">
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告名称:
+            </th>
+            <td>
+                <input type="text" name="name" class="text" maxlength="200" required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告顺序:
+            </th>
+            <td>
+                <input type="number" name="order" class="text" maxlength="200" required/>
+            </td>
+        </tr>
+
+        <tr>
+            <th>
+                <span class="requiredField">*</span>位置类型:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" value="propaganda" name="locationType" checked required/>棉花糖宣传广告
+                </label>
+                <label>
+                    <input type="radio" value="external" name="locationType" required/>外接广告
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告位置:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" value="0" name="screenType" checked required/>A屏
+                </label>
+                <label>
+                    <input type="radio" value="1" name="screenType" required/>B屏
+                </label>
+            </td>
+        </tr>
+
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告类型:
+            </th>
+            <td>
+                <label>
+                    <input id="videoType" type="radio" name="adType" value="video" onclick="video()" checked/>视频
+                </label>
+                <label>
+                    <input id="imageType" type="radio" name="adType" value="image" onclick="image()"/>图片
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告时长:
+            </th>
+            <td>
+                <label>
+                    <input id="duration" type="number" name="duration" class="text" required/>
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>视屏缩略图
+            </th>
+            <td>
+                <label id="mediaPreview">
+                    <input id="mediaPreviewUrl" type="text" name="mediaPreview" class="text" maxlength="200"/>
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn" id="test4"><i class="layui-icon"></i>上传视频缩略图</button>
+                    &nbsp;
+                    &nbsp;
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告视频:
+            </th>
+            <td>
+                <label id="video">
+                    <input id="videoUrl" type="text" name="url" class="text" maxlength="200"/>
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn" id="test5"><i class="layui-icon"></i>上传视频</button>
+                    &nbsp;
+                    &nbsp;
+                    <span class="red">视频大小建议尺寸:50M内</span>
+                </label>
+            </td>
+        </tr>
+
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告图片:
+            </th>
+            <td>
+                <label id="image">
+                    <input id="imageUrl" type="text" name="url" class="text" maxlength="200" disabled/>
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn layui-btn-danger" id="test7" disabled><i
+                            class="layui-icon"></i>上传图片
+                    </button>
+                    &nbsp;
+                    &nbsp;
+                    <span class="red">图片大小建议尺寸:960*1080</span>
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+<div class="layui-footer" style="margin-top: 20px;margin-left: 20px">
+    <span class="red">注意:</span>
+    <br/>
+    <h3><span class="red">上传链接禁止有中文</span></h3>
+</div>
+
+[#--
+    <video src="http://localhost:8080/upload/video/09dc535b-0483-4507-8ac2-38c6af91c948.mp4" preload="metadata" onloadeddata='vload(this)' poster="加载动画.gif">
+
+    </video>--]
+
+<script>
+    function video() {
+        var videoChildren = $("#video").children();
+        for (var i = 0; i < videoChildren.length; i++) {
+            $(videoChildren[i]).removeAttr("disabled");
+        }
+        var media = $("#mediaPreview").children();
+        for (var i = 0; i < media.length; i++) {
+            $(media[i]).removeAttr("disabled");
+        }
+        var imageChildren = $("#image").children();
+        for (var i = 0; i < imageChildren.length; i++) {
+            $(imageChildren[i]).attr("disabled", "disabled");
+        }
+        $("#imageUrl").val("");
+    }
+
+    function image() {
+        var imageChildren = $("#image").children();
+        for (var i = 0; i < imageChildren.length; i++) {
+            $(imageChildren[i]).removeAttr("disabled");
+        }
+
+        var videoChildren = $("#video").children();
+        for (var i = 0; i < videoChildren.length; i++) {
+            $(videoChildren[i]).attr("disabled", "disabled");
+            $(videoChildren[i]).val("");
+        }
+        var media = $("#mediaPreview").children();
+        for (var i = 0; i < media.length; i++) {
+            $(media[i]).attr("disabled", "disabled");
+            $(media[i]).val("");
+        }
+        $("#videoUrl").val("");
+        $("#mediaPreviewUrl").val("");
+    }
+
+</script>
+
+
+<script>
+    layui.use('upload', function () {
+
+        var upload = layui.upload;
+        upload.render({
+            elem: '#test5'
+            , url: '../ad/upload.htm'
+            , accept: 'video' //视频
+            , done: function (res) {
+                $("#videoUrl").val(res.url);
+            }
+        });
+        upload.render({
+            elem: '#test7'
+            , url: '../ad/uploadImage.htm'
+            , accept: 'image' //图片
+            ,
+            done: function (res) {
+                $("#imageUrl").val(res.url);
+            }
+        });
+        upload.render({
+            elem: '#test4'
+            , url: '../ad/uploadmediaPreview.htm'
+            , accept: 'image' //视频缩略图
+            , done: function (res) {
+                $("#mediaPreviewUrl").val(res.url);
+            }
+        });
+
+    });
+</script>
+
+
+</body>
+</html>

+ 262 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/edit.ftl

@@ -0,0 +1,262 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>编辑广告管理</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            var $inputForm = $("#inputForm");
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    xxx: "required"
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 编辑广告管理
+</div>
+<form id="addForm" action="update.htm" method="post">
+    <input type="hidden" name="id" value="${aD.id}"/>
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告名称:
+            </th>
+            <td>
+                <input type="text" name="name" value="${aD.name}" class="text" maxlength="200" required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告顺序:
+            </th>
+            <td>
+                <input type="number" name="order" value="${aD.order}" class="text" maxlength="200" required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>位置类型:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" value="propaganda" name="locationType"
+                           [#if aD.locationType=="propaganda"]checked[/#if] required/>棉花糖宣传广告
+                </label>
+                <label>
+                    <input type="radio" value="external" name="locationType"
+                           [#if aD.locationType=="external"]checked[/#if] required/>外接广告
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告位置:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" value="0" name="screenType"  [#if aD.screenType=="0"]checked[/#if] required/>A屏
+                </label>
+                <label>
+                    <input type="radio" value="1" name="screenType" [#if aD.screenType=="1"]checked[/#if] required/>B屏
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告类型:
+            </th>
+            <td>
+                <label>
+                     [#if aD.adType=="video"]
+                         <input id="videoType" type="radio" name="adType" value="video"
+                                checked/>视频
+                     [#else]
+                      <input id="imageType" type="radio" name="adType" value="image" checked/>图片
+                     [/#if]
+
+
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告时长:
+            </th>
+            <td>
+                <label>
+                    <input id="duration" name="duration" type="number" class="text" value="${aD.duration}" required/>
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>视屏缩略图
+            </th>
+            <td>
+                <label id="mediaPreview">
+                    <input id="mediaPreviewUrl" type="text" name="mediaPreview" class="text" maxlength="200"
+                           value="${aD.mediaPreview}"
+                    />
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn" id="test4"><i class="layui-icon"></i>上传视频缩略图</button>
+                    &nbsp;
+                    &nbsp;
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告视频:
+            </th>
+            <td>
+                <label id="video">
+                    <input id="videoUrl" type="text" name="url" class="text" maxlength="200" [#if aD.adType=="video"]
+                           value="${aD.url}" readonly
+                    [#else ]
+                           disabled
+                    [/#if]
+                    />
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn" id="test5" disabled style="background-color: gray"><i
+                            class="layui-icon"></i>上传视频
+                    </button>
+                    &nbsp;
+                    &nbsp;
+                    <span class="red">视频大小建议尺寸:50M内</span>
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>广告图片:
+            </th>
+            <td>
+                <label id="image">
+                    <input id="imageUrl" type="text" name="url" class="text" maxlength="200" [#if aD.adType=="image"]
+                           value="${aD.url}" readonly
+                    [#else]
+                           disabled
+                    [/#if]
+
+                    />
+                    &nbsp;
+                    &nbsp;
+                    &nbsp;
+                    <button type="button" class="layui-btn layui-btn-danger" id="test7" style="background-color: gray"
+                            disabled><i class="layui-icon"></i>上传图片
+                    </button>
+                    &nbsp;
+                    &nbsp;
+                    <span class="red">图片大小建议尺寸:960*1080</span>
+                </label>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+<div class="layui-footer" style="margin-top: 20px;margin-left: 20px">
+    <span class="red">注意:</span>
+    <br/>
+    <h3><span class="red">上传链接禁止有中文</span></h3>
+</div>
+<script>
+    /* function video() {
+         var videoChildren = $("#video").children();
+         for (var i = 0; i < videoChildren.length; i++) {
+             $(videoChildren[i]).removeAttr("disabled");
+         }
+         var media = $("#mediaPreview").children();
+         for (var i = 0; i < media.length; i++) {
+             $(media[i]).removeAttr("disabled");
+         }
+         var imageChildren = $("#image").children();
+         for (var i = 0; i < imageChildren.length; i++) {
+             $(imageChildren[i]).attr("disabled", "disabled");
+         }
+         $("#imageUrl").val("");
+     }
+
+     function image() {
+         var imageChildren = $("#image").children();
+         for (var i = 0; i < imageChildren.length; i++) {
+             $(imageChildren[i]).removeAttr("disabled");
+         }
+
+         var videoChildren = $("#video").children();
+         for (var i = 0; i < videoChildren.length; i++) {
+             $(videoChildren[i]).attr("disabled", "disabled");
+             $(videoChildren[i]).val("");
+         }
+         var media = $("#mediaPreview").children();
+         for (var i = 0; i < media.length; i++) {
+             $(media[i]).attr("disabled", "disabled");
+             $(media[i]).val("");
+         }
+         $("#videoUrl").val("");
+         $("#mediaPreviewUrl").val("");
+    }*/
+
+</script>
+
+<script>
+    layui.use('upload', function () {
+
+        var upload = layui.upload;
+        upload.render({
+            elem: '#test5'
+            , url: '../ad/upload.htm'
+            , accept: 'video' //视频
+            , done: function (res) {
+                $("#videoUrl").val(res.url);
+            }
+        });
+        upload.render({
+            elem: '#test7'
+            , url: '../ad/uploadImage.htm'
+            , accept: 'image' //视频
+            , done: function (res) {
+                $("#imageUrl").val(res.url);
+            }
+        });
+        upload.render({
+            elem: '#test4'
+            , url: '../ad/uploadmediaPreview.htm'
+            , accept: 'image' //视频缩略图
+            , done: function (res) {
+                $("#mediaPreviewUrl").val(res.url);
+            }
+        });
+
+    });
+</script>
+
+</body>
+</html>

+ 176 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/list.ftl

@@ -0,0 +1,176 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>广告管理列表</title>
+
+
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/list.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+
+	[@flash_message /]
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 广告管理列表 <span>(总共${page.total}行)</span>
+</div>
+<form id="listForm" action="list.htm" method="get">
+    <div class="bar">
+
+        <div class="buttonWrap">
+                 [#if type=="admin"]
+
+                <a href="add.htm" class="iconButton" id="addButton">
+                    <i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+                </a>
+                <a href="javascript:" id="deleteButton" class="iconButton disabled">
+                    <i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+                </a>
+                 [/#if]
+            <a href="javascript:" id="refreshButton" class="iconButton">
+                <i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+            </a>
+            <a href="push.htm" id="refreshButton" class="iconButton">
+                <i class="iconfont icon-guanggao">&nbsp;</i>推送广告
+            </a>
+            <div class="menuWrap">
+                <a href="javascript:" id="pageSizeSelect" class="button">
+                    每页行数<span class="arrow">&nbsp;</span>
+                </a>
+                <div class="popupMenu">
+                    <ul id="pageSizeOption">
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+                        </li>
+                    </ul>
+                </div>
+            </div>
+            &nbsp;
+            &nbsp;
+            &nbsp;
+            <span class="red">每次新增/修改广告,需要点击【推送广告】按钮</span>
+        </div>
+    </div>
+    <table id="listTable" class="list">
+        <tr>
+            <th class="check">
+                <input type="checkbox" id="selectAll"/>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="name">广告名称</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="url">广告图片</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="locationType">位置类型</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="screenType">广告位置</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="adType">广告类型</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="createDate">创建时间</a>
+            </th>
+            <th>
+                <span>操作</span>
+            </th>
+        </tr>
+			[#list page.content as ad]
+				<tr>
+                    <td>
+                        <input type="checkbox" name="ids" value="${ad.id}"/>
+                    </td>
+                    <td>
+                        ${ad.name}
+                    </td>
+                    <td>
+
+						[#if ad.adType.toValue()=='视频']
+                        [#--<div style="display: none">
+                            <video id="video${ad.id}" controls="controls">
+                                <source src="${ad.url}">
+                            </video>
+                        </div>
+                        <img id="videoImage" class="preImage" alt=""/>--]
+                            <img src="${ad.mediaPreview}" alt="视频缩略图" class="preImage"/>
+                        [#else]
+						<img src="${ad.url}" alt="广告图片地址" class="preImage"/>
+                        [/#if]
+
+                    </td>
+                    <td>
+                        ${(ad.locationType.toValue())!""}
+                    </td>
+                    <td>
+                        [#if ad.screenType=="0" ]
+                            A屏
+                        [#else ]
+                            B屏
+                        [/#if]
+                    </td>
+                    <td>
+                        ${(ad.adType.toValue())!""}
+                    </td>
+                    <td>
+                        ${ad.createDate?string("yyyy-MM-dd HH:mm:ss")}
+                    </td>
+                    <td>
+                        <a href="edit.htm?id=${ad.id}"><i class="iconfont icon-bianji edit-icon"></i></a>
+                    </td>
+                </tr>
+            [/#list]
+    </table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+            [#include "/admin/include/pagination.ftl"]
+        [/@pagination]
+</form>
+
+<script>
+
+    /* (function () {
+         var video;
+         var scale = 0.8;
+         var initialize = function () {
+
+             video = document.getElementById("video");
+
+             video.addEventListener('loadeddata', captureImage);
+         };
+
+         var captureImage = function () {
+             var canvas = document.createElement("canvas");
+             canvas.width = video.videoWidth * scale;
+             canvas.height = video.videoHeight * scale;
+             canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
+
+             $("#videoImage").attr("src", canvas.toDataURL("image/png"));
+         };
+         initialize();
+     })();
+ */
+</script>
+</body>
+</html>

+ 153 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/add.ftl

@@ -0,0 +1,153 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>${message("admin.admin.add")}</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	[@flash_message /]
+	
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			username: {
+				required: true,
+				pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+				minlength: 2,
+				maxlength: 20,
+				remote: {
+					url: "check_username.action",
+					cache: false
+				}
+			},
+			password: {
+				required: true,
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				required: true,
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+			roleIds: "required"
+		},
+		messages: {
+			username: {
+				pattern: "格式不正确",
+				remote: "账号已存在"
+			},
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 管理员添加
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		<ul id="tab" class="tab">
+			<li>
+				<input type="button" value="基本信息" />
+			</li>
+		</ul>
+		<table class="input tabContent">
+			<tr>
+				<th>
+					<span class="requiredField">*</span>账号:
+				</th>
+				<td>
+					<input type="text" name="username" class="text" maxlength="20" /> 注:账号一旦生成将无法修改账号名
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    姓名:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" maxlength="200" />
+				</td>
+			</tr>
+			<tr class="roles">
+				<th>
+					<span class="requiredField">*</span>角色:
+				</th>
+				<td>
+					<span class="fieldSet">
+						[#list roles as role]
+							<label>
+								<input type="checkbox" name="roleIds" value="${role.id}" />${role.name}
+							</label>
+						[/#list]
+					</span>
+				</td>
+			</tr>
+			<tr>
+				<th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true" checked="checked" />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+				</td>
+			</tr>
+		</table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 145 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/edit.ftl

@@ -0,0 +1,145 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>${message("admin.admin.edit")}</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	
+	[@flash_message /]
+	
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			password: {
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+			roleIds: "required",
+		},
+		messages: {
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 管理员编辑
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${admin.id}" />
+		<ul id="tab" class="tab">
+			<li>
+				<input type="button" value="基本信息" />
+			</li>
+		</ul>
+		<table class="input tabContent">
+			<tr>
+				<th>
+                    账号:
+				</th>
+				<td>
+					${admin.username}
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    姓名:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" value="${admin.name}" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" value="${admin.email}" maxlength="200" />
+				</td>
+			</tr>
+			<tr class="roles">
+				<th>
+					<span class="requiredField">*</span>角色:
+				</th>
+				<td>
+					<span class="fieldSet">
+						[#list roles as role]
+							<label>
+								<input type="checkbox" name="roleIds" value="${role.id}"[#if admin.roles?seq_contains(role)] checked="checked"[/#if] />${role.name}
+							</label>
+						[/#list]
+					</span>
+				</td>
+			</tr>
+			<tr>
+				<th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true"[#if admin.isEnabled] checked="checked"[/#if] />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+					[#if admin.isLocked]
+						<label>
+							<input type="checkbox" name="isLocked" value="true" checked="checked" />${message("Admin.isLocked")}
+							<input type="hidden" name="_isLocked" value="false" />
+						</label>
+					[/#if]
+				</td>
+			</tr>
+		</table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 171 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/admin/list.ftl

@@ -0,0 +1,171 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>列表</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	[@flash_message /]
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 管理员管理 <span>(总共${page.total}行)</span>
+	</div>
+	<form id="listForm" action="list.htm" method="get">
+		<div class="bar">
+			<a href="add.htm" class="iconButton" id="addButton">
+				<i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+			</a>
+			<div class="buttonWrap">
+				<a href="javascript:" id="deleteButton" class="iconButton disabled">
+					<i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+				</a>
+				<a href="javascript:" id="refreshButton" class="iconButton">
+					<i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+				</a>
+				<div class="menuWrap">
+					<a href="javascript:" id="pageSizeSelect" class="button">
+                        <i class="iconfont icon-yidongyunkongzhitaiicon41">&nbsp;</i>每页行数<span class="arrow">&nbsp;</span>
+					</a>
+					<div class="popupMenu">
+						<ul id="pageSizeOption">
+							<li>
+								<a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+			</div>
+			<div class="menuWrap">
+				<div class="search">
+					<span id="searchPropertySelect" class="arrow"><i class="iconfont icon-xiala"></i></span>
+					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
+					<button type="submit"><i class="iconfont icon-sousuo"></i></button>
+				</div>
+				<div class="popupMenu">
+					<ul id="searchPropertyOption">
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "username"] class="current"[/#if] val="username">账号</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "email"] class="current"[/#if] val="email">邮箱</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "name"] class="current"[/#if] val="name">姓名</a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+		<table id="listTable" class="list">
+			<tr>
+				<th class="check">
+					<input type="checkbox" id="selectAll" />
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="username">账号</a>
+				</th>
+                <th>
+                    <a href="javascript:" >角色</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort" name="name">名字</a>
+                </th>
+                <th>
+					<a href="javascript:" class="sort" name="email">邮箱</a>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="loginDate">登陆时间</a>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="loginIp">登陆IP地址</a>
+				</th>
+				<th>
+					<span>状态</span>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="createDate">创建时间</a>
+				</th>
+				<th>
+					<span>操作</span>
+				</th>
+			</tr>
+			[#list page.content as admin]
+				<tr>
+					<td>
+						<input type="checkbox" name="ids" value="${admin.id}" />
+					</td>
+					<td>
+						${admin.username}
+					</td>
+                    <td>
+						[#list admin.roles as role]
+
+							[#if role_index+1 == admin.roles?size]
+								${role.name}
+							[#else]
+								${role.name} /
+							[/#if]
+						[/#list]
+                    </td>
+                    <td>
+						${admin.name}
+                    </td>
+                    <td>
+						${admin.email}
+					</td>
+					<td>
+						[#if admin.loginDate??]
+							<span>${admin.loginDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+						[#else]
+							-
+						[/#if]
+					</td>
+					<td>
+						${(admin.loginIp)!"-"}
+					</td>
+					<td>
+						[#if !admin.isEnabled]
+							<span class="red">无效</span>
+						[#elseif admin.isLocked]
+							<span class="red">锁定</span>
+						[#else]
+							<span class="green">正常</span>
+						[/#if]
+					</td>
+					<td>
+						<span>${admin.createDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+					</td>
+					<td>
+						<a href="edit.htm?id=${admin.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+					</td>
+				</tr>
+			[/#list]
+		</table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination.ftl"]
+		[/@pagination]
+	</form>
+</body>
+</html>

+ 156 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/add.ftl

@@ -0,0 +1,156 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>代理商添加</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			username: {
+				required: true,
+				pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+				minlength: 2,
+				maxlength: 20,
+				remote: {
+					url: "check_username.action",
+					cache: false
+				}
+			},
+			password: {
+				required: true,
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				required: true,
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+            areaId:{
+                required: true
+			}
+		},
+		messages: {
+			username: {
+				pattern: "格式不正确",
+				remote: "账号已存在"
+			},
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 省级添加
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		<table class="input tabContent">
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>账号:
+				</th>
+				<td>
+					<input type="text" name="username" class="text" maxlength="20" /> 注:账号一旦生成将无法修改账号名
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    名称:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" maxlength="200" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true" checked="checked" />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+				</td>
+			</tr>
+		</table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 158 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/addMerchant.ftl

@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>市级添加</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+
+            var $inputForm = $("#inputForm");
+	[@flash_message /]
+            var $areaId = $("#areaId");
+            $areaId.lSelect({
+                url: "/asl-admin/common/area.htm"
+            });
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    username: {
+                        required: true,
+                        pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+                        minlength: 2,
+                        maxlength: 20,
+                        remote: {
+                            url: "check_username.action",
+                            cache: false
+                        }
+                    },
+                    password: {
+                        required: true,
+                        pattern: /^[^\s&\"<>]+$/,
+                        minlength: 4,
+                        maxlength: 20
+                    },
+                    rePassword: {
+                        required: true,
+                        equalTo: "#password"
+                    },
+                    email: {
+                        email: true
+                    },
+                    areaId: {
+                        required: true
+                    }
+                },
+                messages: {
+                    username: {
+                        pattern: "格式不正确",
+                        remote: "账号已存在"
+                    },
+                    password: {
+                        pattern: "格式不正确"
+                    }
+                }
+            });
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 市级添加
+</div>
+<form id="inputForm" action="saveMerchat.htm" method="post">
+    <table class="input tabContent">
+        <input type="hidden" name="agencyId" value="${agencyId}">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>地区:
+            </th>
+            <td>
+                <input type="hidden" id="areaId" name="areaId"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>账号:
+            </th>
+            <td>
+                <input type="text" name="username" class="text" maxlength="20"/> 注:账号一旦生成将无法修改账号名
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>密码:
+            </th>
+            <td>
+                <input type="password" id="password" name="password" class="text" maxlength="20"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>确认密码:
+            </th>
+            <td>
+                <input type="password" name="rePassword" class="text" maxlength="20"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                名称:
+            </th>
+            <td>
+                <input type="text" name="name" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                邮箱:
+            </th>
+            <td>
+                <input type="text" name="email" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                电话:
+            </th>
+            <td>
+                <input type="text" name="phone" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                设置:
+            </th>
+            <td>
+                <label>
+                    <input type="checkbox" name="isEnabled" value="true" checked="checked"/>是否启动
+                    <input type="hidden" name="_isEnabled" value="false"/>
+                </label>
+            </td>
+        </tr>
+    </table>
+    <table class="input">
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+</html>

+ 367 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/edit.ftl

@@ -0,0 +1,367 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>代理商编辑</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			password: {
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+			roleIds: "required"
+		},
+		messages: {
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 省级编辑
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${admin.id}" />
+        <ul id="tab" class="tab">
+            <li>
+                <input type="button" value="基本信息" />
+            </li>
+            <li>
+                <input type="button" value="提现账户" />
+            </li>
+            <li>
+                <input type="button" value="市级"/>
+            </li>
+            <li>
+                <input type="button" value="终端"/>
+            </li>
+        </ul>
+		<table class="input tabContent">
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" value="${(admin.areaId)!}"
+                           treePath="${(_Area(admin.areaId).treePath)!}"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    账号:
+                </th>
+                <td>
+                ${admin.username}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    开通管理员:
+                </th>
+                <td>
+                ${(_Admin(admin.parentId).username)!"-"}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    密码:
+                </th>
+                <td>
+                    <input type="password" id="password" name="password" class="text" maxlength="20"/> 留空表示不修改
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    确认密码:
+                </th>
+                <td>
+                    <input type="password" name="rePassword" class="text" maxlength="20"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    姓名:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" value="${admin.name}" maxlength="200"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    邮箱:
+                </th>
+                <td>
+                    <input type="text" name="email" class="text" value="${admin.email}" maxlength="200"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200" value="${admin.phone}"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    设置:
+                </th>
+                <td>
+                    <label>
+                        <input type="checkbox" name="isEnabled" value="true"[#if admin.isEnabled]
+                               checked="checked"[/#if] />是否启动
+                        <input type="hidden" name="_isEnabled" value="false"/>
+                    </label>
+					[#if admin.isLocked]
+						<label>
+                            <input type="checkbox" name="isLocked" value="true"
+                                   checked="checked"/>${message("Admin.isLocked")}
+                            <input type="hidden" name="_isLocked" value="false"/>
+                        </label>
+                    [/#if]
+                </td>
+            </tr>
+        </table>
+        <table class="input tabContent">
+            <tr>
+                <th>
+                    操作:
+                </th>
+                <td>
+                    <a href="javascript:location.reload()" class="layui-btn layui-btn-primary layui-btn-sm">刷新</a>
+                </td>
+            </tr>
+            [#if mch.order_status!=null]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>资金账户:
+                </th>
+                <td id="balance">
+                    <span>主账户余额:<b>${mch.alt_main_balance}</b></span>
+                    <span>担保余额:<b>${mch.alt_guar_balance}</b></span>
+                    <span>可取金额:<b>${mch.alt_avil_balance}</b></span>
+                </td>
+            </tr>
+            [/#if]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户状态:
+                </th>
+                <td id="orderStatus">
+                ${(orderStatus.get(mch.order_status))!"-"}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户类型:
+                </th>
+                <td>
+                     [#if mch.alt_merchant_type == '10'] 个人[/#if]
+                     [#if mch.alt_merchant_type == '11'] 个体工商户[/#if]
+                     [#if mch.alt_merchant_type == '12'] 企业[/#if]
+                </td
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人名称:
+                </th>
+                <td>
+                ${mch.busi_contact_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人手机:
+                </th>
+                <td>
+                ${mch.busi_contact_mobile_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人手机号:
+                </th>
+                <td>
+                ${mch.phone_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人姓名:
+                </th>
+                <td>
+                ${mch.legal_person}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人身份证号:
+                </th>
+                <td>
+                ${mch.id_card_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    身份证有效期:
+                </th>
+                <td>
+                ${mch.id_card_expiry}
+                </td>
+            </tr>
+            [#if mch.alt_merchant_type != '10']
+            <tr class="license">
+                <th>
+                    <span class="requiredField">*</span>营业执照编码:
+                </th>
+                <td>
+                    ${mch.license_no}
+                </td>
+            </tr>
+            <tr class="license">
+                <th>
+                    营业执照有效期:
+                </th>
+                <td>
+                    ${mch.license_expiry}
+                </td>
+            </tr>
+            [/#if]
+            <tr>
+                <th>
+                    经营范围:
+                </th>
+                <td>
+                ${mch.manage_scope}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    经营地址:
+                </th>
+                <td>
+                ${mch.manage_addr}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>账户类型:
+                </th>
+                <td id="bank_account_type">
+                    [#if mch.alt_merchant_type=='10'||mch.alt_merchant_type==null]
+                        借记卡
+                    [#else]
+						对公账户
+                    [/#if]
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账户名称:
+                </th>
+                <td>
+                ${mch.bank_account_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账号:
+                </th>
+                <td>
+                ${mch.bank_account_no}
+                </td>
+            </tr>
+            <tr id="bank_channel_no">
+                <th>
+                    <span class="requiredField" style="display: none">*</span>联行号:
+                </th>
+                <td>
+                ${mch.bank_channel_no}
+                </td>
+            </tr>
+        </table>
+        <div class="input tabContent">
+            <table class="layui-table">
+                <tr>
+                    <th>账号</th>
+                    <th>名称</th>
+                    <th>地区</th>
+                    <th>设备</th>
+                </tr>
+
+            [#list merchantAdmins as merchantAdmin]
+                <tr>
+                    <td>${merchantAdmin.username}</td>
+                    <td>${merchantAdmin.name}</td>
+                    <td>${_Area(merchantAdmin.areaId).fullName}</td>
+                    <td>${_countMethod(merchantAdmin.id)}</td>
+                </tr>
+            [/#list]
+            </table>
+        </div>
+        <div class="input tabContent">
+            <table class="layui-table">
+                <tr>
+                    <th>账号</th>
+                    <th>名称</th>
+                    <th>地区</th>
+                    <th>设备</th>
+                </tr>
+            [#list personageAdmins as personageAdmin]
+                <tr>
+                    <td>${personageAdmin.username}</td>
+                    <td>${personageAdmin.name}</td>
+                    <td>${_Area(merchantAdmin.areaId).fullName}</td>
+                    <td>${_countMethod(personageAdmin.id)}</td>
+                </tr>
+            [/#list]
+            </table>
+        </div>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+                    <input type="submit" class="button" value="提交"/>
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 192 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminAgency/list.ftl

@@ -0,0 +1,192 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>列表</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	[@flash_message /]
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 省级管理 <span>(总共${page.total}行) <a class="login-url"> 省级登陆链接:http://app.sunzee.com.cn/asl-admin/login.jsp?type=agency</a>(复制给省级登陆)</span>
+	</div>
+	<form id="listForm" action="list.htm" method="get">
+		<div class="bar">
+			<a href="add.htm" class="iconButton" id="addButton">
+				<i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+			</a>
+			<div class="buttonWrap">
+			[#--<a href="javascript:" id="deleteButton" class="iconButton disabled">
+                <i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+            </a>--]
+				<a href="javascript:" id="refreshButton" class="iconButton">
+					<i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+				</a>
+				<div class="menuWrap">
+					<a href="javascript:" id="pageSizeSelect" class="button">
+                        <i class="iconfont icon-yidongyunkongzhitaiicon41">&nbsp;</i>每页行数<span class="arrow">&nbsp;</span>
+					</a>
+					<div class="popupMenu">
+						<ul id="pageSizeOption">
+							<li>
+								<a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+			</div>
+			<div class="menuWrap">
+				<div class="search">
+					<span id="searchPropertySelect" class="arrow"><i class="iconfont icon-xiala"></i></span>
+					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
+					<button type="submit"><i class="iconfont icon-sousuo"></i></button>
+				</div>
+				<div class="popupMenu">
+					<ul id="searchPropertyOption">
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "username"] class="current"[/#if] val="username">账号</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "email"] class="current"[/#if] val="email">邮箱</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "name"] class="current"[/#if] val="name">姓名</a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+		<table id="listTable" class="list">
+			<tr>
+				<th class="check">
+					<input type="checkbox" id="selectAll" />
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="username">账号</a>
+				</th>
+                <th>
+                    <a href="javascript:">操作</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort" name="name">名字</a>
+                </th>
+                <th>
+					<a href="javascript:" class="sort" name="email">邮箱</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="areaId">地区</a>
+                </th>
+				<th>
+					<a href="javascript:" class="sort" name="loginDate">登陆时间</a>
+				</th>
+				<th>
+                    <a href="javascript:" class="sort" name="phone">电话号码</a>
+                </th>
+                <th>
+					<a href="javascript:" class="sort" name="loginIp">登陆IP地址</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="parentId">所属上级</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort">管理系统ID</a>
+                </th>
+
+                <th>
+					<span>状态</span>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="createDate">创建时间</a>
+				</th>
+				<th>
+					<span>操作</span>
+				</th>
+			</tr>
+			[#list page.content as admin]
+				<tr>
+					<td>
+						<input type="checkbox" name="ids" value="${admin.id}" />
+					</td>
+					<td>
+						${admin.username}
+					</td>
+                    <td>
+						<a class="autoLogin" target="_parent" href="autoLogin.htm?agencyId=${admin.id}">切换登陆</a>
+						[#if currentAdmin.type=="admin"]
+                        <a class="green" href="addMerchant.htm?agencyId=${admin.id}">添加市级</a>
+                        [/#if]
+                    </td>
+                    <td>
+						${admin.name}
+                    </td>
+					<td>
+						${admin.email}
+					</td>
+                    <td>
+						${_Area(admin.areaId).fullName}
+                    </td>
+					<td>
+						[#if admin.loginDate??]
+							<span>${admin.loginDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+						[#else]
+							-
+						[/#if]
+                    </td>
+                    <td>
+                        ${admin.phone}
+					</td>
+					<td>
+						${(admin.loginIp)!"-"}
+					</td>
+                    <td>
+						${(_Admin(admin.parentId).username)!"-"}
+                    </td>
+                    <td>
+                        ${admin.managerId}
+                    </td>
+					<td>
+						[#if !admin.isEnabled]
+							<span class="red">无效</span>
+						[#elseif admin.isLocked]
+							<span class="red">锁定</span>
+						[#else]
+							<span class="green">正常</span>
+						[/#if]
+					</td>
+					<td>
+						<span>${admin.createDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+					</td>
+					<td>
+						<a href="edit.htm?id=${admin.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+					</td>
+				</tr>
+			[/#list]
+		</table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination.ftl"]
+		[/@pagination]
+	</form>
+</body>
+</html>

+ 157 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/add.ftl

@@ -0,0 +1,157 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>市级添加</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			username: {
+				required: true,
+				pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+				minlength: 2,
+				maxlength: 20,
+				remote: {
+					url: "check_username.action",
+					cache: false
+				}
+			},
+			password: {
+				required: true,
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				required: true,
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+            areaId:{
+                required: true
+			}
+		},
+		messages: {
+			username: {
+				pattern: "格式不正确",
+				remote: "账号已存在"
+			},
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 市级添加
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		<table class="input tabContent">
+
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>账号:
+				</th>
+				<td>
+					<input type="text" name="username" class="text" maxlength="20" /> 注:账号一旦生成将无法修改账号名
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    名称:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" maxlength="200" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true" checked="checked" />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+				</td>
+			</tr>
+		</table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 158 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/addPersonage.ftl

@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>终端添加</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+
+            var $inputForm = $("#inputForm");
+	[@flash_message /]
+            var $areaId = $("#areaId");
+            $areaId.lSelect({
+                url: "/asl-admin/common/area.htm"
+            });
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    username: {
+                        required: true,
+                        pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+                        minlength: 2,
+                        maxlength: 20,
+                        remote: {
+                            url: "check_username.action",
+                            cache: false
+                        }
+                    },
+                    password: {
+                        required: true,
+                        pattern: /^[^\s&\"<>]+$/,
+                        minlength: 4,
+                        maxlength: 20
+                    },
+                    rePassword: {
+                        required: true,
+                        equalTo: "#password"
+                    },
+                    email: {
+                        email: true
+                    },
+                    areaId: {
+                        required: true
+                    }
+                },
+                messages: {
+                    username: {
+                        pattern: "格式不正确",
+                        remote: "账号已存在"
+                    },
+                    password: {
+                        pattern: "格式不正确"
+                    }
+                }
+            });
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 终端添加
+</div>
+<form id="inputForm" action="savePersonage.htm" method="post">
+    <table class="input tabContent">
+        <input type="hidden" name="merchantId" value="${merchantId}">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>地区:
+            </th>
+            <td>
+                <input type="hidden" id="areaId" name="areaId"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>账号:
+            </th>
+            <td>
+                <input type="text" name="username" class="text" maxlength="20"/> 注:账号一旦生成将无法修改账号名
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>密码:
+            </th>
+            <td>
+                <input type="password" id="password" name="password" class="text" maxlength="20"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>确认密码:
+            </th>
+            <td>
+                <input type="password" name="rePassword" class="text" maxlength="20"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                名称:
+            </th>
+            <td>
+                <input type="text" name="name" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                邮箱:
+            </th>
+            <td>
+                <input type="text" name="email" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                电话:
+            </th>
+            <td>
+                <input type="text" name="phone" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                设置:
+            </th>
+            <td>
+                <label>
+                    <input type="checkbox" name="isEnabled" value="true" checked="checked"/>是否启动
+                    <input type="hidden" name="_isEnabled" value="false"/>
+                </label>
+            </td>
+        </tr>
+    </table>
+    <table class="input">
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+</html>

+ 344 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/edit.ftl

@@ -0,0 +1,344 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>市级编辑</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			password: {
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+			roleIds: "required"
+		},
+		messages: {
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 市级编辑
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${admin.id}" />
+        <ul id="tab" class="tab">
+            <li>
+                <input type="button" value="基本信息" />
+            </li>
+            <li>
+                <input type="button" value="提现账户" />
+            </li>
+            <li>
+                <input type="button" value="终端"/>
+            </li>
+        </ul>
+		<table class="input tabContent">
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" value="${(admin.areaId)!}" treePath="${(_Area(admin.areaId).treePath)!}"  />
+                </td>
+            </tr>
+			<tr>
+				<th>
+                    账号:
+				</th>
+				<td>
+					${admin.username}
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    开通管理员:
+                </th>
+                <td>
+				${(_Admin(admin.parentId).username)!"-"}
+                </td>
+            </tr>
+			<tr>
+				<th>
+                    密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" /> 留空表示不修改
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    姓名:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" value="${admin.name}" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" value="${admin.email!""}" maxlength="200" autocomplete="off"/>
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200" value="${admin.phone}"/>
+                </td>
+            </tr>
+			<tr>
+				<th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true"[#if admin.isEnabled] checked="checked"[/#if] />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+					[#if admin.isLocked]
+						<label>
+							<input type="checkbox" name="isLocked" value="true" checked="checked" />${message("Admin.isLocked")}
+							<input type="hidden" name="_isLocked" value="false" />
+						</label>
+					[/#if]
+				</td>
+			</tr>
+		</table>
+        <table class="input tabContent">
+            <tr>
+                <th>
+                    操作:
+                </th>
+                <td>
+                    <a href="javascript:location.reload()" class="layui-btn layui-btn-primary layui-btn-sm">刷新</a>
+                </td>
+            </tr>
+            [#if mch.order_status!=null]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>资金账户:
+                </th>
+                <td id="balance">
+                    <span>主账户余额:<b>${mch.alt_main_balance}</b></span>
+                    <span>担保余额:<b>${mch.alt_guar_balance}</b></span>
+                    <span>可取金额:<b>${mch.alt_avil_balance}</b></span>
+                </td>
+            </tr>
+			[/#if]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户状态:
+                </th>
+                <td id="orderStatus">
+				${(orderStatus.get(mch.order_status))!"-"}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户类型:
+                </th>
+                <td>
+                     [#if mch.alt_merchant_type == '10'] 个人[/#if]
+                     [#if mch.alt_merchant_type == '11'] 个体工商户[/#if]
+                     [#if mch.alt_merchant_type == '12'] 企业[/#if]
+                </td
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人名称:
+                </th>
+                <td>
+				${mch.busi_contact_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人手机:
+                </th>
+                <td>
+				${mch.busi_contact_mobile_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人手机号:
+                </th>
+                <td>
+				${mch.phone_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人姓名:
+                </th>
+                <td>
+				${mch.legal_person}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人身份证号:
+                </th>
+                <td>
+				${mch.id_card_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    身份证有效期:
+                </th>
+                <td>
+				${mch.id_card_expiry}
+                </td>
+            </tr>
+             [#if mch.alt_merchant_type != '10']
+            <tr class="license">
+                <th>
+                    <span class="requiredField">*</span>营业执照编码:
+                </th>
+                <td>
+                    ${mch.license_no}
+                </td>
+            </tr>
+            <tr class="license">
+                <th>
+                    营业执照有效期:
+                </th>
+                <td>
+                    ${mch.license_expiry}
+                </td>
+            </tr>
+             [/#if]
+            <tr>
+                <th>
+                    经营范围:
+                </th>
+                <td>
+				${mch.manage_scope}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    经营地址:
+                </th>
+                <td>
+				${mch.manage_addr}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>账户类型:
+                </th>
+                <td id="bank_account_type">
+                    [#if mch.alt_merchant_type=='10'||mch.alt_merchant_type==null]
+                        借记卡
+					[#else]
+						对公账户
+					[/#if]
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账户名称:
+                </th>
+                <td>
+				${mch.bank_account_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账号:
+                </th>
+                <td>
+				${mch.bank_account_no}
+                </td>
+            </tr>
+            <tr id="bank_channel_no">
+                <th>
+                    <span class="requiredField" style="display: none">*</span>联行号:
+                </th>
+                <td>
+				${mch.bank_channel_no}
+                </td>
+            </tr>
+        </table>
+        <div class="input tabContent">
+            <table class="layui-table">
+                <tr>
+                    <th>账号</th>
+                    <th>名称</th>
+                    <th>地区</th>
+                    <th>设备</th>
+                </tr>
+            [#list personageAdmins as personageAdmin]
+                <tr>
+                    <td>${personageAdmin.username}</td>
+                    <td>${personageAdmin.name}</td>
+                    <td>${_Area(merchantAdmin.areaId).fullName}</td>
+                    <td>${_countMethod(personageAdmin.id)}</td>
+                </tr>
+            [/#list]
+            </table>
+        </div>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+                <td>
+					[#if currentAdmin.type=="admin"]
+                    <input type="submit" class="button" value="提交"/>
+                    [/#if]
+                    <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 193 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminMerchant/list.ftl

@@ -0,0 +1,193 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>列表</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	[@flash_message /]
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 市级管理 <span>(总共${page.total}行) <a class="login-url"> 市级登陆链接:http://app.sunzee.com.cn/asl-admin/login.jsp?type=merchant</a>(复制给市级登陆)</span>
+	</div>
+	<form id="listForm" action="list.htm" method="get">
+		<div class="bar">
+		[#--[#if admin.type != "admin"]
+        <a href="add.htm" class="iconButton" id="addButton">
+            <i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+        </a>
+        [/#if]--]
+			<div class="buttonWrap">
+			[#--<a href="javascript:" id="deleteButton" class="iconButton disabled">
+                <i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+            </a>--]
+				<a href="javascript:" id="refreshButton" class="iconButton">
+					<i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+				</a>
+				<div class="menuWrap">
+					<a href="javascript:" id="pageSizeSelect" class="button">
+                        <i class="iconfont icon-yidongyunkongzhitaiicon41">&nbsp;</i>每页行数<span class="arrow">&nbsp;</span>
+					</a>
+					<div class="popupMenu">
+						<ul id="pageSizeOption">
+							<li>
+								<a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+			</div>
+			<div class="menuWrap">
+				<div class="search">
+					<span id="searchPropertySelect" class="arrow"><i class="iconfont icon-xiala"></i></span>
+					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
+					<button type="submit"><i class="iconfont icon-sousuo"></i></button>
+				</div>
+				<div class="popupMenu">
+					<ul id="searchPropertyOption">
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "username"] class="current"[/#if] val="username">账号</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "email"] class="current"[/#if] val="email">邮箱</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "name"] class="current"[/#if] val="name">姓名</a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+		<table id="listTable" class="list">
+			<tr>
+				<th class="check">
+					<input type="checkbox" id="selectAll" />
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="username">账号</a>
+				</th>
+                <th>
+                    <a href="javascript:">操作</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort" name="name">名字</a>
+                </th>
+                <th>
+					<a href="javascript:" class="sort" name="email">邮箱</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="areaId">地区</a>
+                </th>
+				<th>
+					<a href="javascript:" class="sort" name="loginDate">登陆时间</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="phone">电话号码</a>
+                </th>
+				<th>
+					<a href="javascript:" class="sort" name="loginIp">登陆IP地址</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="parentId">所属上级</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort">管理系统ID</a>
+                </th>
+				<th>
+					<span>状态</span>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="createDate">创建时间</a>
+				</th>
+				<th>
+					<span>操作</span>
+				</th>
+			</tr>
+			[#list page.content as admin]
+				<tr>
+					<td>
+						<input type="checkbox" name="ids" value="${admin.id}" />
+					</td>
+					<td>
+						${admin.username}
+					</td>
+                    <td>
+                        <a class="autoLogin" target="_parent" href="autoLogin.htm?merchantId=${admin.id}">切换登陆</a>
+						[#if currentAdmin.type=="admin"]
+                        <a class="green" href="addPersonage.htm?merchantId=${admin.id}">添加终端</a>
+						[/#if]
+                    </td>
+                    <td>
+						${admin.name}
+                    </td>
+					<td>
+						${admin.email}
+					</td>
+                    <td>
+						${_Area(admin.areaId).fullName}
+                    </td>
+					<td>
+						[#if admin.loginDate??]
+							<span>${admin.loginDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+						[#else]
+							-
+						[/#if]
+					</td>
+                    <td>
+                        ${admin.phone}
+                    </td>
+					<td>
+						${(admin.loginIp)!"-"}
+					</td>
+                    <td>
+						${(_Admin(admin.parentId).username)!"-"}
+                    </td>
+                    <td>
+						${admin.managerId}
+                    </td>
+					<td>
+						[#if !admin.isEnabled]
+							<span class="red">无效</span>
+						[#elseif admin.isLocked]
+							<span class="red">锁定</span>
+						[#else]
+							<span class="green">正常</span>
+						[/#if]
+					</td>
+					<td>
+						<span>${admin.createDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+					</td>
+					<td>
+						<a href="edit.htm?id=${admin.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+					</td>
+				</tr>
+			[/#list]
+		</table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination.ftl"]
+		[/@pagination]
+	</form>
+</body>
+</html>

+ 156 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/add.ftl

@@ -0,0 +1,156 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>终端添加</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			username: {
+				required: true,
+				pattern: /^[0-9a-z_A-Z\u4e00-\u9fa5]+$/,
+				minlength: 2,
+				maxlength: 20,
+				remote: {
+					url: "check_username.action",
+					cache: false
+				}
+			},
+			password: {
+				required: true,
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				required: true,
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+            areaId:{
+                required: true
+			}
+		},
+		messages: {
+			username: {
+				pattern: "格式不正确",
+				remote: "账号已存在"
+			},
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 终端添加
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		<table class="input tabContent">
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>账号:
+				</th>
+				<td>
+					<input type="text" name="username" class="text" maxlength="20" /> 注:账号一旦生成将无法修改账号名
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    名称:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" maxlength="200" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200"/>
+                </td>
+            </tr>
+            <tr>
+                <th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true" checked="checked" />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+				</td>
+			</tr>
+		</table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 323 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/edit.ftl

@@ -0,0 +1,323 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>终端编辑</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.lSelect.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+
+	[@flash_message /]
+    var $areaId = $("#areaId");
+    $areaId.lSelect({
+        url: "/asl-admin/common/area.htm"
+    });
+
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			password: {
+				pattern: /^[^\s&\"<>]+$/,
+				minlength: 4,
+				maxlength: 20
+			},
+			rePassword: {
+				equalTo: "#password"
+			},
+            email: {
+                email: true
+            },
+			roleIds: "required"
+		},
+		messages: {
+			password: {
+				pattern: "格式不正确"
+			}
+		}
+	});
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 终端编辑
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${admin.id}" />
+        <ul id="tab" class="tab">
+            <li>
+                <input type="button" value="基本信息" />
+            </li>
+            <li>
+                <input type="button" value="提现账户" />
+            </li>
+        </ul>
+		<table class="input tabContent">
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>地区:
+                </th>
+                <td>
+                    <input type="hidden" id="areaId" name="areaId" value="${(admin.areaId)!}" treePath="${(_Area(admin.areaId).treePath)!}"  />
+                </td>
+            </tr>
+			<tr>
+				<th>
+                    账号:
+				</th>
+				<td>
+					${admin.username}
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    开通管理员:
+                </th>
+                <td>
+				${(_Admin(admin.parentId).username)!"-"}
+                </td>
+            </tr>
+			<tr>
+				<th>
+                    密码:
+				</th>
+				<td>
+					<input type="password" id="password" name="password" class="text" maxlength="20" /> 留空表示不修改
+				</td>
+			</tr>
+			<tr>
+				<th>
+                    确认密码:
+				</th>
+				<td>
+					<input type="password" name="rePassword" class="text" maxlength="20" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    姓名:
+                </th>
+                <td>
+                    <input type="text" name="name" class="text" value="${admin.name}" maxlength="200" />
+                </td>
+            </tr>
+			<tr>
+				<th>
+					邮箱:
+				</th>
+				<td>
+					<input type="text" name="email" class="text" value="${admin.email!""}" maxlength="200" autocomplete="off"/>
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    电话:
+                </th>
+                <td>
+                    <input type="text" name="phone" class="text" maxlength="200" value="${admin.phone}"/>
+                </td>
+            </tr>
+			<tr>
+				<th>
+					设置:
+				</th>
+				<td>
+					<label>
+						<input type="checkbox" name="isEnabled" value="true"[#if admin.isEnabled] checked="checked"[/#if] />是否启动
+						<input type="hidden" name="_isEnabled" value="false" />
+					</label>
+					[#if admin.isLocked]
+						<label>
+							<input type="checkbox" name="isLocked" value="true" checked="checked" />${message("Admin.isLocked")}
+							<input type="hidden" name="_isLocked" value="false" />
+						</label>
+					[/#if]
+				</td>
+			</tr>
+		</table>
+        <table class="input tabContent">
+            <tr>
+                <th>
+                    操作:
+                </th>
+                <td>
+                    <a href="javascript:location.reload()" class="layui-btn layui-btn-primary layui-btn-sm">刷新</a>
+                </td>
+            </tr>
+            [#if mch.order_status!=null]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>资金账户:
+                </th>
+                <td id="balance">
+                    <span>主账户余额:<b>${mch.alt_main_balance}</b></span>
+                    <span>担保余额:<b>${mch.alt_guar_balance}</b></span>
+                    <span>可取金额:<b>${mch.alt_avil_balance}</b></span>
+                </td>
+            </tr>
+			[/#if]
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户状态:
+                </th>
+                <td id="orderStatus">
+				${(orderStatus.get(mch.order_status))!"-"}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>商户类型:
+                </th>
+                <td>
+                     [#if mch.alt_merchant_type == '10'] 个人[/#if]
+                     [#if mch.alt_merchant_type == '11'] 个体工商户[/#if]
+                     [#if mch.alt_merchant_type == '12'] 企业[/#if]
+                </td
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人名称:
+                </th>
+                <td>
+				${mch.busi_contact_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>联系人手机:
+                </th>
+                <td>
+				${mch.busi_contact_mobile_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人手机号:
+                </th>
+                <td>
+				${mch.phone_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人姓名:
+                </th>
+                <td>
+				${mch.legal_person}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>法人/个人身份证号:
+                </th>
+                <td>
+				${mch.id_card_no}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    身份证有效期:
+                </th>
+                <td>
+				${mch.id_card_expiry}
+                </td>
+            </tr>
+            [#if mch.alt_merchant_type != '10']
+            <tr class="license">
+                <th>
+                    <span class="requiredField">*</span>营业执照编码:
+                </th>
+                <td>
+                    ${mch.license_no}
+                </td>
+            </tr>
+            <tr class="license">
+                <th>
+                    营业执照有效期:
+                </th>
+                <td>
+                    ${mch.license_expiry}
+                </td>
+            </tr>
+            [/#if]
+            <tr>
+                <th>
+                    经营范围:
+                </th>
+                <td>
+				${mch.manage_scope}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    经营地址:
+                </th>
+                <td>
+				${mch.manage_addr}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>账户类型:
+                </th>
+                <td id="bank_account_type">
+                    [#if mch.alt_merchant_type=='10'||mch.alt_merchant_type==null]
+                        借记卡
+					[#else]
+						对公账户
+					[/#if]
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账户名称:
+                </th>
+                <td>
+				${mch.bank_account_name}
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    <span class="requiredField">*</span>银行账号:
+                </th>
+                <td>
+				${mch.bank_account_no}
+                </td>
+            </tr>
+            <tr id="bank_channel_no">
+                <th>
+                    <span class="requiredField" style="display: none">*</span>联行号:
+                </th>
+                <td>
+				${mch.bank_channel_no}
+                </td>
+            </tr>
+        </table>
+		<table class="input">
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					[#if currentAdmin.type=="admin"]
+					   <input type="submit" class="button" value="提交"/>
+                    [/#if]
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 192 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/adminPersonage/list.ftl

@@ -0,0 +1,192 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>列表</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	[@flash_message /]
+
+
+});
+</script>
+</head>
+<body>
+	<div class="path">
+        首页 &raquo; 终端管理 <span>(总共${page.total}行) <a class="login-url">终端登陆链接:http://app.sunzee.com.cn/asl-admin/login.jsp?type=personage</a>(复制给终端登陆)</span>
+	</div>
+	<form id="listForm" action="list.htm" method="get">
+		<div class="bar">
+		[#--	[#if admin.type != "admin"]
+			    <a href="add.htm" class="iconButton" id="addButton">
+                    <i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+                </a>
+            [/#if]--]
+			<div class="buttonWrap">
+			[#--	<a href="javascript:" id="deleteButton" class="iconButton disabled">
+					<i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+				</a>--]
+				<a href="javascript:" id="refreshButton" class="iconButton">
+					<i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+				</a>
+				<div class="menuWrap">
+					<a href="javascript:" id="pageSizeSelect" class="button">
+                        <i class="iconfont icon-yidongyunkongzhitaiicon41">&nbsp;</i>每页行数<span class="arrow">&nbsp;</span>
+					</a>
+					<div class="popupMenu">
+						<ul id="pageSizeOption">
+							<li>
+								<a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+							</li>
+							<li>
+								<a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+							</li>
+						</ul>
+					</div>
+				</div>
+			</div>
+			<div class="menuWrap">
+				<div class="search">
+					<span id="searchPropertySelect" class="arrow"><i class="iconfont icon-xiala"></i></span>
+					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
+					<button type="submit"><i class="iconfont icon-sousuo"></i></button>
+				</div>
+				<div class="popupMenu">
+					<ul id="searchPropertyOption">
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "username"] class="current"[/#if] val="username">账号</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "email"] class="current"[/#if] val="email">邮箱</a>
+						</li>
+						<li>
+							<a href="javascript:"[#if page.searchProperty == "name"] class="current"[/#if] val="name">姓名</a>
+						</li>
+					</ul>
+				</div>
+			</div>
+		</div>
+		<table id="listTable" class="list">
+			<tr>
+				<th class="check">
+					<input type="checkbox" id="selectAll" />
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="username">账号</a>
+				</th>
+                <th>
+                    <a href="javascript:">操作</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort" name="name">名字</a>
+                </th>
+                <th>
+					<a href="javascript:" class="sort" name="email">邮箱</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="areaId">地区</a>
+                </th>
+				<th>
+					<a href="javascript:" class="sort" name="loginDate">登陆时间</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="phone">电话号码</a>
+                </th>
+				<th>
+					<a href="javascript:" class="sort" name="loginIp">登陆IP地址</a>
+				</th>
+                <th>
+                    <a href="javascript:" class="sort" name="parentId">所属上级</a>
+                </th>
+                <th>
+                    <a href="javascript:" class="sort">管理系统ID</a>
+                </th>
+				<th>
+					<span>状态</span>
+				</th>
+				<th>
+					<a href="javascript:" class="sort" name="createDate">创建时间</a>
+				</th>
+				<th>
+					<span>操作</span>
+				</th>
+			</tr>
+			[#list page.content as admin]
+				<tr>
+					<td>
+						<input type="checkbox" name="ids" value="${admin.id}" />
+					</td>
+					<td>
+						${admin.username}
+					</td>
+                    <td>
+                        <a class="autoLogin" target="_parent" href="autoLogin.htm?personageId=${admin.id}">切换登陆</a>
+                    </td>
+                    <td>
+						${admin.name}
+                    </td>
+					<td>
+						${admin.email}
+					</td>
+                    <td>
+						${_Area(admin.areaId).fullName}
+                    </td>
+					<td>
+						[#if admin.loginDate??]
+							<span>${admin.loginDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+						[#else]
+							-
+						[/#if]
+					</td>
+                    <td>
+                        ${admin.phone}
+                    </td>
+					<td>
+						${(admin.loginIp)!"-"}
+					</td>
+
+                    <td>
+						${(_Admin(admin.parentId).username)!"-"}
+                    </td>
+                    <td>
+						${admin.managerId}
+                    </td>
+					<td>
+						[#if !admin.isEnabled]
+							<span class="red">无效</span>
+						[#elseif admin.isLocked]
+							<span class="red">锁定</span>
+						[#else]
+							<span class="green">正常</span>
+						[/#if]
+					</td>
+					<td>
+						<span>${admin.createDate?string("yyyy-MM-dd HH:mm:ss")}</span>
+					</td>
+					<td>
+						<a href="edit.htm?id=${admin.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+					</td>
+				</tr>
+			[/#list]
+		</table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination.ftl"]
+		[/@pagination]
+	</form>
+</body>
+</html>

+ 231 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/alarmRecord/list.ftl

@@ -0,0 +1,231 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>报警记录列表</title>
+
+
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/list.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+            layui.use('laydate', function () {
+                var laydate = layui.laydate;
+                laydate.render({
+                    elem: '#exportDate'
+                    , range: true
+                    , theme: '#d6bf3b'
+                });
+            });
+
+            $('#export').click(function () {
+                var date = $('#exportDate').val();
+                window.location.href = "export.htm?" + "date=" + date;
+                return false;
+            });
+	[@flash_message /]
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 报警记录列表 <span>(总共${page.total}行)</span>
+</div>
+<form id="listForm" action="list.htm" method="get">
+    <div class="bar buttonWrap">
+
+        <div class="buttonWrap">
+            <div class="menuWrap">
+                <a href="javascript:" id="refreshButton" class="iconButton">
+                    <i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+                </a>
+                <a href="javascript:" id="pageSizeSelect" class="button">
+                    每页行数<span class="arrow">&nbsp;</span>
+                </a>
+                <div class="popupMenu">
+                    <ul id="pageSizeOption">
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+                        </li>
+                    </ul>
+                </div>
+            </div>
+        </div>
+        <div class="search-bar">
+            唯一码 <input type="text" name="clientId" class="text" value="${clientId}"/>
+            &nbsp;&nbsp;
+            设备名称 <input type="text" name="name" class="text" value="${name}"/>
+            &nbsp;&nbsp;
+            所属商家 <input type="text" name="adminUserName" class="text" value="${adminUserName}"/>
+            &nbsp;&nbsp;
+            报警内容 <input type="text" name="alarmContent" class="text" value="${alarmContent} "/>
+            &nbsp;&nbsp;
+            报警时间
+            <div class="layui-form layui-form-list ">
+                <div class="layui-form-item">
+                    <div class="layui-input-inline" style="margin-right: 70px">
+                        <input type="text" id="beginEndDate" name="beginEndDate" class="text" value="${beginEndDate}"
+                               maxlength="200" placeholder=" - " readonly style="width: 240px"/>
+                    </div>
+                </div>
+            </div>
+            &nbsp;&nbsp; &nbsp;&nbsp;
+            [#if admin.type=="admin"]
+                类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="agency" [#if type=="agency"] selected[/#if]>省级</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>市级</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端</option>
+                </select>
+            [#elseif admin.type=="agency"]
+				类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="agency" [#if type=="agency"] selected[/#if]>我的</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>市级</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端</option>
+                </select>
+            [#elseif admin.type=="merchant"]
+				类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>我的</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端</option>
+                </select>
+            [/#if]
+            &nbsp;&nbsp; &nbsp;&nbsp;
+            <button class="layui-btn layui-btn-normal layui-btn-xs">筛选</button>
+            &nbsp;&nbsp; &nbsp;&nbsp;
+        </div>
+        <div style="margin-left:10px;padding:5px;border: 1px solid" class="search-bar">
+        [#-- 导出类型
+         <select name="exportType">
+             <option value="">全部</option>
+             <option value="account">子账号</option>
+             <option value="equipment">设备</option>
+         </select>--]
+            日期 <input id="exportDate" style="height: 24px;width: 150px" type="text" name="exportDate"
+                      placeholder=" - "/>
+
+            <button id="export" class="layui-btn layui-btn-normal layui-btn-xs">导出Excel</button>
+        </div>
+    </div>
+    <table id="listTable" class="list">
+        <tr>
+        [#--<th class="check">
+            <input type="checkbox" id="selectAll"/>
+        </th>--]
+            <th>
+                <a href="javascript:" class="sort" name="clientId">设备唯一码</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="name">设备名称</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="adminLevel">所属商家级别</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="adminUserName">所属商家</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="alarmContent">报警内容</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="remark">备注</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="occurrenceTime">创建时间</a>
+            </th>
+        </tr>
+			[#list page.content as alarmRecord]
+				<tr>
+                [#--<td>
+                    <input type="checkbox" name="ids" value="${alarmRecord.id}"/>
+                </td>--]
+                    <td>
+						${alarmRecord.clientId}
+                    </td>
+                    <td>
+						${alarmRecord.name}
+                    </td>
+                    <td>
+						${alarmRecord.adminLevel}
+                    </td>
+                    <td>
+                        ${alarmRecord.adminUserName}
+                    </td>
+                    <td>
+						${alarmRecord.alarmContent}
+                    </td>
+                    <td>
+						${alarmRecord.remark}
+                    </td>
+                    <td>
+						${(alarmRecord.occurrenceTime?string("yyyy-MM-dd HH:mm:ss"))!""}
+                    </td>
+
+                </tr>
+			[/#list]
+    </table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+			[#include "/admin/include/pagination.ftl"]
+		[/@pagination]
+</form>
+
+<script>
+    $(document).ready(function () {
+
+        layui.use('form', function () {
+            var form = layui.form;
+        });
+        layui.use('laydate', function () {
+            var laydate = layui.laydate;
+
+            //日期时间范围
+            laydate.render({
+                elem: '#beginEndDate'
+                , type: 'datetime'
+                , range: true
+                , theme: '#d6bf3b'
+            });
+
+        });
+    });
+    /* $("#export").click(function () {
+         //获取
+         var boxs = $("input[name='ids']");
+         var array = new Array();
+         for (var i = 0; i < boxs.length; i++) {
+             //选中状态
+             if (boxs[i].checked) {
+
+                 array.push(boxs[i].value);
+             }
+         }
+         if (array.length == 0) {
+             layer.msg("请选择一个");
+             return;
+         }
+         window.location.href = 'export.htm?ids=' + array;
+     });*/
+</script>
+</body>
+
+</html>

+ 176 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/add.ftl

@@ -0,0 +1,176 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>添加apk信息</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            /*  var $inputForm = $("#inputForm");
+              // 表单验证
+              $inputForm.validate({
+                  rules: {
+                      versionInfo: "required"
+                  }
+              });*/
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 添加apk信息
+</div>
+<form id="inputForm" action="save.htm" method="post">
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本号:
+            </th>
+            <td>
+                <input type="number" id="version" name="version" class="text" maxlength="200" required/>
+                <span id="versionSpan" class="red"></span>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本名:
+            </th>
+            <td>
+                <input type="text" name="versionName" class="text" maxlength="200" required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>型号
+            </th>
+            <td>
+                <input type="radio" name="model" value="301" checked/>MG301
+                <input type="radio" name="model" value="320"/>MG320
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>是否强制更新:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" name="isForce" value="true" checked required/> 是&nbsp;&nbsp;&nbsp;&nbsp;
+                    <input type="radio" name="isForce" value="false" required/> 否
+                </label>
+            </td>
+        </tr>
+    [#--  <tr>
+          <th>
+              <span class="requiredField">*</span>上传文件:
+          </th>
+          <td>
+              <div class="layui-upload-drag" id="uploadzone">
+                  <i class="layui-icon"></i>
+                  <p>点击上传,或将文件拖拽到此处</p>
+              </div>
+              <div id="url"></div>
+              <input type="hidden" id="apkSize" name="apkSize" class="text" maxlength="200"/>
+          </td>
+      </tr>--]
+        <tr>
+            <th>
+                <span class="requiredField">*</span>apk大小:
+            </th>
+            <td>
+                <input type="number" id="apkSize" name="apkSize" class="text" maxlength="200" required/>
+                <span id="apkSizeSpan" class="red"></span>
+
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>下载链接:
+            </th>
+            <td>
+                <input type="text" id="downloadUrl" name="downloadUrl" class="text" required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本介绍:
+            </th>
+            <td>
+                <textarea id="editor" name="versionInfo" class="layui-input text" maxlength="500" required
+                          style="height:200px;width: 300px"></textarea>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+<script>
+    layui.use('upload', function () {
+        var $ = layui.jquery
+                , upload = layui.upload;
+        //拖拽上传
+        upload.render({
+            elem: '#uploadzone'
+            , url: '/asl-admin/file/uploadAPK.htm'
+            , accept: 'file' //普通文件
+            , exts: 'apk'
+            , data: {fileType: 'file'}
+            , done: function (res) {
+                console.log(res)
+                //如果上传失败
+                if (res.code > 0) {
+                    return layer.msg('上传失败');
+                }
+                //上传成功
+                $('#downloadUrl').val(res.url);
+                $('#apkSize').val(res.size);
+                $('#url').html("上传成功 " + res.url + "<br>大小 " + res.size + " KB");
+            }
+            , error: function () {
+
+            }
+        });
+    })
+</script>
+
+<script>
+    var layer;
+    layui.use('layer', function () {
+        layer = layui.layer;
+    })
+    $("#inputForm").submit(function () {
+        debugger;
+        var version = $("#version").val();
+        var apkSize = $("#apkSize").val();
+
+        if (version.indexOf(".") > -1) {
+            $("#versionSpan").html("该选项不能为小数");
+            $("#apkSizeSpan").html("");
+            return false;
+        }
+        if (apkSize.indexOf(".") > -1) {
+            $("#apkSizeSpan").html("该选项不能小数 ");
+            $("#versionSpan").html("");
+            return false;
+        }
+        $("#inputForm").submit();
+    })
+</script>
+</html>

+ 182 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/edit.ftl

@@ -0,0 +1,182 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>编辑apk信息</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            var $inputForm = $("#inputForm");
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    xxx: "required"
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 编辑apk信息
+</div>
+<form id="inputForm" action="update.htm" method="post">
+    <input type="hidden" name="id" value="${apkInfo.id}"/>
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本号:
+            </th>
+            <td>
+                <input type="number" name="version" class="text" maxlength="200" value="${apkInfo.version}" required/>
+                <span id="versionSpan" class="red"></span>
+
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本名:
+            </th>
+            <td>
+                <input type="text" name="versionName" class="text" value="${apkInfo.versionName}" maxlength="200"
+                       required/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>型号
+            </th>
+            <td>
+                <input type="radio" name="model" value="301" [#if apkInfo.model=="301"]checked[/#if]/>MG301
+                <input type="radio" name="model" value="320" [#if apkInfo.model=="320"]checked[/#if]/>MG320
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>是否强制更新:
+            </th>
+            <td>
+                <label>
+                    <input type="radio" name="isForce" value="true" [#if apkInfo.isForce]checked[/#if] required/> 是&nbsp;&nbsp;&nbsp;&nbsp;
+                    <input type="radio" name="isForce" value="false" [#if !apkInfo.isForce]checked[/#if] required/> 否
+                </label>
+            </td>
+        </tr>
+    [#--<tr>
+        <th>
+            <span class="requiredField">*</span>上传文件:
+        </th>
+        <td>
+            <div class="layui-upload-drag" id="uploadzone">
+                <i class="layui-icon"></i>
+                <p>点击上传,或将文件拖拽到此处</p>
+            </div>
+            <div id="url">"${apkInfo.downloadUrl}"</div>
+            <input type="hidden" id="apkSize" name="apkSize" class="text" maxlength="200" value="${apkInfo.apkSize}"
+                   required/>
+        </td>
+    </tr>--]
+        <tr>
+            <th>
+                <span class="requiredField">*</span>apk大小:
+            </th>
+            <td>
+                <input type="number" id="apkSize" name="apkSize" class="text" value="${apkInfo.apkSize}" maxlength="200"
+                       required/>
+                <span id="apkSizeSpan" class="red"></span>
+
+
+            </td>
+        </tr>
+        <tr>
+            <th>
+                <span class="requiredField">*</span>下载链接:
+            </th>
+            <td>
+                <input type="text" id="downloadUrl" name="downloadUrl" value="${apkInfo.downloadUrl}" class="text"
+                       required/>
+            </td>
+        </tr>
+
+        <tr>
+            <th>
+                <span class="requiredField">*</span>版本介绍:
+            </th>
+            <td>
+                <textarea id="editor" name="versionInfo" class="layui-input text" maxlength="500" required
+                          style="height:200px;width: 300px">${apkInfo.versionInfo}</textarea>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+<script>
+    layui.use('upload', function () {
+        var $ = layui.jquery
+                , upload = layui.upload;
+        //拖拽上传
+        upload.render({
+            elem: '#uploadzone'
+            /* ,url: '/app_file/file/upload.htm'*/
+            , url: '/asl-admin/file/uploadAPK.htm'
+            , accept: 'file' //普通文件
+            , exts: 'apk'
+            , data: {fileType: 'file'}
+            , done: function (res) {
+                console.log(res)
+                //如果上传失败
+                if (res.code > 0) {
+                    return layer.msg('上传失败');
+                }
+                //上传成功
+                $('#downloadUrl').val(res.url);
+                $('#apkSize').val(res.size);
+                $('#url').html("上传成功 " + res.url + "<br>大小 " + res.size + " KB");
+            }
+        });
+    })
+</script>
+<script>
+    var layer;
+    layui.use('layer', function () {
+        layer = layui.layer;
+    })
+    $("#inputForm").submit(function () {
+        debugger;
+        var version = $("#version").val();
+        var apkSize = $("#apkSize").val();
+
+        if (version.indexOf(".") > -1) {
+            $("#versionSpan").html("该选项不能为小数");
+            $("#apkSizeSpan").html("");
+            return false;
+        }
+        if (apkSize.indexOf(".") > -1) {
+            $("#apkSizeSpan").html("该选项不能小数 ");
+            $("#versionSpan").html("");
+            return false;
+        }
+        $("#inputForm").submit();
+    })
+
+</script>
+</html>

+ 142 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/apkInfo/list.ftl

@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>apk信息列表</title>
+
+
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/list.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+
+	[@flash_message /]
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; apk信息列表 <span>(总共${page.total}行)</span>
+</div>
+<form id="listForm" action="list.htm" method="get">
+    <div class="bar">
+        <a href="add.htm" class="iconButton" id="addButton">
+            <i class="iconfont icon-anonymous-iconfont1">&nbsp;</i>添加
+        </a>
+        <div class="buttonWrap">
+            <a href="javascript:" id="deleteButton" class="iconButton disabled">
+                <i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+            </a>
+            <a href="javascript:" id="refreshButton" class="iconButton">
+                <i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+            </a>
+            <div class="menuWrap">
+                <a href="javascript:" id="pageSizeSelect" class="button">
+                    每页行数<span class="arrow">&nbsp;</span>
+                </a>
+                <div class="popupMenu">
+                    <ul id="pageSizeOption">
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+                        </li>
+                    </ul>
+                </div>
+            </div>
+            &nbsp;&nbsp;
+            &nbsp;&nbsp;
+            <div class="search-bar">
+                版本号<input type="number" name="version" class="text" value="${version}"/>
+                &nbsp;&nbsp;
+                &nbsp;&nbsp;
+                <button class="layui-btn layui-btn-normal layui-btn-xs">筛选</button>
+            </div>
+        </div>
+    </div>
+    <table id="listTable" class="list">
+        <tr>
+            <th class="check">
+                <input type="checkbox" id="selectAll"/>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="version">版本号</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="versionName">版本信息</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="isForce">是否强制更新</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="apkSize">apk大小(KB)</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="downloadUrl">下载链接</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="model">型号</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="createDate">创建时间</a>
+            </th>
+            <th>
+                <span>操作</span>
+            </th>
+        </tr>
+			[#list page.content as apk_info]
+				<tr>
+                    <td>
+                        <input type="checkbox" name="ids" value="${apk_info.id}"/>
+                    </td>
+                    <td>
+                        ${apk_info.version}
+                    </td>
+                    <td>
+                        ${apk_info.versionName}
+                    </td>
+                    <td>
+						 [#if apk_info.isForce]
+                             <span class="green">是</span>
+                         [#else]
+							<span class="red">否</span>
+                         [/#if]
+                    </td>
+                    <td>
+                        ${apk_info.apkSize}
+                    </td>
+                    <td>
+                        ${apk_info.downloadUrl}
+                    </td>
+                    <td>
+                        ${apk_info.model}
+                    </td>
+                    <td>
+                        ${apk_info.createDate?string("yyyy-MM-dd HH:mm:ss")}
+                    </td>
+                    <td>
+                        <a href="edit.htm?id=${apk_info.id}"><i class="iconfont icon-bianji edit-icon"></i></a>
+                    </td>
+                </tr>
+            [/#list]
+    </table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+            [#include "/admin/include/pagination.ftl"]
+        [/@pagination]
+</form>
+</body>
+</html>

+ 86 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/area/add.ftl

@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>添加地区</title>
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	
+	[@flash_message /]
+	
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			name: "required",
+			order: "digits"
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 添加地址
+	</div>
+	<form id="inputForm" action="save.htm" method="post">
+		[#if parent??]
+			<input type="hidden" name="parentId" value="${parent.id}" />
+		[/#if]
+		<table class="input">
+			<tr>
+				<th>
+                    上层地区:
+				</th>
+				<td>
+					[#if parent??]${parent.name}[#else]根目录[/#if]
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>地区名称:
+				</th>
+				<td>
+					<input type="text" name="name" class="text" maxlength="100" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    地区代码:
+                </th>
+                <td>
+                    <input type="text" name="code" class="text" maxlength="100" /> 地区代码将会默认生成在子账号账号&设备号前缀
+                </td>
+            </tr>
+			<tr>
+				<th>
+					排序:
+				</th>
+				<td>
+					<input type="text" name="order" class="text" maxlength="9" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+                    <input type="submit" class="button" value="提交" />
+                    <input type="button" class="button" value="返回" onclick="location.href='list.htm'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 85 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/area/edit.ftl

@@ -0,0 +1,85 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>编辑地区</title>
+
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+<script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/input.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $inputForm = $("#inputForm");
+	
+	[@flash_message /]
+	
+	// 表单验证
+	$inputForm.validate({
+		rules: {
+			name: "required",
+			order: "digits"
+		}
+	});
+	
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 编辑地区
+	</div>
+	<form id="inputForm" action="update.htm" method="post">
+		<input type="hidden" name="id" value="${area.id}" />
+		<table class="input">
+			<tr>
+				<th>
+					上层地区:
+				</th>
+				<td>
+					[#if area.parent??]${area.parent.name}[#else]根目录[/#if]
+				</td>
+			</tr>
+			<tr>
+				<th>
+					<span class="requiredField">*</span>地区名称:
+				</th>
+				<td>
+					<input type="text" name="name" class="text" value="${area.name}" maxlength="100" />
+				</td>
+			</tr>
+            <tr>
+                <th>
+                    地区代码:
+                </th>
+                <td>
+                    <input type="text" name="code" class="text" value="${area.code}" maxlength="100" /> 地区代码将会默认生成在子账号账号&设备号前缀
+                </td>
+            </tr>
+			<tr>
+				<th>
+					排序:
+				</th>
+				<td>
+					<input type="text" name="order" class="text" value="${area.order}" maxlength="9" />
+				</td>
+			</tr>
+			<tr>
+				<th>
+					&nbsp;
+				</th>
+				<td>
+					<input type="submit" class="button" value="提交" />
+					<input type="button" class="button" value="返回" onclick="location.href='list.htm[#if area.parent??]?parentId=${area.parent.id}[/#if]'" />
+				</td>
+			</tr>
+		</table>
+	</form>
+</body>
+</html>

+ 142 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/area/list.ftl

@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<title>地区列表</title>
+
+
+<link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css" />
+<link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+<link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+<script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+<script type="text/javascript" src="/resources/admin/js/common.js"></script>
+<script type="text/javascript" src="/resources/admin/js/list.js"></script>
+<script type="text/javascript">
+$().ready(function() {
+
+	var $delete = $("#listTable a.delete");
+
+	[@flash_message /]
+	/**
+	// 删除
+	$delete.click(function() {
+		var $this = $(this);
+		$.dialog({
+			type: "warn",
+			content: "确定删除该地区?",
+			onOk: function() {
+				$.ajax({
+					url: "delete.action",
+					type: "POST",
+					data: {id: $this.attr("val")},
+					dataType: "json",
+					cache: false,
+					success: function(message) {
+						$.message(message);
+						if (message.type == "success") {
+							$this.parent().html("&nbsp;");
+						}
+					}
+				});
+			}
+		},260,180);
+		return false;
+	});
+**/
+    layui.use('layer', function(){
+
+        $delete.click(function() {
+            var $this = $(this);
+            var layer = layui.layer;
+            layer.open({
+                type: 1
+                ,title: false //不显示标题栏
+                ,closeBtn: false
+                ,area: '300px;'
+                ,shade: 0.2
+                ,id: 'LAY_layuipro' //设定一个id,防止重复弹出
+                ,btn: ['确定删除', '取消']
+                ,btnAlign: 'c'
+                ,moveType: 1 //拖拽模式,0或者1
+                ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">确定删除该地区?</div>'
+                ,success: function(layero){
+                        var btn = layero.find('.layui-layer-btn');
+                        btn.find('.layui-layer-btn0').click(function () {
+                            $.ajax({
+                                url: "delete.action",
+                                type: "POST",
+                                data: {id: $this.attr("val")},
+                                dataType: "json",
+                                cache: false,
+                                success: function(message) {
+                                    $.message(message);
+                                    if (message.type == "success") {
+                                        $this.parent().html("&nbsp;");
+                                    }
+                                }
+                            });
+                    })
+                }
+            });
+        });
+    });
+});
+</script>
+</head>
+<body>
+	<div class="path">
+		首页 &raquo; 地区列表
+	</div>
+	<div class="bar">
+		<a href="add.htm[#if parent??]?parentId=${parent.id}[/#if]" class="iconButton">
+			<span class="iconfont icon-anonymous-iconfont1">&nbsp;</span>添加
+		</a>
+		[#if parent??]
+			<div class="pageBar">
+				[#if parent.parent??]
+					<a href="list.htm?parentId=${parent.parent.id}" class="iconButton">
+						<span class="upIcon">&nbsp;</span>上层地区
+					</a>
+				[#else]
+					<a href="list.htm" class="iconButton">
+						<span class="upIcon">&nbsp;</span>上层地区
+					</a>
+				[/#if]
+			</div>
+		[/#if]
+	</div>
+	<table id="listTable" class="list">
+		<tr>
+			<th colspan="5" class="green" style="text-align: center;">
+				[#if parent??]上层地区 - ${parent.name}[#else]根目录[/#if]
+			</th>
+		</tr>
+		[#list areas?chunk(5, "") as row]
+			<tr>
+				[#list row as area]
+					[#if area?has_content]
+						<td>
+							<a href="list.htm?parentId=${area.id}" title="${message("admin.common.view")}">${area.name}[${area.code!"-"}]</a>
+							<a href="edit.htm?id=${area.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
+							<a href="javascript:" class="delete" val="${area.id}"><i class="iconfont icon-shequshanchu del-icon" ></i></a>
+						</td>
+					[#else]
+						<td>
+							&nbsp;
+						</td>
+					[/#if]
+				[/#list]
+			</tr>
+		[/#list]
+		[#if !areas?has_content]
+			<tr>
+				<td colspan="5" style="text-align: center; color: red;">
+					地区为空 <a href="add.htm[#if parent??]?parentId=${parent.id}[/#if]" style="color: gray">添加</a>
+				</td>
+			</tr>
+		[/#if]
+	</table>
+</body>
+</html>

+ 55 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/add.ftl

@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>添加投币以及无需支付订单</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            var $inputForm = $("#inputForm");
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    xxx: "required"
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 添加投币以及无需支付订单
+</div>
+<form id="inputForm" action="save.htm" method="post">
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>xxx:
+            </th>
+            <td>
+                <input type="text" name="xxx" class="text" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+</html>

+ 56 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/edit.ftl

@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>编辑投币以及无需支付订单</title>
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.tools.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/jquery.validate.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/input.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+    [@flash_message /]
+            var $inputForm = $("#inputForm");
+            // 表单验证
+            $inputForm.validate({
+                rules: {
+                    xxx: "required"
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 编辑投币以及无需支付订单
+</div>
+<form id="inputForm" action="update.htm" method="post">
+    <input type="hidden" name="id" value="${coinOrder.id}"/>
+    <table class="input">
+        <tr>
+            <th>
+                <span class="requiredField">*</span>xxx:
+            </th>
+            <td>
+                <input type="text" name="xxx" class="text" value="${coinOrder.xxx}" maxlength="200"/>
+            </td>
+        </tr>
+        <tr>
+            <th>
+                &nbsp;
+            </th>
+            <td>
+                <input type="submit" class="button" value="提交"/>
+                <input type="button" class="button" value="返回" onclick="location.href='list.htm'"/>
+            </td>
+        </tr>
+    </table>
+</form>
+</body>
+</html>

+ 249 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/coinOrder/list.ftl

@@ -0,0 +1,249 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+    <title>投币以及无需支付订单列表</title>
+
+
+    <link href="/resources/admin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/iconfont/iconfont.css" rel="stylesheet" type="text/css"/>
+    <link href="/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
+    <script type="text/javascript" src="/resources/admin/js/jquery.js"></script>
+    <script type="text/javascript" src="/resources/admin/layui/layui.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/common.js"></script>
+    <script type="text/javascript" src="/resources/admin/js/list.js"></script>
+    <script type="text/javascript">
+        $().ready(function () {
+
+	[@flash_message /]
+            layui.use('laydate', function () {
+                var laydate = layui.laydate;
+                laydate.render({
+                    elem: '#exportDate'
+                    , range: true
+                    , theme: '#d6bf3b'
+                });
+            });
+
+            $('#export').click(function () {
+                var date = $('#exportDate').val();
+                window.location.href = "export.htm?" + "date=" + date;
+                return false;
+            });
+
+        });
+    </script>
+</head>
+<body>
+<div class="path">
+    首页 &raquo; 投币以及无需支付订单列表 <span>(总共${page.total}行)</span>
+</div>
+<form id="listForm" action="list.htm" method="get">
+    <div class="bar buttonWrap">
+        <div class=" buttonWrap">
+            <a href="javascript:" id="deleteButton" class="iconButton disabled">
+                <i class="iconfont icon-shequshanchu">&nbsp;</i>删除
+            </a>
+            <a href="javascript:" id="refreshButton" class="iconButton">
+                <i class="iconfont icon-shuaxin1">&nbsp;</i>刷新
+            </a>
+            <div class="menuWrap">
+                <a href="javascript:" id="pageSizeSelect" class="button">
+                    每页行数<span class="arrow">&nbsp;</span>
+                </a>
+                <div class="popupMenu">
+                    <ul id="pageSizeOption">
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
+                        </li>
+                        <li>
+                            <a href="javascript:"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
+                        </li>
+                    </ul>
+                </div>
+            </div>
+        </div>
+        <div class="search-bar">
+            订单编号 <input type="text" name="sn" class="text" value="${sn}"/>
+            商品名称 <input type="text" name="productName" class="text" value="${productName}"/>
+            唯一码 <input type="text" name="clientId" class="text" value="${clientId}"/>
+            订单状态
+            <select name="payType">
+                <option value="">全部</option>
+                <option value="0" [#if payType=="0"] selected[/#if]>无需支付</option>
+                <option value="1" [#if status=="1"] selected[/#if]>投币支付</option>
+            </select>
+
+				[#if admin.type=="admin"]
+                类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="agency" [#if type=="agency"] selected[/#if]>省级订单</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>市级订单</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端订单</option>
+                </select>
+                [#elseif admin.type=="agency"]
+				类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="agency" [#if type=="agency"] selected[/#if]>我的订单</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>市级订单</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端订单</option>
+                </select>
+                [#elseif admin.type=="merchant"]
+				类型
+                <select name="type">
+                    <option value="">全部</option>
+                    <option value="merchant" [#if type=="merchant"] selected[/#if]>我的订单</option>
+                    <option value="personage" [#if status=="personage"] selected[/#if]>终端订单</option>
+                </select>
+                [/#if]
+            开始结束时间
+            <div class="layui-form layui-form-list ">
+                <div class="layui-form-item">
+                    <div class="layui-input-inline" style="margin-right: 70px">
+                        <input type="text" id="beginEndDate" name="beginEndDate" class="text"
+                               value="${beginEndDate}"
+                               maxlength="200" placeholder=" - " readonly style="width: 240px"/>
+                    </div>
+                </div>
+            </div>
+            <button class="layui-btn layui-btn-normal layui-btn-xs">筛选</button>
+            &nbsp;&nbsp; &nbsp;&nbsp;
+        [#--<a id="export">
+            <div class="layui-btn layui-btn-xs">导出excel</div>
+        </a>--]
+
+        </div>
+        <div style="margin-left:10px;padding:5px;border: 1px solid" class="search-bar">
+        [#-- 导出类型
+         <select name="exportType">
+             <option value="">全部</option>
+             <option value="account">子账号</option>
+             <option value="equipment">设备</option>
+         </select>--]
+            日期 <input id="exportDate" style="height: 24px;width: 150px" type="text" name="exportDate"
+                      placeholder=" - "/>
+
+            <button id="export" class="layui-btn layui-btn-normal layui-btn-xs">导出Excel</button>
+        </div>
+    </div>
+    <table id="listTable" class="list">
+        <tr>
+            <th class="check">
+                <input type="checkbox" id="selectAll"/>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="sn">订单编号</a>
+            </th>
+            <th>
+                <a href="javascript:">商家</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="clientId">设备唯一码</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="name">商品名称</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="price">价格</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="payType">支付方式</a>
+            </th>
+            <th>
+                <a href="javascript:" class="sort" name="createDate">支付时间</a>
+            </th>
+        </tr>
+			[#list page.content as coinOrder]
+				<tr>
+                    <td>
+                        <input type="checkbox" name="ids" value="${coinOrder.id}"/>
+                    </td>
+                    <td>
+                        ${coinOrder.sn}
+                    </td>
+                    <td>
+                       	[#if coinOrder.type == "agency"]
+                            省级(${_Admin(coinOrder.adminId).username})
+                        [#elseif coinOrder.type == "merchant"]
+							市级(${_Admin(coinOrder.adminId).username})
+                        [#elseif coinOrder.type == "personage"]
+							终端(${_Admin(coinOrder.adminId).username})
+                        [/#if]
+                    </td>
+                    <td>
+                        ${coinOrder.clientId}
+                    </td>
+                    <td>
+                        ${coinOrder.productName}
+                    </td>
+                    <td>
+                        ${coinOrder.price}
+                    </td>
+                    <td>
+                      [#if coinOrder.payType=="0"]
+                          无需支付
+                      [#else]
+                       投币支付
+                      [/#if]
+                    </td>
+                    <td>
+                        ${coinOrder.createDate?string("yyyy-MM-dd HH:mm:ss")}
+                    </td>
+                </tr>
+            [/#list]
+    </table>
+		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
+            [#include "/admin/include/pagination.ftl"]
+        [/@pagination]
+</form>
+<script>
+    $(document).ready(function () {
+
+        layui.use('form', function () {
+            var form = layui.form;
+        });
+        layui.use('laydate', function () {
+            var laydate = layui.laydate;
+
+            //日期时间范围
+            laydate.render({
+                elem: '#beginEndDate'
+                , type: 'datetime'
+                , range: true
+                , theme: '#d6bf3b'
+            });
+
+        });
+    });
+
+</script>
+<script>
+    /*$("#export").click(function () {
+        //获取
+        var boxs = $("input[name='ids']");
+        var array = new Array();
+        for (var i = 0; i < boxs.length; i++) {
+            //选中状态
+            if (boxs[i].checked) {
+
+                array.push(boxs[i].value);
+            }
+        }
+        if (array.length == 0) {
+            layer.msg("请选择一个");
+            return;
+        }
+        window.location.href = 'export.htm?ids=' + array;
+    });*/
+</script>
+</body>
+</html>

+ 0 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/common/error.ftl


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů