|
|
@@ -108,7 +108,7 @@ public class JsonController {
|
|
|
@RequestMapping(value = "/api/saveJson", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
|
|
|
@ResponseBody
|
|
|
public String saveJson(@RequestHeader HttpHeaders header, @RequestBody JsonBean jsonBean) {
|
|
|
- ResponseResult<String> responseResult = new ResponseResult<String>();
|
|
|
+ ResponseResult<JsonBean> responseResult = new ResponseResult<JsonBean>();
|
|
|
responseResult.setMessage("操作失败");
|
|
|
|
|
|
String email = header.getFirst("email");
|
|
|
@@ -127,14 +127,15 @@ public class JsonController {
|
|
|
return JSON.toJSONString(responseResult);
|
|
|
}
|
|
|
|
|
|
+ JsonBean dbJsonBean = null;
|
|
|
try {
|
|
|
- jsonRepository.save(jsonBean);
|
|
|
+ dbJsonBean = jsonRepository.save(jsonBean);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return JSON.toJSONString(responseResult);
|
|
|
}
|
|
|
|
|
|
- responseResult.setContent("操作成功");
|
|
|
+ responseResult.setContent(dbJsonBean);
|
|
|
responseResult.setCode(ResultCode.SUCCESS);
|
|
|
responseResult.setMessage("操作成功");
|
|
|
return JSON.toJSONString(responseResult);
|
|
|
@@ -162,12 +163,13 @@ public class JsonController {
|
|
|
|
|
|
// 用户token不一致
|
|
|
if (dbUserBean == null || !TextUtils.equals(token, dbUserBean.getToken())) {
|
|
|
+ responseResult.setMessage("请重新登录");
|
|
|
return JSON.toJSONString(responseResult);
|
|
|
}
|
|
|
|
|
|
JsonBean jsonBean = null;
|
|
|
try {
|
|
|
- jsonBean = jsonRepository.findCouponByEmail(email);
|
|
|
+ jsonBean = jsonRepository.findJsonBeanByEmail(email);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -187,10 +189,10 @@ public class JsonController {
|
|
|
public String getJson(String email) {
|
|
|
JsonBean jsonBean = null;
|
|
|
try {
|
|
|
- jsonBean = jsonRepository.findCouponByEmail(email);
|
|
|
+ jsonBean = jsonRepository.findJsonBeanByEmail(email);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return "";
|
|
|
+ return "数据库数据重复";
|
|
|
}
|
|
|
return jsonBean.json;
|
|
|
}
|