Pu Zhibing
9 天以前 eaa61bc9ecd9158f192f9999845cb2f05e6970fb
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java
@@ -1,8 +1,11 @@
package com.supersavedriving.driver.modular.system.api;
import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.supersavedriving.driver.modular.system.dao.MonthOrderMapper;
@@ -10,11 +13,10 @@
import com.supersavedriving.driver.modular.system.service.*;
import com.supersavedriving.driver.modular.system.util.ALiSendSms;
import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse;
import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature;
import com.supersavedriving.driver.modular.system.util.MiniPay.MiniAppPay;
import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil;
import com.supersavedriving.driver.modular.system.util.huawei.SMSUtil;
import com.supersavedriving.driver.modular.system.util.juhe.OCRUtil;
import com.supersavedriving.driver.modular.system.util.qianyuntong.SMSUtil;
import com.supersavedriving.driver.modular.system.util.qianyuntong.model.SendSmsRequest;
import com.supersavedriving.driver.modular.system.util.separateAccounts.StrUtil;
import com.supersavedriving.driver.modular.system.util.separateAccounts.TransferUtil;
import com.supersavedriving.driver.modular.system.warpper.*;
@@ -31,11 +33,14 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.InputStream;
import java.io.PrintWriter;
import java.time.LocalDateTime;
@@ -83,8 +88,6 @@
    @Autowired
    private ISystemConfigService systemConfigService;
    @Autowired
    private IEditionService editionService;
@@ -96,6 +99,12 @@
    @Autowired
    private TCheckFacilitatorService checkFacilitatorService;
    @Value("${filePath}")
    private String filePath;
    @Value("${qyt.admin_url}")
    private String adminUrl;
@@ -158,6 +167,8 @@
            return new ResponseWarpper(500, e.getMessage());
        }
    }
    @ResponseBody
    @PostMapping("/base/driver/orcPhoto")
//    @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister")
@@ -210,10 +221,16 @@
                    return ResponseWarpper.success(ResultUtil.error("账号已冻结"));
                }
            }
            String numberRandom = UUIDUtil.getNumberRandom(5);
//            SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]");
            String sData = aLiSendSms.sendSms(phone,"SMS_154775435", "{\"code\":\"" + numberRandom + "\"}");
            String numberRandom = UUIDUtil.getNumberRandom(4);
            SendSmsRequest request = new SendSmsRequest();
            request.setDestAddress(phone);
            request.setTemplateId("TPL202410290001");
            Map<String, String> templateParams = new HashMap<>();
            templateParams.put("code", numberRandom);
            request.setTemplateParams(templateParams);
            request.setCode("code");
            request.setSpId("T8d5hdfg");
            SMSUtil.sendSms(request);
            redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期
            return ResponseWarpper.success(ResultUtil.success());
        }catch (Exception e){
@@ -908,7 +925,6 @@
    /**
     * 账户余额充值支付回调
     * @param response
     */
    @ResponseBody
    @PostMapping("/base/driver/balanceRechargeCallback")
@@ -1167,8 +1183,15 @@
            InputStream inputStream = file.getInputStream();
            String name = file.getOriginalFilename();
            name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf("."));
            String s = OBSUtil.putObjectToBucket(inputStream, name);
            return ResponseWarpper.success(s);
            File file1 = FileUtil.writeFromStream(inputStream, new File(filePath + name));
            HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image");
            HttpRequest form = post.form("file", file1);
            HttpResponse execute = form.execute();
            int status = execute.getStatus();
            if(200 != status){
                throw new RuntimeException("上传图片异常");
            }
            return ResponseWarpper.success(execute.body());
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());