From 9e9cd0250728d8a5681eaa19375f41728bb69ded Mon Sep 17 00:00:00 2001 From: Xiong Neng Date: Sun, 9 Sep 2018 21:45:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0jwt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 4 +- springboot-echarts/pom.xml | 2 +- springboot-hibernate/pom.xml | 2 +- springboot-jwt/README.md | 76 +++- springboot-jwt/pom.xml | 2 +- .../xncoding/jwt/api/ExceptionController.java | 6 +- .../xncoding/jwt/api/NotifyController.java | 28 -- .../xncoding/jwt/api/PublicController.java | 248 +----------- .../com/xncoding/jwt/api/model/BindParam.java | 35 -- .../jwt/api/model/JoinBindResponse.java | 36 -- .../com/xncoding/jwt/api/model/PosParam.java | 119 ------ .../xncoding/jwt/api/model/ReportParam.java | 35 -- .../xncoding/jwt/api/model/UnbindParam.java | 35 -- .../xncoding/jwt/api/model/VersionParam.java | 47 --- .../xncoding/jwt/api/model/VersionResult.java | 85 ----- .../xncoding/jwt/common/dao/entity/App.java | 264 ------------- .../jwt/common/dao/entity/AppPublish.java | 132 ------- .../jwt/common/dao/entity/OperationLog.java | 198 ---------- .../xncoding/jwt/common/dao/entity/Pos.java | 352 ------------------ .../jwt/common/dao/entity/PosHistory.java | 176 --------- .../jwt/common/dao/entity/PosMonitor.java | 198 ---------- .../jwt/common/dao/entity/Project.java | 154 -------- .../jwt/common/dao/entity/ProjectUser.java | 132 ------- .../com/xncoding/jwt/service/ApiService.java | 146 -------- .../com/xncoding/jwt/shiro/JWTFilter.java | 13 +- .../java/com/xncoding/jwt/SimpleTest.java | 12 - 26 files changed, 93 insertions(+), 2444 deletions(-) delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/NotifyController.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/BindParam.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/JoinBindResponse.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/PosParam.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/ReportParam.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/UnbindParam.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionParam.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionResult.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/App.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/AppPublish.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/OperationLog.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Pos.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosHistory.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosMonitor.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Project.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/ProjectUser.java delete mode 100644 springboot-jwt/src/main/java/com/xncoding/jwt/service/ApiService.java diff --git a/springboot-cache/src/main/resources/application.yml b/springboot-cache/src/main/resources/application.yml index 3938cb3..64f1182 100644 --- a/springboot-cache/src/main/resources/application.yml +++ b/springboot-cache/src/main/resources/application.yml @@ -10,9 +10,9 @@ spring: profiles: active: dev datasource: - url: jdbc:mysql://123.207.66.156:3306/test?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8 + url: jdbc:mysql://127.0.0.1:3306/test?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8 username: root - password: _EnZhi123 + password: 123456 ################### mybatis-plus配置 ################### mybatis-plus: diff --git a/springboot-echarts/pom.xml b/springboot-echarts/pom.xml index ea29529..62b7d91 100644 --- a/springboot-echarts/pom.xml +++ b/springboot-echarts/pom.xml @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE + 2.0.4.RELEASE diff --git a/springboot-hibernate/pom.xml b/springboot-hibernate/pom.xml index 536f15f..fcd1d02 100644 --- a/springboot-hibernate/pom.xml +++ b/springboot-hibernate/pom.xml @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE + 2.0.4.RELEASE diff --git a/springboot-jwt/README.md b/springboot-jwt/README.md index 70bf0c2..0575c19 100644 --- a/springboot-jwt/README.md +++ b/springboot-jwt/README.md @@ -9,7 +9,81 @@ ## 测试 -启动应用后,先访问登录接口,使用参数用户名=admin/密码=12345678,拿到token后再访问其他接口。 +启动应用后 + +1. 先访问登录接口/login + +*URL* + +``` +POST http://localhost:9095/login +``` + +*Header参数* + +``` +Content-Type: application/json +``` + +*Body参数* + +``` json +{ + "username": "admin", + "password": "12345678", + "appid": "111", + "imei": "imei" +} +``` + +返回值: + +``` json +{ + "success": true, + "msg": "Login success", + "data": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBpZCI6IjExMSIsImltZWkiOiJpbWVpIiwiZXhwIjoxNTM2NDg3NTM1LCJ1c2VybmFtZSI6ImFkbWluIn0.uat7rvVLwC7bcM-jRs329RWdHIFC6P-YN7YdJrdRUHE" +} +``` + +2. 使用token再去访问接口 + +上面的"data"对应的一长串字符串就是返回的token值 + +*URL* + +``` +GET http://localhost:9095/api/v1/join?imei=imei +``` + +*Header参数* + +``` +Content-Type: application/json +Authorization: 'Bearer ' + token +``` + +*Body参数* + +``` json +{ + "username": "admin", + "password": "12345678", + "appid": "111", + "imei": "imei" +} +``` + +返回值: + +``` json +{ + "success": true, + "msg": "Login success", + "data": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBpZCI6IjExMSIsImltZWkiOiJpbWVpIiwiZXhwIjoxNTM2NDg3NTM1LCJ1c2VybmFtZSI6ImFkbWluIn0.uat7rvVLwC7bcM-jRs329RWdHIFC6P-YN7YdJrdRUHE" +} +``` + ## 许可证 diff --git a/springboot-jwt/pom.xml b/springboot-jwt/pom.xml index cb6c667..03ebc71 100644 --- a/springboot-jwt/pom.xml +++ b/springboot-jwt/pom.xml @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE + 2.0.4.RELEASE diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/ExceptionController.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/ExceptionController.java index c9f2292..db71e93 100644 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/ExceptionController.java +++ b/springboot-jwt/src/main/java/com/xncoding/jwt/api/ExceptionController.java @@ -20,21 +20,21 @@ public class ExceptionController { @ResponseStatus(HttpStatus.UNAUTHORIZED) @ExceptionHandler(ShiroException.class) public BaseResponse handle401(ShiroException e) { - return new BaseResponse(false, "shiro的异常", null); + return new BaseResponse<>(false, "shiro的异常", null); } // 捕捉UnauthorizedException @ResponseStatus(HttpStatus.UNAUTHORIZED) @ExceptionHandler(UnauthorizedException.class) public BaseResponse handle401() { - return new BaseResponse(false, "UnauthorizedException", null); + return new BaseResponse<>(false, "UnauthorizedException", null); } // 捕捉其他所有异常 @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public BaseResponse globalException(HttpServletRequest request, Throwable ex) { - return new BaseResponse(false, "其他异常", null); + return new BaseResponse<>(false, "其他异常", null); } private HttpStatus getStatus(HttpServletRequest request) { diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/NotifyController.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/NotifyController.java deleted file mode 100644 index 229a212..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/NotifyController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.xncoding.jwt.api; - -import com.xncoding.jwt.api.model.BaseResponse; -import com.xncoding.jwt.api.model.UnbindParam; -import org.apache.shiro.authz.annotation.RequiresUser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.*; - -/** - * 通知接口类 - */ -@RestController -@RequestMapping(value = "/notify") -public class NotifyController { - - private static final Logger _logger = LoggerFactory.getLogger(NotifyController.class); - - @PostMapping("/unbind") - @RequiresUser - public BaseResponse unbind(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestBody UnbindParam unbindParam) { - _logger.info("解绑通知接口start"); - return new BaseResponse<>(true, "解绑通知发送成功", null); - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/PublicController.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/PublicController.java index 4537a74..0e9b81e 100644 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/PublicController.java +++ b/springboot-jwt/src/main/java/com/xncoding/jwt/api/PublicController.java @@ -1,22 +1,11 @@ package com.xncoding.jwt.api; -import com.xncoding.jwt.api.model.*; -import com.xncoding.jwt.common.dao.entity.Pos; -import com.xncoding.jwt.common.dao.entity.Project; -import com.xncoding.jwt.service.ApiService; -import com.xncoding.jwt.service.ManagerInfoService; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.RequiresUser; +import com.xncoding.jwt.api.model.BaseResponse; +import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import java.util.Date; - /** * 机具管理API接口类 */ @@ -24,12 +13,6 @@ import java.util.Date; @RequestMapping(value = "/api/v1") public class PublicController { - @Resource - private ApiService apiService; - - @Resource - private ManagerInfoService managerInfoService; - private static final Logger _logger = LoggerFactory.getLogger(PublicController.class); /** @@ -38,230 +21,13 @@ public class PublicController { * @return 是否入网 */ @RequestMapping(value = "/join", method = RequestMethod.GET) - @RequiresUser - public JoinBindResponse join(@RequestHeader(name="Accept", defaultValue = "application/json", required = false) String accept, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestParam("imei") String imei) { - _logger.info("入网查询接口 start...."); - JoinBindResponse result = new JoinBindResponse(); - int posCount = apiService.selectCount(imei); - if (posCount > 0) { - // 如果入网了再去查询是否绑定了网点 - int bindCount = apiService.selectBindCount(imei); - Pos pos = apiService.selectByImei(imei); - result.setPosState(pos.getPosState()); - if (bindCount == 0) { - result.setSuccess(false); - result.setCode(2); - result.setMsg("已入网但尚未绑定网点"); - } else { - result.setSuccess(true); - result.setCode(1); - result.setMsg("已入网并绑定了网点"); - } - } else { - result.setSuccess(false); - result.setCode(3); - result.setMsg("未入网"); - } - return result; - } - - /** - * 请求入网接口 - * - * @return 处理结果 - */ - @RequestMapping(value = "/join", method = RequestMethod.POST) - @RequiresUser - public ResponseEntity doJoin(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestBody PosParam posParam) { - _logger.info("请求入网接口 start...."); + @RequiresAuthentication + public BaseResponse join(@RequestHeader("Authorization") String token, + @RequestParam("imei") String imei) { + _logger.info("入网查询接口 start... imei=" + imei); BaseResponse result = new BaseResponse(); - // imei码约束检查 - if (StringUtils.isEmpty(posParam.getImei()) || posParam.getImei().length() > 32) { - result.setSuccess(false); - result.setMsg("IMEI码长度不是1-32位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 序列号SN约束检查 - if (StringUtils.isEmpty(posParam.getSn()) || posParam.getSn().length() > 64) { - result.setSuccess(false); - result.setMsg("序列号长度不是1-64位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 机具型号约束检查 - if (StringUtils.isEmpty(posParam.getSeries()) || posParam.getSeries().length() > 32) { - result.setSuccess(false); - result.setMsg("机具型号不是1-32位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // Android版本约束检查 - if (StringUtils.isEmpty(posParam.getAndroidVersion()) || posParam.getAndroidVersion().length() > 32) { - result.setSuccess(false); - result.setMsg("Android版本号不是1-32位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 版本号约束检查 - if (StringUtils.isEmpty(posParam.getVersion()) || posParam.getVersion().length() > 32) { - result.setSuccess(false); - result.setMsg("版本号不是1-32位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 归属网点约束检查 - if (StringUtils.isEmpty(posParam.getLocation()) || posParam.getLocation().length() > 64) { - result.setSuccess(false); - result.setMsg("归属网点不是1-64位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 产权方约束检查 - if (StringUtils.isEmpty(posParam.getOwner()) || posParam.getOwner().length() > 64) { - result.setSuccess(false); - result.setMsg("产权方不是1-64位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 应用ID约束检查 - if (StringUtils.isEmpty(posParam.getApplicationId()) || posParam.getApplicationId().length() > 64) { - result.setSuccess(false); - result.setMsg("应用ID不是1-64位,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 备注约束检查 - if (StringUtils.isNotEmpty(posParam.getTips()) && posParam.getTips().length() > 255) { - result.setSuccess(false); - result.setMsg("备注超过255个字符,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - Pos pos = new Pos(); - Date now = new Date(); - pos.setJointime(now); - pos.setBindtime(now); - BeanUtils.copyProperties(posParam, pos); - // 根据applicationId设置归属项目ID - Project project = apiService.selectProjectByApplicationId(posParam.getApplicationId()); - if (project == null) { - result.setSuccess(false); - result.setMsg("Application Id不正确,入网失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 重复检查 - int posCount = apiService.selectCount(posParam.getImei()); - if (posCount > 0) { - result.setSuccess(false); - result.setMsg("入网失败,该机具之前已经入网了。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 插入一条新纪录 - pos.setProjectId(project.getId()); - int insert = apiService.insertPos(pos); - if (insert > 0) { - result.setSuccess(true); - result.setMsg("入网成功"); - return new ResponseEntity<>(result, HttpStatus.CREATED); - } else { - result.setSuccess(false); - result.setMsg("入网失败,请联系管理员。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - } - - /** - * 请求绑定网点接口 - * - * @return 处理结果 - */ - @RequestMapping(value = "/bind", method = RequestMethod.POST) - @RequiresUser - public ResponseEntity doBind(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestBody BindParam bindParam) { - _logger.info("请求绑定网点接口 start...."); - BaseResponse result = new BaseResponse(); - // imei码约束检查 - if (StringUtils.isEmpty(bindParam.getImei()) || bindParam.getImei().length() > 32) { - result.setSuccess(false); - result.setMsg("IMEI码长度不是1-32位,绑定网点失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - // 归属网点约束检查 - if (StringUtils.isEmpty(bindParam.getLocation()) || bindParam.getLocation().length() > 64) { - result.setSuccess(false); - result.setMsg("归属网点不是1-64位,绑定网点失败。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - - Pos pos = apiService.selectByImei(bindParam.getImei()); - if (pos == null) { - result.setSuccess(false); - result.setMsg("该POS机尚未入网。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - - Pos pos2 = apiService.selectBindByImei(bindParam.getImei()); - if (pos2 != null) { - result.setSuccess(false); - result.setMsg("该POS机已经绑定了网点,请先解绑。"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - - pos.setLocation(bindParam.getLocation()); - pos.setUpdatedTime(new Date()); - apiService.bindLocation(pos); - result.setSuccess(true); - result.setMsg("绑定网点成功"); - return new ResponseEntity<>(result, HttpStatus.OK); - } - - /** - * 报告位置接口 - * - * @return 报告结果 - */ - @RequestMapping(value = "/report", method = RequestMethod.POST) - @RequiresUser - public BaseResponse report(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestBody ReportParam param) { - _logger.info("定时报告接口 start...."); - BaseResponse result = new BaseResponse(); - // IMEI码约束检查 - if (StringUtils.isEmpty(param.getImei()) || param.getImei().length() > 32) { - result.setSuccess(false); - result.setMsg("IMEI码不是1-32位,心跳报告失败。"); - return result; - } - // 地址约束检查 - if (StringUtils.isEmpty(param.getLocation()) || param.getLocation().length() > 255) { - result.setSuccess(false); - result.setMsg("地址不是1-255位,心跳报告失败。"); - return result; - } - - int r = apiService.report(param); - if (r > 0) { - result.setSuccess(true); - result.setMsg("心跳报告成功"); - } else { - result.setSuccess(false); - result.setMsg("该POS机还没有入网,心跳报告失败。"); - } + result.setMsg("已入网并绑定了网点"); return result; } - - /** - * 版本检查接口 - * - * @return 版本检查结果 - */ - @RequestMapping(value = "/version", method = RequestMethod.POST) - @RequiresUser - public VersionResult version(@RequestHeader(name="Content-Type", defaultValue = "application/json") String contentType, - @RequestHeader(name="Authorization", defaultValue="token") String token, - @RequestBody VersionParam param) { - _logger.info("版本检查接口 start...."); - return apiService.selectPublishCount(param); - } - } diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/BindParam.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/BindParam.java deleted file mode 100644 index ac58027..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/BindParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * POS绑定网点参数 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/7 - */ -public class BindParam { - /** - * 机具IMEI码 - */ - private String imei; - /** - * 归属网点 - */ - private String location; - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/JoinBindResponse.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/JoinBindResponse.java deleted file mode 100644 index 79b3372..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/JoinBindResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * 入网绑定返回 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/16 - */ -public class JoinBindResponse extends BaseResponse { - /** - * 返回码 1:已入网并绑定了网点 2:已入网但尚未绑定网点 3:未入网 - */ - private int code; - - /** - * 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收) - */ - private Integer posState; - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public Integer getPosState() { - return posState; - } - - public void setPosState(Integer posState) { - this.posState = posState; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/PosParam.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/PosParam.java deleted file mode 100644 index 5e63568..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/PosParam.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * POS入网参数 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/7 - */ -public class PosParam { - /** - * 机具IMEI码 - */ - private String imei; - /** - * 序列号(SN) - */ - private String sn; - /** - * 机具型号 - */ - private String series; - /** - * Android版本 - */ - private String androidVersion; - /** - * 版本号 - */ - private String version; - /** - * 归属网点 - */ - private String location; - /** - * 产权方 - */ - private String owner; - /** - * 备注 - */ - private String tips; - /** - * 应用ID - */ - private String applicationId; - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public String getSeries() { - return series; - } - - public void setSeries(String series) { - this.series = series; - } - - public String getAndroidVersion() { - return androidVersion; - } - - public void setAndroidVersion(String androidVersion) { - this.androidVersion = androidVersion; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getTips() { - return tips; - } - - public void setTips(String tips) { - this.tips = tips; - } - - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/ReportParam.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/ReportParam.java deleted file mode 100644 index e7d2937..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/ReportParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * 报告参数 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/7 - */ -public class ReportParam { - /** - * IMEI码 - */ - private String imei; - /** - * 位置 - */ - private String location; - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/UnbindParam.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/UnbindParam.java deleted file mode 100644 index 500e750..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/UnbindParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * 解绑通知参数 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/9 - */ -public class UnbindParam { - /** - * IMEI码 - */ - private String imei; - /** - * 网点 - */ - private String location; - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionParam.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionParam.java deleted file mode 100644 index 1503baf..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionParam.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.xncoding.jwt.api.model; - -/** - * APP版本检查接口参数 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/9 - */ -public class VersionParam { - /** - * 机具IMEI码 - */ - private String imei; - /** - * 应用ID - */ - private String applicationId; - /** - * 当前版本号 - */ - private String version; - - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionResult.java b/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionResult.java deleted file mode 100644 index d4f8b15..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/api/model/VersionResult.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.xncoding.jwt.api.model; - -import java.util.Date; - -/** - * 版本检查结果 - * - * @author XiongNeng - * @version 1.0 - * @since 2018/1/9 - */ -public class VersionResult { - /** - * 是否发现新版本 - */ - private boolean findNew; - /** - * APP名称 - */ - private String appName; - /** - * 新版本号 - */ - private String version; - /** - * 新版本说明 - */ - private String tips; - /** - * 新版本发布时间 - */ - private Date publishtime; - /** - * 新版本下载地址 - */ - private String downloadUrl; - - public boolean isFindNew() { - return findNew; - } - - public void setFindNew(boolean findNew) { - this.findNew = findNew; - } - - public String getDownloadUrl() { - return downloadUrl; - } - - public void setDownloadUrl(String downloadUrl) { - this.downloadUrl = downloadUrl; - } - - public String getAppName() { - return appName; - } - - public void setAppName(String appName) { - this.appName = appName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getTips() { - return tips; - } - - public void setTips(String tips) { - this.tips = tips; - } - - public Date getPublishtime() { - return publishtime; - } - - public void setPublishtime(Date publishtime) { - this.publishtime = publishtime; - } -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/App.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/App.java deleted file mode 100644 index d849495..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/App.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * APP表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class App { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * 应用编号 - */ - private String applicationId; - /** - * 应用名称 - */ - private String name; - /** - * 版本号 - */ - private String version; - /** - * 版本说明 - */ - private String tips; - /** - * 归属项目ID - */ - private Integer projectId; - /** - * 发布时间 - */ - private Date publishtime; - /** - * 发布范围 1:全网发布 2:灰度发布 - */ - private Integer publishRange; - /** - * 操作者ID - */ - private Integer operatorId; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 应用编号. - * - * @return 应用编号. - */ - public String getApplicationId() { - return applicationId; - } - - /** - * 设置 应用编号. - * - * @param applicationId 应用编号. - */ - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * 获取 应用名称. - * - * @return 应用名称. - */ - public String getName() { - return name; - } - - /** - * 设置 应用名称. - * - * @param name 应用名称. - */ - public void setName(String name) { - this.name = name; - } - - /** - * 获取 版本号. - * - * @return 版本号. - */ - public String getVersion() { - return version; - } - - /** - * 设置 版本号. - * - * @param version 版本号. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * 获取 版本说明. - * - * @return 版本说明. - */ - public String getTips() { - return tips; - } - - /** - * 设置 版本说明. - * - * @param tips 版本说明. - */ - public void setTips(String tips) { - this.tips = tips; - } - - /** - * 获取 归属项目ID. - * - * @return 归属项目ID. - */ - public Integer getProjectId() { - return projectId; - } - - /** - * 设置 归属项目ID. - * - * @param projectId 归属项目ID. - */ - public void setProjectId(Integer projectId) { - this.projectId = projectId; - } - - /** - * 获取 发布时间. - * - * @return 发布时间. - */ - public Date getPublishtime() { - return publishtime; - } - - /** - * 设置 发布时间. - * - * @param publishtime 发布时间. - */ - public void setPublishtime(Date publishtime) { - this.publishtime = publishtime; - } - - /** - * 获取 发布范围 1:全网发布 2:灰度发布. - * - * @return 发布范围 1:全网发布 2:灰度发布. - */ - public Integer getPublishRange() { - return publishRange; - } - - /** - * 设置 发布范围 1:全网发布 2:灰度发布. - * - * @param publishRange 发布范围 1:全网发布 2:灰度发布. - */ - public void setPublishRange(Integer publishRange) { - this.publishRange = publishRange; - } - - /** - * 获取 操作者ID. - * - * @return 操作者ID. - */ - public Integer getOperatorId() { - return operatorId; - } - - /** - * 设置 操作者ID. - * - * @param operatorId 操作者ID. - */ - public void setOperatorId(Integer operatorId) { - this.operatorId = operatorId; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/AppPublish.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/AppPublish.java deleted file mode 100644 index bdad4de..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/AppPublish.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * APP发布表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class AppPublish { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * APP主键 - */ - private Integer appId; - /** - * POS主键 - */ - private Integer posId; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 APP主键. - * - * @return APP主键. - */ - public Integer getAppId() { - return appId; - } - - /** - * 设置 APP主键. - * - * @param appId APP主键. - */ - public void setAppId(Integer appId) { - this.appId = appId; - } - - /** - * 获取 POS主键. - * - * @return POS主键. - */ - public Integer getPosId() { - return posId; - } - - /** - * 设置 POS主键. - * - * @param posId POS主键. - */ - public void setPosId(Integer posId) { - this.posId = posId; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/OperationLog.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/OperationLog.java deleted file mode 100644 index 3c8beea..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/OperationLog.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * 操作日志表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class OperationLog { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * 操作者ID - */ - private Integer operatorId; - /** - * 操作对象ID - */ - private Integer targetId; - /** - * 操作对象名称 - */ - private String targetName; - /** - * 操作类型 - */ - private String operateType; - /** - * 备注 - */ - private String tips; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 操作者ID. - * - * @return 操作者ID. - */ - public Integer getOperatorId() { - return operatorId; - } - - /** - * 设置 操作者ID. - * - * @param operatorId 操作者ID. - */ - public void setOperatorId(Integer operatorId) { - this.operatorId = operatorId; - } - - /** - * 获取 操作对象ID. - * - * @return 操作对象ID. - */ - public Integer getTargetId() { - return targetId; - } - - /** - * 设置 操作对象ID. - * - * @param targetId 操作对象ID. - */ - public void setTargetId(Integer targetId) { - this.targetId = targetId; - } - - /** - * 获取 操作对象名称. - * - * @return 操作对象名称. - */ - public String getTargetName() { - return targetName; - } - - /** - * 设置 操作对象名称. - * - * @param targetName 操作对象名称. - */ - public void setTargetName(String targetName) { - this.targetName = targetName; - } - - /** - * 获取 操作类型. - * - * @return 操作类型. - */ - public String getOperateType() { - return operateType; - } - - /** - * 设置 操作类型. - * - * @param operateType 操作类型. - */ - public void setOperateType(String operateType) { - this.operateType = operateType; - } - - /** - * 获取 备注. - * - * @return 备注. - */ - public String getTips() { - return tips; - } - - /** - * 设置 备注. - * - * @param tips 备注. - */ - public void setTips(String tips) { - this.tips = tips; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Pos.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Pos.java deleted file mode 100644 index f070b31..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Pos.java +++ /dev/null @@ -1,352 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * POS机表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class Pos { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * 机具IMEI码 - */ - private String imei; - /** - * 序列号(SN) - */ - private String sn; - /** - * 机具型号 - */ - private String series; - /** - * Android版本 - */ - private String androidVersion; - /** - * 版本号 - */ - private String version; - /** - * 归属网点 - */ - private String location; - /** - * 归属项目ID - */ - private Integer projectId; - /** - * 入网时间 - */ - private Date jointime; - /** - * 绑定时间 - */ - private Date bindtime; - /** - * 产权方 - */ - private String owner; - /** - * 备注 - */ - private String tips; - /** - * 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收) - */ - private Integer posState; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 机具IMEI码. - * - * @return 机具IMEI码. - */ - public String getImei() { - return imei; - } - - /** - * 设置 机具IMEI码. - * - * @param imei 机具IMEI码. - */ - public void setImei(String imei) { - this.imei = imei; - } - - /** - * 获取 序列号(SN). - * - * @return 序列号(SN). - */ - public String getSn() { - return sn; - } - - /** - * 设置 序列号(SN). - * - * @param sn 序列号(SN). - */ - public void setSn(String sn) { - this.sn = sn; - } - - /** - * 获取 机具型号. - * - * @return 机具型号. - */ - public String getSeries() { - return series; - } - - /** - * 设置 机具型号. - * - * @param series 机具型号. - */ - public void setSeries(String series) { - this.series = series; - } - - /** - * 获取 Android版本. - * - * @return Android版本. - */ - public String getAndroidVersion() { - return androidVersion; - } - - /** - * 设置 Android版本. - * - * @param androidVersion Android版本. - */ - public void setAndroidVersion(String androidVersion) { - this.androidVersion = androidVersion; - } - - /** - * 获取 版本号. - * - * @return 版本号. - */ - public String getVersion() { - return version; - } - - /** - * 设置 版本号. - * - * @param version 版本号. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * 获取 归属网点. - * - * @return 归属网点. - */ - public String getLocation() { - return location; - } - - /** - * 设置 归属网点. - * - * @param location 归属网点. - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * 获取 归属项目ID. - * - * @return 归属项目ID. - */ - public Integer getProjectId() { - return projectId; - } - - /** - * 设置 归属项目ID. - * - * @param projectId 归属项目ID. - */ - public void setProjectId(Integer projectId) { - this.projectId = projectId; - } - - /** - * 获取 入网时间. - * - * @return 入网时间. - */ - public Date getJointime() { - return jointime; - } - - /** - * 设置 入网时间. - * - * @param jointime 入网时间. - */ - public void setJointime(Date jointime) { - this.jointime = jointime; - } - - /** - * 获取 绑定时间. - * - * @return 绑定时间. - */ - public Date getBindtime() { - return bindtime; - } - - /** - * 设置 绑定时间. - * - * @param bindtime 绑定时间. - */ - public void setBindtime(Date bindtime) { - this.bindtime = bindtime; - } - - /** - * 获取 产权方. - * - * @return 产权方. - */ - public String getOwner() { - return owner; - } - - /** - * 设置 产权方. - * - * @param owner 产权方. - */ - public void setOwner(String owner) { - this.owner = owner; - } - - /** - * 获取 备注. - * - * @return 备注. - */ - public String getTips() { - return tips; - } - - /** - * 设置 备注. - * - * @param tips 备注. - */ - public void setTips(String tips) { - this.tips = tips; - } - - /** - * 获取 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收). - * - * @return 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收). - */ - public Integer getPosState() { - return posState; - } - - /** - * 设置 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收). - * - * @param posState 机具状态: 1:正常 2:故障 3:维修中(返厂) 4:已禁用(丢失) 5:已停用(回收). - */ - public void setPosState(Integer posState) { - this.posState = posState; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosHistory.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosHistory.java deleted file mode 100644 index b8257b0..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosHistory.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * POS机历史归属表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class PosHistory { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * POS机ID - */ - private Integer posId; - /** - * 归属网点 - */ - private String location; - /** - * 绑定时间 - */ - private Date bindtime; - /** - * 解绑时间 - */ - private Date unbindtime; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 POS机ID. - * - * @return POS机ID. - */ - public Integer getPosId() { - return posId; - } - - /** - * 设置 POS机ID. - * - * @param posId POS机ID. - */ - public void setPosId(Integer posId) { - this.posId = posId; - } - - /** - * 获取 归属网点. - * - * @return 归属网点. - */ - public String getLocation() { - return location; - } - - /** - * 设置 归属网点. - * - * @param location 归属网点. - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * 获取 绑定时间. - * - * @return 绑定时间. - */ - public Date getBindtime() { - return bindtime; - } - - /** - * 设置 绑定时间. - * - * @param bindtime 绑定时间. - */ - public void setBindtime(Date bindtime) { - this.bindtime = bindtime; - } - - /** - * 获取 解绑时间. - * - * @return 解绑时间. - */ - public Date getUnbindtime() { - return unbindtime; - } - - /** - * 设置 解绑时间. - * - * @param unbindtime 解绑时间. - */ - public void setUnbindtime(Date unbindtime) { - this.unbindtime = unbindtime; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosMonitor.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosMonitor.java deleted file mode 100644 index d800e94..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/PosMonitor.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * POS机监控表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class PosMonitor { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * POS机ID - */ - private Integer posId; - /** - * Socket会话ID - */ - private String sessionId; - /** - * 最近一次报告时间 - */ - private Date reportTime; - /** - * 最近一次报告地址 - */ - private String reportLocation; - /** - * 在线状态: 1:在线 2:离线 - */ - private Integer onlineState; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 POS机ID. - * - * @return POS机ID. - */ - public Integer getPosId() { - return posId; - } - - /** - * 设置 POS机ID. - * - * @param posId POS机ID. - */ - public void setPosId(Integer posId) { - this.posId = posId; - } - - /** - * 获取 Socket会话ID. - * - * @return Socket会话ID. - */ - public String getSessionId() { - return sessionId; - } - - /** - * 设置 Socket会话ID. - * - * @param sessionId Socket会话ID. - */ - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - /** - * 获取 最近一次报告时间. - * - * @return 最近一次报告时间. - */ - public Date getReportTime() { - return reportTime; - } - - /** - * 设置 最近一次报告时间. - * - * @param reportTime 最近一次报告时间. - */ - public void setReportTime(Date reportTime) { - this.reportTime = reportTime; - } - - /** - * 获取 最近一次报告地址. - * - * @return 最近一次报告地址. - */ - public String getReportLocation() { - return reportLocation; - } - - /** - * 设置 最近一次报告地址. - * - * @param reportLocation 最近一次报告地址. - */ - public void setReportLocation(String reportLocation) { - this.reportLocation = reportLocation; - } - - /** - * 获取 在线状态: 1:在线 2:离线. - * - * @return 在线状态: 1:在线 2:离线. - */ - public Integer getOnlineState() { - return onlineState; - } - - /** - * 设置 在线状态: 1:在线 2:离线. - * - * @param onlineState 在线状态: 1:在线 2:离线. - */ - public void setOnlineState(Integer onlineState) { - this.onlineState = onlineState; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Project.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Project.java deleted file mode 100644 index 3603694..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/Project.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * 项目表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class Project { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * 项目名称 - */ - private String name; - /** - * 应用编号 - */ - private String applicationId; - /** - * 项目图片 - */ - private String icon; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 项目名称. - * - * @return 项目名称. - */ - public String getName() { - return name; - } - - /** - * 设置 项目名称. - * - * @param name 项目名称. - */ - public void setName(String name) { - this.name = name; - } - - /** - * 获取 应用编号. - * - * @return 应用编号. - */ - public String getApplicationId() { - return applicationId; - } - - /** - * 设置 应用编号. - * - * @param applicationId 应用编号. - */ - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * 获取 项目图片. - * - * @return 项目图片. - */ - public String getIcon() { - return icon; - } - - /** - * 设置 项目图片. - * - * @param icon 项目图片. - */ - public void setIcon(String icon) { - this.icon = icon; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/ProjectUser.java b/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/ProjectUser.java deleted file mode 100644 index abbff86..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/common/dao/entity/ProjectUser.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.xncoding.jwt.common.dao.entity; - -import java.io.Serializable; -import java.util.Date; - -/** - * 项目用户关联表 - * - * @author 熊能 - * @version 1.0 - * @since 2018/01/02 - */ -public class ProjectUser { - - private static final long serialVersionUID = 1L; - - /** - * 主键ID - */ - private Integer id; - /** - * 用户ID - */ - private Integer userId; - /** - * 项目ID - */ - private Integer projectId; - /** - * 创建时间 - */ - private Date createdTime; - /** - * 更新时间 - */ - private Date updatedTime; - - /** - * 获取 主键ID. - * - * @return 主键ID. - */ - public Integer getId() { - return id; - } - - /** - * 设置 主键ID. - * - * @param id 主键ID. - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取 用户ID. - * - * @return 用户ID. - */ - public Integer getUserId() { - return userId; - } - - /** - * 设置 用户ID. - * - * @param userId 用户ID. - */ - public void setUserId(Integer userId) { - this.userId = userId; - } - - /** - * 获取 项目ID. - * - * @return 项目ID. - */ - public Integer getProjectId() { - return projectId; - } - - /** - * 设置 项目ID. - * - * @param projectId 项目ID. - */ - public void setProjectId(Integer projectId) { - this.projectId = projectId; - } - - /** - * 获取 创建时间. - * - * @return 创建时间. - */ - public Date getCreatedTime() { - return createdTime; - } - - /** - * 设置 创建时间. - * - * @param createdTime 创建时间. - */ - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - /** - * 获取 更新时间. - * - * @return 更新时间. - */ - public Date getUpdatedTime() { - return updatedTime; - } - - /** - * 设置 更新时间. - * - * @param updatedTime 更新时间. - */ - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - protected Serializable pkVal() { - return this.id; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/service/ApiService.java b/springboot-jwt/src/main/java/com/xncoding/jwt/service/ApiService.java deleted file mode 100644 index 141ebc0..0000000 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/service/ApiService.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.xncoding.jwt.service; - -import com.xncoding.jwt.api.model.ReportParam; -import com.xncoding.jwt.api.model.VersionParam; -import com.xncoding.jwt.api.model.VersionResult; -import com.xncoding.jwt.common.dao.entity.Pos; -import com.xncoding.jwt.common.dao.entity.Project; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -/** - * 专门用来服务对外接口用Service - */ - -@Service -public class ApiService { - - private static final Logger logger = LoggerFactory.getLogger(ApiService.class); - - /** - * 根据IMEI码查询POS机是否已经入网 - * - * @param imei IMEI码 - * @return 数量 - */ - public int selectCount(String imei) { - return 1; - } - - /** - * 根据IMEI码查找POS - * - * @param imei - * @return - */ - public Pos selectByImei(String imei) { - Pos p = new Pos(); - p.setImei(imei); - return p; - } - - /** - * 根据IMEI码查找绑定网点的POS - * - * @param imei - * @return - */ - public Pos selectBindByImei(String imei) { - return null; - } - - /** - * 根据IMEI码查询POS机是否绑定了网点 - * - * @param imei IMEI码 - * @return 绑定数量 - */ - public int selectBindCount(String imei) { - return 1; - } - - /** - * 更新机具信息 - * - * @param pos - * @return - */ - public int bindLocation(Pos pos) { - return 1; - } - - /** - * 执行POS机入网 - * - * @param param 参数 - * @return 结果 - */ - public int insertPos(Pos param) { - return 1; - } - - /** - * 根据Application Id查询项目 - * - * @param applicationId Application Id - * @return 项目 - */ - public Project selectProjectByApplicationId(String applicationId) { - Project p = new Project(); - return p; - } - - /** - * 更新报告 - * - * @param param 报告参数 - * @return 结果 - */ - public int report(ReportParam param) { - return 1; - } - - /** - * Just Update monitor state - * - * @param param report param - * @param sessionId session id. - * @param state 1:在线 2:离线. - * @return result - */ - public int updateJustState(ReportParam param, String sessionId, Integer state) { - return 1; - } - - /** - * 根据imei码获取session id - * - * @param imei imei码 - * @return sessionId - */ - public String selectSessionId(String imei) { - return "11"; - } - - /** - * 查询版本发布 - * @param param 查询版本参数 - * @return 结果 - */ - public VersionResult selectPublishCount(VersionParam param) { - return new VersionResult(); - } - - /** - * 给某个POS机推送网点解除绑定消息 - * @param imei imei码 - * @param location 解除的网点 - * @return error msg - */ - public String sendUnbind(String imei, String location) { - logger.info("开始给POS机推送解绑消息"); - return null; - } - -} diff --git a/springboot-jwt/src/main/java/com/xncoding/jwt/shiro/JWTFilter.java b/springboot-jwt/src/main/java/com/xncoding/jwt/shiro/JWTFilter.java index 3c256d2..15d3da3 100644 --- a/springboot-jwt/src/main/java/com/xncoding/jwt/shiro/JWTFilter.java +++ b/springboot-jwt/src/main/java/com/xncoding/jwt/shiro/JWTFilter.java @@ -27,11 +27,8 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { return authorization != null; } - /** - * - */ @Override - protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception { + protected boolean executeLogin(ServletRequest request, ServletResponse response) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String authorization = httpServletRequest.getHeader("Authorization"); JWTToken token = new JWTToken(authorization); @@ -53,11 +50,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { @Override protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { if (isLoginAttempt(request, response)) { - try { - executeLogin(request, response); - } catch (Exception e) { - response401(request, response); - } + return executeLogin(request, response); } return true; } @@ -81,7 +74,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { } /** - * 将非法请求跳转到 /401 + * 将非法请求 /401 */ private void response401(ServletRequest req, ServletResponse resp) { try { diff --git a/springboot-jwt/src/test/java/com/xncoding/jwt/SimpleTest.java b/springboot-jwt/src/test/java/com/xncoding/jwt/SimpleTest.java index e403c44..9df78b3 100644 --- a/springboot-jwt/src/test/java/com/xncoding/jwt/SimpleTest.java +++ b/springboot-jwt/src/test/java/com/xncoding/jwt/SimpleTest.java @@ -1,8 +1,5 @@ package com.xncoding.jwt; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.xncoding.jwt.api.model.VersionParam; import com.xncoding.jwt.shiro.ShiroKit; import org.junit.Test; @@ -25,13 +22,4 @@ public class SimpleTest { System.out.println("这个是保存进数据库的密码:" + encodedPassword); System.out.println("这个是保存进数据库的盐:" + salt); } - - @Test - public void testJackson() throws JsonProcessingException { - VersionParam req = new VersionParam(); - - String reqBody = new ObjectMapper().writeValueAsString(req); - - System.out.println(reqBody); - } }