| Line 45... |
Line 45... |
| 45 |
import com.spice.profitmandi.dao.service.AffiliateService;
|
45 |
import com.spice.profitmandi.dao.service.AffiliateService;
|
| 46 |
import com.spice.profitmandi.dao.service.BidService;
|
46 |
import com.spice.profitmandi.dao.service.BidService;
|
| 47 |
import com.spice.profitmandi.dao.service.OTPResponse;
|
47 |
import com.spice.profitmandi.dao.service.OTPResponse;
|
| 48 |
import com.spice.profitmandi.service.CustomerService;
|
48 |
import com.spice.profitmandi.service.CustomerService;
|
| 49 |
import com.spice.profitmandi.service.EmailService;
|
49 |
import com.spice.profitmandi.service.EmailService;
|
| - |
|
50 |
import com.spice.profitmandi.service.FofoUser;
|
| 50 |
import com.spice.profitmandi.service.NotificationService;
|
51 |
import com.spice.profitmandi.service.NotificationService;
|
| 51 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
52 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 52 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
53 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
| 53 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
54 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| 54 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
55 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
| Line 90... |
Line 91... |
| 90 |
import javax.servlet.http.HttpServletResponse;
|
91 |
import javax.servlet.http.HttpServletResponse;
|
| 91 |
import java.io.ByteArrayInputStream;
|
92 |
import java.io.ByteArrayInputStream;
|
| 92 |
import java.io.ByteArrayOutputStream;
|
93 |
import java.io.ByteArrayOutputStream;
|
| 93 |
import java.io.IOException;
|
94 |
import java.io.IOException;
|
| 94 |
import java.io.InputStream;
|
95 |
import java.io.InputStream;
|
| - |
|
96 |
import java.time.LocalDate;
|
| 95 |
import java.time.LocalDateTime;
|
97 |
import java.time.LocalDateTime;
|
| 96 |
import java.time.LocalTime;
|
98 |
import java.time.LocalTime;
|
| - |
|
99 |
import java.time.YearMonth;
|
| 97 |
import java.time.format.DateTimeFormatter;
|
100 |
import java.time.format.DateTimeFormatter;
|
| 98 |
import java.util.*;
|
101 |
import java.util.*;
|
| 99 |
import java.util.stream.Collectors;
|
102 |
import java.util.stream.Collectors;
|
| 100 |
|
103 |
|
| 101 |
@Controller
|
104 |
@Controller
|
| Line 245... |
Line 248... |
| 245 |
AffiliateLinkRepository affiliateLinkRepository;
|
248 |
AffiliateLinkRepository affiliateLinkRepository;
|
| 246 |
|
249 |
|
| 247 |
@Autowired
|
250 |
@Autowired
|
| 248 |
AffiliateService affiliateService;
|
251 |
AffiliateService affiliateService;
|
| 249 |
|
252 |
|
| - |
|
253 |
@Autowired
|
| - |
|
254 |
FofoUser fofoUser;
|
| - |
|
255 |
|
| 250 |
List<String> filterableParams = Arrays.asList("brand");
|
256 |
List<String> filterableParams = Arrays.asList("brand");
|
| 251 |
|
257 |
|
| 252 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
258 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 253 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
259 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 254 |
@ApiOperation(value = "Get unit deal object")
|
260 |
@ApiOperation(value = "Get unit deal object")
|
| Line 1358... |
Line 1364... |
| 1358 |
public ResponseEntity<?> navBars() throws Exception {
|
1364 |
public ResponseEntity<?> navBars() throws Exception {
|
| 1359 |
List<NavBar> navBars = navBarRepository.selectAllActive();
|
1365 |
List<NavBar> navBars = navBarRepository.selectAllActive();
|
| 1360 |
return responseSender.ok(navBars);
|
1366 |
return responseSender.ok(navBars);
|
| 1361 |
}
|
1367 |
}
|
| 1362 |
|
1368 |
|
| - |
|
1369 |
|
| - |
|
1370 |
@RequestMapping(value = "/getMonthSale", method = RequestMethod.GET)
|
| - |
|
1371 |
public ResponseEntity<?> getMonthsale(HttpServletRequest request) throws Exception {
|
| - |
|
1372 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
1373 |
int fofoId = userInfo.getRetailerId();
|
| - |
|
1374 |
logger.info("getting the user resonse {} ",userInfo);
|
| - |
|
1375 |
Map<String, MonthSaleModel> monthSaleMap = new HashMap<>();
|
| - |
|
1376 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| - |
|
1377 |
int dayOfMonth = curDate.getDayOfMonth();
|
| - |
|
1378 |
YearMonth yearMonth = YearMonth.now();
|
| - |
|
1379 |
for (int i = 1; i <= 6; i++) {
|
| - |
|
1380 |
LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(i);
|
| - |
|
1381 |
int lengthOfMonth = YearMonth.from(startOfMonth).lengthOfMonth();
|
| - |
|
1382 |
logger.info("Start of previous Month {}, start of next month Month {}", startOfMonth, startOfMonth.plusMonths(1));
|
| - |
|
1383 |
double monthSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusMonths(1), fofoId, false).get(fofoId);
|
| - |
|
1384 |
double mtdSales = fofoOrderItemRepository.selectSumMopGroupByRetailer(startOfMonth, startOfMonth.plusDays(Math.min(dayOfMonth, lengthOfMonth)), fofoId, false).get(fofoId);
|
| - |
|
1385 |
|
| - |
|
1386 |
MonthSaleModel ms = new MonthSaleModel();
|
| - |
|
1387 |
ms.setMtdSales(fofoUser.format((long) mtdSales));
|
| - |
|
1388 |
ms.setMonthlySales(fofoUser.format(((long) monthSales)));
|
| - |
|
1389 |
ms.setMonth(startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
|
| - |
|
1390 |
monthSaleMap.put(String.valueOf(i), ms);
|
| - |
|
1391 |
}
|
| - |
|
1392 |
logger.info("getting the month sale map {}",monthSaleMap);
|
| - |
|
1393 |
return responseSender.ok(monthSaleMap);
|
| - |
|
1394 |
}
|
| - |
|
1395 |
@RequestMapping(value = "/getBrandwisePartnerSale", method = RequestMethod.GET)
|
| - |
|
1396 |
@ResponseBody
|
| - |
|
1397 |
public ResponseEntity<?> getBrandwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
|
| - |
|
1398 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
1399 |
int fofoId = userInfo.getRetailerId();
|
| - |
|
1400 |
if (month < 1 || month > 12) {
|
| - |
|
1401 |
throw new IllegalArgumentException("Month must be between 1 and 12");
|
| - |
|
1402 |
}
|
| - |
|
1403 |
List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectBrandWiseMonthlyPartnerSale(Collections.singletonList(fofoId), month);
|
| - |
|
1404 |
List<Map<String, Object>> response = new ArrayList<>();
|
| - |
|
1405 |
for (BrandWisePartnerSaleModel m : brandWisePartnerSaleModels) {
|
| - |
|
1406 |
Map<String, Object> row = new HashMap<>();
|
| - |
|
1407 |
row.put("brand", m.getBrand());
|
| - |
|
1408 |
row.put("lms", fofoUser.format(m.getLms()));
|
| - |
|
1409 |
row.put("lmsQty", m.getLmsQty());
|
| - |
|
1410 |
row.put("mtd", fofoUser.format(m.getMtd()));
|
| - |
|
1411 |
row.put("mtdQty", m.getMtdQty());
|
| - |
|
1412 |
row.put("lmtd", fofoUser.format(m.getLmtd()));
|
| - |
|
1413 |
row.put("lmtdQty", m.getLmtdQty());
|
| - |
|
1414 |
row.put("amtd", fofoUser.format(m.getAmtd()));
|
| - |
|
1415 |
response.add(row);
|
| - |
|
1416 |
}
|
| - |
|
1417 |
logger.info("brandItemWisePartnerSaleModels {}", response);
|
| - |
|
1418 |
return responseSender.ok(response);
|
| - |
|
1419 |
}
|
| - |
|
1420 |
@RequestMapping(value = "/getBrandItemwisePartnerSale", method = RequestMethod.GET)
|
| - |
|
1421 |
@ResponseBody
|
| - |
|
1422 |
public ResponseEntity<?> getBrandItemwisePartnerSale(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, @RequestParam(name = "brand") String brand) throws Exception {
|
| - |
|
1423 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
1424 |
int fofoId = userInfo.getRetailerId();
|
| - |
|
1425 |
if (month < 1 || month > 12) {
|
| - |
|
1426 |
throw new IllegalArgumentException("Month must be between 1 and 12");
|
| - |
|
1427 |
}
|
| - |
|
1428 |
List<BrandItemWisePartnerSaleModel> brandItemWisePartnerSaleModels = fofoStoreRepository.selectPartnerBrandItemMonthlySale(Collections.singletonList(fofoId), month, brand);
|
| - |
|
1429 |
logger.info("getting brandwise item sale {}",brandItemWisePartnerSaleModels);
|
| - |
|
1430 |
return responseSender.ok(brandItemWisePartnerSaleModels);
|
| - |
|
1431 |
}
|
| - |
|
1432 |
|
| - |
|
1433 |
|
| 1363 |
@RequestMapping(value = "/store/clearance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
1434 |
@RequestMapping(value = "/store/clearance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 1364 |
public ResponseEntity<?> getLiquidations() throws Exception {
|
1435 |
public ResponseEntity<?> getLiquidations() throws Exception {
|
| 1365 |
List<Integer> catalogIds = new ArrayList<>();
|
1436 |
List<Integer> catalogIds = new ArrayList<>();
|
| 1366 |
Map<Integer, JSONObject> contentMap = null;
|
1437 |
Map<Integer, JSONObject> contentMap = null;
|
| 1367 |
List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
|
1438 |
List<Liquidation> liquidations = liquidationRepository.selectAllByStatus(ProfitMandiConstants.LIQUIDATION_ENUM.PUBLISHED);
|