Subversion Repositories SmartDukaan

Rev

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

Rev 29900 Rev 30080
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.io.ByteArrayInputStream;
-
 
4
import java.io.File;
-
 
5
import java.io.FileInputStream;
-
 
6
import java.io.FileNotFoundException;
-
 
7
import java.io.InputStream;
-
 
8
import java.io.InputStreamReader;
-
 
9
import java.sql.Timestamp;
-
 
10
import java.time.LocalDate;
-
 
11
import java.time.LocalDateTime;
-
 
12
import java.time.ZoneOffset;
-
 
13
import java.util.ArrayList;
-
 
14
import java.util.Arrays;
-
 
15
import java.util.HashMap;
-
 
16
import java.util.List;
-
 
17
import java.util.Map;
-
 
18
import java.util.stream.Collectors;
-
 
19
 
-
 
20
import javax.servlet.http.HttpServletRequest;
-
 
21
import javax.transaction.Transactional;
-
 
22
import javax.xml.bind.DatatypeConverter;
-
 
23
 
-
 
24
import org.apache.commons.csv.CSVFormat;
-
 
25
import org.apache.commons.csv.CSVParser;
-
 
26
import org.apache.commons.csv.CSVRecord;
-
 
27
import org.apache.commons.lang3.StringUtils;
-
 
28
import org.apache.logging.log4j.LogManager;
-
 
29
import org.apache.logging.log4j.Logger;
-
 
30
import org.springframework.beans.factory.annotation.Autowired;
-
 
31
import org.springframework.stereotype.Controller;
-
 
32
import org.springframework.ui.Model;
-
 
33
import org.springframework.web.bind.annotation.GetMapping;
-
 
34
import org.springframework.web.bind.annotation.PostMapping;
-
 
35
import org.springframework.web.bind.annotation.RequestBody;
-
 
36
import org.springframework.web.bind.annotation.RequestParam;
-
 
37
import org.springframework.web.bind.annotation.RequestPart;
-
 
38
import org.springframework.web.multipart.MultipartFile;
-
 
39
 
-
 
40
import com.google.gson.Gson;
3
import com.google.gson.Gson;
41
import com.jcraft.jsch.ChannelSftp;
-
 
42
import com.jcraft.jsch.JSch;
4
import com.jcraft.jsch.*;
43
import com.jcraft.jsch.JSchException;
-
 
44
import com.jcraft.jsch.Session;
-
 
45
import com.jcraft.jsch.SftpATTRS;
-
 
46
import com.jcraft.jsch.SftpException;
-
 
47
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
5
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
48
import com.spice.profitmandi.common.solr.SolrService;
6
import com.spice.profitmandi.common.solr.SolrService;
49
import com.spice.profitmandi.dao.entity.catalog.Item;
7
import com.spice.profitmandi.dao.entity.catalog.Item;
50
import com.spice.profitmandi.dao.entity.dtr.DocumentUrl;
8
import com.spice.profitmandi.dao.entity.dtr.DocumentUrl;
51
import com.spice.profitmandi.dao.model.ContentPojo;
9
import com.spice.profitmandi.dao.model.ContentPojo;
Line 55... Line 13...
55
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
13
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
56
import com.spice.profitmandi.dao.repository.dtr.DocumentUrlRepository;
14
import com.spice.profitmandi.dao.repository.dtr.DocumentUrlRepository;
57
import com.spice.profitmandi.dao.repository.dtr.Mongo;
15
import com.spice.profitmandi.dao.repository.dtr.Mongo;
58
import com.spice.profitmandi.web.model.EntityMediaPojo;
16
import com.spice.profitmandi.web.model.EntityMediaPojo;
59
import com.spice.profitmandi.web.util.MVCResponseSender;
17
import com.spice.profitmandi.web.util.MVCResponseSender;
-
 
18
import org.apache.commons.csv.CSVFormat;
-
 
19
import org.apache.commons.csv.CSVParser;
-
 
20
import org.apache.commons.csv.CSVRecord;
-
 
21
import org.apache.commons.lang3.StringUtils;
-
 
22
import org.apache.logging.log4j.LogManager;
-
 
23
import org.apache.logging.log4j.Logger;
-
 
24
import org.springframework.beans.factory.annotation.Autowired;
-
 
25
import org.springframework.stereotype.Controller;
-
 
26
import org.springframework.ui.Model;
-
 
27
import org.springframework.web.bind.annotation.*;
-
 
28
import org.springframework.web.multipart.MultipartFile;
-
 
29
 
-
 
30
import javax.servlet.http.HttpServletRequest;
-
 
31
import javax.transaction.Transactional;
-
 
32
import javax.xml.bind.DatatypeConverter;
-
 
33
import java.io.*;
-
 
34
import java.sql.Timestamp;
-
 
35
import java.time.LocalDate;
-
 
36
import java.time.LocalDateTime;
-
 
37
import java.time.ZoneOffset;
-
 
38
import java.util.*;
-
 
39
import java.util.stream.Collectors;
60
 
40
 
61
@Transactional(rollbackOn = Throwable.class)
41
@Transactional(rollbackOn = Throwable.class)
62
@Controller
42
@Controller
63
public class ContentController {
43
public class ContentController {
64
	@Autowired
44
	@Autowired
Line 250... Line 230...
250
		return ep;
230
		return ep;
251
	}
231
	}
252
 
232
 
253
	@GetMapping(value = "/entity")
233
	@GetMapping(value = "/entity")
254
	public String searchEntity(HttpServletRequest request, @RequestParam(defaultValue = "null") String query,
234
	public String searchEntity(HttpServletRequest request, @RequestParam(defaultValue = "null") String query,
255
			@RequestParam(defaultValue = "0") int categoryId, @RequestParam(defaultValue = "") List<String> brands,
235
							   @RequestParam(defaultValue = "0") int categoryId, @RequestParam(defaultValue = "") List<String> brands,
256
			@RequestParam(defaultValue = "30") int limit, Model model) throws Exception {
236
							   @RequestParam(defaultValue = "30") int limit,
-
 
237
							   @RequestParam(defaultValue = "true") boolean activeOnly,
-
 
238
							   Model model) throws Exception {
257
		model.addAttribute("response", solrService.getContent(query, categoryId, brands, limit));
239
		model.addAttribute("response", solrService.getContent(query, categoryId, brands, limit, activeOnly));
258
		return "response";
240
		return "response";
259
	}
241
	}
260
 
242
 
261
	@GetMapping(value = "/content/index")
243
	@GetMapping(value = "/content/index")
262
	public String index(HttpServletRequest request, Model model) throws Exception {
244
	public String index(HttpServletRequest request, Model model) throws Exception {