楼栋系数管理增加创建人和备注属性
This commit is contained in:
+19
-20
@@ -1,7 +1,9 @@
|
||||
package com.fangjia.bkoff.controllers;
|
||||
|
||||
import com.fangjia.bkoff.model.ApiUserModel;
|
||||
import com.fangjia.bkoff.model.BuildingRatioModel;
|
||||
import com.fangjia.dal.mongo.model.bkoff.BuildingRatio;
|
||||
import com.fangjia.dal.sql.model.User;
|
||||
import com.fangjia.service.bo.BuildingRatioBo;
|
||||
import com.fangjia.service.mongo.bkoff.BuildingRatioService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -24,14 +26,11 @@ public class BuildingRatioController {
|
||||
* @return
|
||||
*/
|
||||
public Object doAddAction(BuildingRatioModel model) throws Exception {
|
||||
if (StringUtils.isBlank(model.getCity_name()) || StringUtils.isBlank(model.getRegion())
|
||||
|| StringUtils.isBlank(model.getDistrict()) || StringUtils.isBlank(model.getBuilding_name())
|
||||
|| model.getRatio() == null || StringUtils.isBlank(model.getCreate_user())) {
|
||||
model.setMsg("城市,区域,小区,楼栋名称,楼栋系数,创建人不能为空");
|
||||
model.forward("/buildingRatio/add");
|
||||
return model;
|
||||
}
|
||||
try {
|
||||
if(checkBuildingNameAction(model)){
|
||||
model.redirect("/buildingRatio/add?msg=" + URLEncoder.encode(model.getMsg(), "UTF-8"));
|
||||
return model;
|
||||
}
|
||||
Date date = new Date();
|
||||
BuildingRatio buildingRatio = new BuildingRatio();
|
||||
buildingRatio.setCity(model.getCity_name());
|
||||
@@ -69,18 +68,7 @@ public class BuildingRatioController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Object updateAction(BuildingRatioModel model){
|
||||
String id = model.getId();
|
||||
if (StringUtils.isBlank(model.getCity_name()) ||
|
||||
StringUtils.isBlank(model.getRegion()) ||
|
||||
StringUtils.isBlank(model.getDistrict()) ||
|
||||
StringUtils.isBlank(model.getBuilding_name()) ||
|
||||
model.getRatio() == null || StringUtils.isBlank(model.getCreate_user())) {
|
||||
model.setMsg("城市,区域,小区,楼栋名称,楼栋系数,创建人不能为空");
|
||||
model.forward("/buildingRatio/edit");
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object updateAction(BuildingRatioModel model) throws Exception {
|
||||
Map<String, Object> data_buildingRatio = new HashMap<String, Object>();
|
||||
|
||||
data_buildingRatio.put("id", model.getId());
|
||||
@@ -103,7 +91,7 @@ public class BuildingRatioController {
|
||||
|
||||
public Object listAction(BuildingRatioModel model) {
|
||||
|
||||
List<BuildingRatio> buildingRatioList = this.buildingRatioService.findAllByDistrict(model.getCity_name(),model.getRegion(),model.getDistrict());
|
||||
List<BuildingRatio> buildingRatioList = this.buildingRatioService.findAllByBuildingName(model.getCity_name(),model.getRegion(),model.getDistrict(),model.getBuilding_name());
|
||||
|
||||
List<BuildingRatioBo> buildingRatioBoList = new ArrayList<BuildingRatioBo>();
|
||||
|
||||
@@ -158,6 +146,17 @@ public class BuildingRatioController {
|
||||
return model;
|
||||
}
|
||||
|
||||
public boolean checkBuildingNameAction(BuildingRatioModel model) {
|
||||
model.setViewType("json");
|
||||
model.setViewParam("config", null);
|
||||
List<BuildingRatio> buildingRatioList = buildingRatioService.findAllByBuildingName(model.getCity_name(),model.getRegion(),model.getDistrict(),model.getBuilding_name());
|
||||
if (buildingRatioList.size()>0) {
|
||||
model.setMsg("此楼栋名称已经存在!");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public BuildingRatioService getBuildingRatioService() {
|
||||
return buildingRatioService;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,37 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function submitForm(){
|
||||
var city_name = $("input[name='city_name']").val();
|
||||
var region = $("input[name='region']").val();
|
||||
var district = $("input[name='district']").val();
|
||||
var building_name = $("input[name='building_name']").val();
|
||||
var ratio = $("input[name='ratio']").val();
|
||||
var create_user = $("input[name='create_user']").val();
|
||||
|
||||
if(typeof(city_name) == "undefined" || city_name == ""){
|
||||
alert("城市不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(region) == "undefined" || region == ""){
|
||||
alert("区域不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(district) == "undefined" || district == ""){
|
||||
alert("小区名称不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(building_name) == "undefined" || building_name == ""){
|
||||
alert("楼栋名称不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(ratio) == "undefined" || ratio == ""){
|
||||
alert("楼栋系数不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(create_user) == "undefined" || create_user == ""){
|
||||
alert("创建人不能为空");
|
||||
return false;
|
||||
}
|
||||
$("#addForm").submit();
|
||||
}
|
||||
var getErrorValidate= function(mess){
|
||||
|
||||
@@ -73,6 +73,37 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function submitForm() {
|
||||
var city_name = $("input[name='city_name']").val();
|
||||
var region = $("input[name='region']").val();
|
||||
var district = $("input[name='district']").val();
|
||||
var building_name = $("input[name='building_name']").val();
|
||||
var ratio = $("input[name='ratio']").val();
|
||||
var create_user = $("input[name='create_user']").val();
|
||||
|
||||
if(typeof(city_name) == "undefined" || city_name == ""){
|
||||
alert("城市不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(region) == "undefined" || region == ""){
|
||||
alert("区域不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(district) == "undefined" || district == ""){
|
||||
alert("小区名称不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(building_name) == "undefined" || building_name == ""){
|
||||
alert("楼栋名称不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(ratio) == "undefined" || ratio == ""){
|
||||
alert("楼栋系数不能为空");
|
||||
return false;
|
||||
}
|
||||
if(typeof(create_user) == "undefined" || create_user == ""){
|
||||
alert("创建人不能为空");
|
||||
return false;
|
||||
}
|
||||
$("#submitForm").attr("action", "update");
|
||||
$("#submitForm").submit();
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ public interface BuildingRatioService {
|
||||
public void deleteById(String id);
|
||||
public void saveOrUpdateByBuildingName(String city, String region, String district, String building_name, Map<String, Object> data);
|
||||
public BuildingRatio findBuildingRatioById(String id);
|
||||
public List<BuildingRatio> findAllByDistrict(String city, String region, String district);
|
||||
public List<BuildingRatio> findAllByBuildingName(String city, String region, String district, String building_name);
|
||||
}
|
||||
|
||||
+4
-1
@@ -50,7 +50,7 @@ public class BuildingRatioServiceImpl implements BuildingRatioService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BuildingRatio> findAllByDistrict(String city, String region, String district) {
|
||||
public List<BuildingRatio> findAllByBuildingName(String city, String region, String district, String building_name) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
if(StringUtils.isNotBlank(city)){
|
||||
params.add(new QueryParam("city", city));
|
||||
@@ -61,6 +61,9 @@ public class BuildingRatioServiceImpl implements BuildingRatioService{
|
||||
if(StringUtils.isNotBlank(district)){
|
||||
params.add(new QueryParam("district", district));
|
||||
}
|
||||
if(StringUtils.isNotBlank(building_name)){
|
||||
params.add(new QueryParam("building_name", building_name));
|
||||
}
|
||||
|
||||
List<SortParam> sortParams = new ArrayList<SortParam>();
|
||||
sortParams.add(new SortParam("m_date", false));
|
||||
|
||||
Reference in New Issue
Block a user