| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserComplaintMapper;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.user.UserComplaintException;
|
| | | import com.yeshi.fanli.service.inter.user.UserComplaintService;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | |
| | | private UserComplaintMapper userComplaintMapper;
|
| | |
|
| | | @Override
|
| | | public void addUserComplaint(List<CommonsMultipartFile> fileList, Long uid, String content) |
| | | public void addUserComplaint(List<MultipartFile> fileList, Long uid, String content) |
| | | throws UserComplaintException, IOException, Exception {
|
| | |
|
| | | if (content == null || content.trim().length() == 0) {
|
| | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | // 文件上传
|
| | | for (CommonsMultipartFile file: fileList) {
|
| | | for (MultipartFile file: fileList) {
|
| | |
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 上传文件相对位置
|
| | | String fileUrl="/img/UserComplaint/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String fileUrl= FilePathEnum.userComplaint.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | |
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
|
| | | array.add(uploadFilePath);
|