Authored by zhaoyue

add age and sex verify

git pull
#git add --all src/*
git add push.sh
git add pom.xml
git commit -m "Add report verify"
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);
}
}
... ...
... ... @@ -9,6 +9,7 @@ import com.xkl.model.ReportIdModel;
import com.xkl.model.ResultModel;
import com.xkl.repository.*;
import com.xkl.security.SecurityTool;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
... ... @@ -22,6 +23,7 @@ import java.util.*;
* Created by zhao yue on 2016/11/13.
*/
@Service
@CommonsLog
public class ReportService implements IReportService {
@Autowired
private ReportMetaItemsRepository reportMetaItemsRepository;
... ... @@ -67,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);
... ... @@ -118,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
... ... @@ -215,6 +217,7 @@ public class ReportService implements IReportService {
}
}
} catch (Exception e) {
log.info("ERROR, JSON FROMAT ERROR!!!"+e);
return null;
}
markItemStatus(sex, detailList);
... ...