From a4d873761dd03a74950d05f204171255509bd5fb Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期一, 17 六月 2024 16:03:35 +0800 Subject: [PATCH] 修改 bug --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java | 133 +++++++++++++++++--------------------------- 1 files changed, 52 insertions(+), 81 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java index 17f4d67..c6e7d94 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/BallController.java @@ -231,7 +231,6 @@ return ResultUtil.success(); } - public static MultipartFile convert(BufferedImage bufferedImage, String fileName) throws IOException { // 将 BufferedImage 转换为字节数组 ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -251,29 +250,7 @@ return multipartFile; } - public static void main(String[] args) throws Exception { - // 生成红蓝sutu二维码 - HashMap<String, String> blueCode = new HashMap<>(); - blueCode.put("scan_type", "1000"); - blueCode.put("sutu_id", ""+1041); - blueCode.put("space_id", 46 + ""); - HashMap<String, String> redCode = new HashMap<>(); - redCode.put("scan_type", "1000"); - redCode.put("sutu_id", 1040+""); - redCode.put("space_id", 46 + ""); - String blueS= "{\"scan_type\": 1000, \"space_id\": "+46+", \"sutu_id\": "+1041+"}"; - String redS= "{\"scan_type\": 1000, \"space_id\": "+46+", \"sutu_id\": "+1040+"}"; - MyQrCodeUtil.createCodeToFile(blueS); - MyQrCodeUtil.createCodeToFile(redS); - BufferedImage blueImage = QRCodeUtil.createImage(blueS); - BufferedImage redImage = QRCodeUtil.createImage(redS); - MultipartFile blueFile = convert(blueImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); - MultipartFile redFile = convert(redImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); - String s = OssUploadUtil.ossUpload("img/", blueFile); - String s1 = OssUploadUtil.ossUpload("img/", redFile); - System.err.println("蓝色"+ s); - System.err.println("蓝色"+s1); - } + @RequestMapping("/save") @ResponseBody public ResultUtil save(Integer id, String operationId, String red, String blue, String province, String city, Integer site, Integer store @@ -326,21 +303,20 @@ game.setOperationId(0); } System.out.println("============"+game); - + // 判断是新增还是修改 修改不会重新生成sutuId - if (game.getId()==null){ + if (game.getId()==null) { HashMap<String, String> map5 = new HashMap<>(); - map5.put("space_id", store+""); - map5.put("area_id", site+""); + map5.put("space_id", store + ""); + map5.put("area_id", site + ""); String s5 = HttpRequestUtil.getRequest("https://try.daowepark.com/v7/user_api/general/get_space_sutu", map5); System.err.println(s5); JSONObject jsonObject5 = new JSONObject(s5); - // 获取 data 字段的值 JSONArray data = jsonObject5.getJSONArray("data"); Integer temp = null; // 临时sutuid Integer temp1 = null; // 临时sutuid TSite si = siteService.getById(site); - if (data.length() == 0){ + if (data.length() == 0) { // 这个场地没有添加过sutu HashMap<String, String> map3 = new HashMap<>(); HashMap<String, String> map4 = new HashMap<>(); @@ -368,39 +344,39 @@ String sutuIdValue1 = dataObject1.getString("sutu_id"); Integer sutuId = Integer.valueOf(sutuIdValue); Integer sutuId1 = Integer.valueOf(sutuIdValue1); - game.setBlue(""+sutuId); - game.setRed(""+sutuId1); + game.setBlue("" + sutuId); + game.setRed("" + sutuId1); // 生成红蓝sutu二维码 HashMap<String, String> blueCode = new HashMap<>(); blueCode.put("scan_type", "1000"); - blueCode.put("sutu_id", ""+sutuId); + blueCode.put("sutu_id", "" + sutuId); blueCode.put("space_id", si.getId() + ""); HashMap<String, String> redCode = new HashMap<>(); redCode.put("scan_type", "1000"); - redCode.put("sutu_id", sutuId1+""); + redCode.put("sutu_id", sutuId1 + ""); redCode.put("space_id", si.getId() + ""); - String blueS= "{\"scan_type\": 1000, \"space_id\": "+si.getId()+", \"sutu_id\": "+sutuId+"}"; - String redS= "{\"scan_type\": 1000, \"space_id\": "+si.getId()+", \"sutu_id\": "+sutuId1+"}"; + String blueS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuId + "}"; + String redS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuId1 + "}"; MyQrCodeUtil.createCodeToFile(blueS); MyQrCodeUtil.createCodeToFile(redS); BufferedImage blueImage = QRCodeUtil.createImage(blueS); BufferedImage redImage = QRCodeUtil.createImage(redS); - MultipartFile blueFile = convert(blueImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); - MultipartFile redFile = convert(redImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); + MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); + MultipartFile redFile = convert(redImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); String s = OssUploadUtil.ossUpload("img/", blueFile); String s1 = OssUploadUtil.ossUpload("img/", redFile); game.setBlueCode(s); game.setRedCode(s1); - }else{ - Integer sutuid=0; - Integer sutuid1=0; + } else { + Integer sutuid = 0; + Integer sutuid1 = 0; JSONObject element = data.getJSONObject(0); - if (site==27){ - sutuid=1036; - sutuid1=1037; + if (site == 27) { + sutuid = 1036; + sutuid1 = 1037; game.setBlue(sutuid.toString()); game.setRed(sutuid1.toString()); - }else{ + } else { sutuid = element.getInt("id"); game.setBlue(sutuid.toString()); JSONObject element1 = data.getJSONObject(1); @@ -410,27 +386,28 @@ // 生成红蓝sutu二维码 HashMap<String, String> blueCode = new HashMap<>(); blueCode.put("scan_type", "1000"); - blueCode.put("sutu_id", ""+sutuid); + blueCode.put("sutu_id", "" + sutuid); blueCode.put("space_id", si.getId() + ""); HashMap<String, String> redCode = new HashMap<>(); redCode.put("scan_type", "1000"); - redCode.put("sutu_id", sutuid1+""); + redCode.put("sutu_id", sutuid1 + ""); redCode.put("space_id", si.getId() + ""); - String blueS= "{\"scan_type\": 1000, \"space_id\": "+si.getId()+", \"sutu_id\": "+sutuid+"}"; - String redS= "{\"scan_type\": 1000, \"space_id\": "+si.getId()+", \"sutu_id\": "+sutuid1+"}"; + String blueS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuid + "}"; + String redS = "{\"scan_type\": 1000, \"space_id\": " + si.getId() + ", \"sutu_id\": " + sutuid1 + "}"; MyQrCodeUtil.createCodeToFile(blueS); MyQrCodeUtil.createCodeToFile(redS); BufferedImage blueImage = QRCodeUtil.createImage(blueS); BufferedImage redImage = QRCodeUtil.createImage(redS); - MultipartFile blueFile = convert(blueImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); - MultipartFile redFile = convert(redImage, new Date().getTime()+UUIDUtil.getRandomCode(3)+".PNG"); + MultipartFile blueFile = convert(blueImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); + MultipartFile redFile = convert(redImage, new Date().getTime() + UUIDUtil.getRandomCode(3) + ".PNG"); String s = OssUploadUtil.ossUpload("img/", blueFile); String s1 = OssUploadUtil.ossUpload("img/", redFile); game.setBlueCode(s); game.setRedCode(s1); } + } - + Integer gameId = ballClient.save(game); List<TGameConfig> gameConfigList = new ArrayList<>(); //玩湃跨城赛 @@ -557,7 +534,7 @@ gameConfigly.setIntegral(lyInt); gameConfigly.setOtherId(gameId); gameConfigList.add(gameConfigly); - + //激战3V3 TGameConfig gameConfigv3 = new TGameConfig(); gameConfigv3.setGameId(v3Id); @@ -578,13 +555,13 @@ // map1.put("device_id", red); // map1.put("region_id", st.getId() + ""); // // 添加门禁 -// String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); +// String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map1); // map2.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); // map2.put("space_id", si.getId() + ""); // map2.put("device_id", blue); // map2.put("region_id", st.getId() + ""); // // 添加门禁 -// String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map2); +// String s2 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map2); @@ -592,14 +569,8 @@ return null; } -// public static void main(String[] args) { -// HashMap<String, String> map3 = new HashMap<>(); -// map3.put("space_id", "1001"); -// map3.put("area_id", "4352"); -// String s3 = HttpRequestUtil.getRequest("https://try.daowepark.com/v7/user_api/general/get_space_sutu", map3); -// -// System.err.println(s3); -// } + + @RequestMapping("/pre_add") public String add(Model model) { @@ -680,7 +651,7 @@ TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); model.addAttribute("ly",ly); - + TGameConfig v3 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 0)); model.addAttribute("v3",v3); @@ -752,7 +723,7 @@ TGameConfig ly = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 5)); model.addAttribute("ly",ly); - + TGameConfig v3 = gameConfigService.getOne(new QueryWrapper<TGameConfig>().eq("otherId", id).eq("gameId", 0)); model.addAttribute("v3",v3); @@ -1159,22 +1130,22 @@ } } - if (Integer.parseInt(vo.get("status").toString())==1 ){ - String dateTimeStr = vo.get("times").toString(); - String formattedDateTimeStr = dateTimeStr.substring(0, 11) + dateTimeStr.substring(17); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - try { - Date date = sdf.parse(formattedDateTimeStr); - if (new Date().after(date)){ - vo.put("status",4); - } - - System.out.println(date); - } catch (ParseException e) { - e.printStackTrace(); - } - } +// if (Integer.parseInt(vo.get("status").toString())==1 ){ +// String dateTimeStr = vo.get("times").toString(); +// String formattedDateTimeStr = dateTimeStr.substring(0, 11) + dateTimeStr.substring(17); +// +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); +// try { +// Date date = sdf.parse(formattedDateTimeStr); +// if (new Date().after(date)){ +// vo.put("status",4); +// } +// +// System.out.println(date); +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// } } return orders; } -- Gitblit v1.7.1