| Line 25... |
Line 25... |
| 25 |
import com.spice.profitmandi.dao.model.*;
|
25 |
import com.spice.profitmandi.dao.model.*;
|
| 26 |
import com.spice.profitmandi.dao.repository.auth.*;
|
26 |
import com.spice.profitmandi.dao.repository.auth.*;
|
| 27 |
import com.spice.profitmandi.dao.repository.cs.*;
|
27 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 28 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
28 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 29 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
29 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| - |
|
30 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.fofo.RbmRatingRepository;
|
31 |
import com.spice.profitmandi.dao.repository.fofo.RbmRatingRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.fofo.SalesRatingRepository;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.SalesRatingRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
33 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
34 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 34 |
import com.spice.profitmandi.service.AuthService;
|
35 |
import com.spice.profitmandi.service.AuthService;
|
| 35 |
import com.spice.profitmandi.service.NotificationService;
|
36 |
import com.spice.profitmandi.service.NotificationService;
|
| 36 |
import com.spice.profitmandi.service.PartnerCollectionService;
|
37 |
import com.spice.profitmandi.service.PartnerCollectionService;
|
| - |
|
38 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 37 |
import com.spice.profitmandi.service.user.RetailerService;
|
39 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 38 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
40 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
| 39 |
import com.spice.profitmandi.web.req.CreateFranchiseeRequest;
|
41 |
import com.spice.profitmandi.web.req.CreateFranchiseeRequest;
|
| 40 |
import com.spice.profitmandi.web.req.RbmSalesRatingRequest;
|
42 |
import com.spice.profitmandi.web.req.RbmSalesRatingRequest;
|
| 41 |
import com.spice.profitmandi.web.res.Partner;
|
43 |
import com.spice.profitmandi.web.res.Partner;
|
| Line 179... |
Line 181... |
| 179 |
private TicketAssignedRepository ticketAssignedRepository;
|
181 |
private TicketAssignedRepository ticketAssignedRepository;
|
| 180 |
|
182 |
|
| 181 |
@Autowired
|
183 |
@Autowired
|
| 182 |
LeadDetailRepository leadDetailRepository;
|
184 |
LeadDetailRepository leadDetailRepository;
|
| 183 |
|
185 |
|
| - |
|
186 |
@Autowired
|
| - |
|
187 |
PurchaseRepository purchaseRepository;
|
| - |
|
188 |
|
| 184 |
@RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
189 |
@RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 185 |
@ApiImplicitParams({
|
190 |
@ApiImplicitParams({
|
| 186 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
191 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 187 |
|
192 |
|
| 188 |
public ResponseEntity<?> LeadUser(@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
|
193 |
public ResponseEntity<?> LeadUser(@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
|
| 189 |
LOGGER.info("CreateRefferalRequest - " + createRefferalRequest);
|
194 |
LOGGER.info("CreateRefferalRequest - " + createRefferalRequest);
|
| 190 |
if (createRefferalRequest.getOutletName() == null || createRefferalRequest.getPotential() == 0) {
|
195 |
if (createRefferalRequest.getOutletName() == null || createRefferalRequest.getPotential() == 0) {
|
| 191 |
throw new Exception("Outlet should not be empty and potential shoul be greator > 0");
|
196 |
throw new Exception("Outlet should not be empty and potential shoul be greator > 0");
|
| 192 |
}
|
197 |
}
|
| 193 |
List<Lead> leadDetail = leadRepository.selectByMobileNumber(createRefferalRequest.getMobile());
|
198 |
List<Lead> leadDetail = leadRepository.selectByMobileNumber(createRefferalRequest.getMobile());
|
| 194 |
LOGGER.info("Lead Details {}", leadDetail);
|
199 |
LOGGER.info("Lead Details {}", leadDetail);
|
| 195 |
if(!leadDetail.isEmpty() && leadDetail.get(0).getStatus()!=LeadStatus.notInterested){
|
200 |
if (!leadDetail.isEmpty() && leadDetail.get(0).getStatus() != LeadStatus.notInterested) {
|
| 196 |
AuthUser authUser1 = authRepository.selectById(leadDetail.get(0).getAssignTo());
|
201 |
AuthUser authUser1 = authRepository.selectById(leadDetail.get(0).getAssignTo());
|
| 197 |
return responseSender.ok(" Duplicate Entry: Lead already exists, created by "+ leadDetail.get(0).getCreatedBy()+ " on " + FormattingUtils.format(leadDetail.get(0).getCreatedTimestamp())+ "assigned to " + authUser1.getFullName() );
|
202 |
return responseSender.ok(" Duplicate Entry: Lead already exists, created by " + leadDetail.get(0).getCreatedBy() + " on " + FormattingUtils.format(leadDetail.get(0).getCreatedTimestamp()) + "assigned to " + authUser1.getFullName());
|
| 198 |
|
203 |
|
| 199 |
}
|
204 |
}
|
| 200 |
|
205 |
|
| 201 |
Lead lead = new Lead();
|
206 |
Lead lead = new Lead();
|
| 202 |
lead.setFirstName(createRefferalRequest.getFirstName());
|
207 |
lead.setFirstName(createRefferalRequest.getFirstName());
|
| Line 773... |
Line 778... |
| 773 |
@RequestMapping(value = "/onBoardingTimelineStatus", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
778 |
@RequestMapping(value = "/onBoardingTimelineStatus", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 774 |
@ApiImplicitParams({
|
779 |
@ApiImplicitParams({
|
| 775 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
780 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 776 |
public ResponseEntity<?> onBoardingTimelineStatus(HttpServletRequest request, Model model)
|
781 |
public ResponseEntity<?> onBoardingTimelineStatus(HttpServletRequest request, Model model)
|
| 777 |
throws ProfitMandiBusinessException {
|
782 |
throws ProfitMandiBusinessException {
|
| - |
|
783 |
//This userId is of dtr.users
|
| 778 |
int userId = (int) request.getAttribute("userId");
|
784 |
int userId = (int) request.getAttribute("userId");
|
| - |
|
785 |
|
| - |
|
786 |
//UserCart contains userId/retailerId in context of user.user as
|
| - |
|
787 |
//uc contains retailerId and cartId of the retailerId that belongs to user schema
|
| 779 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
788 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| 780 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(uc.getUserId());
|
789 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(uc.getUserId());
|
| 781 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
|
790 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
|
| 782 |
Map<StoreTimeline, OnBoardingTimelineModel> timelineStatus = null;
|
791 |
Map<StoreTimeline, OnBoardingTimelineModel> timelineStatus = null;
|
| 783 |
LOGGER.info("partnerOnBoardingPanel" + partnerOnBoardingPanel);
|
792 |
LOGGER.info("partnerOnBoardingPanel" + partnerOnBoardingPanel);
|
| Line 790... |
Line 799... |
| 790 |
onBoardingModel = timelineStatus.values().stream().skip(2).map(x -> x).collect(Collectors.toList());
|
799 |
onBoardingModel = timelineStatus.values().stream().skip(2).map(x -> x).collect(Collectors.toList());
|
| 791 |
}
|
800 |
}
|
| 792 |
return responseSender.ok(onBoardingModel);
|
801 |
return responseSender.ok(onBoardingModel);
|
| 793 |
|
802 |
|
| 794 |
}
|
803 |
}
|
| - |
|
804 |
@RequestMapping(value = "/purchaseExist", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
805 |
@ApiImplicitParams({
|
| - |
|
806 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| - |
|
807 |
public ResponseEntity<?> purchaseExist(HttpServletRequest request, Model model)
|
| - |
|
808 |
throws ProfitMandiBusinessException {
|
| - |
|
809 |
int userId = (int) request.getAttribute("userId");
|
| - |
|
810 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| - |
|
811 |
boolean purchaseExist = purchaseRepository.hasPurchaseForFofoId(uc.getUserId());
|
| - |
|
812 |
if (purchaseExist) {
|
| - |
|
813 |
return responseSender.ok(true);
|
| - |
|
814 |
}
|
| - |
|
815 |
return responseSender.ok(false);
|
| 795 |
|
816 |
}
|
| 796 |
@RequestMapping(value = "/onBoardingTimelineVisibility", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
817 |
@RequestMapping(value = "/onBoardingTimelineVisibility", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 797 |
@ApiImplicitParams({
|
818 |
@ApiImplicitParams({
|
| 798 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
819 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 799 |
public ResponseEntity<?> onBoardingTimelineVisibility(HttpServletRequest request, Model model)
|
820 |
public ResponseEntity<?> onBoardingTimelineVisibility(HttpServletRequest request, Model model)
|
| 800 |
throws ProfitMandiBusinessException {
|
821 |
throws ProfitMandiBusinessException {
|