wanghongzhi 1 ano atrás
pai
commit
b0d66a23f2
46 arquivos alterados com 81 adições e 5183 exclusões
  1. 7 12
      easydo-chengfa/src/main/java/easydo/technology/config/exception/BizExceptionHandler.java
  2. 6 2
      easydo-chengfa/src/main/java/easydo/technology/controller/TestController.java
  3. 2 2
      easydo-chengfa/src/main/resources/config/application.yml
  4. 0 9
      easydo-common/src/main/java/easydo/technology/utils/MyUtil.java
  5. 0 39
      easydo-core/src/main/java/easydo/technology/core/DeviceHealthbeat.java
  6. 0 71
      easydo-core/src/main/java/easydo/technology/core/DeviceSensor.java
  7. 0 50
      easydo-core/src/main/java/easydo/technology/core/DeviceSensorRecord.java
  8. 0 79
      easydo-core/src/main/java/easydo/technology/core/DeviceStock.java
  9. 0 351
      easydo-core/src/main/java/easydo/technology/core/EasydoCore.java
  10. 0 187
      easydo-core/src/main/java/easydo/technology/core/EasydoCoreDevice.java
  11. 0 305
      easydo-core/src/main/java/easydo/technology/core/FactoryProjectInfo.java
  12. 0 117
      easydo-core/src/main/java/easydo/technology/core/FactoryProjectInfoPosition.java
  13. 0 59
      easydo-core/src/main/java/easydo/technology/core/SpringRequestUser.java
  14. 0 91
      easydo-core/src/main/java/easydo/technology/core/SysUser.java
  15. 0 61
      easydo-core/src/main/java/easydo/technology/core/ZeroCoreSpringController.java
  16. 1 1
      easydo-core/src/main/java/easydo/technology/core/ZeroSpringFolder.java
  17. 0 62
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoAuthController.java
  18. 0 157
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoDeviceController.java
  19. 0 159
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoEnterpriseController.java
  20. 0 129
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoMenusController.java
  21. 0 95
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoProjectController.java
  22. 0 118
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoRoleController.java
  23. 0 132
      easydo-core/src/main/java/easydo/technology/core/controllers/EasydoUserController.java
  24. 0 59
      easydo-core/src/main/java/easydo/technology/core/controllers/ZeroSpringUserController.java
  25. 0 111
      easydo-core/src/main/java/easydo/technology/core/processors/DeviceProcessor.java
  26. 0 710
      easydo-core/src/main/java/easydo/technology/core/processors/EasydoCoreProcessor.java
  27. 0 275
      easydo-core/src/main/java/easydo/technology/core/processors/EasydoDeviceProcessor.java
  28. 0 275
      easydo-core/src/main/java/easydo/technology/core/processors/UserProcessor.java
  29. 0 90
      easydo-core/src/main/java/easydo/technology/core/qdplat/QDPlatRequest.java
  30. 0 314
      easydo-core/src/main/java/easydo/technology/core/qdplat/QDPlatTCM.java
  31. 0 61
      easydo-core/src/main/java/easydo/technology/core/sql/device.healthbeat.sql
  32. 0 741
      easydo-core/src/main/java/easydo/technology/core/sql/easydo.sql
  33. 0 27
      easydo-core/src/main/java/easydo/technology/core/wx/EasydoWx.java
  34. 5 0
      easydo-system/src/main/java/easydo/technology/system/rest/DeptController.java
  35. 7 0
      easydo-system/src/main/java/easydo/technology/system/rest/DictController.java
  36. 6 0
      easydo-system/src/main/java/easydo/technology/system/rest/DictDetailController.java
  37. 9 0
      easydo-system/src/main/java/easydo/technology/system/rest/MenuController.java
  38. 10 0
      easydo-system/src/main/java/easydo/technology/system/rest/RoleController.java
  39. 3 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysDictController.java
  40. 2 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysUserController.java
  41. 2 0
      easydo-system/src/main/java/easydo/technology/system/rest/SysUsersRolesController.java
  42. 10 26
      easydo-system/src/main/java/easydo/technology/system/rest/UserController.java
  43. 2 1
      easydo-system/src/main/java/easydo/technology/system/rest/VerifyController.java
  44. 5 0
      easydo-system/src/main/java/easydo/technology/system/security/rest/AuthorizationController.java
  45. 4 0
      easydo-system/src/main/java/easydo/technology/system/security/rest/OnlineController.java
  46. 0 205
      easydo-system/src/main/java/easydo/technology/system/security/rest/WxAuthController.java

+ 7 - 12
easydo-chengfa/src/main/java/easydo/technology/config/exception/BizExceptionHandler.java

@@ -1,5 +1,6 @@
 package easydo.technology.config.exception;
 
+import easydo.technology.exception.BizException;
 import lombok.extern.log4j.Log4j2;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -7,6 +8,8 @@ import org.springframework.validation.BindException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -19,17 +22,9 @@ import java.util.Map;
 @Log4j2
 public class BizExceptionHandler {
 
-    /**
-     * 为 @NotNull / @NotEmpty / @NotBlank 提供异常后的消息抛出*
-     * @param bindException
-     * @return
-     */
-    @ExceptionHandler({BindException.class})
-    public ResponseEntity<Object> throwCustomException(BindException bindException){
-        log.error("[ @Vaild异常捕获 ] " + bindException.getMessage());
-        Map<String, Object> vo = new HashMap<>();
-        vo.put("message", bindException.getBindingResult().getFieldError().getDefaultMessage());
-        vo.put("code", HttpStatus.BAD_REQUEST.value());
-        return new ResponseEntity(vo, HttpStatus.OK);
+    @ExceptionHandler({Exception.class})
+    public Object handleException(Exception e, HttpServletRequest request, HttpServletResponse response) {
+        log.error("业务处理异常======>" + request.getServletPath(), e);
+        return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
     }
 }

+ 6 - 2
easydo-chengfa/src/main/java/easydo/technology/controller/TestController.java

@@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.sql.DataSource;
 
+import easydo.technology.exception.BizException;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -96,8 +97,11 @@ public class TestController {
     @WebLog
     @RequestMapping(value = "/getPage")
     public Object getPage() throws Exception {
-        redisUtils.set("test", "123456", 600);
-        log.info(redisUtils.get("test").toString());
+//        redisUtils.set("test", "123456", 600);
+//        log.info(redisUtils.get("test").toString());
+        if(true){
+            throw new BizException("122345678");
+        }
         return "success";
     }
 

+ 2 - 2
easydo-chengfa/src/main/resources/config/application.yml

@@ -42,7 +42,7 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     auto-mapping-behavior: full
-    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   mapper-locations: classpath*:/mapper/*Mapper.xml
   global-config:
     db-config:
@@ -52,7 +52,7 @@ mybatis-plus:
 mybatis:
   type-aliases-package: com.pjb.entity #别名定义
   configuration:
-    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #指定 MyBatis 所用日志的具体实现,未指定时将自动查找
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #指定 MyBatis 所用日志的具体实现,未指定时将自动查找
     map-underscore-to-camel-case: true #开启自动驼峰命名规则(camel case)映射
     lazy-loading-enabled: true #开启延时加载开关
     aggressive-lazy-loading: false #将积极加载改为消极加载(即按需加载),默认值就是false

+ 0 - 9
easydo-common/src/main/java/easydo/technology/utils/MyUtil.java

@@ -1,9 +0,0 @@
-package easydo.technology.utils;
-
-/**
- * 一些不好归类的常用工具类
- * Created by jinjin on 2020-10-01.
- */
-public class MyUtil {
-
-}

+ 0 - 39
easydo-core/src/main/java/easydo/technology/core/DeviceHealthbeat.java

@@ -1,39 +0,0 @@
-package easydo.technology.core;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.time.LocalDateTime;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author whz
- * @since 2023-02-21
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@Accessors(chain = true)
-public class DeviceHealthbeat extends Model {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(type = IdType.ASSIGN_UUID)
-    private String id;
-
-    private LocalDateTime createTime;
-
-    private LocalDateTime updateTime;
-
-    private String features;
-
-    private Integer deviceId;
-
-
-}

+ 0 - 71
easydo-core/src/main/java/easydo/technology/core/DeviceSensor.java

@@ -1,71 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class DeviceSensor extends ZeroCoreStructs {
-
-    public static final String DEVICE_UPPER_COMPUTER = "DEVICE_UPPER_COMPUTER";
-    public static final String DEVICE_UPPER_COMPLETE = "DEVICE_UPPER_COMPLETE";
-
-    private DeviceStock device;
-    private String sensorType;
-    private String sensorID;
-
-    private List<DeviceSensorRecord> records;
-
-    public DeviceSensor() {
-        super();
-    }
-
-    public DeviceSensor(ResultSet set) throws SQLException {
-        super(set);
-
-        if (inResultSet(set, "DEVICE_ID")) {
-            device = new DeviceStock();
-            device.setId(set.getInt("DEVICE_ID"));
-        }
-
-        if (inResultSet(set, "SENSOR_TYPE"))
-            sensorType = set.getString("SENSOR_TYPE");
-
-        if (inResultSet(set, "SENSOR_ID"))
-            sensorID = set.getString("SENSOR_ID");
-    }
-
-    public String getSensorType() {
-        return sensorType;
-    }
-
-    public void setSensorType(String sensorType) {
-        this.sensorType = sensorType;
-    }
-
-    public DeviceStock getDevice() {
-        return device;
-    }
-
-    public void setDevice(DeviceStock device) {
-        this.device = device;
-    }
-
-    public String getSensorID() {
-        return sensorID;
-    }
-
-    public void setSensorID(String sensorID) {
-        this.sensorID = sensorID;
-    }
-
-    public List<DeviceSensorRecord> getRecords() {
-        return records;
-    }
-
-    public void setRecords(List<DeviceSensorRecord> records) {
-        this.records = records;
-    }
-
-}

+ 0 - 50
easydo-core/src/main/java/easydo/technology/core/DeviceSensorRecord.java

@@ -1,50 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.UUID;
-
-import com.alibaba.fastjson.annotation.JSONField;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class DeviceSensorRecord extends ZeroCoreStructs {
-
-    @JSONField(format = CURACAO_DATE_FORMAT)
-    protected Date reportTime;
-
-    private DeviceSensor sensor;
-
-    public DeviceSensorRecord() {
-        super();
-    }
-
-    public DeviceSensorRecord(ResultSet set) throws SQLException {
-        super(set);
-
-        if (inResultSet(set, "REPORT_TIME"))
-            reportTime = new Date(set.getTimestamp("REPORT_TIME").getTime());
-
-        if (inResultSet(set, "SENSOR_ID")) {
-            sensor = new DeviceSensor();
-            sensor.setId(UUID.fromString(set.getString("SENSOR_ID")));
-        }
-    }
-
-    public Date getReportTime() {
-        return reportTime;
-    }
-
-    public void setReportTime(Date reportTime) {
-        this.reportTime = reportTime;
-    }
-
-    public DeviceSensor getSensor() {
-        return sensor;
-    }
-
-    public void setSensor(DeviceSensor sensor) {
-        this.sensor = sensor;
-    }
-}

+ 0 - 79
easydo-core/src/main/java/easydo/technology/core/DeviceStock.java

@@ -1,79 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.Date;
-
-import com.alibaba.fastjson.annotation.JSONField;
-
-import lombok.Getter;
-import lombok.Setter;
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-@Setter
-@Getter
-public class DeviceStock {
-
-    private long id;
-    private long category_id;
-    private long model_id;
-    private long msg_id;
-    private String device_num;
-    private long project_id;
-    private int device_status;
-    private int del_log;
-    private String remark;
-    private String device_pic;
-    private long spec_model_id;
-    private String sdplatform;
-
-    @JSONField(format = ZeroCoreStructs.CURACAO_DATE_FORMAT)
-    private Date healthbeatTime;
-
-    public DeviceStock() {
-        super();
-    }
-
-    public DeviceStock(ResultSet set) throws SQLException {
-        super();
-        if (ZeroCoreStructs.inResultSet(set, "ID"))
-            id = set.getLong("ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "CATEGORY_ID"))
-            category_id = set.getLong("CATEGORY_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "MODEL_ID"))
-            model_id = set.getLong("MODEL_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "MSG_ID"))
-            msg_id = set.getLong("MSG_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "DEVICE_NUM"))
-            device_num = set.getString("DEVICE_NUM");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_ID"))
-            project_id = set.getLong("PROJECT_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "DEVICE_STATUS"))
-            device_status = set.getInt("DEVICE_STATUS");
-
-        if (ZeroCoreStructs.inResultSet(set, "DEL_LOG"))
-            del_log = set.getInt("DEL_LOG");
-
-        if (ZeroCoreStructs.inResultSet(set, "REMARK"))
-            remark = set.getString("REMARK");
-
-        if (ZeroCoreStructs.inResultSet(set, "DEVICE_PIC"))
-            device_pic = set.getString("DEVICE_PIC");
-
-        if (ZeroCoreStructs.inResultSet(set, "SPEC_MODEL_ID"))
-            spec_model_id = set.getLong("SPEC_MODEL_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "HEALTHBEAT_TIME")) {
-            Timestamp timestamp = set.getTimestamp("HEALTHBEAT_TIME");
-            if (timestamp != null)
-                healthbeatTime = new Date(timestamp.getTime());
-        }
-    }
-}

+ 0 - 351
easydo-core/src/main/java/easydo/technology/core/EasydoCore.java

@@ -1,351 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class EasydoCore {
-
-    public static class EasydoMenu extends ZeroCoreStructs {
-
-        private int sort;
-        private List<EasydoMenu> subMenus;
-
-        public EasydoMenu() {
-            super();
-        }
-
-        public EasydoMenu(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "SORT"))
-                sort = set.getInt("SORT");
-        }
-
-        public int getSort() {
-            return sort;
-        }
-
-        public void setSort(int sort) {
-            this.sort = sort;
-        }
-
-        public List<EasydoMenu> getSubMenus() {
-            return subMenus;
-        }
-
-        public void setSubMenus(List<EasydoMenu> subMenus) {
-            this.subMenus = subMenus;
-        }
-
-    }
-
-    public static class EasydoEnterprise extends ZeroCoreStructs {
-
-        private String enterpriseName;
-        private String enterpriseCode;
-        private String enterpriseType;
-
-        private EasydoEnterprise parent;
-        private List<EasydoEnterprise> childs;
-        private List<EasydoProject> projects;
-        private List<EasydoMenu> menus;
-
-        public EasydoEnterprise() {
-            super();
-        }
-
-        public EasydoEnterprise(ResultSet set) throws SQLException {
-            super(set);
-            if (inResultSet(set, "ENTERPRISE_NAME"))
-                enterpriseName = set.getString("ENTERPRISE_NAME");
-            if (inResultSet(set, "ENTERPRISE_CODE"))
-                enterpriseCode = set.getString("ENTERPRISE_CODE");
-            if (inResultSet(set, "ENTERPRISE_TYPE"))
-                enterpriseType = set.getString("ENTERPRISE_TYPE");
-        }
-
-        public String getEnterpriseName() {
-            return enterpriseName;
-        }
-
-        public void setEnterpriseName(String enterpriseName) {
-            this.enterpriseName = enterpriseName;
-        }
-
-        public String getEnterpriseCode() {
-            return enterpriseCode;
-        }
-
-        public void setEnterpriseCode(String enterpriseCode) {
-            this.enterpriseCode = enterpriseCode;
-        }
-
-        public String getEnterpriseType() {
-            return enterpriseType;
-        }
-
-        public void setEnterpriseType(String enterpriseType) {
-            this.enterpriseType = enterpriseType;
-        }
-
-        public EasydoEnterprise getParent() {
-            return parent;
-        }
-
-        public void setParent(EasydoEnterprise parent) {
-            this.parent = parent;
-        }
-
-        public List<EasydoEnterprise> getChilds() {
-            return childs;
-        }
-
-        public void setChilds(List<EasydoEnterprise> childs) {
-            this.childs = childs;
-        }
-
-        public List<EasydoProject> getProjects() {
-            return projects;
-        }
-
-        public void setProjects(List<EasydoProject> projects) {
-            this.projects = projects;
-        }
-
-        public List<EasydoMenu> getMenus() {
-            return menus;
-        }
-
-        public void setMenus(List<EasydoMenu> menus) {
-            this.menus = menus;
-        }
-
-    }
-
-    public static class EasydoProject extends ZeroCoreStructs {
-
-        private String projectCode;
-        private String projectName;
-        private String projectType;
-        private String projectStatus;
-        private String projectScale;
-        private EasydoEnterprise enterprise;
-
-        public EasydoProject() {
-            super();
-        }
-
-        public EasydoProject(ResultSet set) throws SQLException {
-            super(set);
-            if (inResultSet(set, "PROJECT_CODE"))
-                projectCode = set.getString("PROJECT_CODE");
-
-            if (inResultSet(set, "PROJECT_NAME"))
-                projectName = set.getString("PROJECT_NAME");
-
-            if (inResultSet(set, "PROJECT_TYPE"))
-                projectType = set.getString("PROJECT_TYPE");
-
-            if (inResultSet(set, "PROJECT_STATUS"))
-                projectStatus = set.getString("PROJECT_STATUS");
-
-            if (inResultSet(set, "PROJECT_SCALE"))
-                projectScale = set.getString("PROJECT_SCALE");
-
-            if (inResultSet(set, "ENTERPRISE_ID")) {
-                enterprise = new EasydoEnterprise();
-                enterprise.setId(UUID.fromString(set.getString("ENTERPRISE_ID")));
-            }
-        }
-
-        public String getProjectCode() {
-            return projectCode;
-        }
-
-        public void setProjectCode(String projectCode) {
-            this.projectCode = projectCode;
-        }
-
-        public String getProjectName() {
-            return projectName;
-        }
-
-        public void setProjectName(String projectName) {
-            this.projectName = projectName;
-        }
-
-        public String getProjectType() {
-            return projectType;
-        }
-
-        public void setProjectType(String projectType) {
-            this.projectType = projectType;
-        }
-
-        public String getProjectStatus() {
-            return projectStatus;
-        }
-
-        public void setProjectStatus(String projectStatus) {
-            this.projectStatus = projectStatus;
-        }
-
-        public String getProjectScale() {
-            return projectScale;
-        }
-
-        public void setProjectScale(String projectScale) {
-            this.projectScale = projectScale;
-        }
-
-        public EasydoEnterprise getEnterprise() {
-            return enterprise;
-        }
-
-        public void setEnterprise(EasydoEnterprise enterprise) {
-            this.enterprise = enterprise;
-        }
-
-    }
-
-    public static class EasydoRole extends ZeroCoreStructs {
-
-        private String roleName;
-        private List<EasydoMenu> menus;
-
-        public EasydoRole() {
-            super();
-        }
-
-        public EasydoRole(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "ROLE_NAME"))
-                roleName = set.getString("ROLE_NAME");
-        }
-
-        public String getRoleName() {
-            return roleName;
-        }
-
-        public void setRoleName(String roleName) {
-            this.roleName = roleName;
-        }
-
-        public List<EasydoMenu> getMenus() {
-            return menus;
-        }
-
-        public void setMenus(List<EasydoMenu> menus) {
-            this.menus = menus;
-        }
-
-    }
-
-    public static class EasydoUser extends ZeroCoreStructs {
-
-        private String username;
-        private String password;
-        private EasydoUserInfo userInfo;
-
-        private List<EasydoRole> roles;
-
-        public EasydoUser() {
-            super();
-        }
-
-        public EasydoUser(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "USERNAME"))
-                username = set.getString("USERNAME");
-
-            if (inResultSet(set, "PASSWORD"))
-                password = set.getString("PASSWORD");
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-
-        public EasydoUserInfo getUserInfo() {
-            return userInfo;
-        }
-
-        public void setUserInfo(EasydoUserInfo userInfo) {
-            this.userInfo = userInfo;
-        }
-
-        public List<EasydoRole> getRoles() {
-            return roles;
-        }
-
-        public void setRoles(List<EasydoRole> roles) {
-            this.roles = roles;
-        }
-
-    }
-
-    public static class EasydoUserInfo extends ZeroCoreStructs {
-
-        private EasydoUser user;
-        private String nickName;
-        private Date birthday;
-
-        public EasydoUserInfo() {
-            super();
-        }
-
-        public EasydoUserInfo(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "NICK_NAME"))
-                nickName = set.getString("NICK_NAME");
-
-            if (inResultSet(set, "BIRTHDAY"))
-                birthday = new Date(set.getTimestamp("BIRTHDAY").getTime());
-        }
-
-        public EasydoUser getUser() {
-            return user;
-        }
-
-        public void setUser(EasydoUser user) {
-            this.user = user;
-        }
-
-        public String getNickName() {
-            return nickName;
-        }
-
-        public void setNickName(String nickName) {
-            this.nickName = nickName;
-        }
-
-        public Date getBirthday() {
-            return birthday;
-        }
-
-        public void setBirthday(Date birthday) {
-            this.birthday = birthday;
-        }
-
-    }
-}

+ 0 - 187
easydo-core/src/main/java/easydo/technology/core/EasydoCoreDevice.java

@@ -1,187 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import com.alibaba.fastjson.annotation.JSONField;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class EasydoCoreDevice {
-
-    public static class EasydoDevice extends ZeroCoreStructs {
-
-        private String deviceIdentifier;
-        private String deviceType;
-        private List<EasydoSensor> sensors;
-
-        private List<EasydoDeviceHealth> healths;
-
-        public EasydoDevice() {
-            super();
-        }
-
-        public EasydoDevice(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "DEVICE_IDENTIFIER"))
-                deviceIdentifier = set.getString("DEVICE_IDENTIFIER");
-
-            if (inResultSet(set, "DEVICE_TYPE"))
-                deviceType = set.getString("DEVICE_TYPE");
-        }
-
-        public String getDeviceIdentifier() {
-            return deviceIdentifier;
-        }
-
-        public void setDeviceIdentifier(String deviceIdentifier) {
-            this.deviceIdentifier = deviceIdentifier;
-        }
-
-        public String getDeviceType() {
-            return deviceType;
-        }
-
-        public void setDeviceType(String deviceType) {
-            this.deviceType = deviceType;
-        }
-
-        public List<EasydoSensor> getSensors() {
-            return sensors;
-        }
-
-        public void setSensors(List<EasydoSensor> sensors) {
-            this.sensors = sensors;
-        }
-
-        public List<EasydoDeviceHealth> getHealths() {
-            return healths;
-        }
-
-        public void setHealths(List<EasydoDeviceHealth> healths) {
-            this.healths = healths;
-        }
-    }
-
-    public static class EasydoDeviceHealth extends ZeroCoreStructs {
-
-        private EasydoDevice device;
-
-        public EasydoDeviceHealth() {
-            super();
-        }
-
-        public EasydoDeviceHealth(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "DEVICE_ID")) {
-                device = new EasydoDevice();
-                device.setId(UUID.fromString(set.getString("DEVICE_ID")));
-            }
-        }
-
-        public EasydoDevice getDevice() {
-            return device;
-        }
-
-        public void setDevice(EasydoDevice device) {
-            this.device = device;
-        }
-    }
-
-    public static class EasydoSensor extends ZeroCoreStructs {
-
-        private EasydoDevice device;
-        private String sensorIdentifier;
-        private String sensorType;
-
-        public EasydoSensor() {
-            super();
-        }
-
-        public EasydoSensor(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "DEVICE_ID")) {
-                device = new EasydoDevice();
-                device.setId(UUID.fromString(set.getString("DEVICE_ID")));
-            }
-
-            if (inResultSet(set, "SENSOR_IDENTIFIER"))
-                sensorIdentifier = set.getString("SENSOR_IDENTIFIER");
-
-            if (inResultSet(set, "SENSOR_TYPE"))
-                sensorType = set.getString("SENSOR_TYPE");
-        }
-
-        public EasydoDevice getDevice() {
-            return device;
-        }
-
-        public void setDevice(EasydoDevice device) {
-            this.device = device;
-        }
-
-        public String getSensorIdentifier() {
-            return sensorIdentifier;
-        }
-
-        public void setSensorIdentifier(String sensorIdentifier) {
-            this.sensorIdentifier = sensorIdentifier;
-        }
-
-        public String getSensorType() {
-            return sensorType;
-        }
-
-        public void setSensorType(String sensorType) {
-            this.sensorType = sensorType;
-        }
-
-    }
-
-    public static class EasydoSensorRecord extends ZeroCoreStructs {
-
-        private EasydoSensor sensor;
-
-        @JSONField(format = CURACAO_DATE_FORMAT)
-        protected Date reportTime;
-
-        public EasydoSensorRecord() {
-            super();
-        }
-
-        public EasydoSensorRecord(ResultSet set) throws SQLException {
-            super(set);
-
-            if (inResultSet(set, "SENSOR_ID")) {
-                sensor = new EasydoSensor();
-                sensor.setId(UUID.fromString(set.getString("SENSOR_ID")));
-            }
-
-            if (inResultSet(set, "REPORT_TIME"))
-                reportTime = new Date(set.getTimestamp("REPORT_TIME").getTime());
-        }
-
-        public Date getReportTime() {
-            return reportTime;
-        }
-
-        public void setReportTime(Date reportTime) {
-            this.reportTime = reportTime;
-        }
-
-        public EasydoSensor getSensor() {
-            return sensor;
-        }
-
-        public void setSensor(EasydoSensor sensor) {
-            this.sensor = sensor;
-        }
-    }
-
-}

+ 0 - 305
easydo-core/src/main/java/easydo/technology/core/FactoryProjectInfo.java

