|
@@ -26,6 +26,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -261,29 +262,8 @@ public class BillIsolatedServiceImpl extends ServiceImpl<BillIsolatedMapper, Bil
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Result cancelIsolation(HttpServletRequest httpServletRequest, MultipartFile image, String id, String isDead, String deaths) {
|
|
|
- String imgname = "成功";
|
|
|
- String originalFilename = image.getOriginalFilename();
|
|
|
- String filenameExtension = StringUtils.getFilenameExtension(originalFilename);
|
|
|
- String path = DateUtil.format(new Date(),"yyyy-MM");
|
|
|
- try {
|
|
|
- InputStream inputStream = image.getInputStream();
|
|
|
- BufferedInputStream in = new BufferedInputStream(inputStream);
|
|
|
- ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
|
|
|
-
|
|
|
- byte[] temp = new byte[1024];
|
|
|
- int size = 0;
|
|
|
- while ((size = in.read(temp)) != -1) {
|
|
|
- out.write(temp, 0, size);
|
|
|
- }
|
|
|
- in.close();
|
|
|
- byte[] content = out.toByteArray();
|
|
|
- imgname = UUID.randomUUID()+"."+filenameExtension;
|
|
|
- UploadImage.sshSftp(content,path, imgname);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- String content = "https://dam.img.ifarmcloud.com:8030/images/"+path +"/"+imgname;
|
|
|
+ public Result cancelIsolation(HttpServletRequest httpServletRequest, MultipartFile image, String id, String isDead, String deaths) throws IOException {
|
|
|
+ String content = UploadImage.getImageCom(image);
|
|
|
BillIsolated isolation = this.getById(id);
|
|
|
isolation.setIsolatedPicUrl(content);
|
|
|
isolation.setIsolatedSch(2);
|