fei.wang
2025-04-18 321a74059773cfecc01d6313f7c2e2d45545d6d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.hxzkappboot.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.hxzk.mapper.TbZypHandelMapper;
//import com.hxzk.pojo.TbZypHandel;
//import com.hxzk.util.MyFile1;
import com.hxzkappboot.service.UserService;
import com.hxzkappboot.util.MyFile1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
 
@Component
@RestController
//@RequestMapping("/")
//@CrossOrigin
public class uploadimgController {
 
    @Autowired
    UserService userService;
 
    @PostMapping("/api/wx/addpicqwe")
    public String addpicqwe(HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile images) throws IOException {
        String name = request.getParameter("timename");
//        String bumen = request.getParameter("phone");
        String originalFilename = images.getOriginalFilename();
        String fileExtension = StringUtils.getFilenameExtension(originalFilename);
//        name = name + bumen;
        MyFile1.addWeichatImage(images,request,name);
//                QueryWrapper queryWrapper1 = new QueryWrapper<>();
//        queryWrapper1.eq("zypcode", tbZypHandel.getZypcode());
//        queryWrapper1.last("LIMIT 1");
//        TbZypHandel tbZypHandel1 = baseMapper.selectOne(queryWrapper);
//        System.out.println(tbZypHandel1);
//        TbZypHandel tbZypHandel1 = baseMapper.selectOne(queryWrapper);
//        System.out.println(tbZypHandel2);
//        if (tbZypHandel2.getId().equals(tbZypHandel1.getId())){
//            System.out.println("请求119服务器接口");
//            HashMap<String, Object> paramMap = new HashMap<>();
//            paramMap.put("zypcode", tbZypHandel.getZypcode());//参数
//            String result= HttpUtil.get("http://119.115.132.26:7002/hxzkuwb/ExportPdf", paramMap);//接口
//            System.out.println(result);//返回pdf地址
//            tbZypHandel.setZyppdf(result);
//        }
        return name + "." + fileExtension;
    }
}