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 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; } }