Subversion Repositories SmartDukaan

Rev

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

Rev 32539 Rev 32565
Line 25... Line 25...
25
import org.apache.logging.log4j.Logger;
25
import org.apache.logging.log4j.Logger;
26
import org.springframework.beans.factory.annotation.Autowired;
26
import org.springframework.beans.factory.annotation.Autowired;
27
import org.springframework.stereotype.Controller;
27
import org.springframework.stereotype.Controller;
28
import org.springframework.transaction.annotation.Transactional;
28
import org.springframework.transaction.annotation.Transactional;
29
import org.springframework.ui.Model;
29
import org.springframework.ui.Model;
30
import org.springframework.web.bind.annotation.RequestBody;
30
import org.springframework.web.bind.annotation.*;
31
import org.springframework.web.bind.annotation.RequestMapping;
-
 
32
import org.springframework.web.bind.annotation.RequestMethod;
-
 
33
import org.springframework.web.bind.annotation.RequestParam;
-
 
34
 
31
 
35
import javax.servlet.http.HttpServletRequest;
32
import javax.servlet.http.HttpServletRequest;
36
import java.util.HashMap;
33
import java.util.HashMap;
37
import java.util.List;
34
import java.util.List;
38
import java.util.Map;
35
import java.util.Map;
Line 121... Line 118...
121
 
118
 
122
        return "supplier-in-active";
119
        return "supplier-in-active";
123
 
120
 
124
    }
121
    }
125
 
122
 
-
 
123
    /*@RequestMapping(value = "/supplier/edit/{supplierId}", method = RequestMethod.GET)
-
 
124
    public String getEditSupplier(HttpServletRequest request, Model model, @PathVariable int supplierId) throws Exception {
-
 
125
        Supplier supplier  = supplierRepository.selectById(supplierId);
-
 
126
        List<SellerWarehouse> sellerWarehouses = sellerWarehouseRepository.selectAll();
-
 
127
        List<Integer> sellerwarehouseIds = sellerWarehouses.stream().map(x -> x.getWarehouseId()).collect(Collectors.toList());
-
 
128
        LOGGER.info("sellerWarehouses" + sellerWarehouses);
-
 
129
        Map<Integer, WarehouseIdPrefixModel> warehouseIdAndState = new HashMap<>();
-
 
130
 
-
 
131
        for (SellerWarehouse sw : sellerWarehouses) {
-
 
132
 
-
 
133
            WarehouseAddressMapping warehouseAddressMapping = warehouseAddressMappingRepository.selectByWarehouseId(sw.getWarehouseId());
-
 
134
            LOGGER.info("warehouseAddressMapping" + warehouseAddressMapping);
-
 
135
            if (warehouseAddressMapping != null) {
-
 
136
                WarehouseAddressMaster WarehouseAddressMaster = warehouseAddressMasterRepository.selectById(warehouseAddressMapping.getAddressId());
-
 
137
                LOGGER.info("warehouseAddressMappingAddreesId" + warehouseAddressMapping.getAddressId());
-
 
138
                LOGGER.info("WarehouseAddressMaster" + WarehouseAddressMaster);
-
 
139
                State state = stateRepository.selectById(WarehouseAddressMaster.getStateId());
-
 
140
                WarehouseIdPrefixModel wp = new WarehouseIdPrefixModel();
-
 
141
                wp.setPrefix(sw.getPrefix());
-
 
142
                wp.setStateName(state.getName());
-
 
143
                warehouseIdAndState.put(sw.getWarehouseId(), wp);
-
 
144
                LOGGER.info("state" + state);
-
 
145
            }
-
 
146
        }
-
 
147
        LOGGER.info("warehouseIdAndState" + warehouseIdAndState);
-
 
148
        model.addAttribute("warehouseIdAndState", warehouseIdAndState);
-
 
149
 
-
 
150
        List<State> state = stateRepository.selectAll();
-
 
151
 
-
 
152
        model.addAttribute("state", state);
-
 
153
        model.addAttribute("warehouseMap", ProfitMandiConstants.WAREHOUSE_MAP);
-
 
154
        model.addAttribute("supplier", supplier);
-
 
155
        return "edit-supplier";
-
 
156
    }
-
 
157
*/
-
 
158
 
126
    @RequestMapping(value = "/getCreateNewSupplier", method = RequestMethod.GET)
159
    @RequestMapping(value = "/getCreateNewSupplier", method = RequestMethod.GET)
