Browse Source

后台热点详情的修改

Signed-off-by: you.chen <you.chen@cloudcross.com>
you.chen 9 years ago
parent
commit
7b6cb1c1e6

+ 33 - 0
src/main/java/com/cloudcross/ssp/model/PlaceClass.java

@@ -0,0 +1,33 @@
+package com.cloudcross.ssp.model;
+
+/**
+ * 数聚场景和数聚子场景的对应关系表对应数据库表t_place_class
+ * @author chenyou
+ *
+ */
+public class PlaceClass {
+	//数聚场景id
+	private Long classId;
+	//数聚子场景id
+	private Long placeId;
+	
+	public Long getClassId() {
+		return classId;
+	}
+	public void setClassId(Long classId) {
+		this.classId = classId;
+	}
+	public Long getPlaceId() {
+		return placeId;
+	}
+	public void setPlaceId(Long placeId) {
+		this.placeId = placeId;
+	}
+	
+	@Override
+	public String toString() {
+		return "PlaceClass [classId=" + classId + ", placeId=" + placeId + "]";
+	}
+	
+	
+}

+ 46 - 0
src/main/java/com/cloudcross/ssp/model/PlaceClassInformation.java

@@ -0,0 +1,46 @@
+package com.cloudcross.ssp.model;
+
+import com.cloudcross.ssp.web.widget.SelectorController.ISelector;
+
+/**
+ * 云联定义的数聚场景的表信息,对应数据库的t_place_class_info
+ * @author chenyou
+ *
+ */
+public class PlaceClassInformation implements ISelector{
+	//主键
+	private Long id;
+	//数聚场景名称
+	private String name;
+	public Long getId() {
+		return id;
+	}
+	
+	public void setId(Long id) {
+		this.id = id;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	@Override
+	public String toString() {
+		return "PlaceClassInformation [id=" + id + ", name=" + name + "]";
+	}
+
+	@Override
+	public String getLabel() {
+		return this.name;
+	}
+
+	@Override
+	public String getValue() {
+		return String.valueOf(this.id);
+	}
+	
+	
+	
+}

+ 1 - 1
src/main/java/com/cloudcross/ssp/model/PlaceOperator.java

@@ -1,7 +1,7 @@
 package com.cloudcross.ssp.model;
 package com.cloudcross.ssp.model;
 
 
 /**
 /**
- * 运营商定义的场景名称和云联定义场景名称对对应表
+ * 运营商定义的场景名称和云联定义数聚子场景名称对对应表
  * 对应数据库的t_place_operator表
  * 对应数据库的t_place_operator表
  * @author chenyou
  * @author chenyou
  *
  *

+ 12 - 3
src/main/java/com/cloudcross/ssp/model/Wifi.java

@@ -26,8 +26,10 @@ public class Wifi {
 	private String place;
 	private String place;
 	//场景id,这是云联自己定义的场景名称对应的id
 	//场景id,这是云联自己定义的场景名称对应的id
 	private Long placeId;
 	private Long placeId;
-	//场景名称,这是云联自己定义的场景名称,在联表查询时使用
+	//数聚场景子场景在联表查询时使用
 	private String placeName;
 	private String placeName;
+	//数聚场景名称在联表查询时使用
+	private String placeClassName;
 	//运营商id
 	//运营商id
 	private Long operatorId;
 	private Long operatorId;
 	//状态,0-开启,1-暂停,-1-删除
 	//状态,0-开启,1-暂停,-1-删除
@@ -35,6 +37,12 @@ public class Wifi {
 	//更新时间
 	//更新时间
 	private Date updated;
 	private Date updated;
 	
 	
+	public String getPlaceClassName() {
+		return placeClassName;
+	}
+	public void setPlaceClassName(String placeClassName) {
+		this.placeClassName = placeClassName;
+	}
 	public String getCn() {
 	public String getCn() {
 		return cn;
 		return cn;
 	}
 	}
@@ -139,8 +147,9 @@ public class Wifi {
 				+ cnCity + ", apmac=" + apmac + ", address=" + address
 				+ cnCity + ", apmac=" + apmac + ", address=" + address
 				+ ", longitude=" + longitude + ", latitude=" + latitude
 				+ ", longitude=" + longitude + ", latitude=" + latitude
 				+ ", place=" + place + ", placeId=" + placeId + ", placeName="
 				+ ", place=" + place + ", placeId=" + placeId + ", placeName="
-				+ placeName + ", operatorId=" + operatorId + ", status="
-				+ status + ", updated=" + updated + "]";
+				+ placeName + ", placeClassName=" + placeClassName
+				+ ", operatorId=" + operatorId + ", status=" + status
+				+ ", updated=" + updated + "]";
 	}
 	}
 	
 	
 	
 	

+ 13 - 0
src/main/java/com/cloudcross/ssp/model/mapper/place-class.sql.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="placeClassSqlMapper">
+
+	<insert id="add" parameterType="PlaceClass">
+		insert into t_place_class(place_id, class_id) values(#{placeId}, #{classId})
+	</insert>
+	
+	
+	<delete id="deletePlaceClass" parameterType="long">
+		delete from t_place_class where place_id = #{placeId}
+	</delete>
+</mapper>

+ 0 - 5
src/main/java/com/cloudcross/ssp/model/mapper/place-operator.sql.xml

@@ -75,11 +75,6 @@
 		</if>
 		</if>
 	</select>
 	</select>
 	
 	
-	<select id="findPlaceDefindedByOperator" parameterType="long" resultType="PlaceOperator">
-	select <include refid="base_column" /> from t_place_operator where place_id = #{placeId}
-	</select>
-	
-	
 	<update id="deleteRelationShip" parameterType="long">
 	<update id="deleteRelationShip" parameterType="long">
 		update t_place_operator set place_id = 0 where id = #{id}
 		update t_place_operator set place_id = 0 where id = #{id}
 	</update>
 	</update>

+ 10 - 0
src/main/java/com/cloudcross/ssp/model/mapper/place.sql.xml

@@ -41,4 +41,14 @@
 	<insert id="add" parameterType="Place">
 	<insert id="add" parameterType="Place">
 	insert into t_place(name) values(#{name})
 	insert into t_place(name) values(#{name})
 	</insert>
 	</insert>
+	
+	<select id="findUnclassfiedPlace" resultType="Place">
+	select <include refid="base_column"/> from t_place
+	where id not in(select place_id from t_place_class)
+	</select>
+	
+	<select id="findPlaceByPlaceClassId" parameterType="long" resultType="Place">
+		select t_place.id as id, t_place.name as name from t_place
+		where id in (select place_id from t_place_class where class_id = #{placeClassId})
+	</select>
 </mapper>
 </mapper>

+ 21 - 0
src/main/java/com/cloudcross/ssp/model/mapper/placeclass-information.sql.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="placeClassInformationSqlMapper">
+	
+	<select id="findById" parameterType="long" resultType="PlaceClassInformation">
+		select id, name from t_place_class_info
+		where id = #{id}
+	</select>
+	
+	<select id="findPlaceClassByOperatorId" parameterType="long" resultType="map">
+		select i.id as id, i.name as name from t_place_operator o, t_place_class c, t_place_class_info i
+		where o.place_id = c.place_id and c.class_id = i.id
+		<if test="operatorId != null">
+			o.operator_id = #{operatorId}
+		</if>
+	</select>
+	
+	<select id="findAll" resultType="PlaceClassInformation">
+		select * from t_place_class_info
+	</select>
+</mapper>

+ 33 - 21
src/main/java/com/cloudcross/ssp/model/mapper/wifi.sql.xml

@@ -26,10 +26,12 @@
 	</sql>
 	</sql>
 	
 	
 	<select id="countByParamsBack" parameterType="map" resultType="int">
 	<select id="countByParamsBack" parameterType="map" resultType="int">
-		select count(w.id) from t_wifi w, t_location l
-		<where>
-			w.location = l.location and w.status != -1 
-			<if test="operatorId != null">
+		select count(c.wifiId) from 
+		(
+		select t_wifi.id as wifiId, t_wifi.place_id as placeId from  t_wifi w, t_location l 
+		where 
+		w.location = l.location and w.status != -1 
+		<if test="operatorId != null">
 				and w.operator_id = #{operatorId}
 				and w.operator_id = #{operatorId}
 			</if>
 			</if>
 			<if test="cn != null">
 			<if test="cn != null">
@@ -38,24 +40,28 @@
 			<if test="cnCity != null">
 			<if test="cnCity != null">
 				and l.cn_city = #{cnCity}
 				and l.cn_city = #{cnCity}
 			</if>
 			</if>
-			<if test="placeId != null">
-				and w.place_id = #{placeId}
-			</if>
 			<if test="place != null">
 			<if test="place != null">
 				and w.place = #{place}
 				and w.place = #{place}
 			</if>
 			</if>
 			<if test="mac != null">
 			<if test="mac != null">
 				and (w.apmac like #{mac})
 				and (w.apmac like #{mac})
 			</if>
 			</if>
-		</where> 
+			) as c left join t_place_class pc on c.placeId = pc.place_id
+			<where>
+			<if test="placeClassId != null">
+				and pc.class_id = #{placeClassId}
+			</if>
+			</where>
 	</select>
 	</select>
 	
 	
 	<select id="findByParamsBack" parameterType="map" resultType="Wifi">
 	<select id="findByParamsBack" parameterType="map" resultType="Wifi">
+	select c.*, t_place_class_info.name as placeClassName from
+		(
 		select 
 		select 
 		<include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName, t_operator.company_name as operatorName
 		<include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName, t_operator.company_name as operatorName
 		from t_wifi, t_location, t_place, t_operator
 		from t_wifi, t_location, t_place, t_operator
 		<where>
 		<where>
-			t_wifi.location = t_location.location and t_wifi.place_id = t_place.id and t_wifi.operator_id = t_operator.id
+			t_wifi.location = t_location.location and t_wifi.place_id = t_place.id and t_wifi.operator_id = t_operator.id 
 			and t_wifi.status != -1 
 			and t_wifi.status != -1 
 			<if test="operatorId != null">
 			<if test="operatorId != null">
 				and t_wifi.operator_id = #{operatorId}
 				and t_wifi.operator_id = #{operatorId}
@@ -66,25 +72,29 @@
 			<if test="cnCity != null">
 			<if test="cnCity != null">
 				and t_location.cn_city = #{cnCity}
 				and t_location.cn_city = #{cnCity}
 			</if>
 			</if>
-			<if test="placeId != null">
-				and t_wifi.place_id = #{placeId}
-			</if>
 			<if test="place != null">
 			<if test="place != null">
 				and t_wifi.place = #{place}
 				and t_wifi.place = #{place}
 			</if>
 			</if>
 			<if test="mac != null">
 			<if test="mac != null">
 				and (t_wifi.apmac like #{mac})
 				and (t_wifi.apmac like #{mac})
 			</if>
 			</if>
-		</where> 
-		limit #{pager.offset}, #{pager.limit}
+		</where>
+		) as c left join t_place_class pc on c.placeId = pc.place_id 
+        left join t_place_class_info on pc.class_id = t_place_class_info.id
+        <if test="placeClassId != null">
+				and pc.class_id = #{placeClassId}
+		</if>
+        limit #{pager.offset}, #{pager.limit}
 	</select>
 	</select>
 	
 	
 	<select id="findByParams1Back" parameterType="map" resultType="Wifi">
 	<select id="findByParams1Back" parameterType="map" resultType="Wifi">
+		select c.*, t_place_class_info.name as placeClassName from
+		(
 		select 
 		select 
 		<include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName, t_operator.company_name as operatorName
 		<include refid="base_column" />, t_location.cn as cn, t_location.cn_city as cnCity, t_place.name as placeName, t_operator.company_name as operatorName
 		from t_wifi, t_location, t_place, t_operator
 		from t_wifi, t_location, t_place, t_operator
 		<where>
 		<where>
-			t_wifi.location = t_location.location and t_wifi.place_id = t_place.id and t_wifi.operator_id = t_operator.id
+			t_wifi.location = t_location.location and t_wifi.place_id = t_place.id and t_wifi.operator_id = t_operator.id 
 			and t_wifi.status != -1 
 			and t_wifi.status != -1 
 			<if test="operatorId != null">
 			<if test="operatorId != null">
 				and t_wifi.operator_id = #{operatorId}
 				and t_wifi.operator_id = #{operatorId}
@@ -95,16 +105,18 @@
 			<if test="cnCity != null">
 			<if test="cnCity != null">
 				and t_location.cn_city = #{cnCity}
 				and t_location.cn_city = #{cnCity}
 			</if>
 			</if>
-			<if test="placeId != null">
-				and t_wifi.place_id = #{placeId}
-			</if>
 			<if test="place != null">
 			<if test="place != null">
 				and t_wifi.place = #{place}
 				and t_wifi.place = #{place}
 			</if>
 			</if>
-			<if test="searchValue != null">
-				and (t_wifi.apmac like #{searchValue})
+			<if test="mac != null">
+				and (t_wifi.apmac like #{mac})
 			</if>
 			</if>
-		</where> 
+		</where>
+		) as c left join t_place_class pc on c.placeId = pc.place_id 
+        left join t_place_class_info on pc.class_id = t_place_class_info.id
+        <if test="placeClassId != null">
+				and pc.class_id = #{placeClassId}
+		</if>
 	</select>
 	</select>
 	
 	
 	<select id="countByParamsOperator" parameterType="map" resultType="int">
 	<select id="countByParamsOperator" parameterType="map" resultType="int">

+ 30 - 0
src/main/java/com/cloudcross/ssp/service/IPlaceClassInformationService.java

@@ -0,0 +1,30 @@
+package com.cloudcross.ssp.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.cloudcross.ssp.base.service.IGenericService;
+import com.cloudcross.ssp.model.PlaceClassInformation;
+
+
+/**
+ * 数聚场景服务接口定义
+ * @author chenyou
+ *
+ */
+public interface IPlaceClassInformationService extends IGenericService<PlaceClassInformation> {
+	
+	/**
+	 * 根据运营商查找与这个运营商对应的数聚场景
+	 * @param operatorId
+	 * @return
+	 */
+	List<Map<Long, String>> findPlaceClassByOperatorId(Long operatorId);
+	
+	/**
+	 * 查找所有的数聚场景
+	 * @return
+	 */
+	List<PlaceClassInformation> findAll();
+	
+}

+ 18 - 0
src/main/java/com/cloudcross/ssp/service/IPlaceClassService.java

@@ -0,0 +1,18 @@
+package com.cloudcross.ssp.service;
+
+import com.cloudcross.ssp.base.service.IGenericService;
+import com.cloudcross.ssp.model.PlaceClass;
+
+/**
+ * 数聚场景和其子场景对应关系服务接口
+ * @author chenyou
+ *
+ */
+public interface IPlaceClassService extends IGenericService<PlaceClass> {
+	/**
+	 * 根据数聚子场景id删除它和数聚场景的对应关系
+	 * @param place_id
+	 * @return
+	 */
+	boolean deletePlaceClass(Long placeId);
+}

+ 0 - 14
src/main/java/com/cloudcross/ssp/service/IPlaceOperatorService.java

@@ -39,20 +39,6 @@ public interface IPlaceOperatorService extends IGenericService<PlaceOperator> {
 			Pager pager);
 			Pager pager);
 	List<PlaceOperator> findByParamsBack(Map<String, Object> paramMap);
 	List<PlaceOperator> findByParamsBack(Map<String, Object> paramMap);
 	
 	
