From ab64b09ce3020b376af1e6ee0326ea71330d34ad Mon Sep 17 00:00:00 2001
From: fei.wang <wf18701153496@163.com>
Date: 星期四, 21 三月 2024 09:52:42 +0800
Subject: [PATCH] 修改bug

---
 src/main/java/com/flow/controller/IndexController.java |  107 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 57 insertions(+), 50 deletions(-)

diff --git a/src/main/java/com/flow/controller/IndexController.java b/src/main/java/com/flow/controller/IndexController.java
index 7cecefe..27c254f 100644
--- a/src/main/java/com/flow/controller/IndexController.java
+++ b/src/main/java/com/flow/controller/IndexController.java
@@ -15,6 +15,7 @@
 import com.flow.util.result;
 import com.flow.util.resultutil;
 import com.github.pagehelper.PageInfo;
+
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
@@ -26,6 +27,7 @@
 import java.util.*;
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -56,35 +58,39 @@
     public result<List<Card>> FindCard(Integer page, Integer limit) throws Exception {
         PageInfo<Card> cz = this.cardService.FindCarda(page, limit);
 
-        for(int i = 0; i < cz.getSize(); ++i) {
-            if (((Card)cz.getList().get(i)).getCompany() != null) {
-                ((Card)cz.getList().get(i)).setZflow(((Card)cz.getList().get(i)).getZflow() / 1024);
-                ((Card)cz.getList().get(i)).setSyflow(((Card)cz.getList().get(i)).getSyflow() / 1024);
-                ((Card)cz.getList().get(i)).setSyll(((Card)cz.getList().get(i)).getZflow() - ((Card)cz.getList().get(i)).getSyflow());
+        for (int i = 0; i < cz.getSize(); ++i) {
+            if (((Card) cz.getList().get(i)).getCompany() != null) {
+                ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024);
+                ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024);
+                ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow());
+
+                if (((Card) cz.getList().get(i)).getBindid() == null || ((Card) cz.getList().get(i)).getBindid().equals("undefined")) {
+                    ((Card) cz.getList().get(i)).setBindid("鏈煡");
+                }
                 SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd");
                 Date date = new Date();
-                if (cz.getList().get(i).getEnddate()!=null){
-                    if (cz.getList().get(i).getFlow()==null){
-                        ((Card)cz.getList().get(i)).setFlow("12G/骞�");
-                        this.cardService.UpdateCard((Card)cz.getList().get(i));
+                if (cz.getList().get(i).getEnddate() != null) {
+                    if (cz.getList().get(i).getFlow() == null) {
+                        ((Card) cz.getList().get(i)).setFlow("12G/骞�");
+                        this.cardService.UpdateCard((Card) cz.getList().get(i));
                     }
-                    if (cz.getList().get(i).getUnitprice()==null){
-                        ((Card)cz.getList().get(i)).setUnitprice(80);
-                        this.cardService.UpdateCard((Card)cz.getList().get(i));
+                    if (cz.getList().get(i).getUnitprice() == null) {
+                        ((Card) cz.getList().get(i)).setUnitprice(80);
+                        this.cardService.UpdateCard((Card) cz.getList().get(i));
                     }
                     System.out.println(cz.getList().get(i).getEnddate());
-                    if (cz.getList().get(i).getEnddate()!=null){
+                    if (cz.getList().get(i).getEnddate() != null) {
                         Date endDay = date2.parse(cz.getList().get(i).getEnddate());//缁撴潫鏃堕棿
                         Long starTime = date.getTime();
                         Long endTime = endDay.getTime();
                         Long num11 = endTime - starTime;//鏃堕棿鎴�
-                        if ((num11/24/60/60/1000)<0){
-                            ((Card)cz.getList().get(i)).setRemainingdays("0澶�");
-                        }else{
-                            ((Card)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"澶�");
+                        if ((num11 / 24 / 60 / 60 / 1000) < 0) {
+                            ((Card) cz.getList().get(i)).setRemainingdays("0澶�");
+                        } else {
+                            ((Card) cz.getList().get(i)).setRemainingdays(+num11 / 24 / 60 / 60 / 1000 + "澶�");
                         }
-                        if (!((Card)cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card)cz.getList().get(i)).getRemainingdays().equals(+num11/24/60/60/1000+"澶�") ){
-                            this.cardService.UpdateCard((Card)cz.getList().get(i));
+                        if (!((Card) cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card) cz.getList().get(i)).getRemainingdays().equals(+num11 / 24 / 60 / 60 / 1000 + "澶�")) {
+                            this.cardService.UpdateCard((Card) cz.getList().get(i));
                         }
                     }
 
@@ -106,25 +112,25 @@
     public result<List<Card>> FindCardZi(String Zong, Integer page, Integer limit) throws Exception {
         PageInfo<Card> cz = this.cardService.FindCardaZi(Zong, page, limit);
 
-        for(int i = 0; i < cz.getSize(); ++i) {
-            if (((Card)cz.getList().get(i)).getCompany() != null) {
-                ((Card)cz.getList().get(i)).setZflow(((Card)cz.getList().get(i)).getZflow() / 1024);
-                ((Card)cz.getList().get(i)).setSyflow(((Card)cz.getList().get(i)).getSyflow() / 1024);
-                ((Card)cz.getList().get(i)).setSyll(((Card)cz.getList().get(i)).getZflow() - ((Card)cz.getList().get(i)).getSyflow());
+        for (int i = 0; i < cz.getSize(); ++i) {
+            if (((Card) cz.getList().get(i)).getCompany() != null) {
+                ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024);
+                ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024);
+                ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow());
                 SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd");
                 Date date = new Date();
-                if (cz.getList().get(i).getEnddate()!=null){
+                if (cz.getList().get(i).getEnddate() != null) {
                     Date endDay = date2.parse(cz.getList().get(i).getEnddate());//缁撴潫鏃堕棿
                     Long starTime = date.getTime();
                     Long endTime = endDay.getTime();
                     Long num11 = endTime - starTime;//鏃堕棿鎴�
-                    if ((num11/24/60/60/1000)<0){
-                        ((Card)cz.getList().get(i)).setRemainingdays("0澶�");
-                    }else{
-                        ((Card)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"澶�");
+                    if ((num11 / 24 / 60 / 60 / 1000) < 0) {
+                        ((Card) cz.getList().get(i)).setRemainingdays("0澶�");
+                    } else {
+                        ((Card) cz.getList().get(i)).setRemainingdays(+num11 / 24 / 60 / 60 / 1000 + "澶�");
                     }
-                    if (!((Card)cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card)cz.getList().get(i)).getRemainingdays().equals(+num11/24/60/60/1000+"澶�") ){
-                        this.cardService.UpdateCard((Card)cz.getList().get(i));
+                    if (!((Card) cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card) cz.getList().get(i)).getRemainingdays().equals(+num11 / 24 / 60 / 60 / 1000 + "澶�")) {
+                        this.cardService.UpdateCard((Card) cz.getList().get(i));
                     }
                 }
             }
@@ -151,6 +157,7 @@
         this.cardService.UpdateCardChong(card);
         ModelAndView modelAndView = new ModelAndView();
         modelAndView.setViewName("/page/index1.jsp");
+        modelAndView.addObject("operatornum", 2);
         return modelAndView;
     }
 
@@ -164,7 +171,7 @@
         int i;
         Card card1;
         if (str.length > 1 && str1.length > 1) {
-            for(i = 0; i < str.length; ++i) {
+            for (i = 0; i < str.length; ++i) {
                 card1 = new Card();
                 card1.setCompany(card.getCompany());
                 card1.setCardnumber(str[i]);
@@ -179,7 +186,7 @@
                 this.cardService.addCard(card1);
             }
         } else if (str.length > 1 && str1[0] == "") {
-            for(i = 0; i < str.length; ++i) {
+            for (i = 0; i < str.length; ++i) {
                 card1 = new Card();
                 card1.setCompany(card.getCompany());
                 card1.setCardnumber(str[i]);
@@ -194,7 +201,7 @@
                 this.cardService.addCard(card1);
             }
         } else if (str.length > 1 && str1.length == 1) {
-            for(i = 0; i < str.length; ++i) {
+            for (i = 0; i < str.length; ++i) {
                 card1 = new Card();
                 card1.setCompany(card.getCompany());
                 card1.setCardnumber(str[i]);
@@ -209,7 +216,7 @@
                 this.cardService.addCard(card1);
             }
         } else {
-            if (card.getCardnumber()!=null){
+            if (card.getCardnumber() != null && card.getCardnumber() != "") {
                 card.setCompany(card.getCompany());
                 this.cardService.addCard(card);
             }
@@ -223,24 +230,24 @@
     public result<List<Card>> tableSearch(Card card, int page, int limit) throws Exception {
         PageInfo<Card> cz = this.cardService.tableSearch(card, page, limit);
 
-        for(int i = 0; i < cz.getSize(); ++i) {
-            ((Card)cz.getList().get(i)).setZflow(((Card)cz.getList().get(i)).getZflow() / 1024);
-            ((Card)cz.getList().get(i)).setSyflow(((Card)cz.getList().get(i)).getSyflow() / 1024);
-            ((Card)cz.getList().get(i)).setSyll(((Card)cz.getList().get(i)).getSyll() / 1024);
+        for (int i = 0; i < cz.getSize(); ++i) {
+            ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024);
+            ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024);
+            ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getSyll() / 1024);
             SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd");
             Date date = new Date();
-            if (cz.getList().get(i).getEnddate()!=null){
+            if (cz.getList().get(i).getEnddate() != null) {
                 Date endDay = date2.parse(cz.getList().get(i).getEnddate());//缁撴潫鏃堕棿
                 Long starTime = date.getTime();
                 Long endTime = endDay.getTime();
                 Long num11 = endTime - starTime;//鏃堕棿鎴�
-                if ((num11/24/60/60/1000)<0){
-                    ((Card)cz.getList().get(i)).setRemainingdays("0澶�");
-                }else{
-                    ((Card)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"澶�");
+                if ((num11 / 24 / 60 / 60 / 1000) < 0) {
+                    ((Card) cz.getList().get(i)).setRemainingdays("0澶�");
+                } else {
+                    ((Card) cz.getList().get(i)).setRemainingdays(+num11 / 24 / 60 / 60 / 1000 + "澶�");
                 }
-                if (!((Card)cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card)cz.getList().get(i)).getRemainingdays().equals(+num11/24/60/60/1000+"澶�") ){
-                    this.cardService.UpdateCard((Card)cz.getList().get(i));
+                if (!((Card) cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((Card) cz.getList().get(i)).getRemainingdays().equals(+num11 / 24 / 60 / 60 / 1000 + "澶�")) {
+                    this.cardService.UpdateCard((Card) cz.getList().get(i));
                 }
             }
 
@@ -271,7 +278,7 @@
         int length = 30;
         Random random = new Random();
 
-        for(int i = length; i > 0; --i) {
+        for (int i = length; i > 0; --i) {
             int index = random.nextInt(str.length());
             nonce = nonce + str.charAt(index);
         }
@@ -284,7 +291,7 @@
         String sign = Base64.getEncoder().encodeToString(hmacBytes);
         String targetUrl = "https://api.spruceiot.cn/api/v1/sim/list/query?pageIndex=1&pageSize=1";
         URL url = new URL(targetUrl);
-        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
         connection.setRequestProperty("Accept-Charset", "UTF-8");
         connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
         connection.setRequestProperty("Access-Control-Allow-Origin", "http://localhost:8080");
@@ -297,7 +304,7 @@
         StringBuilder response1 = new StringBuilder();
 
         String line;
-        while((line = reader.readLine()) != null) {
+        while ((line = reader.readLine()) != null) {
             response1.append(line);
         }
 
@@ -310,7 +317,7 @@
         int total1 = result.getInt("total");
         JSONArray list = result.getJSONArray("list");
 
-        for(int i = 0; i < list.size(); ++i) {
+        for (int i = 0; i < list.size(); ++i) {
             JSONObject item = list.getJSONObject(i);
             String msisdn = item.getStr("msisdn");
             String iccid = item.getStr("iccid");

--
Gitblit v1.9.3