Subversion Repositories SmartDukaan

Rev

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

Rev 26535 Rev 26536
Line 221... Line 221...
221
				}
221
				}
222
			} catch (ProfitMandiBusinessException profitMandiBusinessException) {
222
			} catch (ProfitMandiBusinessException profitMandiBusinessException) {
223
				LOGGER.error("Retailer not found in user_account");
223
				LOGGER.error("Retailer not found in user_account");
224
			}
224
			}
225
		} else {
225
		} else {
226
			throw new ProfitMandiBusinessException("User Email/Mobile", emailIdOrMobileNumber, "Email/Mobile Not exist"); 
226
			throw new ProfitMandiBusinessException("User Email/Mobile", emailIdOrMobileNumber,
-
 
227
					"Email/Mobile Not exist");
227
		}
228
		}
228
 
229
 
229
		return map;
230
		return map;
230
	}
231
	}
231
 
232
 
Line 1097... Line 1098...
1097
			throws ProfitMandiBusinessException {
1098
			throws ProfitMandiBusinessException {
1098
		Address businessAddress = loginRequestResponseModel.getBusinessAddress();
1099
		Address businessAddress = loginRequestResponseModel.getBusinessAddress();
1099
		businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
1100
		businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
1100
		addressRepository.persist(businessAddress);
1101
		addressRepository.persist(businessAddress);
1101
	}
1102
	}
1102
	
1103
 
1103
	private String getHash256(String originalString) {
1104
	private String getHash256(String originalString) {
1104
		String hashString = Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString();
1105
		String hashString = Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString();
1105
		LOGGER.info("Hash String {}", hashString);
1106
		LOGGER.info("Hash String {}", hashString);
1106
		return hashString;
1107
		return hashString;
1107
	}
1108
	}
1108
 
1109
 
1109
	@Override
1110
	@Override
1110
	@Cacheable(value="fofoIdUrl", cacheManager="oneDayCacheManager")
1111
	@Cacheable(value = "fofoIdUrl", cacheManager = "oneDayCacheManager")
1111
	public Map<Integer, String> getAllFofoRetailerIdUrlMap() {
1112
	public Map<Integer, String> getAllFofoRetailerIdUrlMap() {
1112
			Map<Integer, String> fofoRetailerUrlMap = new HashMap<>();
1113
		Map<Integer, String> fofoRetailerUrlMap = new HashMap<>();
1113
			List<FofoStore> stores = fofoStoreRepository.selectAll().stream().filter(x->x.isActive()).collect(Collectors.toList());
1114
		List<FofoStore> stores = fofoStoreRepository.selectAll().stream().filter(x -> x.isActive())
-
 
1115
				.collect(Collectors.toList());
1114
			Map<Integer, com.spice.profitmandi.dao.entity.user.User> userMap = userUserRepository.selectByIds(stores.stream().map(x->x.getId()).collect(Collectors.toList()))
1116
		Map<Integer, com.spice.profitmandi.dao.entity.user.User> userMap = userUserRepository
-
 
1117
				.selectByIds(stores.stream().map(x -> x.getId()).collect(Collectors.toList())).stream()
1115
					.stream().collect(Collectors.toMap(x->x.getId(), x->x));
1118
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
1116
			for(FofoStore store : stores) {
1119
		for (FofoStore store : stores) {
1117
				String shortName = store.getCode().replaceAll("\\d+", "");
1120
			String shortName = store.getCode().replaceAll("\\d+", "");
1118
				DistrictMaster districtMaster = districtMasterRepository.selectByShortName(shortName);
1121
			DistrictMaster districtMaster = districtMasterRepository.selectByShortName(shortName);
1119
				com.spice.profitmandi.dao.entity.user.User user = userMap.get(store.getId());
1122
			com.spice.profitmandi.dao.entity.user.User user = userMap.get(store.getId());
1120
				String storeName = user.getName();
1123
			String storeName = user.getName();
1121
				String urlString = 
1124
			String urlString = districtMaster.getStateShortName() + "/"
1122
				districtMaster.getStateShortName() + "/" + Utils.getHyphenatedString(districtMaster.getName()) + "/"
1125
					+ Utils.getHyphenatedString(districtMaster.getName()) + "/"
1123
				+ Utils.getHyphenatedString(store.getCode() + " " + storeName);
1126
					+ Utils.getHyphenatedString(store.getCode() + " " + storeName);
1124
				fofoRetailerUrlMap.put(store.getId(), urlString);
1127
			fofoRetailerUrlMap.put(store.getId(), urlString);
1125
				
1128
 
1126
			}
1129
		}
1127
			return fofoRetailerUrlMap;
1130
		return fofoRetailerUrlMap;
1128
	}
1131
	}
1129
 
1132
 
1130
	@Override
1133
	@Override
1131
	@Cacheable(value="urlFofoId", cacheManager="oneDayCacheManager")
1134
	@Cacheable(value = "urlFofoId", cacheManager = "oneDayCacheManager")
1132
	public Map<String, Integer> getAllUrlFofoRetailerIdMap() {
1135
	public Map<String, Integer> getAllUrlFofoRetailerIdMap() {
1133
		Map<Integer, String> map = this.getAllFofoRetailerIdUrlMap();
1136
		Map<Integer, String> map = this.getAllFofoRetailerIdUrlMap();
1134
		return map.entrySet().stream().collect(Collectors.toMap(x->x.getValue(), x->x.getKey()));
1137
		return map.entrySet().stream().collect(Collectors.toMap(x -> x.getValue(), x -> x.getKey()));
1135
	}
1138
	}
1136
}
1139
}