| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.Serializable;
|
- |
|
| 4 |
import java.time.LocalDate;
|
3 |
import java.time.LocalDate;
|
| 5 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 6 |
import java.time.LocalTime;
|
5 |
import java.time.LocalTime;
|
| 7 |
import java.util.ArrayList;
|
6 |
import java.util.ArrayList;
|
| 8 |
import java.util.Arrays;
|
7 |
import java.util.Arrays;
|
| Line 38... |
Line 37... |
| 38 |
import org.springframework.web.bind.annotation.RequestMapping;
|
37 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 39 |
import org.springframework.web.bind.annotation.RequestMethod;
|
38 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 40 |
import org.springframework.web.bind.annotation.RequestParam;
|
39 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 41 |
|
40 |
|
| 42 |
import com.mongodb.DBObject;
|
41 |
import com.mongodb.DBObject;
|
| 43 |
import com.mysql.fabric.xmlrpc.base.Array;
|
- |
|
| 44 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
42 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 45 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
43 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 46 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
44 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 47 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
45 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
| 48 |
import com.spice.profitmandi.common.model.CatalogIdAggregateValue;
|
46 |
import com.spice.profitmandi.common.model.CatalogIdAggregateValue;
|
| 49 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
47 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
| 50 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
48 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 51 |
import com.spice.profitmandi.common.model.SuggestedPoIdModel;
|
- |
|
| 52 |
import com.spice.profitmandi.common.model.SuggestedPoModel;
|
- |
|
| 53 |
import com.spice.profitmandi.common.model.NotifyOrderModel;
|
- |
|
| 54 |
import com.spice.profitmandi.common.model.PlannedModel;
|
49 |
import com.spice.profitmandi.common.model.PlannedModel;
|
| 55 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
50 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 56 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
51 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
| - |
|
52 |
import com.spice.profitmandi.common.model.SuggestedPoIdModel;
|
| - |
|
53 |
import com.spice.profitmandi.common.model.SuggestedPoModel;
|
| 57 |
import com.spice.profitmandi.common.util.FileUtil;
|
54 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 58 |
import com.spice.profitmandi.common.util.Utils;
|
55 |
import com.spice.profitmandi.common.util.Utils;
|
| 59 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
56 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 60 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
57 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 61 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
58 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| Line 63... |
Line 60... |
| 63 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
60 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
| - |
|
65 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
| 70 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
- |
|
| 71 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
68 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 72 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
69 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 73 |
import com.spice.profitmandi.dao.entity.user.User;
|
70 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 74 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
71 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 75 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
72 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
| Line 81... |
Line 78... |
| 81 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
78 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 82 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
79 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
80 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
81 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyPlannedRepository;
|
82 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyPlannedRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
- |
|
| 87 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
- |
|
| 88 |
import com.spice.profitmandi.dao.repository.fofo.PlannedDetailRepository;
|
83 |
import com.spice.profitmandi.dao.repository.fofo.PlannedDetailRepository;
|
| 89 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
84 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| - |
|
85 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
| - |
|
86 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
| 90 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
87 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 91 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
88 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 92 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
89 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 93 |
import com.spice.profitmandi.service.NotificationService;
|
90 |
import com.spice.profitmandi.service.NotificationService;
|
| 94 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
91 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| Line 134... |
Line 131... |
| 134 |
private final List<OrderStatus> partnerPendingOrderList = Arrays.asList(OrderStatus.ACCEPTED,
|
131 |
private final List<OrderStatus> partnerPendingOrderList = Arrays.asList(OrderStatus.ACCEPTED,
|
| 135 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
132 |
OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.BILLED, OrderStatus.SHIPPED_FROM_WH,
|
| 136 |
OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
133 |
OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.SHIPPED_TO_LOGST,
|
| 137 |
OrderStatus.REACHED_DESTINATION_CITY);
|
134 |
OrderStatus.REACHED_DESTINATION_CITY);
|
| 138 |
|
135 |
|
| - |
|
136 |
private static final int PLANNING_OPEN_DAY = 20;
|
| - |
|
137 |
private static final int PLANNING_CLOSE_DAY = 1;
|
| - |
|
138 |
|
| 139 |
@Autowired
|
139 |
@Autowired
|
| 140 |
WalletService walletService;
|
140 |
WalletService walletService;
|
| 141 |
|
141 |
|
| 142 |
@Autowired
|
142 |
@Autowired
|
| 143 |
private JavaMailSender googleMailSender;
|
143 |
private JavaMailSender googleMailSender;
|
| Line 218... |
Line 218... |
| 218 |
private SuggestedPoDetailRepository monthlyPoDetailRepository;
|
218 |
private SuggestedPoDetailRepository monthlyPoDetailRepository;
|
| 219 |
|
219 |
|
| 220 |
@Autowired
|
220 |
@Autowired
|
| 221 |
private NotificationService notificationService;
|
221 |
private NotificationService notificationService;
|
| 222 |
|
222 |
|
| 223 |
/*
|
- |
|
| 224 |
* @RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
- |
|
| 225 |
* public String saveOpenIndent(HttpServletRequest request, Model model,
|
- |
|
| 226 |
*
|
- |
|
| 227 |
* @RequestBody List<StockAllocationModel>
|
- |
|
| 228 |
* stockAllocationModelList, @RequestParam int fofoId,
|
- |
|
| 229 |
*
|
- |
|
| 230 |
* @RequestParam(defaultValue = "TEN_LAC") CounterSize counterSize) throws
|
- |
|
| 231 |
* Exception { LoginDetails loginDetails =
|
- |
|
| 232 |
* cookiesProcessor.getCookiesObject(request); boolean response = false; if
|
- |
|
| 233 |
* (fofoId > 0) { FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
- |
|
| 234 |
* stockAllocationModelList.forEach(x -> { x.setFofoId(fofoId);
|
- |
|
| 235 |
* x.setCounterSize(fs.getCounterSize()); }); } else {
|
- |
|
| 236 |
* stockAllocationModelList.forEach(x -> { x.setFofoId(fofoId);
|
- |
|
| 237 |
* x.setCounterSize(counterSize); }); } if
|
- |
|
| 238 |
* (roleManager.isAdmin(loginDetails.getRoleIds())) { response =
|
- |
|
| 239 |
* stockAllocationService.addToAllocation(stockAllocationModelList);
|
- |
|
| 240 |
* model.addAttribute("response",
|
- |
|
| 241 |
* mvcResponseSender.createResponseString(response)); } return "response"; }
|
- |
|
| 242 |
*/
|
- |
|
| 243 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
223 |
@RequestMapping(value = "/open-indent/save", method = RequestMethod.POST)
|
| 244 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
224 |
public String saveOpenIndent(HttpServletRequest request, Model model, @RequestParam int catalogId,
|
| 245 |
@RequestParam int itemQty) throws Exception {
|
225 |
@RequestParam int itemQty) throws Exception {
|
| 246 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
226 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 247 |
LocalDate currentMonthDate = LocalDate.now();
|
227 |
LocalDate currentMonthDate = LocalDate.now();
|
| 248 |
MonthlyPlanned monthlyPlanned = null;
|
228 |
MonthlyPlanned monthlyPlanned = null;
|
| 249 |
|
229 |
|
| 250 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
230 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 251 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
- |
|
| 252 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
231 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 253 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(loginDetails.getFofoId(),
|
232 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(loginDetails.getFofoId(),
|
| 254 |
currentMonthDate);
|
233 |
currentMonthDate);
|
| 255 |
|
234 |
|
| 256 |
saveMonthlyPlanned(monthlyPlanned, loginDetails.getFofoId(), currentMonthDate, catalogId, itemQty);
|
235 |
saveMonthlyPlanned(monthlyPlanned, loginDetails.getFofoId(), currentMonthDate, catalogId, itemQty);
|
| 257 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
- |
|
| 258 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
- |
|
| 259 |
// freezed code;
|
- |
|
| 260 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
- |
|
| 261 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 262 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(loginDetails.getFofoId(),
|
- |
|
| 263 |
currentMonthDate);
|
- |
|
| 264 |
|
- |
|
| 265 |
saveMonthlyPlanned(monthlyPlanned, loginDetails.getFofoId(), currentMonthDate, catalogId, itemQty);
|
- |
|
| 266 |
}
|
236 |
}
|
| 267 |
|
- |
|
| 268 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
- |
|
| 269 |
|
- |
|
| 270 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
237 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 271 |
|
- |
|
| 272 |
return "response";
|
238 |
return "response";
|
| 273 |
}
|
239 |
}
|
| 274 |
|
240 |
|
| 275 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
241 |
private void saveMonthlyPlanned(MonthlyPlanned monthlyPlanned, int fofoId, LocalDate currentMonthDate,
|
| 276 |
int catalogId, int itemQty) {
|
242 |
int catalogId, int itemQty) {
|
| Line 317... |
Line 283... |
| 317 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
283 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 318 |
fofoId = loginDetails.getFofoId();
|
284 |
fofoId = loginDetails.getFofoId();
|
| 319 |
}
|
285 |
}
|
| 320 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
286 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 321 |
|
287 |
|
| 322 |
LocalDate currentMonthDate = LocalDate.now();
|
288 |
LocalDate currentDate = LocalDate.now();
|
| - |
|
289 |
LocalDate planningMonthDate = null;
|
| 323 |
MonthlyPlanned monthlyPlanned = null;
|
290 |
MonthlyPlanned monthlyPlanned = null;
|
| 324 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
291 |
if (currentDate.isAfter(currentDate.withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 325 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
- |
|
| 326 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
292 |
planningMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 327 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
- |
|
| 328 |
|
- |
|
| 329 |
confirmMonthlyPlanned(monthlyPlanned, customRetailer, fofoId);
|
- |
|
| 330 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
- |
|
| 331 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
- |
|
| 332 |
// freezed code;
|
- |
|
| 333 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
- |
|
| 334 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 335 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
293 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, planningMonthDate);
|
| 336 |
|
294 |
|
| 337 |
confirmMonthlyPlanned(monthlyPlanned, customRetailer, fofoId);
|
295 |
confirmMonthlyPlanned(monthlyPlanned, customRetailer, fofoId);
|
| 338 |
}
|
296 |
}
|
| 339 |
|
- |
|
| 340 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
297 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 341 |
|
298 |
|
| 342 |
return "response";
|
299 |
return "response";
|
| 343 |
}
|
300 |
}
|
| 344 |
|
301 |
|
| Line 595... |
Line 552... |
| 595 |
|
552 |
|
| 596 |
LocalDate currentMonthDate = LocalDate.now();
|
553 |
LocalDate currentMonthDate = LocalDate.now();
|
| 597 |
MonthlyPlanned monthlyPlanned = null;
|
554 |
MonthlyPlanned monthlyPlanned = null;
|
| 598 |
List<Integer> fofoOrderIds = null;
|
555 |
List<Integer> fofoOrderIds = null;
|
| 599 |
LOGGER.info("localDate" + LocalDate.now());
|
556 |
LOGGER.info("localDate" + LocalDate.now());
|
| 600 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
557 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 601 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
- |
|
| 602 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
558 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 603 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
559 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 604 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
560 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 605 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
561 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 606 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
562 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 607 |
.collect(Collectors.toList());
|
563 |
.collect(Collectors.toList());
|
| 608 |
|
564 |
|
| 609 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
565 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 610 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
566 |
} else {
|
| 611 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
- |
|
| 612 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
567 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| 613 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
568 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 614 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
569 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 615 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
570 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| 616 |
model.addAttribute("mtd", true);
|
571 |
model.addAttribute("mtd", true);
|
| 617 |
model.addAttribute("freezed", true);
|
572 |
model.addAttribute("freezed", true);
|
| 618 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
573 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 619 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
574 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 620 |
.collect(Collectors.toList());
|
575 |
.collect(Collectors.toList());
|
| 621 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
576 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 622 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
- |
|
| 623 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 624 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
- |
|
| 625 |
LOGGER.info("monthlyPlanned3" + monthlyPlanned);
|
- |
|
| 626 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
- |
|
| 627 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
- |
|
| 628 |
.collect(Collectors.toList());
|
- |
|
| 629 |
model.addAttribute("planningMonth", LocalDate.now().getMonth());
|
- |
|
| 630 |
}
|
577 |
}
|
| 631 |
|
578 |
|
| 632 |
Map<Integer, Integer> plannedDetailMap = null;
|
579 |
Map<Integer, Integer> plannedDetailMap = null;
|
| 633 |
if (monthlyPlanned != null) {
|
580 |
if (monthlyPlanned != null) {
|
| 634 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
581 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
| 635 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
582 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| Line 1385... |
Line 1332... |
| 1385 |
|
1332 |
|
| 1386 |
LocalDate currentMonthDate = LocalDate.now();
|
1333 |
LocalDate currentMonthDate = LocalDate.now();
|
| 1387 |
MonthlyPlanned monthlyPlanned = null;
|
1334 |
MonthlyPlanned monthlyPlanned = null;
|
| 1388 |
List<Integer> fofoOrderIds = null;
|
1335 |
List<Integer> fofoOrderIds = null;
|
| 1389 |
LOGGER.info("localDate" + LocalDate.now());
|
1336 |
LOGGER.info("localDate" + LocalDate.now());
|
| 1390 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
1337 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(PLANNING_OPEN_DAY))) {
|
| 1391 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
- |
|
| 1392 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
1338 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 1393 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1339 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1394 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
1340 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| 1395 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1341 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1396 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
1342 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 1397 |
.collect(Collectors.toList());
|
1343 |
.collect(Collectors.toList());
|
| 1398 |
|
1344 |
|
| 1399 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
1345 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 1400 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
1346 |
} else {
|
| 1401 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
- |
|
| 1402 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
1347 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| 1403 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
1348 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 1404 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
1349 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 1405 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
1350 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| 1406 |
model.addAttribute("mtd", true);
|
1351 |
model.addAttribute("mtd", true);
|
| 1407 |
model.addAttribute("freezed", true);
|
1352 |
model.addAttribute("freezed", true);
|
| 1408 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
1353 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| 1409 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
1354 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| 1410 |
.collect(Collectors.toList());
|
1355 |
.collect(Collectors.toList());
|
| 1411 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
1356 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 1412 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
- |
|
| 1413 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
- |
|
| 1414 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
- |
|
| 1415 |
LOGGER.info("monthlyPlanned3" + monthlyPlanned);
|
- |
|
| 1416 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
- |
|
| 1417 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
- |
|
| 1418 |
.collect(Collectors.toList());
|
- |
|
| 1419 |
model.addAttribute("planningMonth", LocalDate.now().getMonth());
|
- |
|
| 1420 |
}
|
1357 |
}
|
| 1421 |
|
1358 |
|
| 1422 |
Map<Integer, Integer> plannedDetailMap = null;
|
1359 |
Map<Integer, Integer> plannedDetailMap = null;
|
| 1423 |
if (monthlyPlanned != null) {
|
1360 |
if (monthlyPlanned != null) {
|
| 1424 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
1361 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
| Line 1590... |
Line 1527... |
| 1590 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
1527 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 1591 |
sendNotificationModel.setCampaignName("Alert");
|
1528 |
sendNotificationModel.setCampaignName("Alert");
|
| 1592 |
sendNotificationModel.setMessage("Suggested Po");
|
1529 |
sendNotificationModel.setMessage("Suggested Po");
|
| 1593 |
sendNotificationModel.setType("url");
|
1530 |
sendNotificationModel.setType("url");
|
| 1594 |
sendNotificationModel.setTitle("Alert");
|
1531 |
sendNotificationModel.setTitle("Alert");
|
| 1595 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/partnerPo/"+mp.getId());
|
1532 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/partnerPo/" + mp.getId());
|
| 1596 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
1533 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 1597 |
sendNotificationModel.setMessageType(MessageType.notification);
|
1534 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 1598 |
int userId = userAccountRepository.selectUserIdByRetailerId(monthlyPoModel.getFofoId());
|
1535 |
int userId = userAccountRepository.selectUserIdByRetailerId(monthlyPoModel.getFofoId());
|
| 1599 |
|
1536 |
|
| 1600 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
1537 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|