Merge branch 'zhaoyue-dev4' into 'master'
ADD report location log See merge request !45
Showing
2 changed files
with
18 additions
and
4 deletions
@@ -25,6 +25,10 @@ public class XklAmpReportLocationEntity { | @@ -25,6 +25,10 @@ public class XklAmpReportLocationEntity { | ||
25 | @Column(name = "admin_id") | 25 | @Column(name = "admin_id") |
26 | private long adminId; | 26 | private long adminId; |
27 | 27 | ||
28 | + // reportId | ||
29 | + @Column(name = "report_id") | ||
30 | + private long reportId; | ||
31 | + | ||
28 | // ip | 32 | // ip |
29 | @Column(name = "ip") | 33 | @Column(name = "ip") |
30 | private String IP; | 34 | private String IP; |
@@ -54,11 +58,12 @@ public class XklAmpReportLocationEntity { | @@ -54,11 +58,12 @@ public class XklAmpReportLocationEntity { | ||
54 | @Column(name = "upload_time") | 58 | @Column(name = "upload_time") |
55 | private Timestamp uploadTime; | 59 | private Timestamp uploadTime; |
56 | 60 | ||
57 | - public XklAmpReportLocationEntity(String AMPSerial, long adminId, String IP, | 61 | + public XklAmpReportLocationEntity(String AMPSerial, long adminId, long reportId, String IP, |
58 | String country, String province, String city, | 62 | String country, String province, String city, |
59 | String district, Timestamp checkupTime, Timestamp uploadTime) { | 63 | String district, Timestamp checkupTime, Timestamp uploadTime) { |
60 | this.AMPSerial = AMPSerial; | 64 | this.AMPSerial = AMPSerial; |
61 | this.adminId = adminId; | 65 | this.adminId = adminId; |
66 | + this.reportId = reportId; | ||
62 | this.IP = IP; | 67 | this.IP = IP; |
63 | this.country = country; | 68 | this.country = country; |
64 | this.province = province; | 69 | this.province = province; |
@@ -84,6 +89,14 @@ public class XklAmpReportLocationEntity { | @@ -84,6 +89,14 @@ public class XklAmpReportLocationEntity { | ||
84 | this.adminId = adminId; | 89 | this.adminId = adminId; |
85 | } | 90 | } |
86 | 91 | ||
92 | + public long getReportId() { | ||
93 | + return reportId; | ||
94 | + } | ||
95 | + | ||
96 | + public void setReportId(long reportId) { | ||
97 | + this.reportId = reportId; | ||
98 | + } | ||
99 | + | ||
87 | public String getIP() { | 100 | public String getIP() { |
88 | return IP; | 101 | return IP; |
89 | } | 102 | } |
@@ -249,7 +249,8 @@ public class ReportService implements IReportService { | @@ -249,7 +249,8 @@ public class ReportService implements IReportService { | ||
249 | reportDetailRepository.save(report.getRpDetailList()); | 249 | reportDetailRepository.save(report.getRpDetailList()); |
250 | reportResultRepository.save(report.getBasicResList()); | 250 | reportResultRepository.save(report.getBasicResList()); |
251 | // 保存报告地理位置。 | 251 | // 保存报告地理位置。 |
252 | - saveRpLocation2DB(report, admin); | 252 | + saveRpLocation2DB(report, ampReport.getId(), admin); |
253 | + // 健康评分 | ||
253 | scoreService.getScore(ampReport.getId()); | 254 | scoreService.getScore(ampReport.getId()); |
254 | return ampReport.getId(); | 255 | return ampReport.getId(); |
255 | } | 256 | } |
@@ -257,12 +258,12 @@ public class ReportService implements IReportService { | @@ -257,12 +258,12 @@ public class ReportService implements IReportService { | ||
257 | /* | 258 | /* |
258 | * 保存报告地理位置。 | 259 | * 保存报告地理位置。 |
259 | */ | 260 | */ |
260 | - private void saveRpLocation2DB(ReportData report, XklAdminEntity admin) { | 261 | + private void saveRpLocation2DB(ReportData report, long reportId, XklAdminEntity admin) { |
261 | String ip = admin.getIp(); | 262 | String ip = admin.getIp(); |
262 | Location location = IPTools.getLocationWithIP(ip); | 263 | Location location = IPTools.getLocationWithIP(ip); |
263 | if (location == null) return; | 264 | if (location == null) return; |
264 | XklAmpReportLocationEntity rpLoc = new XklAmpReportLocationEntity(report.getAmpReport().getMachineNum(), | 265 | XklAmpReportLocationEntity rpLoc = new XklAmpReportLocationEntity(report.getAmpReport().getMachineNum(), |
265 | - admin.getId(), ip, location.getCountry(), location.getProvince(), location.getCity(), location.getDistrict(), | 266 | + admin.getId(), reportId, ip, location.getCountry(), location.getProvince(), location.getCity(), location.getDistrict(), |
266 | report.getAmpReport().getCheckTime(), report.getAmpReport().getUptime()); | 267 | report.getAmpReport().getCheckTime(), report.getAmpReport().getUptime()); |
267 | xklAmpReportLocationRespository.save(rpLoc); | 268 | xklAmpReportLocationRespository.save(rpLoc); |
268 | } | 269 | } |
-
Please register or login to post a comment