puzhibing
2023-09-01 75d6a10fd6ab39dc2db63c8cf4879ebba17f4e54
更新
8个文件已修改
133 ■■■■ 已修改文件
UserIGOTravel/guns-admin/pom.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/pom.xml
@@ -9,7 +9,7 @@
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>guns-admin</artifactId>
    <artifactId>user</artifactId>
    <name>guns-admin</name>
    <description>guns 的spring boot版本</description>
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java
@@ -19,7 +19,9 @@
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.nio.charset.StandardCharsets;
import java.util.TimeZone;
/**
 * SpringBoot方式启动类
@@ -40,6 +42,13 @@
        logger.info("GunsApplication is success!");
    }
    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+0"));
    }
    /**
     * 向Spring容器中定义RestTemplate对象
     * @return
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -614,6 +614,10 @@
            orderLogistics.setPayMoney(orderMoney);
            if(ToolUtil.isNotEmpty(userInfo.getEmail())){
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                String path = templatePath + "user/receiptLogistics.html";
                Document document = Jsoup.parse(new File(path), "UTF-8");
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
@@ -739,6 +743,11 @@
                }
                FileOutputStream fileOutputStream = new FileOutputStream(file1);
                HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -1008,6 +1008,10 @@
            }
            if(ToolUtil.isNotEmpty(userInfo.getEmail())){
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                String path = templatePath +  "user/receipt.html";
                Document document = Jsoup.parse(new File(path), "UTF-8");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1169,6 +1173,11 @@
                }
                FileOutputStream fileOutputStream = new FileOutputStream(file1);
                HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
@@ -1277,6 +1286,10 @@
            }
            if(ToolUtil.isNotEmpty(userInfo.getEmail())){
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                String path = templatePath +  "user/receipt.html";
                Document document = Jsoup.parse(new File(path), "UTF-8");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1439,6 +1452,11 @@
                }
                FileOutputStream fileOutputStream = new FileOutputStream(file1);
                HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
@@ -1700,6 +1718,10 @@
            if(ToolUtil.isNotEmpty(userInfo.getEmail())){
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                String path = templatePath +  "user/receipt.html";
                Document document = Jsoup.parse(new File(path), "UTF-8");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1862,6 +1884,11 @@
                }
                FileOutputStream fileOutputStream = new FileOutputStream(file1);
                HtmlToPdfUtils.convertToPdf(fileInputStream, "IGO", fileOutputStream);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
@@ -113,6 +113,9 @@
    private String salt = "&a.s";
    @Autowired
    private SMSUtil smsUtil;
    /**
     * 获取短信验证码
@@ -144,7 +147,7 @@
                    sms = "Votre code de vérification est: " + authCode + ". Ce code est valide pendant 5 minutes. Ne le divulguez pas aux autres!";
                    break;
            }
            SMSUtil.sendTwilioMessage("+" + phone, sms);
            smsUtil.sendCellulantMessage(phone, sms);
        }
        return ResultUtil.success();
    }
@@ -1629,6 +1632,7 @@
     * @param id
     */
    private void singlePointLogin(Integer id) throws Exception{
        pushUtil.pushOffline(id, 1);
        //开始验证当前账号是否在别处登录
        String value = redisUtil.getValue("USER_" + id);
        if(ToolUtil.isNotEmpty(value)){//将另外设备上的强迫下线
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java
@@ -1,9 +1,13 @@
package com.stylefeng.guns.modular.system.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.net.ssl.*;
import java.io.*;
@@ -16,6 +20,7 @@
import java.text.SimpleDateFormat;
import java.util.*;
@Component
public class SMSUtil {
    //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值
@@ -266,6 +271,32 @@
        }
    }
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * Cellulant短信
     * @param toPhone
     * @param msg
     * @return
     */
    public boolean sendCellulantMessage(String toPhone, String msg){
        String url = "https://sms.nalosolutions.com/smsbackend/Nal_resl/send-message/";
        Map<String, Object> params = new HashMap<>();
        params.put("key", "ru#0flkf3993qh!!rg!@y4)nhwi08c#tg_vasek!ja)kvfnfjyoljoz(@nai(jkf");
        params.put("msisdn", toPhone);
        params.put("message", msg);
        params.put("sender_id", "I-GO");
        String s = httpClientUtil.pushHttpRequset("POST", url, params, null, "json");
        JSONObject jsonObject = JSON.parseObject(s);
        Integer status = jsonObject.getInteger("status");
        if(1701 == status){
            return true;
        }else{
            return false;
        }
    }
@@ -278,18 +309,21 @@
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537";
        String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57";
        try {
            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
            Message message = Message.creator(
                    new PhoneNumber("+233570111999"),
                    new PhoneNumber("+16672740015"),
                    "This is the ship that made the Kessel Run in fourteen parsecs?"
            ).create();
            System.out.println(message.getSid() + "--->" + message.getStatus().toString());
        }catch (Exception e){
            e.printStackTrace();
        }
//        String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537";
//        String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57";
//        try {
//            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
//            Message message = Message.creator(
//                    new PhoneNumber("+233570111999"),
//                    new PhoneNumber("+16672740015"),
//                    "This is the ship that made the Kessel Run in fourteen parsecs?"
//            ).create();
//            System.out.println(message.getSid() + "--->" + message.getStatus().toString());
//        }catch (Exception e){
//            e.printStackTrace();
//        }
    }
}
UserIGOTravel/guns-admin/src/main/resources/application.yml
@@ -52,7 +52,7 @@
spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B0
    username: root
    password: HjKbXilb9zajmXbl
    db-name: guns #用来搜集数据库的所有表
UserIGOTravel/guns-admin/src/test/java/com/stylefeng/guns/TestGunsApplication.java
@@ -1,5 +1,6 @@
//package com.stylefeng.guns;
//
//import com.stylefeng.guns.modular.system.util.SMSUtil;
//import com.stylefeng.guns.modular.system.util.Tingg.TinggPayoutUtil;
//import com.twilio.Twilio;
//import com.twilio.http.TwilioRestClient;
@@ -23,21 +24,12 @@
//    @Autowired
//    private TinggPayoutUtil tinggPayoutUtil;
//
//    @Autowired
//    private SMSUtil smsUtil;
//
//
//    @Test
//    public void test(){
//        String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537";
//        String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57";
//        try {
//            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
//            Message message = Message.creator(
//                    new PhoneNumber("+233500666666"),
//                    new PhoneNumber("+16672740015"),
//                    "This is the ship that made the Kessel Run in fourteen parsecs?"
//            ).create();
//            System.out.println(message.getSid());
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        smsUtil.sendCellulantMessage("233500666666", "test");
//    }
//}