| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.time.LocalDate;
|
| 3 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| - |
|
5 |
import java.time.format.DateTimeFormatter;
|
| 4 |
import java.util.ArrayList;
|
6 |
import java.util.ArrayList;
|
| - |
|
7 |
import java.util.HashMap;
|
| - |
|
8 |
import java.util.HashSet;
|
| 5 |
import java.util.List;
|
9 |
import java.util.List;
|
| 6 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 7 |
import java.util.Set;
|
11 |
import java.util.Set;
|
| 8 |
|
12 |
|
| 9 |
import javax.servlet.http.HttpServletRequest;
|
13 |
import javax.servlet.http.HttpServletRequest;
|
| Line 21... |
Line 25... |
| 21 |
import org.springframework.web.bind.annotation.RequestMethod;
|
25 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 22 |
import org.springframework.web.bind.annotation.RequestParam;
|
26 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 23 |
|
27 |
|
| 24 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
28 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 25 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
29 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| - |
|
30 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 26 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
31 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 27 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
32 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 28 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
33 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 29 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
34 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| - |
|
35 |
import com.spice.profitmandi.dao.entity.logistics.PostOffice;
|
| 30 |
import com.spice.profitmandi.dao.entity.user.FranchiseeActivity;
|
36 |
import com.spice.profitmandi.dao.entity.user.FranchiseeActivity;
|
| 31 |
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
|
37 |
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
|
| 32 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
38 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 33 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
39 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
| 34 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeActivityStatus;
|
40 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeActivityStatus;
|
| Line 201... |
Line 207... |
| 201 |
leadActivityRepository.persist(leadActivity);
|
207 |
leadActivityRepository.persist(leadActivity);
|
| 202 |
return responseSender.ok(true);
|
208 |
return responseSender.ok(true);
|
| 203 |
|
209 |
|
| 204 |
}
|
210 |
}
|
| 205 |
|
211 |
|
| - |
|
212 |
@RequestMapping(value = ProfitMandiConstants.URL_NEW_LEAD, method = RequestMethod.POST)
|
| - |
|
213 |
public ResponseEntity<?> newLead(HttpServletRequest request,
|
| - |
|
214 |
@RequestBody CreateRefferalRequest createRefferalRequest) {
|
| - |
|
215 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| - |
|
216 |
Lead lead = new Lead();
|
| - |
|
217 |
lead.setAddress(createRefferalRequest.getCity());
|
| - |
|
218 |
lead.setLeadMobile(createRefferalRequest.getMobile());
|
| - |
|
219 |
lead.setCity(createRefferalRequest.getCity());
|
| - |
|
220 |
lead.setState(createRefferalRequest.getState());
|
| - |
|
221 |
lead.setLastName(createRefferalRequest.getLastName());
|
| - |
|
222 |
if (lead.getState().equals("Uttar Pradesh")) {
|
| - |
|
223 |
lead.setAssignTo(1);
|
| - |
|
224 |
} else if (lead.getState().equals("Haryana")) {
|
| - |
|
225 |
lead.setAssignTo(1);
|
| - |
|
226 |
} else if (lead.getState().equals("Delhi")) {
|
| - |
|
227 |
lead.setAssignTo(1);
|
| - |
|
228 |
} else {
|
| - |
|
229 |
// Assign to sm
|
| - |
|
230 |
// lead.setAssignTo(53);
|
| - |
|
231 |
lead.setAssignTo(1);
|
| - |
|
232 |
}
|
| - |
|
233 |
lead.setAuthId(lead.getAssignTo());
|
| - |
|
234 |
lead.setCreatedBy("daily-sync");
|
| - |
|
235 |
lead.setSource("SD-WEB");
|
| - |
|
236 |
lead.setFirstName(createRefferalRequest.getFirstName());
|
| - |
|
237 |
lead.setStatus(LeadStatus.followUp);
|
| - |
|
238 |
lead.setColor("yellow");
|
| - |
|
239 |
lead.setCreatedTimestamp(LocalDateTime.now());
|
| - |
|
240 |
lead.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
241 |
leadRepository.persist(lead);
|
| - |
|
242 |
|
| - |
|
243 |
return responseSender.ok(true);
|
| - |
|
244 |
|
| - |
|
245 |
}
|
| - |
|
246 |
|
| 206 |
@RequestMapping(value = "/getPartnersList", method = RequestMethod.GET)
|
247 |
@RequestMapping(value = "/getPartnersList", method = RequestMethod.GET)
|
| 207 |
@ApiImplicitParams({
|
248 |
@ApiImplicitParams({
|
| 208 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
249 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 209 |
public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId)
|
250 |
public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId)
|
| 210 |
throws ProfitMandiBusinessException {
|
251 |
throws ProfitMandiBusinessException {
|