Skip to content

Commit

Permalink
Merge branch 'develop' into SM-3717
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelmd-eGov authored and nipunarora-eGov committed Feb 1, 2024
1 parent 17eb70e commit dab4965
Show file tree
Hide file tree
Showing 97 changed files with 11,096 additions and 15 deletions.
18 changes: 18 additions & 0 deletions fsm/src/main/java/org/egov/fsm/service/FSMService.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,14 @@ public FSMResponse fsmSearch(FSMSearchCriteria criteria, RequestInfo requestInfo
}
}

if (!Objects.isNull(criteria.getIndividualIds()) && !criteria.getIndividualIds().isEmpty()) {
List<String> applicationIds = setApplicationIdsWithWorkers(criteria);
if (applicationIds.isEmpty()) {
return FSMResponse.builder().fsm(Collections.emptyList()).totalCount(0).build();
}
criteria.setIds(applicationIds);
}

fsmResponse = repository.getFSMData(criteria, dsoId);
fsmList = fsmResponse.getFsm();
if (!fsmList.isEmpty()) {
Expand All @@ -615,6 +623,16 @@ public FSMResponse fsmSearch(FSMSearchCriteria criteria, RequestInfo requestInfo
return fsmResponse;
}

private List<String> setApplicationIdsWithWorkers(FSMSearchCriteria criteria) {
List<Worker> workers = fsmWorkerRepository.getWorkersData(WorkerSearchCriteria.builder()
.workerTypes(Collections.singletonList(WorkerType.DRIVER.toString()))
.individualIds(criteria.getIndividualIds())
.status(Collections.singletonList(WorkerStatus.ACTIVE.toString()))
.tenantId(criteria.getTenantId())
.build());
return workers.stream().map(Worker::getApplicationId).collect(Collectors.toList());
}

private void checkRoleInValidateSearch(RequestInfo requestInfo, FSMSearchCriteria criteria) {
List<Role> roles = requestInfo.getUserInfo().getRoles();
if (roles.stream().anyMatch(role -> Objects.equals(role.getCode(), FSMConstants.ROLE_FSM_DSO))) {
Expand Down
16 changes: 7 additions & 9 deletions fsm/src/main/java/org/egov/fsm/web/model/FSMSearchCriteria.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package org.egov.fsm.web.model;

import java.util.List;

import org.hibernate.validator.constraints.SafeHtml;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.SafeHtml;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

@Getter
@Setter
Expand Down Expand Up @@ -62,8 +59,9 @@ public class FSMSearchCriteria {

@JsonProperty("ids")
private List <String> ids;



@JsonProperty("individualIds")
private List<String> individualIds;

@JsonProperty("sortBy")
private SortBy sortBy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.egov.pqm.anomaly.finder.web.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -13,6 +12,7 @@
@NoArgsConstructor
@Data
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class QualityCriteria {

@JsonProperty("id")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.egov.pqm.anomaly.finder.web.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;

import javax.validation.Valid;

import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -16,6 +14,7 @@
@NoArgsConstructor
@Data
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class Test {

@JsonProperty("id")
Expand Down
36 changes: 36 additions & 0 deletions trackingservice/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Compiled class file
*.class

# target directory
*/target/*

# IDE files
*/.idea/*

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
10 changes: 10 additions & 0 deletions trackingservice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this module will be documented in this file.

## 1.0.0

- Citizen Rating issues fixed
- Payment link correction sent in sms
- workflow modification to allow re-assign DSO at multiple stages

5 changes: 5 additions & 0 deletions trackingservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM eclipse-temurin:17-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
44 changes: 44 additions & 0 deletions trackingservice/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Tracking service

Tracking service help manage assets that are in motion. It provides APIs to create points of
interests, manage routes, trips and alerts.
The service allows creation of points of interests that are single point LatLong, line string
LatLong and polygons as well.
There is a feature to search nearby as well.

API is built using OpenAPI-Spec and hence follows industry standards.

## Tech details

This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework.

The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org).
Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model
classes.
The specification is available to download using the following url:
http://localhost:8080/v3/api-docs/

Start your server as a simple java application

You can view the api documentation in swagger-ui by pointing to
http://localhost:8080/swagger-ui.html

Change default port value in application.properties

# Generate API model and stubs

openapi-generator-cli generate -i trackingservice_api.yaml -g spring

# Maven build from source code

mvn clean package -Dmaven.test.skip=true

# Docker image creation

docker build --build-arg JAR_FILE=openapi-spring-1.0.11.jar -t trackingservice .

# Docker run

docker run -d --env-file env.txt -p 8080:8080 trackingservice
173 changes: 173 additions & 0 deletions trackingservice/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<properties>
<log4j2.version>2.17.1</log4j2.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<lombok.version>1.18.8</lombok.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springdoc.version>1.6.14</springdoc.version>
<swagger-ui.version>4.15.5</swagger-ui.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.egov</groupId>
<artifactId>vehicle-tracking</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>vehicle-tracking-services</name>
<description>vehicle tracking services</description>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>

</plugins>
</build>
<repositories>
<repository>
<id>repo.digit.org</id>
<name>eGov DIGIT Releases Repository</name>
<url>https://nexus-repo.digit.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>repo.egovernments.org</id>
<name>eGov ERP Releases Repository</name>
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/releases/</url>
</repository>
<repository>
<id>repo.egovernments.org.snapshots</id>
<name>eGov ERP Releases Repository</name>
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>repo.egovernments.org.public</id>
<name>eGov Public Repository Group</name>
<url>https://nexus-repo.egovernments.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!--SpringDoc dependencies -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>
5 changes: 5 additions & 0 deletions trackingservice/sample-env.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_JDBC_URL=jdbc:postgresql://db-postgresql.com:25060/defaultdb
DB_USER=doadmin
DB_PASSWORD=AVNS_VOzqloso05
DIGIT_FSM_URL=https://unified-dev.digit.org/fsm/v1/
DIGIT_VEHICLE_TRIP_URL=https://unified-dev.digit.org/vehicle/trip/v1/
Loading

0 comments on commit dab4965

Please sign in to comment.