Subversion Repositories SmartDukaan

Rev

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

Rev 37751 Rev 37848
Line 1... Line 1...
1
package com.smartdukaan.cron.migrations;
1
package com.smartdukaan.cron.migrations;
2
 
2
 
-
 
3
import com.spice.profitmandi.service.warehouse.BillingWarehouseService;
-
 
4
 
3
import com.google.gson.Gson;
5
import com.google.gson.Gson;
4
import com.smartdukaan.cron.scheduled.ScheduledTasks;
6
import com.smartdukaan.cron.scheduled.ScheduledTasks;
5
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
7
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
6
import com.spice.profitmandi.common.enumuration.ItemType;
8
import com.spice.profitmandi.common.enumuration.ItemType;
7
import com.spice.profitmandi.common.enumuration.PurchaseReturnStatus;
9
import com.spice.profitmandi.common.enumuration.PurchaseReturnStatus;
Line 132... Line 134...
132
 
134
 
133
@Component
135
@Component
134
@Transactional(rollbackFor = Throwable.class)
136
@Transactional(rollbackFor = Throwable.class)
135
public class RunOnceTasks {
137
public class RunOnceTasks {
136
 
138
 
-
 
139
    @Autowired
-
 
140
    private BillingWarehouseService billingWarehouseService;
-
 
141
 
-
 
142
 
137
    private static final Logger LOGGER = LogManager.getLogger(RunOnceTasks.class);
143
    private static final Logger LOGGER = LogManager.getLogger(RunOnceTasks.class);
138
 
144
 
139
    @Autowired
145
    @Autowired
140
    private RestClient restClient;
146
    private RestClient restClient;
141
 
147
 
Line 1514... Line 1520...
1514
        }
1520
        }
1515
    }
1521
    }
1516
 
1522
 
1517
    public void moveOrders() throws Exception {
1523
    public void moveOrders() throws Exception {
1518
        // Clear all Reservations
1524
        // Clear all Reservations
1519
        for (Map.Entry<Integer, String> integerStringEntry : ProfitMandiConstants.WAREHOUSE_MAP.entrySet()) {
1525
        for (Map.Entry<Integer, String> integerStringEntry : billingWarehouseService.getOperationalWarehouses().entrySet()) {
1520
            transactionService.moveOrdersFulfimentWarehouse(integerStringEntry.getKey());
1526
            transactionService.moveOrdersFulfimentWarehouse(integerStringEntry.getKey());
1521
        }
1527
        }
1522
    }
1528
    }
1523
 
1529
 
1524
    public void fixOrders() throws Exception {
1530
    public void fixOrders() throws Exception {
Line 1607... Line 1613...
1607
 
1613
 
1608
    @Autowired
1614
    @Autowired
1609
    BrandRegionMappingRepository brandRegionMappingRepository;
1615
    BrandRegionMappingRepository brandRegionMappingRepository;
1610
 
1616
 
1611
    public void brandRegion() {
1617
    public void brandRegion() {
1612
        Set<Integer> warehouseIds = ProfitMandiConstants.WAREHOUSE_MAP.keySet();
1618
        Set<Integer> warehouseIds = billingWarehouseService.getOperationalWarehouses().keySet();
1613
        Map<String, Map<Boolean, List<BrandRegionMapping>>> mapping = brandRegionMappingRepository.selectAll().stream()
1619
        Map<String, Map<Boolean, List<BrandRegionMapping>>> mapping = brandRegionMappingRepository.selectAll().stream()
1614
                .collect(Collectors.groupingBy(BrandRegionMapping::getBrand,
1620
                .collect(Collectors.groupingBy(BrandRegionMapping::getBrand,
1615
                        Collectors.collectingAndThen(Collectors.toList(),
1621
                        Collectors.collectingAndThen(Collectors.toList(),
1616
                                x -> x.stream().collect(Collectors.groupingBy(BrandRegionMapping::isAccessory)))));
1622
                                x -> x.stream().collect(Collectors.groupingBy(BrandRegionMapping::isAccessory)))));
1617
        for (Map.Entry<String, Map<Boolean, List<BrandRegionMapping>>> entry : mapping.entrySet()) {
1623
        for (Map.Entry<String, Map<Boolean, List<BrandRegionMapping>>> entry : mapping.entrySet()) {