hanzhiwei лет назад: 3
Родитель
Сommit
0ce4c85a61

+ 225 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/entity/LabStudentsInfo.java

@@ -0,0 +1,225 @@
+package com.zd.laboratory.api.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.zd.model.annotation.Excel;
+import com.zd.model.entity.BaseEntity;
+import com.zd.model.enums.AuditStatusEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+
+/**
+ * 学生信息对象 lab_students_info
+ *
+ * @author zhoupan
+ * @date 2021-09-10
+ */
+@ApiModel("学生卡审核信息")
+public class LabStudentsInfo extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 学生ID(userId)
+     */
+    @Excel(name = "学生ID", readConverterExp = "u=serId")
+    @ApiModelProperty(value = "学生ID")
+    private Long joinStudentsId;
+    /**
+     * 学生卡图片
+     */
+    @Excel(name = "学生卡图片")
+
+    @ApiModelProperty(value = "学生卡图片")
+    private String card;
+    /**
+     * 人脸信息图片
+     */
+    @Excel(name = "人脸信息图片")
+    @ApiModelProperty(value = "人脸信息图片")
+    private String faceImg;
+
+    /**
+     * 审核类型 不接收前端传值
+     */
+    @ApiModelProperty(value = "审核类型不接收前端传值")
+    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+    private AuditStatusEnum auditStatus;
+
+    /**
+     * 审核人id 不接收前端传值
+     */
+    @ApiModelProperty(value = "审核人id不接收前端传值")
+    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+    private Long auditUser;
+
+    /**
+     * 申请时间 不接收前端传值
+     */
+    @ApiModelProperty(value = "申请时间不接收前端传值")
+    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date commitTime;
+
+    /**
+     * 人脸特征
+     */
+    @ApiModelProperty(value = "人脸特征")
+    private byte[]  faceFeature;
+
+    private Boolean IfFaceFeature;
+
+    public Boolean getIfFaceFeature()
+    {
+        return IfFaceFeature;
+    }
+
+    public void setIfFaceFeature(Boolean ifFaceFeature) {
+        IfFaceFeature = ifFaceFeature;
+    }
+
+    public byte[] getFaceFeature() {
+        return faceFeature;
+    }
+
+    public void setFaceFeature(byte[] faceFeature) {
+        this.faceFeature = faceFeature;
+    }
+
+    public Date getCommitTime() {
+        return commitTime;
+    }
+
+    public void setCommitTime(Date commitTime) {
+        this.commitTime = commitTime;
+    }
+
+    public Long getAuditUser() {
+        return auditUser;
+    }
+
+    public void setAuditUser(Long auditUser) {
+        this.auditUser = auditUser;
+    }
+
+    public AuditStatusEnum getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(AuditStatusEnum auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    /**
+     * 部门id
+     */
+    @Excel(name = "部门id")
+    @ApiModelProperty(value = "部门id")
+    private Long deptId;
+    /**
+     * 部门名称
+     */
+    @Excel(name = "部门名称")
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+    /**
+     * 创建人(用于数据权限)
+     */
+    @Excel(name = "创建人", readConverterExp = "用=于数据权限")
+    @ApiModelProperty(value = "创建人")
+    private Long userId;
+
+    @ApiModelProperty(value = "意见")
+    private String opinions;
+
+    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+    @ApiModelProperty(value = "审核时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date auditTime;
+
+    public String getOpinions() {
+        return opinions;
+    }
+
+    public void setOpinions(String opinions) {
+        this.opinions = opinions;
+    }
+
+    public Date getAuditTime() {
+        return auditTime;
+    }
+
+    public void setAuditTime(Date auditTime) {
+        this.auditTime = auditTime;
+    }
+
+
+    public void setJoinStudentsId(Long joinStudentsId) {
+        this.joinStudentsId = joinStudentsId;
+    }
+
+    public Long getJoinStudentsId() {
+        return joinStudentsId;
+    }
+
+    public void setCard(String card) {
+        this.card = card;
+    }
+
+    public String getCard() {
+        return card;
+    }
+
+    public void setFaceImg(String faceImg) {
+        this.faceImg = faceImg;
+    }
+
+    public String getFaceImg() {
+        return faceImg;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("joinStudentsId", getJoinStudentsId())
+                .append("card", getCard())
+                .append("faceImg", getFaceImg())
+                .append("deptId", getDeptId())
+                .append("deptName", getDeptName())
+                .append("userId", getUserId())
+                .append("remark", getRemark())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

+ 37 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteStudentsService.java

@@ -0,0 +1,37 @@
+package com.zd.laboratory.api.feign;
+
+import com.zd.laboratory.api.entity.LabStudentsInfo;
+import com.zd.laboratory.api.feign.fallback.RemoteStudentsFallbackFactory;
+import com.zd.model.constant.ApplicationConstants;
+import com.zd.model.domain.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 文件服务
+ *
+ * @author zd
+ */
+@FeignClient(contextId = "remoteStudentsService", value = ApplicationConstants.LABORATORY_SERVICE, fallbackFactory = RemoteStudentsFallbackFactory.class)
+public interface RemoteStudentsService {
+    /**
+     * 获取学生信息
+     * @param id 学生Id
+     * @return 结果
+     */
+    @GetMapping(value = "/studentinfo/{joinStudentsId}")
+    public R<LabStudentsInfo> getInfo(@PathVariable("joinStudentsId") Long id);
+
+    /**
+     * 提交学生卡
+     * @param file
+     * @return
+     */
+    @PostMapping (value = "/studentinfo/commit/crad",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public R commitCard(@RequestPart("file") MultipartFile file);
+}

+ 36 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteStudentsFallbackFactory.java

@@ -0,0 +1,36 @@
+package com.zd.laboratory.api.feign.fallback;
+
+import com.zd.laboratory.api.entity.LabStudentsInfo;
+import com.zd.laboratory.api.feign.RemoteStudentsService;
+import com.zd.model.domain.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 文件服务降级处理
+ *
+ * @author zd
+ */
+@Component
+public class RemoteStudentsFallbackFactory implements FallbackFactory<RemoteStudentsService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteStudentsFallbackFactory.class);
+
+    @Override
+    public RemoteStudentsService create(Throwable throwable) {
+        log.error("学生信息调用失败:{}", throwable.getMessage());
+        return new RemoteStudentsService() {
+            @Override
+            public R<LabStudentsInfo> getInfo(@PathVariable("joinStudentsId") Long id) {
+                return R.fail("学生信息调用失败:" + throwable.getMessage());
+            }
+            @Override
+            public R commitCard(MultipartFile file) {
+                return R.fail("学生卡上传调用失败:" + throwable.getMessage());
+            }
+        };
+    }
+}