| | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCity; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCityBusiness; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.service.ITOpenCityBusinessService; |
| | | import com.stylefeng.guns.modular.system.service.ITOpenCityService; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.util.GaoDeMapUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TOpenCity; |
| | | import com.stylefeng.guns.modular.system.service.ITOpenCityService; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | @Controller |
| | | @RequestMapping("/tOpenCity") |
| | | public class TOpenCityController extends BaseController { |
| | | |
| | | |
| | | private String PREFIX = "/system/tOpenCity/"; |
| | | |
| | | |
| | | @Autowired |
| | | private ITOpenCityService tOpenCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITOpenCityBusinessService tOpenCityBusinessService; |
| | | |
| | | @Resource |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | /** |
| | | * 跳转到城市管理首页 |
| | | */ |
| | |
| | | public String index() { |
| | | return PREFIX + "tOpenCity.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到添加城市管理 |
| | | */ |
| | |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ |
| | | address+=tOpenCity.getCityName(); |
| | | } |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ |
| | | address+=tOpenCity.getProvinceName(); |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())) { |
| | | address += tOpenCity.getProvinceName(); |
| | | } |
| | | JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); |
| | | String longitude = positionObj.getString("longitude"); |
| | |
| | | tOpenCity.setLon(Double.valueOf(longitude)); |
| | | tOpenCity.setLat(Double.valueOf(latitude)); |
| | | tOpenCity.setInsertTime(new Date()); |
| | | tOpenCity.setInsertUser(ShiroExtUtil.getUser().getId()); |
| | | tOpenCity.setInsertUser(shiroExtUtil.getUser().getId()); |
| | | tOpenCityService.insert(tOpenCity); |
| | | |
| | | |
| | | //添加经营业务 |
| | | testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); |
| | | testJSONStrToJSONArray(businessTypeStr, tOpenCity.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | for (int i = 0; i < size; i++){ |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | TOpenCityBusiness business = new TOpenCityBusiness(); |
| | | if (SinataUtil.isNotEmpty(jsonObject.getInteger("busId")) && jsonObject.getInteger("busId") != 0){ |
| | | if (SinataUtil.isNotEmpty(jsonObject.getInteger("busId")) && jsonObject.getInteger("busId") != 0) { |
| | | business = tOpenCityBusinessService.selectById(jsonObject.getInteger("busId")); |
| | | business.setUpdateTime(new Date()); |
| | | business.setUpdateUser(ShiroExtUtil.getUser().getId()); |
| | | business.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | business.setFlag("2"); |
| | | }else{ |
| | | }else { |
| | | business.setInsertTime(DateUtil.parse(jsonObject.getString("time") + " 00:00:00", "yyyy-MM-dd HH:mm:ss")); |
| | | business.setInsertUser(ShiroExtUtil.getUser().getId()); |
| | | business.setInsertUser(shiroExtUtil.getUser().getId()); |
| | | } |
| | | business.setOpenCityId(tOpenCityId); |
| | | String type = jsonObject.getString("type"); |
| | |
| | | //获取经纬度 |
| | | String address = tOpenCity.getAreaName(); |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ |
| | | address+=tOpenCity.getCityName(); |
| | | address += tOpenCity.getCityName(); |
| | | } |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ |
| | | address+=tOpenCity.getProvinceName(); |
| | | if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())) { |
| | | address += tOpenCity.getProvinceName(); |
| | | } |
| | | JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); |
| | | String longitude = positionObj.getString("longitude"); |
| | |
| | | tOpenCity.setLon(Double.valueOf(longitude)); |
| | | tOpenCity.setLat(Double.valueOf(latitude)); |
| | | tOpenCity.setUpdateTime(new Date()); |
| | | tOpenCity.setUpdateUser(ShiroExtUtil.getUser().getId()); |
| | | tOpenCity.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tOpenCityService.updateById(tOpenCity); |
| | | |
| | | |
| | | //删除经营业务 |
| | | TOpenCityBusiness business = new TOpenCityBusiness(); |
| | | business.setFlag("3"); |
| | | tOpenCityBusinessService.update(business,new EntityWrapper<TOpenCityBusiness>().eq("openCityId",tOpenCity.getId())); |
| | | tOpenCityBusinessService.update(business, new EntityWrapper<TOpenCityBusiness>().eq("openCityId", tOpenCity.getId())); |
| | | //添加经营业务 |
| | | testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); |
| | | testJSONStrToJSONArray(businessTypeStr, tOpenCity.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |