Authored by zhaoyue

ADD report location log

... ... @@ -25,6 +25,10 @@ public class XklAmpReportLocationEntity {
@Column(name = "admin_id")
private long adminId;
// reportId
@Column(name = "report_id")
private long reportId;
// ip
@Column(name = "ip")
private String IP;
... ... @@ -54,11 +58,12 @@ public class XklAmpReportLocationEntity {
@Column(name = "upload_time")
private Timestamp uploadTime;
public XklAmpReportLocationEntity(String AMPSerial, long adminId, String IP,
public XklAmpReportLocationEntity(String AMPSerial, long adminId, long reportId, String IP,
String country, String province, String city,
String district, Timestamp checkupTime, Timestamp uploadTime) {
this.AMPSerial = AMPSerial;
this.adminId = adminId;
this.reportId = reportId;
this.IP = IP;
this.country = country;
this.province = province;
... ... @@ -84,6 +89,14 @@ public class XklAmpReportLocationEntity {
this.adminId = adminId;
}
public long getReportId() {
return reportId;
}
public void setReportId(long reportId) {
this.reportId = reportId;
}
public String getIP() {
return IP;
}
... ...
... ... @@ -249,7 +249,8 @@ public class ReportService implements IReportService {
reportDetailRepository.save(report.getRpDetailList());
reportResultRepository.save(report.getBasicResList());
// 保存报告地理位置。
saveRpLocation2DB(report, admin);
saveRpLocation2DB(report, ampReport.getId(), admin);
// 健康评分
scoreService.getScore(ampReport.getId());
return ampReport.getId();
}
... ... @@ -257,12 +258,12 @@ public class ReportService implements IReportService {
/*
* 保存报告地理位置。
*/
private void saveRpLocation2DB(ReportData report, XklAdminEntity admin) {
private void saveRpLocation2DB(ReportData report, long reportId, XklAdminEntity admin) {
String ip = admin.getIp();
Location location = IPTools.getLocationWithIP(ip);
if (location == null) return;
XklAmpReportLocationEntity rpLoc = new XklAmpReportLocationEntity(report.getAmpReport().getMachineNum(),
admin.getId(), ip, location.getCountry(), location.getProvince(), location.getCity(), location.getDistrict(),
admin.getId(), reportId, ip, location.getCountry(), location.getProvince(), location.getCity(), location.getDistrict(),
report.getAmpReport().getCheckTime(), report.getAmpReport().getUptime());
xklAmpReportLocationRespository.save(rpLoc);
}
... ...