-	/**
-	 * 根据数聚场景id查找对应的所有的场景(运营商定义的)
-	 * @param placeId
-	 * @return
-	 */
-	List<PlaceOperator> findPlaceDefindedByOperator(Long placeId);
-	
-	/**
-	 * 删除该场景所对应的数聚场景,即将它对应的数聚场景id变为0
-	 * @param placeId
-	 * @return
-	 */
-	boolean deleteRelationShip(Long id);
-
 	/**
 	/**
 	 * 查找未分类的场景的条数
 	 * 查找未分类的场景的条数
 	 * @param paramMap
 	 * @param paramMap

+ 13 - 0
src/main/java/com/cloudcross/ssp/service/IPlaceService.java

@@ -9,4 +9,17 @@ public interface IPlaceService extends IGenericService<Place> {
 
 
 	List<Place> findPlace();
 	List<Place> findPlace();
 	public List<Place> findAll();
 	public List<Place> findAll();
+	
+	/**
+	 * 查找未分类的数聚子场景
+	 * @return
+	 */
+	List<Place> findUnclassfiedPlace();
+	
+	/**
+	 * 根据数聚场景id得到对应的数聚子场景
+	 * @param placeClassId
+	 * @return
+	 */
+	List<Place> findPlaceByPlaceClassId(Long placeClassId);
 }
 }

