suntianwu před 3 roky
rodič
revize
2969ce1679

+ 10 - 16
src/main/java/com/iden/bms/service/PersonService.java

@@ -154,12 +154,6 @@ public class PersonService {
                     resVO.setTypeName(PersonTypeEnum.getValueToName(resVO.getType()));
                     resVO.setGenderName(GenderEnum.getValueToName(resVO.getGender()));
                     resVO.setCredentialsTypeName(CredentialsTypeEnum.getValueToName(resVO.getCredentialsType()));
-
-                    try {
-                        resVO.setImageUrl(new URL(resVO.getImage()));
-                    } catch (Exception e){
-                        e.printStackTrace();
-                    }
                     Long communityId1 = resVO.getCommunityId();
                     if(communityId1 != null){
                         IdenCommunity idenCommunity = this.idenCommunityService.getById(communityId1);
@@ -210,22 +204,22 @@ public class PersonService {
         }
 
         List<IdenPerson>  list =  this.idenPersonService.list(queryWrapper);
-        List<PersonVO> records = new ArrayList<>();
+        List<PersonExcelVO> records = new ArrayList<>();
         if (CollUtil.isNotEmpty(list)) {
             list.forEach(item->{
-                PersonVO resVO = new PersonVO();
+                PersonExcelVO resVO = new PersonExcelVO();
                 BeanUtils.copyProperties(item,resVO);
-                resVO.setPopulationTypeName(PopulationTypeEnum.getValueToName(resVO.getPopulationType()));
-                resVO.setTypeName(PersonTypeEnum.getValueToName(resVO.getType()));
-                resVO.setGenderName(GenderEnum.getValueToName(resVO.getGender()));
-                resVO.setCredentialsTypeName(CredentialsTypeEnum.getValueToName(resVO.getCredentialsType()));
+                resVO.setPopulationTypeName(PopulationTypeEnum.getValueToName(item.getPopulationType()));
+                resVO.setTypeName(PersonTypeEnum.getValueToName(item.getType()));
+                resVO.setGenderName(GenderEnum.getValueToName(item.getGender()));
+                resVO.setCredentialsTypeName(CredentialsTypeEnum.getValueToName(item.getCredentialsType()));
 
                 try {
-                    resVO.setImageUrl(new URL(resVO.getImage()));
+                    resVO.setImageUrl(new URL(item.getImage()));
                 } catch (Exception e){
                     e.printStackTrace();
                 }
-                Long communityId1 = resVO.getCommunityId();
+                Long communityId1 = item.getCommunityId();
                 if(communityId1 != null){
                     IdenCommunity idenCommunity = this.idenCommunityService.getById(communityId1);
                     if(idenCommunity != null) {
@@ -233,7 +227,7 @@ public class PersonService {
                     }
                 }
                 QueryWrapper<IdenPersonCrowdRef> queryWrapper1 = new QueryWrapper<>();
-                queryWrapper1.lambda().eq(IdenPersonCrowdRef::getPersonId,resVO.getId());
+                queryWrapper1.lambda().eq(IdenPersonCrowdRef::getPersonId,item.getId());
                 List<IdenPersonCrowdRef> listIdenPersonCrowdRef = idenPersonCrowdRefService.list(queryWrapper1);
                 StringBuilder sb = new StringBuilder();
                 if (CollUtil.isNotEmpty(listIdenPersonCrowdRef)) {
@@ -260,7 +254,7 @@ public class PersonService {
             final String fileName = URLEncoder.encode("人员表", "UTF-8");
             response.setHeader("Content-disposition", "attachment;filename=" + fileName + System.currentTimeMillis() + ".xlsx");
 
-            EasyExcel.write(response.getOutputStream(), PersonVO.class).sheet("人员表").doWrite(records);
+            EasyExcel.write(response.getOutputStream(), PersonExcelVO.class).sheet("人员表").doWrite(records);
 
         } catch (Exception e) {
             e.printStackTrace();

+ 134 - 0
src/main/java/com/iden/common/vo/PersonExcelVO.java

@@ -0,0 +1,134 @@
+package com.iden.common.vo;
+
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+
+import com.alibaba.excel.converters.url.UrlImageConverter;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.Date;
+
+/**
+ * 人员表(IdenPerson)实体类
+ *
+ * @author makejava
+ * @since 2021-12-22 17:23:47
+ */
+
+@Data
+@ApiModel(value = "人员表", description = "")
+public class PersonExcelVO implements Serializable {
+    private static final long serialVersionUID = -95513090380191735L;
+
+
+    @ApiModelProperty("人员编码(人员ID)")
+    @ExcelProperty("人员编码")
+    private String code;
+
+
+    @ApiModelProperty("姓名")
+    @ExcelProperty("姓名")
+    private String name;
+
+
+    @ExcelProperty(value = "图像",converter = UrlImageConverter.class)
+    @ColumnWidth(60)
+    private URL imageUrl;
+
+    @ApiModelProperty("性别")
+    @ExcelProperty("性别")
+    private String genderName;
+
+
+    @ApiModelProperty("证件类型")
+    @ExcelProperty("证件类型")
+    private String credentialsTypeName;
+
+    @ApiModelProperty("证件号码")
+    @ExcelProperty("证件号码")
+    private String credentialsCode;
+
+
+    @ApiModelProperty("手机号码")
+    @ExcelProperty("手机号码")
+    private String phone;
+
+
+    @ApiModelProperty("人口类型:1:常住人口 2:暂住人口 3:境外长住人口 4:流动人口 5:寄住人口 6: 临时住宿人口 99其他")
+    @ExcelProperty("人口类型")
+    private String populationTypeName;
+
+    @ApiModelProperty("民族")
+    @ExcelProperty("民族")
+    private String nation;
+
+
+    @ApiModelProperty("政治面貌")
+    @ExcelProperty("政治面貌")
+    private String policitalStatus;
+
+
+    @ApiModelProperty("婚姻")
+    @ExcelProperty("婚姻")
+    private String marriage;
+
+
+    @ApiModelProperty("口音")
+    @ExcelProperty("口音")
+    private String voice;
+
+
+    @ApiModelProperty("所属区域")
+    @ExcelProperty("所属区域")
+    private String district;
+
+    @ApiModelProperty("所属街道")
+    @ExcelProperty("所属街道")
+    private String subdistrict;
+
+
+    @ApiModelProperty("所属小区")
+    @ExcelProperty("所属小区")
+    private String communityName;
+
+    @ApiModelProperty("地址")
+    @ExcelProperty("地址")
+    private String address;
+
+
+    @ApiModelProperty("工作单位")
+    @ExcelProperty("工作单位")
+    private String workPlace;
+
+
+    @ApiModelProperty("单位地址")
+    @ExcelProperty("单位地址")
+    private String workAddress;
+
+
+    @ApiModelProperty("类型名:2、重点人员,3、小区人员,多个用逗号分割")
+    @ExcelProperty("类型")
+    private String typeName;
+
+    @ApiModelProperty("人群类型,多个用逗号分割")
+    @ExcelProperty("人群类型")
+    private String crowdName;
+
+    @ApiModelProperty("备注")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @ApiModelProperty("创建时间")
+    @ExcelProperty("创建时间")
+    private Date createTime;
+
+
+
+}

+ 0 - 28
src/main/java/com/iden/common/vo/PersonVO.java

@@ -1,9 +1,6 @@
 package com.iden.common.vo;
 
 
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.write.style.ColumnWidth;
-import com.alibaba.excel.converters.url.UrlImageConverter;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,7 +8,6 @@ import lombok.Data;
 
 
 import java.io.Serializable;
-import java.net.URL;
 import java.util.Date;
 
 /**
@@ -32,7 +28,6 @@ public class PersonVO implements Serializable {
     private String uid;
 
     @ApiModelProperty("人员编码(人员ID)")
-    @ExcelProperty("人员编码")
     private String code;
 
     @ApiModelProperty("人脸特征码")
@@ -40,38 +35,30 @@ public class PersonVO implements Serializable {
 
 
     @ApiModelProperty("姓名")
-    @ExcelProperty("姓名")
     private String name;
 
 
     @ApiModelProperty("图像")
     private String image;
 
-    @ExcelProperty(value = "图像",converter = UrlImageConverter.class)
-    @ColumnWidth(60)
-    private URL imageUrl;
 
     @ApiModelProperty("性别:M:男 W:女")
     private String gender;
 
     @ApiModelProperty("性别")
-    @ExcelProperty("性别")
     private String genderName;
 
     @ApiModelProperty("证件类型:1:身份证 2:护照  3 军官证")
     private String credentialsType;
 
     @ApiModelProperty("证件类型")
-    @ExcelProperty("证件类型")
     private String credentialsTypeName;
 
     @ApiModelProperty("证件号码")
-    @ExcelProperty("证件号码")
     private String credentialsCode;
 
 
     @ApiModelProperty("手机号码")
-    @ExcelProperty("手机号码")
     private String phone;
 
 
@@ -79,56 +66,45 @@ public class PersonVO implements Serializable {
     private String populationType;
 
     @ApiModelProperty("人口类型:1:常住人口 2:暂住人口 3:境外长住人口 4:流动人口 5:寄住人口 6: 临时住宿人口 99其他")
-    @ExcelProperty("人口类型")
     private String populationTypeName;
 
     @ApiModelProperty("民族")
-    @ExcelProperty("民族")
     private String nation;
 
 
     @ApiModelProperty("政治面貌")
-    @ExcelProperty("政治面貌")
     private String policitalStatus;
 
 
     @ApiModelProperty("婚姻")
-    @ExcelProperty("婚姻")
     private String marriage;
 
 
     @ApiModelProperty("口音")
-    @ExcelProperty("口音")
     private String voice;
 
 
     @ApiModelProperty("所属区域")
-    @ExcelProperty("所属区域")
     private String district;
 
     @ApiModelProperty("所属街道")
-    @ExcelProperty("所属街道")
     private String subdistrict;
 
     @ApiModelProperty("所属小区id")
     private Long communityId;
 
     @ApiModelProperty("所属小区")
-    @ExcelProperty("所属小区")
     private String communityName;
 
     @ApiModelProperty("地址")
-    @ExcelProperty("地址")
     private String address;
 
 
     @ApiModelProperty("工作单位")
-    @ExcelProperty("工作单位")
     private String workPlace;
 
 
     @ApiModelProperty("单位地址")
-    @ExcelProperty("单位地址")
     private String workAddress;
 
 
@@ -136,20 +112,16 @@ public class PersonVO implements Serializable {
     private String type;
 
     @ApiModelProperty("类型名:2、重点人员,3、小区人员,多个用逗号分割")
-    @ExcelProperty("类型名")
     private String typeName;
 
     @ApiModelProperty("人群类型,多个用逗号分割")
-    @ExcelProperty("人群类型")
     private String crowdName;
 
     @ApiModelProperty("备注")
-    @ExcelProperty("备注")
     private String remark;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     @ApiModelProperty("创建时间")
-    @ExcelProperty("创建时间")
     private Date createTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

binární
src/main/resources/export/IdenCameraExportTemplate.xlsx