puzhibing
2024-10-08 6f1a56eb02cb6eb7848e2df6773bc5abfee11efd
合併代碼
4个文件已修改
55 ■■■■ 已修改文件
ruoyi-service/ruoyi-account/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WxLoginController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/pom.xml
@@ -16,11 +16,6 @@
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-mock</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-api-order</artifactId>
        </dependency>
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -60,7 +60,7 @@
    @Autowired
    private TAppUserCarService appUserCarService;
    @Autowired
    @Resource
    private TokenService tokenService;
    @Resource
    private ChargingPileClient chargingPileClient;
@@ -117,7 +117,7 @@
        Integer data2 = otherClient.getAddCarIntegral().getData();
        data.setIntegral(data2);
        if (!cars.isEmpty()){
            if (data1 == -1){
            if (null == data1 || data1 == -1){
                // 没有充电订单 展示最新添加的车辆
                data.setLicensePlate(cars.get(0).getLicensePlate());
                data.setVehicleBrand(cars.get(0).getVehicleBrand());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WxLoginController.java
@@ -30,7 +30,7 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.mock.web.MockMultipartFile;
//import org.springframework.mock.web.MockMultipartFile;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
@@ -66,8 +66,12 @@
    /**
     * 上传文件存储在本地的根路径
     */
    @Value("${file.path}")
    @Value("${file.upload.location}")
    private String localFilePath;
    @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"})
    @PostMapping("/openIdByJsCode")
    public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserEncrypteData data) {
@@ -89,7 +93,7 @@
    }
    
    
    /**
    /**data
     * 测试用
     * @param appletUserDecodeData
     * @return
@@ -99,9 +103,11 @@
    public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserDecodeData appletUserDecodeData) {
        return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData, null));
    }
    public static MultipartFile convertInputStreamToMultipartFile(InputStream inputStream, String fileName, String contentType) throws IOException {
        return new MockMultipartFile(fileName, fileName, contentType, inputStream);
    }
//    public static MultipartFile convertInputStreamToMultipartFile(InputStream inputStream, String fileName, String contentType) throws IOException {
//        return new MockMultipartFile(fileName, fileName, contentType, inputStream);
//    }
    @ApiOperation(value = "获取微信小程序二维码",tags = {"获取微信小程序二维码"})
    @PostMapping("/getQRCode")
    public AjaxResult getQRCode() {
@@ -132,10 +138,10 @@
            System.err.println(Base64.encodeBase64String(result));
            inputStream = new ByteArrayInputStream(result);
            String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpeg";
            MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg");
            String name = FileUploadUtils.upload(localFilePath, multipartFile);
            System.err.println(name);
            return AjaxResult.success(name);
//            MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg");
//            String name = FileUploadUtils.upload(localFilePath, multipartFile);
//            System.err.println(name);
            return AjaxResult.success(null);
        } catch (Exception e) {
            System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e);
        } finally {
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -155,7 +155,7 @@
    public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){
        try {
            TChargingGun chargingGun = chargingGunService.getById(id);
            TChargingPile chargingPile = chargingPileService.getById(chargingGun.getId());
            TChargingPile chargingPile = chargingPileService.getById(chargingGun.getChargingPileId());
            String code = chargingPile.getCode() + chargingGun.getCode();
            String fileName = URLEncoder.encode(code, "UTF-8") + ".jpg";
            response.setContentType("application/force-download");
@@ -175,15 +175,15 @@
            inputStream.close();
            
            //清楚服务器上的文件
            Process process = null;
            try {
                process = Runtime.getRuntime().exec("sudo rm -rf " + filePath);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            if (process != null) {
                process.destroy();
            }
//            Process process = null;
//            try {
//                process = Runtime.getRuntime().exec("sudo rm -rf " + filePath);
//            } catch (IOException e) {
//                throw new RuntimeException(e);
//            }
//            if (process != null) {
//                process.destroy();
//            }
        }catch (Exception e){
            e.printStackTrace();
        }