Authored by zhaoyue

add age and sex verify

1 -git pull  
2 -#git add --all src/*  
3 -git add push.sh  
4 -git add pom.xml  
5 -git commit -m "Add report verify"  
6 -git push origin zhaoyue-dev  
7 -git status  
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 }
@@ -9,6 +9,7 @@ import com.xkl.model.ReportIdModel; @@ -9,6 +9,7 @@ import com.xkl.model.ReportIdModel;
9 import com.xkl.model.ResultModel; 9 import com.xkl.model.ResultModel;
10 import com.xkl.repository.*; 10 import com.xkl.repository.*;
11 import com.xkl.security.SecurityTool; 11 import com.xkl.security.SecurityTool;
  12 +import lombok.extern.apachecommons.CommonsLog;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.data.redis.core.RedisTemplate; 14 import org.springframework.data.redis.core.RedisTemplate;
14 import org.springframework.http.HttpStatus; 15 import org.springframework.http.HttpStatus;
@@ -22,6 +23,7 @@ import java.util.*; @@ -22,6 +23,7 @@ import java.util.*;
22 * Created by zhao yue on 2016/11/13. 23 * Created by zhao yue on 2016/11/13.
23 */ 24 */
24 @Service 25 @Service
  26 +@CommonsLog
25 public class ReportService implements IReportService { 27 public class ReportService implements IReportService {
26 @Autowired 28 @Autowired
27 private ReportMetaItemsRepository reportMetaItemsRepository; 29 private ReportMetaItemsRepository reportMetaItemsRepository;
@@ -67,7 +69,7 @@ public class ReportService implements IReportService { @@ -67,7 +69,7 @@ public class ReportService implements IReportService {
67 XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK); 69 XklAmpReportEntity report = reportRepository.findByMd5AndStatus(reportMd5, Constants.STATUS_OK);
68 if (report != null && report.getStatus() > 0) { 70 if (report != null && report.getStatus() > 0) {
69 // 返回,报告已存在。 71 // 返回,报告已存在。
70 - 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);
71 } else if (redis.hasKey(reportWithNoUser)) { 73 } else if (redis.hasKey(reportWithNoUser)) {
72 // 返回,报告对应会员不存在。 74 // 返回,报告对应会员不存在。
73 return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK); 75 return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
@@ -118,7 +120,7 @@ public class ReportService implements IReportService { @@ -118,7 +120,7 @@ public class ReportService implements IReportService {
118 XklAmpReportEntity report = reportRepository.findById(report_id); 120 XklAmpReportEntity report = reportRepository.findById(report_id);
119 if (report == null || report.getStatus() == 0) { 121 if (report == null || report.getStatus() == 0) {
120 // 报告不存在,返回 122 // 报告不存在,返回
121 - return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID__ERROR), HttpStatus.OK); 123 + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID_ERROR), HttpStatus.OK);
122 } 124 }
123 125
124 // 2. 验证admin 126 // 2. 验证admin
@@ -215,6 +217,7 @@ public class ReportService implements IReportService { @@ -215,6 +217,7 @@ public class ReportService implements IReportService {
215 } 217 }
216 } 218 }
217 } catch (Exception e) { 219 } catch (Exception e) {
  220 + log.info("ERROR, JSON FROMAT ERROR!!!"+e);
218 return null; 221 return null;
219 } 222 }
220 markItemStatus(sex, detailList); 223 markItemStatus(sex, detailList);