|
|
@ -6,13 +6,26 @@ import com.volunteersregistration.entity.VolunteerInformation; |
|
|
import com.volunteersregistration.repository.CompanyInfoRepo; |
|
|
import com.volunteersregistration.repository.CompanyInfoRepo; |
|
|
import com.volunteersregistration.repository.NgoInfoRepo; |
|
|
import com.volunteersregistration.repository.NgoInfoRepo; |
|
|
import com.volunteersregistration.repository.VolunteerRegistrationRepo; |
|
|
import com.volunteersregistration.repository.VolunteerRegistrationRepo; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.core.env.Environment; |
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
|
import java.io.IOException; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.URL; |
|
|
import java.net.URL; |
|
|
import java.net.URLEncoder; |
|
|
import java.net.URLEncoder; |
|
|
import java.nio.charset.StandardCharsets; |
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
|
import java.nio.file.Files; |
|
|
|
|
|
import java.nio.file.Path; |
|
|
|
|
|
import java.nio.file.Paths; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
@ -20,9 +33,24 @@ import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.StringJoiner; |
|
|
import java.util.StringJoiner; |
|
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
|
|
import javax.imageio.ImageWriteParam; |
|
|
|
|
|
import javax.imageio.ImageWriter; |
|
|
|
|
|
import javax.imageio.stream.ImageOutputStream; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class VolunteerRegistrationService { |
|
|
public class VolunteerRegistrationService { |
|
|
|
|
|
|
|
|
|
|
|
private final Environment environment; |
|
|
|
|
|
|
|
|
|
|
|
public VolunteerRegistrationService(Environment environment) { |
|
|
|
|
|
this.environment = environment; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private JdbcTemplate jdbcTemplate; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private VolunteerRegistrationRepo volunteerRegistrationRepo; |
|
|
private VolunteerRegistrationRepo volunteerRegistrationRepo; |
|
|
|
|
|
|
|
|
@ -32,46 +60,268 @@ public class VolunteerRegistrationService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private NgoInfoRepo ngoInfoRepo; |
|
|
private NgoInfoRepo ngoInfoRepo; |
|
|
|
|
|
|
|
|
|
|
|
private boolean isMobileAlreadyRegistered(Long mobileNo) { |
|
|
|
|
|
|
|
|
|
|
|
String sql = " SELECT COUNT(*) " |
|
|
|
|
|
+ " FROM ( " |
|
|
|
|
|
+ " SELECT mobile_no " |
|
|
|
|
|
+ " FROM volunteer_information" |
|
|
|
|
|
+ " WHERE mobile_no = ? and isactive=1 " |
|
|
|
|
|
+ "" |
|
|
|
|
|
+ " UNION ALL " |
|
|
|
|
|
+ "" |
|
|
|
|
|
+ " SELECT contact_per_mobile " |
|
|
|
|
|
+ " FROM corporate_information " |
|
|
|
|
|
+ " WHERE contact_per_mobile = ? and isactive=1 " |
|
|
|
|
|
+ "" |
|
|
|
|
|
+ " UNION ALL " |
|
|
|
|
|
+ "" |
|
|
|
|
|
+ " SELECT mobile_no " |
|
|
|
|
|
+ " FROM ngo_information " |
|
|
|
|
|
+ " WHERE mobile_no = ? and isactive=1 " |
|
|
|
|
|
+ " ) AS mobile_check "; |
|
|
|
|
|
|
|
|
public String register(VolunteerInformation volun) { |
|
|
|
|
|
|
|
|
Integer count = jdbcTemplate.queryForObject( |
|
|
|
|
|
sql, |
|
|
|
|
|
Integer.class, |
|
|
|
|
|
mobileNo, |
|
|
|
|
|
mobileNo, |
|
|
|
|
|
mobileNo |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
volun.setCdate(LocalDateTime.now()); |
|
|
|
|
|
volun.setIsactive(true); |
|
|
|
|
|
try{ |
|
|
|
|
|
if(volun!=null){ |
|
|
|
|
|
String preferredAreas[] =volun.getPreferredAreas(); |
|
|
|
|
|
if (preferredAreas != null) { |
|
|
|
|
|
StringJoiner zones = new StringJoiner(","); |
|
|
|
|
|
StringJoiner joiner = new StringJoiner(","); |
|
|
|
|
|
for (String area : preferredAreas) { |
|
|
|
|
|
String areaWZone[] =area.split("-"); |
|
|
|
|
|
if(areaWZone != null && areaWZone.length==2) { |
|
|
|
|
|
joiner.add(areaWZone[1]); |
|
|
|
|
|
zones.add(areaWZone[0]); |
|
|
|
|
|
}else{ |
|
|
|
|
|
joiner.add(area); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return count != null && count > 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// public String register(VolunteerInformation volun, MultipartFile docFile) { |
|
|
|
|
|
// |
|
|
|
|
|
// volun.setCdate(LocalDateTime.now()); |
|
|
|
|
|
// volun.setIsactive(true); |
|
|
|
|
|
// try{ |
|
|
|
|
|
// if(volun!=null){ |
|
|
|
|
|
// |
|
|
|
|
|
// if (docFile != null && !docFile.isEmpty()) { |
|
|
|
|
|
// |
|
|
|
|
|
// String docPath = fileUpload(docFile,"volunteer"); |
|
|
|
|
|
// |
|
|
|
|
|
// // Set returned path into entity |
|
|
|
|
|
// volun.setDoc_url(docPath); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// String preferredAreas[] =volun.getPreferredAreas(); |
|
|
|
|
|
// if (preferredAreas != null) { |
|
|
|
|
|
// StringJoiner zones = new StringJoiner(","); |
|
|
|
|
|
// StringJoiner joiner = new StringJoiner(","); |
|
|
|
|
|
// for (String area : preferredAreas) { |
|
|
|
|
|
// String areaWZone[] =area.split("-"); |
|
|
|
|
|
// if(areaWZone != null && areaWZone.length==2) { |
|
|
|
|
|
// joiner.add(areaWZone[1]); |
|
|
|
|
|
// zones.add(areaWZone[0]); |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// joiner.add(area); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// volun.setPreferred_area(joiner.toString()); |
|
|
|
|
|
// volun.setPreferred_zones(zones.toString()); |
|
|
|
|
|
// } |
|
|
|
|
|
// volun= volunteerRegistrationRepo.save(volun); |
|
|
|
|
|
// |
|
|
|
|
|
// sendWhatsappMsgENG(volun.getVolunteer_id(),volun.getMobile_no(),"GCC-VOL-"); |
|
|
|
|
|
// sendWhatsappMsgTam(volun.getVolunteer_id(),volun.getMobile_no(),"GCC-VOL-"); |
|
|
|
|
|
// |
|
|
|
|
|
// return "VOL-"+String.format("%05d",volun.getVolunteer_id()); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// return "Not Saved"; |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// }catch(Exception e) { |
|
|
|
|
|
// e.printStackTrace(); |
|
|
|
|
|
// } |
|
|
|
|
|
// return "error"; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String register( |
|
|
|
|
|
VolunteerInformation volun, |
|
|
|
|
|
MultipartFile docFile) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
if (volun == null) { |
|
|
|
|
|
return "Not Saved"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Check mobile number duplication |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
Long mobileNo = volun.getMobile_no(); |
|
|
|
|
|
|
|
|
|
|
|
if (isMobileAlreadyRegistered(mobileNo)) { |
|
|
|
|
|
throw new MobileAlreadyRegisteredException( |
|
|
|
|
|
"This mobile number is already registered" |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Set common fields |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
volun.setCdate(LocalDateTime.now()); |
|
|
|
|
|
volun.setIsactive(true); |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Save document |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
if (docFile != null && !docFile.isEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
String docPath = fileUpload(docFile,"volunteer"); |
|
|
|
|
|
|
|
|
|
|
|
volun.setDoc_url(docPath); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Preferred Areas |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
String preferredAreas[] = volun.getPreferredAreas(); |
|
|
|
|
|
|
|
|
|
|
|
if (preferredAreas != null) { |
|
|
|
|
|
|
|
|
|
|
|
StringJoiner zones = new StringJoiner(","); |
|
|
|
|
|
StringJoiner joiner = new StringJoiner(","); |
|
|
|
|
|
|
|
|
|
|
|
for (String area : preferredAreas) { |
|
|
|
|
|
|
|
|
|
|
|
String areaWZone[] = area.split("-"); |
|
|
|
|
|
|
|
|
|
|
|
if (areaWZone.length == 2) { |
|
|
|
|
|
|
|
|
|
|
|
joiner.add(areaWZone[1]); |
|
|
|
|
|
zones.add(areaWZone[0]); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
joiner.add(area); |
|
|
} |
|
|
} |
|
|
volun.setPreferred_area(joiner.toString()); |
|
|
|
|
|
volun.setPreferred_zones(zones.toString()); |
|
|
|
|
|
} |
|
|
} |
|
|
volun= volunteerRegistrationRepo.save(volun); |
|
|
|
|
|
|
|
|
|
|
|
sendWhatsappMsgENG(volun.getVolunteer_id(),volun.getMobile_no(),"GCC-VOL-"); |
|
|
|
|
|
sendWhatsappMsgTam(volun.getVolunteer_id(),volun.getMobile_no(),"GCC-VOL-"); |
|
|
|
|
|
|
|
|
|
|
|
return "VOL-"+String.format("%05d",volun.getVolunteer_id()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
volun.setPreferred_area(joiner.toString()); |
|
|
|
|
|
volun.setPreferred_zones(zones.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Save volunteer |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
volun = volunteerRegistrationRepo.save(volun); |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Send WhatsApp |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
sendWhatsappMsgENG( |
|
|
|
|
|
volun.getVolunteer_id(), |
|
|
|
|
|
volun.getMobile_no(), |
|
|
|
|
|
"GCC-VOL-" |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
sendWhatsappMsgTam( |
|
|
|
|
|
volun.getVolunteer_id(), |
|
|
|
|
|
volun.getMobile_no(), |
|
|
|
|
|
"GCC-VOL-" |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return "VOL-" + String.format( |
|
|
|
|
|
"%05d", |
|
|
|
|
|
volun.getVolunteer_id() |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} catch (MobileAlreadyRegisteredException e) { |
|
|
|
|
|
|
|
|
|
|
|
// IMPORTANT: |
|
|
|
|
|
// Don't convert this to generic "error" |
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return "error"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String fileUpload(MultipartFile file, String name) { |
|
|
|
|
|
|
|
|
|
|
|
// Set the file path where you want to save it |
|
|
|
|
|
String uploadDirectory = environment.getProperty("file.upload.directory.mobile"); |
|
|
|
|
|
String serviceFolderName = environment.getProperty("volunteer_individual_foldername"); |
|
|
|
|
|
var year = DateTimeUtil.getCurrentYear(); |
|
|
|
|
|
var month = DateTimeUtil.getCurrentMonth(); |
|
|
|
|
|
|
|
|
|
|
|
uploadDirectory = uploadDirectory + serviceFolderName + "/" + year + "/" + month; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// Create directory if it doesn't exist |
|
|
|
|
|
Path directoryPath = Paths.get(uploadDirectory); |
|
|
|
|
|
if (!Files.exists(directoryPath)) { |
|
|
|
|
|
Files.createDirectories(directoryPath); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Datetime string |
|
|
|
|
|
String datetimetxt = DateTimeUtil.getCurrentDateTime(); |
|
|
|
|
|
|
|
|
|
|
|
// File name |
|
|
|
|
|
String fileName = name + "_" + datetimetxt + "_" + file.getOriginalFilename(); |
|
|
|
|
|
fileName = fileName.replaceAll("\\s+", ""); // Remove space on filename |
|
|
|
|
|
|
|
|
|
|
|
String filePath = uploadDirectory + "/" + fileName; |
|
|
|
|
|
|
|
|
|
|
|
String filepath_txt = "/" + serviceFolderName + "/" + year + "/" + month + "/" + fileName; |
|
|
|
|
|
|
|
|
|
|
|
// Create a new Path object |
|
|
|
|
|
Path path = Paths.get(filePath); |
|
|
|
|
|
|
|
|
|
|
|
// Get the bytes of the file |
|
|
|
|
|
byte[] bytes = file.getBytes(); |
|
|
|
|
|
|
|
|
|
|
|
String originalFileName = file.getOriginalFilename(); |
|
|
|
|
|
String extension = originalFileName.substring(originalFileName.lastIndexOf('.') + 1).toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
if ("jpg".equals(extension) || "jpeg".equals(extension)) { |
|
|
|
|
|
BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes)); |
|
|
|
|
|
byte[] compressedBytes = compressImage(image, 0.5f); // Compress with 50% quality |
|
|
|
|
|
|
|
|
|
|
|
// Write the compressed bytes to the file |
|
|
|
|
|
Files.write(path, compressedBytes); |
|
|
} else { |
|
|
} else { |
|
|
return "Not Saved"; |
|
|
|
|
|
|
|
|
// Write the original bytes to the file |
|
|
|
|
|
Files.write(path, bytes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}catch(Exception e) { |
|
|
|
|
|
|
|
|
//System.out.println(filePath); |
|
|
|
|
|
return filepath_txt; |
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
|
|
|
return "Failed to save file " + file.getOriginalFilename(); |
|
|
} |
|
|
} |
|
|
return "error"; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private byte[] compressImage(BufferedImage image, float quality) throws IOException { |
|
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(byteArrayOutputStream); |
|
|
|
|
|
|
|
|
|
|
|
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next(); |
|
|
|
|
|
writer.setOutput(imageOutputStream); |
|
|
|
|
|
|
|
|
|
|
|
ImageWriteParam param = writer.getDefaultWriteParam(); |
|
|
|
|
|
if (param.canWriteCompressed()) { |
|
|
|
|
|
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); |
|
|
|
|
|
param.setCompressionQuality(quality); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
writer.write(null, new javax.imageio.IIOImage(image, null, null), param); |
|
|
|
|
|
|
|
|
|
|
|
writer.dispose(); |
|
|
|
|
|
imageOutputStream.close(); |
|
|
|
|
|
|
|
|
|
|
|
return byteArrayOutputStream.toByteArray(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private String sendWhatsappMsgTam(int id, Long mob_no,String prefix) { |
|
|
private String sendWhatsappMsgTam(int id, Long mob_no,String prefix) { |
|
|
String urlString = ""; |
|
|
String urlString = ""; |
|
|
|
|
|
|
|
|
@ -152,7 +402,23 @@ public class VolunteerRegistrationService { |
|
|
public String registerAsNgo(NgoInformation ngo) { |
|
|
public String registerAsNgo(NgoInformation ngo) { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
if (ngo != null) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ngo == null) { |
|
|
|
|
|
return "Not Saved"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Check mobile number duplication |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
Long mobileNo = ngo.getMobileNo(); |
|
|
|
|
|
|
|
|
|
|
|
if (isMobileAlreadyRegistered(mobileNo)) { |
|
|
|
|
|
throw new MobileAlreadyRegisteredException( |
|
|
|
|
|
"This mobile number is already registered" |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngo.setCdate(LocalDateTime.now()); |
|
|
ngo.setCdate(LocalDateTime.now()); |
|
|
ngo.setIsactive(true); |
|
|
ngo.setIsactive(true); |
|
|
String preferredAreas[] = ngo.getPreferredAreas(); |
|
|
String preferredAreas[] = ngo.getPreferredAreas(); |
|
|
@ -177,19 +443,40 @@ public class VolunteerRegistrationService { |
|
|
sendWhatsappMsgTam(ngo.getNgo_id(),ngo.getMobileNo(),"GCC-NGO_VOL-"); |
|
|
sendWhatsappMsgTam(ngo.getNgo_id(),ngo.getMobileNo(),"GCC-NGO_VOL-"); |
|
|
|
|
|
|
|
|
return "NGO_VOL-"+String.format("%05d",ngo.getNgo_id()); |
|
|
return "NGO_VOL-"+String.format("%05d",ngo.getNgo_id()); |
|
|
} else { |
|
|
|
|
|
return "Not Saved"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (MobileAlreadyRegisteredException e) { |
|
|
|
|
|
|
|
|
|
|
|
// IMPORTANT: |
|
|
|
|
|
// Don't convert this to generic "error" |
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
|
|
|
return "error"; |
|
|
} |
|
|
} |
|
|
return "error"; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String registerAsCorporate(CorporateInformation cop){ |
|
|
public String registerAsCorporate(CorporateInformation cop){ |
|
|
try{ |
|
|
try{ |
|
|
if(cop!=null){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cop == null) { |
|
|
|
|
|
return "Not Saved"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
// Check mobile number duplication |
|
|
|
|
|
// ------------------------------------ |
|
|
|
|
|
Long mobileNo = cop.getContactPerMobile(); |
|
|
|
|
|
|
|
|
|
|
|
if (isMobileAlreadyRegistered(mobileNo)) { |
|
|
|
|
|
throw new MobileAlreadyRegisteredException( |
|
|
|
|
|
"This mobile number is already registered" |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cop.setCdate(LocalDateTime.now()); |
|
|
cop.setCdate(LocalDateTime.now()); |
|
|
cop.setIsactive(true); |
|
|
cop.setIsactive(true); |
|
|
String preferredAreas[] =cop.getPreferredAreas(); |
|
|
String preferredAreas[] =cop.getPreferredAreas(); |
|
|
@ -214,14 +501,20 @@ public class VolunteerRegistrationService { |
|
|
sendWhatsappMsgTam(cop.getCop_id(),cop.getContactPerMobile(),"GCC-COR_VOL-"); |
|
|
sendWhatsappMsgTam(cop.getCop_id(),cop.getContactPerMobile(),"GCC-COR_VOL-"); |
|
|
|
|
|
|
|
|
return "COR_VOL-"+String.format("%05d",cop.getCop_id()); |
|
|
return "COR_VOL-"+String.format("%05d",cop.getCop_id()); |
|
|
} else { |
|
|
|
|
|
return "Not Saved"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (MobileAlreadyRegisteredException e) { |
|
|
|
|
|
|
|
|
|
|
|
// IMPORTANT: |
|
|
|
|
|
// Don't convert this to generic "error" |
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
|
}catch(Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
|
|
|
return "error"; |
|
|
} |
|
|
} |
|
|
return "error"; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|