|
@@ -42,6 +42,8 @@ import java.util.Map;
|
|
public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillBuyInfo> implements IBillBuyInfoService {
|
|
public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillBuyInfo> implements IBillBuyInfoService {
|
|
@Resource
|
|
@Resource
|
|
private BaseAnimalMapper baseAnimalMapper;
|
|
private BaseAnimalMapper baseAnimalMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private BillBuyInfoMapper billBuyInfoMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
@@ -67,7 +69,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- String content = "http://139.9.167.178/images"+path +"/"+imgname;
|
|
|
|
|
|
+ String content = "http://139.9.167.178/images/"+path +"/"+imgname;
|
|
|
|
|
|
String imgname2 = "成功";
|
|
String imgname2 = "成功";
|
|
String originalFilename2 = image2.getOriginalFilename();
|
|
String originalFilename2 = image2.getOriginalFilename();
|
|
@@ -90,7 +92,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- String content2 = "http://139.9.167.178/images"+path2 +"/"+imgname2;
|
|
|
|
|
|
+ String content2 = "http://139.9.167.178/images/"+path2 +"/"+imgname2;
|
|
|
|
|
|
String imgname3 = "成功";
|
|
String imgname3 = "成功";
|
|
String originalFilename3 = image3.getOriginalFilename();
|
|
String originalFilename3 = image3.getOriginalFilename();
|
|
@@ -113,7 +115,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- String content3 = "http://139.9.167.178/images"+path3 +"/"+imgname3;
|
|
|
|
|
|
+ String content3 = "http://139.9.167.178/images/"+path3 +"/"+imgname3;
|
|
|
|
|
|
BillBuyInfo billBuyInfo = new BillBuyInfo();
|
|
BillBuyInfo billBuyInfo = new BillBuyInfo();
|
|
billBuyInfo.setInspectionNum(inspectionNum);
|
|
billBuyInfo.setInspectionNum(inspectionNum);
|
|
@@ -126,6 +128,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
billBuyInfo.setPayPicUrl(content2);
|
|
billBuyInfo.setPayPicUrl(content2);
|
|
billBuyInfo.setBuyPayGoodsPicUrl(content3);
|
|
billBuyInfo.setBuyPayGoodsPicUrl(content3);
|
|
billBuyInfo.setRealEartag(eartags);
|
|
billBuyInfo.setRealEartag(eartags);
|
|
|
|
+ billBuyInfo.setBillBuyStatus(2);
|
|
this.save(billBuyInfo);
|
|
this.save(billBuyInfo);
|
|
|
|
|
|
if (eartags.contains(";")){
|
|
if (eartags.contains(";")){
|
|
@@ -204,4 +207,100 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
}
|
|
}
|
|
return Result.SUCCESS();
|
|
return Result.SUCCESS();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result saveTransaction(HttpServletRequest httpServletRequest, MultipartFile image1, MultipartFile image2, MultipartFile image3, String inspectionNum, String seller, String buyer, String num, String eartags) {
|
|
|
|
+ String imgname = "成功";
|
|
|
|
+ String originalFilename = image1.getOriginalFilename();
|
|
|
|
+ String filenameExtension = StringUtils.getFilenameExtension(originalFilename);
|
|
|
|
+ String path = DateUtil.format(new Date(),"yyyy-MM");
|
|
|
|
+ try {
|
|
|
|
+ InputStream inputStream = image1.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 = "http://139.9.167.178/images/"+path +"/"+imgname;
|
|
|
|
+
|
|
|
|
+ String imgname2 = "成功";
|
|
|
|
+ String originalFilename2 = image2.getOriginalFilename();
|
|
|
|
+ String filenameExtension2 = StringUtils.getFilenameExtension(originalFilename2);
|
|
|
|
+ String path2 = DateUtil.format(new Date(),"yyyy-MM");
|
|
|
|
+ try {
|
|
|
|
+ InputStream inputStream = image2.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[] content2 = out.toByteArray();
|
|
|
|
+ imgname2 = UUID.randomUUID()+"."+filenameExtension2;
|
|
|
|
+ UploadImage.sshSftp(content2,path2, imgname2);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ String content2 = "http://139.9.167.178/images/"+path2 +"/"+imgname2;
|
|
|
|
+
|
|
|
|
+ String imgname3 = "成功";
|
|
|
|
+ String originalFilename3 = image3.getOriginalFilename();
|
|
|
|
+ String filenameExtension3 = StringUtils.getFilenameExtension(originalFilename3);
|
|
|
|
+ String path3 = DateUtil.format(new Date(),"yyyy-MM");
|
|
|
|
+ try {
|
|
|
|
+ InputStream inputStream = image3.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[] content3 = out.toByteArray();
|
|
|
|
+ imgname3 = UUID.randomUUID()+"."+filenameExtension3;
|
|
|
|
+ UploadImage.sshSftp(content3,path3, imgname3);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ String content3 = "http://139.9.167.178/images/"+path3 +"/"+imgname3;
|
|
|
|
+
|
|
|
|
+ BillBuyInfo billBuyInfo = new BillBuyInfo();
|
|
|
|
+ billBuyInfo.setInspectionNum(inspectionNum);
|
|
|
|
+ billBuyInfo.setBuyerName(buyer);
|
|
|
|
+ billBuyInfo.setSellerName(seller);
|
|
|
|
+ billBuyInfo.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
|
+ billBuyInfo.setCreateTime(DateTime.now());
|
|
|
|
+ billBuyInfo.setRealNumUp(num);
|
|
|
|
+ billBuyInfo.setBuyPicUrl(content);
|
|
|
|
+ billBuyInfo.setPayPicUrl(content2);
|
|
|
|
+ billBuyInfo.setBuyPayGoodsPicUrl(content3);
|
|
|
|
+ billBuyInfo.setRealEartag(eartags);
|
|
|
|
+ billBuyInfo.setBillBuyStatus(1);
|
|
|
|
+ this.save(billBuyInfo);
|
|
|
|
+ return Result.SUCCESS();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result getLast(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
|
+ return new Result(ResultCode.SUCCESS, billBuyInfoMapper.selectList(new QueryWrapper<BillBuyInfo>()
|
|
|
|
+ .eq("bill_buy_status",1)
|
|
|
|
+ .eq("create_user",TokenSign.getUserName(httpServletRequest))
|
|
|
|
+ .orderByDesc("create_time")
|
|
|
|
+ .last("limit 1")));
|
|
|
|
+ }
|
|
}
|
|
}
|