From 871d4095b07cedacb7fbef4c38d64982f539c404 Mon Sep 17 00:00:00 2001
From: fei.wang <wf18701153496@163.com>
Date: 星期四, 09 五月 2024 15:40:15 +0800
Subject: [PATCH] 测试提交

---
 src/main/java/com/flow/controller/IndexController.java |  161 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 106 insertions(+), 55 deletions(-)

diff --git a/src/main/java/com/flow/controller/IndexController.java b/src/main/java/com/flow/controller/IndexController.java
index 7cecefe..03e3ba8 100644
--- a/src/main/java/com/flow/controller/IndexController.java
+++ b/src/main/java/com/flow/controller/IndexController.java
@@ -8,13 +8,19 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.flow.mapper.CardMapper;
+import com.flow.mapper.OperationLogMapper;
 import com.flow.pojo.Card;
+import com.flow.pojo.OperationLog;
 import com.flow.pojo.TbFuwuqi;
 import com.flow.service.CardService;
 import com.flow.service.CompanyService;
+import com.flow.service.OperationLogService;
 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,7 +32,9 @@
 import java.util.*;
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
+
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,6 +48,12 @@
     CardService cardService;
     @Autowired
     CompanyService companyService;
+
+    @Autowired
+    CardMapper cardMapper;
+
+    @Autowired
+    OperationLogMapper operationLogMapper;
 
     public IndexController() {
     }
@@ -56,35 +70,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));
                         }
                     }
 
@@ -102,29 +120,29 @@
         return this.companyService.chaZi(Zong);
     }
 
-    @GetMapping({"FindCardZi"})
-    public result<List<Card>> FindCardZi(String Zong, Integer page, Integer limit) throws Exception {
-        PageInfo<Card> cz = this.cardService.FindCardaZi(Zong, page, limit);
+    @PostMapping({"FindCardZi"})
+    public result<List<Card>> FindCardZi(Card card, Integer page, Integer limit) throws Exception {
+        PageInfo<Card> cz = this.cardService.FindCardaZi(card, 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));
                     }
                 }
             }
@@ -134,8 +152,9 @@
     }
 
     @PostMapping({"DeleteCard"})
-    public int DeleteCard(String num) {
-        return this.cardService.DeleteCard(num);
+    public int DeleteCard(String num ,String caozuoname) {
+
+        return this.cardService.DeleteCard(num,caozuoname);
     }
 
     @PostMapping({"Update"})
@@ -149,8 +168,37 @@
     @PostMapping({"UpdateChong"})
     public ModelAndView UpdateChong(Card card) {
         this.cardService.UpdateCardChong(card);
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("cardnumber", card.getCardnumber());
+        Card tbFuwuqi1 = cardMapper.selectOne(queryWrapper);
+        OperationLog operationLog = new OperationLog();
+        operationLog.setCaozuotype("淇敼");
+        operationLog.setCaozuocontent("淇敼鍗″彿锛�"+tbFuwuqi1.getCardnumber());
+//        operationLogMapper.addOperationLog(operationLog);
+        operationLog.setCaozuoname(card.getCaozuoname());
+        Date date = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        operationLog.setCaozuodate(formatter.format(date));
+        operationLogMapper.insert(operationLog);
         ModelAndView modelAndView = new ModelAndView();
         modelAndView.setViewName("/page/index1.jsp");
+        modelAndView.addObject("operatornum", 2);
+        return modelAndView;
+    }
+    @PostMapping({"updateBatchById"})
+    @Transactional(rollbackFor = Exception.class)
+    public ModelAndView updateBatchById(Card card) {
+        this.cardService.updateBatchById(card);
+        OperationLog operationLog = new OperationLog();
+        operationLog.setCaozuotype("淇敼");
+        operationLog.setCaozuocontent("淇敼鍗″彿锛�"+card.getCardnumber());
+        Date date = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        operationLog.setCaozuodate(formatter.format(date));
+        operationLogMapper.insert(operationLog);
+        ModelAndView modelAndView = new ModelAndView();
+        modelAndView.setViewName("/page/index1.jsp");
+        modelAndView.addObject("operatornum", 2);
         return modelAndView;
     }
 
@@ -164,7 +212,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 +227,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 +242,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 +257,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 +271,27 @@
     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) {
+            if (((Card) cz.getList().get(i)).getCompany().equals("鍗庢槦鏅烘帶")){
+                ((Card) cz.getList().get(i)).setCompany("鍖椾含鍗庢槦鍖楁枟鏅烘帶鎶�鏈湁闄愬叕鍙�");
+            }
+//            ((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 +322,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 +335,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 +348,7 @@
         StringBuilder response1 = new StringBuilder();
 
         String line;
-        while((line = reader.readLine()) != null) {
+        while ((line = reader.readLine()) != null) {
             response1.append(line);
         }
 
@@ -310,7 +361,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