Subversion Repositories SmartDukaan

Rev

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

Rev 26528 Rev 26533
Line 11... Line 11...
11
import java.util.function.Function;
11
import java.util.function.Function;
12
import java.util.stream.Collectors;
12
import java.util.stream.Collectors;
13
 
13
 
14
import org.apache.logging.log4j.LogManager;
14
import org.apache.logging.log4j.LogManager;
15
import org.apache.logging.log4j.Logger;
15
import org.apache.logging.log4j.Logger;
-
 
16
import org.hibernate.annotations.Cache;
16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.beans.factory.annotation.Qualifier;
18
import org.springframework.beans.factory.annotation.Qualifier;
18
import org.springframework.cache.annotation.Cacheable;
19
import org.springframework.cache.annotation.Cacheable;
19
import org.springframework.stereotype.Component;
20
import org.springframework.stereotype.Component;
20
 
21
 
Line 1096... Line 1097...
1096
		businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
1097
		businessAddress.setRetaierId(loginRequestResponseModel.getUserId());
1097
		addressRepository.persist(businessAddress);
1098
		addressRepository.persist(businessAddress);
1098
	}
1099
	}
1099
	
1100
	
1100
	private String getHash256(String originalString) {
1101
	private String getHash256(String originalString) {
1101
		return Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString();
1102
		String hashString = Hashing.sha256().hashString(originalString, StandardCharsets.UTF_8).toString();
-
 
1103
		LOGGER.info("Hash String {}", hashString);
-
 
1104
		return hashString;
-
 
1105
	}
-
 
1106
 
-
 
1107
	@Override
-
 
1108
	@Cacheable(value="fofoIdUrl", cacheManager="oneDayCacheManager")
-
 
1109
	public Map<Integer, String> getAllFofoRetailerIdUrlMap() {
-
 
1110
			Map<Integer, String> fofoRetailerUrlMap = new HashMap<>();
-
 
1111
			List<FofoStore> stores = fofoStoreRepository.selectAll().stream().filter(x->x.isActive()).collect(Collectors.toList());
-
 
1112
			Map<Integer, com.spice.profitmandi.dao.entity.user.User> userMap = userUserRepository.selectByIds(stores.stream().map(x->x.getId()).collect(Collectors.toList()))
-
 
1113
					.stream().collect(Collectors.toMap(x->x.getId(), x->x));
-
 
1114
			for(FofoStore store : stores) {
-
 
1115
				String shortName = store.getCode().replaceAll("\\d+", "");
-
 
1116
				DistrictMaster districtMaster = districtMasterRepository.selectByShortName(shortName);
-
 
1117
				com.spice.profitmandi.dao.entity.user.User user = userMap.get(store.getId());
-
 
1118
				String storeName = user.getName();
-
 
1119
				String urlString = 
-
 
1120
				districtMaster.getStateShortName() + "/" + Utils.getHyphenatedString(districtMaster.getName()) + "/"
-
 
1121
				+ Utils.getHyphenatedString(storeName);
-
 
1122
				fofoRetailerUrlMap.put(store.getId(), urlString);
-
 
1123
				
-
 
1124
			}
-
 
1125
			return fofoRetailerUrlMap;
-
 
1126
	}
-
 
1127
 
-
 
1128
	@Override
-
 
1129
	@Cacheable(value="urlFofoId", cacheManager="oneDayCacheManager")
-
 
1130
	public Map<String, Integer> getAllUrlFofoRetailerIdMap() {
-
 
1131
		Map<Integer, String> map = this.getAllFofoRetailerIdUrlMap();
-
 
1132
		return map.entrySet().stream().collect(Collectors.toMap(x->x.getValue(), x->x.getKey()));
1102
	}
1133
	}
1103
}
1134
}