|
@@ -11,6 +11,7 @@ import com.huimv.farm.damsubsidy.common.utils.ResultCode;
|
|
|
import com.huimv.farm.damsubsidy.common.utils.UploadImage;
|
|
|
import com.huimv.farm.damsubsidy.entity.BaseAnimal;
|
|
|
import com.huimv.farm.damsubsidy.entity.BillBuyInfo;
|
|
|
+import com.huimv.farm.damsubsidy.entity.BillBuyInfoVo;
|
|
|
import com.huimv.farm.damsubsidy.mapper.BaseAnimalMapper;
|
|
|
import com.huimv.farm.damsubsidy.mapper.BillBuyInfoMapper;
|
|
|
import com.huimv.farm.damsubsidy.service.IBillBuyInfoService;
|
|
@@ -121,6 +122,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
|
BillBuyInfo billBuyInfo1 = billBuyInfoMapper.selectOne(new QueryWrapper<BillBuyInfo>().eq("create_user", TokenSign.getUserName(httpServletRequest)).eq("bill_buy_status",1));
|
|
|
if (ObjectUtil.isEmpty(billBuyInfo1)){
|
|
|
BillBuyInfo billBuyInfo = new BillBuyInfo();
|
|
|
+ billBuyInfo.setBuyName(seller+"和"+buyer+"的交易信息");
|
|
|
billBuyInfo.setInspectionNum(inspectionNum);
|
|
|
billBuyInfo.setBuyerName(buyer);
|
|
|
billBuyInfo.setSellerName(seller);
|
|
@@ -134,6 +136,7 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
|
billBuyInfo.setBillBuyStatus(2);
|
|
|
this.save(billBuyInfo);
|
|
|
}else {
|
|
|
+ billBuyInfo1.setBuyName(seller+"和"+buyer+"的交易信息");
|
|
|
billBuyInfo1.setInspectionNum(inspectionNum);
|
|
|
billBuyInfo1.setBuyerName(buyer);
|
|
|
billBuyInfo1.setSellerName(seller);
|
|
@@ -227,101 +230,109 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
|
}
|
|
|
|
|
|
@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;
|
|
|
+ @Transactional
|
|
|
+ public Result saveTransaction(HttpServletRequest httpServletRequest,Map<String, String> paramsMap) {
|
|
|
+ String inspectionNum = paramsMap.get("inspectionNum");
|
|
|
+ String seller = paramsMap.get("seller");
|
|
|
+ String buyer = paramsMap.get("buyer");
|
|
|
+ String num = paramsMap.get("num");
|
|
|
+ String eartags = paramsMap.get("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 billBuyInfo1 = billBuyInfoMapper.selectOne(new QueryWrapper<BillBuyInfo>().eq("create_user", TokenSign.getUserName(httpServletRequest)).eq("bill_buy_status",1));
|
|
|
if (ObjectUtil.isEmpty(billBuyInfo1)){
|
|
|
BillBuyInfo billBuyInfo = new BillBuyInfo();
|
|
|
+ billBuyInfo.setBuyName(seller+"和"+buyer+"的交易信息");
|
|
|
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.setBuyPicUrl(content);
|
|
|
+// billBuyInfo.setPayPicUrl(content2);
|
|
|
+// billBuyInfo.setBuyPayGoodsPicUrl(content3);
|
|
|
billBuyInfo.setRealEartag(eartags);
|
|
|
billBuyInfo.setBillBuyStatus(1);
|
|
|
this.save(billBuyInfo);
|
|
|
}else {
|
|
|
+ billBuyInfo1.setBuyName(seller+"和"+buyer+"的交易信息");
|
|
|
billBuyInfo1.setInspectionNum(inspectionNum);
|
|
|
billBuyInfo1.setBuyerName(buyer);
|
|
|
billBuyInfo1.setSellerName(seller);
|
|
|
billBuyInfo1.setCreateUser(TokenSign.getUserName(httpServletRequest));
|
|
|
billBuyInfo1.setCreateTime(DateTime.now());
|
|
|
billBuyInfo1.setRealNumUp(num);
|
|
|
- billBuyInfo1.setBuyPicUrl(content);
|
|
|
- billBuyInfo1.setPayPicUrl(content2);
|
|
|
- billBuyInfo1.setBuyPayGoodsPicUrl(content3);
|
|
|
+// billBuyInfo1.setBuyPicUrl(content);
|
|
|
+// billBuyInfo1.setPayPicUrl(content2);
|
|
|
+// billBuyInfo1.setBuyPayGoodsPicUrl(content3);
|
|
|
billBuyInfo1.setRealEartag(eartags);
|
|
|
billBuyInfo1.setBillBuyStatus(1);
|
|
|
this.updateById(billBuyInfo1);
|
|
@@ -331,13 +342,18 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
|
|
|
|
|
|
@Override
|
|
|
public Result getLast(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
- BillBuyInfo billBuyInfo = billBuyInfoMapper.selectOne(new QueryWrapper<BillBuyInfo>()
|
|
|
- .eq("bill_buy_status", 1)
|
|
|
- .eq("create_user", TokenSign.getUserName(httpServletRequest)));
|
|
|
+ BillBuyInfoVo billBuyInfo = billBuyInfoMapper.getLast(TokenSign.getUserName(httpServletRequest));
|
|
|
if (ObjectUtil.isEmpty(billBuyInfo)){
|
|
|
return new Result(ResultCode.SUCCESS,null);
|
|
|
}else {
|
|
|
return new Result(ResultCode.SUCCESS,billBuyInfo);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result listDetail(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String id = paramsMap.get("id");
|
|
|
+ BillBuyInfoVo billBuyInfo= billBuyInfoMapper.listDetail(id);
|
|
|
+ return new Result(ResultCode.SUCCESS,billBuyInfo);
|
|
|
+ }
|
|
|
}
|