Authored by zhaoyue

Add report verify

git pull
git add --all src/*
#git add --all src/*
git add push.sh
git add pom.xml
git commit -m "Add admin info inter"
git commit -m "Add report verify"
git push origin zhaoyue-dev
git status
git pull
... ...
... ... @@ -70,10 +70,10 @@ public class ReportService implements IReportService {
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK);
} else if (redis.hasKey(reportWithNoUser)) {
// 返回,报告对应会员不存在。
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
} else if (redis.hasKey(reportWrongFormat)) {
// 返回,报告格式有问题。
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
}
/*
* 解析报告数据
... ... @@ -85,7 +85,7 @@ public class ReportService implements IReportService {
if (reportData == null) {
redis.boundValueOps(reportWrongFormat).set("");
// 返回,报告格式有问题。
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
}
/*
* 检验会员存在性
... ... @@ -94,7 +94,7 @@ public class ReportService implements IReportService {
if (user == null) {
redis.boundValueOps(reportWithNoUser).set("");
// 返回,报告对应会员不存在。
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
}
/*
... ... @@ -106,7 +106,7 @@ public class ReportService implements IReportService {
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
} else {
// 返回,服务器存储问题。
return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR), HttpStatus.OK);
}
}
... ... @@ -124,7 +124,7 @@ public class ReportService implements IReportService {
// 2. 验证admin
if (report.getCreateBy() != admin.getId()) {
// 非此admin创建,不能删除,返回
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR),HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.OK);
}
// 3. 删除report和detail,返回ok
reportRepository.delete(report);
... ... @@ -151,6 +151,7 @@ public class ReportService implements IReportService {
List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
List<XklAmpReportResultEntity> basicResList = new ArrayList<>();
int sex;
int age;
/*
* 2. 获取report基础信息
... ... @@ -158,6 +159,13 @@ public class ReportService implements IReportService {
try {
JSONObject rpJson = JSONObject.parseObject(reportJson);
sex = rpJson.getInteger("sex").intValue();
age = rpJson.getInteger("age").intValue();
if (sex != Constants.FEMALE && sex != Constants.MALE) {
return null;
}
if (age < 0 || age > 127) {
return null;
}
ampReport.setReport(rpJson.getString("name"),
rpJson.getString("title"),/// "AMP快速无创身心健康评估报告",
new Timestamp(rpJson.getLong("report_date")),
... ... @@ -227,7 +235,7 @@ public class ReportService implements IReportService {
for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
detail.setReportId(ampReport.getId());
}
for (XklAmpReportResultEntity rpRes : report.getBasicResList()){
for (XklAmpReportResultEntity rpRes : report.getBasicResList()) {
rpRes.setReportId(ampReport.getId());
}
reportDetailRepository.save(report.getRpDetailList());
... ...