| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.io.ByteArrayInputStream;
|
3 |
import java.io.ByteArrayInputStream;
|
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.InputStream;
|
5 |
import java.io.InputStream;
|
| - |
|
6 |
import java.time.LocalDateTime;
|
| 6 |
import java.util.List;
|
7 |
import java.util.List;
|
| 7 |
import java.util.Map;
|
8 |
import java.util.Map;
|
| 8 |
|
9 |
|
| 9 |
import javax.servlet.http.HttpServletRequest;
|
10 |
import javax.servlet.http.HttpServletRequest;
|
| 10 |
import javax.servlet.http.HttpServletResponse;
|
11 |
import javax.servlet.http.HttpServletResponse;
|
| 11 |
|
12 |
|
| 12 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 13 |
import org.apache.logging.log4j.LogManager;
|
13 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
14 |
import org.apache.logging.log4j.Logger;
|
| 14 |
import org.springframework.beans.factory.annotation.Autowired;
|
15 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 15 |
import org.springframework.beans.factory.annotation.Qualifier;
|
16 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 16 |
import org.springframework.beans.factory.annotation.Value;
|
17 |
import org.springframework.beans.factory.annotation.Value;
|
| 17 |
import org.springframework.core.io.InputStreamResource;
|
18 |
import org.springframework.core.io.InputStreamResource;
|
| - |
|
19 |
import org.springframework.format.annotation.DateTimeFormat;
|
| - |
|
20 |
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
| 18 |
import org.springframework.http.HttpHeaders;
|
21 |
import org.springframework.http.HttpHeaders;
|
| 19 |
import org.springframework.http.HttpStatus;
|
22 |
import org.springframework.http.HttpStatus;
|
| 20 |
import org.springframework.http.ResponseEntity;
|
23 |
import org.springframework.http.ResponseEntity;
|
| 21 |
import org.springframework.stereotype.Controller;
|
24 |
import org.springframework.stereotype.Controller;
|
| 22 |
import org.springframework.transaction.annotation.Transactional;
|
25 |
import org.springframework.transaction.annotation.Transactional;
|
| Line 157... |
Line 160... |
| 157 |
return "validate-cart";
|
160 |
return "validate-cart";
|
| 158 |
}
|
161 |
}
|
| 159 |
|
162 |
|
| 160 |
@RequestMapping(value = "/grnHistory")
|
163 |
@RequestMapping(value = "/grnHistory")
|
| 161 |
public String getGrnHistory(HttpServletRequest request,
|
164 |
public String getGrnHistory(HttpServletRequest request,
|
| 162 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
165 |
@RequestParam(required = false) LocalDateTime startTime,
|
| 163 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
166 |
@RequestParam(required = false) LocalDateTime endTime,
|
| 164 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
167 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 165 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
168 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 166 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
169 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
| 167 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
170 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
| 168 |
throws ProfitMandiBusinessException {
|
171 |
throws ProfitMandiBusinessException {
|
| 169 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
172 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 170 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTimeString,
|
173 |
Map<String, Object> map = inventoryService.getGrnHistory(loginDetails.getFofoId(), startTime,
|
| 171 |
endTimeString, offset, limit, purchaseReference, searchType);
|
174 |
endTime, offset, limit, purchaseReference, searchType);
|
| 172 |
model.addAllAttributes(map);
|
175 |
model.addAllAttributes(map);
|
| 173 |
return "grn-history";
|
176 |
return "grn-history";
|
| 174 |
}
|
177 |
}
|
| 175 |
|
178 |
|
| 176 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
179 |
@RequestMapping(value = "/getPaginatedGrnHistory")
|
| 177 |
public String getPaginatedGrnHistory(HttpServletRequest request,
|
180 |
public String getPaginatedGrnHistory(HttpServletRequest request,
|
| 178 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
181 |
@RequestParam(required = false) LocalDateTime startTime,
|
| 179 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
182 |
@RequestParam(required = false) LocalDateTime endTime,
|
| 180 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
183 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 181 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
184 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 182 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
185 |
@RequestParam(name = ProfitMandiConstants.PURCHASE_REFERENCE, defaultValue = "") String purchaseReference,
|
| 183 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
186 |
@RequestParam(name = "searchType", defaultValue = "") String searchType, Model model)
|
| 184 |
throws ProfitMandiBusinessException {
|
187 |
throws ProfitMandiBusinessException {
|
| 185 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
188 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 186 |
Map<String, Object> map = inventoryService.getPaginatedGrnHistory(loginDetails.getFofoId(), startTimeString,
|
189 |
Map<String, Object> map = inventoryService.getPaginatedGrnHistory(loginDetails.getFofoId(), startTime,
|
| 187 |
endTimeString, offset, limit);
|
190 |
endTime, offset, limit);
|
| 188 |
model.addAllAttributes(map);
|
191 |
model.addAllAttributes(map);
|
| 189 |
return "grn-history-paginated";
|
192 |
return "grn-history-paginated";
|
| 190 |
}
|
193 |
}
|
| 191 |
|
194 |
|
| 192 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|
195 |
@RequestMapping(value = "/grnHistoryDetailByPurchaseId")
|