+ 80 - 0
src/main/java/com/cloudcross/ssp/service/impl/PlaceClassInformationService.java

@@ -0,0 +1,80 @@
+package com.cloudcross.ssp.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.cloudcross.ssp.base.dao.GenericIBatisDao;
+import com.cloudcross.ssp.common.utils.MapBuilder;
+import com.cloudcross.ssp.common.utils.Pager;
+import com.cloudcross.ssp.model.PlaceClassInformation;
+import com.cloudcross.ssp.service.IPlaceClassInformationService;
+import com.cloudcross.ssp.web.widget.SelectorController.ISelector;
+import com.cloudcross.ssp.web.widget.SelectorController.ISelectorProvider;
+
+@Service
+public class PlaceClassInformationService implements IPlaceClassInformationService, ISelectorProvider {
+	private static final Logger LOG = Logger.getLogger(PlaceClassInformationService.class);
+	
+	@Autowired
+	private GenericIBatisDao myBatisDao;
+	
+	@Override
+	public PlaceClassInformation findById(Long id) {
+		return myBatisDao.get("placeClassInformationSqlMapper.findById", id);
+	}
+
+	@Override
+	public int countByParams(Map<String, Object> paramMap) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public List<PlaceClassInformation> findByParams(
+			Map<String, Object> paramMap, Pager pager) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean add(PlaceClassInformation t) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean edit(PlaceClassInformation t) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean updateStatus(List<Long> idList, int status) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public List<Map<Long, String>> findPlaceClassByOperatorId(Long operatorId) {
+		return myBatisDao.getList("placeClassInformationSqlMapper.findPlaceClassByOperatorId", operatorId);
+	}
+
+	@Override
+	public List<PlaceClassInformation> findAll() {
+		return myBatisDao.getList("placeClassInformationSqlMapper.findAll");
+	}
+
+	@Override
+	public Map<String, List<? extends ISelector>> provideData(String[] parentId) {
+		List<PlaceClassInformation> placeClassInformationList = findAll();
+		return MapBuilder.create(HashMap.class).add("placeClassInformationList", placeClassInformationList)
+				.map();
+	}
+
+}

