Subversion Repositories SmartDukaan

Rev

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

Rev 25584 Rev 25590
Line 49... Line 49...
49
import com.spice.profitmandi.common.enumuration.RechargeStatus;
49
import com.spice.profitmandi.common.enumuration.RechargeStatus;
50
import com.spice.profitmandi.common.enumuration.ReporticoProject;
50
import com.spice.profitmandi.common.enumuration.ReporticoProject;
51
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
51
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
52
import com.spice.profitmandi.common.model.CustomRetailer;
52
import com.spice.profitmandi.common.model.CustomRetailer;
53
import com.spice.profitmandi.common.model.GstRate;
53
import com.spice.profitmandi.common.model.GstRate;
-
 
54
import com.spice.profitmandi.common.model.ProfitMandiConstants;
54
import com.spice.profitmandi.common.model.RechargeCredential;
55
import com.spice.profitmandi.common.model.RechargeCredential;
55
import com.spice.profitmandi.common.services.ReporticoService;
56
import com.spice.profitmandi.common.services.ReporticoService;
56
import com.spice.profitmandi.common.util.FileUtil;
57
import com.spice.profitmandi.common.util.FileUtil;
57
import com.spice.profitmandi.common.util.FormattingUtils;
58
import com.spice.profitmandi.common.util.FormattingUtils;
58
import com.spice.profitmandi.common.util.Utils;
59
import com.spice.profitmandi.common.util.Utils;
59
import com.spice.profitmandi.common.util.Utils.Attachment;
60
import com.spice.profitmandi.common.util.Utils.Attachment;
60
import com.spice.profitmandi.dao.Interface.Campaign;
61
import com.spice.profitmandi.dao.Interface.Campaign;
61
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
62
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
-
 
63
import com.spice.profitmandi.dao.entity.auth.AuthUser;
62
import com.spice.profitmandi.dao.entity.catalog.Scheme;
64
import com.spice.profitmandi.dao.entity.catalog.Scheme;
-
 
65
import com.spice.profitmandi.dao.entity.cs.Position;
63
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
66
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
64
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
67
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
65
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaigns;
68
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaigns;
66
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
69
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
67
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
70
import com.spice.profitmandi.dao.entity.dtr.RechargeProvider;
Line 85... Line 88...
85
import com.spice.profitmandi.dao.entity.user.Device;
88
import com.spice.profitmandi.dao.entity.user.Device;
86
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
89
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
87
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
90
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
88
import com.spice.profitmandi.dao.model.SimpleCampaign;
91
import com.spice.profitmandi.dao.model.SimpleCampaign;
89
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
92
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
-
 
93
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
90
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
94
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
91
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
95
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
92
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
96
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
-
 
97
import com.spice.profitmandi.dao.repository.cs.CsService;
-
 
98
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
93
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
99
import com.spice.profitmandi.dao.repository.dtr.DailyRechargeRepository;
94
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
100
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
95
import com.spice.profitmandi.dao.repository.dtr.Mongo;
101
import com.spice.profitmandi.dao.repository.dtr.Mongo;
96
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
102
import com.spice.profitmandi.dao.repository.dtr.NotificationCampaignRepository;
97
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
103
import com.spice.profitmandi.dao.repository.dtr.PushNotificationRepository;
Line 140... Line 146...
140
	@Value("${oxigen.recharge.enquiry.url}")
146
	@Value("${oxigen.recharge.enquiry.url}")
141
	private String oxigenRechargeEnquiryUrl;
147
	private String oxigenRechargeEnquiryUrl;
142
 
148
 
143
	@Autowired
149
	@Autowired
144
	private PartnerTypeChangeService partnerTypeChangeService;
150
	private PartnerTypeChangeService partnerTypeChangeService;
-
 
151
	
-
 
152
	@Autowired
-
 
153
	private AuthRepository authRepository;
145
 
154
 
146
	@Autowired
155
	@Autowired
147
	private PriceDropService priceDropService;
156
	private PriceDropService priceDropService;
-
 
157
	
-
 
158
	@Autowired
-
 
159
	private CsService csService;
148
 
160
 
149
	@Value("${oxigen.recharge.auth.key}")
161
	@Value("${oxigen.recharge.auth.key}")
150
	private String oxigenRechargeAuthKey;
162
	private String oxigenRechargeAuthKey;
151
 
163
 
152
	@Value("${oxigen.recharge.validation.url}")
