Skip to content

Commit 12cbd71

Browse files
authored
Merge branch 'develop' into jwt-api
2 parents a6327a4 + abee571 commit 12cbd71

File tree

7 files changed

+42
-7
lines changed

7 files changed

+42
-7
lines changed

src/main/environment/common_ci.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ spring.redis.host=localhost
7070
jwt.secret=@env.JWT_SECRET_KEY@
7171

7272

73+
#ELK logging file name
74+
logging.file.name=@env.TM_API_LOGGING_FILE_NAME@
75+

src/main/java/com/iemr/tm/data/location/Districts.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ public Integer getStateID() {
8686
public void setStateID(Integer stateID) {
8787
this.stateID = stateID;
8888
}
89+
@Column(name = "GovtStateID")
90+
@Expose
91+
private Integer govtLGDStateID;
92+
93+
@Column(name = "GovtDistrictID")
94+
@Expose
95+
private Integer govtLGDDistrictID;
8996

9097
public Boolean getDeleted() {
9198
return deleted;
@@ -133,6 +140,12 @@ public Districts(Integer DistrictID, String DistrictName, Integer stateId, Strin
133140
this.districtID = DistrictID;
134141
this.districtName = DistrictName;
135142
}
143+
public Districts(Integer districtID, String districtName, Integer govtLGDStateID, Integer govtLGDDistrictID) {
144+
this.districtID = districtID;
145+
this.districtName = districtName;
146+
this.govtLGDStateID = govtLGDStateID;
147+
this.govtLGDDistrictID = govtLGDDistrictID;
148+
}
136149

137150
public int getDistrictID() {
138151
return this.districtID.intValue();

src/main/java/com/iemr/tm/data/location/States.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public class States {
4343
@Column(name = "StateID")
4444
@Expose
4545
private Integer stateID;
46+
47+
@Column(name = "GovtStateID")
48+
@Expose
49+
private Integer govtLGDStateID;
4650

4751
@Column(name = "StateName")
4852
@Expose
@@ -155,5 +159,10 @@ public String getStateName() {
155159
public void setStateName(String stateName) {
156160
this.stateName = stateName;
157161
}
158-
162+
163+
public States(int StateID, String StateName, Integer govtLGDStateID) {
164+
this.stateID = StateID;
165+
this.stateName = StateName;
166+
this.govtLGDStateID = govtLGDStateID;
167+
}
159168
}

src/main/java/com/iemr/tm/repo/location/DistrictMasterRepo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@Repository
3535

3636
public interface DistrictMasterRepo extends CrudRepository<Districts, Integer> {
37-
@Query(" SELECT d.districtID, d.districtName FROM Districts d " + " WHERE d.stateID = :stateID AND d.deleted != true ")
37+
@Query(" SELECT d.districtID, d.districtName,d.govtLGDStateID,d.govtLGDDistrictID FROM Districts d " + " WHERE d.stateID = :stateID AND d.deleted != true ")
3838
public ArrayList<Object[]> getDistrictMaster(@Param("stateID") Integer stateID);
3939

4040
}

src/main/java/com/iemr/tm/repo/location/StateMasterRepo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
@Repository
3434

3535
public interface StateMasterRepo extends CrudRepository<States, Integer> {
36-
@Query(" SELECT stateID, stateName FROM States WHERE deleted != true ")
36+
@Query(" SELECT stateID, stateName,govtLGDStateID FROM States WHERE deleted != true ")
3737
public ArrayList<Object[]> getStateMaster();
3838
}

src/main/java/com/iemr/tm/service/location/LocationServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ public String getDistrictList(Integer stateID) {
177177
ArrayList<Object[]> districtMasterList = districtMasterRepo.getDistrictMaster(stateID);
178178
if (districtMasterList != null && districtMasterList.size() > 0) {
179179
for (Object[] objArr : districtMasterList) {
180-
Districts districtMaster = new Districts((Integer) objArr[0], (String) objArr[1]);
180+
Districts districtMaster = new Districts((Integer) objArr[0], (String) objArr[1], (Integer) objArr[2],
181+
(Integer) objArr[3]);
181182
districtList.add(districtMaster);
182183
}
183184
}
@@ -237,7 +238,7 @@ public String getLocDetailsNew(Integer vanID, Integer spPSMID) {
237238
ArrayList<Object[]> stateMasterList = stateMasterRepo.getStateMaster();
238239
if (stateMasterList != null && stateMasterList.size() > 0) {
239240
for (Object[] objArr : stateMasterList) {
240-
States states = new States((Integer) objArr[0], (String) objArr[1]);
241+
States states = new States((Integer) objArr[0], (String) objArr[1], (Integer) objArr[2]);
241242
stateList.add(states);
242243
}
243244
}

src/main/java/com/iemr/tm/utils/http/HTTPRequestInterceptor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@
3333
import com.iemr.tm.utils.redis.RedisStorage;
3434
import com.iemr.tm.utils.response.OutputResponse;
3535
import com.iemr.tm.utils.sessionobject.SessionObject;
36+
import com.iemr.tm.utils.validator.Validator;
3637

3738
import jakarta.servlet.http.HttpServletRequest;
3839
import jakarta.servlet.http.HttpServletResponse;
3940

4041
@Component
4142
public class HTTPRequestInterceptor implements HandlerInterceptor {
42-
43+
private Validator validator;
4344
Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
44-
45+
@Autowired
46+
public void setValidator(Validator validator) {
47+
this.validator = validator;
48+
}
4549
private SessionObject sessionObject;
4650

4751
@Autowired
@@ -86,6 +90,11 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
8690
status = false;
8791
break;
8892
default:
93+
String remoteAddress = request.getHeader("X-FORWARDED-FOR");
94+
if (remoteAddress == null || remoteAddress.trim().length() == 0) {
95+
remoteAddress = request.getRemoteAddr();
96+
}
97+
validator.checkKeyExists(authorization, remoteAddress);
8998
break;
9099
}
91100
} catch (Exception e) {

0 commit comments

Comments
 (0)