From ef96dbc9278ebae4af204cca9de98c63f0d6328e Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期三, 20 九月 2023 19:16:21 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java | 206 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 195 insertions(+), 11 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java index 8690c0b..16910ce 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java @@ -1,6 +1,7 @@ package com.dsh.guns.modular.system.controller.code; import cn.hutool.crypto.SecureUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.course.feignClient.account.CityClient; @@ -14,9 +15,11 @@ import com.dsh.guns.core.common.constant.factory.PageFactory; import com.dsh.guns.core.util.ToolUtil; import com.dsh.guns.modular.system.model.*; -import com.dsh.guns.modular.system.service.ICityService; -import com.dsh.guns.modular.system.service.IStoreService; -import com.dsh.guns.modular.system.service.StoreConfigService; +import com.dsh.guns.modular.system.service.*; +import com.dsh.guns.modular.system.util.GaoDeMapUtil; +import io.swagger.models.auth.In; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -27,6 +30,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 车辆管理控制器 @@ -57,6 +61,20 @@ @Resource private StoreConfigService storeConfigService; + @Autowired + private TStoreOtherConfigTrueService tStoreOtherConfigTrueService; + + @Autowired + private TStoreOtherConfigService storeOtherConfigService; + + @Autowired + private TTurnService tTurnService; + + @Autowired + private TStoreOtherService storeOtherService; + + + /** * 跳转到车辆管理首页 @@ -80,6 +98,22 @@ String roleid = UserExt.getUser().getRoleid(); model.addAttribute("role",roleid); return PREFIX + "tShop_add.html"; + } + @RequestMapping("/tShop_add_one") + public String tCompetitionAddOne(Integer id,Model model) { + List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); + model.addAttribute("list",list); + String roleid = UserExt.getUser().getRoleid(); + model.addAttribute("id",id); + + return PREFIX + "tShop_add_one.html"; + } + @RequestMapping("/tShop_add_two") + public String tCompetitionAddTwo(Model model) { + List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); + model.addAttribute("list",list); + String roleid = UserExt.getUser().getRoleid(); + return PREFIX + "tShop_add_two.html"; } @@ -109,6 +143,27 @@ model.addAttribute("type",1); return PREFIX + "tShop_edit.html"; } + + + + + @RequestMapping("/tShop_update_one/{id}") + public String tCityUpdateOne(@PathVariable Integer id, Model model) { + TStoreOtherConfig byId = storeOtherConfigService.getById(id); + TTurn one = tTurnService.getOne(new LambdaQueryWrapper<TTurn>().eq(TTurn::getName, byId.getName())); + // page list + List<TTurn> list = tTurnService.list(new LambdaQueryWrapper<TTurn>().eq(TTurn::getPid, one.getId())); + // type list + List<TTurn> list1 = tTurnService.list(new LambdaQueryWrapper<TTurn>().eq(TTurn::getPid, byId.getPageId())); + model.addAttribute("item",byId); + model.addAttribute("list",list); + model.addAttribute("list1",list1); + + return PREFIX + "tShop_edit_two.html"; + } + + + @RequestMapping("/tShop_info/{id}") public String tCityInfo(@PathVariable Integer id, Model model) { TStore byId = storeService.getById(id); @@ -167,19 +222,29 @@ public Object list(String provinceCode, String cityCode , String name, String phone,String shopName) { Page<TStoreListVo> page = new PageFactory<TStoreListVo>().defaultPage(); List<TStoreListVo> list = storeService.listAll(page,provinceCode,cityCode,name,phone,shopName); - for (TStoreListVo tStoreListVo : list) { - TCityManager byId = cityClient.getById(tStoreListVo.getCityManagerId()); - tStoreListVo.setAccount(byId.getName()+"-"+byId.getPhone()); - - } + page.setRecords(list); + return super.packForBT(page); + } + @RequestMapping(value = "/listOne") + @ResponseBody + public Object listOne(Integer id) { + Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage(); + List<Map<String,Object>> list = storeService.listOne(page,id); + page.setRecords(list); + return super.packForBT(page); + } + @RequestMapping(value = "/listTwo") + @ResponseBody + public Object listTwo() { + Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage(); + List<Map<String,Object>> list = storeService.listTwo(page); page.setRecords(list); return super.packForBT(page); } - @RequestMapping(value = "/add") @ResponseBody - public Object list(TStore tStore,String time,String userName,String userPhone) { + public Object list(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId,String lat,String lon) { try { if(ToolUtil.isNotEmpty(tStore.getProvinceCode())) { TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getProvinceCode())); @@ -189,6 +254,9 @@ } tStore.setStartTime(time.split(" - ")[0]); tStore.setEndTime(time.split(" - ")[1]); + tStore.setIds(ids); + tStore.setType(type); + tStore.setOperatorId(yyId); tStore.setState(1); User user = new User(); List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, userPhone)); @@ -202,6 +270,9 @@ user.setPassword(SecureUtil.md5("a123456")); userMapper.insert(user); tStore.setStoreStaffId(user.getId()); + tStore.setLon(lon); + tStore.setLat(lat); + storeService.save(tStore); ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); @@ -223,7 +294,7 @@ @RequestMapping(value = "/update") @ResponseBody - public Object update(TStore tStore,String time,String userName,String userPhone) { + public Object update(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId) { try { TStore byId = storeService.getById(tStore.getId()); @@ -235,6 +306,9 @@ } tStore.setStartTime(time.split(" - ")[0]); tStore.setEndTime(time.split(" - ")[1]); + tStore.setIds(ids); + tStore.setType(type); + tStore.setOperatorId(yyId); if(ToolUtil.isEmpty(tStore.getCoverDrawing())){ tStore.setCoverDrawing(byId.getCoverDrawing()); } @@ -337,6 +411,17 @@ return ERROR; } } + @ResponseBody + @RequestMapping(value = "/deleteOne") + public Object delete1(Integer id) { + try { + storeService.delete1(id); + return SUCCESS_TIP; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } @RequestMapping(value = "/saveImg") @ResponseBody @@ -393,6 +478,105 @@ return ERROR; } } + @RequestMapping(value = "/typeChange") + @ResponseBody + public Object typeChange(String name) { + try { + List<Map<String,Object>> list = storeService.typeChange(name); + return list; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } + @RequestMapping(value = "/typeChangeOne") + @ResponseBody + public Object typeChangeOne(Integer id) { + try { + List<Map<String,Object>> list = storeService.typeChangeOne(id); + return list; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } + + /** + * ajax.set("url",url); + * ajax.set("name",name); + * ajax.set("page",page); + * ajax.set("type",type); + * ajax.set("turnId",turnId); + * ajax.set("sort",sort); + * @param id + * @return + */ + @RequestMapping(value = "/addConfigOne") + @ResponseBody + public Object addConfigOne(String url,String name,Integer page,Integer type,String turnId,Integer sort) { + try { + storeService.addConfigOne(url,name,page,type,turnId,sort); + return SUCCESS_TIP; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } + @RequestMapping(value = "/addConfig") + @ResponseBody + public Object addConfig(String name,Integer id) { + try { + List<TStoreOtherConfig> list = storeOtherConfigService.list(); + if(list.size()>0){ + TStoreOther tStoreOther = new TStoreOther(); + tStoreOther.setName(name); + tStoreOther.setStoreId(id); + storeOtherService.save(tStoreOther); + + // 找出temp表数据 + + ArrayList<TStoreOtherConfigTrue> tStoreOtherConfigTrues = new ArrayList<>(); + for (TStoreOtherConfig tStoreOtherConfig : list) { + TStoreOtherConfigTrue tStoreOtherConfigTrue = new TStoreOtherConfigTrue(); + BeanUtils.copyProperties(tStoreOtherConfig,tStoreOtherConfigTrue); + tStoreOtherConfigTrue.setPid(tStoreOther.getId()); + tStoreOtherConfigTrues.add(tStoreOtherConfigTrue); + } + tStoreOtherConfigTrueService.saveBatch(tStoreOtherConfigTrues); + storeOtherConfigService.remove(new LambdaQueryWrapper<TStoreOtherConfig>().gt(TStoreOtherConfig::getId,0)); + } + + + return SUCCESS_TIP; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } + @RequestMapping(value = "/updateConfigOne") + @ResponseBody + public Object addConfigOne(String url,String name,Integer page,Integer type,String turnId,Integer sort,Integer id) { + try { + TStoreOtherConfig byId = storeOtherConfigService.getById(id); + if(ToolUtil.isNotEmpty(url)){ + byId.setUrl(url); + } + byId.setName(name); + TTurn byId1 = tTurnService.getById(page); + TTurn byId2 = tTurnService.getById(type); + byId.setPage(byId1.getName()); + byId.setType(byId2.getName()); + byId.setTurnId(turnId); + byId.setSort(sort); + byId.setPageId(page); + byId.setTypeId(type); + storeOtherConfigService.updateById(byId); + return SUCCESS_TIP; + }catch (Exception e){ + e.printStackTrace(); + return ERROR; + } + } -- Gitblit v1.7.1