Subversion Repositories SmartDukaan

Rev

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

Rev 26498 Rev 26512
Line 139... Line 139...
139
 
139
 
140
	@Autowired
140
	@Autowired
141
	private ItemRepository itemRepository;
141
	private ItemRepository itemRepository;
142
 
142
 
143
	@Autowired
143
	@Autowired
-
 
144
	private Gson gson;
-
 
145
 
-
 
146
	@Autowired
144
	private RetailerService retailerService;
147
	private RetailerService retailerService;
145
 
148
 
146
	@Autowired
149
	@Autowired
147
	private MVCResponseSender mvcResponseSender;
150
	private MVCResponseSender mvcResponseSender;
148
 
151
 
Line 1070... Line 1073...
1070
	}
1073
	}
1071
 
1074
 
1072
	@RequestMapping(value = "/getProductInfo", method = RequestMethod.GET)
1075
	@RequestMapping(value = "/getProductInfo", method = RequestMethod.GET)
1073
	public String getProductInfo(HttpServletRequest request, long catalogId, Model model) throws Exception {
1076
	public String getProductInfo(HttpServletRequest request, long catalogId, Model model) throws Exception {
1074
		ContentPojo cp = mongoClient.getEntityById(catalogId);
1077
		ContentPojo cp = mongoClient.getEntityById(catalogId);
1075
		List<String> cps = cp.getKeySpecs();
-
 
1076
		LOGGER.info("cp" + cp.getDefaultImageUrl());
-
 
1077
		model.addAttribute("cp", cp);
1078
		model.addAttribute("cp", cp);
1078
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1079
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
1079
		return "product-info";
1080
		return "product-info";
1080
	}
1081
	}
1081
 
1082
 
1082
	@RequestMapping(value = "/getProductCompareInfo", method = RequestMethod.GET)
1083
	@RequestMapping(value = "/getProductCompareInfo", method = RequestMethod.GET)
1083
	public String getProductCompareInfo(HttpServletRequest request, @RequestParam List<Long> catalogId, Model model)
1084
	public String getProductCompareInfo(HttpServletRequest request, @RequestParam List<Long> catalogIds, Model model)
1084
			throws Exception {
1085
			throws Exception {
1085
		List<ContentPojo> cps = new ArrayList<>();
1086
		List<ContentPojo> cps = new ArrayList<>();
1086
		for (Long id : catalogId) {
1087
		for (Long cId : catalogIds) {
1087
			ContentPojo cp = mongoClient.getEntityById(id);
1088
			ContentPojo cp = mongoClient.getEntityById(cId);
-
 
1089
			if(cp.getName()==null) {
-
 
1090
				cp.setName(itemRepository.selectAllByCatalogItemId(cId.intValue()).get(0).getItemDescriptionNoColor());
-
 
1091
			}
1088
			cps.add(cp);
1092
			cps.add(cp);
1089
		}
1093
		}
1090
		
1094
		
1091
		List<Map<String, String>> entityList = new ArrayList<>();
1095
		List<Map<String, String>> entityList = new ArrayList<>();
1092
		for(ContentPojo cp : cps) {
1096
		for(ContentPojo cp : cps) {
Line 1101... Line 1105...
1101
			entityList.add(specsMap);
1105
			entityList.add(specsMap);
1102
		}
1106
		}
1103
		
1107
		
1104
		LOGGER.info("cps" + cps);
1108
		LOGGER.info("cps" + cps);
1105
        model.addAttribute("cps", cps);
1109
        model.addAttribute("cps", cps);
-
 
1110
        model.addAttribute("catalogIds", gson.toJson(catalogIds,List.class));
1106
        model.addAttribute("entityList", entityList);
1111
        model.addAttribute("entityList", entityList);
1107
		return "product-compare";
1112
		return "product-compare";
1108
	}
1113
	}
1109
}
1114
}
1110
1115