| Line 4... |
Line 4... |
| 4 |
import com.fasterxml.jackson.databind.JsonNode;
|
4 |
import com.fasterxml.jackson.databind.JsonNode;
|
| 5 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
5 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 6 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
6 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 8 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
8 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 9 |
import com.spice.profitmandi.common.util.JWTUtil;
|
9 |
import com.spice.profitmandi.service.authentication.JWTUtil;
|
| 10 |
import com.spice.profitmandi.common.web.client.RestClient;
|
10 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 11 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
11 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| 12 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
12 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 13 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
13 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 14 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
14 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| Line 22... |
Line 22... |
| 22 |
import org.springframework.beans.factory.annotation.Autowired;
|
22 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23 |
import org.springframework.http.HttpHeaders;
|
23 |
import org.springframework.http.HttpHeaders;
|
| 24 |
import org.springframework.http.MediaType;
|
24 |
import org.springframework.http.MediaType;
|
| 25 |
import org.springframework.stereotype.Component;
|
25 |
import org.springframework.stereotype.Component;
|
| 26 |
|
26 |
|
| 27 |
import java.io.IOException;
|
- |
|
| 28 |
import java.util.HashMap;
|
27 |
import java.util.HashMap;
|
| 29 |
import java.util.List;
|
28 |
import java.util.List;
|
| 30 |
import java.util.Map;
|
29 |
import java.util.Map;
|
| 31 |
|
30 |
|
| 32 |
@Component
|
31 |
@Component
|
| Line 77... |
Line 76... |
| 77 |
private RetailerService retailerService;
|
76 |
private RetailerService retailerService;
|
| 78 |
|
77 |
|
| 79 |
@Autowired
|
78 |
@Autowired
|
| 80 |
private PincodePartnerRepository pincodePartnerRepository;
|
79 |
private PincodePartnerRepository pincodePartnerRepository;
|
| 81 |
|
80 |
|
| - |
|
81 |
@Autowired
|
| - |
|
82 |
JWTUtil jwtUtil;
|
| - |
|
83 |
|
| 82 |
public String process(String token) throws ProfitMandiBusinessException {
|
84 |
public String process(String token) throws ProfitMandiBusinessException {
|
| 83 |
Map<String, String> params = new HashMap<>();
|
85 |
Map<String, String> params = new HashMap<>();
|
| 84 |
params.put(ProfitMandiConstants.ID_TOKEN, token);
|
86 |
params.put(ProfitMandiConstants.ID_TOKEN, token);
|
| 85 |
Map<String, String> headers = new HashMap<>();
|
87 |
Map<String, String> headers = new HashMap<>();
|
| 86 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
88 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
| Line 110... |
Line 112... |
| 110 |
String[] roleTypes = new String[roleIds.size()];
|
112 |
String[] roleTypes = new String[roleIds.size()];
|
| 111 |
int index = 0;
|
113 |
int index = 0;
|
| 112 |
for (int roleId : roleIds) {
|
114 |
for (int roleId : roleIds) {
|
| 113 |
roleTypes[index++] = String.valueOf(roleId);
|
115 |
roleTypes[index++] = String.valueOf(roleId);
|
| 114 |
}
|
116 |
}
|
| 115 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(userId, retailerId, roleTypes));
|
117 |
responseMap.put(ProfitMandiConstants.TOKEN, jwtUtil.create(userId, retailerId, roleTypes));
|
| 116 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
118 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
| 117 |
responseMap.put(ProfitMandiConstants.PIN_CODE, partnerPin != null ? partnerPin.getPincode() : partnerPin);
|
119 |
responseMap.put(ProfitMandiConstants.PIN_CODE, partnerPin != null ? partnerPin.getPincode() : partnerPin);
|
| 118 |
return responseMap;
|
120 |
return responseMap;
|
| 119 |
}
|
121 |
}
|
| 120 |
}
|
122 |
}
|