Subversion Repositories SmartDukaan

Rev

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

Rev 28582 Rev 29515
Line 62... Line 62...
62
import com.spice.profitmandi.common.util.Utils;
62
import com.spice.profitmandi.common.util.Utils;
63
import com.spice.profitmandi.common.web.client.RestClient;
63
import com.spice.profitmandi.common.web.client.RestClient;
64
import com.spice.profitmandi.common.web.util.ResponseSender;
64
import com.spice.profitmandi.common.web.util.ResponseSender;
65
import com.spice.profitmandi.dao.entity.catalog.Item;
65
import com.spice.profitmandi.dao.entity.catalog.Item;
66
import com.spice.profitmandi.dao.entity.catalog.TagListing;
66
import com.spice.profitmandi.dao.entity.catalog.TagListing;
-
 
67
import com.spice.profitmandi.dao.entity.dtr.ScratchOffer;
67
import com.spice.profitmandi.dao.entity.dtr.User;
68
import com.spice.profitmandi.dao.entity.dtr.User;
68
import com.spice.profitmandi.dao.entity.dtr.WebListing;
69
import com.spice.profitmandi.dao.entity.dtr.WebListing;
69
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
70
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
70
import com.spice.profitmandi.dao.entity.fofo.Customer;
71
import com.spice.profitmandi.dao.entity.fofo.Customer;
71
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
72
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
Line 74... Line 75...
74
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
75
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
75
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
76
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
76
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
77
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
77
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
78
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
78
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
79
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
-
 
80
import com.spice.profitmandi.dao.enumuration.inventory.ScratchedGift;
79
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
81
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
80
import com.spice.profitmandi.dao.model.AddCartRequest;
82
import com.spice.profitmandi.dao.model.AddCartRequest;
81
import com.spice.profitmandi.dao.model.CartItem;
83
import com.spice.profitmandi.dao.model.CartItem;
82
import com.spice.profitmandi.dao.model.CartItemResponseModel;
84
import com.spice.profitmandi.dao.model.CartItemResponseModel;
83
import com.spice.profitmandi.dao.model.CartResponse;
85
import com.spice.profitmandi.dao.model.CartResponse;
84
import com.spice.profitmandi.dao.model.CustomerOrderDetail;
86
import com.spice.profitmandi.dao.model.CustomerOrderDetail;
-
 
87
import com.spice.profitmandi.dao.model.DateRangeModel;
85
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
88
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
86
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
89
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
87
import com.spice.profitmandi.dao.repository.cs.CsService;
90
import com.spice.profitmandi.dao.repository.cs.CsService;
88
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
91
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
-
 
92
import com.spice.profitmandi.dao.repository.dtr.ScratchOfferRepository;
89
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
93
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
90
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
94
import com.spice.profitmandi.dao.repository.dtr.WebListingRepository;
91
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
95
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
92
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
96
import com.spice.profitmandi.dao.repository.dtr.WebProductListingRepository;
93
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
97
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
Line 239... Line 243...
239
	@Autowired
243
	@Autowired
240
	private FofoOrderItemRepository fofoOrderItemRepository;
244
	private FofoOrderItemRepository fofoOrderItemRepository;
241
 
245
 
242
	@Autowired
246
	@Autowired
243
	private OrderService orderService;
247
	private OrderService orderService;
-
 
248
 
-
 
249
	@Autowired
-
 
250
	private ScratchOfferRepository scratchOfferRepository;
244
	private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
251
	private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
245
 
252
 
246
	List<String> filterableParams = Arrays.asList("brand");
253
	List<String> filterableParams = Arrays.asList("brand");
247
 
254
 
248
	@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
255
	@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
Line 1112... Line 1119...
1112
		}
1119
		}
1113
 
1120
 
1114
		return responseSender.ok(true);
1121
		return responseSender.ok(true);
1115
 
1122
 
1116
	}
1123
	}
-
 
1124
 
-
 
1125
	@RequestMapping(value = "/store/checkEligibilityStoreOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
1126
	public ResponseEntity<?> checkEligibilityStoreOffers(HttpServletRequest request, @RequestParam(value = "id") int id)
-
 
1127
			throws Exception {
-
 
1128
 
-
 
1129
		boolean eligibility = false;
-
 
1130
 
-
 
1131
		List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerId(id);
-
 
1132
 
-
 
1133
		if (!scratchOffers.isEmpty()) {
-
 
1134
			eligibility = true;
-
 
1135
 
-
 
1136
		} else {
-
 
1137
			eligibility = false;
-
 
1138
		}
-
 
1139
 
-
 
1140
		return responseSender.ok(eligibility);
-
 
1141
	}
-
 
1142
 
-
 
1143
	@RequestMapping(value = "/store/ScratchOffers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
1144
	public ResponseEntity<?> scratchOffers(HttpServletRequest request, @RequestParam(value = "id") int id)
-
 
1145
			throws Exception {
-
 
1146
 
-
 
1147
		List<ScratchOffer> scratchOffers = scratchOfferRepository.selectBycCustomerId(id);
-
 
1148
		for (ScratchOffer so : scratchOffers) {
-
 
1149
 
-
 
1150
			if (so.getOfferName() != null) {
-
 
1151
				if (so.getOfferName().equals(ScratchedGift.OTSR)) {
-
 
1152
					so.setExpiredTimestamp(so.getCreatedTimestamp().plusDays(1));
-
 
1153
				} else if (so.getOfferName().equals(ScratchedGift.DMTL)) {
-
 
1154
					so.setExpiredTimestamp(so.getCreatedTimestamp().plusDays(1));
-
 
1155
				}
-
 
1156
			}
-
 
1157
			if (LocalDateTime.now().isAfter(so.getUnlockedAt())) {
-
 
1158
				so.setUnlocked(true);
-
 
1159
			} else {
-
 
1160
				so.setUnlocked(false);
-
 
1161
			}
-
 
1162
		}
-
 
1163
 
-
 
1164
		return responseSender.ok(scratchOffers);
-
 
1165
	}
-
 
1166
 
-
 
1167
	@RequestMapping(value = "/store/ScratchedOffer", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
1168
	public ResponseEntity<?> scratchedOffer(HttpServletRequest request, @RequestParam(value = "id") int id)
-
 
1169
			throws Exception {
-
 
1170
 
-
 
1171
		ScratchOffer scratchOffer = scratchOfferRepository.selectById(id);
-
 
1172
		scratchOffer.setScratched(true);
-
 
1173
		scratchOffer.setScracthedAt(LocalDateTime.now());
-
 
1174
 
-
 
1175
		return responseSender.ok(true);
-
 
1176
	}
-
 
1177
 
1117
}
1178
}
1118
1179