Authored by zhaoyue

Add report verify

1 git pull 1 git pull
2 -git add --all src/* 2 +#git add --all src/*
3 git add push.sh 3 git add push.sh
4 git add pom.xml 4 git add pom.xml
5 -git commit -m "Add admin info inter" 5 +git commit -m "Add report verify"
6 git push origin zhaoyue-dev 6 git push origin zhaoyue-dev
7 git status 7 git status
8 git pull 8 git pull
@@ -70,10 +70,10 @@ public class ReportService implements IReportService { @@ -70,10 +70,10 @@ public class ReportService implements IReportService {
70 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK); 70 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK);
71 } else if (redis.hasKey(reportWithNoUser)) { 71 } else if (redis.hasKey(reportWithNoUser)) {
72 // 返回,报告对应会员不存在。 72 // 返回,报告对应会员不存在。
73 - return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK); 73 + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
74 } else if (redis.hasKey(reportWrongFormat)) { 74 } else if (redis.hasKey(reportWrongFormat)) {
75 // 返回,报告格式有问题。 75 // 返回,报告格式有问题。
76 - return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK); 76 + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
77 } 77 }
78 /* 78 /*
79 * 解析报告数据 79 * 解析报告数据
@@ -85,7 +85,7 @@ public class ReportService implements IReportService { @@ -85,7 +85,7 @@ public class ReportService implements IReportService {
85 if (reportData == null) { 85 if (reportData == null) {
86 redis.boundValueOps(reportWrongFormat).set(""); 86 redis.boundValueOps(reportWrongFormat).set("");
87 // 返回,报告格式有问题。 87 // 返回,报告格式有问题。
88 - return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK); 88 + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
89 } 89 }
90 /* 90 /*
91 * 检验会员存在性 91 * 检验会员存在性
@@ -94,7 +94,7 @@ public class ReportService implements IReportService { @@ -94,7 +94,7 @@ public class ReportService implements IReportService {
94 if (user == null) { 94 if (user == null) {
95 redis.boundValueOps(reportWithNoUser).set(""); 95 redis.boundValueOps(reportWithNoUser).set("");
96 // 返回,报告对应会员不存在。 96 // 返回,报告对应会员不存在。
97 - return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK); 97 + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
98 } 98 }
99 99
100 /* 100 /*
@@ -106,7 +106,7 @@ public class ReportService implements IReportService { @@ -106,7 +106,7 @@ public class ReportService implements IReportService {
106 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK); 106 return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
107 } else { 107 } else {
108 // 返回,服务器存储问题。 108 // 返回,服务器存储问题。
109 - return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR),HttpStatus.OK); 109 + return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR), HttpStatus.OK);
110 } 110 }
111 } 111 }
112 112
@@ -124,7 +124,7 @@ public class ReportService implements IReportService { @@ -124,7 +124,7 @@ public class ReportService implements IReportService {
124 // 2. 验证admin 124 // 2. 验证admin
125 if (report.getCreateBy() != admin.getId()) { 125 if (report.getCreateBy() != admin.getId()) {
126 // 非此admin创建,不能删除,返回 126 // 非此admin创建,不能删除,返回
127 - return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR),HttpStatus.OK); 127 + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.OK);
128 } 128 }
129 // 3. 删除report和detail,返回ok 129 // 3. 删除report和detail,返回ok
130 reportRepository.delete(report); 130 reportRepository.delete(report);
@@ -151,6 +151,7 @@ public class ReportService implements IReportService { @@ -151,6 +151,7 @@ public class ReportService implements IReportService {
151 List<XklAmpReportDetailEntity> detailList = new ArrayList<>(); 151 List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
152 List<XklAmpReportResultEntity> basicResList = new ArrayList<>(); 152 List<XklAmpReportResultEntity> basicResList = new ArrayList<>();
153 int sex; 153 int sex;
  154 + int age;
154 155
155 /* 156 /*
156 * 2. 获取report基础信息 157 * 2. 获取report基础信息
@@ -158,6 +159,13 @@ public class ReportService implements IReportService { @@ -158,6 +159,13 @@ public class ReportService implements IReportService {
158 try { 159 try {
159 JSONObject rpJson = JSONObject.parseObject(reportJson); 160 JSONObject rpJson = JSONObject.parseObject(reportJson);
160 sex = rpJson.getInteger("sex").intValue(); 161 sex = rpJson.getInteger("sex").intValue();
  162 + age = rpJson.getInteger("age").intValue();
  163 + if (sex != Constants.FEMALE && sex != Constants.MALE) {
  164 + return null;
  165 + }
  166 + if (age < 0 || age > 127) {
  167 + return null;
  168 + }
161 ampReport.setReport(rpJson.getString("name"), 169 ampReport.setReport(rpJson.getString("name"),
162 rpJson.getString("title"),/// "AMP快速无创身心健康评估报告", 170 rpJson.getString("title"),/// "AMP快速无创身心健康评估报告",
163 new Timestamp(rpJson.getLong("report_date")), 171 new Timestamp(rpJson.getLong("report_date")),
@@ -227,7 +235,7 @@ public class ReportService implements IReportService { @@ -227,7 +235,7 @@ public class ReportService implements IReportService {
227 for (XklAmpReportDetailEntity detail : report.getRpDetailList()) { 235 for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
228 detail.setReportId(ampReport.getId()); 236 detail.setReportId(ampReport.getId());
229 } 237 }
230 - for (XklAmpReportResultEntity rpRes : report.getBasicResList()){ 238 + for (XklAmpReportResultEntity rpRes : report.getBasicResList()) {
231 rpRes.setReportId(ampReport.getId()); 239 rpRes.setReportId(ampReport.getId());
232 } 240 }
233 reportDetailRepository.save(report.getRpDetailList()); 241 reportDetailRepository.save(report.getRpDetailList());