@@ -1,305 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.UUID;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class FactoryProjectInfo extends ZeroCoreStructs {
-    
-    public static final String PROJECT_META_TYPE_CORE = "PROJECT_META_TYPE_CORE";
-    public static final String PROJECT_META_TYPE_GENERAL = "PROJECT_META_TYPE_GENERAL";
-
-    private long fpiID;
-    private String status;
-    private String projectNoFpi;
-    private String projectName;
-    private String projectAddr;
-    private Date startTime;
-    private Date endTime;
-    private String resPersonName;
-    private String resPersonNo;
-    private String resPersonComp;
-    private String projectAliasName;
-    private String projectFirmName;
-    private String projectCoordinates;
-    private String projectType;
-    private String projectStatus;
-    private String projectScale;
-    private String projectMoney;
-    private String projectBackupsNumber;
-    private String projectLogo;
-    private String metatype;
-
-    private FactoryProjectInfoPosition position;
-
-    public FactoryProjectInfo() {
-        super();
-    }
-
-    public FactoryProjectInfo(ResultSet set) throws SQLException {
-        super();
-        if (ZeroCoreStructs.inResultSet(set, "FPI_ID"))
-            fpiID = set.getLong("FPI_ID");
-
-        if (ZeroCoreStructs.inResultSet(set, "STATUS"))
-            status = set.getString("STATUS");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_NO_FPI"))
-            projectNoFpi = set.getString("PROJECT_NO_FPI");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_NAME"))
-            projectName = set.getString("PROJECT_NAME");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_ADDR"))
-            projectAddr = set.getString("PROJECT_ADDR");
-
-        if (ZeroCoreStructs.inResultSet(set, "START_TIME") && set.getTimestamp("START_TIME") != null)
-            startTime = new Date(set.getTimestamp("START_TIME").getTime());
-
-        if (ZeroCoreStructs.inResultSet(set, "END_TIME") && set.getTimestamp("END_TIME") != null)
-            endTime = new Date(set.getTimestamp("END_TIME").getTime());
-
-        if (ZeroCoreStructs.inResultSet(set, "RES_PERSON_NAME"))
-            resPersonName = set.getString("RES_PERSON_NAME");
-
-        if (ZeroCoreStructs.inResultSet(set, "RES_PERSON_NO"))
-            resPersonNo = set.getString("RES_PERSON_NO");
-
-        if (ZeroCoreStructs.inResultSet(set, "RES_PERSON_COMP"))
-            resPersonComp = set.getString("RES_PERSON_COMP");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_ALIAS_NAME"))
-            projectAliasName = set.getString("PROJECT_ALIAS_NAME");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_FIRM_NAME"))
-            projectFirmName = set.getString("PROJECT_FIRM_NAME");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_COORDINATES"))
-            projectCoordinates = set.getString("PROJECT_COORDINATES");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_TYPE"))
-            projectType = set.getString("PROJECT_TYPE");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_STATUS"))
-            projectStatus = set.getString("PROJECT_STATUS");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_SCALE"))
-            projectScale = set.getString("PROJECT_SCALE");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_MONEY"))
-            projectMoney = set.getString("PROJECT_MONEY");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_BACKUPS_NUMBER"))
-            projectBackupsNumber = set.getString("PROJECT_BACKUPS_NUMBER");
-
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_LOGO"))
-            projectLogo = set.getString("PROJECT_LOGO");
-
-        if (ZeroCoreStructs.inResultSet(set, "METATYPE"))
-            metatype = set.getString("METATYPE");
-
-    }
-
-    @Override
-    public final void setId(UUID id) {
-    }
-
-    @Override
-    public UUID getId() {
-        return null;
-    }
-
-    @Override
-    public String uuIDString() {
-        return null;
-    }
-
-    @Override
-    public void setCreateTime(Date createTime) {
-    }
-
-    @Override
-    public Date getCreateTime() {
-        return null;
-    }
-
-    @Override
-    public void setUpdateTime(Date updateTime) {
-    }
-
-    @Override
-    public Date getUpdateTime() {
-        return null;
-    }
-
-    public long getFpiID() {
-        return fpiID;
-    }
-
-    public void setFpiID(long fpiID) {
-        this.fpiID = fpiID;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    public String getProjectNoFpi() {
-        return projectNoFpi;
-    }
-
-    public void setProjectNoFpi(String projectNoFpi) {
-        this.projectNoFpi = projectNoFpi;
-    }
-
-    public String getProjectName() {
-        return projectName;
-    }
-
-    public void setProjectName(String projectName) {
-        this.projectName = projectName;
-    }
-
-    public String getProjectAddr() {
-        return projectAddr;
-    }
-
-    public void setProjectAddr(String projectAddr) {
-        this.projectAddr = projectAddr;
-    }
-
-    public Date getStartTime() {
-        return startTime;
-    }
-
-    public void setStartTime(Date startTime) {
-        this.startTime = startTime;
-    }
-
-    public Date getEndTime() {
-        return endTime;
-    }
-
-    public void setEndTime(Date endTime) {
-        this.endTime = endTime;
-    }
-
-    public String getResPersonName() {
-        return resPersonName;
-    }
-
-    public void setResPersonName(String resPersonName) {
-        this.resPersonName = resPersonName;
-    }
-
-    public String getResPersonNo() {
-        return resPersonNo;
-    }
-
-    public void setResPersonNo(String resPersonNo) {
-        this.resPersonNo = resPersonNo;
-    }
-
-    public String getResPersonComp() {
-        return resPersonComp;
-    }
-
-    public void setResPersonComp(String resPersonComp) {
-        this.resPersonComp = resPersonComp;
-    }
-
-    public String getProjectAliasName() {
-        return projectAliasName;
-    }
-
-    public void setProjectAliasName(String projectAliasName) {
-        this.projectAliasName = projectAliasName;
-    }
-
-    public String getProjectFirmName() {
-        return projectFirmName;
-    }
-
-    public void setProjectFirmName(String projectFirmName) {
-        this.projectFirmName = projectFirmName;
-    }
-
-    public String getProjectCoordinates() {
-        return projectCoordinates;
-    }
-
-    public void setProjectCoordinates(String projectCoordinates) {
-        this.projectCoordinates = projectCoordinates;
-    }
-
-    public String getProjectType() {
-        return projectType;
-    }
-
-    public void setProjectType(String projectType) {
-        this.projectType = projectType;
-    }
-
-    public String getProjectStatus() {
-        return projectStatus;
-    }
-
-    public void setProjectStatus(String projectStatus) {
-        this.projectStatus = projectStatus;
-    }
-
-    public String getProjectScale() {
-        return projectScale;
-    }
-
-    public void setProjectScale(String projectScale) {
-        this.projectScale = projectScale;
-    }
-
-    public String getProjectMoney() {
-        return projectMoney;
-    }
-
-    public void setProjectMoney(String projectMoney) {
-        this.projectMoney = projectMoney;
-    }
-
-    public String getProjectBackupsNumber() {
-        return projectBackupsNumber;
-    }
-
-    public void setProjectBackupsNumber(String projectBackupsNumber) {
-        this.projectBackupsNumber = projectBackupsNumber;
-    }
-
-    public String getProjectLogo() {
-        return projectLogo;
-    }
-
-    public void setProjectLogo(String projectLogo) {
-        this.projectLogo = projectLogo;
-    }
-
-    public FactoryProjectInfoPosition getPosition() {
-        return position;
-    }
-
-    public void setPosition(FactoryProjectInfoPosition position) {
-        this.position = position;
-    }
-
-    public String getMetatype() {
-        return metatype;
-    }
-
-    public void setMetatype(String metatype) {
-        this.metatype = metatype;
-    }
-}

+ 0 - 117
easydo-core/src/main/java/easydo/technology/core/FactoryProjectInfoPosition.java

@@ -1,117 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-public class FactoryProjectInfoPosition extends ZeroCoreStructs {
-
-    private FactoryProjectInfo projectInfo;
-    private String province;
-    private String city;
-    private String region;
-    private String street;
-    private String address;
-
-    private long longitude;
-    private long latitude;
-
-    public FactoryProjectInfoPosition() {
-        super();
-    }
-
-    public FactoryProjectInfoPosition(ResultSet set) throws SQLException {
-        super();
-        if (ZeroCoreStructs.inResultSet(set, "PROJECT_ID")) {
-            projectInfo = new FactoryProjectInfo();
-            projectInfo.setFpiID(set.getLong("PROJECT_ID"));
-        }
-
-        if (ZeroCoreStructs.inResultSet(set, "PROVINCE"))
-            province = set.getString("PROVINCE");
-
-        if (ZeroCoreStructs.inResultSet(set, "CITY"))
-            city = set.getString("CITY");
-
-        if (ZeroCoreStructs.inResultSet(set, "REGION"))
-            region = set.getString("REGION");
-
-        if (ZeroCoreStructs.inResultSet(set, "STREET"))
-            street = set.getString("STREET");
-
-        if (ZeroCoreStructs.inResultSet(set, "ADDRESS"))
-            address = set.getString("ADDRESS");
-
-        if (ZeroCoreStructs.inResultSet(set, "LONGITUDE"))
-            longitude = set.getLong("LONGITUDE");
-
-        if (ZeroCoreStructs.inResultSet(set, "LATITUDE"))
-            latitude = set.getLong("LATITUDE");
-    }
-
-    public FactoryProjectInfo getProjectInfo() {
-        return projectInfo;
-    }
-
-    public void setProjectInfo(FactoryProjectInfo projectInfo) {
-        this.projectInfo = projectInfo;
-    }
-
-    public String getProvince() {
-        return province;
-    }
-
-    public void setProvince(String province) {
-        this.province = province;
-    }
-
-    public String getCity() {
-        return city;
-    }
-
-    public void setCity(String city) {
-        this.city = city;
-    }
-
-    public String getRegion() {
-        return region;
-    }
-
-    public void setRegion(String region) {
-        this.region = region;
-    }
-
-    public String getStreet() {
-        return street;
-    }
-
-    public void setStreet(String street) {
-        this.street = street;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public void setAddress(String address) {
-        this.address = address;
-    }
-
-    public long getLongitude() {
-        return longitude;
-    }
-
-    public void setLongitude(long longitude) {
-        this.longitude = longitude;
-    }
-
-    public long getLatitude() {
-        return latitude;
-    }
-
-    public void setLatitude(long latitude) {
-        this.latitude = latitude;
-    }
-
-}

+ 0 - 59
easydo-core/src/main/java/easydo/technology/core/SpringRequestUser.java

@@ -1,59 +0,0 @@
-package easydo.technology.core;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import easydo.technology.utils.SecurityUtils;
-import zmo.technology.lite.core.ZeroException;
-
-public  class SpringRequestUser {
-    private long userID;
-    private long deptID;
-    private List<FactoryProjectInfo> projectInfos;
-    private boolean projectUser;
-
-    public SpringRequestUser() throws ZeroException {
-        super();
-        try {
-            projectUser = false;
-            userID = SecurityUtils.getCurrentUserId();
-        } catch (Exception e) {
-            throw new ZeroException(30112, e.toString());
-        }
-    }
-
-    public long getUserID() {
-        return userID;
-    }
-
-    public void setDeptID(long deptID) {
-        this.deptID = deptID;
-    }
-
-    public long getDeptID() {
-        return deptID;
-    }
-
-    public void addProjectInfo(FactoryProjectInfo projectInfo) {
-        projectInfos = new ArrayList<>();
-        projectInfos.add(projectInfo);
-        projectUser = true;
-    }
-
-    public void setProjectInfos(List<FactoryProjectInfo> projectInfos) {
-        this.projectInfos = projectInfos;
-    }
-
-    public List<FactoryProjectInfo> getProjectInfos() {
-        return projectInfos;
-    }
-
-    public void setProjectUser(boolean projectUser) {
-        this.projectUser = projectUser;
-    }
-
-    public boolean isProjectUser() {
-        return projectUser;
-    }
-}
-

+ 0 - 91
easydo-core/src/main/java/easydo/technology/core/SysUser.java

@@ -1,91 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-
-import lombok.Getter;
-import lombok.Setter;
-import zmo.technology.lite.core.ZeroCoreStructs;
-
-@Setter
-@Getter
-public class SysUser extends ZeroCoreStructs {
-
-    private Long userID;
-    private Long deptID;
-    private String username;
-    private String nickName;
-    private String gender;
-    private String phone;
-    private String email;
-    private String avatarName;
-    private String avatarPath;
-    private Long enabled;
-    private String createBy;
-    private String updateBy;
-    private Date pwdResetTime;
-    private Date createTime;
-    private Date updateTime;
-    private Integer projectFpiID;
-    private String projectUserType;
-
-    public SysUser() {
-        super();
-    }
-
-    public SysUser(ResultSet set) throws SQLException {
-        super(set);
-
-        if (inResultSet(set, "USER_ID") && set.getObject("USER_ID") != null)
-            userID = set.getLong("USER_ID");
-
-        if (inResultSet(set, "DEPT_ID") && set.getObject("DEPT_ID") != null)
-            deptID = set.getLong("DEPT_ID");
-
-        if (inResultSet(set, "USERNAME"))
-            username = set.getString("USERNAME");
-
-        if (inResultSet(set, "NICK_NAME"))
-            nickName = set.getString("NICK_NAME");
-
-        if (inResultSet(set, "GENDER"))
-            gender = set.getString("GENDER");
-
-        if (inResultSet(set, "PHONE"))
-            phone = set.getString("PHONE");
-
-        if (inResultSet(set, "EMAIL"))
-            email = set.getString("EMAIL");
-
-        if (inResultSet(set, "AVATAR_NAME"))
-            avatarName = set.getString("AVATAR_NAME");
-
-        if (inResultSet(set, "AVATAR_PATH"))
-            avatarPath = set.getString("AVATAR_PATH");
-
-        if (inResultSet(set, "ENABLED") && set.getObject("ENABLED") != null)
-            enabled = set.getLong("ENABLED");
-
-        if (inResultSet(set, "CREATE_BY"))
-            createBy = set.getString("CREATE_BY");
-
-        if (inResultSet(set, "UPDATE_BY"))
-            updateBy = set.getString("UPDATE_BY");
-
-        if (inResultSet(set, "PWD_RESET_TIME") && set.getObject("PWD_RESET_TIME") != null)
-            pwdResetTime = new Date(set.getTimestamp("PWD_RESET_TIME").getTime());
-
-        if (inResultSet(set, "CREATE_TIME") && set.getObject("CREATE_TIME") != null)
-            createTime = new Date(set.getTimestamp("CREATE_TIME").getTime());
-
-        if (inResultSet(set, "UPDATE_TIME") && set.getObject("UPDATE_TIME") != null)
-            updateTime = new Date(set.getTimestamp("UPDATE_TIME").getTime());
-
-        if (inResultSet(set, "PROJECT_FPI_ID") && set.getObject("PROJECT_FPI_ID") != null)
-            projectFpiID = set.getInt("PROJECT_FPI_ID");
-
-        if (inResultSet(set, "PROJECT_USER_TYPE"))
-            projectUserType = set.getString("PROJECT_USER_TYPE");
-    }
-}

+ 0 - 61
easydo-core/src/main/java/easydo/technology/core/ZeroCoreSpringController.java

@@ -1,61 +0,0 @@
-package easydo.technology.core;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import easydo.technology.core.processors.UserProcessor;
-import zmo.technology.lite.core.ZeroController;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-public abstract class ZeroCoreSpringController extends ZeroController {
-
-    public static final String REQUEST_USER = "REQUEST_USER";
-
-    protected ZeroCoreSpringController(String prefix) {
-        super(prefix);
-    }
-
-    private void fetchChildDeptProjects(UserProcessor userProcessor, SpringRequestUser user, Long deptID)
-            throws SQLException {
-        Set<Long> childIds = userProcessor.fetchChildDeptIDs(deptID);
-        if (!childIds.isEmpty()) {
-            user.getProjectInfos().addAll(userProcessor.fetchChildDeptProjectInfos(deptID));
-            for (Long childId : childIds)
-                fetchChildDeptProjects(userProcessor, user, childId);
-        }
-    }
-
-    @Override
-    protected void before(ZeroRequestGuider guider) throws Exception {
-        UserProcessor userProcessor = UserProcessor.build(guider);
-        SpringRequestUser user = new SpringRequestUser();
-        userProcessor.fetchUserProjectInfos(user);
-        if (user.getDeptID() == 1) {
-            user.setProjectUser(false);
-            userProcessor.fetchAllProjectInfos(user);
-        } else if (!user.isProjectUser()) {
-            userProcessor.fetchDeptProjectInfos(user);
-            fetchChildDeptProjects(userProcessor, user, user.getDeptID());
-        }
-        //查询用户授权项目
-        List<FactoryProjectInfo> authProjectList = userProcessor.fetchUserAuthProjectList(user.getUserID());
-        if (!authProjectList.isEmpty()) {
-            List<FactoryProjectInfo> existList;
-            if (user.getProjectInfos() != null) {
-                existList = user.getProjectInfos();
-            } else {
-                existList = new ArrayList<>();
-            }
-            existList.addAll(authProjectList);
-            user.setProjectInfos(existList);
-        }
-        if (user.getProjectInfos() != null) {
-            for (FactoryProjectInfo projectInfo : user.getProjectInfos()) {
-                userProcessor.fetchAllProjectInfoPosition(projectInfo);
-            }
-        }
-        guider.addJSONStaging(REQUEST_USER, user);
-    }
-}

+ 1 - 1
easydo-core/src/main/java/easydo/technology/core/ZeroSpringFolder.java

@@ -27,7 +27,7 @@ import zmo.technology.lite.core.ZeroException;
 import zmo.technology.lite.core.ZeroFolders;
 import zmo.technology.lite.core.ZeroFolders.ZeroFolderContainer;
 
-public abstract class ZeroSpringFolder<T extends ZeroSpringFolder<?>> extends Model<T> {
+public abstract class ZeroSpringFolder<T extends ZeroSpringFolder<?>> {
 
     public static class ZeroFoldersJacksonDeserializer extends JsonDeserializer<ZeroJacksonFolders> {
 

+ 0 - 62
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoAuthController.java

@@ -1,62 +0,0 @@
-package easydo.technology.core.controllers;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import easydo.technology.core.EasydoCore.EasydoUser;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoAuthController.AUTH_PREFIX)
-public class EasydoAuthController extends ZeroCoreSpringController {
-
-    public static final String AUTH_PREFIX = "auth";
-
-    public EasydoAuthController() {
-        super(AUTH_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void login(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        guider.write(success());
-    }
-
-    public void reset(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        guider.write(success());
-    }
-
-    public void info(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        guider.write(success());
-    }
-}

+ 0 - 157
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoDeviceController.java

@@ -1,157 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCoreDevice.EasydoDevice;
-import easydo.technology.core.EasydoCoreDevice.EasydoSensor;
-import easydo.technology.core.EasydoCoreDevice.EasydoSensorRecord;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoDeviceProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoDeviceController.DEVICE_PREFIX)
-public class EasydoDeviceController extends ZeroCoreSpringController {
-
-    public static final String DEVICE_PREFIX = "device";
-
-    public EasydoDeviceController() {
-        super(DEVICE_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void add(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoDevice> request = ZeroRequest.build(EasydoDevice.class, guider.getRawData());
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-        for (EasydoDevice device : request.getQuerys())
-            processor.addDeivce(device);
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoDevice> request = ZeroRequest.build(EasydoDevice.class, guider.getRawData());
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-        for (EasydoDevice device : request.getQuerys())
-            processor.upDeivce(device);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoDevice> request = ZeroRequest.build(EasydoDevice.class, guider.getRawData());
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-        for (EasydoDevice device : request.getQuerys())
-            processor.rmDeivce(device);
-        guider.write(success());
-    }
-
-    public void addsensor(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoSensor> request = ZeroRequest.build(EasydoSensor.class, guider.getRawData());
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-        for (EasydoSensor sensor : request.getQuerys()) {
-            processor.addSensor(sensor);
-        }
-        guider.write(success());
-    }
-
-    public void rmsensor(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoSensor> request = ZeroRequest.build(EasydoSensor.class, guider.getRawData());
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-        for (EasydoSensor sensor : request.getQuerys()) {
-            processor.rmSensor(sensor);
-        }
-        guider.write(success());
-    }
-
-    protected static final String OPTION_SENSOR = "sensor";
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoDevice>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoDevice.class);
-
-        ZeroQueryOperation<EasydoDevice> operation = ZeroQueryOperation.build(EasydoDevice.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_project"));
-
-        List<EasydoDevice> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoDevice data = operation.getCurrent();
-            if (request.hasOption(OPTION_SENSOR))
-                processor.fetchSensorByDeviceID(data);
-            processor.fetchDeivceHealth(data);
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-
-    public void devsen(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoSensor>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoSensor.class);
-
-        ZeroQueryOperation<EasydoSensor> operation = ZeroQueryOperation.build(EasydoSensor.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_sensor"));
-
-        List<EasydoSensor> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoSensor data = operation.getCurrent();
-            data.setDevice(processor.fetchDeviceByID(data.getDevice().uuIDString()));
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-
-    public void senrec(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoSensorRecord>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoSensorRecord.class);
-
-        ZeroQueryOperation<EasydoSensorRecord> operation = ZeroQueryOperation.build(EasydoSensorRecord.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_sensor_record"));
-
-        List<EasydoSensorRecord> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoDeviceProcessor processor = EasydoDeviceProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoSensorRecord data = operation.getCurrent();
-            data.setSensor(processor.fetchSensorByID(data.getSensor().uuIDString()));
-            data.getSensor().setDevice(processor.fetchDeviceByID(data.getSensor().getDevice().uuIDString()));
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 159
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoEnterpriseController.java

@@ -1,159 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCore.EasydoEnterprise;
-import easydo.technology.core.EasydoCore.EasydoMenu;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoEnterpriseController.ENTERPRISE_PREFIX)
-public class EasydoEnterpriseController extends ZeroCoreSpringController {
-
-    public static final String ENTERPRISE_PREFIX = "enterprise";
-
-    public EasydoEnterpriseController() {
-        super(ENTERPRISE_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void add(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys())
-            processor.addEnterprise(enterprise);
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys())
-            processor.upEnterprise(enterprise);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys())
-            processor.rmEnterprise(enterprise);
-        guider.write(success());
-    }
-
-    public void addsubep(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys()) {
-            for (EasydoEnterprise subenterprise : enterprise.getChilds()) {
-                if (subenterprise.getId() == null)
-                    processor.addEnterprise(subenterprise);
-                processor.addEnterpriseRelevancy(enterprise.uuIDString(), subenterprise.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    public void rmsubep(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys()) {
-            for (EasydoEnterprise subenterprise : enterprise.getChilds()) {
-                processor.rmEnterpriseRelevancy(enterprise.uuIDString(), subenterprise.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    public void addepmenus(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys()) {
-            for (EasydoMenu menu : enterprise.getMenus()) {
-                processor.addEnterpriseMenus(enterprise.uuIDString(), menu.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    public void rmepmenus(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoEnterprise> request = ZeroRequest.build(EasydoEnterprise.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoEnterprise enterprise : request.getQuerys()) {
-            for (EasydoMenu menu : enterprise.getMenus()) {
-                processor.rmEnterpriseMenus(enterprise.uuIDString(), menu.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    protected static final String OPTION_ROOT = "root";
-    protected static final String OPTION_RECURSION = "recursion";
-
-    protected static final String OPTION_MENUS = "menus";
-    protected static final String OPTION_PROJECTS = "projects";
-
-    private void recursionEnterprises(EasydoCoreProcessor processor, EasydoEnterprise enterprise) throws SQLException {
-        processor.fetchSubEnterprises(enterprise);
-        for (EasydoEnterprise subenterprise : enterprise.getChilds())
-            recursionEnterprises(processor, subenterprise);
-    }
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoEnterprise>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoEnterprise.class);
-
-        ZeroQueryOperation<EasydoEnterprise> operation = ZeroQueryOperation.build(EasydoEnterprise.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_enterprise_view"));
-        if (request.hasOption(OPTION_ROOT))
-            operation.appendCondition(() -> "ENTERPRISE_ID IS NULL");
-
-        List<EasydoEnterprise> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoEnterprise data = operation.getCurrent();
-            if (request.hasOption(OPTION_RECURSION))
-                recursionEnterprises(processor, data);
-            if (request.hasOption(OPTION_PROJECTS))
-                processor.fetchEnterpriseProjects(data);
-            if (request.hasOption(OPTION_MENUS))
-                processor.fetchEnterpriseMenus(data);
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 129
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoMenusController.java

@@ -1,129 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCore.EasydoMenu;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoMenusController.MENUS_PREFIX)
-public class EasydoMenusController extends ZeroCoreSpringController {
-
-    public static final String MENUS_PREFIX = "menus";
-
-    public EasydoMenusController() {
-        super(MENUS_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void add(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoMenu> request = ZeroRequest.build(EasydoMenu.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoMenu menu : request.getQuerys())
-            processor.addMenus(menu);
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoMenu> request = ZeroRequest.build(EasydoMenu.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoMenu menu : request.getQuerys())
-            processor.upMenu(menu);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoMenu> request = ZeroRequest.build(EasydoMenu.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoMenu menu : request.getQuerys())
-            processor.rmMenu(menu);
-        guider.write(success());
-    }
-
-    public void addsubmenu(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoMenu> request = ZeroRequest.build(EasydoMenu.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoMenu menu : request.getQuerys()) {
-            for (EasydoMenu submenu : menu.getSubMenus()) {
-                if (submenu.getId() == null)
-                    processor.addMenus(submenu);
-                processor.addMenusRelevancy(menu.uuIDString(), submenu.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    public void rmsubmenu(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoMenu> request = ZeroRequest.build(EasydoMenu.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoMenu menu : request.getQuerys()) {
-            for (EasydoMenu submenu : menu.getSubMenus()) {
-                processor.rmMenusRelevancy(menu.uuIDString(), submenu.uuIDString());
-            }
-        }
-        guider.write(success());
-    }
-
-    protected static final String OPTION_ROOT = "root";
-    protected static final String OPTION_RECURSION = "recursion";
-
-    private void recursionMenus(EasydoCoreProcessor processor, EasydoMenu menu) throws SQLException {
-        processor.fetchSubMenus(menu);
-        for (EasydoMenu submenu : menu.getSubMenus())
-            recursionMenus(processor, submenu);
-    }
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoMenu>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoMenu.class);
-
-        ZeroQueryOperation<EasydoMenu> operation = ZeroQueryOperation.build(EasydoMenu.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_menus_view"));
-        if (request.hasOption(OPTION_ROOT))
-            operation.appendCondition(() -> "MENU_ID IS NULL");
-
-        List<EasydoMenu> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoMenu data = operation.getCurrent();
-            if (request.hasOption(OPTION_RECURSION))
-                recursionMenus(processor, data);
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 95
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoProjectController.java

@@ -1,95 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCore.EasydoProject;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoProjectController.PROJECTS_PREFIX)
-public class EasydoProjectController extends ZeroCoreSpringController {
-
-    public static final String PROJECTS_PREFIX = "projects";
-
-    public EasydoProjectController() {
-        super(PROJECTS_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void add(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoProject> request = ZeroRequest.build(EasydoProject.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoProject project : request.getQuerys())
-            processor.addProject(project);
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoProject> request = ZeroRequest.build(EasydoProject.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoProject project : request.getQuerys())
-            processor.upProject(project);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoProject> request = ZeroRequest.build(EasydoProject.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoProject project : request.getQuerys())
-            processor.rmProject(project);
-        guider.write(success());
-    }
-
-    protected static final String OPTION_ENTERPRISE = "enterprise";
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoProject>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoProject.class);
-
-        ZeroQueryOperation<EasydoProject> operation = ZeroQueryOperation.build(EasydoProject.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_project"));
-
-        List<EasydoProject> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoProject data = operation.getCurrent();
-            if (request.hasOption(OPTION_ENTERPRISE))
-                data.setEnterprise(processor.fetchEnterpriseByID(data.getEnterprise().uuIDString()));
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 118
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoRoleController.java

@@ -1,118 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCore.EasydoMenu;
-import easydo.technology.core.EasydoCore.EasydoRole;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoRoleController.ROLES_PREFIX)
-public class EasydoRoleController extends ZeroCoreSpringController {
-    
-    public static final String ROLES_PREFIX = "roles";
-
-    public EasydoRoleController() {
-        super(ROLES_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void create(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoRole> request = ZeroRequest.build(EasydoRole.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoRole role : request.getQuerys())
-            processor.addRole(role);
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoRole> request = ZeroRequest.build(EasydoRole.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoRole role : request.getQuerys())
-            processor.upRole(role);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoRole> request = ZeroRequest.build(EasydoRole.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoRole role : request.getQuerys())
-            processor.rmRole(role);
-        guider.write(success());
-    }
-
-    public void addmenu(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoRole> request = ZeroRequest.build(EasydoRole.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoRole role : request.getQuerys()) {
-            if (role.getMenus() != null)
-                for (EasydoMenu menu : role.getMenus())
-                    processor.addRoleMenus(role.uuIDString(), menu.uuIDString());
-        }
-        guider.write(success());
-    }
-
-    public void rmmenu(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoRole> request = ZeroRequest.build(EasydoRole.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoRole role : request.getQuerys()) {
-            if (role.getMenus() != null)
-                for (EasydoMenu menu : role.getMenus())
-                    processor.rmRoleMenus(role.uuIDString(), menu.uuIDString());
-        }
-        guider.write(success());
-    }
-
-    protected static final String OPTION_MENUS = "menus";
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoRole>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoRole.class);
-
-        ZeroQueryOperation<EasydoRole> operation = ZeroQueryOperation.build(EasydoRole.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_roles"));
-
-        List<EasydoRole> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoRole data = operation.getCurrent();
-            if (request.hasOption(OPTION_MENUS))
-                processor.fetchRoleMenus(data);
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 132
easydo-core/src/main/java/easydo/technology/core/controllers/EasydoUserController.java

@@ -1,132 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.EasydoCore.EasydoRole;
-import easydo.technology.core.EasydoCore.EasydoUser;
-import easydo.technology.core.ZeroCoreSpringController;
-import easydo.technology.core.processors.EasydoCoreProcessor;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroQuery;
-import zmo.technology.lite.core.ZeroQueryOperation;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-// @Controller
-// @RequestMapping(EasydoUserController.USERS_PREFIX)
-public class EasydoUserController extends ZeroCoreSpringController {
-
-    public static final String USERS_PREFIX = "users";
-
-    public EasydoUserController() {
-        super(USERS_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void create(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys()) {
-            processor.addUser(user);
-            if (user.getUserInfo() != null) {
-                user.getUserInfo().setUser(user);
-                processor.addUserInfo(user.getUserInfo());
-            }
-        }
-        guider.write(success());
-    }
-
-    public void up(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys())
-            processor.upUser(user);
-        guider.write(success());
-    }
-
-    public void reset(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys())
-            processor.resetUserPassword(user);
-        guider.write(success());
-    }
-
-    public void rm(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys())
-            processor.rmUser(user);
-        guider.write(success());
-    }
-
-    public void addrole(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys()) {
-            if (user.getRoles() != null)
-                for (EasydoRole role : user.getRoles())
-                    processor.addUserRole(user.uuIDString(), role.uuIDString());
-        }
-        guider.write(success());
-    }
-
-    public void rmrole(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<EasydoUser> request = ZeroRequest.build(EasydoUser.class, guider.getRawData());
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-        for (EasydoUser user : request.getQuerys()) {
-            if (user.getRoles() != null)
-                for (EasydoRole role : user.getRoles())
-                    processor.rmUserRole(user.uuIDString(), role.uuIDString());
-        }
-        guider.write(success());
-    }
-
-    protected static final String OPTION_ROLES = "roles";
-
-    public void fetch(ZeroRequestGuider guider) throws Exception {
-
-        ZeroRequest<ZeroQuery<EasydoUser>> request = ZeroRequest.build(guider.getRawData(),
-                EasydoUser.class);
-
-        ZeroQueryOperation<EasydoUser> operation = ZeroQueryOperation.build(EasydoUser.class, guider);
-        operation.openConnect(request.getQuerys().get(0).setTableName("easydo_users"));
-
-        List<EasydoUser> datas = new ArrayList<>();
-        JSONObject expands = new JSONObject();
-        EasydoCoreProcessor processor = EasydoCoreProcessor.build(guider);
-
-        operation.exec(() -> {
-            EasydoUser data = operation.getCurrent();
-            processor.fetchUserInfoByUserID(data);
-            if (request.hasOption(OPTION_ROLES))
-                processor.fetchUserRoles(data);
-            datas.add(data);
-        }).eachExpands((key, value) -> expands.put(key, value));
-        guider.write(success(datas, expands));
-    }
-}

+ 0 - 59
easydo-core/src/main/java/easydo/technology/core/controllers/ZeroSpringUserController.java

@@ -1,59 +0,0 @@
-package easydo.technology.core.controllers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import easydo.technology.core.SpringRequestUser;
-import easydo.technology.core.ZeroCoreSpringController;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-@Controller
-@RequestMapping(ZeroSpringUserController.ZUSER_PREFIX)
-public class ZeroSpringUserController extends ZeroCoreSpringController {
-
-    public static final String ZUSER_PREFIX = "zuser";
-
-    public ZeroSpringUserController() {
-        super(ZUSER_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() != 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    public void projects(ZeroRequestGuider guider) throws Exception {
-        SpringRequestUser user = guider.fetchJSONStaging(REQUEST_USER, SpringRequestUser.class);
-        if (user.getProjectInfos().isEmpty())
-            throw new ZeroException("access denied");
-        guider.write(success(user.getProjectInfos()));
-    }
-    
-    public void infos(ZeroRequestGuider guider) throws Exception {
-        SpringRequestUser user = guider.fetchJSONStaging(REQUEST_USER, SpringRequestUser.class);
-        if (user.getProjectInfos().isEmpty())
-            throw new ZeroException("access denied"); 
-        List<SpringRequestUser> users = new ArrayList<>();
-        users.add(user);
-        guider.write(success(users));
-    }
-}

+ 0 - 111
easydo-core/src/main/java/easydo/technology/core/processors/DeviceProcessor.java

@@ -1,111 +0,0 @@
-package easydo.technology.core.processors;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.DeviceStock;
-import zmo.technology.lite.core.ZeroProcessor;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-public class DeviceProcessor extends ZeroProcessor {
-
-    protected DeviceProcessor(ZeroRequestGuider guider) {
-        super(guider);
-    }
-
-    public static DeviceProcessor build(ZeroRequestGuider guider) {
-        return new DeviceProcessor(guider);
-    }
-
-    //// device
-
-    private PreparedStatement fetchDeviceByIDPrepared() throws SQLException {
-        final String fetchDeviceByID = "SELECT * FROM device_stock_view WHERE id = ?";
-        if (!existsPreparedStatement(fetchDeviceByID))
-            registeyPreparedStatement(fetchDeviceByID);
-        return preparedStatement(fetchDeviceByID);
-    }
-
-    public DeviceStock fetchDeviceByID(long deviceID) throws SQLException {
-        fetchDeviceByIDPrepared().setLong(1, deviceID);
-        ResultSet set = fetchDeviceByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("device id '" + deviceID + "' not found");
-        return new DeviceStock(set);
-    }
-
-    private PreparedStatement fetchDevicePrepared() throws SQLException {
-        final String fetchDevice = "SELECT * FROM device_stock_view WHERE device_num = ?";
-        if (!existsPreparedStatement(fetchDevice))
-            registeyPreparedStatement(fetchDevice);
-        return preparedStatement(fetchDevice);
-    }
-
-    public DeviceStock fetchDevice(String deviceNum) throws SQLException {
-        fetchDevicePrepared().setString(1, deviceNum);
-        ResultSet set = fetchDevicePrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("device '" + deviceNum + "' not found");
-        return new DeviceStock(set);
-    }
-
-    ///// healthbeat
-
-    private PreparedStatement addHealthbeatPrepared() throws SQLException {
-        final String addHealthbeat = "INSERT INTO device_healthbeat(features, device_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addHealthbeat))
-            registeyPreparedStatement(addHealthbeat);
-        return preparedStatement(addHealthbeat);
-    }
-
-    private PreparedStatement upHealthbeatPrepared() throws SQLException {
-        final String upHealthbeat = "UPDATE device_healthbeat SET features = ? WHERE device_id = ? AND ID <> ''";
-        if (!existsPreparedStatement(upHealthbeat))
-            registeyPreparedStatement(upHealthbeat);
-        return preparedStatement(upHealthbeat);
-    }
-
-    private PreparedStatement fetchHealthbeatCountPrepared() throws SQLException {
-        final String fetchHealthbeatCount = "SELECT count(1) FROM device_healthbeat WHERE device_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchHealthbeatCount))
-            registeyPreparedStatement(fetchHealthbeatCount);
-        return preparedStatement(fetchHealthbeatCount);
-    }
-
-    public void onHealthbeat(JSONObject features, long deviceID) throws SQLException {
-        fetchHealthbeatCountPrepared().setLong(1, deviceID);
-        ResultSet set = fetchHealthbeatCountPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("query 'fetchHealthbeatCount' faild");
-
-        if (set.getLong(1) > 0) {
-            upHealthbeatPrepared().setString(1, JSONObject.toJSONString(features));
-            upHealthbeatPrepared().setLong(2, deviceID);
-            upHealthbeatPrepared().execute();
-        } else {
-            addHealthbeatPrepared().setString(1, JSONObject.toJSONString(features));
-            addHealthbeatPrepared().setLong(2, deviceID);
-            addHealthbeatPrepared().execute();
-        }
-
-    }
-
-    private PreparedStatement fetchHealthbeatPrepared() throws SQLException {
-        final String fetchHealthbeat = "SELECT update_time FROM device_healthbeat WHERE device_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchHealthbeat))
-            registeyPreparedStatement(fetchHealthbeat);
-        return preparedStatement(fetchHealthbeat);
-    }
-
-    public Date fetchHealthbeat(long deviceID) throws SQLException {
-        fetchHealthbeatPrepared().setLong(1, deviceID);
-        ResultSet set = fetchHealthbeatPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("device '" + deviceID + "' not found");
-        return new Date(set.getTimestamp(1).getTime());
-    }
-}

+ 0 - 710
easydo-core/src/main/java/easydo/technology/core/processors/EasydoCoreProcessor.java

@@ -1,710 +0,0 @@
-package easydo.technology.core.processors;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import easydo.technology.core.EasydoCore.EasydoEnterprise;
-import easydo.technology.core.EasydoCore.EasydoMenu;
-import easydo.technology.core.EasydoCore.EasydoProject;
-import easydo.technology.core.EasydoCore.EasydoRole;
-import easydo.technology.core.EasydoCore.EasydoUser;
-import easydo.technology.core.EasydoCore.EasydoUserInfo;
-import zmo.technology.lite.core.ZeroProcessor;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-public class EasydoCoreProcessor extends ZeroProcessor {
-
-    protected EasydoCoreProcessor(ZeroRequestGuider guider) {
-        super(guider);
-    }
-
-    public static EasydoCoreProcessor build(ZeroRequestGuider guider) {
-        return new EasydoCoreProcessor(guider);
-    }
-
-    /// ---- users and roles
-
-    private PreparedStatement addRolePrepared() throws SQLException {
-        final String addRole = "INSERT INTO easydo_roles(ID, features, role_name) VALUES (? ,? ,?)";
-        if (!existsPreparedStatement(addRole))
-            registeyPreparedStatement(addRole);
-        return preparedStatement(addRole);
-    }
-
-    public void addRole(EasydoRole role) throws SQLException {
-        role.reset();
-        addRolePrepared().setString(1, role.uuIDString());
-        addRolePrepared().setString(2, role.featuresJSONString());
-        addRolePrepared().setString(3, role.getRoleName());
-        addRolePrepared().execute();
-    }
-
-    private PreparedStatement upRolePrepared() throws SQLException {
-        final String upRole = "UPDATE easydo_roles SET role_name = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upRole))
-            registeyPreparedStatement(upRole);
-        return preparedStatement(upRole);
-    }
-
-    public void upRole(EasydoRole role) throws SQLException {
-        upRolePrepared().setString(1, role.getRoleName());
-        upRolePrepared().setString(2, role.featuresJSONString());
-        upRolePrepared().setString(3, role.uuIDString());
-        upRolePrepared().execute();
-    }
-
-    private PreparedStatement rmRolePrepared() throws SQLException {
-        final String rmRole = "DELETE FROM easydo_roles WHERE ID = ?";
-        if (!existsPreparedStatement(rmRole))
-            registeyPreparedStatement(rmRole);
-        return preparedStatement(rmRole);
-    }
-
-    public void rmRole(EasydoRole role) throws SQLException {
-        rmRolePrepared().setString(1, role.uuIDString());
-        rmRolePrepared().execute();
-    }
-
-    private PreparedStatement fetchRoleByIDPrepared() throws SQLException {
-        final String fetchRoleByID = "SELECT * FROM easydo_roles WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchRoleByID))
-            registeyPreparedStatement(fetchRoleByID);
-        return preparedStatement(fetchRoleByID);
-    }
-
-    public EasydoRole fetchRoleByID(String roleID) throws SQLException {
-        fetchRoleByIDPrepared().setString(1, roleID);
-        ResultSet set = fetchRoleByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("role '" + roleID + "' not found");
-        return new EasydoRole(set);
-    }
-
-    private PreparedStatement addUserPrepared() throws SQLException {
-        final String addUser = "INSERT INTO easydo_users(ID, features, username, password) VALUES (? ,? ,? ,md5(?))";
-        if (!existsPreparedStatement(addUser))
-            registeyPreparedStatement(addUser);
-        return preparedStatement(addUser);
-    }
-
-    public void addUser(EasydoUser user) throws SQLException {
-        user.reset();
-        addUserPrepared().setString(1, user.uuIDString());
-        addUserPrepared().setString(2, user.featuresJSONString());
-        addUserPrepared().setString(3, user.getUsername());
-        addUserPrepared().setString(4, user.getPassword());
-        addUserPrepared().execute();
-    }
-
-    private PreparedStatement upUserPrepared() throws SQLException {
-        final String upUser = "UPDATE easydo_users SET features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upUser))
-            registeyPreparedStatement(upUser);
-        return preparedStatement(upUser);
-    }
-
-    public void upUser(EasydoUser user) throws SQLException {
-        upUserPrepared().setString(1, user.featuresJSONString());
-        upUserPrepared().setString(2, user.uuIDString());
-        upUserPrepared().execute();
-    }
-
-    private PreparedStatement resetUserPasswordPrepared() throws SQLException {
-        final String resetUserPassword = "UPDATE easydo_users SET password = md5(?) WHERE ID = ?";
-        if (!existsPreparedStatement(resetUserPassword))
-            registeyPreparedStatement(resetUserPassword);
-        return preparedStatement(resetUserPassword);
-    }
-
-    public void resetUserPassword(EasydoUser user) throws SQLException {
-        resetUserPasswordPrepared().setString(1, user.getPassword());
-        resetUserPasswordPrepared().setString(2, user.uuIDString());
-        resetUserPasswordPrepared().execute();
-    }
-
-    private PreparedStatement rmUserPrepared() throws SQLException {
-        final String rmUser = "DELETE FROM easydo_users WHERE ID = ?";
-        if (!existsPreparedStatement(rmUser))
-            registeyPreparedStatement(rmUser);
-        return preparedStatement(rmUser);
-    }
-
-    public void rmUser(EasydoUser user) throws SQLException {
-        rmUserPrepared().setString(1, user.uuIDString());
-        rmUserPrepared().execute();
-    }
-
-    private PreparedStatement fetchUserByIDPrepared() throws SQLException {
-        final String fetchUserByID = "SELECT * FROM easydo_users WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchUserByID))
-            registeyPreparedStatement(fetchUserByID);
-        return preparedStatement(fetchUserByID);
-    }
-
-    public EasydoUser fetchUserByID(String userID) throws SQLException {
-        fetchUserByIDPrepared().setString(1, userID);
-        ResultSet set = fetchUserByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("user '" + userID + "' not found");
-        return new EasydoUser(set);
-    }
-
-    private PreparedStatement addUserInfoPrepared() throws SQLException {
-        final String addUserInfo = "INSERT INTO easydo_user_info(ID, features, user_id, nick_name, birthday) VALUES (? ,? ,? ,? ,?)";
-        if (!existsPreparedStatement(addUserInfo))
-            registeyPreparedStatement(addUserInfo);
-        return preparedStatement(addUserInfo);
-    }
-
-    public void addUserInfo(EasydoUserInfo userInfo) throws SQLException {
-        userInfo.reset();
-        addUserInfoPrepared().setString(1, userInfo.uuIDString());
-        addUserInfoPrepared().setString(2, userInfo.featuresJSONString());
-        addUserInfoPrepared().setString(3, userInfo.getUser().uuIDString());
-        addUserInfoPrepared().setString(4, userInfo.getNickName());
-        addUserInfoPrepared().setTimestamp(5, new Timestamp(userInfo.getBirthday().getTime()));
-        addUserInfoPrepared().execute();
-    }
-
-    private PreparedStatement upUserInfoPrepared() throws SQLException {
-        final String upUserInfo = "UPDATE easydo_user_info SET features = ? ,nick_name = ? ,birthday = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upUserInfo))
-            registeyPreparedStatement(upUserInfo);
-        return preparedStatement(upUserInfo);
-    }
-
-    public void upUserInfo(EasydoUserInfo userInfo) throws SQLException {
-        upUserInfoPrepared().setString(1, userInfo.featuresJSONString());
-        upUserInfoPrepared().setString(2, userInfo.getNickName());
-        upUserInfoPrepared().setTimestamp(3, new Timestamp(userInfo.getBirthday().getTime()));
-        upUserInfoPrepared().setString(4, userInfo.uuIDString());
-        upUserInfoPrepared().execute();
-    }
-
-    private PreparedStatement fetchUserInfoByUserIDPrepared() throws SQLException {
-        final String fetchUserInfoByUserID = "SELECT * FROM easydo_user_info WHERE user_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchUserInfoByUserID))
-            registeyPreparedStatement(fetchUserInfoByUserID);
-        return preparedStatement(fetchUserInfoByUserID);
-    }
-
-    public EasydoUserInfo fetchUserInfoByUserID(EasydoUser user) throws SQLException {
-        fetchUserInfoByUserIDPrepared().setString(1, user.uuIDString());
-        ResultSet set = fetchUserInfoByUserIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("user '" + user.uuIDString() + "' userinfo not found");
-        user.setUserInfo(new EasydoUserInfo(set));
-        return user.getUserInfo();
-    }
-
-    /// ---- menus
-
-    private PreparedStatement addMenusPrepared() throws SQLException {
-        final String addMenus = "INSERT INTO easydo_menus(ID, features, sort) VALUES (? ,? ,?)";
-        if (!existsPreparedStatement(addMenus))
-            registeyPreparedStatement(addMenus);
-        return preparedStatement(addMenus);
-    }
-
-    public void addMenus(EasydoMenu menu) throws SQLException {
-        menu.reset();
-        addMenusPrepared().setString(1, menu.uuIDString());
-        addMenusPrepared().setString(2, menu.featuresJSONString());
-        addMenusPrepared().setInt(3, menu.getSort());
-        addMenusPrepared().execute();
-    }
-
-    private PreparedStatement upMenuPrepared() throws SQLException {
-        final String upMenu = "UPDATE easydo_menus SET sort = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upMenu))
-            registeyPreparedStatement(upMenu);
-        return preparedStatement(upMenu);
-    }
-
-    public void upMenu(EasydoMenu menu) throws SQLException {
-        upMenuPrepared().setInt(1, menu.getSort());
-        upMenuPrepared().setString(2, menu.featuresJSONString());
-        upMenuPrepared().setString(3, menu.uuIDString());
-        upMenuPrepared().execute();
-    }
-
-    private PreparedStatement rmMenuPrepared() throws SQLException {
-        final String rmMenu = "DELETE FROM easydo_menus WHERE ID = ?";
-        if (!existsPreparedStatement(rmMenu))
-            registeyPreparedStatement(rmMenu);
-        return preparedStatement(rmMenu);
-    }
-
-    public void rmMenu(EasydoMenu menu) throws SQLException {
-        rmMenuPrepared().setString(1, menu.uuIDString());
-        rmMenuPrepared().execute();
-    }
-
-    private PreparedStatement fetchMenuByIDPrepared() throws SQLException {
-        final String fetchMenuByID = "SELECT * FROM easydo_menus WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchMenuByID))
-            registeyPreparedStatement(fetchMenuByID);
-        return preparedStatement(fetchMenuByID);
-    }
-
-    public EasydoMenu fetchMenuByID(String menuID) throws SQLException {
-        fetchMenuByIDPrepared().setString(1, menuID);
-        ResultSet set = fetchMenuByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("menu '" + menuID + "' not found");
-        return new EasydoMenu(set);
-    }
-
-    private PreparedStatement addMenusRelevancyPrepared() throws SQLException {
-        final String addMenusRelevancy = "INSERT INTO easydo_menus_relevancy(menu_id, sub_menu_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addMenusRelevancy))
-            registeyPreparedStatement(addMenusRelevancy);
-        return preparedStatement(addMenusRelevancy);
-    }
-
-    public void addMenusRelevancy(String menuID, String subMenuID) throws SQLException {
-        addMenusRelevancyPrepared().setString(1, menuID);
-        addMenusRelevancyPrepared().setString(2, subMenuID);
-        addMenusRelevancyPrepared().execute();
-    }
-
-    private PreparedStatement rmMenusRelevancyPrepared() throws SQLException {
-        final String rmMenusRelevancy = "DELETE FROM easydo_menus_relevancy WHERE menu_id = ? AND sub_menu_id = ?";
-        if (!existsPreparedStatement(rmMenusRelevancy))
-            registeyPreparedStatement(rmMenusRelevancy);
-        return preparedStatement(rmMenusRelevancy);
-    }
-
-    public void rmMenusRelevancy(String menuID, String subMenuID) throws SQLException {
-        rmMenusRelevancyPrepared().setString(1, menuID);
-        rmMenusRelevancyPrepared().setString(2, subMenuID);
-        rmMenusRelevancyPrepared().execute();
-    }
-
-    private PreparedStatement fetchSubMenusPrepared() throws SQLException {
-        final String fetchSubMenus = "SELECT * FROM easydo_menus_view WHERE menu_id = ?";
-        if (!existsPreparedStatement(fetchSubMenus))
-            registeyPreparedStatement(fetchSubMenus);
-        return preparedStatement(fetchSubMenus);
-    }
-
-    public List<EasydoMenu> fetchSubMenus(EasydoMenu menu) throws SQLException {
-        fetchSubMenusPrepared().setString(1, menu.uuIDString());
-        ResultSet set = fetchSubMenusPrepared().executeQuery();
-        menu.setSubMenus(new ArrayList<>());
-        while (set.next())
-            menu.getSubMenus().add(new EasydoMenu(set));
-        return menu.getSubMenus();
-    }
-
-    /// ---- enterprise
-
-    private PreparedStatement addEnterprisePrepared() throws SQLException {
-        final String addEnterprise = "INSERT INTO easydo_enterprise(ID, features, enterprise_name, enterprise_code, enterprise_type) VALUES (? ,? ,? ,? ,?)";
-        if (!existsPreparedStatement(addEnterprise))
-            registeyPreparedStatement(addEnterprise);
-        return preparedStatement(addEnterprise);
-    }
-
-    public void addEnterprise(EasydoEnterprise enterprise) throws SQLException {
-        enterprise.reset();
-        addEnterprisePrepared().setString(1, enterprise.uuIDString());
-        addEnterprisePrepared().setString(2, enterprise.featuresJSONString());
-        addEnterprisePrepared().setString(3, enterprise.getEnterpriseName());
-        addEnterprisePrepared().setString(4, enterprise.getEnterpriseCode());
-        addEnterprisePrepared().setString(5, enterprise.getEnterpriseType());
-        addEnterprisePrepared().execute();
-    }
-
-    private PreparedStatement upEnterprisePrepared() throws SQLException {
-        final String upEnterprise = "UPDATE easydo_enterprise SET enterprise_name = ?, enterprise_code = ?, enterprise_type = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upEnterprise))
-            registeyPreparedStatement(upEnterprise);
-        return preparedStatement(upEnterprise);
-    }
-
-    public void upEnterprise(EasydoEnterprise enterprise) throws SQLException {
-        upEnterprisePrepared().setString(1, enterprise.getEnterpriseName());
-        upEnterprisePrepared().setString(2, enterprise.getEnterpriseCode());
-        upEnterprisePrepared().setString(3, enterprise.getEnterpriseType());
-        upEnterprisePrepared().setString(4, enterprise.featuresJSONString());
-        upEnterprisePrepared().setString(5, enterprise.uuIDString());
-        upEnterprisePrepared().execute();
-    }
-
-    private PreparedStatement rmEnterprisePrepared() throws SQLException {
-        final String rmEnterprise = "DELETE FROM easydo_enterprise WHERE ID = ?";
-        if (!existsPreparedStatement(rmEnterprise))
-            registeyPreparedStatement(rmEnterprise);
-        return preparedStatement(rmEnterprise);
-    }
-
-    public void rmEnterprise(EasydoEnterprise enterprise) throws SQLException {
-        rmEnterprisePrepared().setString(1, enterprise.uuIDString());
-        rmEnterprisePrepared().execute();
-    }
-
-    private PreparedStatement fetchEnterpriseByIDPrepared() throws SQLException {
-        final String fetchEnterpriseByID = "SELECT * FROM easydo_enterprise WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchEnterpriseByID))
-            registeyPreparedStatement(fetchEnterpriseByID);
-        return preparedStatement(fetchEnterpriseByID);
-    }
-
-    public EasydoEnterprise fetchEnterpriseByID(String enterpriseID) throws SQLException {
-        fetchEnterpriseByIDPrepared().setString(1, enterpriseID);
-        ResultSet set = fetchEnterpriseByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("enterprise '" + enterpriseID + "' not found");
-        return new EasydoEnterprise(set);
-    }
-
-    private PreparedStatement addEnterpriseRelevancyPrepared() throws SQLException {
-        final String addEnterpriseRelevancy = "INSERT INTO easydo_enterprise_relevancy(enterprise_id, sub_enterprise_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addEnterpriseRelevancy))
-            registeyPreparedStatement(addEnterpriseRelevancy);
-        return preparedStatement(addEnterpriseRelevancy);
-    }
-
-    public void addEnterpriseRelevancy(String enterpriseID, String subEnterpriseID) throws SQLException {
-        addEnterpriseRelevancyPrepared().setString(1, enterpriseID);
-        addEnterpriseRelevancyPrepared().setString(2, subEnterpriseID);
-        addEnterpriseRelevancyPrepared().execute();
-    }
-
-    private PreparedStatement rmEnterpriseRelevancyPrepared() throws SQLException {
-        final String rmEnterpriseRelevancy = "DELETE FROM easydo_enterprise_relevancy WHERE enterprise_id = ? AND sub_enterprise_id = ?";
-        if (!existsPreparedStatement(rmEnterpriseRelevancy))
-            registeyPreparedStatement(rmEnterpriseRelevancy);
-        return preparedStatement(rmEnterpriseRelevancy);
-    }
-
-    public void rmEnterpriseRelevancy(String enterpriseID, String subEnterpriseID) throws SQLException {
-        rmEnterpriseRelevancyPrepared().setString(1, enterpriseID);
-        rmEnterpriseRelevancyPrepared().setString(2, subEnterpriseID);
-        rmEnterpriseRelevancyPrepared().execute();
-    }
-
-    private PreparedStatement fetchSubEnterprisesPrepared() throws SQLException {
-        final String fetchSubEnterprises = "SELECT * FROM easydo_enterprise_view WHERE enterprise_id = ?";
-        if (!existsPreparedStatement(fetchSubEnterprises))
-            registeyPreparedStatement(fetchSubEnterprises);
-        return preparedStatement(fetchSubEnterprises);
-    }
-
-    public List<EasydoEnterprise> fetchSubEnterprises(EasydoEnterprise enterprise) throws SQLException {
-        fetchSubEnterprisesPrepared().setString(1, enterprise.uuIDString());
-        ResultSet set = fetchSubEnterprisesPrepared().executeQuery();
-        enterprise.setChilds(new ArrayList<>());
-        while (set.next())
-            enterprise.getChilds().add(new EasydoEnterprise(set));
-        return enterprise.getChilds();
-    }
-
-    private PreparedStatement fetchEnterpriseMenusPrepared() throws SQLException {
-        final String fetchEnterpriseMenus = "SELECT b.* FROM easydo_enterprise_menus a, easydo_menus b WHERE a.enterprise_id = ? AND a.menu_id = b.ID";
-        if (!existsPreparedStatement(fetchEnterpriseMenus))
-            registeyPreparedStatement(fetchEnterpriseMenus);
-        return preparedStatement(fetchEnterpriseMenus);
-    }
-
-    public List<EasydoMenu> fetchEnterpriseMenus(EasydoEnterprise enterprise) throws SQLException {
-        fetchEnterpriseMenusPrepared().setString(1, enterprise.uuIDString());
-        ResultSet set = fetchEnterpriseMenusPrepared().executeQuery();
-        enterprise.setMenus(new ArrayList<>());
-        while (set.next())
-            enterprise.getMenus().add(new EasydoMenu(set));
-        return enterprise.getMenus();
-    }
-
-    private PreparedStatement fetchEnterpriseProjectsPrepared() throws SQLException {
-        final String fetchEnterpriseProjects = "SELECT * FROM easydo_project WHERE enterprise_id = ?";
-        if (!existsPreparedStatement(fetchEnterpriseProjects))
-            registeyPreparedStatement(fetchEnterpriseProjects);
-        return preparedStatement(fetchEnterpriseProjects);
-    }
-
-    public List<EasydoProject> fetchEnterpriseProjects(EasydoEnterprise enterprise) throws SQLException {
-        fetchEnterpriseProjectsPrepared().setString(1, enterprise.uuIDString());
-        ResultSet set = fetchEnterpriseProjectsPrepared().executeQuery();
-        enterprise.setProjects(new ArrayList<>());
-        while (set.next())
-            enterprise.getProjects().add(new EasydoProject(set));
-        return enterprise.getProjects();
-    }
-
-    /// ---- project
-
-    private PreparedStatement addProjectPrepared() throws SQLException {
-        final String addProject = "INSERT INTO easydo_project(ID, features, enterprise_id, project_code, project_name, project_type, project_status, project_scale) VALUES (? ,? ,? ,? ,? ,? ,? ,?)";
-        if (!existsPreparedStatement(addProject))
-            registeyPreparedStatement(addProject);
-        return preparedStatement(addProject);
-    }
-
-    public void addProject(EasydoProject project) throws SQLException {
-        project.reset();
-        addProjectPrepared().setString(1, project.uuIDString());
-        addProjectPrepared().setString(2, project.featuresJSONString());
-        addProjectPrepared().setString(3, project.getEnterprise().uuIDString());
-        addProjectPrepared().setString(4, project.getProjectCode());
-        addProjectPrepared().setString(5, project.getProjectName());
-        addProjectPrepared().setString(6, project.getProjectType());
-        addProjectPrepared().setString(7, project.getProjectStatus());
-        addProjectPrepared().setString(8, project.getProjectScale());
-        addProjectPrepared().execute();
-    }
-
-    private PreparedStatement upProjectPrepared() throws SQLException {
-        final String upProject = "UPDATE easydo_project SET project_code = ?, project_name = ?, project_type = ?, project_status = ?, project_scale = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upProject))
-            registeyPreparedStatement(upProject);
-        return preparedStatement(upProject);
-    }
-
-    public void upProject(EasydoProject project) throws SQLException {
-        upProjectPrepared().setString(1, project.getProjectCode());
-        upProjectPrepared().setString(2, project.getProjectName());
-        upProjectPrepared().setString(3, project.getProjectType());
-        upProjectPrepared().setString(4, project.getProjectStatus());
-        upProjectPrepared().setString(5, project.getProjectScale());
-        upProjectPrepared().setString(6, project.featuresJSONString());
-        upProjectPrepared().setString(7, project.uuIDString());
-        upProjectPrepared().execute();
-    }
-
-    private PreparedStatement rmProjectPrepared() throws SQLException {
-        final String rmProject = "DELETE FROM easydo_project WHERE ID = ?";
-        if (!existsPreparedStatement(rmProject))
-            registeyPreparedStatement(rmProject);
-        return preparedStatement(rmProject);
-    }
-
-    public void rmProject(EasydoProject project) throws SQLException {
-        rmProjectPrepared().setString(1, project.uuIDString());
-        rmProjectPrepared().execute();
-    }
-
-    private PreparedStatement fetchProjectByIDPrepared() throws SQLException {
-        final String fetchProjectByID = "SELECT * FROM easydo_project WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchProjectByID))
-            registeyPreparedStatement(fetchProjectByID);
-        return preparedStatement(fetchProjectByID);
-    }
-
-    public EasydoProject fetchProjectByID(String projectID) throws SQLException {
-        fetchProjectByIDPrepared().setString(1, projectID);
-        ResultSet set = fetchProjectByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("project '" + projectID + "' not found");
-        return new EasydoProject(set);
-    }
-
-    /// ---- enterprise menus
-
-    private PreparedStatement addEnterpriseMenusPrepared() throws SQLException {
-        final String addEnterpriseMenus = "INSERT INTO easydo_enterprise_menus(enterprise_id, menu_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addEnterpriseMenus))
-            registeyPreparedStatement(addEnterpriseMenus);
-        return preparedStatement(addEnterpriseMenus);
-    }
-
-    public void addEnterpriseMenus(String enterpriseID, String menuID) throws SQLException {
-        addEnterpriseMenusPrepared().setString(1, enterpriseID);
-        addEnterpriseMenusPrepared().setString(2, menuID);
-        addEnterpriseMenusPrepared().execute();
-    }
-
-    private PreparedStatement rmEnterpriseMenusPrepared() throws SQLException {
-        final String rmEnterpriseMenus = "DELETE FROM easydo_enterprise_menus WHERE enterprise_id = ? AND menu_id = ?";
-        if (!existsPreparedStatement(rmEnterpriseMenus))
-            registeyPreparedStatement(rmEnterpriseMenus);
-        return preparedStatement(rmEnterpriseMenus);
-    }
-
-    public void rmEnterpriseMenus(String enterpriseID, String menuID) throws SQLException {
-        rmEnterpriseMenusPrepared().setString(1, enterpriseID);
-        rmEnterpriseMenusPrepared().setString(2, menuID);
-        rmEnterpriseMenusPrepared().execute();
-    }
-
-    /// ---- role menus
-
-    private PreparedStatement addRoleMenusPrepared() throws SQLException {
-        final String addRoleMenus = "INSERT INTO easydo_role_menus(role_id, menu_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addRoleMenus))
-            registeyPreparedStatement(addRoleMenus);
-        return preparedStatement(addRoleMenus);
-    }
-
-    public void addRoleMenus(String roleID, String menuID) throws SQLException {
-        addRoleMenusPrepared().setString(1, roleID);
-        addRoleMenusPrepared().setString(2, menuID);
-        addRoleMenusPrepared().execute();
-    }
-
-    private PreparedStatement rmRoleMenusPrepared() throws SQLException {
-        final String rmRoleMenus = "DELETE FROM easydo_role_menus WHERE role_id = ? AND menu_id = ?";
-        if (!existsPreparedStatement(rmRoleMenus))
-            registeyPreparedStatement(rmRoleMenus);
-        return preparedStatement(rmRoleMenus);
-    }
-
-    public void rmRoleMenus(String roleID, String menuID) throws SQLException {
-        rmRoleMenusPrepared().setString(1, roleID);
-        rmRoleMenusPrepared().setString(2, menuID);
-        rmRoleMenusPrepared().execute();
-    }
-
-    private PreparedStatement fetchRoleMenusPrepared() throws SQLException {
-        final String fetchRoleMenus = "SELECT b.* FROM easydo_role_menus a ,easydo_menus b WHERE a.role_id = ? AND a.menu_id = b.ID";
-        if (!existsPreparedStatement(fetchRoleMenus))
-            registeyPreparedStatement(fetchRoleMenus);
-        return preparedStatement(fetchRoleMenus);
-    }
-
-    public List<EasydoMenu> fetchRoleMenus(EasydoRole role) throws SQLException {
-        fetchRoleMenusPrepared().setString(1, role.uuIDString());
-        ResultSet set = fetchRoleMenusPrepared().executeQuery();
-        role.setMenus(new ArrayList<>());
-        while (set.next())
-            role.getMenus().add(new EasydoMenu(set));
-        return role.getMenus();
-    }
-
-    /// ---- enterprise users
-
-    private PreparedStatement addEnterpriseUsersPrepared() throws SQLException {
-        final String addEnterpriseUsers = "INSERT INTO easydo_enterprise_users(enterprise_id, user_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addEnterpriseUsers))
-            registeyPreparedStatement(addEnterpriseUsers);
-        return preparedStatement(addEnterpriseUsers);
-    }
-
-    public void addEnterpriseUsers(String enterpriseID, String userID) throws SQLException {
-        addEnterpriseUsersPrepared().setString(1, enterpriseID);
-        addEnterpriseUsersPrepared().setString(2, userID);
-        addEnterpriseUsersPrepared().execute();
-    }
-
-    private PreparedStatement rmEnterpriseUsersPrepared() throws SQLException {
-        final String rmEnterpriseUsers = "DELETE FROM easydo_enterprise_users WHERE enterprise_id = ? AND user_id = ?";
-        if (!existsPreparedStatement(rmEnterpriseUsers))
-            registeyPreparedStatement(rmEnterpriseUsers);
-        return preparedStatement(rmEnterpriseUsers);
-    }
-
-    public void rmEnterpriseUsers(String enterpriseID, String userID) throws SQLException {
-        rmEnterpriseUsersPrepared().setString(1, enterpriseID);
-        rmEnterpriseUsersPrepared().setString(2, userID);
-        rmEnterpriseUsersPrepared().execute();
-    }
-
-    /// ---- project users
-
-    private PreparedStatement addProjectUsersPrepared() throws SQLException {
-        final String addProjectUsers = "INSERT INTO easydo_project_users(project_id, user_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addProjectUsers))
-            registeyPreparedStatement(addProjectUsers);
-        return preparedStatement(addProjectUsers);
-    }
-
-    public void addProjectUsers(String projectID, String userID) throws SQLException {
-        addProjectUsersPrepared().setString(1, projectID);
-        addProjectUsersPrepared().setString(2, userID);
-        addProjectUsersPrepared().execute();
-    }
-
-    private PreparedStatement rmProjectUsersPrepared() throws SQLException {
-        final String rmProjectUsers = "DELETE FROM easydo_project_users WHERE project_id = ? AND user_id = ?";
-        if (!existsPreparedStatement(rmProjectUsers))
-            registeyPreparedStatement(rmProjectUsers);
-        return preparedStatement(rmProjectUsers);
-    }
-
-    public void rmProjectUsers(String projectID, String userID) throws SQLException {
-        rmProjectUsersPrepared().setString(1, projectID);
-        rmProjectUsersPrepared().setString(2, userID);
-        rmProjectUsersPrepared().execute();
-    }
-
-    /// ---- user role
-
-    private PreparedStatement addUserRolePrepared() throws SQLException {
-        final String addUserRole = "INSERT INTO easydo_user_role(user_id ,role_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addUserRole))
-            registeyPreparedStatement(addUserRole);
-        return preparedStatement(addUserRole);
-    }
-
-    public void addUserRole(String userID, String roleID) throws SQLException {
-        addUserRolePrepared().setString(1, userID);
-        addUserRolePrepared().setString(2, roleID);
-        addUserRolePrepared().execute();
-    }
-
-    private PreparedStatement rmUserRolePrepared() throws SQLException {
-        final String rmUserRole = "DELETE FROM easydo_user_role WHERE user_id = ? AND role_id = ?";
-        if (!existsPreparedStatement(rmUserRole))
-            registeyPreparedStatement(rmUserRole);
-        return preparedStatement(rmUserRole);
-    }
-
-    public void rmUserRole(String userID, String roleID) throws SQLException {
-        rmUserRolePrepared().setString(1, userID);
-        rmUserRolePrepared().setString(2, roleID);
-        rmUserRolePrepared().execute();
-    }
-
-    private PreparedStatement fetchUserRolesPrepared() throws SQLException {
-        final String fetchUserRoles = "SELECT b.* FROM easydo_user_role a ,easydo_roles b WHERE a.user_id = ? AND a.role_id = b.ID";
-        if (!existsPreparedStatement(fetchUserRoles))
-            registeyPreparedStatement(fetchUserRoles);
-        return preparedStatement(fetchUserRoles);
-    }
-
-    public List<EasydoRole> fetchUserRoles(EasydoUser user) throws SQLException {
-        fetchUserRolesPrepared().setString(1, user.uuIDString());
-        ResultSet set = fetchUserRolesPrepared().executeQuery();
-        user.setRoles(new ArrayList<>());
-        while (set.next())
-            user.getRoles().add(new EasydoRole(set));
-        return user.getRoles();
-    }
-
-    /// ---- dept
-
-    private PreparedStatement fetchProjectDeptIDPrepared() throws SQLException {
-        final String fetchProjectDeptID = "SELECT dept_id FROM factory_project_belong WHERE project_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchProjectDeptID))
-            registeyPreparedStatement(fetchProjectDeptID);
-        return preparedStatement(fetchProjectDeptID);
-    }
-
-    public long fetchProjectDeptID(long projectID) throws SQLException {
-        fetchProjectDeptIDPrepared().setLong(1, projectID);
-        ResultSet set = fetchProjectDeptIDPrepared().executeQuery();
-        if (!set.next())
-            return -1;
-        return set.getLong(1);
-    }
-
-    private PreparedStatement fetchDeptParentIDPrepared() throws SQLException {
-        final String fetchDeptParentID = "SELECT ifnull(pid, -1) FROM sys_dept WHERE dept_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchDeptParentID))
-            registeyPreparedStatement(fetchDeptParentID);
-        return preparedStatement(fetchDeptParentID);
-    }
-
-    public long fetchDeptParentID(long deptID) throws SQLException {
-        fetchDeptParentIDPrepared().setLong(1, deptID);
-        ResultSet set = fetchDeptParentIDPrepared().executeQuery();
-        if (!set.next())
-            return -1;
-        return set.getLong(1);
-    }
-}

+ 0 - 275
easydo-core/src/main/java/easydo/technology/core/processors/EasydoDeviceProcessor.java

@@ -1,275 +0,0 @@
-package easydo.technology.core.processors;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import easydo.technology.core.EasydoCoreDevice.EasydoDevice;
-import easydo.technology.core.EasydoCoreDevice.EasydoDeviceHealth;
-import easydo.technology.core.EasydoCoreDevice.EasydoSensor;
-import easydo.technology.core.EasydoCoreDevice.EasydoSensorRecord;
-import zmo.technology.lite.core.ZeroProcessor;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-public class EasydoDeviceProcessor extends ZeroProcessor {
-
-    protected EasydoDeviceProcessor(ZeroRequestGuider guider) {
-        super(guider);
-    }
-
-    public static EasydoDeviceProcessor build(ZeroRequestGuider guider) {
-        return new EasydoDeviceProcessor(guider);
-    }
-
-    /// ---- deivce
-
-    private PreparedStatement addDeivcePrepared() throws SQLException {
-        final String addDeivce = "INSERT INTO easydo_device(ID, features, device_identifier, device_type) VALUES (? ,? ,? ,?)";
-        if (!existsPreparedStatement(addDeivce))
-            registeyPreparedStatement(addDeivce);
-        return preparedStatement(addDeivce);
-    }
-
-    public void addDeivce(EasydoDevice device) throws SQLException {
-        device.reset();
-        addDeivcePrepared().setString(1, device.uuIDString());
-        addDeivcePrepared().setString(2, device.featuresJSONString());
-        addDeivcePrepared().setString(3, device.getDeviceIdentifier());
-        addDeivcePrepared().setString(4, device.getDeviceType());
-        addDeivcePrepared().execute();
-    }
-
-    private PreparedStatement upDeivcePrepared() throws SQLException {
-        final String upDeivce = "UPDATE easydo_device SET device_identifier = ?, device_type = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upDeivce))
-            registeyPreparedStatement(upDeivce);
-        return preparedStatement(upDeivce);
-    }
-
-    public void upDeivce(EasydoDevice device) throws SQLException {
-        upDeivcePrepared().setString(1, device.getDeviceIdentifier());
-        upDeivcePrepared().setString(2, device.getDeviceType());
-        upDeivcePrepared().setString(3, device.featuresJSONString());
-        upDeivcePrepared().setString(4, device.uuIDString());
-        upDeivcePrepared().execute();
-    }
-
-    private PreparedStatement rmDeivcePrepared() throws SQLException {
-        final String rmDeivce = "DELETE FROM easydo_device WHERE ID = ?";
-        if (!existsPreparedStatement(rmDeivce))
-            registeyPreparedStatement(rmDeivce);
-        return preparedStatement(rmDeivce);
-    }
-
-    public void rmDeivce(EasydoDevice device) throws SQLException {
-        rmDeivcePrepared().setString(1, device.uuIDString());
-        rmDeivcePrepared().execute();
-    }
-
-    private PreparedStatement fetchDeviceByIDPrepared() throws SQLException {
-        final String fetchDeviceByID = "SELECT * FROM easydo_device WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchDeviceByID))
-            registeyPreparedStatement(fetchDeviceByID);
-        return preparedStatement(fetchDeviceByID);
-    }
-
-    public EasydoDevice fetchDeviceByID(String deviceID) throws SQLException {
-        fetchDeviceByIDPrepared().setString(1, deviceID);
-        ResultSet set = fetchDeviceByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("device '" + deviceID + "' not found");
-        return new EasydoDevice(set);
-    }
-
-    /// ---- deivce health
-
-    private PreparedStatement addDeivceHealthPrepared() throws SQLException {
-        final String addDeivceHealth = "INSERT INTO easydo_device_health(ID, features, device_id) VALUES (? ,? ,?)";
-        if (!existsPreparedStatement(addDeivceHealth))
-            registeyPreparedStatement(addDeivceHealth);
-        return preparedStatement(addDeivceHealth);
-    }
-
-    public void addDeivceHealth(EasydoDeviceHealth deviceHealth) throws SQLException {
-        deviceHealth.reset();
-        addDeivceHealthPrepared().setString(1, deviceHealth.uuIDString());
-        addDeivceHealthPrepared().setString(2, deviceHealth.featuresJSONString());
-        addDeivceHealthPrepared().setString(3, deviceHealth.getDevice().uuIDString());
-        addDeivceHealthPrepared().execute();
-    }
-
-    private PreparedStatement upDeivceHealthPrepared() throws SQLException {
-        final String upDeivceHealth = "UPDATE easydo_device_health SET features = ? WHERE device_id = ? AND ID <> ''";
-        if (!existsPreparedStatement(upDeivceHealth))
-            registeyPreparedStatement(upDeivceHealth);
-        return preparedStatement(upDeivceHealth);
-    }
-
-    public void upDeivceHealth(EasydoDeviceHealth deviceHealth) throws SQLException {
-        upDeivceHealthPrepared().setString(1, deviceHealth.featuresJSONString());
-        upDeivceHealthPrepared().setString(2, deviceHealth.getDevice().uuIDString());
-        upDeivceHealthPrepared().execute();
-    }
-
-    private PreparedStatement fetchDeivceHealthCountPrepared() throws SQLException {
-        final String fetchDeivceHealthCount = "SELECT count(1) FROM easydo_device_health WHERE device_id = ?";
-        if (!existsPreparedStatement(fetchDeivceHealthCount))
-            registeyPreparedStatement(fetchDeivceHealthCount);
-        return preparedStatement(fetchDeivceHealthCount);
-    }
-
-    public long fetchDeivceHealthCount(String deviceID) throws SQLException {
-        fetchDeivceHealthCountPrepared().setString(1, deviceID);
-        ResultSet set = fetchDeivceHealthCountPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("query `fetchDeivceHealthCount` faild");
-        return set.getLong(1);
-    }
-
-    private PreparedStatement fetchDeivceHealthPrepared() throws SQLException {
-        final String fetchDeivceHealth = "SELECT * FROM easydo_device_health WHERE device_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchDeivceHealth))
-            registeyPreparedStatement(fetchDeivceHealth);
-        return preparedStatement(fetchDeivceHealth);
-    }
-
-    public EasydoDeviceHealth fetchDeivceHealth(String deviceID) throws SQLException {
-        fetchDeivceHealthPrepared().setString(1, deviceID);
-        ResultSet set = fetchDeivceHealthPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("device `" + deviceID + "` health not found");
-        return new EasydoDeviceHealth(set);
-    }
-
-    public EasydoDeviceHealth fetchDeivceHealth(EasydoDevice device) throws SQLException {
-        device.setHealths(new ArrayList<>());
-        device.getHealths().add(fetchDeivceHealth(device.uuIDString()));
-        return device.getHealths().get(0);
-    }
-
-    /// ---- sensor
-
-    private PreparedStatement addSensorPrepared() throws SQLException {
-        final String addSensor = "INSERT INTO easydo_sensor(ID, features, device_id, sensor_identifier, sensor_type) VALUES (? ,? ,? ,? ,?)";
-        if (!existsPreparedStatement(addSensor))
-            registeyPreparedStatement(addSensor);
-        return preparedStatement(addSensor);
-    }
-
-    public void addSensor(EasydoSensor sensor) throws SQLException {
-        sensor.reset();
-        addSensorPrepared().setString(1, sensor.uuIDString());
-        addSensorPrepared().setString(2, sensor.featuresJSONString());
-        addSensorPrepared().setString(3, sensor.getDevice().uuIDString());
-        addSensorPrepared().setString(4, sensor.getSensorIdentifier());
-        addSensorPrepared().setString(5, sensor.getSensorType());
-        addSensorPrepared().execute();
-    }
-
-    private PreparedStatement upSensorPrepared() throws SQLException {
-        final String upSensor = "UPDATE easydo_sensor SET sensor_identifier = ?, sensor_type = ?, features = ? WHERE ID = ?";
-        if (!existsPreparedStatement(upSensor))
-            registeyPreparedStatement(upSensor);
-        return preparedStatement(upSensor);
-    }
-
-    public void upSensor(EasydoSensor sensor) throws SQLException {
-        upSensorPrepared().setString(1, sensor.getSensorIdentifier());
-        upSensorPrepared().setString(2, sensor.getSensorType());
-        upSensorPrepared().setString(3, sensor.featuresJSONString());
-        upSensorPrepared().setString(4, sensor.uuIDString());
-        upSensorPrepared().execute();
-    }
-
-    private PreparedStatement rmSensorPrepared() throws SQLException {
-        final String rmSensor = "DELETE FROM easydo_sensor WHERE ID = ?";
-        if (!existsPreparedStatement(rmSensor))
-            registeyPreparedStatement(rmSensor);
-        return preparedStatement(rmSensor);
-    }
-
-    public void rmSensor(EasydoSensor sensor) throws SQLException {
-        rmSensorPrepared().setString(1, sensor.uuIDString());
-        rmSensorPrepared().execute();
-    }
-
-    private PreparedStatement fetchSensorByIDPrepared() throws SQLException {
-        final String fetchSensorByID = "SELECT * FROM easydo_sensor WHERE ID = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchSensorByID))
-            registeyPreparedStatement(fetchSensorByID);
-        return preparedStatement(fetchSensorByID);
-    }
-
-    public EasydoSensor fetchSensorByID(String sensorID) throws SQLException {
-        fetchSensorByIDPrepared().setString(1, sensorID);
-        ResultSet set = fetchSensorByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("sensor '" + sensorID + "' not found");
-        return new EasydoSensor(set);
-    }
-
-    private PreparedStatement fetchSensorByDeviceIDPrepared() throws SQLException {
-        final String fetchSensorByDeviceID = "SELECT * FROM easydo_sensor WHERE device_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchSensorByDeviceID))
-            registeyPreparedStatement(fetchSensorByDeviceID);
-        return preparedStatement(fetchSensorByDeviceID);
-    }
-
-    public List<EasydoSensor> fetchSensorByDeviceID(EasydoDevice device) throws SQLException {
-        fetchSensorByDeviceIDPrepared().setString(1, device.uuIDString());
-        ResultSet set = fetchSensorByDeviceIDPrepared().executeQuery();
-        device.setSensors(new ArrayList<>());
-        while (set.next())
-            device.getSensors().add(new EasydoSensor(set));
-        return device.getSensors();
-    }
-
-    /// ---- sensor record
-
-    private PreparedStatement addSensorRecordPrepared() throws SQLException {
-        final String addSensorRecord = "INSERT INTO easydo_sensor_record(ID, features, sensor_id, report_time) VALUES (? ,? ,? ,?)";
-        if (!existsPreparedStatement(addSensorRecord))
-            registeyPreparedStatement(addSensorRecord);
-        return preparedStatement(addSensorRecord);
-    }
-
-    public void addSensorRecord(EasydoSensorRecord sensorRecord) throws SQLException {
-        sensorRecord.reset();
-        addSensorRecordPrepared().setString(1, sensorRecord.uuIDString());
-        addSensorRecordPrepared().setString(2, sensorRecord.featuresJSONString());
-        addSensorRecordPrepared().setString(3, sensorRecord.getSensor().uuIDString());
-        addSensorRecordPrepared().setTimestamp(4, new Timestamp(sensorRecord.getReportTime().getTime()));
-        addSensorRecordPrepared().execute();
-    }
-
-    /// ---- project devices
-
-    private PreparedStatement addProjectDevicesPrepared() throws SQLException {
-        final String addProjectDevices = "INSERT INTO easydo_project_devices(project_id, device_id) VALUES (? ,?)";
-        if (!existsPreparedStatement(addProjectDevices))
-            registeyPreparedStatement(addProjectDevices);
-        return preparedStatement(addProjectDevices);
-    }
-
-    public void addProjectDevices(String projectID, String deviceID) throws SQLException {
-        addProjectDevicesPrepared().setString(1, projectID);
-        addProjectDevicesPrepared().setString(2, deviceID);
-        addProjectDevicesPrepared().execute();
-    }
-
-    private PreparedStatement rmProjectDevicesPrepared() throws SQLException {
-        final String rmProjectDevices = "DELETE FROM easydo_project_devices WHERE project_id = ? AND device_id = ?";
-        if (!existsPreparedStatement(rmProjectDevices))
-            registeyPreparedStatement(rmProjectDevices);
-        return preparedStatement(rmProjectDevices);
-    }
-
-    public void rmProjectDevices(String projectID, String deviceID) throws SQLException {
-        rmProjectDevicesPrepared().setString(1, projectID);
-        rmProjectDevicesPrepared().setString(2, deviceID);
-        rmProjectDevicesPrepared().execute();
-    }
-}

+ 0 - 275
easydo-core/src/main/java/easydo/technology/core/processors/UserProcessor.java

@@ -1,275 +0,0 @@
-package easydo.technology.core.processors;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.alibaba.fastjson.JSONObject;
-
-import easydo.technology.core.FactoryProjectInfo;
-import easydo.technology.core.FactoryProjectInfoPosition;
-import easydo.technology.core.SpringRequestUser;
-import zmo.technology.lite.core.ZeroProcessor;
-import zmo.technology.lite.core.ZeroRequestGuider;
-
-public class UserProcessor extends ZeroProcessor {
-
-    protected UserProcessor(ZeroRequestGuider guider) {
-        super(guider);
-    }
-
-    public static UserProcessor build(ZeroRequestGuider guider) {
-        return new UserProcessor(guider);
-    }
-
-    private PreparedStatement fetchProjectInfoByIDPrepared() throws SQLException {
-        final String fetchProjectInfoByID = "SELECT * FROM factory_project_info_view WHERE fpi_id = ?";
-        if (!existsPreparedStatement(fetchProjectInfoByID))
-            registeyPreparedStatement(fetchProjectInfoByID);
-        return preparedStatement(fetchProjectInfoByID);
-    }
-
-    public FactoryProjectInfo fetchProjectInfoByID(long fpiID) throws SQLException {
-        fetchProjectInfoByIDPrepared().setLong(1, fpiID);
-        ResultSet set = fetchProjectInfoByIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("project info : " + fpiID + " not found");
-        return new FactoryProjectInfo(set);
-    }
-
-    private PreparedStatement fetchUserProjectInfosPrepared() throws SQLException {
-        final String fetchUserProjectInfos = "SELECT dept_id ,project_fpi_id FROM sys_user WHERE user_id = ?";
-        if (!existsPreparedStatement(fetchUserProjectInfos))
-            registeyPreparedStatement(fetchUserProjectInfos);
-        return preparedStatement(fetchUserProjectInfos);
-    }
-
-    public SpringRequestUser fetchUserProjectInfos(SpringRequestUser user) throws SQLException {
-        fetchUserProjectInfosPrepared().setLong(1, user.getUserID());
-        ResultSet set = fetchUserProjectInfosPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("user not found");
-        user.setDeptID(set.getLong("DEPT_ID"));
-        if (set.getObject("PROJECT_FPI_ID") != null)
-            user.addProjectInfo(fetchProjectInfoByID(set.getLong("PROJECT_FPI_ID")));
-        return user;
-    }
-
-    private PreparedStatement fetchDeptProjectInfosPrepared() throws SQLException {
-        final String fetchDeptProjectInfos = "SELECT a.* FROM factory_project_info_view a ,factory_project_belong b WHERE b.dept_id = ? AND a.fpi_id = b.project_id";
-        if (!existsPreparedStatement(fetchDeptProjectInfos))
-            registeyPreparedStatement(fetchDeptProjectInfos);
-        return preparedStatement(fetchDeptProjectInfos);
-    }
-
-    public List<FactoryProjectInfo> fetchDeptProjectInfos(SpringRequestUser user) throws SQLException {
-        fetchDeptProjectInfosPrepared().setLong(1, user.getDeptID());
-        ResultSet set = fetchDeptProjectInfosPrepared().executeQuery();
-        user.setProjectInfos(new ArrayList<>());
-        while (set.next())
-            user.getProjectInfos().add(new FactoryProjectInfo(set));
-        return user.getProjectInfos();
-    }
-
-    private PreparedStatement fetchChildDeptIDsPrepared() throws SQLException {
-        final String fetchChildDeptIDs = "SELECT dept_id FROM sys_dept WHERE pid = ?";
-        if (!existsPreparedStatement(fetchChildDeptIDs))
-            registeyPreparedStatement(fetchChildDeptIDs);
-        return preparedStatement(fetchChildDeptIDs);
-    }
-
-    public Set<Long> fetchChildDeptIDs(long parentID) throws SQLException {
-        fetchChildDeptIDsPrepared().setLong(1, parentID);
-        ResultSet set = fetchChildDeptIDsPrepared().executeQuery();
-        Set<Long> deptIDs = new HashSet<>();
-        while (set.next())
-            deptIDs.add(set.getLong(1));
-        return deptIDs;
-    }
-
-    private PreparedStatement fetchChildDeptProjectInfosPrepared() throws SQLException {
-        final String fetchChildDeptProjectInfos = "SELECT c.* FROM sys_dept a ,factory_project_belong b ,factory_project_info_view c WHERE a.pid = ? AND a.dept_id = b.dept_id AND b.project_id = c.fpi_id";
-        if (!existsPreparedStatement(fetchChildDeptProjectInfos))
-            registeyPreparedStatement(fetchChildDeptProjectInfos);
-        return preparedStatement(fetchChildDeptProjectInfos);
-    }
-
-    public List<FactoryProjectInfo> fetchChildDeptProjectInfos(long parentID) throws SQLException {
-        fetchChildDeptProjectInfosPrepared().setLong(1, parentID);
-        ResultSet set = fetchChildDeptProjectInfosPrepared().executeQuery();
-        List<FactoryProjectInfo> projectInfos = new ArrayList<>();
-        while (set.next())
-            projectInfos.add(new FactoryProjectInfo(set));
-        return projectInfos;
-    }
-
-    private PreparedStatement fetchAllProjectInfosPrepared() throws SQLException {
-        final String fetchAllProjectInfos = "SELECT * FROM factory_project_info_view";
-        if (!existsPreparedStatement(fetchAllProjectInfos))
-            registeyPreparedStatement(fetchAllProjectInfos);
-        return preparedStatement(fetchAllProjectInfos);
-    }
-
-    public List<FactoryProjectInfo> fetchAllProjectInfos(SpringRequestUser user) throws SQLException {
-        ResultSet set = fetchAllProjectInfosPrepared().executeQuery();
-        user.setProjectInfos(new ArrayList<>());
-        while (set.next())
-            user.getProjectInfos().add(new FactoryProjectInfo(set));
-        return user.getProjectInfos();
-    }
-
-    private PreparedStatement fetchAllProjectInfoPositionPrepared() throws SQLException {
-        final String fetchAllProjectInfoPosition = "SELECT * FROM factory_project_position WHERE project_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchAllProjectInfoPosition))
-            registeyPreparedStatement(fetchAllProjectInfoPosition);
-        return preparedStatement(fetchAllProjectInfoPosition);
-    }
-
-    public FactoryProjectInfoPosition fetchAllProjectInfoPosition(FactoryProjectInfo project) throws SQLException {
-        fetchAllProjectInfoPositionPrepared().setLong(1, project.getFpiID());
-        ResultSet set = fetchAllProjectInfoPositionPrepared().executeQuery();
-        if (!set.next())
-            return null;
-        project.setPosition(new FactoryProjectInfoPosition(set));
-        return project.getPosition();
-    }
-
-    private PreparedStatement fetchUserIDByUsernamePrepared() throws SQLException {
-        final String fetchUserIDByUsername = "SELECT user_id FROM sys_user WHERE username = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchUserIDByUsername))
-            registeyPreparedStatement(fetchUserIDByUsername);
-        return preparedStatement(fetchUserIDByUsername);
-    }
-
-    public long fetchUserIDByUsername(String username) throws SQLException {
-        fetchUserIDByUsernamePrepared().setString(1, username);
-        ResultSet set = fetchUserIDByUsernamePrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("user `" + username + "` not found");
-        return set.getLong(1);
-    }
-
-    private PreparedStatement fetchUsernameByUserIDPrepared() throws SQLException {
-        final String fetchUsernameByUserID = "SELECT username FROM sys_user WHERE user_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchUsernameByUserID))
-            registeyPreparedStatement(fetchUsernameByUserID);
-        return preparedStatement(fetchUsernameByUserID);
-    }
-
-    public String fetchUsernameByUserID(long userID) throws SQLException {
-        fetchUsernameByUserIDPrepared().setLong(1, userID);
-        ResultSet set = fetchUsernameByUserIDPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("user id `" + userID + "` not found");
-        return set.getString(1);
-    }
-
-    /// -- wx open id
-
-    private PreparedStatement addUserWxOpenIDPrepared() throws SQLException {
-        final String addUserWxOpenID = "INSERT INTO sys_user_wxopenid(user_id, open_id, features) VALUES (? ,? ,?)";
-        if (!existsPreparedStatement(addUserWxOpenID))
-            registeyPreparedStatement(addUserWxOpenID);
-        return preparedStatement(addUserWxOpenID);
-    }
-
-    public void addUserWxOpenID(long userID, String openID, JSONObject features) throws SQLException {
-        addUserWxOpenIDPrepared().setLong(1, userID);
-        addUserWxOpenIDPrepared().setString(2, openID);
-        addUserWxOpenIDPrepared().setString(3, features.toJSONString());
-        addUserWxOpenIDPrepared().execute();
-    }
-
-    private PreparedStatement rmUserWxOpenIDPrepared() throws SQLException {
-        final String rmUserWxOpenID = "DELETE FROM sys_user_wxopenid WHERE ID = ?";
-        if (!existsPreparedStatement(rmUserWxOpenID))
-            registeyPreparedStatement(rmUserWxOpenID);
-        return preparedStatement(rmUserWxOpenID);
-    }
-
-    public void rmUserWxOpenID(String id) throws SQLException {
-        rmUserWxOpenIDPrepared().setString(1, id);
-        rmUserWxOpenIDPrepared().execute();
-    }
-
-    private PreparedStatement fetchWxFeaturesByOpenIDPrepared() throws SQLException {
-        final String fetchWxFeaturesByOpenID = "SELECT user_id ,features FROM sys_user_wxopenid WHERE open_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchWxFeaturesByOpenID))
-            registeyPreparedStatement(fetchWxFeaturesByOpenID);
-        return preparedStatement(fetchWxFeaturesByOpenID);
-    }
-
-    public JSONObject fetchWxFeaturesByOpenID(String openID) throws SQLException {
-        fetchWxFeaturesByOpenIDPrepared().setString(1, openID);
-        ResultSet set = fetchWxFeaturesByOpenIDPrepared().executeQuery();
-        if (!set.next())
-            return null;
-        long userID = set.getLong(1);
-        JSONObject jsonObject = JSONObject.parseObject(set.getString(2));
-        jsonObject.put("userID", userID);
-        return jsonObject;
-    }
-
-    private PreparedStatement fetchWxFeaturesByUserIDPrepared() throws SQLException {
-        final String fetchWxFeaturesByUserID = "SELECT features FROM sys_user_wxopenid WHERE user_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchWxFeaturesByUserID))
-            registeyPreparedStatement(fetchWxFeaturesByUserID);
-        return preparedStatement(fetchWxFeaturesByUserID);
-    }
-
-    public JSONObject fetchWxFeaturesByUserID(long userID) throws SQLException {
-        fetchWxFeaturesByUserIDPrepared().setLong(1, userID);
-        ResultSet set = fetchWxFeaturesByUserIDPrepared().executeQuery();
-        if (!set.next())
-            return null;
-        return JSONObject.parseObject(set.getString(1));
-    }
-
-    private PreparedStatement upWxFeaturesByUserIDPrepared() throws SQLException {
-        final String upWxFeaturesByUserID = "UPDATE sys_user_wxopenid SET features = ? WHERE user_id = ?";
-        if (!existsPreparedStatement(upWxFeaturesByUserID))
-            registeyPreparedStatement(upWxFeaturesByUserID);
-        return preparedStatement(upWxFeaturesByUserID);
-    }
-
-    public void upWxFeaturesByUserID(JSONObject features, long userID) throws SQLException {
-        upWxFeaturesByUserIDPrepared().setString(1, features.toJSONString());
-        upWxFeaturesByUserIDPrepared().setLong(2, userID);
-        upWxFeaturesByUserIDPrepared().execute();
-    }
-
-    private PreparedStatement fetchUserWxFeaturesCountPrepared() throws SQLException {
-        final String fetchUserWxFeaturesCount = "SELECT count(1) FROM sys_user_wxopenid WHERE user_id = ? LIMIT 1";
-        if (!existsPreparedStatement(fetchUserWxFeaturesCount))
-            registeyPreparedStatement(fetchUserWxFeaturesCount);
-        return preparedStatement(fetchUserWxFeaturesCount);
-    }
-
-    public long fetchUserWxFeaturesCount(long userID) throws SQLException {
-        fetchUserWxFeaturesCountPrepared().setLong(1, userID);
-        ResultSet set = fetchUserWxFeaturesCountPrepared().executeQuery();
-        if (!set.next())
-            throw new SQLException("query `fetchUserWxFeaturesCount` faild");
-        return set.getLong(1);
-    }
-
-    private PreparedStatement fetchUserAuthProjectListPrepared() throws SQLException {
-        final String fetchUserAuthProjectList = "select fpi.* from factory_project_user_ref fpur,factory_project_info fpi where fpur.project_id = fpi.fpi_id and user_id = ?";
-        if (!existsPreparedStatement(fetchUserAuthProjectList))
-            registeyPreparedStatement(fetchUserAuthProjectList);
-        return preparedStatement(fetchUserAuthProjectList);
-    }
-
-    public List<FactoryProjectInfo> fetchUserAuthProjectList(long userID) throws SQLException {
-        fetchUserAuthProjectListPrepared().setLong(1, userID);
-        ResultSet set = fetchUserAuthProjectListPrepared().executeQuery();
-        List<FactoryProjectInfo> projectList = new ArrayList<>();
-        while (set.next())
-            projectList.add(new FactoryProjectInfo(set));
-        return projectList;
-    }
-}

+ 0 - 90
easydo-core/src/main/java/easydo/technology/core/qdplat/QDPlatRequest.java

@@ -1,90 +0,0 @@
-package easydo.technology.core.qdplat;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import zmo.technology.lite.encrypt.ZeroEncrypt;
-import zmo.technology.lite.httpcli.ZeroHttpClient;
-
-public class QDPlatRequest {
-
-    public static final long TEST_PROJECT_ID = 1690231135754244L;
-
-    /// test
-
-    public static final String AES_KEY = "46CC1C4D1C474A8029EAB203541510";
-    public static final String APPID = "qdzhgdcs20210713";
-    public static final String SECRET = "a45685faacfa7ac7925f3af093d334e8";
-    public static final String ADDRESS = "http://39.106.50.195:8100";
-
-    /// prod
-
-    // public static final String APPID = "68432d7035ff8ac8";
-    // public static final String SECRET = "867f745ef03a71ceadf87aca4d28f41a";
-    // public static final String ADDRESS = "http://47.95.217.172:8100";
-
-    // uri
-
-    public static final String TCM_BASIC = "/api/provide/service/towerCrane/baseInfo";
-    public static final String TCM_STATUS = "/api/provide/service/towerCrane/device";
-    public static final String TCM_RECORD = "/api/provide/service/towerCrane/supervision";
-    public static final String TCM_WARN = "/api/provide/service/towerCrane/alarmData";
-    public static final String TCM_OVERTURN_WARN = "/api/provide/service/towerCrane/fqfData";
-
-    public static String AES(String value) throws Exception {
-        return ZeroEncrypt.encryptAESPKCS5Padding(AES_KEY, value);
-    }
-
-    private String hostname;
-    private String uri;
-    private String appid;
-    private String secret;
-    private String projectId;
-
-    private QDPlatRequest(String hostname) {
-        super();
-        this.hostname = hostname;
-        this.appid = APPID;
-        this.secret = SECRET;
-    }
-
-    public static QDPlatRequest host(String hostname) {
-        return new QDPlatRequest(hostname);
-    }
-
-    public QDPlatRequest uri(String uri) {
-        this.uri = uri;
-        return this;
-    }
-
-    public QDPlatRequest appid(String appid) {
-        this.appid = appid;
-        return this;
-    }
-
-    public QDPlatRequest secret(String secret) {
-        this.secret = secret;
-        return this;
-    }
-
-    public QDPlatRequest projectId(String projectId) {
-        this.projectId = projectId;
-        return this;
-    }
-
-    public JSONObject post(Object o) throws Exception {
-        String params = "appid=" + appid + "&projectId=" + projectId + "&sign="
-                + ZeroEncrypt.MD5(secret + "appid" + appid + "projectId" + projectId + secret);
-        return ZeroHttpClient.request(hostname + uri + "?" + params).jsonPostObject(o).json();
-    }
-
-    public JSONObject postArray(Object[] os) throws Exception {
-        String params = "appid=" + appid + "&projectId=" + projectId + "&sign="
-                + ZeroEncrypt.MD5(secret + "appid" + appid + "projectId" + projectId + secret);
-        return ZeroHttpClient.request(hostname + uri + "?" + params).jsonPost(JSONArray.toJSONString(os)).json();
-    }
-
-    public JSONObject postArray(Object o) throws Exception {
-        return postArray(new Object[] { o });
-    }
-}

+ 0 - 314
easydo-core/src/main/java/easydo/technology/core/qdplat/QDPlatTCM.java

@@ -1,314 +0,0 @@
-package easydo.technology.core.qdplat;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-public class QDPlatTCM {
-
-    @Setter
-    @Getter
-    @NoArgsConstructor
-    public static class QDPlatTCMInfo {
-
-        private long projectId; // long 否 20 业平台的项目id (施工许可证编号和项目id二选一必传)
-        private String towerDeviceId; // string 是 50 塔机id
-        private String towerDeviceName; // string 是 50 塔机名称,示例:1#塔机
-        private String towerDeviceNo; // string 是 50 塔机SN号
-        private String manufacturingLicense; // string 是 50 制造许可编号
-        private String model; // string 是 50 规格型号
-        private String recordNumber; // string 是 50 设备备案编号
-        private String manufacturer; // string 是 50 制造厂家
-        private String propertyUnit; // string 是 50 设备产权单位
-        private String manufactureDate; // string 是 20 出厂日期,格式yyyy-MM-dd
-        private String manufacturingNo; // string 是 50 出厂编号
-        private String contactNumber; // string 是 11 联系电话
-        private String installationUnit; // string 是 50 安装单位
-        private String verifyDate; // string 是 20 检验合格日期,格式yyyy-MM-dd
-        private String recordDate; // string 是 20 使用登记日期,格式yyyy-MM-dd
-        private String foreArmLength; // string 是 10 起重臂长,单位:m
-        private String rearArmLength; // string 是 10 平衡臂长,单位:m
-        private float maxLoad; // float 是 额定吊重,单位:t
-        private float maxWeight; // float 是 最大吊重,单位:t
-        private float ratedTorque; // float 是 额定力矩,单位:Kn·m
-        private float ratedWindSpeed; // float 是 额定风速 0.00~36.90m/s
-        private String customTowerCraneType; // string 是 1 塔机类型,1:尖头塔,2:平头塔,3:动臂塔
-        private String detectionUnit; // string 否 50 检测单位
-        private String simCardNo; // string 是 50 SIM卡号
-        private String hardwareVer; // string 是 50 硬件版本号
-        private String protocolVer; // string 是 50 协议版本号
-        private int selfCraneNo; // int 是 塔机名称编号1~16
-        private int craneType; // int 是 塔吊类型,0: 动臂吊,1: 塔头平臂吊,2: 平头平臂吊
-        private float armHeight; // float 是 塔高,单位:m
-        private float maxHeight; // float 是 最大高度,单位:m
-        private float maxAngle; // float 是 最大角度,单位:°
-        private float minAngle; // float 是 最小角度,单位:°
-        private float ratedObliguity; // float 是 额定倾角,单位:°
-        private float tcMSLoadCapacity; // float 是 最大幅度允许最大载重0.00~99.99t
-        private float tcMLMaxScope; // float 是 最大载重达到最大幅度0.00~655.3m
-        private String lng; // string 是 20 经度
-        private String lat; // string 是 20 纬度
-        private int isSupervise; // int 是 塔吊使用状态,0:使用中,1:已拆除
-    }
-
-    @Setter
-    @Getter
-    @NoArgsConstructor
-    public static class QDPlatTCMStatus {
-
-        private long projectId; // long 否 20 业平台的项目id (施工许可证编号和项目id二选一必传)
-        private String towerDeviceId; // string 是 50 塔机id
-        private String deviceId; // string 是 50 监测设备(黑匣子等)id
-        private String deviceName; // string 是 50 监测设备名称
-        private int deviceStatus; // int 是 监测设备状态,1:在线,0:离线
-        private int deviceType; // int 是 监测设备类型,0:黑匣子,1:防倾翻
-        private String uploadTime; // string 是 20 上传时间,格式yyyy-MM-dd HH:mm:ss
-    }
-
-    @Setter
-    @Getter
-    @NoArgsConstructor
-    public static class QDPlatTCMRecord {
-
-        private long projectId; // long 否 20 业平台的项目id (施工许可证编号和项目id二选一必传)
-        private String towerDeviceId; // string 是 50 塔机id
-        private String deviceId; // string 是 50 监测设备id
-        private String deviceName; // string 是 50 监测设备名称
-        private String driverName; // string 是 20 司机姓名
-        private String loadRatio; // string 是 20 荷载比,单位:%
-        private String torqueRatio; // string 是 20 力矩比,单位:%
-        private String amplitude; // string 是 20 幅度,单位:°
-        private String angle; // string 是 20 倾角,单位:°
-        private String height; // string 是 20 高度,单位:m
-        private String rotation; // string 是 20 转角,单位:°
-        private String weight; // string 是 20 吊重0.00~99.99,单位:t
-        private String windspeed; // string 是 20 风速0.00~36.90,单位:m/s
-        private String uploadTime; // string 是 20 上传数据时间,格式yyyy-MM-dd HH:mm:ss
-        private String protocolVer; // string 是 50 协议版本号
-        private String deviceSN; // string 是 50 设备序列号
-        private String deviceTCPIP; // string 是 200 黑匣子TCP实际IP
-        private String deviceTCPPoot; // string 是 200 黑匣子TCP实际端口
-        private String operaterNo; // string 是 3 司机人员工号
-        private String workStatus; // string 是 1 塔机工作状态,0:运行监控,1:顶升监控
-        private String motorStatus; // string 是 1 系统运行状态,0:无电机处于工作状态,1:有电机处于工作状态
-        private float obliguity; // float 是 倾角,单位:°
-        private float ratedWeight; // float 是 额定载重 0.00~99.99,单位:t
-        private String windLevel; // string 是 2 风级 0~12级
-        private String eventTime; // string 是 20 数据产生时间,格式yyyy-MM-dd HH:mm:ss
-    }
-
-    @Setter
-    @Getter
-    @NoArgsConstructor
-    public static class QDPlatTCMWarn {
-
-        private long projectId; // long 否 20 业平台的项目id (施工许可证编号和项目id二选一必传)
-        private String towerDeviceId; // string 是 50 塔机id
-        private String deviceId; // string 是 50 监测设备id
-        private String deviceName; // string 是 50 监测设备名称
-        private int alarmMessageType; // int 是 50 告警消息类型,0:实时告警,1:循环告警
-        private String eventTime; // string 是 20 数据产生时间,格式yyyy-MM-dd HH:mm:ss
-        private int alarmLevel; // int 是 告警等级, 1:预警 ,2:报警
-        private String alarmType; // string 是 10 告警类型,见附录B.24
-        private double alarmValue; // double 是 告警值
-        private String driverName; // string 是 20 塔吊司机名称
-        private String driverIdcardNumber; // string 是 50 塔吊司机身份证号,AES加密
-    }
-
-    @Setter
-    @Getter
-    @NoArgsConstructor
-    public static class QDPlatTCMTippingWarn {
-
-        private long projectId; // long 否 20 业平台的项目id (施工许可证编号和项目id二选一必传)
-        private String towerDeviceId; // string 是 50 塔机id
-        private String deviceId; // string 是 50 防倾翻设备id
-        private String deviceName; // string 是 50 防倾翻设备名称
-        private String eventTime; // string 是 20 数据产生时间,格式yyyy-MM-dd HH:mm:ss
-        private float dip; // float 是 倾斜角度-30~30,单位:°
-        private String direction; // string 是 20 倾斜方向
-        private int alarmType; // int 是 报警类型,见附录B.25
-    }
-
-    // public static void main(String[] args) throws Exception {
-
-    //     QDPlatTCMInfo info = new QDPlatTCMInfo();
-    //     info.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     info.setTowerDeviceId("qdeasydo-test001");
-    //     info.setTowerDeviceName("1#塔吊11");
-    //     info.setTowerDeviceNo("a0123456t");
-    //     info.setManufacturingLicense("aaabbbccc1234");
-    //     info.setModel("X-123");
-    //     info.setRecordNumber("beiantest");
-    //     info.setManufacturer("测试制造商");
-    //     info.setPropertyUnit("产权单位");
-    //     info.setManufactureDate("2018-09-03 13:14:15");
-    //     info.setManufacturingNo("20180903131415");
-    //     info.setContactNumber("18899776556");
-    //     info.setInstallationUnit("安装单位");
-    //     info.setVerifyDate("2018-09-03 13:14:15");
-    //     info.setRecordDate("2018-09-03 13:14:15");
-    //     info.setForeArmLength("100");
-    //     info.setRearArmLength("50");
-    //     info.setMaxLoad(20.F);
-    //     info.setMaxWeight(10.F);
-    //     info.setRatedTorque(360.F);
-    //     info.setRatedWindSpeed(30.F);
-    //     info.setCustomTowerCraneType("2");
-    //     info.setSimCardNo("0000000");
-    //     info.setHardwareVer("v1.0.3");
-    //     info.setProtocolVer("sock5");
-    //     info.setSelfCraneNo(1);
-    //     info.setCraneType(2);
-    //     info.setArmHeight(10.F);
-    //     info.setMaxHeight(10.F);
-    //     info.setMaxAngle(270.F);
-    //     info.setMinAngle(0.F);
-    //     info.setRatedObliguity(0);
-    //     info.setTcMSLoadCapacity(0);
-    //     info.setTcMLMaxScope(0);
-    //     info.setLng("120");
-    //     info.setLat("37");
-    //     info.setIsSupervise(0);
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_BASIC)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(info));
-
-    //     QDPlatTCMStatus status = new QDPlatTCMStatus();
-    //     status.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     status.setTowerDeviceId("qdeasydo-test001");
-    //     status.setDeviceId("9507777711B");
-    //     status.setDeviceName("tcmrecorder-b");
-    //     status.setDeviceStatus(1);
-    //     status.setDeviceType(0);
-    //     status.setUploadTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_STATUS)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(status));
-
-    //     QDPlatTCMStatus status1 = new QDPlatTCMStatus();
-    //     status1.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     status1.setTowerDeviceId("qdeasydo-test001");
-    //     status1.setDeviceId("9507777711T");
-    //     status1.setDeviceName("tcmrecorder-T");
-    //     status1.setDeviceStatus(1);
-    //     status1.setDeviceType(0);
-    //     status1.setUploadTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_STATUS)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(status1));
-
-    //     QDPlatTCMRecord record = new QDPlatTCMRecord();
-    //     record.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     record.setTowerDeviceId("qdeasydo-test001");
-    //     record.setDeviceId("9507777711T");
-    //     record.setDeviceName("tcmrecorder-T");
-    //     record.setDriverName("路人甲");
-    //     record.setLoadRatio("0");
-    //     record.setTorqueRatio("0");
-    //     record.setAmplitude("0");
-    //     record.setAngle("10");
-    //     record.setHeight("20");
-    //     record.setRotation("20");
-    //     record.setWeight("1");
-    //     record.setWindspeed("0");
-    //     record.setUploadTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     record.setProtocolVer("sock5");
-    //     record.setDeviceSN("9507777711T");
-    //     record.setDeviceTCPIP("0.0.0.0");
-    //     record.setDeviceTCPPoot("49900");
-    //     record.setEventTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     record.setOperaterNo("1");
-    //     record.setWorkStatus("0");
-    //     record.setMotorStatus("0");
-    //     record.setObliguity(0);
-    //     record.setRatedWeight(0);
-    //     record.setWindLevel("0");
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_RECORD)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(record));
-
-    //     QDPlatTCMRecord record1 = new QDPlatTCMRecord();
-    //     record1.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     record1.setTowerDeviceId("qdeasydo-test001");
-    //     record1.setDeviceId("9507777711B");
-    //     record1.setDeviceName("tcmrecorder-b");
-    //     record1.setDriverName("路人甲");
-    //     record1.setLoadRatio("0");
-    //     record1.setTorqueRatio("0");
-    //     record1.setAmplitude("0");
-    //     record1.setAngle("10");
-    //     record1.setHeight("20");
-    //     record1.setRotation("20");
-    //     record1.setWeight("1");
-    //     record1.setWindspeed("0");
-    //     record1.setUploadTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     record1.setProtocolVer("sock5");
-    //     record1.setDeviceSN("9507777711B");
-    //     record1.setDeviceTCPIP("0.0.0.0");
-    //     record1.setDeviceTCPPoot("49900");
-    //     record1.setEventTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     record1.setOperaterNo("1");
-    //     record1.setWorkStatus("0");
-    //     record1.setMotorStatus("0");
-    //     record1.setObliguity(0);
-    //     record1.setRatedWeight(0);
-    //     record1.setWindLevel("0");
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_RECORD)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(record1));
-
-    //     QDPlatTCMWarn warn = new QDPlatTCMWarn();
-    //     warn.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     warn.setTowerDeviceId("qdeasydo-test001");
-    //     warn.setDeviceId("9507777711T");
-    //     warn.setDeviceName("tcmrecorder-T");
-    //     warn.setAlarmMessageType(0);
-    //     warn.setEventTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     warn.setAlarmLevel(2);
-    //     warn.setAlarmType("09");
-    //     warn.setAlarmValue(10);
-    //     warn.setDriverName("路人甲");
-    //     warn.setDriverIdcardNumber(QDPlatRequest.AES("370203199108180010"));
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_WARN)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(warn));
-
-    //     QDPlatTCMTippingWarn tippingWarn = new QDPlatTCMTippingWarn();
-    //     tippingWarn.setProjectId(QDPlatRequest.TEST_PROJECT_ID);
-    //     tippingWarn.setTowerDeviceId("qdeasydo-test001");
-    //     tippingWarn.setDeviceId("9507777711T");
-    //     tippingWarn.setDeviceName("tcmrecorder-T");
-    //     tippingWarn.setEventTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-    //     tippingWarn.setDip(30.F);
-    //     tippingWarn.setDirection("0");
-    //     tippingWarn.setAlarmType(16);
-
-    //     System.out.println(
-    //             QDPlatRequest.host(QDPlatRequest.ADDRESS)
-    //                     .uri(QDPlatRequest.TCM_OVERTURN_WARN)
-    //                     .projectId(String.valueOf(QDPlatRequest.TEST_PROJECT_ID))
-    //                     .postArray(tippingWarn));
-    // }
-}

+ 0 - 61
easydo-core/src/main/java/easydo/technology/core/sql/device.healthbeat.sql

@@ -1,66 +0,0 @@
-USE iot;
-
-
-
-CREATE TABLE IF NOT EXISTS `device_healthbeat` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`device_id` INT(11) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `device_healthbeat` ADD PRIMARY KEY pk_device_healthbeat_id(`id`);
-ALTER TABLE `device_healthbeat` ADD KEY idx_device_healthbeat_create_time (`create_time`);
-ALTER TABLE `device_healthbeat` ADD KEY idx_device_healthbeat_update_time (`update_time`);
-ALTER TABLE `device_healthbeat` ADD UNIQUE KEY uk_device_healthbeat (`device_id`);
-ALTER TABLE `device_healthbeat` ADD CONSTRAINT fk_device_healthbeat_device_id
-	FOREIGN KEY (`device_id`) 
- 		REFERENCES device_stock(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `device_healthbeat_uuid`;
-DELIMITER $
-CREATE TRIGGER `device_healthbeat_uuid`
-BEFORE INSERT
-ON `device_healthbeat`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `device_healthbeat_update_time`;
-DELIMITER $
-CREATE TRIGGER `device_healthbeat_update_time`
-BEFORE UPDATE
-ON `device_healthbeat`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-DROP VIEW IF EXISTS `device_stock_view`;
-CREATE VIEW `device_stock_view` AS 
-SELECT 
-	a.*, 
-	b.update_time AS healthbeat_time 
-FROM 
-	device_stock a 
-LEFT JOIN 
-	device_healthbeat b 
-ON 
-	a.id = b.device_id;
-

+ 0 - 741
easydo-core/src/main/java/easydo/technology/core/sql/easydo.sql

@@ -1,799 +0,0 @@
-USE iot;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_roles` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`role_name` VARCHAR(64) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_roles` ADD PRIMARY KEY pk_easydo_roles_id (`id`);
-ALTER TABLE `easydo_roles` ADD KEY idx_easydo_roles_create_time (`create_time`);
-ALTER TABLE `easydo_roles` ADD KEY idx_easydo_roles_update_time (`update_time`);
-ALTER TABLE `easydo_roles` ADD UNIQUE KEY uk_easydo_roles_role_name (`role_name`);
-
-DROP TRIGGER IF EXISTS `easydo_roles_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_roles_uuid`
-BEFORE INSERT
-ON `easydo_roles`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_roles_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_roles_update_time`
-BEFORE UPDATE
-ON `easydo_roles`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_users` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`username` VARCHAR(32) NOT NULL,
-	`password` VARCHAR(32) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_users` ADD PRIMARY KEY pk_easydo_users_id (`id`);
-ALTER TABLE `easydo_users` ADD KEY idx_easydo_users_create_time (`create_time`);
-ALTER TABLE `easydo_users` ADD KEY idx_easydo_users_update_time (`update_time`);
-ALTER TABLE `easydo_users` ADD UNIQUE KEY uk_easydo_users_username (`username`);
-
-DROP TRIGGER IF EXISTS `easydo_users_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_users_uuid`
-BEFORE INSERT
-ON `easydo_users`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_users_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_users_update_time`
-BEFORE UPDATE
-ON `easydo_users`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_user_info` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`user_id` VARCHAR(36) NOT NULL,
-	`nick_name` VARCHAR(128) NOT NULL,
-	`birthday` DATETIME NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_user_info` ADD PRIMARY KEY pk_easydo_user_info_id (`id`);
-ALTER TABLE `easydo_user_info` ADD KEY idx_easydo_user_info_create_time (`create_time`);
-ALTER TABLE `easydo_user_info` ADD KEY idx_easydo_user_info_update_time (`update_time`);
-ALTER TABLE `easydo_user_info` ADD CONSTRAINT fk_easydo_user_info_user_id
-	FOREIGN KEY (`user_id`) 
- 		REFERENCES easydo_users(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_user_info_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_user_info_uuid`
-BEFORE INSERT
-ON `easydo_user_info`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_user_info_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_user_info_update_time`
-BEFORE UPDATE
-ON `easydo_user_info`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_menus` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`sort` INT(8) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_menus` ADD PRIMARY KEY pk_easydo_menus_id (`id`);
-ALTER TABLE `easydo_menus` ADD KEY idx_easydo_menus_create_time (`create_time`);
-ALTER TABLE `easydo_menus` ADD KEY idx_easydo_menus_update_time (`update_time`);
-ALTER TABLE `easydo_menus` ADD KEY idx_easydo_menus_sort (`sort`);
-
-DROP TRIGGER IF EXISTS `easydo_menus_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_menus_uuid`
-BEFORE INSERT
-ON `easydo_menus`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_menus_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_menus_update_time`
-BEFORE UPDATE
-ON `easydo_menus`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_menus_relevancy` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`menu_id` VARCHAR(36) NOT NULL,
-	`sub_menu_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_menus_relevancy` ADD PRIMARY KEY pk_easydo_menus_relevancy_id (`id`);
-ALTER TABLE `easydo_menus_relevancy` ADD CONSTRAINT fk_easydo_menus_relevancy_menu_id
-	FOREIGN KEY (`menu_id`) 
- 		REFERENCES easydo_menus(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_menus_relevancy` ADD CONSTRAINT fk_easydo_menus_relevancy_sub_menu_id
-	FOREIGN KEY (`sub_menu_id`) 
- 		REFERENCES easydo_menus(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_menus_relevancy_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_menus_relevancy_uuid`
-BEFORE INSERT
-ON `easydo_menus_relevancy`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_enterprise` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`enterprise_name` VARCHAR(256) NOT NULL,
-	`enterprise_code` VARCHAR(64) NOT NULL,
-	`enterprise_type` VARCHAR(64) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_enterprise` ADD PRIMARY KEY pk_easydo_enterprise_id (`id`);
-ALTER TABLE `easydo_enterprise` ADD KEY idx_easydo_enterprise_create_time (`create_time`);
-ALTER TABLE `easydo_enterprise` ADD KEY idx_easydo_enterprise_update_time (`update_time`);
-ALTER TABLE `easydo_enterprise` ADD UNIQUE KEY uk_easydo_enterprise_code (`enterprise_code`);
-
-DROP TRIGGER IF EXISTS `easydo_enterprise_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_enterprise_uuid`
-BEFORE INSERT
-ON `easydo_enterprise`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_enterprise_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_enterprise_update_time`
-BEFORE UPDATE
-ON `easydo_enterprise`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_enterprise_relevancy` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`enterprise_id` VARCHAR(36) NOT NULL,
-	`sub_enterprise_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_enterprise_relevancy` ADD PRIMARY KEY pk_easydo_enterprise_relevancy_id (`id`);
-ALTER TABLE `easydo_enterprise_relevancy` ADD CONSTRAINT fk_easydo_enterprise_relevancy_epid
-	FOREIGN KEY (`enterprise_id`) 
- 		REFERENCES easydo_enterprise(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_enterprise_relevancy` ADD CONSTRAINT fk_easydo_enterprise_relevancy_subepid
-	FOREIGN KEY (`sub_enterprise_id`) 
- 		REFERENCES easydo_enterprise(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_enterprise_relevancy_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_enterprise_relevancy_uuid`
-BEFORE INSERT
-ON `easydo_enterprise_relevancy`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_project` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`enterprise_id` VARCHAR(36) NOT NULL,
-	`project_code` VARCHAR(64) NOT NULL,
-	`project_name` VARCHAR(256) NOT NULL,
-	`project_type` VARCHAR(64) NOT NULL,
-	`project_status` VARCHAR(64) NOT NULL,
-	`project_scale` VARCHAR(64) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_project` ADD PRIMARY KEY pk_easydo_project_id (`id`);
-ALTER TABLE `easydo_project` ADD KEY idx_easydo_project_create_time (`create_time`);
-ALTER TABLE `easydo_project` ADD KEY idx_easydo_project_update_time (`update_time`);
-ALTER TABLE `easydo_project` ADD UNIQUE KEY uk_easydo_project_code (`project_code`);
-ALTER TABLE `easydo_project` ADD CONSTRAINT fk_easydo_project_enterprise_id
-	FOREIGN KEY (`enterprise_id`) 
- 		REFERENCES easydo_enterprise(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_project_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_project_uuid`
-BEFORE INSERT
-ON `easydo_project`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_project_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_project_update_time`
-BEFORE UPDATE
-ON `easydo_project`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_device` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`device_identifier` VARCHAR(64) NOT NULL,
-	`device_type` VARCHAR(64) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_device` ADD PRIMARY KEY pk_easydo_device_id (`id`);
-ALTER TABLE `easydo_device` ADD KEY idx_easydo_device_create_time (`create_time`);
-ALTER TABLE `easydo_device` ADD KEY idx_easydo_device_update_time (`update_time`);
-ALTER TABLE `easydo_device` ADD UNIQUE KEY uk_easydo_device_identifier (`device_identifier`);
-
-DROP TRIGGER IF EXISTS `easydo_device_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_device_uuid`
-BEFORE INSERT
-ON `easydo_device`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_device_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_device_update_time`
-BEFORE UPDATE
-ON `easydo_device`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_device_health` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`device_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_device_health` ADD PRIMARY KEY pk_easydo_device_health_id (`id`);
-ALTER TABLE `easydo_device_health` ADD KEY idx_easydo_device_health_create_time (`create_time`);
-ALTER TABLE `easydo_device_health` ADD KEY idx_easydo_device_health_update_time (`update_time`);
-ALTER TABLE `easydo_device_health` ADD CONSTRAINT fk_easydo_device_health_device_id
-	FOREIGN KEY (`device_id`) 
- 		REFERENCES easydo_device(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_device_health_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_device_health_uuid`
-BEFORE INSERT
-ON `easydo_device_health`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_device_health_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_device_health_update_time`
-BEFORE UPDATE
-ON `easydo_device_health`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_sensor` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`device_id` VARCHAR(36) NOT NULL,
-	`sensor_identifier` VARCHAR(64) NOT NULL,
-	`sensor_type` VARCHAR(64) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_sensor` ADD PRIMARY KEY pk_easydo_sensor_id (`id`);
-ALTER TABLE `easydo_sensor` ADD KEY idx_easydo_sensor_create_time (`create_time`);
-ALTER TABLE `easydo_sensor` ADD KEY idx_easydo_sensor_update_time (`update_time`);
-ALTER TABLE `easydo_sensor` ADD UNIQUE KEY uk_easydo_sensor_identifier (`sensor_identifier`);
-ALTER TABLE `easydo_sensor` ADD CONSTRAINT fk_easydo_sensor_device_id
-	FOREIGN KEY (`device_id`) 
- 		REFERENCES easydo_device(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_sensor_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_sensor_uuid`
-BEFORE INSERT
-ON `easydo_sensor`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_sensor_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_sensor_update_time`
-BEFORE UPDATE
-ON `easydo_sensor`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_sensor_record` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-	`features` JSON NOT NULL,
-	`sensor_id` VARCHAR(36) NOT NULL,
-	`report_time` DATETIME NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_sensor_record` ADD PRIMARY KEY pk_easydo_sensor_record_id (`id`);
-ALTER TABLE `easydo_sensor_record` ADD KEY idx_easydo_sensor_record_create_time (`create_time`);
-ALTER TABLE `easydo_sensor_record` ADD KEY idx_easydo_sensor_record_update_time (`update_time`);
-ALTER TABLE `easydo_sensor_record` ADD KEY idx_easydo_sensor_record_report_time (`report_time`);
-ALTER TABLE `easydo_sensor_record` ADD CONSTRAINT fk_easydo_sensor_record_sensor_id
-	FOREIGN KEY (`sensor_id`) 
- 		REFERENCES easydo_sensor(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_sensor_record_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_sensor_record_uuid`
-BEFORE INSERT
-ON `easydo_sensor_record`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-DROP TRIGGER IF EXISTS `easydo_sensor_record_update_time`;
-DELIMITER $
-CREATE TRIGGER `easydo_sensor_record_update_time`
-BEFORE UPDATE
-ON `easydo_sensor_record`
-FOR EACH ROW
-BEGIN
-	SET new.update_time = (SELECT now());
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_enterprise_menus` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`enterprise_id` VARCHAR(36) NOT NULL,
-	`menu_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_enterprise_menus` ADD PRIMARY KEY pk_easydo_enterprise_menus_id (`id`);
-ALTER TABLE `easydo_enterprise_menus` ADD CONSTRAINT fk_easydo_enterprise_menus_epid
-	FOREIGN KEY (`enterprise_id`) 
- 		REFERENCES easydo_enterprise(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_enterprise_menus` ADD CONSTRAINT fk_easydo_enterprise_menus_id
-	FOREIGN KEY (`menu_id`) 
- 		REFERENCES easydo_menus(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_enterprise_menus_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_enterprise_menus_uuid`
-BEFORE INSERT
-ON `easydo_enterprise_menus`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_role_menus` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`role_id` VARCHAR(36) NOT NULL,
-	`menu_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_role_menus` ADD PRIMARY KEY pk_easydo_role_menus_id (`id`);
-ALTER TABLE `easydo_role_menus` ADD CONSTRAINT fk_easydo_role_menus_roleid
-	FOREIGN KEY (`role_id`) 
- 		REFERENCES easydo_roles(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_role_menus` ADD CONSTRAINT fk_easydo_role_menus_id
-	FOREIGN KEY (`menu_id`) 
- 		REFERENCES easydo_menus(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_role_menus_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_role_menus_uuid`
-BEFORE INSERT
-ON `easydo_role_menus`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_project_devices` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`project_id` VARCHAR(36) NOT NULL,
-	`device_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_project_devices` ADD PRIMARY KEY pk_easydo_project_devices_id (`id`);
-ALTER TABLE `easydo_project_devices` ADD CONSTRAINT fk_easydo_project_devices_project_id
-	FOREIGN KEY (`project_id`) 
- 		REFERENCES easydo_project(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_project_devices` ADD CONSTRAINT fk_easydo_project_devices_id
-	FOREIGN KEY (`device_id`) 
- 		REFERENCES easydo_device(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_project_devices_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_project_devices_uuid`
-BEFORE INSERT
-ON `easydo_project_devices`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_enterprise_users` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`enterprise_id` VARCHAR(36) NOT NULL,
-	`user_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_enterprise_users` ADD PRIMARY KEY pk_easydo_enterprise_users_id (`id`);
-ALTER TABLE `easydo_enterprise_users` ADD CONSTRAINT fk_easydo_enterprise_users_epid
-	FOREIGN KEY (`enterprise_id`) 
- 		REFERENCES easydo_enterprise(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_enterprise_users` ADD CONSTRAINT fk_easydo_enterprise_users_id
-	FOREIGN KEY (`user_id`) 
- 		REFERENCES easydo_users(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_enterprise_users_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_enterprise_users_uuid`
-BEFORE INSERT
-ON `easydo_enterprise_users`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_project_users` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`project_id` VARCHAR(36) NOT NULL,
-	`user_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_project_users` ADD PRIMARY KEY pk_easydo_project_users_id (`id`);
-ALTER TABLE `easydo_project_users` ADD CONSTRAINT fk_easydo_project_users_projectid
-	FOREIGN KEY (`project_id`) 
- 		REFERENCES easydo_project(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_project_users` ADD CONSTRAINT fk_easydo_project_users_id
-	FOREIGN KEY (`user_id`) 
- 		REFERENCES easydo_users(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_project_users_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_project_users_uuid`
-BEFORE INSERT
-ON `easydo_project_users`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-CREATE TABLE IF NOT EXISTS `easydo_user_role` (
-	`id` VARCHAR(36) NOT NULL DEFAULT '-',
-	`user_id` VARCHAR(36) NOT NULL,
-	`role_id` VARCHAR(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-
-ALTER TABLE `easydo_user_role` ADD PRIMARY KEY pk_easydo_user_role_id (`id`);
-ALTER TABLE `easydo_user_role` ADD CONSTRAINT fk_easydo_user_role_users_id
-	FOREIGN KEY (`user_id`) 
- 		REFERENCES easydo_users(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-ALTER TABLE `easydo_user_role` ADD CONSTRAINT fk_easydo_user_role_role_id
-	FOREIGN KEY (`role_id`) 
- 		REFERENCES easydo_roles(`id`) 
- 		ON DELETE CASCADE 
- 		ON UPDATE CASCADE;
-
-DROP TRIGGER IF EXISTS `easydo_user_role_uuid`;
-DELIMITER $
-CREATE TRIGGER `easydo_user_role_uuid`
-BEFORE INSERT
-ON `easydo_user_role`
-FOR EACH ROW
-BEGIN
-	IF new.id = '-'
-    THEN 
-		SET new.id = (SELECT uuid());
-	END IF;
-END$
-DELIMITER ;
-
-
-
-DROP VIEW IF EXISTS `easydo_menus_view`;
-CREATE VIEW `easydo_menus_view` AS 
-SELECT 
-	a.*,
-	b.menu_id,
-	b.sub_menu_id
-FROM 
-	easydo_menus a 
-LEFT JOIN 
-	easydo_menus_relevancy b 
-ON 
-	a.ID = b.menu_id;
-
-
-
-DROP VIEW IF EXISTS `easydo_enterprise_view`;
-CREATE VIEW `easydo_enterprise_view` AS 
-SELECT 
-	a.*,
-	b.enterprise_id,
-	b.sub_enterprise_id
-FROM 
-	easydo_enterprise a 
-LEFT JOIN 
-	easydo_enterprise_relevancy b 
-ON 
-	a.ID = b.enterprise_id;
-

+ 0 - 27
easydo-core/src/main/java/easydo/technology/core/wx/EasydoWx.java

@@ -1,27 +0,0 @@
-package easydo.technology.core.wx;
-
-import com.alibaba.fastjson.JSONObject;
-
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.httpcli.ZeroHttpClient;
-
-public class EasydoWx {
-
-    public static final String OPEN_ID = "openid";
-    public static final String SESSION_KEY = "session_key";
-
-    public static final String WIFI_MINI_APPID = "wxc23a2c2dceda414d";
-    public static final String WIFI_MINI_APP_SECRET = "deb739a34e69763e845e41685a46af72";
-    public static final String WIFI_MINI_URL = "https://api.weixin.qq.com/sns/jscode2session?appid=<APPID>&secret=<SECRET>&js_code=<JSCODE>&grant_type=authorization_code";
-
-    public static JSONObject exchangeOpenID(String jscode) throws Exception {
-        JSONObject jsonObject = ZeroHttpClient.request(WIFI_MINI_URL
-                .replace("<JSCODE>", jscode)
-                .replace("<APPID>", WIFI_MINI_APPID)
-                .replace("<SECRET>", WIFI_MINI_APP_SECRET))
-                .get().json();
-        if (jsonObject.containsKey("errcode"))
-            throw new ZeroException(jsonObject.getString("errmsg"));
-        return jsonObject;
-    }
-}

+ 5 - 0
easydo-system/src/main/java/easydo/technology/system/rest/DeptController.java

@@ -1,6 +1,7 @@
 package easydo.technology.system.rest;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.domain.SysDept;
 import easydo.technology.system.dto.SysDeptDto;
 import easydo.technology.system.mapper.SysDeptMapper;
@@ -28,6 +29,7 @@ public class DeptController {
     @Resource
     ISysDeptService sysDeptService;
 
+    @WebLog
     @RequestMapping("/getList")
     public Object getList(@RequestBody SysDeptDto dto) {
         QueryWrapper<SysDept> wrapper = new QueryWrapper<>();
@@ -54,18 +56,21 @@ public class DeptController {
         return new ResponseEntity<>(deptList, HttpStatus.OK);
     }
 
+    @WebLog
     @RequestMapping("/save")
     public Object save(@RequestBody SysDept dept) {
         sysDeptService.saveDept(dept);
         return new ResponseEntity<>(dept, HttpStatus.OK);
     }
 
+    @WebLog
     @RequestMapping("/update")
     public Object update(@RequestBody SysDept dept) throws Exception {
         sysDeptService.updateDept(dept);
         return new ResponseEntity<>(dept, HttpStatus.OK);
     }
 
+    @WebLog
     @RequestMapping("/remove")
     public Object remove(@RequestBody SysDeptDto dept) throws Exception {
         sysDeptService.verification(dept.getIds());

+ 7 - 0
easydo-system/src/main/java/easydo/technology/system/rest/DictController.java

@@ -20,6 +20,7 @@ import java.util.Set;
 
 import javax.servlet.http.HttpServletResponse;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.domain.Dict;
 import easydo.technology.system.dto.DictQueryParam;
 import org.springframework.data.domain.Pageable;
@@ -51,21 +52,25 @@ public class DictController {
     private final DictService dictService;
     private static final String ENTITY_NAME = "dict";
 
+    @WebLog
     @GetMapping(value = "/download")
     public void download(HttpServletResponse response, DictQueryParam criteria) throws IOException {
         dictService.download(dictService.queryAll(criteria), response);
     }
 
+    @WebLog
     @GetMapping(value = "/all")
     public ResponseEntity<Object> queryAll(){
         return new ResponseEntity<>(dictService.queryAll(new DictQueryParam()),HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping
     public ResponseEntity<Object> query(DictQueryParam query, Pageable pageable){
         return new ResponseEntity<>(dictService.queryAll(query,pageable),HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping
     public ResponseEntity<Object> create(@Validated @RequestBody Dict resources){
         if (resources.getId() != null) {
@@ -75,12 +80,14 @@ public class DictController {
         return new ResponseEntity<>(HttpStatus.CREATED);
     }
 
+    @WebLog
     @PutMapping
     public ResponseEntity<Object> update(@RequestBody Dict resources){
         dictService.updateById(resources);
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @DeleteMapping
     public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
         dictService.removeByIds(ids);

+ 6 - 0
easydo-system/src/main/java/easydo/technology/system/rest/DictDetailController.java

@@ -19,6 +19,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.dto.DictDetailDto;
 import easydo.technology.system.dto.DictDetailQueryParam;
 import org.springframework.data.domain.Pageable;
@@ -54,6 +55,7 @@ public class DictDetailController {
     private final DictDetailService dictDetailService;
     private static final String ENTITY_NAME = "dictDetail";
 
+    @WebLog
     @GetMapping
     public ResponseEntity<Object> query(DictDetailQueryParam query,
                                         @PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){
@@ -64,6 +66,7 @@ public class DictDetailController {
         }
     }
 
+    @WebLog
     @GetMapping(value = "/map")
     public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
         String[] names = dictName.split("[,,]");
@@ -74,6 +77,7 @@ public class DictDetailController {
         return new ResponseEntity<>(dictMap, HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping
     public ResponseEntity<Object> create(@Validated @RequestBody DictDetailDto resources){
         if (resources.getId() != null) {
@@ -83,12 +87,14 @@ public class DictDetailController {
         return new ResponseEntity<>(HttpStatus.CREATED);
     }
 
+    @WebLog
     @PutMapping
     public ResponseEntity<Object> update(@RequestBody DictDetailDto resources){
         dictDetailService.updateById(resources);
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @DeleteMapping(value = "/{id}")
     public ResponseEntity<Object> delete(@PathVariable Long id){
         dictDetailService.removeById(id);

+ 9 - 0
easydo-system/src/main/java/easydo/technology/system/rest/MenuController.java

@@ -16,6 +16,7 @@
 package easydo.technology.system.rest;
 
 import com.alibaba.fastjson.JSONObject;
+import easydo.technology.annotation.WebLog;
 import easydo.technology.exception.BadRequestException;
 import easydo.technology.system.domain.Menu;
 import easydo.technology.system.dto.MenuDto;
@@ -49,17 +50,20 @@ public class MenuController {
     // private final MenuMapper menuMapper;
     private static final String ENTITY_NAME = "menu";
 
+    @WebLog
     @GetMapping
     public ResponseEntity<Object> query(MenuQueryParam criteria) throws Exception {
         List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
         return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()), HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/lazy")
     public ResponseEntity<Object> query(@RequestParam Long pid, @RequestParam String platformType) {
         return new ResponseEntity<>(menuService.getMenus(pid, platformType), HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/build")
     public ResponseEntity<Object> buildMenus() {
         List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId());
@@ -85,6 +89,7 @@ public class MenuController {
 //        return new ResponseEntity<>(menuService.buildMenus(menuDtos), HttpStatus.OK);
 //    }
 
+    @WebLog
     @PostMapping("/superior")
     public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) throws Exception {
         Set<MenuDto> menuDtos = new LinkedHashSet<>();
@@ -98,6 +103,7 @@ public class MenuController {
         throw new Exception("参数缺失");
     }
 
+    @WebLog
     @PostMapping
     public ResponseEntity<Object> create(@Validated @RequestBody Menu resources) {
         if (resources.getId() != null) {
@@ -107,12 +113,14 @@ public class MenuController {
         return new ResponseEntity<>(resources, HttpStatus.OK);
     }
 
+    @WebLog
     @PutMapping
     public ResponseEntity<Object> update(@Validated(Menu.Update.class) @RequestBody Menu resources) {
         menuService.updateById(resources);
         return new ResponseEntity<>(resources, HttpStatus.OK);
     }
 
+    @WebLog
     @DeleteMapping
     public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
         Set<Menu> menuSet = new HashSet<>();
@@ -127,6 +135,7 @@ public class MenuController {
         return new ResponseEntity<>(HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/download")
     public void download(HttpServletResponse response, MenuQueryParam criteria) throws Exception {
         menuService.download(menuService.queryAll(criteria, false), response);

+ 10 - 0
easydo-system/src/main/java/easydo/technology/system/rest/RoleController.java

@@ -15,6 +15,7 @@
  */
 package easydo.technology.system.rest;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.exception.BadRequestException;
 import easydo.technology.system.domain.Role;
 import easydo.technology.system.dto.RoleDto;
@@ -48,26 +49,31 @@ public class RoleController {
 
     private static final String ENTITY_NAME = "role";
 
+    @WebLog
     @GetMapping(value = "/{id}")
     public ResponseEntity<Object> query(@PathVariable Long id) {
         return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/download")
     public void download(HttpServletResponse response, RoleQueryParam criteria) throws IOException {
         roleService.download(roleService.queryAll(criteria), response);
     }
 
+    @WebLog
     @GetMapping(value = "/all")
     public ResponseEntity<Object> query() {
         return new ResponseEntity<>(roleService.queryAll(), HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping
     public ResponseEntity<Object> query(RoleQueryParam criteria, Pageable pageable) {
         return new ResponseEntity<>(roleService.queryAll(criteria, pageable), HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/level")
     public ResponseEntity<Object> getLevel() {
         Map<String, Object> map = new HashMap<>();
@@ -75,6 +81,7 @@ public class RoleController {
         return new ResponseEntity<>(map, HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping
     public ResponseEntity<Object> create(@Validated @RequestBody RoleDto resources) {
         if (resources.getId() != null) {
@@ -85,6 +92,7 @@ public class RoleController {
         return new ResponseEntity<>(HttpStatus.CREATED);
     }
 
+    @WebLog
     @PutMapping
     public ResponseEntity<Object> update(@Validated(Role.Update.class) @RequestBody RoleDto resources) {
         getLevels(resources.getLevel());
@@ -92,6 +100,7 @@ public class RoleController {
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @PutMapping(value = "/menu")
     public ResponseEntity<Object> updateMenu(@RequestBody RoleDto resources) {
         RoleDto role = roleService.findById(resources.getId());
@@ -100,6 +109,7 @@ public class RoleController {
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @DeleteMapping
     public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
         for (Long id : ids) {

+ 3 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysDictController.java

@@ -1,5 +1,6 @@
 package easydo.technology.system.rest;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.dto.DictDetailDto;
 import easydo.technology.system.mapper.DictDetailMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +15,8 @@ import java.util.List;
 public class SysDictController {
     @Autowired
     private DictDetailMapper dictDetailMapper;
+
+    @WebLog
     @RequestMapping(value = "/selectDict")
     public List<DictDetailDto> selectDict(@RequestBody DictDetailDto detailDto){
         List<DictDetailDto> dictDetailDtos = dictDetailMapper.getDictDetailsByDictName(detailDto);

+ 2 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysUserController.java

@@ -1,6 +1,7 @@
 package easydo.technology.system.rest;
 
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.domain.User;
 import easydo.technology.system.domain.vo.UserDto;
 import easydo.technology.system.service.UserService;
@@ -31,6 +32,7 @@ public class SysUserController {
     @Autowired
     private UserService sysUserService;
 
+    @WebLog
     @RequestMapping(value = "/getList")
     public ResponseEntity<Object> getList(@RequestBody Map<Object,Object> paramMap){
         Map<String, Object> result = new HashMap<>();

+ 2 - 0
easydo-system/src/main/java/easydo/technology/system/rest/SysUsersRolesController.java

@@ -2,6 +2,7 @@ package easydo.technology.system.rest;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.domain.User;
 import easydo.technology.system.domain.UsersRoles;
 import easydo.technology.system.service.UserService;
@@ -36,6 +37,7 @@ public class SysUsersRolesController {
     @Autowired
     private UserService sysUserService;
 
+    @WebLog
     @RequestMapping(value = "/getUserListByRoleId")
     public ResponseEntity<Object> getUserListByRoleId(@RequestBody Long roleId) throws Exception {
 

+ 10 - 26
easydo-system/src/main/java/easydo/technology/system/rest/UserController.java

@@ -17,8 +17,8 @@ package easydo.technology.system.rest;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import easydo.technology.annotation.WebLog;
 import easydo.technology.config.RsaProperties;
-import easydo.technology.core.processors.UserProcessor;
 import easydo.technology.exception.BadRequestException;
 import easydo.technology.system.domain.User;
 import easydo.technology.system.domain.vo.UserPassVo;
@@ -26,7 +26,6 @@ import easydo.technology.system.domain.vo.UserVo;
 import easydo.technology.system.dto.RoleSmallDto;
 import easydo.technology.system.dto.UserDto;
 import easydo.technology.system.dto.UserQueryParam;
-import easydo.technology.system.security.rest.WxAuthController.WxAuth;
 import easydo.technology.system.service.*;
 import easydo.technology.utils.PageUtil;
 import easydo.technology.utils.RsaUtils;
@@ -37,20 +36,16 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-import zmo.technology.lite.core.ZeroRequestGuider;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import javax.sql.DataSource;
 import java.io.IOException;
-import java.sql.Connection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
@@ -72,11 +67,13 @@ public class UserController {
     private final RoleService roleService;
     private final VerifyService verificationCodeService;
 
+    @WebLog
     @GetMapping(value = "/download")
     public void download(HttpServletResponse response, UserQueryParam criteria) throws IOException {
         userService.download(userService.queryAll(criteria), response);
     }
 
+    @WebLog
     @GetMapping
 /**
     // 该注解会影响前端用户查询用户列表,先干掉,后续有需求斟酌一下再打开
@@ -105,6 +102,7 @@ public class UserController {
         return new ResponseEntity<>(PageUtil.toPage(null, 0), HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping
     public ResponseEntity<Object> create(@Validated @RequestBody UserDto resources) {
         checkLevel(resources);
@@ -114,6 +112,7 @@ public class UserController {
         return new ResponseEntity<>(HttpStatus.CREATED);
     }
 
+    @WebLog
     @PutMapping
     public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody UserDto resources) {
         checkLevel(resources);
@@ -121,6 +120,7 @@ public class UserController {
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @PutMapping(value = "center")
     public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources) {
         if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) {
@@ -130,6 +130,7 @@ public class UserController {
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @WebLog
     @DeleteMapping
     public ResponseEntity<Object> delete(@RequestBody Set<Long> ids) {
         for (Long id : ids) {
@@ -149,6 +150,7 @@ public class UserController {
     @Autowired
     DataSource dataSource;
 
+    @WebLog
     @PostMapping(value = "/updatePass")
     public ResponseEntity<Object> updatePass(@RequestBody UserPassVo passVo) throws Exception {
         String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass());
@@ -160,35 +162,17 @@ public class UserController {
         if (passwordEncoder.matches(newPass, user.getPassword())) {
             throw new BadRequestException("新密码不能与旧密码相同");
         }
-        Connection connection = dataSource.getConnection();
-        try {
-            connection.setAutoCommit(false);
-            ZeroRequestGuider guider = ZeroRequestGuider.build();
-            guider.setConnection(connection);
-            UserProcessor processor = UserProcessor.build(guider);
-            JSONObject features = processor.fetchWxFeaturesByUserID(user.getId());
-            if (features != null) {
-                WxAuth auth = new WxAuth(features.getString("auth"));
-                auth.setPassword(newPass);
-                features.put("auth", auth.encodeAuthString());
-                processor.upWxFeaturesByUserID(features, user.getId());
-                connection.commit();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            connection.rollback();
-        } finally {
-            connection.close();
-        }
         userService.updatePass(user.getUsername(), passwordEncoder.encode(newPass));
         return new ResponseEntity<>(HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping(value = "/updateAvatar")
     public ResponseEntity<Object> updateAvatar(@RequestParam MultipartFile avatar) {
         return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK);
     }
 
+    @WebLog
     @PostMapping(value = "/updateEmail/{code}")
     public ResponseEntity<Object> updateEmail(@PathVariable String code, @RequestBody User user) throws Exception {
         String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword());

+ 2 - 1
easydo-system/src/main/java/easydo/technology/system/rest/VerifyController.java

@@ -15,6 +15,7 @@
  */
 package easydo.technology.system.rest;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.service.VerifyService;
 import easydo.technology.utils.enums.CodeBiEnum;
 import easydo.technology.utils.enums.CodeEnum;
@@ -55,7 +56,7 @@ public class VerifyController {
     //     emailService.send(emailVo,emailService.find());
     //     return new ResponseEntity<>(HttpStatus.OK);
     // }
-
+    @WebLog
     @GetMapping(value = "/validated")
     public ResponseEntity<Object> validated(@RequestParam String email, @RequestParam String code, @RequestParam Integer codeBi){
         CodeBiEnum biEnum = CodeBiEnum.find(codeBi);

+ 5 - 0
easydo-system/src/main/java/easydo/technology/system/security/rest/AuthorizationController.java

@@ -16,6 +16,7 @@
 package easydo.technology.system.security.rest;
 
 import com.wf.captcha.base.Captcha;
+import easydo.technology.annotation.WebLog;
 import easydo.technology.annotation.rest.AnonymousDeleteMapping;
 import easydo.technology.annotation.rest.AnonymousGetMapping;
 import easydo.technology.annotation.rest.AnonymousPostMapping;
@@ -69,6 +70,7 @@ public class AuthorizationController {
     private final DeptService deptService;
     private final LoginProperties loginProperties;
 
+    @WebLog
     @AnonymousPostMapping(value = "/login")
     public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request)
             throws Exception {
@@ -112,11 +114,13 @@ public class AuthorizationController {
         return ResponseEntity.ok(authInfo);
     }
 
+    @WebLog
     @GetMapping(value = "/info")
     public ResponseEntity<Object> getUserInfo() {
         return ResponseEntity.ok(SecurityUtils.getCurrentUser());
     }
 
+    @WebLog
     @AnonymousGetMapping(value = "/code")
     public ResponseEntity<Object> getCode() {
         // 获取运算的结果
@@ -139,6 +143,7 @@ public class AuthorizationController {
         return ResponseEntity.ok(imgResult);
     }
 
+    @WebLog
     @AnonymousDeleteMapping(value = "/logout")
     public ResponseEntity<Object> logout(HttpServletRequest request) {
         onlineUserService.logout(tokenProvider.getToken(request));

+ 4 - 0
easydo-system/src/main/java/easydo/technology/system/security/rest/OnlineController.java

@@ -15,6 +15,7 @@
  */
 package easydo.technology.system.security.rest;
 
+import easydo.technology.annotation.WebLog;
 import easydo.technology.system.security.service.OnlineUserService;
 import easydo.technology.utils.EncryptUtils;
 import lombok.RequiredArgsConstructor;
@@ -38,16 +39,19 @@ public class OnlineController {
 
     private final OnlineUserService onlineUserService;
 
+    @WebLog
     @GetMapping
     public ResponseEntity<Object> query(String filter, Pageable pageable){
         return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
     }
 
+    @WebLog
     @GetMapping(value = "/download")
     public void download(HttpServletResponse response, String filter) throws IOException {
         onlineUserService.download(onlineUserService.getAll(filter), response);
     }
 
+    @WebLog
     @DeleteMapping
     public ResponseEntity<Object> delete(@RequestBody Set<String> keys) throws Exception {
         for (String key : keys) {

+ 0 - 205
easydo-system/src/main/java/easydo/technology/system/security/rest/WxAuthController.java

@@ -1,205 +0,0 @@
-package easydo.technology.system.security.rest;
-
-import com.alibaba.fastjson.JSONObject;
-import easydo.technology.core.processors.UserProcessor;
-import easydo.technology.core.wx.EasydoWx;
-import easydo.technology.system.security.config.bean.SecurityProperties;
-import easydo.technology.system.security.security.TokenProvider;
-import easydo.technology.system.security.service.OnlineUserService;
-import easydo.technology.system.security.service.dto.JwtUserDto;
-import easydo.technology.utils.RedisUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import zmo.technology.lite.core.ZeroController;
-import zmo.technology.lite.core.ZeroException;
-import zmo.technology.lite.core.ZeroRequest;
-import zmo.technology.lite.core.ZeroRequestGuider;
-import zmo.technology.lite.encrypt.ZeroEncrypt;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Controller
-@RequestMapping(WxAuthController.WX_PREFIX)
-public class WxAuthController extends ZeroController {
-
-    public static final String WX_PREFIX = "wx";
-
-    public WxAuthController() {
-        super(WX_PREFIX);
-    }
-
-    @Autowired
-    private DataSource dataSource;
-    @Resource
-    RedisUtils redisUtils;
-
-    @Override
-    protected String handlerNameConstructor(ZeroRequestGuider guider) throws Exception {
-        if (guider.getPaths().size() < 1)
-            throw new ZeroException(404, "no handlers");
-        return guider.getPaths().get(0);
-    }
-
-    @RequestMapping(GENERAL_HANDLER_PATH)
-    public void general(HttpServletRequest request, HttpServletResponse response) throws Exception {
-        proxyHandler(dataSource, request, response);
-    }
-
-    @Autowired
-    private SecurityProperties properties;
-
-    @Autowired
-    private OnlineUserService onlineUserService;
-
-    @Autowired
-    private TokenProvider tokenProvider;
-
-    @Autowired
-    private AuthenticationManagerBuilder authenticationManagerBuilder;
-
-    public static class WxAuth {
-
-        private String jscode;
-        private String username;
-        private String password;
-
-        public WxAuth(String authString) {
-            super();
-            StringBuilder builder = new StringBuilder();
-            for (int i = authString.length() - 9; i >= 0; i--)
-                builder.append(authString.substring(i, i + 1));
-            builder.append(authString.substring(authString.length() - 8));
-
-            String decodeString = ZeroEncrypt.Base64DecodeToString(builder.toString());
-            String head = ZeroEncrypt.Base64DecodeToString(decodeString.substring(0, 8));
-            int jscodeLen = Integer.parseInt(head.substring(0, 2));
-            int usernameLen = Integer.parseInt(head.substring(2, 4));
-            int passwordLen = Integer.parseInt(head.substring(4, 6));
-
-            jscode = decodeString.substring(8, 8 + jscodeLen);
-            username = decodeString.substring(8 + jscodeLen, 8 + jscodeLen + usernameLen);
-            password = decodeString.substring(8 + jscodeLen + usernameLen, 8 + jscodeLen + usernameLen + passwordLen);
-        }
-
-        public WxAuth(String jscode, String username, String password) {
-            super();
-            this.jscode = jscode;
-            this.username = username;
-            this.password = password;
-        }
-
-        public String encodeAuthString() throws Exception {
-            if (jscode.length() > 99
-                    || jscode.length() == 0
-                    || username.length() > 99
-                    || username.length() == 0
-                    || password.length() > 99
-                    || password.length() == 0)
-                throw new ZeroException("invalid data length");
-
-            String head = String.format("%02d", jscode.length()) +
-                    String.format("%02d", username.length()) +
-                    String.format("%02d", password.length());
-            String content = jscode + username + password;
-            String authString = ZeroEncrypt.Base64Encode(ZeroEncrypt.Base64Encode(head) + content);
-            StringBuilder builder = new StringBuilder();
-            for (int i = authString.length() - 9; i >= 0; i--)
-                builder.append(authString.substring(i, i + 1));
-            builder.append(authString.substring(authString.length() - 8));
-            return builder.toString();
-        }
-
-        public String getJscode() {
-            return jscode;
-        }
-
-        public void setJscode(String jscode) {
-            this.jscode = jscode;
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-    }
-
-    private List<?> wxAutoLogin(ZeroRequestGuider guider, String openid) throws Exception {
-        UserProcessor processor = UserProcessor.build(guider);
-        JSONObject features = processor.fetchWxFeaturesByOpenID(openid);
-        if (features == null)
-            throw new ZeroException(11091, "wx openid not found");
-
-        WxAuth auth = new WxAuth(features.getString("auth"));
-        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
-                processor.fetchUsernameByUserID(features.getLongValue("userID")), auth.password);
-        Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
-        SecurityContextHolder.getContext().setAuthentication(authentication);
-
-        String token = tokenProvider.createToken(authentication);
-        JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
-        onlineUserService.save(jwtUserDto, token, guider.getRequest());
-        Map<String, Object> authInfo = new HashMap<String, Object>(2) {
-            {
-                put("token", properties.getTokenStartWith() + token);
-                put("user", jwtUserDto);
-            }
-        };
-
-        List<Object> datas = new ArrayList<>();
-        datas.add(authInfo);
-        return datas;
-    }
-
-    private static final String EXPANDS_AUTH = "auth";
-    private static final String EXPANDS_JSCODE = "jscode";
-
-    public void wxauto(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<?> request = ZeroRequest.build(guider.getRawData());
-        WxAuth auth = new WxAuth(request.getExpands().getString(EXPANDS_AUTH));
-
-        JSONObject jsonObject = EasydoWx.exchangeOpenID(auth.jscode);
-        UserProcessor processor = UserProcessor.build(guider);
-        long userID = processor.fetchUserIDByUsername(auth.username);
-
-        if (processor.fetchUserWxFeaturesCount(userID) > 0)
-            throw new ZeroException("user `" + auth.username + "` already binding");
-
-        JSONObject features = new JSONObject();
-        features.put("auth",
-                new WxAuth(jsonObject.getString(EasydoWx.OPEN_ID), "<placeholder>", auth.password).encodeAuthString());
-        processor.addUserWxOpenID(userID, jsonObject.getString(EasydoWx.OPEN_ID), features);
-
-        guider.write(success(wxAutoLogin(guider, jsonObject.getString(EasydoWx.OPEN_ID))));
-    }
-
-    public void wxauth(ZeroRequestGuider guider) throws Exception {
-        ZeroRequest<?> request = ZeroRequest.build(guider.getRawData());
-        String jscode = request.getExpands().getString(EXPANDS_JSCODE);
-        JSONObject jsonObject = EasydoWx.exchangeOpenID(jscode);
-        guider.write(success(wxAutoLogin(guider, jsonObject.getString(EasydoWx.OPEN_ID))));
-    }
-
-}