164
	@Value("${oxigen.recharge.validation.url}")
Line 185... Line 197...
185
	@Autowired
197
	@Autowired
186
	private ReporticoService reporticoService;
198
	private ReporticoService reporticoService;
187
 
199
 
188
	@Autowired
200
	@Autowired
189
	private PartnerInvestmentService partnerInvestmentService;
201
	private PartnerInvestmentService partnerInvestmentService;
-
 
202
	
-
 
203
	@Autowired
-
 
204
	private PositionRepository positionRepository;
190
 
205
 
191
	@Autowired
206
	@Autowired
192
	private FofoOrderItemRepository fofoOrderItemRepository;
207
	private FofoOrderItemRepository fofoOrderItemRepository;
193
 
208
 
194
	@Autowired
209
	@Autowired
Line 720... Line 735...
720
				new ByteArrayResource(baos.toByteArray()));
735
				new ByteArrayResource(baos.toByteArray()));
721
	}
736
	}
722
 
737
 
723
	private Map<String, Set<String>> getStoreGuyMap() {
738
	private Map<String, Set<String>> getStoreGuyMap() {
724
		Map<String, Set<String>> storeGuyMap = new HashMap<>();
739
		Map<String, Set<String>> storeGuyMap = new HashMap<>();
725
		for (Map.Entry<String, List<String>> entry : storeManagerMap.entrySet()) {
740
		List<Position> categoryPositions = positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY);
726
			String storeEmail = entry.getKey();
741
		Map<Integer, Position> positionsMap = categoryPositions.stream().collect(Collectors.toMap(x->x.getId(), x->x));
-
 
742
		
727
			List<String> storeGuys = entry.getValue();
743
		Map<Integer, List<CustomRetailer>> positonPartnerMap = csService.getPositionCustomRetailerMap(categoryPositions);
728
			for (String storeGuy : storeGuys) {
744
		for(Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
729
				if (!storeGuyMap.containsKey(storeGuy)) {
745
			int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
-
 
746
			Set<String> partnerEmails = positionPartnerEntry.getValue().stream().map(x->x.getEmail()).collect(Collectors.toSet());
730
					storeGuyMap.put(storeGuy, new HashSet<>());
747
			AuthUser authUser = authRepository.selectById(authUserId);
731
				}
-
 
732
				storeGuyMap.get(storeGuy).add(storeEmail);
748
			storeGuyMap.put(authUser.getEmailId(), partnerEmails);
733
			}
-
 
734
		}
749
		}
735
		storeGuyMap.remove("");
-
 
736
		return storeGuyMap;
750
		return storeGuyMap;
737
	}
751
	}
738
 
752
 
739
	public void sendAgeingReport(String... sendTo) throws Exception {
753
	public void sendAgeingReport(String... sendTo) throws Exception {
740
 
754
 
Line 1504... Line 1518...
1504
		storeManagerMap.put("KHURANAMOBILE753@GMAIL.COM", Arrays.asList("Sohan", "Ankit", "Mohinder"));
1518
		storeManagerMap.put("KHURANAMOBILE753@GMAIL.COM", Arrays.asList("Sohan", "Ankit", "Mohinder"));
1505
 
1519
 
1506
	}
1520
	}
1507
 
1521
 
1508
	public void grouping() throws Exception {
1522
	public void grouping() throws Exception {
1509
		for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
1523
		/*for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
1510
			/*LOGGER.info("{}, {}", fofoStore.getId(),
1524
			LOGGER.info("{}, {}", fofoStore.getId(),
1511
					partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now().plusDays(1)));*/
1525
					partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now().plusDays(1)));
1512
				UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoStore.getId());
1526
				UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoStore.getId());
1513
				if(userWallet==null) continue;
1527
				if(userWallet==null) continue;
1514
				System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n", fofoStore.getCode(), userWallet.getAmount(), walletService.getWalletAmount(fofoStore.getId()));
1528
				System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n", fofoStore.getCode(), userWallet.getAmount(), walletService.getWalletAmount(fofoStore.getId()));
-
 
1529
		}*/
-
 
1530
		for (Map.Entry<String, Set<String>> storeGuyEntry : getStoreGuyMap().entrySet()) {
-
 
1531
			System.out.println(storeGuyEntry.getKey() + " = " + storeGuyEntry.getValue());
1515
		}
1532
		}
1516
	}
1533
	}
1517
}
1534
}