Authored by zhaoyue

Merge branch 'zhaoyue-dev' into 'master'

add report infomation



See merge request !22
... ... @@ -2,7 +2,7 @@ git pull
git add --all src/*
git add push.sh
git add pom.xml
git commit -m "add log"
git commit -m "add report infomation"
git push origin zhaoyue-dev
git status
git pull
... ...
... ... @@ -25,7 +25,7 @@ public enum ResultStatus {
AMP_KEY_ERROR(-11100, "AMP密钥不匹配"),
REPORT_FORMAT_ERROR(-11140,"报告格式错误/Report json format error"),
REPORT_EXISTED_ERROR(-11141,"报告重复上传/Report is already exist"),
REPORT_INVALID__ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"),
REPORT_INVALID_ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"),
INVALID_USER_ERROR(-11150,"报告所属用户未注册/Report user's account is not exist"),
INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!/Operator can not delete the report which is not create by him"),
... ...
... ... @@ -73,4 +73,9 @@ public class ResultModel {
public static ResultModel error(ResultStatus error) {
return new ResultModel(error);
}
public static ResultModel error(ResultStatus error, Object content) {
return new ResultModel(error, content);
}
}
... ...
... ... @@ -69,7 +69,7 @@ public class ReportService implements IReportService {
XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK);
if (report != null && report.getStatus() > 0) {
// 返回,报告已存在。
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_EXISTED_ERROR, new ReportIdModel(report.getId())), HttpStatus.OK);
} else if (redis.hasKey(reportWithNoUser)) {
// 返回,报告对应会员不存在。
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
... ... @@ -120,7 +120,7 @@ public class ReportService implements IReportService {
XklAmpReportEntity report = reportRepository.findById(report_id);
if (report == null || report.getStatus() == 0) {
// 报告不存在,返回
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID__ERROR), HttpStatus.OK);
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID_ERROR), HttpStatus.OK);
}
// 2. 验证admin
... ...