|
@@ -16,7 +16,11 @@ import com.cloudcross.ssp.base.web.SimpleController;
|
|
|
import com.cloudcross.ssp.common.utils.Pager;
|
|
|
import com.cloudcross.ssp.common.utils.SqlHelper;
|
|
|
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.service.IPlaceClassInformationService;
|
|
|
+import com.cloudcross.ssp.service.IPlaceClassService;
|
|
|
import com.cloudcross.ssp.service.IPlaceOperatorService;
|
|
|
import com.cloudcross.ssp.service.IPlaceService;
|
|
|
|
|
@@ -32,92 +36,89 @@ public class PlaceController extends SimpleController {
|
|
|
private IPlaceService placeService;
|
|
|
@Autowired
|
|
|
private IPlaceOperatorService placeOperatorService;
|
|
|
+ @Autowired
|
|
|
+ private IPlaceClassInformationService placeClassInformationService;
|
|
|
+ @Autowired
|
|
|
+ private IPlaceClassService placeClassService;
|
|
|
|
|
|
/**
|
|
|
- * 跳转到新增数聚场景页面
|
|
|
- * 按数聚场景名称搜索,变量名为placeName
|
|
|
+ * 新增数聚场景页
|
|
|
* @param model
|
|
|
* @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.addAllAttributes(paramMap);
|
|
|
- return page("create");
|
|
|
+ model.addAttribute("placeClassInformationList", placeClassInformationList);
|
|
|
+ return page("unclassfiedPlaceName");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 将待分类数聚子场景添加到数聚场景里面
|
|
|
+ * @param placeId 数聚子场景的id组成的字符串,格式为"1-2-3"
|
|
|
+ * @param placeClassId 数聚场景的id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@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
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/get-place")
|
|
|
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 paramMap
|
|
|
+ * @param id 数聚子场景的id数组
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/delete-place")
|
|
|
- public @ResponseBody String deletePlace(Model model, @RequestParam Long id) {
|
|
|
+ public @ResponseBody String deletePlace(Model model, @RequestParam Long[] id) {
|
|
|
//传递的参数是不是为空
|
|
|
if(null == id) {
|
|
|
System.out.println("传递的参数有误");
|
|
|
return ERROR;
|
|
|
}
|
|
|
|
|
|
- placeOperatorService.deleteRelationShip(id);
|
|
|
+ for(int i = 0; i < id.length; i++) {
|
|
|
+ placeClassService.deletePlaceClass(id[i]);
|
|
|
+ }
|
|
|
+
|
|
|
return OK;
|
|
|
}
|
|
|
|
|
@@ -133,6 +134,7 @@ public class PlaceController extends SimpleController {
|
|
|
public String placeSort(Model model, @RequestParam HashMap<String, Object> paramMap,
|
|
|
@RequestParam(defaultValue = "1") int page) {
|
|
|
String place = null;
|
|
|
+ String place1 = null;
|
|
|
// 对传递过来的场景名称做处理,如果传递的为空或者是空字符串,则让它等于空
|
|
|
if (null == paramMap.get("place")
|
|
|
|| "".equals(paramMap.get("place"))) {
|
|
@@ -140,6 +142,7 @@ public class PlaceController extends SimpleController {
|
|
|
} else {
|
|
|
try {
|
|
|
place = new String(String.valueOf(paramMap.get("place")).trim().getBytes("ISO-8859-1"), "UTF-8");
|
|
|
+ place1 = place;
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
@@ -157,23 +160,27 @@ public class PlaceController extends SimpleController {
|
|
|
|
|
|
paramMap.put("pager", pager);
|
|
|
List<PlaceOperator> placeOperatorList = placeOperatorService.findUnclassfiedPlace(paramMap);
|
|
|
+
|
|
|
+ //将传递过来的搜索参数回传
|
|
|
+ if(null != place) {
|
|
|
+ model.addAttribute("place", place1);
|
|
|
+ }
|
|
|
model.addAttribute("placeOperatorList", placeOperatorList);
|
|
|
model.addAllAttributes(paramMap);
|
|
|
return page("place-sort");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 得到所有的数聚场景的名称
|
|
|
+ * 根据数聚场景id得到其对应的所有数聚子场景
|
|
|
* @return
|
|
|
*/
|
|
|
@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;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 用户场景分类的保存
|
|
|
* 这里要传递两个变量,一个是t_place_operator的id字符串(变量名为id),另一个就是数聚场景id(变量名叫placeId)
|