From 487274f7b8828e5bb7e5efcc914b7a72d63fcf27 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期二, 24 十月 2023 20:20:36 +0800
Subject: [PATCH] 10.24。2
---
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java | 118 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 97 insertions(+), 21 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 ee74721..42555bb 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 cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -18,6 +19,7 @@
import com.dsh.guns.modular.system.model.*;
import com.dsh.guns.modular.system.service.*;
import com.dsh.guns.modular.system.util.GaoDeMapUtil;
+import com.dsh.guns.modular.system.util.HttpRequestUtil;
import io.swagger.models.auth.In;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
@@ -29,10 +31,7 @@
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -106,11 +105,15 @@
// if (!roleid.equals("1")){
TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
- model.addAttribute("operator",operator1.getId());
+ if(operator1!=null){
+ model.addAttribute("operator",operator1.getId());
+ }else {
+ model.addAttribute("operator",0);
+ }
// }
model.addAttribute("yysList",list1);
- return PREFIX + "tShop_add.html";
+ return PREFIX + "TShop_add.html";
}
@RequestMapping("/tShop_add_one")
public String tCompetitionAddOne(Integer id,Model model) {
@@ -119,7 +122,7 @@
String roleid = UserExt.getUser().getRoleid();
model.addAttribute("id",id);
- return PREFIX + "tShop_add_one.html";
+ return PREFIX + "TShop_add_one.html";
}
@RequestMapping("/tShop_add_two")
public String tCompetitionAddTwo(Integer id,Model model) {
@@ -184,13 +187,13 @@
User byId1 = userMapper.selectById(byId.getStoreStaffId());
model.addAttribute("city",byId1);
model.addAttribute("type",1);
- return PREFIX + "tShop_edit.html";
+ return PREFIX + "TShop_edit.html";
}
@RequestMapping("/tShop_update1/{id}")
public String tCityUpdate1(@PathVariable Integer id, Model model) {
TStoreOther byId = storeOtherService.getById(id);
model.addAttribute("item",byId);
- return PREFIX + "tShop_edit_one.html";
+ return PREFIX + "TShop_edit_one.html";
}
@@ -201,14 +204,16 @@
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()));
+ if (one!=null) {
+ List<TTurn> list = tTurnService.list(new LambdaQueryWrapper<TTurn>().eq(TTurn::getPid, one.getId()));
+ model.addAttribute("list", list);
+ }
// 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";
+ return PREFIX + "TShop_edit_two.html";
}
@RequestMapping("/tShop_update_one1/{id}")
public String tCityUpdateOne1(@PathVariable Integer id, Model model) {
@@ -222,7 +227,7 @@
model.addAttribute("list",list);
model.addAttribute("list1",list1);
- return PREFIX + "tShop_add_three.html";
+ return PREFIX + "TShop_add_three.html";
}
@@ -239,6 +244,7 @@
cityListQuery.setOffset(1);
cityListQuery.setLimit(10000);
cityListQuery.setCityCode(byId.getCityCode());
+ model.addAttribute("yysList", tOperatorService.list());
Page<TCityManager> list2 = cityClient.list(cityListQuery);
model.addAttribute("list1",list1);
model.addAttribute("list2",list2.getRecords());
@@ -248,14 +254,14 @@
User byId1 = userMapper.selectById(byId.getStoreStaffId());
model.addAttribute("city",byId1);
model.addAttribute("type",0);
- return PREFIX + "tShop_edit.html";
+ return PREFIX + "TShop_edit.html";
}
@RequestMapping("/tShop_gift/{id}")
public String tCityGift(@PathVariable Integer id, Model model) {
TStore byId = storeService.getById(id);
model.addAttribute("welfarePicture",byId.getWelfarePicture());
model.addAttribute("id",id);
- return PREFIX + "tShop_img.html";
+ return PREFIX + "TShop_img.html";
}
@RequestMapping("/tShop_indexSet/{id}")
public String tCityIndexSet(@PathVariable Integer id, Model model) {
@@ -276,7 +282,7 @@
StoreConfig c8 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,8));
model.addAttribute("c8",c8);
model.addAttribute("id",id);
- return PREFIX + "tShop_imgAll.html";
+ return PREFIX + "TShop_imgAll.html";
}
@@ -284,7 +290,14 @@
@ResponseBody
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);
+ String roleid = UserExt.getUser().getRoleid();
+ List<TStoreListVo> list =new ArrayList<>();
+ if("3".equals(roleid)){
+ Integer objectId = UserExt.getUser().getObjectId();
+ list = storeService.listAllStore(page,provinceCode,cityCode,name,phone,shopName,objectId);
+ }else {
+ list = storeService.listAll(page,provinceCode,cityCode,name,phone,shopName);
+ }
page.setRecords(list);
return super.packForBT(page);
}
@@ -317,9 +330,12 @@
@ResponseBody
public Object list(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId,String lat,String lon,String pCode1,String cCode1) {
try {
- if(yyId==null){
+
+
+ if(yyId==null || type==1){
yyId=0;
}
+
if(yyId!=0) {
List<TOperatorCity> list1 = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, yyId));
if(list1.size()>0){
@@ -382,6 +398,9 @@
storeService.save(tStore);
+
+
+
ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
for (int i = 1; i < 9; i++) {
StoreConfig storeConfig = new StoreConfig();
@@ -392,6 +411,41 @@
storeConfigs.add(storeConfig);
}
storeConfigService.saveBatch(storeConfigs);
+
+
+ // 添加门店
+ HashMap<String, String> map1 = new HashMap<>();
+ map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+ map1.put("name",tStore.getName());
+ map1.put("short_name",tStore.getName());
+ map1.put("location",tStore.getCity());
+ map1.put("address",tStore.getAddress());
+ map1.put("telephone",tStore.getPhone());
+ map1.put("linkman",userName);
+ map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]");
+ map1.put("logo",tStore.getCoverDrawing());
+ map1.put("remark",tStore.getIntroduce());
+ map1.put("lat",tStore.getLat());
+ map1.put("lng",tStore.getLon());
+ map1.put("space_id",tStore.getId().toString());
+ String result = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map1);
+ System.out.println(result);
+
+
+
+ for (String s : tStore.getIds().split(",")) {
+ HashMap<String, String> map = new HashMap<>();
+ map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+ map.put("space_id",tStore.getId()+"");
+ map.put("device_id",s);
+ map.put("region_id","");
+ // 添加门禁
+ String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map);
+ System.out.println(s1);
+ }
+
+
+
return new SuccessTip<>();
}catch (Exception e){
e.printStackTrace();
@@ -469,6 +523,30 @@
tStore.setLon(lon);
tStore.setLat(lat);
storeService.updateById(tStore);
+ String ids1 = byIdc.getIds();
+
+
+
+ HashMap<String, String> mapx = new HashMap<>();
+ mapx.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+ for (String s : ids1.split(",")) {
+ String post = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s,mapx);
+ System.out.println(post);
+ }
+
+ for (String s : ids.split(",")) {
+ HashMap<String, String> map1 = new HashMap<>();
+ map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+ map1.put("space_id",tStore.getId()+"");
+ map1.put("device_id",s);
+ map1.put("region_id","");
+ // 添加门禁
+ String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1);
+ System.out.println(s1);
+ }
+
+
+
return new SuccessTip<>();
}catch (Exception e){
e.printStackTrace();
@@ -622,10 +700,8 @@
@RequestMapping(value = "/deleteTwo")
public Object delete2(Integer id) {
try {
- TStoreOtherConfigTrue byId = tStoreOtherConfigTrueService.getById(id);
+ storeOtherConfigService.removeById(id);
- byId.setState(2);
- tStoreOtherConfigTrueService.updateById(byId);
return SUCCESS_TIP;
}catch (Exception e){
e.printStackTrace();
--
Gitblit v1.7.1