Subversion Repositories SmartDukaan

Rev

Rev 22095 | Rev 22139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22095 Rev 22104
Line 4... Line 4...
4
import java.io.IOException;
4
import java.io.IOException;
5
 
5
 
6
import javax.servlet.http.HttpServletRequest;
6
import javax.servlet.http.HttpServletRequest;
7
 
7
 
8
import org.apache.commons.io.FileUtils;
8
import org.apache.commons.io.FileUtils;
9
import org.json.JSONObject;
-
 
10
import org.slf4j.Logger;
9
import org.slf4j.Logger;
11
import org.slf4j.LoggerFactory;
10
import org.slf4j.LoggerFactory;
12
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.stereotype.Controller;
12
import org.springframework.stereotype.Controller;
-
 
13
import org.springframework.ui.Model;
14
import org.springframework.ui.ModelMap;
14
import org.springframework.ui.ModelMap;
15
import org.springframework.web.bind.annotation.ModelAttribute;
15
import org.springframework.web.bind.annotation.ModelAttribute;
-
 
16
import org.springframework.web.bind.annotation.RequestBody;
16
import org.springframework.web.bind.annotation.RequestMapping;
17
import org.springframework.web.bind.annotation.RequestMapping;
17
import org.springframework.web.bind.annotation.RequestMethod;
18
import org.springframework.web.bind.annotation.RequestMethod;
18
import org.springframework.web.bind.annotation.RequestParam;
-
 
19
 
19
 
20
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
20
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
21
import com.spice.profitmandi.dao.entity.dtr.Document;
21
import com.spice.profitmandi.dao.entity.dtr.Document;
22
import com.spice.profitmandi.dao.model.FofoForm;
22
import com.spice.profitmandi.dao.model.FofoForm;
23
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
23
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
-
 
24
import com.spice.profitmandi.dao.repository.dtr.Mongo;
24
 
25
 
25
@Controller
26
@Controller
26
public class RegisterController {
27
public class RegisterController {
27
	
28
	
28
	private static final Logger LOGGER = LoggerFactory.getLogger(RegisterController.class);
29
	private static final Logger LOGGER = LoggerFactory.getLogger(RegisterController.class);
Line 35... Line 36...
35
	public String registerIndex(HttpServletRequest request, @ModelAttribute("model") ModelMap model) throws Exception{
36
	public String registerIndex(HttpServletRequest request, @ModelAttribute("model") ModelMap model) throws Exception{
36
		return "fofo-form";
37
		return "fofo-form";
37
	}
38
	}
38
	
39
	
39
	@RequestMapping(value = "/register", method = RequestMethod.POST)
40
	@RequestMapping(value = "/register", method = RequestMethod.POST)
40
	public String registerIndex(HttpServletRequest request, @RequestParam(name = "formData") String formData ,@ModelAttribute("model") ModelMap model) throws Exception{
41
	public String registerIndex(HttpServletRequest request, @RequestBody FofoForm fofoForm ,Model model) throws Exception{
41
		JSONObject formObject = new JSONObject(formData);
-
 
42
		getFofoForm(formObject);
42
		Mongo.persistFofoRegInfo(fofoForm);
43
		return "";
43
		return "";
44
	}	
44
	}	
45
	
45
	
46
	public Integer moveDocument(String documentId){
46
	public Integer moveDocument(String documentId){
47
		if (documentId == null || documentId.isEmpty()){
47
		if (documentId == null || documentId.isEmpty()){
Line 65... Line 65...
65
			return null;
65
			return null;
66
		}
66
		}
67
		return document.getId();
67
		return document.getId();
68
	}
68
	}
69
	
69
	
70
	
70
	/*
71
	private FofoForm getFofoForm(JSONObject formObject) {
71
	private FofoForm getFofoForm(JSONObject formObject) {
72
		FofoForm ff = new FofoForm();
72
		FofoForm ff = new FofoForm();
73
		ff.setRegisteredBusinessName(formObject.getString("registeredBusinessName"));
73
		ff.setRegisteredBusinessName(formObject.getString("registeredBusinessName"));
74
		ff.setLine1(formObject.getString("line1"));
74
		ff.setLine1(formObject.getString("line1"));
75
		ff.setLine2(formObject.getString("line2"));
75
		ff.setLine2(formObject.getString("line2"));
Line 206... Line 206...
206
        ff.setBranchName(branchName);
206
        ff.setBranchName(branchName);
207
        ff.setChequeCopy(moveDocument(getChequeCopy()));
207
        ff.setChequeCopy(moveDocument(getChequeCopy()));
208
        ff.setUtr(utr);
208
        ff.setUtr(utr);
209
        ff.set_id(_id);
209
        ff.set_id(_id);
210
        return ff;
210
        return ff;
211
	}
211
	}*/
212
}
212
}