Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/Dev_FixServiceGeoInfor'
Browse files Browse the repository at this point in the history
  • Loading branch information
tuansu2021998 committed Apr 24, 2020
2 parents 5f2a9a1 + 1359545 commit e1a8365
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import com.google.gson.Gson;

import capstone.lip.landinformationportal.business.service.Interface.IHouseService;
import capstone.lip.landinformationportal.business.service.Interface.IHousesDetailService;
import capstone.lip.landinformationportal.business.service.Interface.IHousesFeatureService;
Expand All @@ -37,6 +39,7 @@
import capstone.lip.landinformationportal.common.dto.HouseFeatureValue;
import capstone.lip.landinformationportal.common.dto.LandFeatureValue;
import capstone.lip.landinformationportal.common.entity.District;
import capstone.lip.landinformationportal.common.entity.FormedCoordinate;
import capstone.lip.landinformationportal.common.entity.House;
import capstone.lip.landinformationportal.common.entity.HousesDetail;
import capstone.lip.landinformationportal.common.entity.HousesFeature;
Expand Down Expand Up @@ -112,7 +115,6 @@ public class ContributeNewRealEstateBean implements Serializable {
private String lngSingleCoordinate;
private String latSingleCoordinate;
private List<Coordinate> listCoordinate;
private String jsonMultipleCoordinate;

private String landFeatureIdSelected = "";
private String houseFeatureIdSelected = "";
Expand Down Expand Up @@ -617,7 +619,7 @@ public void provinceChange() {
segmentStreetIdSelected = "";
nameInput = selectedProvince.getProvinceName();

PrimeFaces.current().executeScript("focusMap(" + selectedProvince.getProvinceLat() + ", " + selectedProvince.getProvinceLng() + ");");
PrimeFaces.current().executeScript("focusMap(" + selectedProvince.getProvinceLat() + ", " + selectedProvince.getProvinceLng() + ", 15);");
} else {
listDistrict = new ArrayList<>();
listStreet = new ArrayList<>();
Expand All @@ -635,7 +637,7 @@ public void districtChange() {
segmentStreetIdSelected = "";

selectedDistrict = listDistrict.stream().filter(x -> x.getDistrictId().equals(Long.parseLong(districtIdSelected))).collect(Collectors.toList()).get(0);
PrimeFaces.current().executeScript("focusMap(" + selectedDistrict.getDistrictLat() + ", " + selectedDistrict.getDistrictLng() + ");");
PrimeFaces.current().executeScript("focusMap(" + selectedDistrict.getDistrictLat() + ", " + selectedDistrict.getDistrictLng() + ", 17);");
PrimeFaces.current().executeScript("changeInfo(\"" + selectedDistrict.getDistrictName() + "\", " + selectedDistrict.getDistrictLng() + ", "
+ selectedDistrict.getDistrictLat() + ")");
listSegmentOfStreet = selectedDistrict.getListSegmentOfStreet();
Expand All @@ -657,7 +659,7 @@ public void streetChange() {
segmentStreetIdSelected = "";

selectedStreet = listStreet.stream().filter(x -> x.getStreetId().equals((Long.parseLong(streetIdSelected)))).collect(Collectors.toList()).get(0);
PrimeFaces.current().executeScript("focusMap(" + selectedStreet.getStreetLat() + ", " + selectedStreet.getStreetLng() + ");");
PrimeFaces.current().executeScript("focusMap(" + selectedStreet.getStreetLat() + ", " + selectedStreet.getStreetLng() + ", 19);");
PrimeFaces.current().executeScript("changeInfo(\"" + selectedStreet.getStreetName() + "\", " + selectedStreet.getStreetLat() + ", "
+ selectedStreet.getStreetLng() + ")");

Expand All @@ -675,11 +677,23 @@ public void segmentStreetChange() {
if (segmentStreetIdSelected != null && !segmentStreetIdSelected.equals("")) {
processType = "4";
segmentOfStreet = listSegmentOfStreet.stream().filter(x -> x.getSegmentId().equals(Long.parseLong(segmentStreetIdSelected))).collect(Collectors.toList()).get(0);
PrimeFaces.current().executeScript("focusMap(" + segmentOfStreet.getSegmentLat() + ", " + segmentOfStreet.getSegmentLng() + ");");
PrimeFaces.current().executeScript("clearDataMap()");
PrimeFaces.current().executeScript("focusMap(" + segmentOfStreet.getSegmentLat() + ", " + segmentOfStreet.getSegmentLng() + ", 19);");
PrimeFaces.current().executeScript("changeInfo(\"" + segmentOfStreet.getSegmentName() + "\", " + segmentOfStreet.getSegmentLat() + ", "
+ segmentOfStreet.getSegmentLng() + ")");

PrimeFaces.current().executeScript("updateDeleteOld()");
List<FormedCoordinate> listFormedCoordinate = segmentOfStreet.getListFormedCoordinate();
List<Coordinate> listCoordinate = listFormedCoordinate.stream()
.map(x->{
Coordinate coor = new Coordinate(x.getFormedLng(), x.getFormedLat());
return coor;
}).collect(Collectors.toList());
Gson gson = new Gson();
String jsonMultipleCoordinate = gson.toJson(listCoordinate);

PrimeFaces.current().executeScript("drawPath('"+jsonMultipleCoordinate+"')");

} else {
segmentStreetIdSelected = "";
segmentOfStreet = null;
Expand Down Expand Up @@ -872,14 +886,6 @@ public void setListCoordinate(List<Coordinate> listCoordinate) {
this.listCoordinate = listCoordinate;
}

public String getJsonMultipleCoordinate() {
return jsonMultipleCoordinate;
}

public void setJsonMultipleCoordinate(String jsonMultipleCoordinate) {
this.jsonMultipleCoordinate = jsonMultipleCoordinate;
}

public Province getSelectedProvince() {
return selectedProvince;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public void showPopup(Long realEstateId) {
listDistrict = null;
listStreet = null;
listSegment = null;
listAdjacentSegment = null;
listAdjacentSegment = realEstate.getListRealEstateAdjacentSegment();
provinceIdSelected = "";
districtIdSelected = "";
streetIdSelected = "";
roadSegmentIdSelected = "";
singleLat = realEstate.getRealEstateLat().toString();
singleLng = realEstate.getRealEstateLng().toString();
singleLat = "";
singleLng = "";

if (realEstate.getListRealEstateAdjacentSegment() != null) {
if (realEstate.getListRealEstateAdjacentSegment() != null && !realEstate.getListRealEstateAdjacentSegment().isEmpty()) {
segmentConfuse = false;
}else {
segmentConfuse = true;
Expand Down Expand Up @@ -140,8 +140,14 @@ public void segmentStreetChange() {
PrimeFaces.current().executeScript("drawPath('"+json+"')");
}
public void saveSegmentToReo() {

List<RealEstate> listRealEstateByCoordinate = realEstateService.findByRealEstateLatAndRealEstateLng(realEstate.getRealEstateLat(), realEstate.getRealEstateLng());
try {
Double.parseDouble(singleLat);
Double.parseDouble(singleLng);
}catch (Exception e) {
setMessage(FacesMessage.SEVERITY_ERROR, "Tọa độ không hợp lệ");
return;
}
List<RealEstate> listRealEstateByCoordinate = realEstateService.findByRealEstateLatAndRealEstateLng(Double.parseDouble(singleLat), Double.parseDouble(singleLng));
if (listRealEstateByCoordinate == null || (listRealEstateByCoordinate!=null && listRealEstateByCoordinate.isEmpty())) {
coordinateConfuse = false;
}else {
Expand All @@ -155,15 +161,21 @@ public void saveSegmentToReo() {
}



if (listAdjacentSegment == null || listAdjacentSegment.isEmpty()) {
setMessage(FacesMessage.SEVERITY_ERROR, "Chưa chọn đoạn đường");
return;
}

realEstateAdjacentSegmentService.save(listAdjacentSegment);

realEstate = realEstateService.findById(realEstate.getRealEstateId());
realEstate.setRealEstateLng(Double.parseDouble(singleLng));
realEstate.setRealEstateLat(Double.parseDouble(singleLat));
realEstate.setRealEstateStatus(String.valueOf(StatusRealEstateConstant.VERIFIED));
realEstateService.save(realEstate);
setMessage(FacesMessage.SEVERITY_INFO, "Chỉnh sửa thành công");
PrimeFaces.current().executeScript("PF('alert').renderMessage({\"summary\":\"Thành công\",\"detail\":\"Chỉnh sửa thành công\",\"severity\":\"info\"})");
showPopup = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import capstone.lip.landinformationportal.common.entity.audit.AuditAbstract;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import capstone.lip.landinformationportal.common.entity.audit.AuditAbstract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
Expand All @@ -17,8 +16,6 @@
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import capstone.lip.landinformationportal.common.entity.audit.AuditAbstract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
Expand All @@ -12,13 +10,10 @@
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import capstone.lip.landinformationportal.common.entity.audit.AuditAbstract;
@Entity
Expand Down
68 changes: 38 additions & 30 deletions src/main/webapp/admin/listuser.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,47 @@
<head>
</head>
<body>
<h:outputStylesheet name="listallrealestate.css" library="css" />
<h:outputStylesheet name="bootstrap.min.css" library="css" />
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces" />
<ui:composition template="/template/admin/adminLayout.xhtml">
<ui:define name="content">
<h:outputStylesheet name="listallrealestate.css" library="css" />
<h:outputStylesheet name="color.css" library="css"/>
<h:outputStylesheet name="bootstrap.min.css" library="css" />
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces" />
<h:form id="table-user" prependId="false">

<h:commandButton id="btn-UnbanUser"
value="Vô hiệu"
action="#{listUserBean.banUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
<h:commandButton id="btn-BanUser"
value="Kích hoạt"
action="#{listUserBean.unbanUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
<h:commandButton id="btn-ChangeUserRoleAdmin"
value="Phân quyền Admin"
action="#{listUserBean.changeUserRoleAdmin()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
<h:commandButton id="btn-ChangeUserRoleContributor"
value="Phân quyền User"
action="#{listUserBean.changeUserRoleUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
<h:commandButton id="btn-ResetPassword"
value="Đặt lại mật khẩu"
action="#{listUserBean.resetPassword()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>

<div class="row" style="margin-bottom:10px;">
<div class="col">
<h:commandButton id="btn-UnbanUser" class="btn btn-block bg-deep-orange waves-effect"
value="Vô hiệu" action="#{listUserBean.banUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
</div>
<div class="col">
<h:commandButton id="btn-BanUser" class="btn btn-block btn-success waves-effect"
value="Kích hoạt"
action="#{listUserBean.unbanUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
</div>
<div class="col">
<h:commandButton id="btn-ChangeUserRoleAdmin" class="btn btn-block btn-primary waves-effect"
value="Phân quyền Admin" action="#{listUserBean.changeUserRoleAdmin()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
</div>
<div class="col">
<h:commandButton id="btn-ChangeUserRoleContributor" class="btn btn-block bg-indigo waves-effect"
value="Phân quyền User" action="#{listUserBean.changeUserRoleUser()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
</div>
<div class="col">
<h:commandButton id="btn-ResetPassword" class="btn btn-block bg-blue-grey waves-effect"
value="Đặt lại mật khẩu"
action="#{listUserBean.resetPassword()}">
<p:ajax process="@form" update="table-user"/>
</h:commandButton>
</div>
</div>
<p:dataTable var="user" rowIndexVar="index" id="table"
value="#{listUserBean.lazyUser}"
rowKey="#{user.userId}"
Expand Down
28 changes: 21 additions & 7 deletions src/main/webapp/admin/managecrawlrealestate.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,31 @@
</p:dataTable>
<h:panelGroup id="popup" layout="block" styleClass="popup-panel-overlay"
rendered="#{manageCrawlRealEstateSetRoadSegmentBean.showPopup}">

<p:growl id="msgs_popup" showDetail="true" widgetVar="alert_popup"/>
<div class="popup-panel">
<c:set var="beanPopup" value="${manageCrawlRealEstateSetRoadSegmentBean}"></c:set>
<div class="row">
<div class="col-3">
<div>
<h:outputText value="Cần cập nhập tọa độ" rendered="#{beanPopup.coordinateConfuse}"></h:outputText>
<h:outputText value="Cần cập nhật đoạn đường" rendered="#{beanPopup.segmentConfuse}"></h:outputText>
<h:panelGroup rendered="#{beanPopup.coordinateConfuse}">
<span class="badge badge-danger">Tọa độ bị trùng</span>
</h:panelGroup>
<h:panelGroup rendered="#{beanPopup.segmentConfuse}">
<span class="badge badge-danger">Chưa cập nhật đoạn đường</span>
</h:panelGroup>
#{beanPopup.coordinateConfuse}
#{beanPopup.segmentConfuse}
</div>
<div class="form-group row">
<div class="col">
Địa chỉ: #{beanPopup.realEstate.realEstateAddress}
<div class="form-group">
<div class="row">
<div class="col">
Địa chỉ: #{beanPopup.realEstate.realEstateAddress}
</div>
</div>
<div class="row">
<div class="col">
<a href="#{beanPopup.realEstate.realEstateLink}" target="_blank" class="badge badge-light">Source Link</a>
</div>
</div>
</div>
<div class="form-group row">
Expand Down Expand Up @@ -186,7 +199,7 @@
<div class="col text-center">
<h:commandButton value="Lưu chỉnh sửa" class="btn btn-block btn-info waves-effect"
action="#{beanPopup.saveSegmentToReo()}">
<p:ajax process="popup" update="popup" oncomplete="initMap(#{beanPopup.realEstate.realEstateLat},#{beanPopup.realEstate.realEstateLng})">
<p:ajax process="tabledata" update="tabledata" oncomplete="initMap(#{beanPopup.realEstate.realEstateLat},#{beanPopup.realEstate.realEstateLng})">

</p:ajax>
<ui:remove>
Expand All @@ -199,6 +212,7 @@
<div class="col text-center">
<h:commandButton value="Đóng cửa sổ" class="btn btn-block btn-warning waves-effect" action="#{beanPopup.hidePopup()}">
<f:ajax render="tabledata"/>
<f:actionListener binding="#{manageCrawlRealEstateBean.refreshData()}"></f:actionListener>
</h:commandButton>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/main/webapp/resources/css/color.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.bg-deep-orange {
background-color: #FF5722 !important;
color: #fff;
}
.bg-indigo {
background-color: #3F51B5 !important;
color: #fff;
}
.bg-blue-grey {
background-color: #607D8B !important;
color: #fff;
}
Loading

0 comments on commit e1a8365

Please sign in to comment.