ADD:add report list interface
Showing
9 changed files
with
205 additions
and
11 deletions
src/main/java/META-INF/persistence.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> | ||
3 | + | ||
4 | + <persistence-unit name="NewPersistenceUnit"> | ||
5 | + <provider>org.hibernate.ejb.HibernatePersistence</provider> | ||
6 | + <properties> | ||
7 | + <property name="hibernate.connection.url" value=""/> | ||
8 | + <property name="hibernate.connection.driver_class" value=""/> | ||
9 | + <property name="hibernate.connection.username" value=""/> | ||
10 | + <property name="hibernate.connection.password" value=""/> | ||
11 | + <property name="hibernate.archive.autodetection" value="class"/> | ||
12 | + <property name="hibernate.show_sql" value="true"/> | ||
13 | + <property name="hibernate.format_sql" value="true"/> | ||
14 | + <property name="hbm2ddl.auto" value="update"/> | ||
15 | + </properties> | ||
16 | + </persistence-unit> | ||
17 | +</persistence> |
@@ -40,12 +40,12 @@ public class SignAspect { | @@ -40,12 +40,12 @@ public class SignAspect { | ||
40 | * @return | 40 | * @return |
41 | */ | 41 | */ |
42 | private String getKeyByType(int type){ | 42 | private String getKeyByType(int type){ |
43 | - int id = 0; | 43 | + long id = 0; |
44 | if(type == 1) | 44 | if(type == 1) |
45 | id = 1; | 45 | id = 1; |
46 | else | 46 | else |
47 | id = 2; | 47 | id = 2; |
48 | - return xklInterKeyRespository.findById(id).getKey(); | 48 | + return xklInterKeyRespository.findOne(id).getKey(); |
49 | } | 49 | } |
50 | /** | 50 | /** |
51 | * 定义切点,定位到@Sign注解的地方 | 51 | * 定义切点,定位到@Sign注解的地方 |
1 | +package com.xkl.controller; | ||
2 | + | ||
3 | +import com.wordnik.swagger.annotations.ApiImplicitParam; | ||
4 | +import com.wordnik.swagger.annotations.ApiImplicitParams; | ||
5 | +import com.wordnik.swagger.annotations.ApiOperation; | ||
6 | +import com.xkl.authorization.annotation.Authorization; | ||
7 | +import com.xkl.authorization.annotation.CurrentUser; | ||
8 | +import com.xkl.domain.User; | ||
9 | +import com.xkl.domain.XklAmpReportEntity; | ||
10 | +import com.xkl.domain.XklMemberEntity; | ||
11 | +import com.xkl.model.ResultModel; | ||
12 | +import com.xkl.repository.XklAmpReportRespository; | ||
13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
14 | +import org.springframework.http.HttpStatus; | ||
15 | +import org.springframework.http.ResponseEntity; | ||
16 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
17 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
18 | +import org.springframework.web.bind.annotation.RequestParam; | ||
19 | +import org.springframework.web.bind.annotation.RestController; | ||
20 | + | ||
21 | +import javax.servlet.http.HttpServletRequest; | ||
22 | +import java.util.List; | ||
23 | + | ||
24 | +/** | ||
25 | + * Created by win7 on 2016/11/20. | ||
26 | + */ | ||
27 | +@RestController | ||
28 | +@RequestMapping("/report") | ||
29 | +public class ReportController { | ||
30 | + @Autowired | ||
31 | + private XklAmpReportRespository xklAmpReportRespository; | ||
32 | + | ||
33 | + @RequestMapping(method = RequestMethod.GET) | ||
34 | + @Authorization | ||
35 | + //@Sign | ||
36 | + @ApiOperation(value = "体检报告列表查询接口") | ||
37 | + @ApiImplicitParams({ | ||
38 | + @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | ||
39 | + }) | ||
40 | + public ResponseEntity<ResultModel> getUserInfo(HttpServletRequest request, @CurrentUser User user, | ||
41 | + @RequestParam String sign, @RequestParam long t, @RequestParam int type) { | ||
42 | + long member_id=user.getMember_id(); | ||
43 | + List<XklAmpReportEntity> xklAmpReportEntity=xklAmpReportRespository.findByMemberId(member_id); | ||
44 | + return new ResponseEntity<>(ResultModel.ok(xklAmpReportEntity), HttpStatus.OK); | ||
45 | + } | ||
46 | +} |
@@ -39,6 +39,7 @@ public class UserInfoController { | @@ -39,6 +39,7 @@ public class UserInfoController { | ||
39 | @Autowired | 39 | @Autowired |
40 | private XklMemberRespository xklMemberRespository; | 40 | private XklMemberRespository xklMemberRespository; |
41 | 41 | ||
42 | + | ||
42 | @AntiXSS | 43 | @AntiXSS |
43 | //@Sign | 44 | //@Sign |
44 | @RequestMapping(method = RequestMethod.POST) | 45 | @RequestMapping(method = RequestMethod.POST) |
@@ -56,7 +57,9 @@ public class UserInfoController { | @@ -56,7 +57,9 @@ public class UserInfoController { | ||
56 | String pass=SecurityTool.getPassword(username,password,salt); | 57 | String pass=SecurityTool.getPassword(username,password,salt); |
57 | user = new User(); | 58 | user = new User(); |
58 | /** | 59 | /** |
59 | - * TODO:暂时都为1 | 60 | + * TODO: |
61 | + * 1. sign检测注解@Sign先注释掉 ,便于测试 | ||
62 | + * 2. 暂时把所有注册的用户的member表member_id都设置为1 | ||
60 | */ | 63 | */ |
61 | user.setMember_id(1); | 64 | user.setMember_id(1); |
62 | user.setUsername(username); | 65 | user.setUsername(username); |
@@ -91,6 +94,7 @@ public class UserInfoController { | @@ -91,6 +94,7 @@ public class UserInfoController { | ||
91 | 94 | ||
92 | @RequestMapping(method = RequestMethod.GET) | 95 | @RequestMapping(method = RequestMethod.GET) |
93 | @Authorization | 96 | @Authorization |
97 | + //@Sign | ||
94 | @ApiOperation(value = "个人信息查询接口") | 98 | @ApiOperation(value = "个人信息查询接口") |
95 | @ApiImplicitParams({ | 99 | @ApiImplicitParams({ |
96 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | 100 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), |
1 | +package com.xkl.domain; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import javax.persistence.*; | ||
6 | +import java.io.Serializable; | ||
7 | + | ||
8 | +/** | ||
9 | + * Created by win7 on 2016/11/20. | ||
10 | + */ | ||
11 | +@Data | ||
12 | +@Entity | ||
13 | +@Table(name = "xkl_amp_report", schema = "hanhe_test", catalog = "") | ||
14 | +public class XklAmpReportEntity { | ||
15 | + @Id | ||
16 | + @Column(name = "id") | ||
17 | + private long id; | ||
18 | + @Basic | ||
19 | + @Column(name = "member_id") | ||
20 | + private long memberId; | ||
21 | + @Basic | ||
22 | + @Column(name = "name") | ||
23 | + private String name; | ||
24 | + @Basic | ||
25 | + @Column(name = "title") | ||
26 | + private String title; | ||
27 | + @Basic | ||
28 | + @Column(name = "check_time") | ||
29 | + private String checkTime; | ||
30 | + @Basic | ||
31 | + @Column(name = "uptime") | ||
32 | + private String uptime; | ||
33 | + @Basic | ||
34 | + @Column(name = "account_str") | ||
35 | + private String accountStr; | ||
36 | + @Basic | ||
37 | + @Column(name = "sex") | ||
38 | + private Byte sex; | ||
39 | + @Basic | ||
40 | + @Column(name = "age") | ||
41 | + private Byte age; | ||
42 | + @Basic | ||
43 | + @Column(name = "weight") | ||
44 | + private long weight; | ||
45 | + @Basic | ||
46 | + @Column(name = "pulse") | ||
47 | + private long pulse; | ||
48 | + @Basic | ||
49 | + @Column(name = "breath_rate") | ||
50 | + private long breathRate; | ||
51 | + @Basic | ||
52 | + @Column(name = "atmos_pressure") | ||
53 | + private Double atmosPressure; | ||
54 | + @Basic | ||
55 | + @Column(name = "LCA") | ||
56 | + private Double lca; | ||
57 | + @Basic | ||
58 | + @Column(name = "RCA") | ||
59 | + private Double rca; | ||
60 | + @Basic | ||
61 | + @Column(name = "LAC") | ||
62 | + private Double lac; | ||
63 | + @Basic | ||
64 | + @Column(name = "RAC") | ||
65 | + private Double rac; | ||
66 | + @Basic | ||
67 | + @Column(name = "ABD") | ||
68 | + private Double abd; | ||
69 | + @Basic | ||
70 | + @Column(name = "temp_sum") | ||
71 | + private Double tempSum; | ||
72 | + @Basic | ||
73 | + @Column(name = "stable") | ||
74 | + private long stable; | ||
75 | + @Basic | ||
76 | + @Column(name = "md5") | ||
77 | + private String md5; | ||
78 | + @Basic | ||
79 | + @Column(name = "create_by") | ||
80 | + private long createBy; | ||
81 | + @Basic | ||
82 | + @Column(name = "machine_num") | ||
83 | + private String machineNum; | ||
84 | + @Basic | ||
85 | + @Column(name = "T0") | ||
86 | + private String t0; | ||
87 | + @Basic | ||
88 | + @Column(name = "T1") | ||
89 | + private String t1; | ||
90 | + @Basic | ||
91 | + @Column(name = "T2") | ||
92 | + private String t2; | ||
93 | + @Basic | ||
94 | + @Column(name = "T3") | ||
95 | + private String t3; | ||
96 | + @Basic | ||
97 | + @Column(name = "T4") | ||
98 | + private String t4; | ||
99 | + @Basic | ||
100 | + @Column(name = "conclusion") | ||
101 | + private String conclusion; | ||
102 | + @Basic | ||
103 | + @Column(name = "score") | ||
104 | + private Double score; | ||
105 | + @Basic | ||
106 | + @Column(name = "company_id") | ||
107 | + private long companyId; | ||
108 | + @Basic | ||
109 | + @Column(name = "status") | ||
110 | + private Byte status; | ||
111 | +} |
@@ -13,7 +13,7 @@ import javax.persistence.*; | @@ -13,7 +13,7 @@ import javax.persistence.*; | ||
13 | public class XklInterKeyEntity { | 13 | public class XklInterKeyEntity { |
14 | @Id | 14 | @Id |
15 | @Column(name = "id") | 15 | @Column(name = "id") |
16 | - private int id; | 16 | + private long id; |
17 | @Basic | 17 | @Basic |
18 | @Column(name = "key") | 18 | @Column(name = "key") |
19 | private String key; | 19 | private String key; |
@@ -25,5 +25,5 @@ public class XklInterKeyEntity { | @@ -25,5 +25,5 @@ public class XklInterKeyEntity { | ||
25 | private String note; | 25 | private String note; |
26 | @Basic | 26 | @Basic |
27 | @Column(name = "company_id") | 27 | @Column(name = "company_id") |
28 | - private int companyId; | 28 | + private long companyId; |
29 | } | 29 | } |
@@ -36,19 +36,19 @@ public class XklMemberEntity { | @@ -36,19 +36,19 @@ public class XklMemberEntity { | ||
36 | private String registerTime; | 36 | private String registerTime; |
37 | @Basic | 37 | @Basic |
38 | @Column(name = "company_id") | 38 | @Column(name = "company_id") |
39 | - private int companyId; | 39 | + private long companyId; |
40 | @Basic | 40 | @Basic |
41 | @Column(name = "province") | 41 | @Column(name = "province") |
42 | - private int province; | 42 | + private long province; |
43 | @Basic | 43 | @Basic |
44 | @Column(name = "city") | 44 | @Column(name = "city") |
45 | - private int city; | 45 | + private long city; |
46 | @Basic | 46 | @Basic |
47 | @Column(name = "country") | 47 | @Column(name = "country") |
48 | - private int country; | 48 | + private long country; |
49 | @Basic | 49 | @Basic |
50 | @Column(name = "register_by") | 50 | @Column(name = "register_by") |
51 | - private int registerBy; | 51 | + private long registerBy; |
52 | @Basic | 52 | @Basic |
53 | @Column(name = "status") | 53 | @Column(name = "status") |
54 | private Byte status; | 54 | private Byte status; |
1 | +package com.xkl.repository; | ||
2 | + | ||
3 | +import com.xkl.domain.User; | ||
4 | +import com.xkl.domain.XklAmpReportEntity; | ||
5 | +import com.xkl.domain.XklMemberEntity; | ||
6 | +import org.springframework.data.repository.CrudRepository; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by win7 on 2016/11/20. | ||
12 | + */ | ||
13 | +public interface XklAmpReportRespository extends CrudRepository<XklAmpReportEntity, Long> { | ||
14 | + //member_id | ||
15 | + public List<XklAmpReportEntity> findByMemberId(long member_id); | ||
16 | +} |
@@ -8,5 +8,5 @@ import org.springframework.data.repository.CrudRepository; | @@ -8,5 +8,5 @@ import org.springframework.data.repository.CrudRepository; | ||
8 | * Created by win7 on 2016/11/20. | 8 | * Created by win7 on 2016/11/20. |
9 | */ | 9 | */ |
10 | public interface XklInterKeyRespository extends CrudRepository<XklInterKeyEntity, Long> { | 10 | public interface XklInterKeyRespository extends CrudRepository<XklInterKeyEntity, Long> { |
11 | - public XklInterKeyEntity findById(int companyId); | 11 | + |
12 | } | 12 | } |
-
Please register or login to post a comment