+ 62 - 0
src/main/java/com/cloudcross/ssp/service/impl/PlaceClassService.java

@@ -0,0 +1,62 @@
+package com.cloudcross.ssp.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.cloudcross.ssp.base.dao.GenericIBatisDao;
+import com.cloudcross.ssp.common.utils.Pager;
+import com.cloudcross.ssp.model.PlaceClass;
+import com.cloudcross.ssp.service.IPlaceClassService;
+
+@Service
+public class PlaceClassService implements IPlaceClassService {
+	@Autowired
+	private GenericIBatisDao myBatisDao;
+	
+	@Override
+	public PlaceClass findById(Long id) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public int countByParams(Map<String, Object> paramMap) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public List<PlaceClass> findByParams(Map<String, Object> paramMap,
+			Pager pager) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean add(PlaceClass t) {
+		myBatisDao.save("placeClassSqlMapper.add", t);
+		return true;
+	}
+
+	@Override
+	public boolean edit(PlaceClass t) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean updateStatus(List<Long> idList, int status) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean deletePlaceClass(Long placeId) {
+		myBatisDao.delete("placeClassSqlMapper.deletePlaceClass", placeId);
+		return true;
+	}
+	
+}

+ 0 - 10
src/main/java/com/cloudcross/ssp/service/impl/PlaceOperatorService.java

@@ -91,11 +91,6 @@ public class PlaceOperatorService implements IPlaceOperatorService{
 		return myBatisDao.getList("placeOperatorSqlMapper.findByParams1Back", paramMap);
 		return myBatisDao.getList("placeOperatorSqlMapper.findByParams1Back", paramMap);
 	}
 	}
 	
 	
-	@Override
-	public List<PlaceOperator> findPlaceDefindedByOperator(Long placeId) {
-		return myBatisDao.getList("placeOperatorSqlMapper.findPlaceDefindedByOperator", placeId);
-	}
-	
 	
 	
 	@Override
 	@Override
 	public int countUnclassfiedPlace(Map<String, Object> paramMap) {
 	public int countUnclassfiedPlace(Map<String, Object> paramMap) {
@@ -113,9 +108,4 @@ public class PlaceOperatorService implements IPlaceOperatorService{
 		return true;
 		return true;
 	}
 	}
 
 
-	@Override
-	public boolean deleteRelationShip(Long id) {
-		myBatisDao.save("placeOperatorSqlMapper.deleteRelationShip", id);
-		return true;
-	}
 }
 }

+ 8 - 0
src/main/java/com/cloudcross/ssp/service/impl/PlaceService.java

