| Line 159... |
Line 159... |
| 159 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
159 |
@RequestMapping(value = "/retailerDetails", method = RequestMethod.PUT)
|
| 160 |
public String updateRetailerDetails(HttpServletRequest request,
|
160 |
public String updateRetailerDetails(HttpServletRequest request,
|
| 161 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
161 |
@RequestBody UpdateRetailerRequest updateRetailerRequest, Model model) throws ProfitMandiBusinessException {
|
| 162 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
162 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), updateRetailerRequest);
|
| 163 |
String storeCode = updateRetailerRequest.getFofostorecode();
|
163 |
String storeCode = updateRetailerRequest.getFofostorecode();
|
| - |
|
164 |
boolean isStoreCodeNotCreated = (storeCode == null || storeCode.isEmpty());
|
| - |
|
165 |
LOGGER.info("isStoreCodeNotCreated - "+isStoreCodeNotCreated);
|
| 164 |
if (!updateRetailerRequest.getFofoType().equals(FofoType.INTERNAL) && (storeCode==null || storeCode.isEmpty())) {
|
166 |
if (!updateRetailerRequest.getFofoType().equals(FofoType.INTERNAL) && isStoreCodeNotCreated) {
|
| 165 |
checkLoiCompletion(updateRetailerRequest);
|
167 |
checkLoiCompletion(updateRetailerRequest);
|
| 166 |
}
|
168 |
}
|
| 167 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
169 |
Map<String, Object> map = retailerService.updateRetailerDetails(updateRetailerRequest);
|
| 168 |
//retailerService.up
|
170 |
//retailerService.up
|
| 169 |
|
171 |
|
| Line 182... |
Line 184... |
| 182 |
}
|
184 |
}
|
| 183 |
String userMobile = updateRetailerRequest.getUserMobileNumber();
|
185 |
String userMobile = updateRetailerRequest.getUserMobileNumber();
|
| 184 |
String gstNumber = updateRetailerRequest.getGstNumber();
|
186 |
String gstNumber = updateRetailerRequest.getGstNumber();
|
| 185 |
LoiForm loiForm = findLoiForm(userMobile, gstNumber);
|
187 |
LoiForm loiForm = findLoiForm(userMobile, gstNumber);
|
| 186 |
if (loiForm == null) {
|
188 |
if (loiForm == null) {
|
| 187 |
throw new ProfitMandiBusinessException("Loi Not Available","Message - ","Please fill the LOI_FORM and try again");
|
189 |
throw new ProfitMandiBusinessException("Loi Not Available", "Message - ", "Please fill the LOI_FORM and try again");
|
| 188 |
}
|
190 |
}
|
| 189 |
if (loiForm.getOnBoardingId() <= 0) {
|
191 |
if (loiForm.getOnBoardingId() <= 0) {
|
| 190 |
throw new ProfitMandiBusinessException("Loi not completed", "Message - ", "Please Complete LOI_FORM and try again");
|
192 |
throw new ProfitMandiBusinessException("Loi not completed", "Message - ", "Please Complete LOI_FORM and try again");
|
| 191 |
}
|
193 |
}
|
| 192 |
}
|
194 |
}
|
| 193 |
|
195 |
|
| 194 |
private LoiForm findLoiForm(String mobile, String gstNumber) throws ProfitMandiBusinessException {
|
196 |
private LoiForm findLoiForm(String mobile, String gstNumber) throws ProfitMandiBusinessException {
|
| 195 |
LoiForm form = loiFormRepository.selectByEmailOrMobile(mobile);
|
197 |
LoiForm form = loiFormRepository.selectByEmailOrMobile(mobile);
|
| 196 |
if (form == null && gstNumber != null) {
|
198 |
if (form == null && gstNumber != null) {
|
| 197 |
form = loiFormRepository.selectByEqualsKeyValue("gstNo", gstNumber);
|
199 |
form = loiFormRepository.selectByEqualsKeyValue("gstNo", gstNumber);
|
| 198 |
}
|
200 |
}
|