Jelajahi Sumber

一键下载

sunyize 2 tahun lalu
induk
melakukan
33ebe72fd8

+ 78 - 2
tnc-sms/src/main/java/org/jeecg/modules/smscheck/configs/ObjectComparator.java

@@ -1,10 +1,17 @@
 package org.jeecg.modules.smscheck.configs;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiModelProperty;
+import org.jeecg.modules.smscheck.entity.FileStaticUrl;
+import org.jeecg.modules.smscheck.entity.MyCustomAnnotation;
+import org.jeecg.modules.smscheck.entity.SmsCheckCustomerData;
+import org.jeecg.modules.smscheck.entity.UrlData;
 
 import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 public class ObjectComparator {
     public static Map<String, Object> compareObjects(Object obj1, Object obj2) throws IllegalAccessException {
@@ -54,4 +61,73 @@ public class ObjectComparator {
 
         return diffProperties;
     }
+
+    public static  List<UrlData> downLoad(Object o){
+        if (o==null){
+            return null;
+        }
+        List<UrlData> urlDatas = new ArrayList<>();
+        try {
+            Class<?> clazz =  o.getClass();
+            Field[] fields = clazz.getDeclaredFields();
+            for (Field field : fields) {
+                field.setAccessible(true);
+                if (field.isAnnotationPresent(MyCustomAnnotation.class)) {
+                    Object value = field.get(o);
+                    MyCustomAnnotation annotation = field.getAnnotation(MyCustomAnnotation.class);
+                    if (value!=null && !((String) value).isEmpty() && !value.toString().equals("[{}]")){
+                        JSONArray jsonArray = JSONArray.parseArray(value.toString());
+                        List<UrlStrObj> urlList = jsonArray.toJavaList(UrlStrObj.class);
+                        List<FileStaticUrl> urls =new ArrayList<>();
+                        for (UrlStrObj urlStrObj : urlList) {
+                            FileStaticUrl fileStaticUrl = new FileStaticUrl();
+                            fileStaticUrl.setFileName(urlStrObj.getFileName());
+                            fileStaticUrl.setFileStaticUrl(urlStrObj.getUrl());
+                            urls.add(fileStaticUrl);
+                        }
+                        UrlData urlData = new  UrlData();
+                        urlData.setFileId(field.getAnnotation(ApiModelProperty.class).value());
+                        urlData.setFileStaticUrl(urls);
+                        urlDatas.add(urlData);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return urlDatas;
+    }
+
+
+    static class UrlStrObj{
+        private String urlBase;
+
+        private String url;
+
+        private String fileName;
+
+        public String getUrlBase() {
+            return urlBase;
+        }
+
+        public void setUrlBase(String urlBase) {
+            this.urlBase = urlBase;
+        }
+
+        public String getUrl() {
+            return url;
+        }
+
+        public void setUrl(String url) {
+            this.url = url;
+        }
+
+        public String getFileName() {
+            return fileName;
+        }
+
+        public void setFileName(String fileName) {
+            this.fileName = fileName;
+        }
+    }
 }

+ 14 - 0
tnc-sms/src/main/java/org/jeecg/modules/smscheck/controller/SmsCheckCustomerInfoController.java

@@ -27,6 +27,7 @@ import org.jeecg.common.util.BeanCopyUtil;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.smscheck.configs.CheckStateCode;
 import org.jeecg.modules.smscheck.configs.CheckTypeCode;
+import org.jeecg.modules.smscheck.configs.ObjectComparator;
 import org.jeecg.modules.smscheck.entity.*;
 import org.jeecg.modules.smscheck.service.*;
 import org.jeecg.modules.smscheck.vo.SmsCheckCustomerInfoTaskVo;
@@ -301,6 +302,19 @@ public class SmsCheckCustomerInfoController extends JeecgController<SmsCheckCust
         return Result.OK(smsCheckCustomerInfo);
     }
 
+     @GetMapping(value = "/queryUrlById")
+    public Result<List>  queryUrlById(@RequestParam(name = "id") String id) {
+        Map<String,Object> map = new HashMap<>();
+         LambdaQueryWrapper<SmsCheckCustomerData> query = new LambdaQueryWrapper<>();
+         query.eq(SmsCheckCustomerData::getInfoId, id);
+         SmsCheckCustomerData smsCheckCustomerInfo = customerDataService.getOne(query);
+         List< UrlData> urlData = ObjectComparator.downLoad(smsCheckCustomerInfo);
+        if (urlData==null || urlData.isEmpty()){
+            return Result.error("空");
+        }
+         return Result.OK(ObjectComparator.downLoad(smsCheckCustomerInfo));
+    }
+
     /**
      * 导出excel
      *

+ 24 - 0
tnc-sms/src/main/java/org/jeecg/modules/smscheck/entity/FileStaticUrl.java

@@ -0,0 +1,24 @@
+package org.jeecg.modules.smscheck.entity;
+
+public class FileStaticUrl {
+    private String fileStaticUrl;
+
+    private String fileName;
+
+    public String getFileStaticUrl() {
+        return fileStaticUrl;
+    }
+
+    public void setFileStaticUrl(String fileStaticUrl) {
+        this.fileStaticUrl = fileStaticUrl;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+}

+ 12 - 0
tnc-sms/src/main/java/org/jeecg/modules/smscheck/entity/MyCustomAnnotation.java

@@ -0,0 +1,12 @@
+package org.jeecg.modules.smscheck.entity;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface MyCustomAnnotation {
+    String value() default "";
+}

+ 16 - 16
tnc-sms/src/main/java/org/jeecg/modules/smscheck/entity/SmsCheckCustomerData.java

@@ -74,56 +74,56 @@ public class SmsCheckCustomerData implements Serializable {
     @ApiModelProperty(value = "所属部门")
     private String sysOrgCode;
 
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = "合同到期时间上传资料")
     private String contractDate;
 
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 营业执照到期时间上传资料")
     private String businessLicenseDate;
 
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 码号证书到期时间上传资料")
     private String codeNumberDate;
 
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 备案通知到期时间上传资料")
     private String filingsDate;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 增值业务许可证到期时间上传资料")
     private String permitDate;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 法人/责任人证件上传资料")
     private String corporationCard;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 责任人授权书上传资料")
     private String personResponsible;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 经办人证件上传资料")
     private String operatorCard;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 经办人手持身份证照片(背景需为电信营业厅或白墙)上传资料")
     private String operatorCardPhone;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 机房设备照片上传资料")
     private String devicePhone;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 短信模板上传资料")
     private String textMessage;
 
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 端口类短信业务责任承诺书上传资料")
     private String textMessageBook;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 信息安全责任承诺书上传资料")
     private String secureBook;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 特殊资费审批(标准资费无需提供)上传资料")
     private String special;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 入网签报上传资料")
     private String networkAccess;
-
+    @MyCustomAnnotation
     @ApiModelProperty(value = " 集团价格审批上传资料")
     private String groupPriceApproval;
 

+ 50 - 0
tnc-sms/src/main/java/org/jeecg/modules/smscheck/entity/UrlData.java

@@ -0,0 +1,50 @@
+package org.jeecg.modules.smscheck.entity;
+
+import java.io.File;
+import java.util.List;
+
+public class UrlData {
+
+        private List<FileStaticUrl> fileStaticUrl;
+
+        private String fileId;
+
+        public List<FileStaticUrl> getFileStaticUrl() {
+            return fileStaticUrl;
+        }
+
+        public void setFileStaticUrl(List<FileStaticUrl> fileStaticUrl) {
+            this.fileStaticUrl = fileStaticUrl;
+        }
+
+        public String getFileId() {
+            return fileId;
+        }
+
+        public void setFileId(String fileId) {
+            this.fileId = fileId;
+        }
+
+        class fileStaticUrl{
+
+            private String fileStaticUrl;
+
+            private String fileName;
+
+            public String getFileStaticUrl() {
+                return fileStaticUrl;
+            }
+
+            public void setFileStaticUrl(String fileStaticUrl) {
+                this.fileStaticUrl = fileStaticUrl;
+            }
+
+            public String getFileName() {
+                return fileName;
+            }
+
+            public void setFileName(String fileName) {
+                this.fileName = fileName;
+            }
+        }
+}