فهرست منبع

配置公共属性

523096025 2 سال پیش
والد
کامیت
7412eba1ec

+ 4 - 2
admin/src/main/java/com/huimv/farm/damsubsidy/common/utils/BuyImageUtil.java

@@ -1,6 +1,7 @@
 package com.huimv.farm.damsubsidy.common.utils;
 
 import cn.hutool.core.util.ObjectUtil;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -12,12 +13,13 @@ public class BuyImageUtil {
 
     public static String getUrl(String content, MultipartFile image) throws IOException {
         if (ObjectUtil.isNotEmpty(image)){
-            if (ObjectUtil.isNotNull(content)){
+            if ( !"".equals(content)){
                 content = content +","+uploadImage.getImageCom(image);
             }else {
-                content = content + uploadImage.getImageCom(image);
+                content =   content +uploadImage.getImageCom(image);
             }
         }
         return content;
     }
+
 }

+ 0 - 1
admin/src/main/java/com/huimv/farm/damsubsidy/entity/BillLandingInspection.java

@@ -34,7 +34,6 @@ public class BillLandingInspection extends BaseEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @TableId(value = "id", type = IdType.ASSIGN_ID)
-
     @JsonSerialize(using = LongJsonSerializer.class)
     @JsonDeserialize(using = LongJsonDeserializer.class)
     private Long id;

+ 1 - 0
admin/src/main/java/com/huimv/farm/damsubsidy/entity/vo/BillLandingImageVo.java

@@ -6,4 +6,5 @@ import lombok.Data;
 @Data
 public class BillLandingImageVo extends BillLandingInspection {
     private String[] pages;
+
 }

+ 31 - 8
admin/src/main/java/com/huimv/farm/damsubsidy/service/impl/BillLandingInspectionServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -168,7 +169,7 @@ public class BillLandingInspectionServiceImpl extends ServiceImpl<BillLandingIns
         if (!IntegerUtil.isInteger(animalNumberUp)){
             return new Result(10001, "头数应为整数!", false);
         }
-        String content = null;
+        String content = "";
         int total = Integer.parseInt(animalNumberUp);
         int sum = 0;
         eartags = eartags.replace(",",",");
@@ -230,11 +231,11 @@ public class BillLandingInspectionServiceImpl extends ServiceImpl<BillLandingIns
         if (sum != total){
             return new Result(10001,"实际耳标数量和填写数量不符!",false);
         }
-        content = BuyImageUtil.getUrl(content,image1);
-        content = BuyImageUtil.getUrl(content,image2);
-        content = BuyImageUtil.getUrl(content,image3);
-        content = BuyImageUtil.getUrl(content,image4);
-        content = BuyImageUtil.getUrl(content,image5);
+        content = getUrl(content,image1);
+        content = getUrl(content,image2);
+        content = getUrl(content,image3);
+        content = getUrl(content,image4);
+        content = getUrl(content,image5);
 
         BillLandingInspection billLandingInspection = new BillLandingInspection();
         billLandingInspection.setInspectionNum(inspectionNum);
@@ -261,6 +262,18 @@ public class BillLandingInspectionServiceImpl extends ServiceImpl<BillLandingIns
         }
     }
 
+  
+    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
     public Result cancelApplication(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
         String id = paramsMap.get("id");
@@ -280,7 +293,6 @@ public class BillLandingInspectionServiceImpl extends ServiceImpl<BillLandingIns
         SysUser user = sysUserMapper.selectOne(new QueryWrapper<SysUser>().eq("id", userName));
         Integer userType = user.getUserType();
 
-
         QueryWrapper<BillLandingInspection> landingInspectionQueryWrapper = new QueryWrapper<>();
         if (userType == 2 || userType == 3){
             landingInspectionQueryWrapper.eq("create_user",userName);
@@ -297,12 +309,23 @@ public class BillLandingInspectionServiceImpl extends ServiceImpl<BillLandingIns
         Page<BillLandingInspection> page = new Page(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
         Page<BillLandingInspection> billLandingInspectionPage = billLandingInspectionMapper.selectPage(page, landingInspectionQueryWrapper);
         Page<BillLandingImageVo> billLandingImageVoPage = new Page<>();
+        List billLandingImageVoList = new ArrayList<>();
+        for (BillLandingInspection record : billLandingInspectionPage.getRecords()) {
+            BillLandingImageVo billLandingImageVo = new BillLandingImageVo();
+            BeanUtil.copyProperties(record,billLandingImageVo);
+            if (ObjectUtil.isNotEmpty(record.getJcbgImgUrl())){
+                billLandingImageVo.setPages(record.getJcbgImgUrl().split(","));
+            }
+            billLandingImageVoList.add(billLandingImageVo);
+        }
+        billLandingImageVoPage.setRecords(billLandingImageVoList);
+       /* billLandingImageVoPage.setRecords(billLandingImageVoList);
         BeanUtil.copyProperties(billLandingInspectionPage,billLandingImageVoPage);
         for (BillLandingImageVo record : billLandingImageVoPage.getRecords()) {
             if (ObjectUtil.isNotEmpty(record.getJcbgImgUrl())){
                 record.setPages(record.getJcbgImgUrl().split(","));
             }
-        }
+        }*/
         return new Result(ResultCode.SUCCESS, billLandingImageVoPage);
     }