Authored by fangyeqing

FIX:fix bug

Showing 37 changed files with 871 additions and 786 deletions
1 git add --all src/* 1 git add --all src/*
2 git add push.sh 2 git add push.sh
3 git add pom.xml 3 git add pom.xml
4 -git commit -m "FIX some conflicts"  
5 -git push origin zhaoyue-dev2 4 +git commit -m "Fix names"
  5 +git push origin zhaoyue-dev3
6 git status 6 git status
@@ -2,7 +2,8 @@ package com.xkl.authorization.resolvers; @@ -2,7 +2,8 @@ package com.xkl.authorization.resolvers;
2 2
3 import com.xkl.authorization.annotation.CurrentAdmin; 3 import com.xkl.authorization.annotation.CurrentAdmin;
4 import com.xkl.config.Constants; 4 import com.xkl.config.Constants;
5 -import com.xkl.domain.Admin; 5 +import com.xkl.controller.uploadsoft.UpSoftAccountController;
  6 +import com.xkl.domain.XklAdminEntity;
6 import com.xkl.repository.AdminRepository; 7 import com.xkl.repository.AdminRepository;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.core.MethodParameter; 9 import org.springframework.core.MethodParameter;
@@ -16,6 +17,7 @@ import org.springframework.web.multipart.support.MissingServletRequestPartExcept @@ -16,6 +17,7 @@ import org.springframework.web.multipart.support.MissingServletRequestPartExcept
16 17
17 /** 18 /**
18 * 增加方法注入,将含有CurrentAdmin注解的方法参数注入当前登录用户 19 * 增加方法注入,将含有CurrentAdmin注解的方法参数注入当前登录用户
  20 + *
19 * @see CurrentAdmin 21 * @see CurrentAdmin
20 */ 22 */
21 @Component 23 @Component
@@ -27,7 +29,7 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument @@ -27,7 +29,7 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument
27 @Override 29 @Override
28 public boolean supportsParameter(MethodParameter parameter) { 30 public boolean supportsParameter(MethodParameter parameter) {
29 //如果参数类型是Admin并且有CurrentAdmin注解则支持 31 //如果参数类型是Admin并且有CurrentAdmin注解则支持
30 - if (parameter.getParameterType().isAssignableFrom(Admin.class) && 32 + if (parameter.getParameterType().isAssignableFrom(XklAdminEntity.class) &&
31 parameter.hasParameterAnnotation(CurrentAdmin.class)) { 33 parameter.hasParameterAnnotation(CurrentAdmin.class)) {
32 return true; 34 return true;
33 } 35 }
@@ -37,10 +39,11 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument @@ -37,10 +39,11 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument
37 @Override 39 @Override
38 public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { 40 public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
39 //取出鉴权时存入的登录用户Id 41 //取出鉴权时存入的登录用户Id
40 - Long currentAdminId = (Long) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST); 42 + String currentAdminId = ((String) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST)).replace(UpSoftAccountController.UPSOFT_TOKEN_PREFIX, "");
41 if (currentAdminId != null) { 43 if (currentAdminId != null) {
42 //从数据库中查询并返回 44 //从数据库中查询并返回
43 - return adminRepository.findOne(currentAdminId); 45 + XklAdminEntity admin = adminRepository.findByIdAndStatus(Long.parseLong(currentAdminId), Constants.STATUS_OK);
  46 + return admin;
44 } 47 }
45 throw new MissingServletRequestPartException(Constants.CURRENT_USER_ID); 48 throw new MissingServletRequestPartException(Constants.CURRENT_USER_ID);
46 } 49 }
@@ -66,4 +66,13 @@ public interface Constants { @@ -66,4 +66,13 @@ public interface Constants {
66 public static final int LOWER = 1; 66 public static final int LOWER = 1;
67 public static final int HIGHER = 2; 67 public static final int HIGHER = 2;
68 68
  69 + public static final int STATUS_BAD = 0;
  70 + public static final boolean STATUS_BAD2 = false;
  71 + public static final Byte STATUS_BAD3 = 0;
  72 +
  73 + public static final int STATUS_OK = 1;
  74 + public static final boolean STATUS_OK2= true;
  75 + public static final Byte STATUS_OK3= 1;
  76 +
  77 +
69 } 78 }
1 -package com.xkl.config; 1 +package com.xkl;
2 2
3 import com.mangofactory.swagger.configuration.SpringSwaggerConfig; 3 import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
4 import com.mangofactory.swagger.models.dto.ApiInfo; 4 import com.mangofactory.swagger.models.dto.ApiInfo;
@@ -10,6 +10,8 @@ import org.springframework.context.annotation.Configuration; @@ -10,6 +10,8 @@ import org.springframework.context.annotation.Configuration;
10 10
11 import java.sql.Timestamp; 11 import java.sql.Timestamp;
12 12
  13 +//import springfox.documentation.service.ApiInfo;
  14 +
