| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.cardService.UpdateCardChong(card); |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("/page/index1.jsp"); |
| | | modelAndView.addObject("operatornum", 2); |
| | | return modelAndView; |
| | | } |
| | | |
| | |
| | | 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]); |
| | |
| | | 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]); |
| | |
| | | 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]); |
| | |
| | | this.cardService.addCard(card1); |
| | | } |
| | | } else { |
| | | if (card.getCardnumber()!=null){ |
| | | if (card.getCardnumber() != null && card.getCardnumber() != "") { |
| | | card.setCompany(card.getCompany()); |
| | | this.cardService.addCard(card); |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"); |
| | |
| | | StringBuilder response1 = new StringBuilder(); |
| | | |
| | | String line; |
| | | while((line = reader.readLine()) != null) { |
| | | while ((line = reader.readLine()) != null) { |
| | | response1.append(line); |
| | | } |
| | | |
| | |
| | | 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"); |