| 22095 |
kshitij.so |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import java.io.File;
|
|
|
4 |
import java.io.IOException;
|
|
|
5 |
|
|
|
6 |
import javax.servlet.http.HttpServletRequest;
|
| 22156 |
amit.gupta |
7 |
import javax.servlet.http.HttpServletResponse;
|
| 22095 |
kshitij.so |
8 |
|
|
|
9 |
import org.apache.commons.io.FileUtils;
|
|
|
10 |
import org.slf4j.Logger;
|
|
|
11 |
import org.slf4j.LoggerFactory;
|
|
|
12 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
13 |
import org.springframework.stereotype.Controller;
|
| 22104 |
amit.gupta |
14 |
import org.springframework.ui.Model;
|
|
|
15 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 22095 |
kshitij.so |
16 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
17 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
18 |
|
|
|
19 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
|
|
20 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
|
|
21 |
import com.spice.profitmandi.dao.model.FofoForm;
|
|
|
22 |
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
|
| 22104 |
amit.gupta |
23 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 22139 |
amit.gupta |
24 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
25 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 22095 |
kshitij.so |
26 |
|
|
|
27 |
@Controller
|
|
|
28 |
public class RegisterController {
|
|
|
29 |
|
|
|
30 |
private static final Logger LOGGER = LoggerFactory.getLogger(RegisterController.class);
|
|
|
31 |
private static final String DOCUMENT_STORE = "/hsps-docs/";
|
|
|
32 |
|
|
|
33 |
@Autowired
|
|
|
34 |
DocumentRepository documentRepository;
|
| 22139 |
amit.gupta |
35 |
|
|
|
36 |
@Autowired
|
|
|
37 |
CookiesProcessor cookiesProcessor;
|
| 22095 |
kshitij.so |
38 |
|
| 22162 |
amit.gupta |
39 |
@Autowired
|
|
|
40 |
Mongo mongoClient;
|
|
|
41 |
|
| 22095 |
kshitij.so |
42 |
@RequestMapping(value = "/register", method = RequestMethod.GET)
|
| 22156 |
amit.gupta |
43 |
public String registerIndex(HttpServletResponse response, HttpServletRequest request, Model model) throws Throwable{
|
| 22140 |
amit.gupta |
44 |
LoginDetails details = cookiesProcessor.getCookiesObject(request);
|
| 22162 |
amit.gupta |
45 |
FofoForm form = mongoClient.getFofoForm(details.getEmailId());
|
| 22158 |
amit.gupta |
46 |
if (form == null) {
|
| 22155 |
amit.gupta |
47 |
model.addAttribute("email", details.getEmailId());
|
|
|
48 |
return "fofo-form";
|
|
|
49 |
} else {
|
| 22156 |
amit.gupta |
50 |
cookiesProcessor.removeCookies(request, response);
|
| 22155 |
amit.gupta |
51 |
return "fofo-thankyou";
|
|
|
52 |
}
|
| 22095 |
kshitij.so |
53 |
}
|
|
|
54 |
|
|
|
55 |
@RequestMapping(value = "/register", method = RequestMethod.POST)
|
| 22156 |
amit.gupta |
56 |
public String registerIndex(HttpServletResponse response, HttpServletRequest request, @RequestBody FofoForm fofoForm ,Model model) throws Throwable{
|
| 22162 |
amit.gupta |
57 |
mongoClient.persistFofoRegInfo(fofoForm);
|
| 22156 |
amit.gupta |
58 |
cookiesProcessor.removeCookies(request, response);
|
|
|
59 |
return "fofo-thankyou";
|
| 22095 |
kshitij.so |
60 |
}
|
|
|
61 |
|
|
|
62 |
public Integer moveDocument(String documentId){
|
|
|
63 |
if (documentId == null || documentId.isEmpty()){
|
|
|
64 |
return null;
|
|
|
65 |
}
|
|
|
66 |
int doc_id = Integer.valueOf(documentId);
|
|
|
67 |
Document document;
|
|
|
68 |
try {
|
|
|
69 |
document = documentRepository.selectById(doc_id);
|
|
|
70 |
} catch (ProfitMandiBusinessException e1) {
|
|
|
71 |
// TODO Auto-generated catch block
|
|
|
72 |
return null;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
File source = new File(document.getPath()+document.getName());
|
|
|
76 |
File dest = new File(DOCUMENT_STORE+source.getName());
|
|
|
77 |
try {
|
|
|
78 |
FileUtils.copyFile(source, dest);
|
|
|
79 |
} catch (IOException e) {
|
|
|
80 |
e.printStackTrace();
|
|
|
81 |
return null;
|
|
|
82 |
}
|
|
|
83 |
return document.getId();
|
|
|
84 |
}
|
|
|
85 |
|
| 22104 |
amit.gupta |
86 |
/*
|
| 22095 |
kshitij.so |
87 |
private FofoForm getFofoForm(JSONObject formObject) {
|
|
|
88 |
FofoForm ff = new FofoForm();
|
|
|
89 |
ff.setRegisteredBusinessName(formObject.getString("registeredBusinessName"));
|
|
|
90 |
ff.setLine1(formObject.getString("line1"));
|
|
|
91 |
ff.setLine2(formObject.getString("line2"));
|
|
|
92 |
ff.setLine3(formObject.getString("line3"));
|
|
|
93 |
ff.setCity(formObject.getString("city"));
|
|
|
94 |
ff.setDistrict(formObject.getString("district"));
|
|
|
95 |
ff.setPincode(formObject.getString("pincode"));
|
|
|
96 |
ff.setState(formObject.getString("state"));
|
|
|
97 |
ff.setStdcode(formObject.getString("stdcode"));
|
|
|
98 |
ff.setTelephone(formObject.getString("telephone"));
|
|
|
99 |
ff.setMobile(formObject.getString("mobile"));
|
|
|
100 |
ff.setRegisteredEmail1(formObject.getString("registeredEmail1"));
|
|
|
101 |
ff.setRegisteredEmail2(formObject.getString("registeredEmail2"));
|
|
|
102 |
ff.setbEntity(formObject.getString("bEntity"));
|
|
|
103 |
ff.setDinNumber(formObject.getString("dinNumber"));
|
|
|
104 |
ff.setbEntityDoc(moveDocument(formObject.getString("bEntityDoc")));
|
|
|
105 |
ff.setGst(formObject.getString("gst"));
|
|
|
106 |
ff.setGstDoc(moveDocument(formObject.getString("gstDoc")));
|
|
|
107 |
ff.setPan(formObject.getString("pan"));
|
|
|
108 |
ff.setPanDoc(moveDocument(formObject.getString("panDoc")));
|
|
|
109 |
ff.setbPmpDetail(formObject.getString("bPmpDetail"));
|
|
|
110 |
ff.setProprietorBusineesName(formObject.getString("proprietorBusineesName"));
|
|
|
111 |
//formObject.getString("proprietorAddress")
|
|
|
112 |
ff.setProprietorAddress(formObject.getString("proprietorAddress"));
|
|
|
113 |
ff.setProprietorPhone(formObject.getString("proprietorPhone"));
|
|
|
114 |
ff.setProprietorPan(proprietorPan);
|
|
|
115 |
ff.setProprietorAdhaar(proprietorAdhaar);
|
|
|
116 |
ff.setProprietorEmail(proprietorEmail);
|
|
|
117 |
ff.setProprietorOwner(proprietorOwner);
|
|
|
118 |
ff.setPartnerName1(partnerName1);
|
|
|
119 |
ff.setPartnerAddress1(partnerAddress1);
|
|
|
120 |
ff.setPartnerPhone1(partnerPhone1);
|
|
|
121 |
ff.setPartnerPan1(partnerPan1);
|
|
|
122 |
ff.setPartnerAdhaar1(partnerAdhaar1);
|
|
|
123 |
ff.setPartnerEmail1(partnerEmail1);
|
|
|
124 |
ff.setPartnerOwner1(partnerOwner1);
|
|
|
125 |
ff.setPartnerName2(partnerName2);
|
|
|
126 |
ff.setPartnerAddress2(partnerAddress2);
|
|
|
127 |
ff.setPartnerPhone2(partnerPhone2);
|
|
|
128 |
ff.setPartnerPan2(partnerPan2);
|
|
|
129 |
ff.setPartnerAdhaar2(partnerAdhaar2);
|
|
|
130 |
ff.setPartnerEmail2(partnerEmail2);
|
|
|
131 |
ff.setPartnerOwner2(partnerOwner2);
|
|
|
132 |
ff.setPartnerName3(partnerName3);
|
|
|
133 |
ff.setPartnerAddress3(partnerAddress3);
|
|
|
134 |
ff.setPartnerPhone3(partnerPhone3);
|
|
|
135 |
ff.setPartnerPan3(partnerPan3);
|
|
|
136 |
ff.setPartnerAdhaar3(partnerAdhaar3);
|
|
|
137 |
ff.setPartnerEmail3(partnerEmail3);
|
|
|
138 |
ff.setPartnerOwner3(partnerOwner3);
|
|
|
139 |
ff.setPartnerName4(partnerName4);
|
|
|
140 |
ff.setPartnerAddress4(partnerAddress4);
|
|
|
141 |
ff.setPartnerPhone4(partnerPhone4);
|
|
|
142 |
ff.setPartnerPan4(partnerPan4);
|
|
|
143 |
ff.setPartnerAdhaar4(partnerAdhaar4);
|
|
|
144 |
ff.setPartnerEmail4(partnerEmail4);
|
|
|
145 |
ff.setPartnerOwner4(partnerOwner4);
|
|
|
146 |
ff.setShareholderName1(shareholderName1);
|
|
|
147 |
ff.setShareholderAddress1(shareholderAddress1);
|
|
|
148 |
ff.setShareholderPhone1(shareholderPhone1);
|
|
|
149 |
ff.setShareholderPan1(shareholderPan1);
|
|
|
150 |
ff.setShareholderAdhaar1(shareholderAdhaar1);
|
|
|
151 |
ff.setShareholderEmail1(shareholderEmail1);
|
|
|
152 |
ff.setShareholderOwner1(shareholderOwner1);
|
|
|
153 |
ff.setShareholderName2(shareholderName2);
|
|
|
154 |
ff.setShareholderAddress2(shareholderAddress2);
|
|
|
155 |
ff.setShareholderPhone2(shareholderPhone2);
|
|
|
156 |
ff.setShareholderPan2(shareholderPan2);
|
|
|
157 |
ff.setShareholderAdhaar2(shareholderAdhaar2);
|
|
|
158 |
ff.setShareholderEmail2(shareholderEmail2);
|
|
|
159 |
ff.setShareholderOwner2(shareholderOwner2);
|
|
|
160 |
ff.setShareholderName3(shareholderName3);
|
|
|
161 |
ff.setShareholderAddress3(shareholderAddress3);
|
|
|
162 |
ff.setShareholderPhone3(shareholderPhone3);
|
|
|
163 |
ff.setShareholderPan3(shareholderPan3);
|
|
|
164 |
ff.setShareholderAdhaar3(shareholderAdhaar3);
|
|
|
165 |
ff.setShareholderEmail3(shareholderEmail3);
|
|
|
166 |
ff.setShareholderOwner3(shareholderOwner3);
|
|
|
167 |
ff.setShareholderName4(shareholderName4);
|
|
|
168 |
ff.setShareholderAddress4(shareholderAddress4);
|
|
|
169 |
ff.setShareholderPhone4(shareholderPhone4);
|
|
|
170 |
ff.setShareholderPan4(shareholderPan4);
|
|
|
171 |
ff.setShareholderAdhaar4(shareholderAdhaar4);
|
|
|
172 |
ff.setShareholderEmail4(shareholderEmail4);
|
|
|
173 |
ff.setShareholderOwner4(shareholderOwner4);
|
|
|
174 |
ff.setManagerName(managerName);
|
|
|
175 |
ff.setManagerNo(managerNo);
|
|
|
176 |
ff.setManagerEmail(managerEmail);
|
|
|
177 |
ff.setNoOfEmployees(noOfEmployees);
|
|
|
178 |
ff.setManagementStaff(managementStaff);
|
|
|
179 |
ff.setExperienceinTelecome(experienceinTelecome);
|
|
|
180 |
ff.setDescriptionofExistingBusiness(descriptionofExistingBusiness);
|
|
|
181 |
ff.setItrDoc(moveDocument(getItrDoc()));
|
|
|
182 |
ff.setBusinessModel(businessModel);
|
|
|
183 |
ff.setSellingOnline(sellingOnline);
|
|
|
184 |
ff.setPortalName1(portalName1);
|
|
|
185 |
ff.setPortalName2(portalName2);
|
|
|
186 |
ff.setPortalName3(portalName3);
|
|
|
187 |
ff.setEast(east);
|
|
|
188 |
ff.setWest(west);
|
|
|
189 |
ff.setNorth(north);
|
|
|
190 |
ff.setSouth(south);
|
|
|
191 |
ff.setFront(front);
|
|
|
192 |
ff.setRoadSize(roadSize);
|
|
|
193 |
ff.setShopArea(shopArea);
|
|
|
194 |
ff.setShopStatus(shopStatus);
|
|
|
195 |
ff.setFlooring(flooring);
|
|
|
196 |
ff.setCieling(cieling);
|
|
|
197 |
ff.setStore(nearestStore);
|
|
|
198 |
ff.setWashroom(washroom);
|
|
|
199 |
ff.setWaterSupply(waterSupply);
|
|
|
200 |
ff.setPantry(pantry);
|
|
|
201 |
ff.setElectricity(electricity);
|
|
|
202 |
ff.setShopAvailbility(shopAvailbility);
|
|
|
203 |
ff.setAngleDoc1(moveDocument(getAngleDoc1()));
|
|
|
204 |
ff.setAngleDoc2(moveDocument(getAngleDoc2()));
|
|
|
205 |
ff.setAngleDoc3(moveDocument(getAngleDoc3()));
|
|
|
206 |
ff.setAngleDoc4(moveDocument(getAngleDoc4()));
|
|
|
207 |
ff.setAngleDoc5(moveDocument(getAngleDoc5()));
|
|
|
208 |
ff.setLocation(location);
|
|
|
209 |
ff.setNearestStore(nearestStore);
|
|
|
210 |
ff.setStoreName(storeName);
|
|
|
211 |
ff.setStoreAddress(storeAddress);
|
|
|
212 |
ff.setOwnership(ownership);
|
|
|
213 |
ff.setOwnershipDoc(moveDocument(getOwnershipDoc()));
|
|
|
214 |
ff.setInsurance(insurance);
|
|
|
215 |
ff.setInsuranceDoc(moveDocument(getInsuranceDoc()));
|
|
|
216 |
ff.setLoan(loan);
|
|
|
217 |
ff.setLoanDoc(moveDocument(getLoanDoc()));
|
|
|
218 |
ff.setSanctionDoc(moveDocument(getSanctionDoc()));
|
|
|
219 |
ff.setAccountNumber(accountNumber);
|
|
|
220 |
ff.setBankName(bankName);
|
|
|
221 |
ff.setIfscCode(ifscCode);
|
|
|
222 |
ff.setBranchName(branchName);
|
|
|
223 |
ff.setChequeCopy(moveDocument(getChequeCopy()));
|
|
|
224 |
ff.setUtr(utr);
|
|
|
225 |
ff.set_id(_id);
|
|
|
226 |
return ff;
|
| 22104 |
amit.gupta |
227 |
}*/
|
| 22095 |
kshitij.so |
228 |
}
|