Sfoglia il codice sorgente

交易,落地检五张照片

Newspaper 2 anni fa
parent
commit
9673646a78

+ 10 - 7
admin/src/main/java/com/huimv/farm/damsubsidy/controller/BillBuyInfoController.java

@@ -43,13 +43,16 @@ public class BillBuyInfoController {
         Page<BillBuyInfo> page = new Page(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
         Page<BillBuyInfo> billBuyInfoPage = billBuyInfoService.page(page, new QueryWrapper<BillBuyInfo>().orderByDesc("create_time").eq("bill_buy_status", 2));
         Page<BillBuyInfoImageVo> billBuyInfoVoPage = new Page<>();
-        BeanUtil.copyProperties(billBuyInfoPage,billBuyInfoVoPage);
-        for (BillBuyInfoImageVo record : billBuyInfoVoPage.getRecords()) {
-            if (ObjectUtil.isNotEmpty(record.getBuyPicUrl())){
-                String[] split = record.getBuyPicUrl().split(",");
-                record.setPages(split);
+        List billBuyInfoImageVoList = new ArrayList();
+        for (BillBuyInfo record : billBuyInfoPage.getRecords()) {
+            BillBuyInfoImageVo billBuyInfoImageVo = new BillBuyInfoImageVo();
+            BeanUtil.copyProperties(record,billBuyInfoImageVo);
+            if (ObjectUtil.isNotEmpty(record.getBuyPayGoodsPicUrl())){
+                billBuyInfoImageVo.setPages(record.getBuyPayGoodsPicUrl().split(","));
             }
+            billBuyInfoImageVoList.add(billBuyInfoImageVo);
         }
+        billBuyInfoVoPage.setRecords(billBuyInfoImageVoList);
         return new Result(ResultCode.SUCCESS, billBuyInfoVoPage);
     }
 
@@ -60,15 +63,15 @@ public class BillBuyInfoController {
                                  @RequestParam(value = "buyImage3", required = false) MultipartFile buyImage3,
                                  @RequestParam(value = "buyImage4", required = false) MultipartFile buyImage4,
                                  @RequestParam(value = "buyImage5", required = false) MultipartFile buyImage5,
+                                 @RequestParam("image1") MultipartFile image1,
                                  @RequestParam("image2") MultipartFile image2,
-                                 @RequestParam("image3") MultipartFile image3,
                                  @RequestParam("inspectionNum") String inspectionNum,
                                  @RequestParam("seller") String seller,
                                  @RequestParam("buyer") String buyer,
                                  @RequestParam("num") String num,
                                  @RequestParam("eartags") String eartags,
                                  @RequestParam("buyerPhone")String buyerPhone) throws IOException {
-        return billBuyInfoService.addTransaction(httpServletRequest,buyImage1,buyImage2,buyImage3,buyImage4,buyImage5,image2,image3,inspectionNum,seller,buyer,num,eartags,buyerPhone);
+        return billBuyInfoService.addTransaction(httpServletRequest,buyImage1,buyImage2,buyImage3,buyImage4,buyImage5,image1,image2,inspectionNum,seller,buyer,num,eartags,buyerPhone);
     }
 
     @PostMapping("/saveTransaction")

+ 19 - 8
admin/src/main/java/com/huimv/farm/damsubsidy/service/impl/BillBuyInfoServiceImpl.java

@@ -52,12 +52,11 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
     private UploadImage uploadImage;
     @Override
     @Transactional(rollbackFor = RuntimeException.class)
-    public synchronized Result addTransaction(HttpServletRequest httpServletRequest, MultipartFile buyImage1, MultipartFile buyImage2, MultipartFile buyImage3, MultipartFile buyImage4, MultipartFile buyImage5, MultipartFile image2, MultipartFile image3, String inspectionNum, String seller, String buyer, String num, String eartags,String buyerPhone) throws IOException {
+    public synchronized Result addTransaction(HttpServletRequest httpServletRequest, MultipartFile buyImage1, MultipartFile buyImage2, MultipartFile buyImage3, MultipartFile buyImage4, MultipartFile buyImage5, MultipartFile image1, MultipartFile image2, String inspectionNum, String seller, String buyer, String num, String eartags,String buyerPhone) throws IOException {
         BillBuyInfo billBuyInfo1 = billBuyInfoMapper.selectOne(new QueryWrapper<BillBuyInfo>().eq("create_user", TokenSign.getMemberIdByJwtToken(httpServletRequest)).eq("bill_buy_status",1));
         SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper<SysUser>().eq("phone", buyerPhone));
         BillLandingInspection billLandingInspection = billLandingInspectionMapper.selectOne(new QueryWrapper<BillLandingInspection>().eq("inspection_num", inspectionNum));
         int total = Integer.parseInt(num);
-        String content = null;
         if (ObjectUtil.isNotEmpty(sysUser)){
             if (!sysUser.getUserName().equals(buyer)){
                 return new Result(10001,"买家手机号和姓名不匹配",false);
@@ -89,13 +88,14 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
             baseAnimal.setBuyTime(DateTime.now());
             baseAnimalMapper.updateById(baseAnimal);
         }
-        content = BuyImageUtil.getUrl(content,buyImage1);
-        content = BuyImageUtil.getUrl(content,buyImage2);
-        content = BuyImageUtil.getUrl(content,buyImage3);
-        content = BuyImageUtil.getUrl(content,buyImage4);
-        content = BuyImageUtil.getUrl(content,buyImage5);
+        String content3 = "";
+        String content = uploadImage.getImageCom(image1);
         String content2 = uploadImage.getImageCom(image2);
-        String content3 = uploadImage.getImageCom(image3);
+        content3 = getUrl(content3,buyImage1);
+        content3 = getUrl(content3,buyImage2);
+        content3 = getUrl(content3,buyImage3);
+        content3 = getUrl(content3,buyImage4);
+        content3 = getUrl(content3,buyImage5);
 
 
         if (ObjectUtil.isEmpty(billBuyInfo1)){
@@ -138,6 +138,17 @@ public class BillBuyInfoServiceImpl extends ServiceImpl<BillBuyInfoMapper, BillB
         return Result.SUCCESS();
     }
 
+    public  String getUrl(String content, MultipartFile image) throws IOException {
+        if (ObjectUtil.isNotEmpty(image)){
+            if ( !"".equals(content)){
+                content = content +","+uploadImage.getImageCom(image);
+            }else {
+                content =   content +uploadImage.getImageCom(image);
+            }
+        }
+        return content;
+    }
+
     @Override
     @Transactional
     public Result saveTransaction(HttpServletRequest httpServletRequest,Map<String, String> paramsMap) {