/**
 * 
 */
package net.wyun.wcrs.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import net.wyun.wcrs.jsj.JSJFormInfo;
import net.wyun.wcrs.model.User;
import net.wyun.wcrs.model.UserRepository;

/**
 * @author Xuecheng
 *
 */
@RequestMapping("/secure")
@RestController
public class JingshujuController {
	
	private static final Logger logger = LoggerFactory.getLogger(JingshujuController.class);
	
	@Autowired
	UserRepository userRepo;
	
	@RequestMapping(value= "/jsj", method=RequestMethod.POST)
	String saveUser(@RequestBody JSJFormInfo data){
		logger.info("jingshuju data: " + data.getFormName() + data.getEntry());
		return data.getForm();
	}

}

@@ -36,24 +36,48 @@
 ontroller;%0A%0A
+import java.util.Date;%0A%0A
 import org.s
@@ -85,24 +85,24 @@
 f4j.Logger;%0A
-
 import org.s
@@ -484,32 +484,92 @@
 .RestController;
+%0Aimport org.springframework.web.bind.annotation.CrossOrigin;
 %0A%0Aimport net.wyu
@@ -667,16 +667,55 @@
 ository;
+%0Aimport net.wyun.wcrs.model.UserStatus;
 %0A%0A/**%0A *
@@ -739,16 +739,17 @@
 %0A *%0A */%0A
+%0A
 @Request
@@ -952,16 +952,30 @@
 Repo;%0A%09%0A
+%09@CrossOrigin%0A
 %09@Reques
@@ -1154,29 +1154,289 @@
 ;%0A%09%09
-return data.getForm()
+%0A%09%09String oid = data.getEntry().getXFieldWeixinOpenid();%0A%09%09User u = userRepo.findByOpenID(oid);%0A%09%09if(null == u)%7B%0A%09%09%09throw new RuntimeException(%22user not exist for oid: %22 + oid);%0A%09%09%7D%0A%09%09u.setStatus(UserStatus.REGISTERED);%0A%09%09u.setModify_t(new Date());%0A%09%09userRepo.save(u);%0A%09%09return oid
 ;%0A%09%7D

add handling for jinshuju's data.