| Line 60... |
Line 60... |
| 60 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
60 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 64 |
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.PartnerType;
|
| - |
|
66 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTypeChange;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
69 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
| 68 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
70 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 69 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
71 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| Line 79... |
Line 81... |
| 79 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
81 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 80 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
82 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 81 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
83 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 82 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
84 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyPlannedRepository;
|
85 |
import com.spice.profitmandi.dao.repository.fofo.MonthlyPlannedRepository;
|
| - |
|
86 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.PlannedDetailRepository;
|
87 |
import com.spice.profitmandi.dao.repository.fofo.PlannedDetailRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
88 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
89 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
90 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
91 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| Line 199... |
Line 202... |
| 199 |
|
202 |
|
| 200 |
@Autowired
|
203 |
@Autowired
|
| 201 |
RoleManager roleManager;
|
204 |
RoleManager roleManager;
|
| 202 |
|
205 |
|
| 203 |
@Autowired
|
206 |
@Autowired
|
| - |
|
207 |
PartnerTypeChangeRepository partnerTypeChangeRepository;
|
| - |
|
208 |
|
| - |
|
209 |
@Autowired
|
| 204 |
private Mongo mongoClient;
|
210 |
private Mongo mongoClient;
|
| 205 |
|
211 |
|
| 206 |
@Autowired
|
212 |
@Autowired
|
| 207 |
private InventoryService inventoryService;
|
213 |
private InventoryService inventoryService;
|
| 208 |
|
214 |
|
| Line 556... |
Line 562... |
| 556 |
|
562 |
|
| 557 |
int totalPcs = 0;
|
563 |
int totalPcs = 0;
|
| 558 |
|
564 |
|
| 559 |
float totalAmount = 0;
|
565 |
float totalAmount = 0;
|
| 560 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
566 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| 561 |
|
- |
|
| - |
|
567 |
PartnerTypeChange ptc = partnerTypeChangeRepository.selectPartnerType(fofoId, LocalDate.now());
|
| 562 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
568 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAllByPartnerType(ptc.getPartnerType())
|
| 563 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
569 |
.stream().collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 564 |
|
570 |
|
| 565 |
LocalDate planningMonthDate = null;
|
571 |
LocalDate planningMonthDate = null;
|
| 566 |
MonthlyPlanned monthlyPlanned = null;
|
572 |
MonthlyPlanned monthlyPlanned = null;
|
| 567 |
List<Integer> fofoOrderIds = null;
|
573 |
List<Integer> fofoOrderIds = null;
|
| 568 |
LOGGER.info("localDate" + LocalDate.now());
|
574 |
LOGGER.info("localDate" + LocalDate.now());
|
| Line 808... |
Line 814... |
| 808 |
int totalPcs = 0;
|
814 |
int totalPcs = 0;
|
| 809 |
|
815 |
|
| 810 |
float totalAmount = 0;
|
816 |
float totalAmount = 0;
|
| 811 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
817 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| 812 |
|
818 |
|
| - |
|
819 |
PartnerTypeChange ptc = partnerTypeChangeRepository.selectPartnerType(fofoId, LocalDate.now());
|
| 813 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
820 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAllByPartnerType(ptc.getPartnerType())
|
| 814 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
821 |
.stream().collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 815 |
|
822 |
|
| 816 |
MonthlyPlanned monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId,
|
823 |
MonthlyPlanned monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId,
|
| 817 |
planMonthStart.minusMonths(1));
|
824 |
planMonthStart.minusMonths(1));
|
| 818 |
model.addAttribute("planningMonth", planMonthStart.minusMonths(1).getMonth());
|
825 |
model.addAttribute("planningMonth", planMonthStart.minusMonths(1).getMonth());
|
| 819 |
model.addAttribute("previousPlanningMonth", planMonthStart.minusMonths(1).getMonth());
|
826 |
model.addAttribute("previousPlanningMonth", planMonthStart.minusMonths(1).getMonth());
|
| Line 1127... |
Line 1134... |
| 1127 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
1134 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 1128 |
throws ProfitMandiBusinessException {
|
1135 |
throws ProfitMandiBusinessException {
|
| 1129 |
|
1136 |
|
| 1130 |
long size = 0;
|
1137 |
long size = 0;
|
| 1131 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
1138 |
List<FocusedModel> focusedModels = focusedModelRepository.selectAll(offset, limit);
|
| 1132 |
size = focusedModelRepository.selectAllCount();
|
- |
|
| 1133 |
|
1139 |
|
| - |
|
1140 |
size = focusedModelRepository.selectAllCount();
|
| 1134 |
if (!focusedModels.isEmpty()) {
|
1141 |
if (!focusedModels.isEmpty()) {
|
| 1135 |
Map<Integer, Item> itemMap = this.getItemByCatalogId(focusedModels);
|
1142 |
Map<Integer, Item> itemMap = this.getItemByCatalogId(focusedModels);
|
| 1136 |
|
1143 |
|
| 1137 |
model.addAttribute("focusedModels", focusedModels);
|
1144 |
model.addAttribute("focusedModels", focusedModels);
|
| 1138 |
model.addAttribute("itemMap", itemMap);
|
1145 |
model.addAttribute("itemMap", itemMap);
|
| Line 1151... |
Line 1158... |
| 1151 |
model.addAttribute("walletRequest", focusedModels);
|
1158 |
model.addAttribute("walletRequest", focusedModels);
|
| 1152 |
model.addAttribute("size", size);
|
1159 |
model.addAttribute("size", size);
|
| 1153 |
|
1160 |
|
| 1154 |
}
|
1161 |
}
|
| 1155 |
|
1162 |
|
| - |
|
1163 |
model.addAttribute("partnerType", PartnerType.values());
|
| - |
|
1164 |
|
| 1156 |
return "focused_model";
|
1165 |
return "focused_model";
|
| 1157 |
}
|
1166 |
}
|
| 1158 |
|
1167 |
|
| 1159 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
1168 |
@RequestMapping(value = "/getPaginatedFocusedModel", method = RequestMethod.GET)
|
| 1160 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
1169 |
public String getPaginatedFocusedModel(HttpServletRequest request,
|
| Line 1173... |
Line 1182... |
| 1173 |
model.addAttribute("url", "/getPaginatedFocusedModel");
|
1182 |
model.addAttribute("url", "/getPaginatedFocusedModel");
|
| 1174 |
} else {
|
1183 |
} else {
|
| 1175 |
model.addAttribute("focusedModels", focusedModels);
|
1184 |
model.addAttribute("focusedModels", focusedModels);
|
| 1176 |
|
1185 |
|
| 1177 |
}
|
1186 |
}
|
| - |
|
1187 |
|
| - |
|
1188 |
model.addAttribute("partnerType", PartnerType.values());
|
| 1178 |
return "focused-model-paginated";
|
1189 |
return "focused-model-paginated";
|
| 1179 |
}
|
1190 |
}
|
| 1180 |
|
1191 |
|
| 1181 |
private Map<Integer, Item> getItemByCatalogId(List<FocusedModel> focusedModels) {
|
1192 |
private Map<Integer, Item> getItemByCatalogId(List<FocusedModel> focusedModels) {
|
| 1182 |
Map<Integer, Item> itemMap = new HashMap<>();
|
1193 |
Map<Integer, Item> itemMap = new HashMap<>();
|
| Line 1188... |
Line 1199... |
| 1188 |
return itemMap;
|
1199 |
return itemMap;
|
| 1189 |
}
|
1200 |
}
|
| 1190 |
|
1201 |
|
| 1191 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
1202 |
@RequestMapping(value = "/focusedModel", method = RequestMethod.POST)
|
| 1192 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId, @RequestParam int recommended,
|
1203 |
public String focusedModel(HttpServletRequest request, @RequestParam int catalogId, @RequestParam int recommended,
|
| 1193 |
@RequestParam int minimumQty, Model model) throws ProfitMandiBusinessException {
|
1204 |
@RequestParam int minimumQty, @RequestParam PartnerType partnerType, Model model)
|
| - |
|
1205 |
throws ProfitMandiBusinessException {
|
| 1194 |
|
1206 |
|
| 1195 |
FocusedModel fm = new FocusedModel();
|
1207 |
FocusedModel fm = new FocusedModel();
|
| 1196 |
fm.setCatalogId(catalogId);
|
1208 |
fm.setCatalogId(catalogId);
|
| 1197 |
fm.setMinimumQty(minimumQty);
|
1209 |
fm.setMinimumQty(minimumQty);
|
| 1198 |
fm.setRecommendedQty(recommended);
|
1210 |
fm.setRecommendedQty(recommended);
|
| - |
|
1211 |
fm.setPartnerType(partnerType);
|
| 1199 |
fm.setCreatedTimestamp(LocalDateTime.now());
|
1212 |
fm.setCreatedTimestamp(LocalDateTime.now());
|
| 1200 |
focusedModelRepository.persist(fm);
|
1213 |
focusedModelRepository.persist(fm);
|
| 1201 |
return "focused_model";
|
1214 |
return "focused_model";
|
| 1202 |
}
|
1215 |
}
|
| 1203 |
|
1216 |
|
| 1204 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
1217 |
@RequestMapping(value = "/removeItem", method = RequestMethod.DELETE)
|
| 1205 |
public String removeFocusedModelItem(HttpServletRequest request,
|
1218 |
public String removeFocusedModelItem(HttpServletRequest request,
|
| 1206 |
@RequestParam(name = "catalogId", defaultValue = "0") int catalogId, Model model) throws Exception {
|
1219 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 1207 |
|
1220 |
|
| 1208 |
focusedModelRepository.deleteById(catalogId);
|
1221 |
focusedModelRepository.deleteById(id);
|
| 1209 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1222 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1210 |
return "response";
|
1223 |
return "response";
|
| 1211 |
}
|
1224 |
}
|
| 1212 |
|
1225 |
|
| 1213 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
1226 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
| Line 1338... |
Line 1351... |
| 1338 |
|
1351 |
|
| 1339 |
int totalPcs = 0;
|
1352 |
int totalPcs = 0;
|
| 1340 |
|
1353 |
|
| 1341 |
float totalAmount = 0;
|
1354 |
float totalAmount = 0;
|
| 1342 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
1355 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| - |
|
1356 |
PartnerTypeChange ptc = partnerTypeChangeRepository.selectPartnerType(fofoId, LocalDate.now());
|
| - |
|
1357 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAllByPartnerType(ptc.getPartnerType())
|
| - |
|
1358 |
.stream().collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 1343 |
|
1359 |
|
| 1344 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
- |
|
| 1345 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
- |
|
| 1346 |
|
1360 |
|
| 1347 |
LocalDate currentMonthDate = LocalDate.now();
|
1361 |
LocalDate currentMonthDate = LocalDate.now();
|
| 1348 |
MonthlyPlanned monthlyPlanned = null;
|
1362 |
MonthlyPlanned monthlyPlanned = null;
|
| 1349 |
List<Integer> fofoOrderIds = null;
|
1363 |
List<Integer> fofoOrderIds = null;
|
| 1350 |
LOGGER.info("localDate" + LocalDate.now());
|
1364 |
LOGGER.info("localDate" + LocalDate.now());
|