licailing 4 лет назад
Родитель
Сommit
499849daef

+ 24 - 1
src/main/java/com/izouma/wenlvju/dto/RecordDTO.java

@@ -5,9 +5,11 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.metadata.BaseRowModel;
 import com.alibaba.excel.metadata.BaseRowModel;
 import com.izouma.wenlvju.domain.Record;
 import com.izouma.wenlvju.domain.Record;
+import com.izouma.wenlvju.domain.RecordExpert;
 import com.izouma.wenlvju.domain.RecordSpecialty;
 import com.izouma.wenlvju.domain.RecordSpecialty;
 import com.izouma.wenlvju.utils.excel.LocalDateConverter;
 import com.izouma.wenlvju.utils.excel.LocalDateConverter;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;
 import lombok.Data;
 import lombok.Data;
@@ -78,6 +80,8 @@ public class RecordDTO extends BaseRowModel {
     @ExcelProperty(value = "考试简章", index = 18)
     @ExcelProperty(value = "考试简章", index = 18)
     private String examinationGuide;
     private String examinationGuide;
 
 
+    private Long sno;
+
     @ExcelProperty(value = "考级专业名称", index = 19)
     @ExcelProperty(value = "考级专业名称", index = 19)
     private String name;
     private String name;
 
 
@@ -93,7 +97,22 @@ public class RecordDTO extends BaseRowModel {
     @ExcelProperty(value = "考级专业考官人数", index = 23)
     @ExcelProperty(value = "考级专业考官人数", index = 23)
     private int speExaQuantity;
     private int speExaQuantity;
 
 
-    public RecordDTO(Record record, RecordSpecialty specialty, long no) {
+
+    @ExcelProperty(value = "考官姓名", index = 24)
+    private String expertName;
+
+    private String sex;
+
+    @ApiModelProperty(value = "证件号码")
+    private String idNo;
+
+    @ApiModelProperty(value = "是否外聘")
+    private boolean external;
+
+    @ApiModelProperty(value = "职称")
+    private String position;
+
+    public RecordDTO(Record record, RecordSpecialty specialty, RecordExpert expert, long no) {
         BeanUtil.copyProperties(record, this);
         BeanUtil.copyProperties(record, this);
         this.examinerQuantity = record.getExaminerQuantity();
         this.examinerQuantity = record.getExaminerQuantity();
 
 
@@ -102,6 +121,10 @@ public class RecordDTO extends BaseRowModel {
             this.speExaQuantity = specialty.getExaminerQuantity();
             this.speExaQuantity = specialty.getExaminerQuantity();
         }
         }
 
 
+        if (ObjectUtil.isNotEmpty(expert)) {
+            BeanUtil.copyProperties(expert, this);
+            this.expertName = expert.getName();
+        }
         this.no = no;
         this.no = no;
     }
     }
 }
 }

+ 12 - 3
src/main/java/com/izouma/wenlvju/service/RecordService.java

@@ -5,16 +5,17 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.izouma.wenlvju.domain.Record;
 import com.izouma.wenlvju.domain.Record;
+import com.izouma.wenlvju.domain.RecordExpert;
 import com.izouma.wenlvju.domain.RecordSpecialty;
 import com.izouma.wenlvju.domain.RecordSpecialty;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.dto.RecordDTO;
 import com.izouma.wenlvju.dto.RecordDTO;
+import com.izouma.wenlvju.repo.RecordExpertRepo;
 import com.izouma.wenlvju.repo.RecordRepo;
 import com.izouma.wenlvju.repo.RecordRepo;
 import com.izouma.wenlvju.repo.RecordSpecialtyRepo;
 import com.izouma.wenlvju.repo.RecordSpecialtyRepo;
 import com.izouma.wenlvju.utils.JpaUtils;
 import com.izouma.wenlvju.utils.JpaUtils;
 import com.izouma.wenlvju.utils.excel.ExcelUtils;
 import com.izouma.wenlvju.utils.excel.ExcelUtils;
 import jodd.util.StringUtil;
 import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -36,6 +37,7 @@ public class RecordService {
 
 
     private RecordRepo          recordRepo;
     private RecordRepo          recordRepo;
     private RecordSpecialtyRepo recordSpecialtyRepo;
     private RecordSpecialtyRepo recordSpecialtyRepo;
+    private RecordExpertRepo    recordExpertRepo;
 
 
     public Page<Record> all(PageQuery pageQuery) {
     public Page<Record> all(PageQuery pageQuery) {
         return recordRepo.findAll(JpaUtils.toSpecification(pageQuery, Record.class), JpaUtils.toPageRequest(pageQuery));
         return recordRepo.findAll(JpaUtils.toSpecification(pageQuery, Record.class), JpaUtils.toPageRequest(pageQuery));
@@ -107,10 +109,13 @@ public class RecordService {
         for (Record record : data) {
         for (Record record : data) {
             List<RecordSpecialty> specialtyList = listMap.get(record.getId());
             List<RecordSpecialty> specialtyList = listMap.get(record.getId());
             if (CollUtil.isEmpty(specialtyList)) {
             if (CollUtil.isEmpty(specialtyList)) {
-                dtos.add(new RecordDTO(record, null, no));
+                dtos.add(new RecordDTO(record, null, null, no));
             } else {
             } else {
                 long finalNo = no;
                 long finalNo = no;
-                specialtyList.forEach(specialty -> dtos.add(new RecordDTO(record, specialty, finalNo)));
+                specialtyList.forEach(specialty -> {
+                    List<RecordExpert> experts = recordExpertRepo.findAllByRecordSpecialtyId(specialty.getId());
+                    experts.forEach(expert -> dtos.add(new RecordDTO(record, specialty, expert, finalNo)));
+                });
             }
             }
             no = no + 1;
             no = no + 1;
         }
         }
@@ -154,6 +159,10 @@ public class RecordService {
             specialty.setRecordId(recordId);
             specialty.setRecordId(recordId);
             specialty.setExaminerQuantity(dto.getSpeExaQuantity());
             specialty.setExaminerQuantity(dto.getSpeExaQuantity());
             specialties.add(specialty);
             specialties.add(specialty);
+
+            RecordExpert expert = new RecordExpert();
+            BeanUtil.copyProperties(dto,expert);
+            expert.setName(dto.getExpertName());
         }
         }
         recordSpecialtyRepo.saveAll(specialties);
         recordSpecialtyRepo.saveAll(specialties);