@@ -57,6 +57,14 @@ public class PlaceService implements IPlaceService {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
 		return ibatisDao.getList("placeSqlMapper.findAll");
 		return ibatisDao.getList("placeSqlMapper.findAll");
 	}
 	}
+	@Override
+	public List<Place> findUnclassfiedPlace() {
+		return ibatisDao.getList("placeSqlMapper.findUnclassfiedPlace");
+	}
+	@Override
+	public List<Place> findPlaceByPlaceClassId(Long placeClassId) {
+		return ibatisDao.getList("placeSqlMapper.findPlaceByPlaceClassId", placeClassId);
+	}
 
 
 
 
 }
 }

+ 26 - 25
src/main/java/com/cloudcross/ssp/web/back/main/ap/ApmacController.java

@@ -38,6 +38,7 @@ import com.cloudcross.ssp.model.Wifi;
 import com.cloudcross.ssp.service.ILocationService;
 import com.cloudcross.ssp.service.ILocationService;
 import com.cloudcross.ssp.service.ILogService;
 import com.cloudcross.ssp.service.ILogService;
 import com.cloudcross.ssp.service.IOperatorService;
 import com.cloudcross.ssp.service.IOperatorService;
+import com.cloudcross.ssp.service.IPlaceClassInformationService;
 import com.cloudcross.ssp.service.IPlaceOperatorService;
 import com.cloudcross.ssp.service.IPlaceOperatorService;
 import com.cloudcross.ssp.service.IPlaceService;
 import com.cloudcross.ssp.service.IPlaceService;
 import com.cloudcross.ssp.service.IWifiService;
 import com.cloudcross.ssp.service.IWifiService;
@@ -66,11 +67,13 @@ public class ApmacController extends SimpleController {
 	private IPlaceService placeService;
 	private IPlaceService placeService;
 	@Autowired
 	@Autowired
 	private IOperatorService operatorService;
 	private IOperatorService operatorService;
+	@Autowired
+	private IPlaceClassInformationService placeClassInformationService;
 	
 	
 	/**
 	/**
 	 * 热点详情的列表页
 	 * 热点详情的列表页
 	 * 前端要传递几个参数,分别所选媒体的媒体Id(变量名为selectedOperatorId),省(变量名为cn),市(变量名为cnCity),场景(变量名为place,这个是运营商定义的场景名称,传过来传个场景名称就行),
 	 * 前端要传递几个参数,分别所选媒体的媒体Id(变量名为selectedOperatorId),省(变量名为cn),市(变量名为cnCity),场景(变量名为place,这个是运营商定义的场景名称,传过来传个场景名称就行),
-	 * 数聚场景id(变量名为placeId)
+	 * 数聚场景id(这个数聚场景是云联自己定义的,变量名为placeClassId)
 	 * 还有一个搜索参数,按mac地址搜索
 	 * 还有一个搜索参数,按mac地址搜索
 	 * 注:如果传过来的参数是空值或者空字符串或者没传,则按默认值进行搜索,默认的为全部
 	 * 注:如果传过来的参数是空值或者空字符串或者没传,则按默认值进行搜索,默认的为全部
 	 * @param model
 	 * @param model
@@ -87,13 +90,12 @@ public class ApmacController extends SimpleController {
 		String cn = null;
 		String cn = null;
 		String cnCity = null;
 		String cnCity = null;
 		String place = null;
 		String place = null;
-		Long placeId = null;
-		String placeName = null;
+		Long placeClassId = null;
+		String placeClassName = null;
 		
 		
 		/**
 		/**
 		 * 下面对传递过来的几个参数进行处理
 		 * 下面对传递过来的几个参数进行处理
 		 */
 		 */
-		System.out.println("little"+paramMap.get("selectedOperatorId")+paramMap.get("cn")+paramMap.get("cnCity"));
 		if(null != paramMap.get("selectedOperatorId") && !"".equals(paramMap.get("selectedOperatorId"))) {
 		if(null != paramMap.get("selectedOperatorId") && !"".equals(paramMap.get("selectedOperatorId"))) {
 			operatorId = Long.parseLong(String.valueOf(paramMap.get("selectedOperatorId")));
 			operatorId = Long.parseLong(String.valueOf(paramMap.get("selectedOperatorId")));
 		}
 		}
@@ -106,8 +108,8 @@ public class ApmacController extends SimpleController {
 			cnCity = String.valueOf(paramMap.get("cnCity"));
 			cnCity = String.valueOf(paramMap.get("cnCity"));
 		}
 		}
 		
 		
