Subversion Repositories SmartDukaan

Rev

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

Rev 32383 Rev 37653
Line 12... Line 12...
12
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
12
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
13
import com.spice.profitmandi.dao.repository.transaction.SellerRepository;
13
import com.spice.profitmandi.dao.repository.transaction.SellerRepository;
14
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
14
import com.spice.profitmandi.dao.repository.transaction.SellerWarehouseRepository;
15
import com.spice.profitmandi.dao.repository.transaction.WarehouseAddressMappingRepository;
15
import com.spice.profitmandi.dao.repository.transaction.WarehouseAddressMappingRepository;
16
import com.spice.profitmandi.dao.repository.transaction.WarehouseAddressMasterRepository;
16
import com.spice.profitmandi.dao.repository.transaction.WarehouseAddressMasterRepository;
-
 
17
import com.spice.profitmandi.service.SellerService;
17
import org.apache.logging.log4j.LogManager;
18
import org.apache.logging.log4j.LogManager;
18
import org.apache.logging.log4j.Logger;
19
import org.apache.logging.log4j.Logger;
19
import org.springframework.beans.factory.annotation.Autowired;
20
import org.springframework.beans.factory.annotation.Autowired;
-
 
21
import org.springframework.http.ResponseEntity;
20
import org.springframework.stereotype.Controller;
22
import org.springframework.stereotype.Controller;
21
import org.springframework.transaction.annotation.Transactional;
23
import org.springframework.transaction.annotation.Transactional;
22
import org.springframework.ui.Model;
24
import org.springframework.ui.Model;
23
import org.springframework.web.bind.annotation.RequestMapping;
25
import org.springframework.web.bind.annotation.RequestMapping;
24
import org.springframework.web.bind.annotation.RequestMethod;
26
import org.springframework.web.bind.annotation.RequestMethod;
25
import org.springframework.web.bind.annotation.RequestParam;
27
import org.springframework.web.bind.annotation.RequestParam;
-
 
28
import org.springframework.web.bind.annotation.ResponseBody;
26
 
29
 
27
import javax.servlet.http.HttpServletRequest;
30
import javax.servlet.http.HttpServletRequest;
28
import java.time.LocalDateTime;
31
import java.time.LocalDateTime;
29
import java.util.HashMap;
32
import java.util.HashMap;
30
import java.util.List;
33
import java.util.List;
Line 53... Line 56...
53
    private SellerWarehouseRepository sellerWarehouseRepository;
56
    private SellerWarehouseRepository sellerWarehouseRepository;
54
 
57
 
55
    @Autowired
58
    @Autowired
56
    private WarehouseAddressMappingRepository warehouseAddressMappingRepository;
59
    private WarehouseAddressMappingRepository warehouseAddressMappingRepository;
57
 
60
 
-
 
61
    @Autowired
-
 
62
    private SellerService sellerService;
-
 
63
 
58
    private static final Logger LOGGER = LogManager.getLogger(SellerController.class);
64
    private static final Logger LOGGER = LogManager.getLogger(SellerController.class);
59
 
65
 
-
 
66
    /**
-
 
67
     * Realign the INTERNAL stores of a warehouse with the address currently mapped to it.
-
 
68
     *
-
 
69
     * The mapping has no edit screen - it gets repointed straight in the database - so nothing
-
 
70
     * carried a warehouse's move through to the internal store's user.address, and orders kept
-
 
71
     * billing to an address the branch had left years earlier. This is that missing hop; run it
-
 
72
     * after changing a warehouse's address mapping.
-
 
73
     */
-
 
74
    @RequestMapping(value = "/syncWarehouseInternalAddress", method = RequestMethod.POST)
-
 
75
    @ResponseBody
-
 
76
    public ResponseEntity<?> syncWarehouseInternalAddress(@RequestParam(name = "warehouseId") int warehouseId)
-
 
77
            throws Exception {
-
 
78
        int synced = sellerService.syncInternalStoreAddresses(warehouseId);
-
 
79
        LOGGER.info("Synced {} internal store address(es) for warehouse {}", synced, warehouseId);
-
 
80
        Map<String, Object> response = new HashMap<>();
-
 
81
        response.put("warehouseId", warehouseId);
-
 
82
        response.put("storesSynced", synced);
-
 
83
        return ResponseEntity.ok(response);
-
 
84
    }
-
 
85
 
60
    @RequestMapping(value = "/createNewWarehouse", method = RequestMethod.POST)
86
    @RequestMapping(value = "/createNewWarehouse", method = RequestMethod.POST)
61
    public String getViewOurSales(HttpServletRequest request, @RequestParam(name = "address", required = true, defaultValue = "0") int address, @RequestParam(name = "prefix", required = true, defaultValue = "0") String prefix, @RequestParam(name = "sellerId", required = true, defaultValue = "0") int sellerId, @RequestParam(name = "warehouseName", required = true, defaultValue = "0") String warehouseName, @RequestParam(name = "pin", required = true, defaultValue = "0") String pinCode, Model model)
87
    public String getViewOurSales(HttpServletRequest request, @RequestParam(name = "address", required = true, defaultValue = "0") int address, @RequestParam(name = "prefix", required = true, defaultValue = "0") String prefix, @RequestParam(name = "sellerId", required = true, defaultValue = "0") int sellerId, @RequestParam(name = "warehouseName", required = true, defaultValue = "0") String warehouseName, @RequestParam(name = "pin", required = true, defaultValue = "0") String pinCode, Model model)
62
 
88
 
63
            throws Exception {
89
            throws Exception {
64
 
90