Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutksefpt committed May 13, 2020
1 parent a5d8be0 commit 42a6a94
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,15 @@ public void saveDataUploadToDB() throws IOException {
RealEstate newUploadRealEstate = new RealEstate();
List<LandsDetail> listLandDetail = new ArrayList<>();
List<HousesDetail> listHousesDetail = new ArrayList<>();
newUploadRealEstate = validateInfor(realEstateName, realEstateLat, realEstateLng, realEstateAddress, realEstatePrice, realEstateStatus, tempUser);
newUploadRealEstate = validateInfor(realEstateName.trim(), realEstateLat, realEstateLng, realEstateAddress, realEstatePrice, realEstateStatus, tempUser);

StringValidation sv = new StringValidation();
RealEstateAdjacentSegment newRealEstateAdjacentSegment = new RealEstateAdjacentSegment();
// save to Table REAS

if (typeRealEstate.equals(RealEstateTypeConstant.LANDTYPE)) {
if (newLandMoney == null || newLandMoney.toString().trim().equals("")) {
newLandMoney = BigDecimal.ZERO;
}
Land newLand = new Land();
newLand = validateLandInfor(newUploadRealEstate, newLandName, newLandMoney, listLandFeatureValue); // call from Service
newLand = validateLandInfor(newUploadRealEstate, newLandName.trim(), newLandMoney, listLandFeatureValue); // call from Service
if (newUploadRealEstate != null && realEstateAddress.isEmpty() && newLandName.isEmpty() && listLandFeatureValue.isEmpty() && newLandMoney.compareTo(BigDecimal.ZERO) == 0) {
PrimeFaces.current().executeScript("showLogEmptyLandHouse()");
variableSuccess = false;
Expand All @@ -235,7 +232,7 @@ public void saveDataUploadToDB() throws IOException {
PrimeFaces.current().executeScript("logLengthPrice()");
variableSuccess = false;
} else if (!checkNullString(newLandName) && (StringUtils.isNumeric(newUploadRealEstate.getRealEstateName().toString())
|| !sv.isValidText(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText(newLandName.toString().trim()).equals(""))) {
|| !sv.isValidText2(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText2(newLandName.toString().trim()).equals(""))) {
PrimeFaces.current().executeScript("showLogInvalidName()");
variableSuccess = false;
} else if (newUploadRealEstate != null && newLand != null) {
Expand All @@ -246,18 +243,15 @@ public void saveDataUploadToDB() throws IOException {
variableSuccess = true;
}
} else if (typeRealEstate.equals(RealEstateTypeConstant.HOUSETYPE)) {
if (newHouseMoney == null || newHouseMoney.toString().trim().equals("")) {
newHouseMoney = BigDecimal.ZERO;
}
House newHouse = new House();
newHouse = validateHouseInfor(newUploadRealEstate, newHouseName, newHouseMoney, listHouseFeatureValue); // call from Service
newHouse = validateHouseInfor(newUploadRealEstate, newHouseName.trim(), newHouseMoney, listHouseFeatureValue); // call from Service
if (newUploadRealEstate != null && realEstateAddress.isEmpty() && newHouseName.isEmpty() && listHouseFeatureValue.isEmpty() && newHouseMoney.compareTo(BigDecimal.ZERO) == 0) {
PrimeFaces.current().executeScript("showLogEmptyLandHouse()");
variableSuccess = false;
} else if (newUploadRealEstate == null || !checkFillTextHouse()) {
PrimeFaces.current().executeScript("showLogEmptyLandHouse()");
variableSuccess = false;
} else if (!checkNullString(newHouseName) && (!sv.isValidText(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText(newHouseName.toString().trim()).equals(""))) {
} else if (!checkNullString(newHouseName) && (!sv.isValidText2(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText2(newHouseName.toString().trim()).equals(""))) {
PrimeFaces.current().executeScript("showLogInvalidName()");
variableSuccess = false;
} else if (newUploadRealEstate.getRealEstatePrice().compareTo(newHouseMoney) == -1) {
Expand All @@ -274,26 +268,20 @@ public void saveDataUploadToDB() throws IOException {
variableSuccess = true;
}
} else if (typeRealEstate.equals(RealEstateTypeConstant.LANDHOUSETYPE)) {
if (newLandMoney == null || newLandMoney.toString().trim().equals("")) {
newLandMoney = BigDecimal.ZERO;
}
if (newHouseMoney == null || newHouseMoney.toString().trim().equals("")) {
newHouseMoney = BigDecimal.ZERO;
}
Land newLand = new Land();
newLand = validateLandInfor(newUploadRealEstate, newLandName, newLandMoney, listLandFeatureValue); // call from Service
newLand = validateLandInfor(newUploadRealEstate, newLandName.trim(), newLandMoney, listLandFeatureValue); // call from Service
listLandDetail = validateLandDetailInfor(newLand, listLandFeatureValue);

House newHouse = new House();
newHouse = validateHouseInfor(newUploadRealEstate, newHouseName, newHouseMoney, listHouseFeatureValue); // call from Service
newHouse = validateHouseInfor(newUploadRealEstate, newHouseName.trim(), newHouseMoney, listHouseFeatureValue); // call from Service
listHousesDetail = validateHouseDetailInfor(newHouse, listHouseFeatureValue);

if (newUploadRealEstate != null && realEstateAddress.isEmpty() && newHouseName.isEmpty() && listHouseFeatureValue.isEmpty() && newHouseMoney.compareTo(BigDecimal.ZERO) == 0
&& newLandName.isEmpty() && listLandFeatureValue.isEmpty() && newLandMoney.compareTo(BigDecimal.ZERO) == 0) {
PrimeFaces.current().executeScript("showLogEmptyLandHouse()");
variableSuccess = false;
} else if ((!checkNullString(newLandName) && (!sv.isValidText(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText(newLandName.toString().trim()).equals("")))
|| (!checkNullString(newHouseName) && (!sv.isValidText(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText(newHouseName.toString().trim()).equals("")))) {
} else if ((!checkNullString(newLandName) && (!sv.isValidText2(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText2(newLandName.toString().trim()).equals("")))
|| (!checkNullString(newHouseName) && (!sv.isValidText2(newUploadRealEstate.getRealEstateName().toString().trim()).equals("") || !sv.isValidText2(newHouseName.toString().trim()).equals("")))) {
PrimeFaces.current().executeScript("showLogInvalidName()");
variableSuccess = false;
} else if (newUploadRealEstate == null || !checkFillTextHouse() || !checkFillTextLand()) {
Expand Down Expand Up @@ -695,6 +683,10 @@ public void onChangeHouseUnit() {
}

public void addNewLandFeatureValue() {
if(landFeatureIdSelected.trim().equals("")){
PrimeFaces.current().executeScript("dataType()");
return;
}
if (!checkLandFeatureExisted(landFeatureIdSelected, listLandFeatureValue)) {
for (int i = 0; i < listLandsFeature.size(); i++) {

Expand Down Expand Up @@ -761,6 +753,10 @@ public boolean checkDataRange(List<String> featureDataRangeClicked, String dataC
}

public void addNewHousesFeatureValue() {
if(houseFeatureIdSelected.trim().equals("")){
PrimeFaces.current().executeScript("dataType()");
return;
}
if (!checkHouseFeatureExisted(houseFeatureIdSelected, listHouseFeatureValue)) {
for (int i = 0; i < listHousesFeature.size(); i++) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public void sendFeedback() throws IOException{
if (feedbackTitle != null && !feedbackTitle.trim().isEmpty() && !feedbackContent.trim().isEmpty() && feedbackContent != null) {
feedbackStatus = FeedbackStatusConstant.OPEN;
Feedback newfb = new Feedback();
newfb.setFeedbackTitle(feedbackTitle);
newfb.setFeedbackContent(feedbackContent);
newfb.setFeedbackTitle(feedbackTitle.trim());
newfb.setFeedbackContent(feedbackContent.trim());
newfb.setFeedbackStatus(feedbackStatus);
newfb.setUser(userSelected);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package capstone.lip.landinformationportal.business.bean;

import capstone.lip.landinformationportal.business.service.Interface.IRealEstateService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public void init() {

public void updateMyProfile() {
StringValidation sv = new StringValidation();
userSelected.setFullName(fullname);
userSelected.setEmail(email);
userSelected.setAddress(address);
userSelected.setPhone(phone);
userSelected.setFullName(fullname.trim());
userSelected.setEmail(email.trim());
userSelected.setAddress(address.trim());
userSelected.setPhone(phone.trim());
userSelected.setGender(genderSelected);
UserValidation uv = new UserValidation();
// update to DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ public void registerUser() throws IOException {

public User setUserInformation() {
User user = new User();
user.setAddress(address);
user.setEmail(email);
user.setFullName(fullname);
user.setGender(gender);
user.setAddress(address.trim());
user.setEmail(email.trim());
user.setFullName(fullname.trim());
user.setGender(gender.trim());
user.setPassword(EncryptedPassword.encrytePassword(password));
user.setPhone(phone);
user.setUsername(username);
user.setPhone(phone.trim());
user.setUsername(username.trim());
user.setUserStatus("ACTIVE");
user.setRole(UserRoleConstant.USER);

Expand Down
Loading

0 comments on commit 42a6a94

Please sign in to comment.