127
    public String getCreateNewSupplier(HttpServletRequest request, Model model) throws Exception {
160
    public String getCreateNewSupplier(HttpServletRequest request, Model model) throws Exception {
128
        List<SellerWarehouse> sellerWarehouses = sellerWarehouseRepository.selectAll();
161
        List<SellerWarehouse> sellerWarehouses = sellerWarehouseRepository.selectAll();
129
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
162
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
130
        sellerWarehouses = sellerWarehouses.stream().filter(x -> warehouseMap.containsKey(x.getWarehouseId())).collect(Collectors.toList());
163
        sellerWarehouses = sellerWarehouses.stream().filter(x -> warehouseMap.containsKey(x.getWarehouseId())).collect(Collectors.toList());
Line 150... Line 183...
150
        model.addAttribute("warehouseIdAndState", warehouseIdAndState);
183
        model.addAttribute("warehouseIdAndState", warehouseIdAndState);
151
 
184
 
152
        List<State> state = stateRepository.selectAll();
185
        List<State> state = stateRepository.selectAll();
153
 
186
 
154
        model.addAttribute("state", state);
187
        model.addAttribute("state", state);
-
 
188
        model.addAttribute("warehouseMap", ProfitMandiConstants.WAREHOUSE_MAP);
155
 
189
 
156
        return "new-supplier";
190
        return "new-supplier";
157
    }
191
    }
158
 
192
 
159
    @RequestMapping(value = "/setStatusInActive", method = RequestMethod.POST)
193
    @RequestMapping(value = "/setStatusInActive", method = RequestMethod.POST)
Line 189... Line 223...
189
        supplier.setName(createNewSupplier.getName());
223
        supplier.setName(createNewSupplier.getName());
190
        supplier.setCommunicationAddress(createNewSupplier.getCommunicationAddress());
224
        supplier.setCommunicationAddress(createNewSupplier.getCommunicationAddress());
191
        supplier.setContactEmail(createNewSupplier.getContactEmail());
225
        supplier.setContactEmail(createNewSupplier.getContactEmail());
192
        supplier.setContactFax(createNewSupplier.getContactFax());
226
        supplier.setContactFax(createNewSupplier.getContactFax());
193
        supplier.setContactName(createNewSupplier.getContactPerson());
227
        supplier.setContactName(createNewSupplier.getContactPerson());
-
 
228
 
-
 
229
        supplier.setContactPhone(createNewSupplier.getContactPhone());
194
        supplier.setGstin(createNewSupplier.getGst());
230
        supplier.setGstin(createNewSupplier.getGst());
195
        supplier.setHeadDesignation(createNewSupplier.getHeadDesign());
231
        supplier.setHeadDesignation(createNewSupplier.getHeadDesign());
196
        supplier.setHeadEmail(createNewSupplier.getHeadEmail());
232
        supplier.setHeadEmail(createNewSupplier.getHeadEmail());
197
        supplier.setHeadName(createNewSupplier.getHeadName());
233
        supplier.setHeadName(createNewSupplier.getHeadName());
198
        supplier.setPan(createNewSupplier.getPan());
234
        supplier.setPan(createNewSupplier.getPan());
199
        supplier.setPhone(createNewSupplier.getPhone());
235
        supplier.setPhone(createNewSupplier.getPhone());
200
        supplier.setPoValidityLimit(createNewSupplier.getpOValidityLimit());
236
        supplier.setPoValidityLimit(createNewSupplier.getpOValidityLimit());
201
        supplier.setRegisteredAddress(createNewSupplier.getRegisteredAddress());
237
        supplier.setRegisteredAddress(createNewSupplier.getRegisteredAddress());
202
        supplier.setStateId(createNewSupplier.getState());
238
        supplier.setStateId(createNewSupplier.getState());
-
 
239
        supplier.setInternalWarehouseId(createNewSupplier.getInternalWarehouseId());
203
        supplierRepository.persist(supplier);
240
        supplierRepository.persist(supplier);
204
 
241
 
205
        Vendor vendor = new Vendor();
242
        Vendor vendor = new Vendor();
206
        vendor.setName(supplier.getName());
243
        vendor.setName(supplier.getName());
207
        vendor.setId(supplier.getId());
244
        vendor.setId(supplier.getId());
Line 230... Line 267...
230
 
267
 
231
            }
268
            }
232
 
269
 
233
        }
270
        }
234
 
271
 
-
 
272
        //model.addAttribute("response1", mvcResponseSender.createResponseString(true));
-
 
273
 
235
        return "new-supplier";
274
        return getShowInActiveSupplier(request, model);
236
 
275
 
237
    }
276
    }
238
}
277
}