Merge branch 'zhaoyue-dev' into 'master'
add report infomation See merge request !22
Showing
4 changed files
with
9 additions
and
4 deletions
| @@ -2,7 +2,7 @@ git pull | @@ -2,7 +2,7 @@ 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 log" | 5 | +git commit -m "add report infomation" |
| 6 | git push origin zhaoyue-dev | 6 | git push origin zhaoyue-dev |
| 7 | git status | 7 | git status |
| 8 | git pull | 8 | git pull |
| @@ -25,7 +25,7 @@ public enum ResultStatus { | @@ -25,7 +25,7 @@ public enum ResultStatus { | ||
| 25 | AMP_KEY_ERROR(-11100, "AMP密钥不匹配"), | 25 | AMP_KEY_ERROR(-11100, "AMP密钥不匹配"), |
| 26 | REPORT_FORMAT_ERROR(-11140,"报告格式错误/Report json format error"), | 26 | REPORT_FORMAT_ERROR(-11140,"报告格式错误/Report json format error"), |
| 27 | REPORT_EXISTED_ERROR(-11141,"报告重复上传/Report is already exist"), | 27 | REPORT_EXISTED_ERROR(-11141,"报告重复上传/Report is already exist"), |
| 28 | - REPORT_INVALID__ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"), | 28 | + REPORT_INVALID_ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"), |
| 29 | 29 | ||
| 30 | INVALID_USER_ERROR(-11150,"报告所属用户未注册/Report user's account is not exist"), | 30 | INVALID_USER_ERROR(-11150,"报告所属用户未注册/Report user's account is not exist"), |
| 31 | INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!/Operator can not delete the report which is not create by him"), | 31 | INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!/Operator can not delete the report which is not create by him"), |
| @@ -73,4 +73,9 @@ public class ResultModel { | @@ -73,4 +73,9 @@ public class ResultModel { | ||
| 73 | public static ResultModel error(ResultStatus error) { | 73 | public static ResultModel error(ResultStatus error) { |
| 74 | return new ResultModel(error); | 74 | return new ResultModel(error); |
| 75 | } | 75 | } |
| 76 | + | ||
| 77 | + public static ResultModel error(ResultStatus error, Object content) { | ||
| 78 | + return new ResultModel(error, content); | ||
| 79 | + } | ||
| 80 | + | ||
| 76 | } | 81 | } |
| @@ -69,7 +69,7 @@ public class ReportService implements IReportService { | @@ -69,7 +69,7 @@ public class ReportService implements IReportService { | ||
| 69 | XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK); | 69 | XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK); |
| 70 | if (report != null && report.getStatus() > 0) { | 70 | if (report != null && report.getStatus() > 0) { |
| 71 | // 返回,报告已存在。 | 71 | // 返回,报告已存在。 |
| 72 | - return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK); | 72 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_EXISTED_ERROR, new ReportIdModel(report.getId())), HttpStatus.OK); |
| 73 | } else if (redis.hasKey(reportWithNoUser)) { | 73 | } else if (redis.hasKey(reportWithNoUser)) { |
| 74 | // 返回,报告对应会员不存在。 | 74 | // 返回,报告对应会员不存在。 |
| 75 | return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK); | 75 | return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK); |
| @@ -120,7 +120,7 @@ public class ReportService implements IReportService { | @@ -120,7 +120,7 @@ public class ReportService implements IReportService { | ||
| 120 | XklAmpReportEntity report = reportRepository.findById(report_id); | 120 | XklAmpReportEntity report = reportRepository.findById(report_id); |
| 121 | if (report == null || report.getStatus() == 0) { | 121 | if (report == null || report.getStatus() == 0) { |
| 122 | // 报告不存在,返回 | 122 | // 报告不存在,返回 |
| 123 | - return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID__ERROR), HttpStatus.OK); | 123 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID_ERROR), HttpStatus.OK); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | // 2. 验证admin | 126 | // 2. 验证admin |
-
Please register or login to post a comment