| Line 37... |
Line 37... |
| 37 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
37 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 38 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
38 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
39 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| 40 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
40 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 41 |
import com.spice.profitmandi.dao.repository.webRepository.NavBarRepository;
|
41 |
import com.spice.profitmandi.dao.repository.webRepository.NavBarRepository;
|
| - |
|
42 |
import com.spice.profitmandi.dao.service.BidService;
|
| 42 |
import com.spice.profitmandi.service.CustomerService;
|
43 |
import com.spice.profitmandi.service.CustomerService;
|
| 43 |
import com.spice.profitmandi.service.EmailService;
|
44 |
import com.spice.profitmandi.service.EmailService;
|
| 44 |
import com.spice.profitmandi.service.NotificationService;
|
45 |
import com.spice.profitmandi.service.NotificationService;
|
| 45 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
46 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 46 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
47 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
| Line 222... |
Line 223... |
| 222 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
223 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
| 223 |
|
224 |
|
| 224 |
@Autowired
|
225 |
@Autowired
|
| 225 |
NavBarRepository navBarRepository;
|
226 |
NavBarRepository navBarRepository;
|
| 226 |
|
227 |
|
| 227 |
|
- |
|
| 228 |
@Autowired
|
228 |
@Autowired
|
| 229 |
BidRepository bidRepository;
|
229 |
BidRepository bidRepository;
|
| 230 |
|
230 |
|
| - |
|
231 |
@Autowired
|
| - |
|
232 |
BidService bidService;
|
| - |
|
233 |
|
| 231 |
List<String> filterableParams = Arrays.asList("brand");
|
234 |
List<String> filterableParams = Arrays.asList("brand");
|
| 232 |
|
235 |
|
| 233 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
236 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 234 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
237 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 235 |
@ApiOperation(value = "Get unit deal object")
|
238 |
@ApiOperation(value = "Get unit deal object")
|
| Line 1310... |
Line 1313... |
| 1310 |
liquidationDetail.setSuperCatalogs(jsonObj.getString("superCatalogVariants_s"));
|
1313 |
liquidationDetail.setSuperCatalogs(jsonObj.getString("superCatalogVariants_s"));
|
| 1311 |
liquidationDetail.setStartDate(liquidation.getStartDate());
|
1314 |
liquidationDetail.setStartDate(liquidation.getStartDate());
|
| 1312 |
liquidationDetail.setEndDate(liquidation.getEndDate());
|
1315 |
liquidationDetail.setEndDate(liquidation.getEndDate());
|
| 1313 |
liquidationDetail.setSellingPrice(liquidation.getPrice());
|
1316 |
liquidationDetail.setSellingPrice(liquidation.getPrice());
|
| 1314 |
liquidationDetail.setAvailableQuantity(liquidation.getQuantity());
|
1317 |
liquidationDetail.setAvailableQuantity(liquidation.getQuantity());
|
| - |
|
1318 |
liquidationDetail.setIncrementStep(liquidation.getIncrementStep());
|
| 1315 |
liquidationDetail.setBidList(bidList);
|
1319 |
liquidationDetail.setBidList(bidList);
|
| 1316 |
resultList.add(liquidationDetail);
|
1320 |
resultList.add(liquidationDetail);
|
| 1317 |
}
|
1321 |
}
|
| 1318 |
}
|
1322 |
}
|
| 1319 |
}
|
1323 |
}
|
| Line 1325... |
Line 1329... |
| 1325 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
1329 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 1326 |
public ResponseEntity<?> saveBidding(HttpServletRequest request, @RequestBody BiddingModel biddingModel) throws Exception {
|
1330 |
public ResponseEntity<?> saveBidding(HttpServletRequest request, @RequestBody BiddingModel biddingModel) throws Exception {
|
| 1327 |
LocalDateTime now = LocalDateTime.now();
|
1331 |
LocalDateTime now = LocalDateTime.now();
|
| 1328 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(biddingModel.getLiquidationId());
|
1332 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(biddingModel.getLiquidationId());
|
| 1329 |
LocalDateTime endDateTime = LocalDateTime.of(liquidation.getEndDate().toLocalDate(), LocalTime.of(ProfitMandiConstants.BID_END_HOUR, ProfitMandiConstants.BID_END_MIN));
|
1333 |
LocalDateTime endDateTime = LocalDateTime.of(liquidation.getEndDate().toLocalDate(), LocalTime.of(ProfitMandiConstants.BID_END_HOUR, ProfitMandiConstants.BID_END_MIN));
|
| - |
|
1334 |
List<Bid> biddings = bidRepository.selectBidByLiquidationId(biddingModel.getLiquidationId());
|
| 1330 |
if (now.isAfter(endDateTime)) {
|
1335 |
if (now.isAfter(endDateTime)) {
|
| 1331 |
return responseSender.badRequest("false");
|
1336 |
return responseSender.badRequest("Bid on this product has been closed");
|
| 1332 |
}
|
1337 |
}
|
| 1333 |
Bid bid = null;
|
1338 |
Bid bid = null;
|
| 1334 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
1339 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 1335 |
if (biddingModel.getId() != null && biddingModel.getId() > 0) {
|
1340 |
if (biddingModel.getId() != null && biddingModel.getId() > 0) {
|
| 1336 |
bid = bidRepository.selectById(biddingModel.getId());
|
1341 |
bid = bidRepository.selectById(biddingModel.getId());
|
| 1337 |
if (bid == null) {
|
1342 |
if (bid == null) {
|
| 1338 |
throw new Exception("Bidding record not found with ID: " + biddingModel.getId());
|
1343 |
return responseSender.badRequest("Bidding record not found with ID: " + biddingModel.getId());
|
| 1339 |
}
|
1344 |
}
|
| 1340 |
} else {
|
1345 |
} else {
|
| 1341 |
bid = new Bid();
|
1346 |
bid = new Bid();
|
| 1342 |
}
|
1347 |
}
|
| 1343 |
logger.info("biddingModel {}: ",biddingModel);
|
1348 |
logger.info("biddingModel {}: ",biddingModel);
|
| Line 1346... |
Line 1351... |
| 1346 |
bid.setFofoId(userInfo.getRetailerId());
|
1351 |
bid.setFofoId(userInfo.getRetailerId());
|
| 1347 |
bid.setItemName(biddingModel.getItemName());
|
1352 |
bid.setItemName(biddingModel.getItemName());
|
| 1348 |
bid.setQuantity(biddingModel.getBidQty());
|
1353 |
bid.setQuantity(biddingModel.getBidQty());
|
| 1349 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.PENDING);
|
1354 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.PENDING);
|
| 1350 |
bid.setCreatedAt(LocalDateTime.now());
|
1355 |
bid.setCreatedAt(LocalDateTime.now());
|
| - |
|
1356 |
if (biddings.size() > 1) {
|
| - |
|
1357 |
for (Bid bidding : biddings) {
|
| - |
|
1358 |
if (!(bid.getFofoId().equals(bidding.getFofoId()))) bidService.notifyPartner(bid.getFofoId(), bidding, ProfitMandiConstants.BID_ENUM.UPDATE);
|
| - |
|
1359 |
}
|
| - |
|
1360 |
}
|
| 1351 |
if (biddingModel.getId() == null) {
|
1361 |
if (biddingModel.getId() == null) {
|
| 1352 |
bidRepository.persist(bid);
|
1362 |
bidRepository.persist(bid);
|
| 1353 |
}
|
1363 |
}
|
| - |
|
1364 |
bidService.notifyPartner(bid.getFofoId(), bid, bid.getStatus());
|
| 1354 |
return responseSender.ok("true");
|
1365 |
return responseSender.ok("Bid placed successfully!");
|
| 1355 |
}
|
1366 |
}
|
| 1356 |
|
1367 |
|
| 1357 |
|
1368 |
|
| 1358 |
}
|
1369 |
}
|
| 1359 |
|
1370 |
|