//package com.dsh.guns.modular.system.controller.specialTrain;
|
//
|
//import com.alibaba.fastjson.JSON;
|
//import com.alibaba.fastjson.JSONArray;
|
//import com.alibaba.fastjson.JSONObject;
|
//import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
//import com.baomidou.mybatisplus.plugins.Page;
|
//import com.dsh.guns.core.base.controller.BaseController;
|
//import com.dsh.guns.core.common.constant.factory.PageFactory;
|
//import com.dsh.guns.core.shiro.ShiroKit;
|
//import com.dsh.guns.core.util.DateUtil;
|
//import com.dsh.guns.core.util.SinataUtil;
|
//import com.dsh.guns.core.util.ToolUtil;
|
//import com.dsh.guns.modular.system.model.TDriverLine;
|
//import com.dsh.guns.modular.system.model.TLocation;
|
//import com.dsh.guns.modular.system.model.TRegion;
|
//import com.dsh.guns.modular.system.service.ITLocationService;
|
//import com.dsh.guns.modular.system.service.ITRegionService;
|
//import com.dsh.guns.modular.system.util.GDMapElectricFenceUtil;
|
//import com.dsh.guns.modular.system.util.ResultUtil;
|
//import org.springframework.stereotype.Controller;
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
//import org.springframework.web.bind.annotation.ResponseBody;
|
//import org.springframework.ui.Model;
|
//import org.springframework.web.bind.annotation.PathVariable;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
//import com.dsh.guns.core.log.LogObjectHolder;
|
//import org.springframework.web.bind.annotation.RequestParam;
|
//import com.dsh.guns.modular.system.model.TSite;
|
//import com.dsh.guns.modular.system.service.ITSiteService;
|
//
|
//import java.util.ArrayList;
|
//import java.util.Date;
|
//import java.util.List;
|
//import java.util.Map;
|
//
|
///**
|
// * 跨城站点管理控制器
|
// *
|
// * @author fengshuonan
|
// * @Date 2020-09-04 10:35:51
|
// */
|
//@Controller
|
//@RequestMapping("/tSite")
|
//public class TSiteController extends BaseController {
|
//
|
// private String PREFIX = "/system/tSite/";
|
//
|
// @Autowired
|
// private ITSiteService tSiteService;
|
//
|
// @Autowired
|
// private ITRegionService tRegionService;
|
//
|
// @Autowired
|
// private ITLocationService itLocationService;
|
//
|
// @Autowired
|
// private GDMapElectricFenceUtil gdMapElectricFenceUtil;
|
//
|
//
|
//
|
// /**
|
// * 跳转到跨城站点管理首页
|
// */
|
// @RequestMapping("")
|
// public String index() {
|
// return PREFIX + "tImg.html";
|
// }
|
//
|
// /**
|
// * 跳转到添加跨城站点管理
|
// */
|
// @RequestMapping("/tSite_add")
|
// public String tSiteAdd(Model model) {
|
// //省
|
// List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
|
// model.addAttribute("provinceList",provinceList);
|
// return PREFIX + "tSite_add.html";
|
// }
|
//
|
// /**
|
// * 跳转到修改跨城站点管理
|
// */
|
// @RequestMapping("/tSite_update/{tSiteId}")
|
// public String tSiteUpdate(@PathVariable Integer tSiteId, Model model) {
|
// TSite tSite = tSiteService.selectById(tSiteId);
|
// model.addAttribute("item",tSite);
|
// LogObjectHolder.me().set(tSite);
|
//
|
// //省
|
// List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
|
// model.addAttribute("provinceList",provinceList);
|
//
|
// TRegion province = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tSite.getProvinceCode()));
|
// //市
|
// List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", province.getId()));
|
// model.addAttribute("cityList",cityList);
|
//
|
// if (SinataUtil.isNotEmpty(tSite.getCityCode())){
|
// TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tSite.getCityCode()));
|
// //区
|
// List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", city.getId()));
|
// model.addAttribute("areaList",areaList);
|
// }else{
|
// model.addAttribute("areaList",null);
|
// }
|
//
|
// //查询所有的站点区域
|
// List<TLocation> locationList = itLocationService.selectList(new EntityWrapper<TLocation>().eq("siteId", tSite.getId()).ne("state", 3));
|
// model.addAttribute("locationList",locationList);
|
// model.addAttribute("disabled","disabled");
|
//
|
// Integer type = itLocationService.selectList(new EntityWrapper<TLocation>().eq("siteId", tSite.getId())).get(0).getType();
|
// model.addAttribute("type1", type == 1 ? "block" : "none");
|
// model.addAttribute("type2", type == 1 ? "none" : "block");
|
// model.addAttribute("checked1", type == 1 ? "checked" : "");
|
// model.addAttribute("checked2", type == 1 ? "" : "checked");
|
// return PREFIX + "tImg_edit.html";
|
// }
|
//
|
// /**
|
// * 获取跨城站点管理列表
|
// */
|
// @RequestMapping(value = "/list")
|
// @ResponseBody
|
// public Object list(String insertTime,String name,String insertUser,String city,Integer state) {
|
// String beginTime = null;
|
// String endTime = null;
|
// if (SinataUtil.isNotEmpty(insertTime)){
|
// String[] timeArray = insertTime.split(" - ");
|
// beginTime = timeArray[0];
|
// endTime = timeArray[1];
|
// }
|
// Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
|
// if (ShiroKit.getUser().getRoleType() != 1){
|
// page.setRecords(null);
|
// }else{
|
// page.setRecords(tSiteService.getSiteList(page,beginTime,endTime,name,insertUser,city,state));
|
// }
|
// return super.packForBT(page);
|
// }
|
//
|
// /**
|
// * 新增跨城站点管理
|
// */
|
// @RequestMapping(value = "/add")
|
// @ResponseBody
|
// public Object add(TSite tSite,@RequestParam String subArr) {
|
// tSite.setInsertTime(new Date());
|
// tSite.setInsertUserId(ShiroKit.getUser().getId());
|
// tSite.setState(1);
|
// tSiteService.insert(tSite);
|
//
|
// //添加站点区域
|
// addLocation(subArr,tSite.getId());
|
// return ResultUtil.success();
|
// }
|
//
|
// /**
|
// * 添加站点区域
|
// * @param subArr
|
// * @param id
|
// */
|
// public void addLocation(String subArr,Integer id){
|
// JSONArray jsonArray = JSON.parseArray(subArr);
|
// int size = jsonArray.size();
|
// for (int i = 0; i < size; i++){
|
// JSONObject jsonObject = jsonArray.getJSONObject(i);
|
// TLocation location = new TLocation();
|
// location.setSiteId(id);
|
// location.setName(jsonObject.getString("name"));
|
// location.setInsertTime(new Date());
|
// location.setAddTime(jsonObject.getString("time"));
|
// location.setState(1);
|
// location.setUpdateTime(new Date());
|
// Integer type = jsonObject.getInteger("areaType");
|
// location.setType(type);
|
// if (1 == type){
|
// if (SinataUtil.isNotEmpty(jsonObject.getString("provinceCode"))){
|
// location.setProvince(jsonObject.getString("province"));
|
// location.setProvinceCode(jsonObject.getString("provinceCode"));
|
// }
|
// if (SinataUtil.isNotEmpty(jsonObject.getString("cityCode"))){
|
// location.setCity(jsonObject.getString("city"));
|
// location.setCityCode(jsonObject.getString("cityCode"));
|
// }
|
// if (SinataUtil.isNotEmpty(jsonObject.getString("districtCode"))){
|
// location.setDistrict(jsonObject.getString("district"));
|
// location.setDistrictCode(jsonObject.getString("districtCode"));
|
// }
|
// }else if (2 == type){
|
// String coordinate = jsonObject.getString("coordinate");
|
// coordinate = coordinate.substring(0, coordinate.length() - 1);
|
// location.setCoordinate(coordinate);
|
// }
|
// itLocationService.insert(location);
|
//
|
// if(type == 2){
|
// List<String> fence = gdMapElectricFenceUtil.createFence(location.getId().toString(), location.getCoordinate());
|
// TLocation location1 = itLocationService.selectById(location.getId());
|
// String s = "";
|
// for(String gid : fence){
|
// s += gid + "_";
|
// }
|
// location1.setGid(s.substring(0, s.length() - 1));
|
// location1.setUpdateTime(new Date());
|
// itLocationService.updateById(location1);
|
// }
|
// }
|
// }
|
//
|
// /**
|
// * 操作跨城站点管理
|
// * optType 1=删除 2=冻结 3=解冻
|
// */
|
// @RequestMapping(value = "/opt")
|
// @ResponseBody
|
// public Object opt(@RequestParam Integer tSiteId,@RequestParam Integer optType) {
|
// TSite tSite = tSiteService.selectById(tSiteId);
|
// if (1 == optType){
|
// tSite.setState(3);
|
// }else if (2 == optType){
|
// tSite.setState(2);
|
// }else if (3 == optType){
|
// tSite.setState(1);
|
// }
|
// tSiteService.updateById(tSite);
|
// return SUCCESS_TIP;
|
// }
|
//
|
// /**
|
// * 修改跨城站点管理
|
// */
|
// @RequestMapping(value = "/update")
|
// @ResponseBody
|
// public Object update(TSite tSite,@RequestParam String subArr) {
|
// tSiteService.updateById(tSite);
|
//
|
// //删除站点区域
|
// JSONArray jsonArray = JSON.parseArray(subArr);
|
// List<TLocation> siteId = itLocationService.selectList(new EntityWrapper<TLocation>().eq("siteId", tSite.getId()));
|
// List<TLocation> del = new ArrayList<>();
|
// List<Object> add = new ArrayList<>();
|
// for(TLocation location : siteId){
|
// boolean b = true;
|
// for(int i = 0; i < jsonArray.size(); i++){
|
// if(jsonArray.getJSONObject(i).getIntValue("id") == location.getId()){
|
// b = false;
|
// }
|
// }
|
// if(b){
|
// del.add(location);
|
// continue;
|
// }
|
// }
|
// for(int i = 0; i < jsonArray.size(); i++){
|
// if(jsonArray.getJSONObject(i).getInteger("id") == null){
|
// add.add(jsonArray.get(i));
|
// }
|
// }
|
// for(TLocation location : del){
|
// if(location.getType() == 2){
|
// String[] s = location.getGid().split("_");
|
// for(String gid : s){
|
// gdMapElectricFenceUtil.deleteElectricFenc(gid);
|
// }
|
// }
|
// itLocationService.deleteById(location.getId());
|
// }
|
//
|
// //添加站点区域
|
// addLocation(JSON.toJSONString(add),tSite.getId());
|
// return SUCCESS_TIP;
|
// }
|
//
|
// /**
|
// * 跨城站点管理详情
|
// */
|
// @RequestMapping(value = "/detail/{tSiteId}")
|
// @ResponseBody
|
// public Object detail(@PathVariable("tSiteId") Integer tSiteId) {
|
// return tSiteService.selectById(tSiteId);
|
// }
|
//}
|