-		if(null != paramMap.get("placeId") && !"".equals(paramMap.get("placeId"))) {
-			placeId = Long.parseLong(String.valueOf(paramMap.get("placeId")));
+		if(null != paramMap.get("placeClassId") && !"".equals(paramMap.get("placeClassId"))) {
+			placeClassId = Long.parseLong(String.valueOf(paramMap.get("placeClassId")));
 		} 
 		} 
 		
 		
 		if(null != paramMap.get("place") && !"".equals(paramMap.get("place"))) {
 		if(null != paramMap.get("place") && !"".equals(paramMap.get("place"))) {
@@ -117,7 +119,7 @@ public class ApmacController extends SimpleController {
 		paramMap.put("operatorId", operatorId);
 		paramMap.put("operatorId", operatorId);
 		paramMap.put("cn", cn);
 		paramMap.put("cn", cn);
 		paramMap.put("cnCity", cnCity);
 		paramMap.put("cnCity", cnCity);
-		paramMap.put("placeId", placeId);
+		paramMap.put("placeClassId", placeClassId);
 		paramMap.put("place", place);
 		paramMap.put("place", place);
 		
 		
 		int totalRow = 0;
 		int totalRow = 0;
@@ -149,17 +151,17 @@ public class ApmacController extends SimpleController {
 			place = "场景";
 			place = "场景";
 		}
 		}
 		
 		
-		if(null == placeId) {
-			placeName = "数聚场景";
+		if(null == placeClassId) {
+			placeClassName = "数聚场景";
 		} else {
 		} else {
-			placeName = placeService.findById(placeId).getName();
+			placeClassName = placeClassInformationService.findById(placeClassId).getName();
 		}
 		}
 		
 		
 		paramMap.put("operatorName", operatorName);
 		paramMap.put("operatorName", operatorName);
 		paramMap.put("cn", cn);
 		paramMap.put("cn", cn);
 		paramMap.put("cnCity", cnCity);
 		paramMap.put("cnCity", cnCity);
 		paramMap.put("place", place);
 		paramMap.put("place", place);
-		paramMap.put("placeName", placeName);
+		paramMap.put("placeName", placeClassName);
 		model.addAttribute("pager",pager);
 		model.addAttribute("pager",pager);
 		model.addAllAttributes(paramMap);
 		model.addAllAttributes(paramMap);
 		model.addAttribute("wifiList", wifiList);
 		model.addAttribute("wifiList", wifiList);
@@ -268,16 +270,15 @@ public class ApmacController extends SimpleController {
 	 * 这里必须传递一个运营商id,因为是搜索某一个运营商下的场景
 	 * 这里必须传递一个运营商id,因为是搜索某一个运营商下的场景
 	 * @return
 	 * @return
 	 */
 	 */
-	@RequestMapping("/placeName")
+	@RequestMapping("/placeClassName")
 	public @ResponseBody
 	public @ResponseBody
 	List<Map<Long, String>> placeName(@RequestParam Long operatorId) {
 	List<Map<Long, String>> placeName(@RequestParam Long operatorId) {
 		if(null == operatorId) {
 		if(null == operatorId) {
 			System.out.println("传递的参数为空");
 			System.out.println("传递的参数为空");
 			return null;
 			return null;
 		}
 		}
-		System.out.println("hellowatch"+operatorId);
-		List<Map<Long, String>> placeNameList = placeOperatorService.findPlace(operatorId);
-		return placeNameList;
+		List<Map<Long, String>> placeClassNameList = placeClassInformationService.findPlaceClassByOperatorId(operatorId);
+		return placeClassNameList;
 	}
 	}
 	
 	
 	/**
 	/**
@@ -700,7 +701,7 @@ public class ApmacController extends SimpleController {
 	/**
 	/**
 	 * 导出热点详情列表页的excel
 	 * 导出热点详情列表页的excel
 	 * 前端要传递几个参数,分别所选媒体的媒体Id(变量名为selectedOperatorId),省(变量名为cn),市(变量名为cnCity),场景(变量名为place,这个是运营商定义的场景名称,传过来传个场景名称就行),
 	 * 前端要传递几个参数,分别所选媒体的媒体Id(变量名为selectedOperatorId),省(变量名为cn),市(变量名为cnCity),场景(变量名为place,这个是运营商定义的场景名称,传过来传个场景名称就行),
-	 * 数聚场景id(变量名为placeId)
+	 * 数聚场景id(变量名为placeClassId)
 	 * 还有一个搜索参数,按mac地址搜索
 	 * 还有一个搜索参数,按mac地址搜索
 	 * 注:如果传过来的参数是空值或者空字符串或者没传,则按默认值进行搜索,默认的为全部
 	 * 注:如果传过来的参数是空值或者空字符串或者没传,则按默认值进行搜索,默认的为全部
 	 * @param request
 	 * @param request
@@ -716,8 +717,8 @@ public class ApmacController extends SimpleController {
 		String cn = null;
 		String cn = null;
 		String cnCity = null;
 		String cnCity = null;
 		String place = null;
 		String place = null;
-		Long placeId = null;
-		String placeName = null;
+		Long placeClassId = null;
+		String placeClassName = null;
 		
 		
 		/**
 		/**
 		 * 下面对传递过来的几个参数进行处理
 		 * 下面对传递过来的几个参数进行处理
@@ -745,12 +746,12 @@ public class ApmacController extends SimpleController {
 			paramMap.put("cnCityName", "全部");
 			paramMap.put("cnCityName", "全部");
 		}
 		}
 
 
-		if (null != paramMap.get("placeId")
-				&& !"".equals(paramMap.get("placeId"))) {
-			placeId = Long.parseLong(String.valueOf(paramMap.get("placeId")));
-			placeName = placeService.findById(placeId).getName();
+		if (null != paramMap.get("placeClassId")
+				&& !"".equals(paramMap.get("placeClassId"))) {
+			placeClassId = Long.parseLong(String.valueOf(paramMap.get("placeClassId")));
+			placeClassName = placeClassInformationService.findById(placeClassId).getName();
 		} else {
 		} else {
-			placeName = "全部";
+			placeClassName = "全部";
 		}
 		}
 
 
 		if(null != paramMap.get("place") && !"".equals(paramMap.get("place"))) {
 		if(null != paramMap.get("place") && !"".equals(paramMap.get("place"))) {
@@ -763,9 +764,9 @@ public class ApmacController extends SimpleController {
 		paramMap.put("operatorId", operatorId);
 		paramMap.put("operatorId", operatorId);
 		paramMap.put("cn", cn);
 		paramMap.put("cn", cn);
 		paramMap.put("cnCity", cnCity);
 		paramMap.put("cnCity", cnCity);
-		paramMap.put("placeId", placeId);
+		paramMap.put("placeId", placeClassId);
 		paramMap.put("place", place);
 		paramMap.put("place", place);
-		paramMap.put("placeName", placeName);
+		paramMap.put("placeName", placeClassName);
 		paramMap.put("operatorName", operatorName);
 		paramMap.put("operatorName", operatorName);
 
 
 		//按mac地址搜索
 		//按mac地址搜索

+ 64 - 57
src/main/java/com/cloudcross/ssp/web/back/main/ap/PlaceController.java

@@ -16,7 +16,11 @@ import com.cloudcross.ssp.base.web.SimpleController;
 import com.cloudcross.ssp.common.utils.Pager;
 import com.cloudcross.ssp.common.utils.Pager;
 import com.cloudcross.ssp.common.utils.SqlHelper;
 import com.cloudcross.ssp.common.utils.SqlHelper;
 import com.cloudcross.ssp.model.Place;
 import com.cloudcross.ssp.model.Place;
+import com.cloudcross.ssp.model.PlaceClass;
+import com.cloudcross.ssp.model.PlaceClassInformation;
 import com.cloudcross.ssp.model.PlaceOperator;
 import com.cloudcross.ssp.model.PlaceOperator;
+import com.cloudcross.ssp.service.IPlaceClassInformationService;
+import com.cloudcross.ssp.service.IPlaceClassService;
 import com.cloudcross.ssp.service.IPlaceOperatorService;
 import com.cloudcross.ssp.service.IPlaceOperatorService;
 import com.cloudcross.ssp.service.IPlaceService;
 import com.cloudcross.ssp.service.IPlaceService;
 
 
@@ -32,92 +36,89 @@ public class PlaceController extends SimpleController {
 	private IPlaceService placeService;
 	private IPlaceService placeService;
 	@Autowired
 	@Autowired
 	private IPlaceOperatorService placeOperatorService;
 	private IPlaceOperatorService placeOperatorService;
+	@Autowired
+	private IPlaceClassInformationService placeClassInformationService;
+	@Autowired
+	private IPlaceClassService placeClassService;
 	
 	
 	/**
 	/**
-	 * 跳转到新增数聚场景页面
-	 * 按数聚场景名称搜索,变量名为placeName
+	 * 新增数聚场景页
 	 * @param model
 	 * @param model
 	 * @return
 	 * @return
 	 */
 	 */
-	@RequestMapping("/create")
-	public String edit(Model model, @RequestParam HashMap<String, Object> paramMap,
-			@RequestParam(defaultValue = "1") int page) {
-		String placeName = null;
-		//对传递过来的数聚场景名称做处理,如果传递的为空或者是空字符串,则让它等于空
+	@RequestMapping("/unclassfiedPlaceName")
+	public String unclassfiedPlaceName(Model model) {
+		//待分类数聚子场景
+		List<Place> placeList = placeService.findUnclassfiedPlace();
 		
 		
-		if(null == paramMap.get("placeName") || "".equals(paramMap.get("placeName"))) {
-			paramMap.put("placeName", null);
-		} else {
-			try {
-				placeName = new String(String.valueOf(paramMap.get("placeName")).trim().getBytes("ISO-8859-1"), "UTF-8");
-			} catch (UnsupportedEncodingException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			paramMap.put("placeName", SqlHelper.doLike(placeName).trim());
-		}
+		//查找所有的数聚场景
+		List<PlaceClassInformation> placeClassInformationList = placeClassInformationService.findAll();
 		
 		
-		int totalRow = 0;
-		Pager pager = null;
-		pager = new Pager();
-		//查询符合条件的总的条数
-		totalRow = placeService.countByParams(paramMap);
-		pager.setPage(page);
-		pager.setTotalRow(totalRow);
-		
-		List<Place> placeList = placeService.findByParams(paramMap, pager);
 		model.addAttribute("placeList", placeList);
 		model.addAttribute("placeList", placeList);
-		model.addAllAttributes(paramMap);
-		return page("create");
+		model.addAttribute("placeClassInformationList", placeClassInformationList);
+		return page("unclassfiedPlaceName");
 	}
 	}
 	
 	
+	/**
+	 * 将待分类数聚子场景添加到数聚场景里面
+	 * @param placeId 数聚子场景的id组成的字符串,格式为"1-2-3"
+	 * @param placeClassId 数聚场景的id
+	 * @return
+	 */
 	@RequestMapping("/add")
 	@RequestMapping("/add")
-	public String add(@RequestParam String placeName) {
-		Place place = new Place();
-		try {
-			placeName = new String(placeName.getBytes("ISO-8859-1"), "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+	public String add(@RequestParam String placeId, @RequestParam Long placeClassId) {
+		//判断传递过来的参数是不是为空
+		if(null == placeId || "".equals(placeId) || null == placeClassId) {
+			System.out.println("传入的参数有错");
+		} else {
+			String[] placeIdString = placeId.split("-");
+			
+			for(int i = 0; i < placeIdString.length; i++) {
+				PlaceClass placeClass = new PlaceClass();
+				placeClass.setClassId(placeClassId);
+				placeClass.setPlaceId(Long.parseLong(placeIdString[i]));
+				
+				placeClassService.add(placeClass);
+			}
+			
+			
 		}
 		}
-		place.setName(placeName);
-		placeService.add(place);
-		return redirect(page("create"));
+		
+		
+		return redirect(page("unclassfiedPlaceName"));
 	}
 	}
+	
 	/**
 	/**
-	 * 得到与该数聚场景对应的场景(运营商定义的)
+	 * 得到所有的数聚子场景
 	 * @param placeId
 	 * @param placeId
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping("/get-place")
 	@RequestMapping("/get-place")
 	public @ResponseBody
 	public @ResponseBody
-	List<PlaceOperator> getPlace(@RequestParam Long placeId) {
-		//如果传递的数聚场景id为空则返回空值
-		if(null == placeId) {
-			return null;
-		}
-		System.out.println("xiaobao"+placeId);
-		List<PlaceOperator> placeOperatorList = placeOperatorService.findPlaceDefindedByOperator(placeId);
+	List<Place> getPlace() {
 		
 		
-		return placeOperatorList;
+		List<Place> placeList = placeService.findAll();
+		return placeList;
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 删除场景
-	 * 注:这里的删除场景是将数聚场景和该场景的对应关系删掉,即将该场景的数聚场景id置为0
+	 * 删除数聚场景下的数聚子场景
 	 * @param model
 	 * @param model
-	 * @param paramMap
+	 * @param id 数聚子场景的id数组
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping("/delete-place")
 	@RequestMapping("/delete-place")
-	public @ResponseBody String deletePlace(Model model, @RequestParam Long id) {
+	public @ResponseBody String deletePlace(Model model, @RequestParam Long[] id) {
 		//传递的参数是不是为空
 		//传递的参数是不是为空
 		if(null == id) {
 		if(null == id) {
 			System.out.println("传递的参数有误");
 			System.out.println("传递的参数有误");
 			return ERROR;
 			return ERROR;
 		}
 		}
 		
 		
-		placeOperatorService.deleteRelationShip(id);
+		for(int i = 0; i < id.length; i++) {
+			placeClassService.deletePlaceClass(id[i]);
+		}
+		
 		return OK;
 		return OK;
 	}
 	}
 	
 	
@@ -133,6 +134,7 @@ public class PlaceController extends SimpleController {
 	public String placeSort(Model model, @RequestParam HashMap<String, Object> paramMap,
 	public String placeSort(Model model, @RequestParam HashMap<String, Object> paramMap,
 			@RequestParam(defaultValue = "1") int page) {
 			@RequestParam(defaultValue = "1") int page) {
 		String place = null;
 		String place = null;
+		String place1 = null;
 		// 对传递过来的场景名称做处理,如果传递的为空或者是空字符串,则让它等于空
 		// 对传递过来的场景名称做处理,如果传递的为空或者是空字符串,则让它等于空
 		if (null == paramMap.get("place")
 		if (null == paramMap.get("place")
 				|| "".equals(paramMap.get("place"))) {
 				|| "".equals(paramMap.get("place"))) {
@@ -140,6 +142,7 @@ public class PlaceController extends SimpleController {
 		} else {
 		} else {
 			try {
 			try {
 				place = new String(String.valueOf(paramMap.get("place")).trim().getBytes("ISO-8859-1"), "UTF-8");
 				place = new String(String.valueOf(paramMap.get("place")).trim().getBytes("ISO-8859-1"), "UTF-8");
+				place1 = place;
 			} catch (UnsupportedEncodingException e) {
 			} catch (UnsupportedEncodingException e) {
 				// TODO Auto-generated catch block
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 				e.printStackTrace();
@@ -157,23 +160,27 @@ public class PlaceController extends SimpleController {
 		
 		
 		paramMap.put("pager", pager);
 		paramMap.put("pager", pager);
 		List<PlaceOperator> placeOperatorList = placeOperatorService.findUnclassfiedPlace(paramMap);
 		List<PlaceOperator> placeOperatorList = placeOperatorService.findUnclassfiedPlace(paramMap);
+		
+		//将传递过来的搜索参数回传
+		if(null != place) {
+			model.addAttribute("place", place1);
+		}
 		model.addAttribute("placeOperatorList", placeOperatorList);
 		model.addAttribute("placeOperatorList", placeOperatorList);
 		model.addAllAttributes(paramMap);
 		model.addAllAttributes(paramMap);
 		return page("place-sort");
 		return page("place-sort");
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 得到所有数聚场景的名称
+	 * 根据数聚场景id得到其对应的所有数聚场景
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping("/placeName")
 	@RequestMapping("/placeName")
-	public @ResponseBody List<Place> findAllPlaceName() {
-		List<Place> placeList = placeService.findAll();
+	public @ResponseBody List<Place> findAllPlaceName(Long placeClassId) {
+		List<Place> placeList = placeService.findPlaceByPlaceClassId(placeClassId);
 		return placeList;
 		return placeList;
 	}
 	}
 	
 	
 	
 	
-	
 	/**
 	/**
 	 * 用户场景分类的保存
 	 * 用户场景分类的保存
 	 * 这里要传递两个变量,一个是t_place_operator的id字符串(变量名为id),另一个就是数聚场景id(变量名叫placeId)
 	 * 这里要传递两个变量,一个是t_place_operator的id字符串(变量名为id),另一个就是数聚场景id(变量名叫placeId)