Skip to content

Commit

Permalink
Merge pull request #22 from KB-iGOT/4.8.20-dev-v1
Browse files Browse the repository at this point in the history
4.8.20 dev v1
  • Loading branch information
SaipradeepR authored Dec 5, 2024
2 parents a71914e + 0eccd23 commit b06d060
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,13 @@ public final class JsonKey {
public static final String OTP_EMAIL_SERVER_USERNAME = "sunbird_otp_mail_server_username";
public static final String OTP_EMAIL_SERVER_FROM = "sunbird_otp_mail_server_from_email";
public static final String OTP_EMAIL_PROTOCOL = "sunbird_otp_mail_protocol";
public static final String REGISTRATION_START_DATE = "registrationStartDate";
public static final String REGISTRATION_END_DATE = "registrationEndDate";
public static final String START_DATE_REGISTRATION = "startDateRegistration";
public static final String END_DATE_REGISTRATION = "endDateRegistration";
public static final String MINISTRY_STATE_NAME = "ministryOrStateName";
public static final String MINISTRY_STATE_TYPE = "ministryOrStateType";
public static final String DEPT_NAME = "deptName";

private JsonKey() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import akka.actor.ActorRef;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.commons.collections.MapUtils;
Expand Down Expand Up @@ -377,7 +378,34 @@ private void updateOrgData(Request actorMessage) {
}
}
ObjectMapper mapper = new ObjectMapper();
// This will remove all extra unnecessary parameter from request
String registrationStartDate = (String) MapUtils.getObject(updateOrgDao, JsonKey.REGISTRATION_START_DATE);
String registrationEndDate = (String) MapUtils.getObject(updateOrgDao, JsonKey.REGISTRATION_END_DATE);
String ministryStateName = (String) MapUtils.getObject(updateOrgDao, JsonKey.MINISTRY_STATE_NAME);
String ministryStateType = (String) MapUtils.getObject(updateOrgDao, JsonKey.MINISTRY_STATE_TYPE);
String deptName = (String) MapUtils.getObject(updateOrgDao, JsonKey.DEPT_NAME);
if (StringUtils.isNotEmpty(registrationStartDate) && StringUtils.isNotEmpty(registrationEndDate)) {
logger.info("OrganisationManagementActor : orgUpdate: Organisation registration dates: " + registrationStartDate + " " + registrationEndDate);
ZoneId zoneId = ZoneId.of("Asia/Kolkata");
ZonedDateTime registrationStartDateLong = Instant.ofEpochMilli(Long.parseLong(registrationStartDate)).atZone(zoneId);
ZonedDateTime registrationEndDateLong = Instant.ofEpochMilli(Long.parseLong(registrationEndDate)).atZone(zoneId);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
String formattedRegistrationStartDate = registrationStartDateLong.format(formatter);
String formattedRegistrationEndDate = registrationEndDateLong.format(formatter);
updateOrgDao.remove(JsonKey.REGISTRATION_START_DATE);
updateOrgDao.remove(JsonKey.REGISTRATION_END_DATE);
updateOrgDao.put(JsonKey.START_DATE_REGISTRATION, formattedRegistrationStartDate);
updateOrgDao.put(JsonKey.END_DATE_REGISTRATION, formattedRegistrationEndDate);
logger.info("OrganisationManagementActor : orgUpdate: Organisation Formatted registration dates: " + formattedRegistrationStartDate + " " + formattedRegistrationEndDate);
}
if(StringUtils.isNotEmpty(ministryStateName) ){
updateOrgDao.put(JsonKey.MINISTRY_STATE_NAME, ministryStateName);
}
if(StringUtils.isNotEmpty(ministryStateType)){
updateOrgDao.put(JsonKey.MINISTRY_STATE_TYPE, ministryStateType);
}
if(StringUtils.isNotEmpty(deptName)){
updateOrgDao.put(JsonKey.DEPT_NAME, deptName);
}
Organisation org = mapper.convertValue(updateOrgDao, Organisation.class);
updateOrgDao = mapper.convertValue(org, Map.class);
Response response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ public class Organisation implements Serializable {
private String frameworkId;
private String imgUrl;
private String cqfId;
private String registrationLink;
private String qrRegistrationLink;
private String registrationStartDate;
private String registrationEndDate;
private String logo;
private String startDateRegistration;
private String endDateRegistration;
private String settings;
private String ministryOrStateName;
private String ministryOrStateType;
private String deptName;

public String getId() {
return id;
Expand Down Expand Up @@ -214,4 +225,88 @@ public void setImgUrl(String imgUrl) {
public String getCqfId() { return cqfId; }

public void setCqfId(String cqfId) { this.cqfId = cqfId; }

public String getRegistrationLink() { return registrationLink; }

public void setRegistrationLink(String registrationLink) {
this.registrationLink = registrationLink;
}

public String getQrRegistrationLink() { return qrRegistrationLink; }

public void setQrRegistrationLink(String qrRegistrationLink) {
this.qrRegistrationLink = qrRegistrationLink;
}

public String getRegistrationStartDate() {
return registrationStartDate;
}

public void setRegistrationStartDate(String registrationStartDate) {
this.registrationStartDate = registrationStartDate;
}

public String getRegistrationEndDate() {
return registrationEndDate;
}

public void setRegistrationEndDate(String registrationEndDate) {
this.registrationEndDate = registrationEndDate;
}

public String getLogo() {
return logo;
}

public void setLogo(String logo) {
this.logo = logo;
}

public String getEndDateRegistration() {
return endDateRegistration;
}

public void setEndDateRegistration(String endDateRegistration) {
this.endDateRegistration = endDateRegistration;
}

public String getStartDateRegistration() {
return startDateRegistration;
}

public void setStartDateRegistration(String startDateRegistration) {
this.startDateRegistration = startDateRegistration;
}

public String getSettings() {
return settings;
}

public void setSettings(String settings) {
this.settings = settings;
}

public String getDeptName() {
return deptName;
}

public void setDeptName(String deptName) {
this.deptName = deptName;
}

public String getMinistryOrStateType() {
return ministryOrStateType;
}

public void setMinistryOrStateType(String ministryOrStateType) {
this.ministryOrStateType = ministryOrStateType;
}

public String getMinistryOrStateName() {
return ministryOrStateName;
}

public void setMinistryOrStateName(String ministryOrStateName) {
this.ministryOrStateName = ministryOrStateName;
}
}

0 comments on commit b06d060

Please sign in to comment.