forked from PSMRI/HWC-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from beehyv/daily_activity
Created daily outreach activity entity,repo and APIs related to it.
- Loading branch information
Showing
5 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
src/main/java/com/iemr/hwc/data/choApp/OutreachActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.iemr.hwc.data.choApp; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import javax.persistence.*; | ||
import java.sql.Timestamp; | ||
import java.util.ArrayList; | ||
|
||
@Data | ||
@Entity | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "t_outreach_activity") | ||
public class OutreachActivity { | ||
|
||
@Id | ||
@Expose | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "ActivityId") | ||
private int activityId; | ||
|
||
@Expose | ||
@Column(name = "UserId") | ||
private Integer userId; | ||
|
||
@Expose | ||
@Column(name = "UserName") | ||
private String userName; | ||
|
||
@Expose | ||
@Column(name = "ActivityName") | ||
private String activityName; | ||
|
||
@Expose | ||
@Column(name = "EventDesc") | ||
private String eventDescription; | ||
|
||
@Expose | ||
@Column(name = "NoOfParticipants") | ||
private Integer noOfParticipants; | ||
|
||
@Expose | ||
@Column(name = "ActivityDate") | ||
private Timestamp activityDate; | ||
|
||
@Expose | ||
@Column(name = "Img1TimeStamp") | ||
private Timestamp img1TimeStamp; | ||
|
||
@Expose | ||
@Column(name = "Img2TimeStamp") | ||
private Timestamp img2TimeStamp; | ||
|
||
@Lob | ||
@Column(name = "Img1", columnDefinition = "MEDIUMBLOB") | ||
private byte[] img1Data; | ||
|
||
@Lob | ||
@Column(name = "Img2", columnDefinition = "MEDIUMBLOB") | ||
private byte[] img2Data; | ||
|
||
@Expose | ||
@Transient | ||
private String img1; | ||
|
||
@Expose | ||
@Transient | ||
private String img2; | ||
|
||
@Expose | ||
@Column(name = "Img1Latitude") | ||
private Double img1latitude ; | ||
|
||
@Expose | ||
@Column(name = "Img1Longitude") | ||
private Double img1longitude; | ||
|
||
@Expose | ||
@Column(name = "Img1Address") | ||
private String img1Address; | ||
|
||
@Expose | ||
@Column(name = "Img2Address") | ||
private String img2Address; | ||
|
||
@Expose | ||
@Column(name = "Img2Latitude") | ||
private Double img2latitude ; | ||
|
||
@Expose | ||
@Column(name = "Img2Longitude") | ||
private Double img2longitude; | ||
|
||
@Column(name = "Deleted", insertable = false, updatable = true) | ||
private Boolean deleted; | ||
|
||
public OutreachActivity(Integer activityId, String activityName, String eventDescription, Integer noOfParticipants, | ||
Timestamp activityDate, Integer userId, String userName) { | ||
this.activityId = activityId; | ||
this.activityName = activityName; | ||
this.eventDescription = eventDescription; | ||
this.noOfParticipants = noOfParticipants; | ||
this.activityDate = activityDate; | ||
this.userId = userId; | ||
this.userName = userName; | ||
} | ||
|
||
public static ArrayList<OutreachActivity> getActivitiesForUser(ArrayList<Object[]> objList) { | ||
ArrayList<OutreachActivity> activityList = new ArrayList<>(); | ||
OutreachActivity obj = null; | ||
if (objList != null && !objList.isEmpty()) { | ||
for (Object[] objArr : objList) { | ||
obj = new OutreachActivity((Integer) objArr[0], (String) objArr[1], (String) objArr[2], | ||
(Integer) objArr[3], (Timestamp) objArr[4],(Integer) objArr[5], (String) objArr[6]); | ||
activityList.add(obj); | ||
} | ||
} | ||
return activityList; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/iemr/hwc/repo/choApp/OutreachActivityRepo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.iemr.hwc.repo.choApp; | ||
|
||
import com.iemr.hwc.data.choApp.OutreachActivity; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
import java.util.ArrayList; | ||
|
||
|
||
@Repository | ||
public interface OutreachActivityRepo extends CrudRepository<OutreachActivity, Integer> { | ||
|
||
@Query(" SELECT o.activityId, o.activityName, o.eventDescription," + | ||
"o.noOfParticipants, o.activityDate, o.userId, o.userName FROM OutreachActivity o WHERE o.userId = :userId AND o.deleted = false ") | ||
ArrayList<Object[]> getActivitiesByUserID(@Param("userId") Integer userId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters