| Line 53... |
Line 53... |
| 53 |
import org.springframework.web.bind.annotation.RequestMapping;
|
53 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 54 |
import org.springframework.web.bind.annotation.RequestMethod;
|
54 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 55 |
import org.springframework.web.bind.annotation.RequestParam;
|
55 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 56 |
|
56 |
|
| 57 |
import javax.servlet.http.HttpServletRequest;
|
57 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
58 |
import java.time.LocalDate;
|
| 58 |
import java.time.LocalDateTime;
|
59 |
import java.time.LocalDateTime;
|
| 59 |
import java.util.*;
|
60 |
import java.util.*;
|
| 60 |
import java.util.stream.Collectors;
|
61 |
import java.util.stream.Collectors;
|
| 61 |
|
62 |
|
| 62 |
@Controller
|
63 |
@Controller
|
| Line 163... |
Line 164... |
| 163 |
return "response";
|
164 |
return "response";
|
| 164 |
}
|
165 |
}
|
| 165 |
}
|
166 |
}
|
| 166 |
|
167 |
|
| 167 |
// show all pending Form to specific auth user who have filled the form(type based)
|
168 |
// show all pending Form to specific auth user who have filled the form(type based)
|
| 168 |
@RequestMapping("/pendingOnboardingForm")
|
169 |
@RequestMapping(value = "/pendingOnboardingForm", method = RequestMethod.GET)
|
| 169 |
public String pendingLoiForm(HttpServletRequest request, Model model) throws Exception {
|
170 |
public String pendingLoiForm(HttpServletRequest request, Model model) throws Exception {
|
| 170 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
171 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 171 |
String email = loginDetails.getEmailId();
|
172 |
String email = loginDetails.getEmailId();
|
| 172 |
boolean isDocApprover = false;
|
173 |
boolean isDocApprover = false;
|
| 173 |
//todo:replace
|
174 |
//todo:replace
|
| 174 |
String approverEmail = "gaurav.sharma@smartdukaan.com";
|
175 |
String approverEmail = "gaurav.sharma@smartdukaan.com";
|
| 175 |
if (email.equals(approverEmail)) {
|
176 |
if (email.equals(approverEmail)) {
|
| 176 |
isDocApprover = true;
|
177 |
isDocApprover = true;
|
| 177 |
}
|
178 |
}
|
| - |
|
179 |
boolean isAuthUser = false;
|
| - |
|
180 |
List<String> authEmail = Arrays.asList("sm@smartdukaan.com", "gaurav.sharma@smartdukaan.com", "tejus.lohani@smartdukaan.com");
|
| - |
|
181 |
isAuthUser = authEmail.stream().anyMatch(x -> x.equals(email));
|
| 178 |
List<LoiFormModel> pendingFormList = loiFormService.pendingFormList(email);
|
182 |
List<LoiFormModel> pendingFormList = loiFormService.pendingFormList(email);
|
| 179 |
LOGGER.info("pendingFormList {}", pendingFormList);
|
183 |
LOGGER.info("pendingFormList {}", pendingFormList);
|
| 180 |
model.addAttribute("isDocApprover", isDocApprover);
|
184 |
model.addAttribute("isDocApprover", isDocApprover);
|
| - |
|
185 |
model.addAttribute("isAuthUser", isAuthUser);
|
| 181 |
model.addAttribute("pendingFormList", pendingFormList);
|
186 |
model.addAttribute("pendingFormList", pendingFormList);
|
| 182 |
return "pendingForm";
|
187 |
return "pendingForm";
|
| 183 |
}
|
188 |
}
|
| 184 |
|
189 |
|
| 185 |
// generate LOI for specific Form data
|
190 |
// generate LOI for specific Form data
|
| Line 204... |
Line 209... |
| 204 |
model.addAttribute("pod", loiForm);
|
209 |
model.addAttribute("pod", loiForm);
|
| 205 |
return "auto-Loi";
|
210 |
return "auto-Loi";
|
| 206 |
|
211 |
|
| 207 |
}
|
212 |
}
|
| 208 |
|
213 |
|
| 209 |
@RequestMapping("/saveLoiDoc")
|
214 |
@RequestMapping(value = "/saveLoiDoc", method = RequestMethod.POST)
|
| 210 |
public String saveLoiDoc(@RequestParam int loiId, @RequestParam int loiDocId, Model model) throws Exception {
|
215 |
public String saveLoiDoc(@RequestParam int loiId, @RequestParam int loiDocId, Model model) throws Exception {
|
| 211 |
LOGGER.info("loi_docId-" + loiDocId);
|
216 |
LOGGER.info("loi_docId-" + loiDocId);
|
| 212 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
217 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
| 213 |
LOGGER.info("loiForm - " + loiForm);
|
218 |
LOGGER.info("loiForm - " + loiForm);
|
| 214 |
int loiDoc = loiForm.getLoiDoc();
|
219 |
int loiDoc = loiForm.getLoiDoc();
|
| Line 223... |
Line 228... |
| 223 |
}
|
228 |
}
|
| 224 |
|
229 |
|
| 225 |
}
|
230 |
}
|
| 226 |
|
231 |
|
| 227 |
// send Filled form for update purpose
|
232 |
// send Filled form for update purpose
|
| 228 |
@RequestMapping("/updateOnboardingForm")
|
233 |
@RequestMapping(value = "/updateOnboardingForm", method = RequestMethod.GET)
|
| 229 |
public String UpdateLoiForm(HttpServletRequest request,
|
234 |
public String UpdateLoiForm(HttpServletRequest request,
|
| 230 |
@RequestParam int loiId,
|
235 |
@RequestParam int loiId,
|
| 231 |
Model model) throws ProfitMandiBusinessException {
|
236 |
Model model) throws ProfitMandiBusinessException {
|
| 232 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
237 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
| 233 |
List<AuthUser> salesAuthList = loiFormService.getReferalAuthList();
|
238 |
List<AuthUser> salesAuthList = loiFormService.getReferalAuthList();
|
| Line 279... |
Line 284... |
| 279 |
throw new ProfitMandiBusinessException("You need to add only due brand fee that is Only, " + differanceAmount + " INR", null, "Pay differance amount or less then differance amount");
|
284 |
throw new ProfitMandiBusinessException("You need to add only due brand fee that is Only, " + differanceAmount + " INR", null, "Pay differance amount or less then differance amount");
|
| 280 |
}
|
285 |
}
|
| 281 |
}
|
286 |
}
|
| 282 |
|
287 |
|
| 283 |
|
288 |
|
| 284 |
@RequestMapping("/paymentsDetail")
|
289 |
@RequestMapping(value = "/paymentsDetail", method = RequestMethod.GET)
|
| 285 |
public String paymentsDetails(HttpServletRequest request, @RequestParam int loiId, Model model) throws ProfitMandiBusinessException {
|
290 |
public String paymentsDetails(HttpServletRequest request, @RequestParam int loiId, Model model) throws ProfitMandiBusinessException {
|
| 286 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
291 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 287 |
String email = loginDetails.getEmailId();
|
292 |
String email = loginDetails.getEmailId();
|
| 288 |
boolean isNiraj = false;
|
293 |
boolean isNiraj = false;
|
| 289 |
if (email.equals("neeraj.gupta@smartdukaan.com")) {
|
294 |
if (email.equals("neeraj.gupta@smartdukaan.com")) {
|
| Line 296... |
Line 301... |
| 296 |
model.addAttribute("isNiraj", isNiraj);
|
301 |
model.addAttribute("isNiraj", isNiraj);
|
| 297 |
return "payment-collection-details";
|
302 |
return "payment-collection-details";
|
| 298 |
}
|
303 |
}
|
| 299 |
|
304 |
|
| 300 |
// bfcId - Brand Fee Collection Id
|
305 |
// bfcId - Brand Fee Collection Id
|
| 301 |
@RequestMapping("/feePaymentApproval")
|
306 |
@RequestMapping(value = "/feePaymentApproval", method = RequestMethod.PUT)
|
| 302 |
public String feePaymentApproval(HttpServletRequest request, @RequestParam int bfcId, @RequestParam FeePaymentStatus feePaymentStatus, @RequestParam String description,
|
307 |
public String feePaymentApproval(HttpServletRequest request, @RequestParam int bfcId, @RequestParam FeePaymentStatus feePaymentStatus, @RequestParam String description,
|
| 303 |
Model model) throws Exception {
|
308 |
Model model) throws Exception {
|
| 304 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
309 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 305 |
String authEmail = loginDetails.getEmailId();
|
310 |
String authEmail = loginDetails.getEmailId();
|
| 306 |
BrandFeeCollection brandFeeCollection = brandFeeCollectionRepository.selectById(bfcId);
|
311 |
BrandFeeCollection brandFeeCollection = brandFeeCollectionRepository.selectById(bfcId);
|
| Line 313... |
Line 318... |
| 313 |
double totalBrandFeeCollection = brandFeeCollections.stream().mapToDouble(x -> x.getCollectedAmount()).sum() + brandFeeCollection.getCollectedAmount();
|
318 |
double totalBrandFeeCollection = brandFeeCollections.stream().mapToDouble(x -> x.getCollectedAmount()).sum() + brandFeeCollection.getCollectedAmount();
|
| 314 |
LOGGER.info("agreedBrandeFee -" + agreedBrandFee);
|
319 |
LOGGER.info("agreedBrandeFee -" + agreedBrandFee);
|
| 315 |
LOGGER.info("totalBrandFeeCollection -" + totalBrandFeeCollection);
|
320 |
LOGGER.info("totalBrandFeeCollection -" + totalBrandFeeCollection);
|
| 316 |
boolean b = agreedBrandFee == totalBrandFeeCollection && loiForm.getLoiSignOtp() != null;
|
321 |
boolean b = agreedBrandFee == totalBrandFeeCollection && loiForm.getLoiSignOtp() != null;
|
| 317 |
if (brandFeeCollection.getPaymentStatus().equals(FeePaymentStatus.REJECT)) {
|
322 |
if (brandFeeCollection.getPaymentStatus().equals(FeePaymentStatus.REJECT)) {
|
| 318 |
loiFormService.sendPaymentStatusMailToLoiFiller(brandFeeCollection);
|
323 |
loiFormService.sendPaymentStatusMailToLoiFormFilledBy(brandFeeCollection);
|
| 319 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
324 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
| 320 |
} else {
|
325 |
} else {
|
| 321 |
loiFormService.sendPaymentStatusMailToLoiFiller(brandFeeCollection);
|
326 |
loiFormService.sendPaymentStatusMailToLoiFormFilledBy(brandFeeCollection);
|
| 322 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
327 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 323 |
}
|
328 |
}
|
| 324 |
if (agreedBrandFee == totalBrandFeeCollection && loiForm.getLoiSignOtp() != null) {
|
329 |
if (agreedBrandFee == totalBrandFeeCollection && loiForm.getLoiSignOtp() != null) {
|
| 325 |
loiForm.setStatus(LoiStatus.PRE_ONBOARDING_DONE);
|
330 |
loiForm.setStatus(LoiStatus.PRE_ONBOARDING_DONE);
|
| 326 |
}
|
331 |
}
|
| 327 |
return "response";
|
332 |
return "response";
|
| 328 |
|
333 |
|
| 329 |
}
|
334 |
}
|
| 330 |
|
335 |
|
| 331 |
@RequestMapping("/uploadDocumentForm")
|
336 |
@RequestMapping(value = "/uploadDocumentForm", method = RequestMethod.GET)
|
| 332 |
public String uploadDocumentForm(HttpServletRequest request, @RequestParam int loiId, Model model) throws ProfitMandiBusinessException {
|
337 |
public String uploadDocumentForm(HttpServletRequest request, @RequestParam int loiId, Model model) throws ProfitMandiBusinessException {
|
| 333 |
List<LoiDocMaster> activeDocMasterList = loiDocMasterList.getAllActiveDoc();
|
338 |
List<LoiDocMaster> activeDocMasterList = loiDocMasterList.getAllActiveDoc();
|
| 334 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
339 |
LoiForm loiForm = loiFormRepository.selectById(loiId);
|
| 335 |
//TODO:replace
|
- |
|
| 336 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
340 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 337 |
String authEmail = authRepository.selectByEmailOrMobile(loginDetails.getEmailId()).getEmailId();
|
341 |
String authEmail = authRepository.selectByEmailOrMobile(loginDetails.getEmailId()).getEmailId();
|
| 338 |
String approverEmail = "gaurav.sharma@smartdukaan.com";
|
342 |
String approverEmail = "gaurav.sharma@smartdukaan.com";
|
| 339 |
boolean isApprover = false;
|
343 |
boolean isApprover = false;
|
| 340 |
if (authEmail.equals(approverEmail)) {
|
344 |
if (authEmail.equals(approverEmail)) {
|
| Line 358... |
Line 362... |
| 358 |
return "response";
|
362 |
return "response";
|
| 359 |
|
363 |
|
| 360 |
}
|
364 |
}
|
| 361 |
|
365 |
|
| 362 |
|
366 |
|
| 363 |
@RequestMapping("/documentVerify")
|
367 |
@RequestMapping(value = "/documentVerify", method = RequestMethod.PUT)
|
| 364 |
public String docApproval(HttpServletRequest request, @RequestParam int loiId, @RequestParam int docMasterId, @RequestParam boolean flag, Model model) throws Exception {
|
368 |
public String docApproval(HttpServletRequest request, @RequestParam int loiId, @RequestParam int docMasterId, @RequestParam boolean flag, Model model) throws Exception {
|
| 365 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
369 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 366 |
AuthUser auth = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
370 |
AuthUser auth = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 367 |
LoiDoc loiDoc = loiDocRepository.selectByLoiIdAndMasterDocId(loiId, docMasterId);
|
371 |
LoiDoc loiDoc = loiDocRepository.selectByLoiIdAndMasterDocId(loiId, docMasterId);
|
| 368 |
if (flag) {
|
372 |
if (flag) {
|
| Line 371... |
Line 375... |
| 371 |
model.addAttribute("response1", mvcResponseSender.createResponseString(loiDoc.getDocType() + " is Accepted "));
|
375 |
model.addAttribute("response1", mvcResponseSender.createResponseString(loiDoc.getDocType() + " is Accepted "));
|
| 372 |
return "response";
|
376 |
return "response";
|
| 373 |
} else {
|
377 |
} else {
|
| 374 |
loiDoc.setOk(false);
|
378 |
loiDoc.setOk(false);
|
| 375 |
loiDoc.setVerifyBy(auth.getId());
|
379 |
loiDoc.setVerifyBy(auth.getId());
|
| - |
|
380 |
loiFormService.sendDocApprovalMail(loiDoc);
|
| 376 |
model.addAttribute("response1", mvcResponseSender.createResponseString(loiDoc.getDocType() + " is Rejected"));
|
381 |
model.addAttribute("response1", mvcResponseSender.createResponseString(loiDoc.getDocType() + " is Rejected"));
|
| 377 |
return "response";
|
382 |
return "response";
|
| 378 |
}
|
383 |
}
|
| 379 |
}
|
384 |
}
|
| 380 |
|
385 |
|
| Line 419... |
Line 424... |
| 419 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
424 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 420 |
}
|
425 |
}
|
| 421 |
return "response";
|
426 |
return "response";
|
| 422 |
}
|
427 |
}
|
| 423 |
|
428 |
|
| 424 |
@RequestMapping(value = "/completedLoiForms")
|
429 |
@RequestMapping(value = "/completedLoiForms", method = RequestMethod.GET)
|
| 425 |
public String completeLoiFormList(Model model) {
|
430 |
public String completeLoiFormList(Model model) {
|
| 426 |
List<LoiForm> loiForms = loiFormRepository.selectAllCompleteForm();
|
431 |
List<LoiForm> loiForms = loiFormRepository.selectAllCompleteForm();
|
| 427 |
List<EscalationType> EscalationTypeList = new ArrayList<>();
|
432 |
List<EscalationType> EscalationTypeList = new ArrayList<>();
|
| 428 |
EscalationTypeList.add(EscalationType.L2);
|
433 |
EscalationTypeList.add(EscalationType.L2);
|
| 429 |
EscalationTypeList.add(EscalationType.L1);
|
434 |
EscalationTypeList.add(EscalationType.L1);
|
| Line 433... |
Line 438... |
| 433 |
model.addAttribute("loiForms", loiForms);
|
438 |
model.addAttribute("loiForms", loiForms);
|
| 434 |
model.addAttribute("authUsers", authUsers);
|
439 |
model.addAttribute("authUsers", authUsers);
|
| 435 |
return "loiForm/completed-loi-form";
|
440 |
return "loiForm/completed-loi-form";
|
| 436 |
}
|
441 |
}
|
| 437 |
|
442 |
|
| 438 |
@RequestMapping(value = "/createNewOnboardingPanel")
|
443 |
@RequestMapping(value = "/createNewOnboardingPanel", method = RequestMethod.POST)
|
| 439 |
public String CreateNewOnboardingPanel(@RequestParam int loiId, @RequestParam int authId, Model model) throws Exception {
|
444 |
public String CreateNewOnboardingPanel(@RequestParam int loiId, @RequestParam int authId, Model model) throws Exception {
|
| 440 |
PartnerOnBoardingPanel partnerOnboardingPanel = loiFormService.createPartnerOnboardingPanel(loiId, authId);
|
445 |
PartnerOnBoardingPanel partnerOnboardingPanel = loiFormService.createPartnerOnboardingPanel(loiId, authId);
|
| 441 |
loiFormRepository.selectById(loiId).setStatus(LoiStatus.IN_ONBOARDING_PROCESS);
|
446 |
loiFormRepository.selectById(loiId).setStatus(LoiStatus.IN_ONBOARDING_PROCESS);
|
| 442 |
if (partnerOnboardingPanel.getId() != 0)
|
447 |
if (partnerOnboardingPanel.getId() != 0)
|
| 443 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
448 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 444 |
else
|
449 |
else
|
| 445 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
450 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
| 446 |
return "response";
|
451 |
return "response";
|
| 447 |
}
|
452 |
}
|
| - |
|
453 |
|
| - |
|
454 |
@RequestMapping(value = "/downloadLoiFromReport", method = RequestMethod.GET)
|
| - |
|
455 |
public ResponseEntity<?> downloadAllLoiForm(@RequestParam LocalDate from, @RequestParam LocalDate to) throws Exception {
|
| - |
|
456 |
ResponseEntity<?> responseEntity = loiFormService.createLoiFormReport(from, to);
|
| - |
|
457 |
|
| - |
|
458 |
return responseEntity;
|
| - |
|
459 |
}
|
| - |
|
460 |
|
| - |
|
461 |
|
| 448 |
}
|
462 |
}
|