| Line 3... |
Line 3... |
| 3 |
import com.google.gson.Gson;
|
3 |
import com.google.gson.Gson;
|
| 4 |
import com.jcraft.jsch.*;
|
4 |
import com.jcraft.jsch.*;
|
| 5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
5 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 6 |
import com.spice.profitmandi.common.solr.SolrService;
|
6 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 7 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
7 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| - |
|
8 |
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
|
| - |
|
9 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
| 8 |
import com.spice.profitmandi.dao.entity.dtr.DocumentUrl;
|
10 |
import com.spice.profitmandi.dao.entity.dtr.DocumentUrl;
|
| 9 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.PrintResource;
|
| - |
|
12 |
import com.spice.profitmandi.dao.entity.fofo.PrintResourceRegion;
|
| 10 |
import com.spice.profitmandi.dao.model.MediaPojo;
|
13 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 11 |
import com.spice.profitmandi.dao.model.Specification;
|
14 |
import com.spice.profitmandi.dao.model.*;
|
| 12 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
15 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 13 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
16 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
| 14 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
17 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| - |
|
18 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
| - |
|
19 |
import com.spice.profitmandi.dao.repository.cs.RegionRepository;
|
| 15 |
import com.spice.profitmandi.dao.repository.dtr.DocumentUrlRepository;
|
20 |
import com.spice.profitmandi.dao.repository.dtr.DocumentUrlRepository;
|
| 16 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
21 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| - |
|
22 |
import com.spice.profitmandi.dao.repository.fofo.PrintResourceRegionRepository;
|
| - |
|
23 |
import com.spice.profitmandi.dao.repository.fofo.PrintResourceRepository;
|
| - |
|
24 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 17 |
import com.spice.profitmandi.service.catalog.ItemLoaderService;
|
25 |
import com.spice.profitmandi.service.catalog.ItemLoaderService;
|
| 18 |
import com.spice.profitmandi.web.model.EntityMediaPojo;
|
26 |
import com.spice.profitmandi.web.model.EntityMediaPojo;
|
| - |
|
27 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| - |
|
28 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 19 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
29 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 20 |
import org.apache.commons.csv.CSVFormat;
|
30 |
import org.apache.commons.csv.CSVFormat;
|
| 21 |
import org.apache.commons.csv.CSVParser;
|
31 |
import org.apache.commons.csv.CSVParser;
|
| 22 |
import org.apache.commons.csv.CSVRecord;
|
32 |
import org.apache.commons.csv.CSVRecord;
|
| 23 |
import org.apache.commons.lang3.StringUtils;
|
33 |
import org.apache.commons.lang3.StringUtils;
|
| Line 60... |
Line 70... |
| 60 |
@Autowired
|
70 |
@Autowired
|
| 61 |
DocumentUrlRepository documentUrlRepository;
|
71 |
DocumentUrlRepository documentUrlRepository;
|
| 62 |
|
72 |
|
| 63 |
@Autowired
|
73 |
@Autowired
|
| 64 |
FocusedModelRepository focusedModelRepository;
|
74 |
FocusedModelRepository focusedModelRepository;
|
| - |
|
75 |
|
| - |
|
76 |
@Autowired
|
| - |
|
77 |
PrintResourceRepository printResourceRepository;
|
| - |
|
78 |
@Autowired
|
| - |
|
79 |
AuthRepository authRepository;
|
| - |
|
80 |
@Autowired
|
| - |
|
81 |
RegionRepository regionRepository;
|
| - |
|
82 |
@Autowired
|
| - |
|
83 |
PrintResourceRegionRepository printResourceRegionRepository;
|
| - |
|
84 |
@Autowired
|
| - |
|
85 |
PartnerRegionRepository partnerRegionRepository;
|
| - |
|
86 |
|
| 65 |
private Gson gson = new Gson();
|
87 |
private Gson gson = new Gson();
|
| 66 |
|
88 |
|
| 67 |
public static final int Entity_Id = 0;
|
89 |
public static final int Entity_Id = 0;
|
| 68 |
public static final int Title = 1;
|
90 |
public static final int Title = 1;
|
| 69 |
public static final int KeySpec1 = 2;
|
91 |
public static final int KeySpec1 = 2;
|
| Line 500... |
Line 522... |
| 500 |
|
522 |
|
| 501 |
@GetMapping(value = "/urlGeneration")
|
523 |
@GetMapping(value = "/urlGeneration")
|
| 502 |
public String urlGeneration(HttpServletRequest request, Model model) throws Exception {
|
524 |
public String urlGeneration(HttpServletRequest request, Model model) throws Exception {
|
| 503 |
return "url-generation";
|
525 |
return "url-generation";
|
| 504 |
}
|
526 |
}
|
| - |
|
527 |
@Autowired
|
| - |
|
528 |
UserRepository userRepository;
|
| - |
|
529 |
@Autowired
|
| - |
|
530 |
private CookiesProcessor cookiesProcessor;
|
| - |
|
531 |
|
| - |
|
532 |
@GetMapping(value = "/printResources")
|
| - |
|
533 |
public String printResources(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
534 |
List<Region> regionList = regionRepository.selectAll();
|
| - |
|
535 |
model.addAttribute("regionList", regionList);
|
| - |
|
536 |
return "print-resource";
|
| - |
|
537 |
}
|
| - |
|
538 |
|
| - |
|
539 |
@RequestMapping(value = "/postPrintResource", method = RequestMethod.POST)
|
| - |
|
540 |
public String postPrintResource(HttpServletRequest request, @RequestBody PrintResourceModel printResourceModel,
|
| - |
|
541 |
Model model) throws Exception {
|
| - |
|
542 |
LOGGER.info("printResourceModel {}", printResourceModel);
|
| - |
|
543 |
PrintResource printResource = new PrintResource();
|
| - |
|
544 |
printResource.setTitle(printResourceModel.getTitle());
|
| - |
|
545 |
printResource.setStartDate(printResourceModel.getStartDate().atStartOfDay());
|
| - |
|
546 |
if (printResourceModel.getEndDate() != null) {
|
| - |
|
547 |
printResource.setEndDate(printResourceModel.getEndDate().atStartOfDay());
|
| - |
|
548 |
} else {
|
| - |
|
549 |
printResource.setEndDate(null);
|
| - |
|
550 |
}
|
| - |
|
551 |
|
| - |
|
552 |
printResource.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
553 |
printResource.setImgUrl(printResourceModel.getImgUrl());
|
| - |
|
554 |
printResourceRepository.persist(printResource);
|
| - |
|
555 |
|
| - |
|
556 |
PrintResourceRegion printResourceRegion = new PrintResourceRegion();
|
| - |
|
557 |
int regionId = Integer.parseInt(printResourceModel.getRegion());
|
| - |
|
558 |
printResourceRegion.setRegionId(regionId);
|
| - |
|
559 |
printResourceRegion.setResourceId(printResource.getId());
|
| - |
|
560 |
printResourceRegionRepository.persist(printResourceRegion);
|
| - |
|
561 |
|
| - |
|
562 |
|
| - |
|
563 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
564 |
|
| - |
|
565 |
return "response";
|
| - |
|
566 |
}
|
| - |
|
567 |
|
| - |
|
568 |
@RequestMapping(value = "/changeEndDate", method = RequestMethod.POST)
|
| - |
|
569 |
public String changeEndDate(HttpServletRequest request, @RequestParam LocalDate date, @RequestParam int resourceId,
|
| - |
|
570 |
Model model) throws Exception {
|
| - |
|
571 |
|
| - |
|
572 |
PrintResource printResource = printResourceRepository.selectById(resourceId);
|
| - |
|
573 |
printResource.setEndDate(date.atStartOfDay());
|
| - |
|
574 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
575 |
return "response";
|
| - |
|
576 |
}
|
| - |
|
577 |
|
| - |
|
578 |
@GetMapping(value = "/partnerPrintResources")
|
| - |
|
579 |
public String partnerPrintResources(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
580 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
581 |
int fofoId = loginDetails.getFofoId();
|
| - |
|
582 |
User user = userRepository.selectById(fofoId);
|
| - |
|
583 |
List<PartnerRegion> partnerRegion = partnerRegionRepository.selectByfofoId(user.getId());
|
| - |
|
584 |
LocalDateTime currentDate = LocalDateTime.now();
|
| - |
|
585 |
List<PrintResource> printResources = printResourceRepository.selectPrintResourcesByFofoRegion(partnerRegion.get(0).getRegionId(), currentDate);
|
| - |
|
586 |
LOGGER.info("printresourcesList {}", printResources);
|
| - |
|
587 |
model.addAttribute("printResources", printResources);
|
| - |
|
588 |
return "partner_print_resource";
|
| - |
|
589 |
}
|
| - |
|
590 |
|
| - |
|
591 |
@GetMapping(value = "/allPrintResources")
|
| - |
|
592 |
public String allPrintResources(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
593 |
LocalDateTime currentDate = LocalDateTime.now();
|
| - |
|
594 |
List<PrintResource> printResources = printResourceRepository.selectAllPrintResources(currentDate);
|
| - |
|
595 |
model.addAttribute("printResources", printResources);
|
| - |
|
596 |
return "all-print-resource";
|
| - |
|
597 |
}
|
| - |
|
598 |
|
| 505 |
}
|
599 |
}
|