13 /** 15 /**
14 * swagger-ui的配置 16 * swagger-ui的配置
15 */ 17 */
@@ -175,7 +175,7 @@ public class ReportController { @@ -175,7 +175,7 @@ public class ReportController {
175 175
176 if(xklAmpReportEntity!=null && xklAmpReportEntity.size()>0){ 176 if(xklAmpReportEntity!=null && xklAmpReportEntity.size()>0){
177 for(XklAmpReportEntity report:xklAmpReportEntity){ 177 for(XklAmpReportEntity report:xklAmpReportEntity){
178 - long reportTime= UtilTools.getLongTime(report.getUptime()); 178 + long reportTime= report.getUptime().getTime();
179 long stimeLong= UtilTools.getLongTime(stime); 179 long stimeLong= UtilTools.getLongTime(stime);
180 long etimeLong= UtilTools.getLongTime(etime); 180 long etimeLong= UtilTools.getLongTime(etime);
181 long reportId= report.getId(); 181 long reportId= report.getId();
1 package com.xkl.controller; 1 package com.xkl.controller;
2 2
  3 +import com.wordnik.swagger.annotations.ApiImplicitParam;
  4 +import com.wordnik.swagger.annotations.ApiImplicitParams;
  5 +import com.wordnik.swagger.annotations.ApiOperation;
3 import com.xkl.authorization.annotation.Authorization; 6 import com.xkl.authorization.annotation.Authorization;
4 import com.xkl.authorization.annotation.CurrentUser; 7 import com.xkl.authorization.annotation.CurrentUser;
5 import com.xkl.authorization.annotation.Sign; 8 import com.xkl.authorization.annotation.Sign;
@@ -8,11 +11,6 @@ import com.xkl.authorization.model.TokenModel; @@ -8,11 +11,6 @@ import com.xkl.authorization.model.TokenModel;
8 import com.xkl.config.ResultStatus; 11 import com.xkl.config.ResultStatus;
9 import com.xkl.domain.User; 12 import com.xkl.domain.User;
10 import com.xkl.model.ResultModel; 13 import com.xkl.model.ResultModel;
11 -import com.xkl.repository.UserRepository;  
12 -import com.wordnik.swagger.annotations.ApiImplicitParam;  
13 -import com.wordnik.swagger.annotations.ApiImplicitParams;  
14 -import com.wordnik.swagger.annotations.ApiOperation;  
15 -import com.xkl.security.SecurityTool;  
16 import com.xkl.service.ILoginService; 14 import com.xkl.service.ILoginService;
17 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.http.HttpStatus; 16 import org.springframework.http.HttpStatus;
@@ -39,16 +37,15 @@ public class TokenController { @@ -39,16 +37,15 @@ public class TokenController {
39 @Sign 37 @Sign
40 @RequestMapping(method = RequestMethod.POST) 38 @RequestMapping(method = RequestMethod.POST)
41 @ApiOperation(value = "用户登录接口") 39 @ApiOperation(value = "用户登录接口")
42 - public ResponseEntity<ResultModel> login(HttpServletRequest request,@RequestParam String username, @RequestParam String password,  
43 - @RequestParam String sign,@RequestParam long t,@RequestParam int type) {  
44 - if(!(boolean)request.getAttribute("signAspect")) 40 + public ResponseEntity<ResultModel> login(HttpServletRequest request, @RequestParam String username, @RequestParam String password,
  41 + @RequestParam String sign, @RequestParam long t, @RequestParam int type) {
  42 + if (!(boolean) request.getAttribute("signAspect"))
45 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK); 43 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK);
46 44
47 Assert.notNull(username, "username can not be empty"); 45 Assert.notNull(username, "username can not be empty");
48 Assert.notNull(password, "password can not be empty"); 46 Assert.notNull(password, "password can not be empty");
49 47
50 User user = loginService.check(username, password); 48 User user = loginService.check(username, password);
51 -  
52 if (user == null) {//用户,密码错误 49 if (user == null) {//用户,密码错误
53 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.OK); 50 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.OK);
54 } 51 }
@@ -65,9 +62,9 @@ public class TokenController { @@ -65,9 +62,9 @@ public class TokenController {
65 @ApiImplicitParams({ 62 @ApiImplicitParams({
66 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), 63 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
67 }) 64 })
68 - public ResponseEntity<ResultModel> logout(HttpServletRequest request,@CurrentUser User user,  
69 - @RequestParam String sign,@RequestParam long t,@RequestParam int type) {  
70 - if(!(boolean)request.getAttribute("signAspect")) 65 + public ResponseEntity<ResultModel> logout(HttpServletRequest request, @CurrentUser User user,
  66 + @RequestParam String sign, @RequestParam long t, @RequestParam int type) {
  67 + if (!(boolean) request.getAttribute("signAspect"))
71 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK); 68 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK);
72 69
73 tokenManager.deleteToken(String.valueOf(user.getId())); 70 tokenManager.deleteToken(String.valueOf(user.getId()));
@@ -4,6 +4,7 @@ import com.xkl.authorization.annotation.Authorization; @@ -4,6 +4,7 @@ import com.xkl.authorization.annotation.Authorization;
4 import com.xkl.authorization.annotation.CurrentUser; 4 import com.xkl.authorization.annotation.CurrentUser;
5 import com.xkl.authorization.annotation.Sign; 5 import com.xkl.authorization.annotation.Sign;
6 import com.xkl.authorization.manager.ITokenManager; 6 import com.xkl.authorization.manager.ITokenManager;
  7 +import com.xkl.config.Constants;
7 import com.xkl.config.ResultStatus; 8 import com.xkl.config.ResultStatus;
8 import com.xkl.domain.User; 9 import com.xkl.domain.User;
9 import com.xkl.domain.XklMemberEntity; 10 import com.xkl.domain.XklMemberEntity;
@@ -53,7 +54,7 @@ public class UserInfoController { @@ -53,7 +54,7 @@ public class UserInfoController {
53 Assert.notNull(username, "username can not be empty"); 54 Assert.notNull(username, "username can not be empty");
54 Assert.notNull(password, "password can not be empty"); 55 Assert.notNull(password, "password can not be empty");
55 56
56 - User user = userRepository.findByLoginAccount(username); 57 + User user = userRepository.findByLoginAccountAndStatus(username, Constants.STATUS_OK2);
57 if (user != null ) { //用户已注册 58 if (user != null ) { //用户已注册
58 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_IS_EXIT), HttpStatus.OK); 59 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_IS_EXIT), HttpStatus.OK);
59 }else{ 60 }else{
1 package com.xkl.controller.uploadsoft; 1 package com.xkl.controller.uploadsoft;
2 2
3 -import com.wordnik.swagger.annotations.*; 3 +import com.wordnik.swagger.annotations.Api;
  4 +import com.wordnik.swagger.annotations.ApiImplicitParam;
  5 +import com.wordnik.swagger.annotations.ApiImplicitParams;
  6 +import com.wordnik.swagger.annotations.ApiOperation;
4 import com.xkl.authorization.annotation.Authorization; 7 import com.xkl.authorization.annotation.Authorization;
5 import com.xkl.authorization.annotation.CurrentAdmin; 8 import com.xkl.authorization.annotation.CurrentAdmin;
6 -import com.xkl.authorization.annotation.CurrentUser;  
7 import com.xkl.authorization.manager.ITokenManager; 9 import com.xkl.authorization.manager.ITokenManager;
8 import com.xkl.authorization.model.TokenModel; 10 import com.xkl.authorization.model.TokenModel;
9 import com.xkl.config.Constants; 11 import com.xkl.config.Constants;
10 import com.xkl.config.ResultStatus; 12 import com.xkl.config.ResultStatus;
11 -import com.xkl.domain.AMPMachine;  
12 -import com.xkl.domain.Admin; 13 +import com.xkl.domain.XklAdminEntity;
13 import com.xkl.model.ResultModel; 14 import com.xkl.model.ResultModel;
14 import com.xkl.repository.AMPMachineRepository; 15 import com.xkl.repository.AMPMachineRepository;
15 import com.xkl.repository.AdminRepository; 16 import com.xkl.repository.AdminRepository;
16 -import org.hibernate.validator.constraints.SafeHtml; 17 +import com.xkl.security.SecurityTool;
17 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.http.HttpStatus; 19 import org.springframework.http.HttpStatus;
19 import org.springframework.http.ResponseEntity; 20 import org.springframework.http.ResponseEntity;
@@ -39,29 +40,33 @@ public class UpSoftAccountController { @@ -39,29 +40,33 @@ public class UpSoftAccountController {
39 @Autowired 40 @Autowired
40 private ITokenManager tokenManager; 41 private ITokenManager tokenManager;
41 42
42 - private static final String UPSOFT_TOKEN_PREFIX = "UPSOFT_TOKEN"; 43 + public static final String UPSOFT_TOKEN_PREFIX = "UPSOFTTOKEN";
43 44
44 @RequestMapping(method = RequestMethod.POST) 45 @RequestMapping(method = RequestMethod.POST)
45 @ApiOperation(value = "报告上传软件登录", notes = "login") 46 @ApiOperation(value = "报告上传软件登录", notes = "login")
46 47
47 - public ResponseEntity<ResultModel> login(@RequestParam String account, @RequestParam String password  
48 - , @RequestParam String ampserial, @RequestParam String ampkey) { 48 + public ResponseEntity<ResultModel> login(@RequestParam String account, @RequestParam String password) {
  49 + // , @RequestParam String ampserial, @RequestParam String ampkey
49 Assert.notNull(account, "account can not be empty"); 50 Assert.notNull(account, "account can not be empty");
50 Assert.notNull(password, "password can not be empty"); 51 Assert.notNull(password, "password can not be empty");
51 - Assert.notNull(ampserial, "ampserial can not be empty");  
52 - Assert.notNull(ampkey, "ampkey can not be empty");  
53 -  
54 - AMPMachine ampMachine = ampMachineRepository.findBySecretKey(ampkey.trim());  
55 - if (ampMachine == null ||// 未找到密钥所对应的机器  
56 - !ampMachine.getAMPSerial().equals(ampserial) ||//amp序号不符合  
57 - ampMachine.getStatus() != 1) {//用户无效  
58 - return new ResponseEntity<>(ResultModel.error(ResultStatus.AMP_KEY_ERROR), HttpStatus.NOT_FOUND);  
59 - 52 +// Assert.notNull(ampserial, "ampserial can not be empty");
  53 +// Assert.notNull(ampkey, "ampkey can not be empty");
  54 +// XklAMPMachineEntity ampMachine = ampMachineRepository.findBySecretKey(ampkey.trim());
  55 +// if (ampMachine == null ||// 未找到密钥所对应的机器
  56 +// !ampMachine.getAMPSerial().equals(ampserial) ||//amp序号不符合
  57 +// ampMachine.getStatus() != 1) {//用户无效
  58 +// return new ResponseEntity<>(ResultModel.error(ResultStatus.AMP_KEY_ERROR), HttpStatus.NOT_FOUND);
  59 +// }
  60 + XklAdminEntity admin = adminRepository.findByAccountAndStatus(account, Constants.STATUS_OK);
  61 + //未注册
  62 + if (admin == null) {
  63 + //提示用户名或密码错误
  64 + return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND);
60 } 65 }
61 -  
62 - Admin admin = adminRepository.findByAccount(account);  
63 - if (admin == null || //未注册  
64 - !admin.getPwd().equals(password) ||//密码错误 66 + String salt = admin.getSalt();
  67 + String pass_in_db = admin.getPwd();
  68 + String calcuPass = SecurityTool.getPassword(account, password, salt);
  69 + if (!calcuPass.equals(pass_in_db) ||//密码错误
65 admin.getStatus() != 1) {//用户无效 70 admin.getStatus() != 1) {//用户无效
66 //提示用户名或密码错误 71 //提示用户名或密码错误
67 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND); 72 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND);
@@ -78,22 +83,25 @@ public class UpSoftAccountController { @@ -78,22 +83,25 @@ public class UpSoftAccountController {
78 @ApiImplicitParams({ 83 @ApiImplicitParams({
79 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), 84 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
80 }) 85 })
81 - public ResponseEntity<ResultModel> logout(@CurrentAdmin Admin admin) { 86 + public ResponseEntity<ResultModel> logout(@CurrentAdmin XklAdminEntity admin) {
82 tokenManager.deleteToken(UPSOFT_TOKEN_PREFIX + admin.getId()); 87 tokenManager.deleteToken(UPSOFT_TOKEN_PREFIX + admin.getId());
83 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); 88 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
84 } 89 }
85 90
86 - @RequestMapping(value = "/upsoft/modpwd", method = RequestMethod.PUT) 91 + @RequestMapping(method = RequestMethod.PUT)
87 @Authorization 92 @Authorization
88 @ApiOperation(value = "报告上传软件修改密码") 93 @ApiOperation(value = "报告上传软件修改密码")
89 @ApiImplicitParams({ 94 @ApiImplicitParams({
90 @ApiImplicitParam(name = "authorization", value = "请以如下格式输入登录返回信息:adminId_tokens", required = true, dataType = "string", paramType = "header"), 95 @ApiImplicitParam(name = "authorization", value = "请以如下格式输入登录返回信息:adminId_tokens", required = true, dataType = "string", paramType = "header"),
91 }) 96 })
92 - public ResponseEntity<ResultModel> modpwd(@CurrentAdmin Admin admin, @RequestParam String newpwd) {  
93 -  
94 - admin = adminRepository.findById(admin.getId());  
95 - admin.setPwd(newpwd); 97 + public ResponseEntity<ResultModel> modpwd(@CurrentAdmin XklAdminEntity admin, @RequestParam String newpwd) {
  98 + Assert.notNull(newpwd, "password can not be empty");
  99 + String salt = SecurityTool.genSalt();
  100 + String pass2Db = SecurityTool.getPassword(admin.getAccount(), newpwd, salt);
  101 + admin.setPwd(pass2Db);
  102 + admin.setSalt(salt);
96 adminRepository.save(admin); 103 adminRepository.save(admin);
  104 + tokenManager.deleteToken(UPSOFT_TOKEN_PREFIX + admin.getId());
97 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); 105 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
98 } 106 }
99 } 107 }
@@ -5,26 +5,18 @@ import com.wordnik.swagger.annotations.ApiImplicitParams; @@ -5,26 +5,18 @@ import com.wordnik.swagger.annotations.ApiImplicitParams;
5 import com.wordnik.swagger.annotations.ApiOperation; 5 import com.wordnik.swagger.annotations.ApiOperation;
6 import com.xkl.authorization.annotation.Authorization; 6 import com.xkl.authorization.annotation.Authorization;
7 import com.xkl.authorization.annotation.CurrentAdmin; 7 import com.xkl.authorization.annotation.CurrentAdmin;
8 -import com.xkl.config.Constants;  
9 -import com.xkl.config.ResultStatus;  
10 import com.xkl.domain.*; 8 import com.xkl.domain.*;
11 -import com.xkl.model.ReportIdModel;  
12 import com.xkl.model.ResultModel; 9 import com.xkl.model.ResultModel;
13 import com.xkl.repository.*; 10 import com.xkl.repository.*;
14 import com.xkl.security.AntiXSS; 11 import com.xkl.security.AntiXSS;
15 -import com.xkl.security.SecurityTool;  
16 import com.xkl.service.IReportService; 12 import com.xkl.service.IReportService;
17 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
18 -import org.springframework.data.redis.core.RedisTemplate;  
19 -import org.springframework.http.HttpStatus;  
20 import org.springframework.http.ResponseEntity; 14 import org.springframework.http.ResponseEntity;
21 import org.springframework.web.bind.annotation.RequestMapping; 15 import org.springframework.web.bind.annotation.RequestMapping;
22 import org.springframework.web.bind.annotation.RequestMethod; 16 import org.springframework.web.bind.annotation.RequestMethod;
23 import org.springframework.web.bind.annotation.RequestParam; 17 import org.springframework.web.bind.annotation.RequestParam;
24 import org.springframework.web.bind.annotation.RestController; 18 import org.springframework.web.bind.annotation.RestController;
25 19
26 -import java.util.List;  
27 -  
28 20
29 /** 21 /**
30 * 上传报告及删除报告接口。 22 * 上传报告及删除报告接口。
@@ -59,7 +51,7 @@ public class UpSoftReportController { @@ -59,7 +51,7 @@ public class UpSoftReportController {
59 @ApiImplicitParams({ 51 @ApiImplicitParams({
60 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), 52 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
61 }) 53 })
62 - public ResponseEntity<ResultModel> save(@CurrentAdmin Admin admin, @RequestParam String json_report) { 54 + public ResponseEntity<ResultModel> save(@CurrentAdmin XklAdminEntity admin, @RequestParam String json_report) {
63 // 其中json_report格式为上传软件上传上来的原始report格式。 55 // 其中json_report格式为上传软件上传上来的原始report格式。
64 return reportService.save(admin, json_report); 56 return reportService.save(admin, json_report);
65 } 57 }
@@ -71,7 +63,7 @@ public class UpSoftReportController { @@ -71,7 +63,7 @@ public class UpSoftReportController {
71 @ApiImplicitParams({ 63 @ApiImplicitParams({
72 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), 64 @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
73 }) 65 })
74 - public ResponseEntity<ResultModel> delete(@CurrentAdmin Admin admin, @RequestParam long report_id) { 66 + public ResponseEntity<ResultModel> delete(@CurrentAdmin XklAdminEntity admin, @RequestParam long report_id) {
75 return reportService.delete(admin, report_id); 67 return reportService.delete(admin, report_id);
76 } 68 }
77 69
@@ -2,7 +2,7 @@ package com.xkl.controller.uploadsoft; @@ -2,7 +2,7 @@ package com.xkl.controller.uploadsoft;
2 2
3 import com.wordnik.swagger.annotations.ApiOperation; 3 import com.wordnik.swagger.annotations.ApiOperation;
4 4
5 -import com.xkl.domain.UpSoftVersion; 5 +import com.xkl.domain.XklUpSoftVersionEntity;
6 import com.xkl.model.ResultModel; 6 import com.xkl.model.ResultModel;
7 7
8 import com.xkl.repository.UpSoftVersionRepository; 8 import com.xkl.repository.UpSoftVersionRepository;
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RequestMethod; 14 import org.springframework.web.bind.annotation.RequestMethod;
15 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
16 16
17 -import java.util.ArrayList;  
18 import java.util.List; 17 import java.util.List;
19 18
20 /** 19 /**
@@ -31,8 +30,8 @@ public class UpSoftVerController { @@ -31,8 +30,8 @@ public class UpSoftVerController {
31 @RequestMapping(method = RequestMethod.GET) 30 @RequestMapping(method = RequestMethod.GET)
32 @ApiOperation(value = "获取最新软件版本信息,返回值中,version_num为版本号") 31 @ApiOperation(value = "获取最新软件版本信息,返回值中,version_num为版本号")
33 public ResponseEntity<ResultModel> getVersionInfo() { 32 public ResponseEntity<ResultModel> getVersionInfo() {
34 - List<UpSoftVersion> versionList = upSoftVersionRepository.findAllVersion();  
35 - UpSoftVersion version = versionList.get(versionList.size() - 1); 33 + List<XklUpSoftVersionEntity> versionList = upSoftVersionRepository.findAllVersion();
  34 + XklUpSoftVersionEntity version = versionList.get(versionList.size() - 1);
36 return new ResponseEntity<>(ResultModel.ok(version), HttpStatus.OK); 35 return new ResponseEntity<>(ResultModel.ok(version), HttpStatus.OK);
37 } 36 }
38 37
1 -package com.xkl.domain;  
2 -  
3 -import lombok.Data;  
4 -  
5 -import javax.persistence.*;  
6 -import java.sql.Timestamp;  
7 -  
8 -/**  
9 - * 用户数据的domain类  
10 - */  
11 -@Entity  
12 -@Table(name = "xkl_amp_report")  
13 -@Data  
14 -public class AMPReport {  
15 - //用户id  
16 - @Id  
17 - @Column(name = "id")  
18 - @GeneratedValue(strategy = GenerationType.IDENTITY)  
19 - private int id;  
20 -  
21 - @Column(name = "member_id")  
22 - private int member_id;  
23 - // 姓名  
24 - @Column(name = "name")  
25 - private String name;  
26 - // 报告标题  
27 - @Column(name = "title")  
28 - private String title;  
29 - // 体检时间  
30 - @Column(name = "check_time")  
31 - private Timestamp check_time;  
32 - // 上传时间  
33 - @Column(name = "uptime")  
34 - private Timestamp uptime;  
35 - //用户账号  
36 - @Column(name = "account_str")  
37 - private String account_str;  
38 - // 0, 男; 1,女  
39 - @Column(name = "sex")  
40 - private int sex;  
41 -  
42 - @Column(name = "age")  
43 - private int age;  
44 -  
45 - @Column(name = "weight")  
46 - private int weight;  
47 - // 脉搏  
48 - @Column(name = "pulse")  
49 - private int pulse;  
50 - // 呼吸频率  
51 - @Column(name = "breath_rate")  
52 - private int breath_rate;  
53 - // 大气压力  
54 - @Column(name = "atmos_pressure")  
55 - private float atmos_pressure;  
56 -  
57 - @Column(name = "LCA")  
58 - private float LCA;  
59 -  
60 - @Column(name = "RCA")  
61 - private float RCA;  
62 -  
63 - @Column(name = "LAC")  
64 - private float LAC;  
65 -  
66 - @Column(name = "RAC")  
67 - private float RAC;  
68 -  
69 - @Column(name = "ABD")  
70 - private float ABD;  
71 - // 温度和  
72 - @Column(name = "temp_sum")  
73 - private float temp_sum;  
74 - // 稳定值  
75 - @Column(name = "stable")  
76 - private int stable;  
77 - // 报告md5值  
78 - @Column(name = "md5")  
79 - private String md5;  
80 - // 创建者id  
81 - @Column(name = "create_by")  
82 - private int create_by;  
83 - // 机器号码  
84 - @Column(name = "machine_num")  
85 - private String machine_num;  
86 -  
87 - @Column(name = "T0")  
88 - private String T0;  
89 -  
90 - @Column(name = "T1")  
91 - private String T1;  
92 -  
93 - @Column(name = "T2")  
94 - private String T2;  
95 -  
96 - @Column(name = "T3")  
97 - private String T3;  
98 -  
99 - @Column(name = "T4")  
100 - private String T4;  
101 - // 体检结论  
102 - @Column(name = "conclusion")  
103 - private String conclusion;  
104 - // 健康评分  
105 - @Column(name = "score")  
106 - private float score;  
107 - // 所属公司id  
108 - @Column(name = "company_id")  
109 - private int company_id;  
110 - // 报告状态 0,失效;1有效。  
111 - @Column(name = "status")  
112 - private int status;  
113 -  
114 - public void setReport(String name, String title, Timestamp check_time,  
115 - Timestamp uptime, String account_str, int sex, int age,  
116 - int weight, int pulse, int breath_rate, float atmos_pressure,  
117 - float LCA, float RCA, float LAC, float RAC, float ABD, float temp_sum,  
118 - int stable, String md5,String machine_num, String conclusion) {  
119 - this.name = name;  
120 - this.title = title;  
121 - this.check_time = check_time;  
122 - this.uptime = uptime;  
123 - this.account_str = account_str;  
124 - this.sex = sex;  
125 - this.age = age;  
126 - this.weight = weight;  
127 - this.pulse = pulse;  
128 - this.breath_rate = breath_rate;  
129 - this.atmos_pressure = atmos_pressure;  
130 - this.LCA = LCA;  
131 - this.RCA = RCA;  
132 - this.LAC = LAC;  
133 - this.RAC = RAC;  
134 - this.ABD = ABD;  
135 - this.temp_sum = temp_sum;  
136 - this.stable = stable;  
137 - this.md5 = md5;  
138 - this.machine_num = machine_num;  
139 - this.conclusion = conclusion;  
140 - this.status = 1; //默认为有效。  
141 - }  
142 -  
143 - public int getId() {  
144 - return id;  
145 - }  
146 -  
147 - public void setId(int id) {  
148 - this.id = id;  
149 - }  
150 -  
151 - public int getMember_id() {  
152 - return member_id;  
153 - }  
154 -  
155 - public void setMember_id(int member_id) {  
156 - this.member_id = member_id;  
157 - }  
158 -  
159 - public String getName() {  
160 - return name;  
161 - }  
162 -  
163 - public void setName(String name) {  
164 - this.name = name;  
165 - }  
166 -  
167 - public String getTitle() {  
168 - return title;  
169 - }  
170 -  
171 - public void setTitle(String title) {  
172 - this.title = title;  
173 - }  
174 -  
175 - public Timestamp getCheck_time() {  
176 - return check_time;  
177 - }  
178 -  
179 - public void setCheck_time(Timestamp check_time) {  
180 - this.check_time = check_time;  
181 - }  
182 -  
183 - public Timestamp getUptime() {  
184 - return uptime;  
185 - }  
186 -  
187 - public void setUptime(Timestamp uptime) {  
188 - this.uptime = uptime;  
189 - }  
190 -  
191 - public String getAccount_str() {  
192 - return account_str;  
193 - }  
194 -  
195 - public void setAccount_str(String account_str) {  
196 - this.account_str = account_str;  
197 - }  
198 -  
199 - public int getSex() {  
200 - return sex;  
201 - }  
202 -  
203 - public void setSex(int sex) {  
204 - this.sex = sex;  
205 - }  
206 -  
207 - public int getAge() {  
208 - return age;  
209 - }  
210 -  
211 - public void setAge(int age) {  
212 - this.age = age;  
213 - }  
214 -  
215 - public int getWeight() {  
216 - return weight;  
217 - }  
218 -  
219 - public void setWeight(int weight) {  
220 - this.weight = weight;  
221 - }  
222 -  
223 - public int getPulse() {  
224 - return pulse;  
225 - }  
226 -  
227 - public void setPulse(int pulse) {  
228 - this.pulse = pulse;  
229 - }  
230 -  
231 - public int getBreath_rate() {  
232 - return breath_rate;  
233 - }  
234 -  
235 - public void setBreath_rate(int breath_rate) {  
236 - this.breath_rate = breath_rate;  
237 - }  
238 -  
239 - public float getAtmos_pressure() {  
240 - return atmos_pressure;  
241 - }  
242 -  
243 - public void setAtmos_pressure(float atmos_pressure) {  
244 - this.atmos_pressure = atmos_pressure;  
245 - }  
246 -  
247 - public float getLCA() {  
248 - return LCA;  
249 - }  
250 -  
251 - public void setLCA(float LCA) {  
252 - this.LCA = LCA;  
253 - }  
254 -  
255 - public float getRCA() {  
256 - return RCA;  
257 - }  
258 -  
259 - public void setRCA(float RCA) {  
260 - this.RCA = RCA;  
261 - }  
262 -  
263 - public float getLAC() {  
264 - return LAC;  
265 - }  
266 -  
267 - public void setLAC(float LAC) {  
268 - this.LAC = LAC;  
269 - }  
270 -  
271 - public float getRAC() {  
272 - return RAC;  
273 - }  
274 -  
275 - public void setRAC(float RAC) {  
276 - this.RAC = RAC;  
277 - }  
278 -  
279 - public float getABD() {  
280 - return ABD;  
281 - }  
282 -  
283 - public void setABD(float ABD) {  
284 - this.ABD = ABD;  
285 - }  
286 -  
287 - public float getTemp_sum() {  
288 - return temp_sum;  
289 - }  
290 -  
291 - public void setTemp_sum(float temp_sum) {  
292 - this.temp_sum = temp_sum;  
293 - }  
294 -  
295 - public int getStable() {  
296 - return stable;  
297 - }  
298 -  
299 - public void setStable(int stable) {  
300 - this.stable = stable;  
301 - }  
302 -  
303 - public String getMd5() {  
304 - return md5;  
305 - }  
306 -  
307 - public void setMd5(String md5) {  
308 - this.md5 = md5;  
309 - }  
310 -  
311 - public int getCreate_by() {  
312 - return create_by;  
313 - }  
314 -  
315 - public void setCreate_by(int create_by) {  
316 - this.create_by = create_by;  
317 - }  
318 -  
319 - public String getMachine_num() {  
320 - return machine_num;  
321 - }  
322 -  
323 - public void setMachine_num(String machine_num) {  
324 - this.machine_num = machine_num;  
325 - }  
326 -  
327 - public String getT0() {  
328 - return T0;  
329 - }  
330 -  
331 - public void setT0(String t0) {  
332 - T0 = t0;  
333 - }  
334 -  
335 - public String getT1() {  
336 - return T1;  
337 - }  
338 -  
339 - public void setT1(String t1) {  
340 - T1 = t1;  
341 - }  
342 -  
343 - public String getT2() {  
344 - return T2;  
345 - }  
346 -  
347 - public void setT2(String t2) {  
348 - T2 = t2;  
349 - }  
350 -  
351 - public String getT3() {  
352 - return T3;  
353 - }  
354 -  
355 - public void setT3(String t3) {  
356 - T3 = t3;  
357 - }  
358 -  
359 - public String getT4() {  
360 - return T4;  
361 - }  
362 -  
363 - public void setT4(String t4) {  
364 - T4 = t4;  
365 - }  
366 -  
367 - public String getConclusion() {  
368 - return conclusion;  
369 - }  
370 -  
371 - public void setConclusion(String conclusion) {  
372 - this.conclusion = conclusion;  
373 - }  
374 -  
375 - public float getScore() {  
376 - return score;  
377 - }  
378 -  
379 - public void setScore(float score) {  
380 - this.score = score;  
381 - }  
382 -  
383 -  
384 - public int getCompany_id() {  
385 - return company_id;  
386 - }  
387 -  
388 - public void setCompany_id(int company_id) {  
389 - this.company_id = company_id;  
390 - }  
391 -  
392 - public int getStatus() {  
393 - return status;  
394 - }  
395 -  
396 - public void setStatus(int status) {  
397 - this.status = status;  
398 - }  
399 -}  
1 -package com.xkl.domain;  
2 -  
3 -import org.hibernate.annotations.Cascade;  
4 -  
5 -import javax.persistence.*;  
6 -  
7 -/**  
8 - * 用户数据的domain类  
9 - */  
10 -@Entity  
11 -@Table(name = "xkl_amp_report_detail")  
12 -public class AMPReportDetail {  
13 -  
14 - //自增id  
15 - @Id  
16 - @Column(name = "id")  
17 - @GeneratedValue(strategy = GenerationType.IDENTITY)  
18 - private long id;  
19 -  
20 - // 报告id  
21 - @Column(name = "report_id")  
22 - private int reportId;  
23 -  
24 - // 指标id  
25 - @Column(name = "item_id")  
26 - private int itemId;  
27 -  
28 - // 指标值  
29 - @Column(name = "item_value")  
30 - private float itemValue;  
31 -  
32 -  
33 - // 0, normal; 1, lower; 2, higher.  
34 - @Column(name = "status")  
35 - private int status;  
36 -  
37 - public long getId() {  
38 - return id;  
39 - }  
40 -  
41 - public void setId(long id) {  
42 - this.id = id;  
43 - }  
44 -  
45 - public int getReportId() {  
46 - return reportId;  
47 - }  
48 -  
49 - public void setReportId(int reportId) {  
50 - this.reportId = reportId;  
51 - }  
52 -  
53 - public int getItemId() {  
54 - return itemId;  
55 - }  
56 -  
57 - public void setItemId(int itemId) {  
58 - this.itemId = itemId;  
59 - }  
60 -  
61 - public float getItemValue() {  
62 - return itemValue;  
63 - }  
64 -  
65 - public void setItemValue(float itemValue) {  
66 - this.itemValue = itemValue;  
67 - }  
68 -  
69 - public int getStatus() {  
70 - return status;  
71 - }  
72 -  
73 - public void setStatus(int status) {  
74 - this.status = status;  
75 - }  
76 -}  
@@ -8,27 +8,27 @@ import com.xkl.config.ResultStatus; @@ -8,27 +8,27 @@ import com.xkl.config.ResultStatus;
8 * Created by zhao yue on 2016/11/13. 8 * Created by zhao yue on 2016/11/13.
9 */ 9 */
10 public class ReportData { 10 public class ReportData {
11 - private AMPReport ampReport;  
12 - private List<AMPReportDetail> rpDetailList; 11 + private XklAmpReportEntity ampReport;
  12 + private List<XklAmpReportDetailEntity> rpDetailList;
13 // ResultStatus resStatus; 13 // ResultStatus resStatus;
14 14
15 // public ReportData(ResultStatus resStatus) { 15 // public ReportData(ResultStatus resStatus) {
16 // this.resStatus = resStatus; 16 // this.resStatus = resStatus;
17 // } 17 // }
18 18
19 - public AMPReport getAmpReport() { 19 + public XklAmpReportEntity getAmpReport() {
20 return ampReport; 20 return ampReport;
21 } 21 }
22 22
23 - public void setAmpReport(AMPReport ampReport) { 23 + public void setAmpReport(XklAmpReportEntity ampReport) {
24 this.ampReport = ampReport; 24 this.ampReport = ampReport;
25 } 25 }
26 26
27 - public List<AMPReportDetail> getRpDetailList() { 27 + public List<XklAmpReportDetailEntity> getRpDetailList() {
28 return rpDetailList; 28 return rpDetailList;
29 } 29 }
30 30
31 - public void setRpDetailList(List<AMPReportDetail> rpDetailList) { 31 + public void setRpDetailList(List<XklAmpReportDetailEntity> rpDetailList) {
32 this.rpDetailList = rpDetailList; 32 this.rpDetailList = rpDetailList;
33 } 33 }
34 34
1 -package com.xkl.domain;  
2 -  
3 -import javax.persistence.Column;  
4 -import javax.persistence.Entity;  
5 -import javax.persistence.Id;  
6 -import javax.persistence.Table;  
7 -  
8 -/**  
9 - * 指标数据标准的domain类  
10 - */  
11 -@Entity  
12 -@Table(name = "xkl_amp_report_meta_items")  
13 -public class ReportMetaItem {  
14 - // id  
15 - @Id  
16 - @Column(name = "id")  
17 - private long id;  
18 -  
19 - // item_id  
20 - @Column(name = "item_id")  
21 - private int item_id;  
22 -  
23 - // type  
24 - @Column(name = "type")  
25 - private int type;  
26 -  
27 - // title  
28 - @Column(name = "title")  
29 - private String title;  
30 -  
31 - // standard_low_male  
32 - @Column(name = "standard_low_male")  
33 - private float standard_low_male;  
34 -  
35 - // standard_high_male  
36 - @Column(name = "standard_high_male")  
37 - private float standard_high_male;  
38 -  
39 - // standard_low_female  
40 - @Column(name = "standard_low_female")  
41 - private float standard_low_female;  
42 -  
43 - // standard_high_female  
44 - @Column(name = "standard_high_female")  
45 - private float standard_high_female;  
46 -  
47 - // explain_low  
48 - @Column(name = "explain_low")  
49 - private String explain_low;  
50 -  
51 - // explain_high  
52 - @Column(name = "explain_high")  
53 - private String explain_high;  
54 -  
55 - // explain_normal  
56 - @Column(name = "explain_normal")  
57 - private String explain_normal;  
58 -  
59 - public long getId() {  
60 - return id;  
61 - }  
62 -  
63 - public void setId(long id) {  
64 - this.id = id;  
65 - }  
66 -  
67 - public int getItem_id() {  
68 - return item_id;  
69 - }  
70 -  
71 - public void setItem_id(int item_id) {  
72 - this.item_id = item_id;  
73 - }  
74 -  
75 - public int getType() {  
76 - return type;  
77 - }  
78 -  
79 - public void setType(int type) {  
80 - this.type = type;  
81 - }  
82 -  
83 - public String getTitle() {  
84 - return title;  
85 - }  
86 -  
87 - public void setTitle(String title) {  
88 - this.title = title;  
89 - }  
90 -  
91 - public float getStandard_low_male() {  
92 - return standard_low_male;  
93 - }  
94 -  
95 - public void setStandard_low_male(float standard_low_male) {  
96 - this.standard_low_male = standard_low_male;  
97 - }  
98 -  
99 - public float getStandard_high_male() {  
100 - return standard_high_male;  
101 - }  
102 -  
103 - public void setStandard_high_male(float standard_high_male) {  
104 - this.standard_high_male = standard_high_male;  
105 - }  
106 -  
107 - public float getStandard_low_female() {  
108 - return standard_low_female;  
109 - }  
110 -  
111 - public void setStandard_low_female(float standard_low_female) {  
112 - this.standard_low_female = standard_low_female;  
113 - }  
114 -  
115 - public float getStandard_high_female() {  
116 - return standard_high_female;  
117 - }  
118 -  
119 - public void setStandard_high_female(float standard_high_female) {  
120 - this.standard_high_female = standard_high_female;  
121 - }  
122 -  
123 - public String getExplain_low() {  
124 - return explain_low;  
125 - }  
126 -  
127 - public void setExplain_low(String explain_low) {  
128 - this.explain_low = explain_low;  
129 - }  
130 -  
131 - public String getExplain_high() {  
132 - return explain_high;  
133 - }  
134 -  
135 - public void setExplain_high(String explain_high) {  
136 - this.explain_high = explain_high;  
137 - }  
138 -  
139 - public String getExplain_normal() {  
140 - return explain_normal;  
141 - }  
142 -  
143 - public void setExplain_normal(String explain_normal) {  
144 - this.explain_normal = explain_normal;  
145 - }  
146 -}  
@@ -11,7 +11,7 @@ import java.sql.Timestamp; @@ -11,7 +11,7 @@ import java.sql.Timestamp;
11 */ 11 */
12 @Entity 12 @Entity
13 @Table(name = "xkl_amp_machine") 13 @Table(name = "xkl_amp_machine")
14 -public class AMPMachine { 14 +public class XklAMPMachineEntity {
15 15
16 //machine id 16 //machine id
17 @Id 17 @Id
@@ -10,7 +10,7 @@ import javax.persistence.Table; @@ -10,7 +10,7 @@ import javax.persistence.Table;
10 */ 10 */
11 @Entity 11 @Entity
12 @Table(name = "xkl_admin") 12 @Table(name = "xkl_admin")
13 -public class Admin { 13 +public class XklAdminEntity {
14 //用户id 14 //用户id
15 @Id 15 @Id
16 @Column(name = "id") 16 @Column(name = "id")
@@ -33,6 +33,10 @@ public class Admin { @@ -33,6 +33,10 @@ public class Admin {
33 @Column(name = "coid") 33 @Column(name = "coid")
34 private int coid; 34 private int coid;
35 35
  36 + //salt
  37 + @Column(name = "salt")
  38 + private String salt;
  39 +
36 //备注 40 //备注
37 @Column(name = "note") 41 @Column(name = "note")
38 private String note; 42 private String note;
@@ -82,6 +86,14 @@ public class Admin { @@ -82,6 +86,14 @@ public class Admin {
82 this.coid = coid; 86 this.coid = coid;
83 } 87 }
84 88
  89 + public String getSalt() {
  90 + return salt;
  91 + }
  92 +
  93 + public void setSalt(String salt) {
  94 + this.salt = salt;
  95 + }
  96 +
85 public String getNote() { 97 public String getNote() {
86 return note; 98 return note;
87 } 99 }
@@ -13,7 +13,7 @@ import javax.persistence.*; @@ -13,7 +13,7 @@ import javax.persistence.*;
13 @Table(name = "xkl_amp_report_detail", schema = "hanhe_test", catalog = "") 13 @Table(name = "xkl_amp_report_detail", schema = "hanhe_test", catalog = "")
14 public class XklAmpReportDetailEntity { 14 public class XklAmpReportDetailEntity {
15 @Id 15 @Id
16 - @GeneratedValue 16 + @GeneratedValue(strategy = GenerationType.IDENTITY)
17 @Column(name = "id") 17 @Column(name = "id")
18 private long id; 18 private long id;
19 @Basic 19 @Basic
@@ -28,4 +28,44 @@ public class XklAmpReportDetailEntity { @@ -28,4 +28,44 @@ public class XklAmpReportDetailEntity {
28 @Basic 28 @Basic
29 @Column(name = "status") 29 @Column(name = "status")
30 private int status; 30 private int status;
  31 +
  32 + public long getId() {
  33 + return id;
  34 + }
  35 +
  36 + public void setId(long id) {
  37 + this.id = id;
  38 + }
  39 +
  40 + public long getReportId() {
  41 + return reportId;
  42 + }
  43 +
  44 + public void setReportId(long reportId) {
  45 + this.reportId = reportId;
  46 + }
  47 +
  48 + public int getItemId() {
  49 + return itemId;
  50 + }
  51 +
  52 + public void setItemId(int itemId) {
  53 + this.itemId = itemId;
  54 + }
  55 +
  56 + public double getItemValue() {
  57 + return itemValue;
  58 + }
  59 +
  60 + public void setItemValue(double itemValue) {
  61 + this.itemValue = itemValue;
  62 + }
  63 +
  64 + public int getStatus() {
  65 + return status;
  66 + }
  67 +
  68 + public void setStatus(int status) {
  69 + this.status = status;
  70 + }
31 } 71 }
@@ -3,7 +3,7 @@ package com.xkl.domain; @@ -3,7 +3,7 @@ package com.xkl.domain;
3 import lombok.Data; 3 import lombok.Data;
4 4
5 import javax.persistence.*; 5 import javax.persistence.*;
6 -import java.io.Serializable; 6 +import java.sql.Timestamp;
7 7
8 /** 8 /**
9 * Created by win7 on 2016/11/20. 9 * Created by win7 on 2016/11/20.
@@ -15,6 +15,7 @@ import java.io.Serializable; @@ -15,6 +15,7 @@ import java.io.Serializable;
15 public class XklAmpReportEntity { 15 public class XklAmpReportEntity {
16 @Id 16 @Id
17 @Column(name = "id") 17 @Column(name = "id")
  18 + @GeneratedValue(strategy = GenerationType.IDENTITY)
18 private long id; 19 private long id;
19 @Basic 20 @Basic
20 @Column(name = "member_id") 21 @Column(name = "member_id")
@@ -27,10 +28,10 @@ public class XklAmpReportEntity { @@ -27,10 +28,10 @@ public class XklAmpReportEntity {
27 private String title; 28 private String title;
28 @Basic 29 @Basic
29 @Column(name = "check_time") 30 @Column(name = "check_time")
30 - private String checkTime; 31 + private Timestamp checkTime;
31 @Basic 32 @Basic
32 @Column(name = "uptime") 33 @Column(name = "uptime")
33 - private String uptime; 34 + private Timestamp uptime;
34 @Basic 35 @Basic
35 @Column(name = "account_str") 36 @Column(name = "account_str")
36 private String accountStr; 37 private String accountStr;
@@ -109,4 +110,290 @@ public class XklAmpReportEntity { @@ -109,4 +110,290 @@ public class XklAmpReportEntity {
109 @Basic 110 @Basic
110 @Column(name = "status") 111 @Column(name = "status")
111 private Byte status; 112 private Byte status;
  113 +
  114 + public long getId() {
  115 + return id;
  116 + }
  117 +
  118 +
  119 + public void setReport(String name, String title, Timestamp check_time,
  120 + Timestamp uptime, String account_str, Byte sex, Byte age,
  121 + int weight, int pulse, int breath_rate, Double atmos_pressure,
  122 + Double LCA, Double RCA, Double LAC, Double RAC, Double ABD, Double temp_sum,
  123 + int stable, String md5, String machine_num, String conclusion) {
  124 + this.name = name;
  125 + this.title = title;
  126 + this.checkTime = check_time;
  127 + this.uptime = uptime;
  128 + this.accountStr = account_str;
  129 + this.sex = sex;
  130 + this.age = age;
  131 + this.weight = weight;
  132 + this.pulse = pulse;
  133 + this.breathRate = breath_rate;
  134 + this.atmosPressure = atmos_pressure;
  135 + this.lca = LCA;
  136 + this.rca = RCA;
  137 + this.lac = LAC;
  138 + this.rac = RAC;
  139 + this.abd = ABD;
  140 + this.tempSum = temp_sum;
  141 + this.stable = stable;
  142 + this.md5 = md5;
  143 + this.machineNum = machine_num;
  144 + this.conclusion = conclusion;
  145 + this.status = 1; //默认为有效。
  146 + }
  147 +
  148 + public void setId(long id) {
  149 + this.id = id;
  150 + }
  151 +
  152 + public long getMemberId() {
  153 + return memberId;
  154 + }
  155 +
  156 + public void setMemberId(long memberId) {
  157 + this.memberId = memberId;
  158 + }
  159 +
  160 + public String getName() {
  161 + return name;
  162 + }
  163 +
  164 + public void setName(String name) {
  165 + this.name = name;
  166 + }
  167 +
  168 + public String getTitle() {
  169 + return title;
  170 + }
  171 +
  172 + public void setTitle(String title) {
  173 + this.title = title;
  174 + }
  175 +
  176 + public Timestamp getCheckTime() {
  177 + return checkTime;
  178 + }
  179 +
  180 + public void setCheckTime(Timestamp checkTime) {
  181 + this.checkTime = checkTime;
  182 + }
  183 +
  184 + public Timestamp getUptime() {
  185 + return uptime;
  186 + }
  187 +
  188 + public void setUptime(Timestamp uptime) {
  189 + this.uptime = uptime;
  190 + }
  191 +
  192 + public String getAccountStr() {
  193 + return accountStr;
  194 + }
  195 +
  196 + public void setAccountStr(String accountStr) {
  197 + this.accountStr = accountStr;
  198 + }
  199 +
  200 + public Byte getSex() {
  201 + return sex;
  202 + }
  203 +
  204 + public void setSex(Byte sex) {
  205 + this.sex = sex;
  206 + }
  207 +
  208 + public Byte getAge() {
  209 + return age;
  210 + }
  211 +
  212 + public void setAge(Byte age) {
  213 + this.age = age;
  214 + }
  215 +
  216 + public long getWeight() {
  217 + return weight;
  218 + }
  219 +
  220 + public void setWeight(long weight) {
  221 + this.weight = weight;
  222 + }
  223 +
  224 + public long getPulse() {
  225 + return pulse;
  226 + }
  227 +
  228 + public void setPulse(long pulse) {
  229 + this.pulse = pulse;
  230 + }
  231 +
  232 + public long getBreathRate() {
  233 + return breathRate;
  234 + }
  235 +
  236 + public void setBreathRate(long breathRate) {
  237 + this.breathRate = breathRate;
  238 + }
  239 +
  240 + public Double getAtmosPressure() {
  241 + return atmosPressure;
  242 + }
  243 +
  244 + public void setAtmosPressure(Double atmosPressure) {
  245 + this.atmosPressure = atmosPressure;
  246 + }
  247 +
  248 + public Double getLca() {
  249 + return lca;
  250 + }
  251 +
  252 + public void setLca(Double lca) {
  253 + this.lca = lca;
  254 + }
  255 +
  256 + public Double getRca() {
  257 + return rca;
  258 + }
  259 +
  260 + public void setRca(Double rca) {
  261 + this.rca = rca;
  262 + }
  263 +
  264 + public Double getLac() {
  265 + return lac;
  266 + }
  267 +
  268 + public void setLac(Double lac) {
  269 + this.lac = lac;
  270 + }
  271 +
  272 + public Double getRac() {
  273 + return rac;
  274 + }
  275 +
  276 + public void setRac(Double rac) {
  277 + this.rac = rac;
  278 + }
  279 +
  280 + public Double getAbd() {
  281 + return abd;
  282 + }
  283 +
  284 + public void setAbd(Double abd) {
  285 + this.abd = abd;
  286 + }
  287 +
  288 + public Double getTempSum() {
  289 + return tempSum;
  290 + }
  291 +
  292 + public void setTempSum(Double tempSum) {
  293 + this.tempSum = tempSum;
  294 + }
  295 +
  296 + public long getStable() {
  297 + return stable;
  298 + }
  299 +
  300 + public void setStable(long stable) {
  301 + this.stable = stable;
  302 + }
  303 +
  304 + public String getMd5() {
  305 + return md5;
  306 + }
  307 +
  308 + public void setMd5(String md5) {
  309 + this.md5 = md5;
  310 + }
  311 +
  312 + public long getCreateBy() {
  313 + return createBy;
  314 + }
  315 +
  316 + public void setCreateBy(long createBy) {
  317 + this.createBy = createBy;
  318 + }
  319 +
  320 + public String getMachineNum() {
  321 + return machineNum;
  322 + }
  323 +
  324 + public void setMachineNum(String machineNum) {
  325 + this.machineNum = machineNum;
  326 + }
  327 +
  328 + public String getT0() {
  329 + return t0;
  330 + }
  331 +
  332 + public void setT0(String t0) {
  333 + this.t0 = t0;
  334 + }
  335 +
  336 + public String getT1() {
  337 + return t1;
  338 + }
  339 +
  340 + public void setT1(String t1) {
  341 + this.t1 = t1;
  342 + }
  343 +
  344 + public String getT2() {
  345 + return t2;
  346 + }
  347 +
  348 + public void setT2(String t2) {
  349 + this.t2 = t2;
  350 + }
  351 +
  352 + public String getT3() {
  353 + return t3;
  354 + }
  355 +
  356 + public void setT3(String t3) {
  357 + this.t3 = t3;
  358 + }
  359 +
  360 + public String getT4() {
  361 + return t4;
  362 + }
  363 +
  364 + public void setT4(String t4) {
  365 + this.t4 = t4;
  366 + }
  367 +
  368 + public String getConclusion() {
  369 + return conclusion;
  370 + }
  371 +
  372 + public void setConclusion(String conclusion) {
  373 + this.conclusion = conclusion;
  374 + }
  375 +
  376 + public Double getScore() {
  377 + return score;
  378 + }
  379 +
  380 + public void setScore(Double score) {
  381 + this.score = score;
  382 + }
  383 +
  384 + public long getCompanyId() {
  385 + return companyId;
  386 + }
  387 +
  388 + public void setCompanyId(long companyId) {
  389 + this.companyId = companyId;
  390 + }
  391 +
  392 + public Byte getStatus() {
  393 + return status;
  394 + }
  395 +
  396 + public void setStatus(Byte status) {
  397 + this.status = status;
  398 + }
112 } 399 }
@@ -26,4 +26,35 @@ public class XklAmpReportHealthScoreEntity { @@ -26,4 +26,35 @@ public class XklAmpReportHealthScoreEntity {
26 @Column(name = "type_health_score") 26 @Column(name = "type_health_score")
27 private double typeHealthScore; 27 private double typeHealthScore;
28 28
  29 + public long getId() {
  30 + return id;
  31 + }
  32 +
  33 + public void setId(long id) {
  34 + this.id = id;
  35 + }
  36 +
  37 + public long getReportId() {
  38 + return reportId;
  39 + }
  40 +
  41 + public void setReportId(long reportId) {
  42 + this.reportId = reportId;
  43 + }
  44 +
  45 + public int getType() {
  46 + return type;
  47 + }
  48 +
  49 + public void setType(int type) {
  50 + this.type = type;
  51 + }
  52 +
  53 + public double getTypeHealthScore() {
  54 + return typeHealthScore;
  55 + }
  56 +
  57 + public void setTypeHealthScore(double typeHealthScore) {
  58 + this.typeHealthScore = typeHealthScore;
  59 + }
29 } 60 }
@@ -45,4 +45,92 @@ public class XklAmpReportMetaItemsEntity { @@ -45,4 +45,92 @@ public class XklAmpReportMetaItemsEntity {
45 @Basic 45 @Basic
46 @Column(name = "explain_normal") 46 @Column(name = "explain_normal")
47 private String explainNormal; 47 private String explainNormal;
  48 +
  49 + public int getId() {
  50 + return id;
  51 + }
  52 +
  53 + public void setId(int id) {
  54 + this.id = id;
  55 + }
  56 +
  57 + public int getItemId() {
  58 + return itemId;
  59 + }
  60 +
  61 + public void setItemId(int itemId) {
  62 + this.itemId = itemId;
  63 + }
  64 +
  65 + public int getType() {
  66 + return type;
  67 + }
  68 +
  69 + public void setType(int type) {
  70 + this.type = type;
  71 + }
  72 +
  73 + public String getTitle() {
  74 + return title;
  75 + }
  76 +
  77 + public void setTitle(String title) {
  78 + this.title = title;
  79 + }
  80 +
  81 + public double getStandardLowMale() {
  82 + return standardLowMale;
  83 + }
  84 +
  85 + public void setStandardLowMale(double standardLowMale) {
  86 + this.standardLowMale = standardLowMale;
  87 + }
  88 +
  89 + public double getStandardHighMale() {
  90 + return standardHighMale;
  91 + }
  92 +
  93 + public void setStandardHighMale(double standardHighMale) {
  94 + this.standardHighMale = standardHighMale;
  95 + }
  96 +
  97 + public double getStandardLowFemale() {
  98 + return standardLowFemale;
  99 + }
  100 +
  101 + public void setStandardLowFemale(double standardLowFemale) {
  102 + this.standardLowFemale = standardLowFemale;
  103 + }
  104 +
  105 + public double getStandardHighFemale() {
  106 + return standardHighFemale;
  107 + }
  108 +
  109 + public void setStandardHighFemale(double standardHighFemale) {
  110 + this.standardHighFemale = standardHighFemale;
  111 + }
  112 +
  113 + public String getExplainLow() {
  114 + return explainLow;
  115 + }
  116 +
  117 + public void setExplainLow(String explainLow) {
  118 + this.explainLow = explainLow;
  119 + }
  120 +
  121 + public String getExplainHigh() {
  122 + return explainHigh;
  123 + }
  124 +
  125 + public void setExplainHigh(String explainHigh) {
  126 + this.explainHigh = explainHigh;
  127 + }
  128 +
  129 + public String getExplainNormal() {
  130 + return explainNormal;
  131 + }
  132 +
  133 + public void setExplainNormal(String explainNormal) {
  134 + this.explainNormal = explainNormal;
  135 + }
48 } 136 }
@@ -90,4 +90,156 @@ public class XklAmpReportMetaScoreStandardEntity { @@ -90,4 +90,156 @@ public class XklAmpReportMetaScoreStandardEntity {
90 result = interval5Score; 90 result = interval5Score;
91 return result; 91 return result;
92 } 92 }
  93 +
  94 + public long getId() {
  95 + return id;
  96 + }
  97 +
  98 + public void setId(long id) {
  99 + this.id = id;
  100 + }
  101 +
  102 + public int getItemId() {
  103 + return itemId;
  104 + }
  105 +
  106 + public void setItemId(int itemId) {
  107 + this.itemId = itemId;
  108 + }
  109 +
  110 + public String getItemName() {
  111 + return itemName;
  112 + }
  113 +
  114 + public void setItemName(String itemName) {
  115 + this.itemName = itemName;
  116 + }
  117 +
  118 + public int getItemType() {
  119 + return itemType;
  120 + }
  121 +
  122 + public void setItemType(int itemType) {
  123 + this.itemType = itemType;
  124 + }
  125 +
  126 + public double getInterval1Min() {
  127 + return interval1Min;
  128 + }
  129 +
  130 + public void setInterval1Min(double interval1Min) {
  131 + this.interval1Min = interval1Min;
  132 + }
  133 +
  134 + public double getInterval1Max() {
  135 + return interval1Max;
  136 + }
  137 +
  138 + public void setInterval1Max(double interval1Max) {
  139 + this.interval1Max = interval1Max;
  140 + }
  141 +
  142 + public double getInterval1Score() {
  143 + return interval1Score;
  144 + }
  145 +
  146 + public void setInterval1Score(double interval1Score) {
  147 + this.interval1Score = interval1Score;
  148 + }
  149 +
  150 + public double getInterval2Min() {
  151 + return interval2Min;
  152 + }
  153 +
  154 + public void setInterval2Min(double interval2Min) {
  155 + this.interval2Min = interval2Min;
  156 + }
  157 +
  158 + public double getInterval2Max() {
  159 + return interval2Max;
  160 + }
  161 +
  162 + public void setInterval2Max(double interval2Max) {
  163 + this.interval2Max = interval2Max;
  164 + }
  165 +
  166 + public double getInterval2Score() {
  167 + return interval2Score;
  168 + }
  169 +
  170 + public void setInterval2Score(double interval2Score) {
  171 + this.interval2Score = interval2Score;
  172 + }
  173 +
  174 + public double getInterval3Min() {
  175 + return interval3Min;
  176 + }
  177 +
  178 + public void setInterval3Min(double interval3Min) {
  179 + this.interval3Min = interval3Min;
  180 + }
  181 +
  182 + public double getInterval3Max() {
  183 + return interval3Max;
  184 + }
  185 +
  186 + public void setInterval3Max(double interval3Max) {
  187 + this.interval3Max = interval3Max;
  188 + }
  189 +
  190 + public double getInterval3Score() {
  191 + return interval3Score;
  192 + }
  193 +
  194 + public void setInterval3Score(double interval3Score) {
  195 + this.interval3Score = interval3Score;
  196 + }
  197 +
  198 + public double getInterval4Min() {
  199 + return interval4Min;
  200 + }
  201 +
  202 + public void setInterval4Min(double interval4Min) {
  203 + this.interval4Min = interval4Min;
  204 + }
  205 +
  206 + public double getInterval4Max() {
  207 + return interval4Max;
  208 + }
  209 +
  210 + public void setInterval4Max(double interval4Max) {
  211 + this.interval4Max = interval4Max;
  212 + }
  213 +
  214 + public double getInterval4Score() {
  215 + return interval4Score;
  216 + }
  217 +
  218 + public void setInterval4Score(double interval4Score) {
  219 + this.interval4Score = interval4Score;
  220 + }
  221 +
  222 + public double getInterval5Min() {
  223 + return interval5Min;
  224 + }
  225 +
  226 + public void setInterval5Min(double interval5Min) {
  227 + this.interval5Min = interval5Min;
  228 + }
  229 +
  230 + public double getInterval5Max() {
  231 + return interval5Max;
  232 + }
  233 +
  234 + public void setInterval5Max(double interval5Max) {
  235 + this.interval5Max = interval5Max;
  236 + }
  237 +
  238 + public double getInterval5Score() {
  239 + return interval5Score;
  240 + }
  241 +
  242 + public void setInterval5Score(double interval5Score) {
  243 + this.interval5Score = interval5Score;
  244 + }
93 } 245 }
@@ -10,7 +10,7 @@ import javax.persistence.Table; @@ -10,7 +10,7 @@ import javax.persistence.Table;
10 */ 10 */
11 @Entity 11 @Entity
12 @Table(name = "xkl_upsoft_version") 12 @Table(name = "xkl_upsoft_version")
13 -public class UpSoftVersion { 13 +public class XklUpSoftVersionEntity {
14 //用户id 14 //用户id
15 @Id 15 @Id
16 @Column(name = "id") 16 @Column(name = "id")
@@ -24,4 +24,68 @@ public class ReportDetailModel { @@ -24,4 +24,68 @@ public class ReportDetailModel {
24 */ 24 */
25 private int type; 25 private int type;
26 private double typeHealthScore; 26 private double typeHealthScore;
  27 +
  28 + public int getItemId() {
  29 + return itemId;
  30 + }
  31 +
  32 + public void setItemId(int itemId) {
  33 + this.itemId = itemId;
  34 + }
  35 +
  36 + public double getItemValue() {
  37 + return itemValue;
  38 + }
  39 +
  40 + public void setItemValue(double itemValue) {
  41 + this.itemValue = itemValue;
  42 + }
  43 +
  44 + public int getStatus() {
  45 + return status;
  46 + }
  47 +
  48 + public void setStatus(int status) {
  49 + this.status = status;
  50 + }
  51 +
  52 + public String getTitle() {
  53 + return title;
  54 + }
  55 +
  56 + public void setTitle(String title) {
  57 + this.title = title;
  58 + }
  59 +
  60 + public String getNormalNv() {
  61 + return normalNv;
  62 + }
  63 +
  64 + public void setNormalNv(String normalNv) {
  65 + this.normalNv = normalNv;
  66 + }
  67 +
  68 + public String getNormal() {
  69 + return normal;
  70 + }
  71 +
  72 + public void setNormal(String normal) {
  73 + this.normal = normal;
  74 + }
  75 +
  76 + public int getType() {
  77 + return type;
  78 + }
  79 +
  80 + public void setType(int type) {
  81 + this.type = type;
  82 + }
  83 +
  84 + public double getTypeHealthScore() {
  85 + return typeHealthScore;
  86 + }
  87 +
  88 + public void setTypeHealthScore(double typeHealthScore) {
  89 + this.typeHealthScore = typeHealthScore;
  90 + }
27 } 91 }
@@ -4,18 +4,18 @@ package com.xkl.model; @@ -4,18 +4,18 @@ package com.xkl.model;
4 public class ReportIdModel { 4 public class ReportIdModel {
5 5
6 // Report Id 6 // Report Id
7 - private int reportId; 7 + private long reportId;
8 8
9 9
10 - public ReportIdModel(int reportId) { 10 + public ReportIdModel(long reportId) {
11 this.reportId = reportId; 11 this.reportId = reportId;
12 } 12 }
13 13
14 - public int getReportId() { 14 + public long getReportId() {
15 return reportId; 15 return reportId;
16 } 16 }
17 17
18 - public void setReportId(int reportId) { 18 + public void setReportId(long reportId) {
19 this.reportId = reportId; 19 this.reportId = reportId;
20 } 20 }
21 } 21 }
@@ -12,4 +12,22 @@ import lombok.Data; @@ -12,4 +12,22 @@ import lombok.Data;
12 public class ReportItemGraphModel { 12 public class ReportItemGraphModel {
13 public long time; 13 public long time;
14 public double value; 14 public double value;
  15 +
  16 +
  17 + public long getTime() {
  18 + return time;
  19 + }
  20 +
  21 + public void setTime(long time) {
  22 + this.time = time;
  23 + }
  24 +
  25 + public double getValue() {
  26 + return value;
  27 + }
  28 +
  29 + public void setValue(double value) {
  30 + this.value = value;
  31 + }
  32 +
15 } 33 }
@@ -18,4 +18,5 @@ public class ReportModel { @@ -18,4 +18,5 @@ public class ReportModel {
18 private XklAmpReportEntity Report; 18 private XklAmpReportEntity Report;
19 19
20 private List<ReportDetailModel> ReportDetailList; 20 private List<ReportDetailModel> ReportDetailList;
  21 +
21 } 22 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.AMPMachine; 3 +import com.xkl.domain.XklAMPMachineEntity;
4 import org.springframework.data.repository.CrudRepository; 4 import org.springframework.data.repository.CrudRepository;
5 5
6 /** 6 /**
7 - * AMPMachine 类的CRUD操作 7 + * XklAMPMachineEntity 类的CRUD操作
8 * 8 *
9 - * @see AMPMachine 9 + * @see XklAMPMachineEntity
10 */ 10 */
11 -public interface AMPMachineRepository extends CrudRepository<AMPMachine, Long> { 11 +public interface AMPMachineRepository extends CrudRepository<XklAMPMachineEntity, Long> {
12 12
13 - public AMPMachine findBySecretKey(String secretKey); 13 + public XklAMPMachineEntity findBySecretKey(String secretKey);
14 } 14 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.Admin; 3 +import com.xkl.domain.XklAdminEntity;
4 import org.springframework.data.repository.CrudRepository; 4 import org.springframework.data.repository.CrudRepository;
5 5
6 /** 6 /**
7 * Admin类的CRUD操作 7 * Admin类的CRUD操作
8 - * @see Admin 8 + * @see XklAdminEntity
9 */ 9 */
10 -public interface AdminRepository extends CrudRepository<Admin, Long> { 10 +public interface AdminRepository extends CrudRepository<XklAdminEntity, Long> {
11 11
12 - public Admin findByAccount(String account);  
13 - public Admin findById(long id); 12 +// public XklAdminEntity findByAccount(String account);
  13 + public XklAdminEntity findByAccountAndStatus(String account, int status);
  14 + public XklAdminEntity findByIdAndStatus(long id, int status);
14 15
15 } 16 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.AMPReport;  
4 -import com.xkl.domain.AMPReportDetail; 3 +import com.xkl.domain.XklAmpReportDetailEntity;
5 import org.springframework.data.repository.CrudRepository; 4 import org.springframework.data.repository.CrudRepository;
6 5
7 import java.util.List; 6 import java.util.List;
@@ -9,8 +8,8 @@ import java.util.List; @@ -9,8 +8,8 @@ import java.util.List;
9 /** 8 /**
10 * AMPReportDetail类的CRUD操作 9 * AMPReportDetail类的CRUD操作
11 * 10 *
12 - * @see AMPReportDetail 11 + * @see XklAmpReportDetailEntity
13 */ 12 */
14 -public interface ReportDetailRepository extends CrudRepository<AMPReportDetail, Long> {  
15 - public List<AMPReportDetail> findByReportId(int reportId); 13 +public interface ReportDetailRepository extends CrudRepository<XklAmpReportDetailEntity, Long> {
  14 + public List<XklAmpReportDetailEntity> findByReportId(long reportId);
16 } 15 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.ReportMetaItem; 3 +import com.xkl.domain.XklAmpReportMetaItemsEntity;
4 import com.xkl.domain.User; 4 import com.xkl.domain.User;
5 import org.springframework.data.repository.CrudRepository; 5 import org.springframework.data.repository.CrudRepository;
6 6
@@ -8,5 +8,5 @@ import org.springframework.data.repository.CrudRepository; @@ -8,5 +8,5 @@ import org.springframework.data.repository.CrudRepository;
8 * ReportMetaItems类的CRUD操作 8 * ReportMetaItems类的CRUD操作
9 * @see User 9 * @see User
10 */ 10 */
11 -public interface ReportMetaItemsRepository extends CrudRepository<ReportMetaItem, Long> { 11 +public interface ReportMetaItemsRepository extends CrudRepository<XklAmpReportMetaItemsEntity, Long> {
12 } 12 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.AMPReport;  
4 -import com.xkl.domain.Admin;  
5 import org.springframework.data.repository.CrudRepository; 3 import org.springframework.data.repository.CrudRepository;
  4 +import com.xkl.domain.XklAmpReportEntity;
6 5
7 /** 6 /**
8 * AMPReport类的CRUD操作 7 * AMPReport类的CRUD操作
9 * 8 *
10 - * @see AMPReport 9 + * @see XklAmpReportEntity
11 */ 10 */
12 -public interface ReportRepository extends CrudRepository<AMPReport, Long> {  
13 - public AMPReport findByMd5(String md5); 11 +public interface ReportRepository extends CrudRepository<XklAmpReportEntity, Long> {
  12 + public XklAmpReportEntity findByMd5AndStatus(String md5, Byte status);
14 13
15 - public AMPReport findById(int id); 14 + public XklAmpReportEntity findById(long id);
16 15
17 } 16 }
1 package com.xkl.repository; 1 package com.xkl.repository;
2 2
3 -import com.xkl.domain.UpSoftVersion; 3 +import com.xkl.domain.XklUpSoftVersionEntity;
4 import org.springframework.data.jpa.repository.Query; 4 import org.springframework.data.jpa.repository.Query;
5 import org.springframework.data.repository.CrudRepository; 5 import org.springframework.data.repository.CrudRepository;
6 6
@@ -9,9 +9,9 @@ import java.util.List; @@ -9,9 +9,9 @@ import java.util.List;
9 /** 9 /**
10 * User类的CRUD操作 10 * User类的CRUD操作
11 * 11 *
12 - * @see UpSoftVersion 12 + * @see XklUpSoftVersionEntity
13 */ 13 */
14 -public interface UpSoftVersionRepository extends CrudRepository<UpSoftVersion, Long> {  
15 - @Query("select upsoft from UpSoftVersion upsoft")  
16 - public List<UpSoftVersion> findAllVersion(); 14 +public interface UpSoftVersionRepository extends CrudRepository<XklUpSoftVersionEntity, Long> {
  15 + @Query("select upsoft from XklUpSoftVersionEntity upsoft")
  16 + public List<XklUpSoftVersionEntity> findAllVersion();
17 } 17 }
@@ -8,6 +8,5 @@ import org.springframework.data.repository.CrudRepository; @@ -8,6 +8,5 @@ import org.springframework.data.repository.CrudRepository;
8 * @see com.xkl.domain.User 8 * @see com.xkl.domain.User
9 */ 9 */
10 public interface UserRepository extends CrudRepository<User, Long> { 10 public interface UserRepository extends CrudRepository<User, Long> {
11 -  
12 - public User findByLoginAccount(String username); 11 + public User findByLoginAccountAndStatus(String username,boolean status);
13 } 12 }
1 package com.xkl.service; 1 package com.xkl.service;
2 2
3 -import com.xkl.domain.Admin;  
4 -import com.xkl.domain.ReportData;  
5 -import com.xkl.domain.User; 3 +import com.xkl.domain.XklAdminEntity;
6 import com.xkl.model.ResultModel; 4 import com.xkl.model.ResultModel;
7 import org.springframework.http.ResponseEntity; 5 import org.springframework.http.ResponseEntity;
8 -import org.springframework.web.bind.annotation.RequestParam;  
9 6
10 /** 7 /**
11 * Created by zhao yue on 2016/11/26. 8 * Created by zhao yue on 2016/11/26.
@@ -13,10 +10,10 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -13,10 +10,10 @@ import org.springframework.web.bind.annotation.RequestParam;
13 public interface IReportService { 10 public interface IReportService {
14 // public ReportData parseReport(String reportJson, String md5); 11 // public ReportData parseReport(String reportJson, String md5);
15 12
16 -// public int saveReport(ReportData report, Admin admin, User user); 13 +// public int saveReport(ReportData report, XklAdminEntity admin, User user);
17 14
18 - public ResponseEntity<ResultModel> delete(Admin admin, long report_id);  
19 - public ResponseEntity<ResultModel> save(Admin admin, String json_report); 15 + public ResponseEntity<ResultModel> delete(XklAdminEntity admin, long report_id);
  16 + public ResponseEntity<ResultModel> save(XklAdminEntity admin, String json_report);
20 17
21 18
22 19
1 package com.xkl.service; 1 package com.xkl.service;
2 2
  3 +import com.xkl.config.Constants;
3 import com.xkl.domain.User; 4 import com.xkl.domain.User;
4 import com.xkl.repository.UserRepository; 5 import com.xkl.repository.UserRepository;
5 import com.xkl.security.SecurityTool; 6 import com.xkl.security.SecurityTool;
@@ -15,7 +16,7 @@ public class LoginServiceImpl implements ILoginService{ @@ -15,7 +16,7 @@ public class LoginServiceImpl implements ILoginService{
15 private UserRepository userRepository; 16 private UserRepository userRepository;
16 @Override 17 @Override
17 public User check(String username, String password) { 18 public User check(String username, String password) {
18 - User user = userRepository.findByLoginAccount(username); 19 + User user = userRepository.findByLoginAccountAndStatus(username, Constants.STATUS_OK2);
19 20
20 if (user == null) { //用户不存在 21 if (user == null) { //用户不存在
21 return null; 22 return null;
@@ -11,6 +11,7 @@ import com.xkl.repository.ReportMetaItemsRepository; @@ -11,6 +11,7 @@ import com.xkl.repository.ReportMetaItemsRepository;
11 import com.xkl.repository.ReportRepository; 11 import com.xkl.repository.ReportRepository;
12 import com.xkl.repository.UserRepository; 12 import com.xkl.repository.UserRepository;
13 import com.xkl.security.SecurityTool; 13 import com.xkl.security.SecurityTool;
  14 +import com.xkl.tools.UtilTools;
14 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.data.redis.core.RedisTemplate; 16 import org.springframework.data.redis.core.RedisTemplate;
16 import org.springframework.http.HttpStatus; 17 import org.springframework.http.HttpStatus;
@@ -45,22 +46,22 @@ public class ReportService implements IReportService { @@ -45,22 +46,22 @@ public class ReportService implements IReportService {
45 this.redis = redis; 46 this.redis = redis;
46 } 47 }
47 48
48 - private static Map<Integer, ReportMetaItem> rpMetaItemMap = new HashMap<Integer, ReportMetaItem>(); 49 + private static Map<Integer, XklAmpReportMetaItemsEntity> rpMetaItemMap = new HashMap<Integer, XklAmpReportMetaItemsEntity>();
49 50
50 /* 51 /*
51 * 存储报告 52 * 存储报告
52 */ 53 */
53 - public ResponseEntity<ResultModel> save(Admin admin, String json_report) { 54 + public ResponseEntity<ResultModel> save(XklAdminEntity admin, String json_report) {
54 // 验证存在性 55 // 验证存在性
55 String reportMd5 = SecurityTool.encode("MD5", json_report); 56 String reportMd5 = SecurityTool.encode("MD5", json_report);
56 - // 验证是否有对应的会员 57 + // 验证是无对应的会员,rediskey
57 String reportWithNoUser = reportMd5 + "Member"; 58 String reportWithNoUser = reportMd5 + "Member";
58 - // 验证报告格式是否有问题 59 + // 验证报告格式有问题,rediskey
59 String reportWrongFormat = reportMd5 + "Format"; 60 String reportWrongFormat = reportMd5 + "Format";
60 /* 61 /*
61 * 如果已经处理过的报告,不再进行处理。 62 * 如果已经处理过的报告,不再进行处理。
62 */ 63 */
63 - AMPReport report = reportRepository.findByMd5(reportMd5); 64 + XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK3);
64 if (report != null && report.getStatus() > 0) { 65 if (report != null && report.getStatus() > 0) {
65 // 返回,报告已存在。 66 // 返回,报告已存在。
66 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK); 67 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK);
@@ -86,7 +87,7 @@ public class ReportService implements IReportService { @@ -86,7 +87,7 @@ public class ReportService implements IReportService {
86 /* 87 /*
87 * 检验会员存在性 88 * 检验会员存在性
88 */ 89 */
89 - User user = userRepository.findByLoginAccount(reportData.getAmpReport().getAccount_str()); 90 + User user = userRepository.findByLoginAccountAndStatus(reportData.getAmpReport().getAccountStr(), Constants.STATUS_OK2);
90 if (user == null) { 91 if (user == null) {
91 redis.boundValueOps(reportWithNoUser).set(""); 92 redis.boundValueOps(reportWithNoUser).set("");
92 // 返回,报告对应会员不存在。 93 // 返回,报告对应会员不存在。
@@ -96,7 +97,7 @@ public class ReportService implements IReportService { @@ -96,7 +97,7 @@ public class ReportService implements IReportService {
96 /* 97 /*
97 * 存储报告 98 * 存储报告
98 */ 99 */
99 - int reportId = save2DB(reportData, admin, user); 100 + long reportId = save2DB(reportData, admin, user);
100 if (reportId > 0) { 101 if (reportId > 0) {
101 // 返回,报告存储成功,报告id 102 // 返回,报告存储成功,报告id
102 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK); 103 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
@@ -109,22 +110,22 @@ public class ReportService implements IReportService { @@ -109,22 +110,22 @@ public class ReportService implements IReportService {
109 /* 110 /*
110 * 操作员删除报告,只能删除该操作员自己创建的报告。 111 * 操作员删除报告,只能删除该操作员自己创建的报告。
111 */ 112 */
112 - public ResponseEntity<ResultModel> delete(Admin admin, long report_id) { 113 + public ResponseEntity<ResultModel> delete(XklAdminEntity admin, long report_id) {
113 // 1. 得到report,验证报告存在性 114 // 1. 得到report,验证报告存在性
114 - AMPReport report = reportRepository.findById((int) report_id);  
115 - if (report == null) { 115 + XklAmpReportEntity report = reportRepository.findById( report_id);
  116 + if (report == null || report.getStatus() == 0) {
116 // 报告不存在,返回 117 // 报告不存在,返回
117 - return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID__ERROR), HttpStatus.NOT_FOUND); 118 + return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
118 } 119 }
119 120
120 // 2. 验证admin 121 // 2. 验证admin
121 - if (report.getCreate_by() != admin.getId()) { 122 + if (report.getCreateBy() != admin.getId()) {
122 // 非此admin创建,不能删除,返回 123 // 非此admin创建,不能删除,返回
123 return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.NOT_FOUND); 124 return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.NOT_FOUND);
124 } 125 }
125 // 3. 删除report和detail,返回ok 126 // 3. 删除report和detail,返回ok
126 reportRepository.delete(report); 127 reportRepository.delete(report);
127 - List<AMPReportDetail> detailList = reportDetailRepository.findByReportId(report.getId()); 128 + List<XklAmpReportDetailEntity> detailList = reportDetailRepository.findByReportId(report.getId());
128 reportDetailRepository.delete(detailList); 129 reportDetailRepository.delete(detailList);
129 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); 130 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
130 } 131 }
@@ -137,12 +138,12 @@ public class ReportService implements IReportService { @@ -137,12 +138,12 @@ public class ReportService implements IReportService {
137 验证member 138 验证member
138 获取admin 139 获取admin
139 */ 140 */
140 - // 需要程喆增加 title,account,machine_num字段 String; 修改set字段为int,0男,1女。  
141 - // 125项目,改为float类型。 141 + // 需要程喆增加 title,account,machine_num字段 String; 修改set字段为int,0男,1女。125项目,改为float类型。
  142 + //
142 private ReportData parseReport(String reportJson, String md5) { 143 private ReportData parseReport(String reportJson, String md5) {
143 ReportData reportData = new ReportData(); 144 ReportData reportData = new ReportData();
144 - AMPReport ampReport = new AMPReport();  
145 - List<AMPReportDetail> detailList = new ArrayList<>(); 145 + XklAmpReportEntity ampReport = new XklAmpReportEntity();
  146 + List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
146 int sex; 147 int sex;
147 148
148 /* 149 /*
@@ -156,18 +157,18 @@ public class ReportService implements IReportService { @@ -156,18 +157,18 @@ public class ReportService implements IReportService {
156 Timestamp.valueOf(rpJson.getString("report_date")), 157 Timestamp.valueOf(rpJson.getString("report_date")),
157 new Timestamp(System.currentTimeMillis()), 158 new Timestamp(System.currentTimeMillis()),
158 rpJson.getString("account"),/// 159 rpJson.getString("account"),///
159 - rpJson.getInteger("sex").intValue(),///  
160 - rpJson.getInteger("age").intValue(), 160 + rpJson.getInteger("sex").byteValue(),///
  161 + rpJson.getInteger("age").byteValue(),
161 rpJson.getInteger("weight").intValue(), 162 rpJson.getInteger("weight").intValue(),
162 rpJson.getInteger("pulse").intValue(), 163 rpJson.getInteger("pulse").intValue(),
163 rpJson.getInteger("respiratory_rate").intValue(), 164 rpJson.getInteger("respiratory_rate").intValue(),
164 - rpJson.getFloat("atmospheric_pressure").floatValue(),  
165 - rpJson.getFloat("LCA").floatValue(),  
166 - rpJson.getFloat("RCA").floatValue(),  
167 - rpJson.getFloat("LAC").floatValue(),  
168 - rpJson.getFloat("RAC").floatValue(),  
169 - rpJson.getFloat("ABD").floatValue(),  
170 - rpJson.getFloat("total").floatValue(), 165 + rpJson.getDouble("atmospheric_pressure").doubleValue(),
  166 + rpJson.getDouble("LCA").doubleValue(),
  167 + rpJson.getDouble("RCA").doubleValue(),
  168 + rpJson.getDouble("LAC").doubleValue(),
  169 + rpJson.getDouble("RAC").doubleValue(),
  170 + rpJson.getDouble("ABD").doubleValue(),
  171 + rpJson.getDouble("total").doubleValue(),
171 rpJson.getInteger("stable").intValue(), 172 rpJson.getInteger("stable").intValue(),
172 md5, rpJson.getString("machine_num"), rpJson.getString("basic_result")); 173 md5, rpJson.getString("machine_num"), rpJson.getString("basic_result"));
173 /* 174 /*
@@ -176,7 +177,7 @@ public class ReportService implements IReportService { @@ -176,7 +177,7 @@ public class ReportService implements IReportService {
176 JSONObject rpDetails = rpJson.getJSONObject("detail"); 177 JSONObject rpDetails = rpJson.getJSONObject("detail");
177 for (int item_id = 1; item_id <= 125; item_id++) { 178 for (int item_id = 1; item_id <= 125; item_id++) {
178 float val = rpDetails.getFloat(String.valueOf(item_id)).floatValue(); 179 float val = rpDetails.getFloat(String.valueOf(item_id)).floatValue();
179 - AMPReportDetail detail = new AMPReportDetail(); 180 + XklAmpReportDetailEntity detail = new XklAmpReportDetailEntity();
180 detail.setItemValue(val); 181 detail.setItemValue(val);
181 detail.setItemId(item_id); 182 detail.setItemId(item_id);
182 detailList.add(detail); 183 detailList.add(detail);
@@ -193,12 +194,12 @@ public class ReportService implements IReportService { @@ -193,12 +194,12 @@ public class ReportService implements IReportService {
193 /* 194 /*
194 * 存储报告 195 * 存储报告
195 */ 196 */
196 - private int save2DB(ReportData report, Admin admin, User user) {  
197 - report.getAmpReport().setCreate_by((int) admin.getId());  
198 - report.getAmpReport().setCompany_id(admin.getCoid());  
199 - report.getAmpReport().setMember_id(user.getMemberId());  
200 - AMPReport ampReport = reportRepository.save(report.getAmpReport());  
201 - for (AMPReportDetail detail : report.getRpDetailList()) { 197 + private long save2DB(ReportData report, XklAdminEntity admin, User user) {
  198 + report.getAmpReport().setCreateBy(admin.getId());
  199 + report.getAmpReport().setCompanyId((long)admin.getCoid());
  200 + report.getAmpReport().setMemberId((long)user.getMemberId());
  201 + XklAmpReportEntity ampReport = reportRepository.save(report.getAmpReport());
  202 + for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
202 detail.setReportId(ampReport.getId()); 203 detail.setReportId(ampReport.getId());
203 } 204 }
204 reportDetailRepository.save(report.getRpDetailList()); 205 reportDetailRepository.save(report.getRpDetailList());
@@ -208,28 +209,28 @@ public class ReportService implements IReportService { @@ -208,28 +209,28 @@ public class ReportService implements IReportService {
208 /* 209 /*
209 * 判断detail是正常,高于标准或低于标准。 210 * 判断detail是正常,高于标准或低于标准。
210 */ 211 */
211 - private void markItemStatus(int sex, List<AMPReportDetail> detailList) { 212 + private void markItemStatus(int sex, List<XklAmpReportDetailEntity> detailList) {
212 // load ReportMetaItems into memory. 213 // load ReportMetaItems into memory.
213 synchronized (this) { 214 synchronized (this) {
214 if (rpMetaItemMap.size() == 0) { 215 if (rpMetaItemMap.size() == 0) {
215 - Iterator<ReportMetaItem> rpMetaIter = reportMetaItemsRepository.findAll().iterator(); 216 + Iterator<XklAmpReportMetaItemsEntity> rpMetaIter = reportMetaItemsRepository.findAll().iterator();
216 while (rpMetaIter.hasNext()) { 217 while (rpMetaIter.hasNext()) {
217 - ReportMetaItem rpMetaItem = rpMetaIter.next();  
218 - rpMetaItemMap.put(rpMetaItem.getItem_id(), rpMetaItem); 218 + XklAmpReportMetaItemsEntity rpMetaItem = rpMetaIter.next();
  219 + rpMetaItemMap.put(rpMetaItem.getItemId(), rpMetaItem);
219 } 220 }
220 } 221 }
221 } 222 }
222 // mark status 223 // mark status
223 - for (AMPReportDetail detail : detailList) {  
224 - float lowSt;  
225 - float highSt; 224 + for (XklAmpReportDetailEntity detail : detailList) {
  225 + double lowSt;
  226 + double highSt;
226 // get standard 227 // get standard
227 if (sex == Constants.MALE) { // male 228 if (sex == Constants.MALE) { // male
228 - lowSt = rpMetaItemMap.get(detail.getItemId()).getStandard_low_male();  
229 - highSt = rpMetaItemMap.get(detail.getItemId()).getStandard_high_male(); 229 + lowSt = rpMetaItemMap.get(detail.getItemId()).getStandardLowMale();
  230 + highSt = rpMetaItemMap.get(detail.getItemId()).getStandardHighMale();
230 } else { // female 231 } else { // female
231 - lowSt = rpMetaItemMap.get(detail.getItemId()).getStandard_low_female();  
232 - highSt = rpMetaItemMap.get(detail.getItemId()).getStandard_high_female(); 232 + lowSt = rpMetaItemMap.get(detail.getItemId()).getStandardLowFemale();
  233 + highSt = rpMetaItemMap.get(detail.getItemId()).getStandardHighFemale();
233 } 234 }
234 int status; 235 int status;
235 if (detail.getItemValue() < lowSt) { 236 if (detail.getItemValue() < lowSt) {
@@ -5,14 +5,19 @@ server.port=8090 @@ -5,14 +5,19 @@ server.port=8090
5 #server.ssl.key-password = xkl2016 5 #server.ssl.key-password = xkl2016
6 6
7 #MySQL 7 #MySQL
8 -spring.datasource.url=jdbc:mysql://localhost:3306/hanhe_test?useUnicode=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=round&autoReconnect=true  
9 -spring.datasource.username=root  
10 -spring.datasource.password=fyqmysql 8 +#spring.datasource.url=jdbc:mysql://localhost:3306/hanhe_test?useUnicode=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=round&autoReconnect=true
  9 +#spring.datasource.username=root
  10 +#spring.datasource.password=fyqmysql
  11 +
  12 +spring.datasource.url=jdbc:mysql://db.hanhezy.com:4096/hanhe_test?useUnicode=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=round&autoReconnect=true
  13 +spring.datasource.username=hanhe
  14 +spring.datasource.password=HANhetest2016
11 15
12 #Redis 16 #Redis
13 spring.redis.host=127.0.0.1 17 spring.redis.host=127.0.0.1
14 -spring.redis.password=foobared 18 +#spring.redis.password=foobared
15 #spring.redis.host=r-m5e7cedd3124afd4.redis.rds.aliyuncs.com 19 #spring.redis.host=r-m5e7cedd3124afd4.redis.rds.aliyuncs.com
16 #spring.redis.password=r-m5e7cedd3124afd4:XIkaiLURedis2016 20 #spring.redis.password=r-m5e7cedd3124afd4:XIkaiLURedis2016
17 21
18 spring.redis.port=6379 22 spring.redis.port=6379
  23 +