Browse Source

20211227交付物(多个文件)

master
zy_Java 4 years ago
parent
commit
79965bfa25
  1. 9
      src/main/java/com/ccsens/defaultwbs/api/FileController.java
  2. 11
      src/main/java/com/ccsens/defaultwbs/bean/dto/DeliverDto.java
  3. 106
      src/main/java/com/ccsens/defaultwbs/bean/po/ProDeliverFile.java
  4. 701
      src/main/java/com/ccsens/defaultwbs/bean/po/ProDeliverFileExample.java
  5. 10
      src/main/java/com/ccsens/defaultwbs/bean/vo/DeliverVo.java
  6. 30
      src/main/java/com/ccsens/defaultwbs/persist/mapper/ProDeliverFileMapper.java
  7. 21
      src/main/java/com/ccsens/defaultwbs/service/DeliverService.java
  8. 74
      src/main/java/com/ccsens/defaultwbs/service/FileService.java
  9. 7
      src/main/java/com/ccsens/defaultwbs/service/IFileService.java
  10. 23
      src/main/resources/mapper_dao/ProDeliverDao.xml
  11. 258
      src/main/resources/mapper_raw/ProDeliverFileMapper.xml
  12. 3
      src/main/resources/mbg.xml

9
src/main/java/com/ccsens/defaultwbs/api/FileController.java

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
@ -32,11 +33,11 @@ public class FileController {
@ApiImplicitParams({
})
@RequestMapping(value = "upload", method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
public JsonResponse<FileVo.FileInfo> uploadFile(QueryDto<MultipartFile> params) throws Exception {
public JsonResponse<List<FileVo.FileInfo>> uploadFile(QueryDto<List<MultipartFile>> params) throws Exception {
log.info("上传文件:{}",params);
MultipartFile f = params.getParam();
FileVo.FileInfo fileInfo = fileService.uploadFile(f,params.getUserId());
// MultipartFile f = params.getParam();
List<FileVo.FileInfo> fileInfoList = fileService.uploadFile(params.getParam(),params.getUserId());
return JsonResponse.newInstance().ok(fileInfo);
return JsonResponse.newInstance().ok(fileInfoList);
}
}

11
src/main/java/com/ccsens/defaultwbs/bean/dto/DeliverDto.java

@ -1,5 +1,6 @@
package com.ccsens.defaultwbs.bean.dto;
import com.ccsens.defaultwbs.bean.vo.FileVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -49,10 +50,12 @@ public class DeliverDto {
private Long taskSubId;
@ApiModelProperty("文本内容")
private String content;
@ApiModelProperty("文件id")
private Long fileId;
@ApiModelProperty("文件路径")
private String filePath;
@ApiModelProperty("文件信息")
private List<FileVo.FileInfo> fileInfoList;
// @ApiModelProperty("文件id")
// private Long fileId;
// @ApiModelProperty("文件路径")
// private String filePath;
@NotEmpty(message = "请选择检查人")
@ApiModelProperty("检查人列表")
private List<Long> checkerList;

106
src/main/java/com/ccsens/defaultwbs/bean/po/ProDeliverFile.java

@ -0,0 +1,106 @@
package com.ccsens.defaultwbs.bean.po;
import java.io.Serializable;
import java.util.Date;
public class ProDeliverFile implements Serializable {
private Long id;
private Long deliverId;
private Long fileId;
private String fileName;
private String filePath;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getDeliverId() {
return deliverId;
}
public void setDeliverId(Long deliverId) {
this.deliverId = deliverId;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName == null ? null : fileName.trim();
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath == null ? null : filePath.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", deliverId=").append(deliverId);
sb.append(", fileId=").append(fileId);
sb.append(", fileName=").append(fileName);
sb.append(", filePath=").append(filePath);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append("]");
return sb.toString();
}
}

701
src/main/java/com/ccsens/defaultwbs/bean/po/ProDeliverFileExample.java

@ -0,0 +1,701 @@
package com.ccsens.defaultwbs.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ProDeliverFileExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ProDeliverFileExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andDeliverIdIsNull() {
addCriterion("deliver_id is null");
return (Criteria) this;
}
public Criteria andDeliverIdIsNotNull() {
addCriterion("deliver_id is not null");
return (Criteria) this;
}
public Criteria andDeliverIdEqualTo(Long value) {
addCriterion("deliver_id =", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdNotEqualTo(Long value) {
addCriterion("deliver_id <>", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdGreaterThan(Long value) {
addCriterion("deliver_id >", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdGreaterThanOrEqualTo(Long value) {
addCriterion("deliver_id >=", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdLessThan(Long value) {
addCriterion("deliver_id <", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdLessThanOrEqualTo(Long value) {
addCriterion("deliver_id <=", value, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdIn(List<Long> values) {
addCriterion("deliver_id in", values, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdNotIn(List<Long> values) {
addCriterion("deliver_id not in", values, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdBetween(Long value1, Long value2) {
addCriterion("deliver_id between", value1, value2, "deliverId");
return (Criteria) this;
}
public Criteria andDeliverIdNotBetween(Long value1, Long value2) {
addCriterion("deliver_id not between", value1, value2, "deliverId");
return (Criteria) this;
}
public Criteria andFileIdIsNull() {
addCriterion("file_id is null");
return (Criteria) this;
}
public Criteria andFileIdIsNotNull() {
addCriterion("file_id is not null");
return (Criteria) this;
}
public Criteria andFileIdEqualTo(Long value) {
addCriterion("file_id =", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotEqualTo(Long value) {
addCriterion("file_id <>", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdGreaterThan(Long value) {
addCriterion("file_id >", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdGreaterThanOrEqualTo(Long value) {
addCriterion("file_id >=", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdLessThan(Long value) {
addCriterion("file_id <", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdLessThanOrEqualTo(Long value) {
addCriterion("file_id <=", value, "fileId");
return (Criteria) this;
}
public Criteria andFileIdIn(List<Long> values) {
addCriterion("file_id in", values, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotIn(List<Long> values) {
addCriterion("file_id not in", values, "fileId");
return (Criteria) this;
}
public Criteria andFileIdBetween(Long value1, Long value2) {
addCriterion("file_id between", value1, value2, "fileId");
return (Criteria) this;
}
public Criteria andFileIdNotBetween(Long value1, Long value2) {
addCriterion("file_id not between", value1, value2, "fileId");
return (Criteria) this;
}
public Criteria andFileNameIsNull() {
addCriterion("file_name is null");
return (Criteria) this;
}
public Criteria andFileNameIsNotNull() {
addCriterion("file_name is not null");
return (Criteria) this;
}
public Criteria andFileNameEqualTo(String value) {
addCriterion("file_name =", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotEqualTo(String value) {
addCriterion("file_name <>", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThan(String value) {
addCriterion("file_name >", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThanOrEqualTo(String value) {
addCriterion("file_name >=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThan(String value) {
addCriterion("file_name <", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThanOrEqualTo(String value) {
addCriterion("file_name <=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLike(String value) {
addCriterion("file_name like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotLike(String value) {
addCriterion("file_name not like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameIn(List<String> values) {
addCriterion("file_name in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotIn(List<String> values) {
addCriterion("file_name not in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameBetween(String value1, String value2) {
addCriterion("file_name between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotBetween(String value1, String value2) {
addCriterion("file_name not between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andFilePathIsNull() {
addCriterion("file_path is null");
return (Criteria) this;
}
public Criteria andFilePathIsNotNull() {
addCriterion("file_path is not null");
return (Criteria) this;
}
public Criteria andFilePathEqualTo(String value) {
addCriterion("file_path =", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotEqualTo(String value) {
addCriterion("file_path <>", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathGreaterThan(String value) {
addCriterion("file_path >", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathGreaterThanOrEqualTo(String value) {
addCriterion("file_path >=", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLessThan(String value) {
addCriterion("file_path <", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLessThanOrEqualTo(String value) {
addCriterion("file_path <=", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLike(String value) {
addCriterion("file_path like", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotLike(String value) {
addCriterion("file_path not like", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathIn(List<String> values) {
addCriterion("file_path in", values, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotIn(List<String> values) {
addCriterion("file_path not in", values, "filePath");
return (Criteria) this;
}
public Criteria andFilePathBetween(String value1, String value2) {
addCriterion("file_path between", value1, value2, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotBetween(String value1, String value2) {
addCriterion("file_path not between", value1, value2, "filePath");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;
}
public Criteria andCreatedAtIsNotNull() {
addCriterion("created_at is not null");
return (Criteria) this;
}
public Criteria andCreatedAtEqualTo(Date value) {
addCriterion("created_at =", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotEqualTo(Date value) {
addCriterion("created_at <>", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThan(Date value) {
addCriterion("created_at >", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("created_at >=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThan(Date value) {
addCriterion("created_at <", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
addCriterion("created_at <=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtIn(List<Date> values) {
addCriterion("created_at in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotIn(List<Date> values) {
addCriterion("created_at not in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtBetween(Date value1, Date value2) {
addCriterion("created_at between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
addCriterion("created_at not between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNull() {
addCriterion("updated_at is null");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNotNull() {
addCriterion("updated_at is not null");
return (Criteria) this;
}
public Criteria andUpdatedAtEqualTo(Date value) {
addCriterion("updated_at =", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotEqualTo(Date value) {
addCriterion("updated_at <>", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThan(Date value) {
addCriterion("updated_at >", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("updated_at >=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThan(Date value) {
addCriterion("updated_at <", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
addCriterion("updated_at <=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIn(List<Date> values) {
addCriterion("updated_at in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotIn(List<Date> values) {
addCriterion("updated_at not in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
addCriterion("updated_at between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
addCriterion("updated_at not between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andRecStatusIsNull() {
addCriterion("rec_status is null");
return (Criteria) this;
}
public Criteria andRecStatusIsNotNull() {
addCriterion("rec_status is not null");
return (Criteria) this;
}
public Criteria andRecStatusEqualTo(Byte value) {
addCriterion("rec_status =", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotEqualTo(Byte value) {
addCriterion("rec_status <>", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThan(Byte value) {
addCriterion("rec_status >", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("rec_status >=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThan(Byte value) {
addCriterion("rec_status <", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThanOrEqualTo(Byte value) {
addCriterion("rec_status <=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusIn(List<Byte> values) {
addCriterion("rec_status in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotIn(List<Byte> values) {
addCriterion("rec_status not in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusBetween(Byte value1, Byte value2) {
addCriterion("rec_status between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

10
src/main/java/com/ccsens/defaultwbs/bean/vo/DeliverVo.java

@ -45,10 +45,12 @@ public class DeliverVo {
private Long time;
@ApiModelProperty("文本内容")
private String content;
@ApiModelProperty("文件id")
private Long fileId;
@ApiModelProperty("文件路径")
private String filePath;
@ApiModelProperty("文件信息")
private List<FileVo.FileInfo> fileInfoList;
// @ApiModelProperty("文件id")
// private Long fileId;
// @ApiModelProperty("文件路径")
// private String filePath;
@ApiModelProperty("检查人列表")
private List<CheckerInfo> checkerList;
}

30
src/main/java/com/ccsens/defaultwbs/persist/mapper/ProDeliverFileMapper.java

@ -0,0 +1,30 @@
package com.ccsens.defaultwbs.persist.mapper;
import com.ccsens.defaultwbs.bean.po.ProDeliverFile;
import com.ccsens.defaultwbs.bean.po.ProDeliverFileExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ProDeliverFileMapper {
long countByExample(ProDeliverFileExample example);
int deleteByExample(ProDeliverFileExample example);
int deleteByPrimaryKey(Long id);
int insert(ProDeliverFile record);
int insertSelective(ProDeliverFile record);
List<ProDeliverFile> selectByExample(ProDeliverFileExample example);
ProDeliverFile selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") ProDeliverFile record, @Param("example") ProDeliverFileExample example);
int updateByExample(@Param("record") ProDeliverFile record, @Param("example") ProDeliverFileExample example);
int updateByPrimaryKeySelective(ProDeliverFile record);
int updateByPrimaryKey(ProDeliverFile record);
}

21
src/main/java/com/ccsens/defaultwbs/service/DeliverService.java

@ -12,10 +12,12 @@ import com.ccsens.defaultwbs.bean.po.ProDeliver;
import com.ccsens.defaultwbs.bean.po.ProDeliverChecker;
import com.ccsens.common.bean.po.ProMember;
import com.ccsens.common.bean.po.ProTaskSub;
import com.ccsens.defaultwbs.bean.po.ProDeliverFile;
import com.ccsens.defaultwbs.bean.vo.DeliverVo;
import com.ccsens.common.bean.vo.CMemberVo;
import com.ccsens.common.bean.vo.CProjectVo;
import com.ccsens.defaultwbs.persist.dao.*;
import com.ccsens.defaultwbs.persist.mapper.ProDeliverFileMapper;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
@ -62,6 +64,8 @@ public class DeliverService implements IDeliverService {
private Snowflake snowflake;
@Resource
private AmqpTemplate rabbitTemplate;
@Resource
private ProDeliverFileMapper proDeliverFileMapper;
@Override
public List<DeliverVo.Checker> queryChecker(DeliverDto.QueryChecker params, Long userId) {
@ -107,11 +111,12 @@ public class DeliverService implements IDeliverService {
proDeliver.setTaskSubId(params.getTaskSubId());
proDeliver.setMemberId(userOfMemberId);
proDeliver.setContent(params.getContent());
proDeliver.setFileId(params.getFileId());
proDeliver.setFilePath(params.getFilePath());
// proDeliver.setFileId(params.getFileId());
// proDeliver.setFilePath(params.getFilePath());
proDeliver.setProjectId(params.getProjectId());
proDeliver.setTime(System.currentTimeMillis());
deliverDao.insertSelective(proDeliver);
//添加交付物检查信息
for (Long checkerId : params.getCheckerList()) {
ProDeliverChecker deliverChecker = new ProDeliverChecker();
deliverChecker.setId(snowflake.nextId());
@ -120,6 +125,18 @@ public class DeliverService implements IDeliverService {
deliverChecker.setStatus((byte)0);
deliverCheckerDao.insertSelective(deliverChecker);
}
//添加交付物文件信息
if(CollectionUtil.isNotEmpty(params.getFileInfoList())){
params.getFileInfoList().forEach(fileInfo -> {
ProDeliverFile proDeliverFile = new ProDeliverFile();
proDeliverFile.setId(snowflake.nextId());
proDeliverFile.setFileId(fileInfo.getFileId());
proDeliverFile.setDeliverId(proDeliver.getId());
proDeliverFile.setFileName(fileInfo.getName());
proDeliverFile.setFilePath(fileInfo.getPath());
proDeliverFileMapper.insertSelective(proDeliverFile);
});
}
//TODO 发送消息
sendToDeliverUploadMessage(params, userId, taskSub.getTaskDetailId(), proDeliver.getId());
}

74
src/main/java/com/ccsens/defaultwbs/service/FileService.java

@ -1,5 +1,6 @@
package com.ccsens.defaultwbs.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Snowflake;
@ -21,7 +22,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author
@ -36,42 +39,47 @@ public class FileService implements IFileService {
private FileCommitMapper fileCommitMapper;
@Override
public FileVo.FileInfo uploadFile(MultipartFile f, Long userId) throws Exception {
if(ObjectUtil.isNull(f)){
public List<FileVo.FileInfo> uploadFile(List<MultipartFile> fileList, Long userId) throws Exception {
if(CollectionUtil.isNotEmpty(fileList)){
throw new BaseException(DefaultCodeError.NOT_FILE);
}
//文件类型验证
String ext = FileUtil.extName(f.getOriginalFilename());
log.info("文件类型:{}",ext);
if(StrUtil.isEmpty(ext) || (!Constant.FILE_TYPE_IMG.contains(ext) && !Constant.FILE_TYPE_DOCUMENT.contains(ext))){
throw new BaseException(DefaultCodeError.FILE_FORMAT_ERROR);
}
//文件路径
String dir = PropUtil.path;
String extraPath = DateUtil.format(new Date(), "yyyyMMdd");
String path = extraPath + "/" + IdUtil.simpleUUID() + "." + ext;
//转成file
File file = new File(dir + extraPath);
if (!file.exists()) {
file.mkdirs();
List<FileVo.FileInfo> fileInfoList = new ArrayList<>();
for (MultipartFile f : fileList) {
//文件类型验证
String ext = FileUtil.extName(f.getOriginalFilename());
log.info("文件类型:{}",ext);
if(StrUtil.isEmpty(ext) || (!Constant.FILE_TYPE_IMG.contains(ext) && !Constant.FILE_TYPE_DOCUMENT.contains(ext))){
throw new BaseException(DefaultCodeError.FILE_FORMAT_ERROR);
}
//文件路径
String dir = PropUtil.path;
String extraPath = DateUtil.format(new Date(), "yyyyMMdd");
String path = extraPath + "/" + IdUtil.simpleUUID() + "." + ext;
//转成file
File file = new File(dir + extraPath);
if (!file.exists()) {
file.mkdirs();
}
String fullPath = dir + path;
//写入文件
FileUtil.writeFromStream(f.getInputStream(), fullPath);
//保存数据库
FileCommit fileCommit = new FileCommit();
fileCommit.setId(snowflake.nextId());
fileCommit.setName(f.getOriginalFilename());
fileCommit.setVisitPath(PropUtil.imgDomain + path);
fileCommit.setTime(System.currentTimeMillis());
fileCommit.setOperator(userId);
fileCommitMapper.insertSelective(fileCommit);
//返回
FileVo.FileInfo fileInfo = new FileVo.FileInfo();
fileInfo.setFileId(fileCommit.getId());
fileInfo.setName(fileCommit.getName());
fileInfo.setPath(fileCommit.getVisitPath());
fileInfoList.add(fileInfo);
}
String fullPath = dir + path;
//写入文件
FileUtil.writeFromStream(f.getInputStream(), fullPath);
//保存数据库
FileCommit fileCommit = new FileCommit();
fileCommit.setId(snowflake.nextId());
fileCommit.setName(f.getOriginalFilename());
fileCommit.setVisitPath(PropUtil.imgDomain + path);
fileCommit.setTime(System.currentTimeMillis());
fileCommit.setOperator(userId);
fileCommitMapper.insertSelective(fileCommit);
//返回
FileVo.FileInfo fileInfo = new FileVo.FileInfo();
fileInfo.setFileId(fileCommit.getId());
fileInfo.setName(fileCommit.getName());
fileInfo.setPath(fileCommit.getVisitPath());
return fileInfo;
return fileInfoList;
}
}

7
src/main/java/com/ccsens/defaultwbs/service/IFileService.java

@ -3,17 +3,20 @@ package com.ccsens.defaultwbs.service;
import com.ccsens.defaultwbs.bean.vo.FileVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @author
*/
public interface IFileService {
/**
* 上传文件
* @param f 文件
* @param fileList 文件
* @param userId userId
* @return 返回文件id和路径
* @throws Exception io
*/
FileVo.FileInfo uploadFile(MultipartFile f, Long userId) throws Exception;
List<FileVo.FileInfo> uploadFile(List<MultipartFile> fileList, Long userId) throws Exception;
// FileVo.FileInfo uploadFile(MultipartFile f, Long userId) throws Exception;
}

23
src/main/resources/mapper_dao/ProDeliverDao.xml

@ -8,8 +8,11 @@
<result column="taskName" property="taskName"/>
<result column="time" property="time"/>
<result column="content" property="content"/>
<result column="fileId" property="fileId"/>
<result column="filePath" property="filePath"/>
<collection property="fileInfoList" ofType="com.ccsens.defaultwbs.bean.vo.FileVo$FileInfo">
<result column="fileId" property="fileId"/>
<result column="fileName" property="name"/>
<result column="filePath" property="path"/>
</collection>
<collection property="checkerList" ofType="com.ccsens.defaultwbs.bean.vo.DeliverVo$CheckerInfo">
<result column="checkId" property="checkId"/>
<result column="checkerName" property="checkerName"/>
@ -28,18 +31,20 @@
td.`name` AS taskName,
d.time,
d.content,
d.file_id as fileId,
d.file_path as filePath,
f.file_id as fileId,
f.file_name as fileName,
f.file_path as filePath,
c.id As checkId,
m1.`name` AS checkerName,
m1.id AS checkerId,
c.`status`,
c.score,
c.remark,
if(m1.id = #{userMemberId},1,0) as isMain
if(m1.id = #{userMemberId},1,0) as isMine
FROM
t_pro_deliver AS d
LEFT JOIN t_pro_deliver_checker AS c ON d.id = c.deliver_id AND c.rec_status = 0
LEFT JOIN t_pro_deliver_file AS f ON d.id = f.deliver_id AND f.rec_status = 0
LEFT JOIN t_pro_task_sub AS ts ON ts.id = d.task_sub_id
LEFT JOIN t_pro_task_detail AS td ON td.id = ts.task_detail_id
LEFT JOIN t_pro_member AS m ON m.id = d.member_id AND m.rec_status = 0 AND m.rec_status = 0
@ -57,18 +62,20 @@
td.`name` AS taskName,
d.time,
d.content,
d.file_id as fileId,
d.file_path as filePath,
f.file_id as fileId,
f.file_name as fileName,
f.file_path as filePath,
c.id As checkId,
m1.`name` AS checkerName,
m1.id AS checkerId,
c.`status`,
c.score,
c.remark,
if(m1.id = #{userMemberId},1,0) as isMain
if(m1.id = #{userMemberId},1,0) as isMine
FROM
t_pro_deliver AS d
LEFT JOIN t_pro_deliver_checker AS c ON d.id = c.deliver_id AND c.rec_status = 0
LEFT JOIN t_pro_deliver_file AS f ON d.id = f.deliver_id AND f.rec_status = 0
LEFT JOIN t_pro_task_sub AS ts ON ts.id = d.task_sub_id
LEFT JOIN t_pro_task_detail AS td ON td.id = ts.task_detail_id
LEFT JOIN t_pro_member AS m ON m.id = d.member_id AND m.rec_status = 0 AND m.rec_status = 0

258
src/main/resources/mapper_raw/ProDeliverFileMapper.xml

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.defaultwbs.persist.mapper.ProDeliverFileMapper">
<resultMap id="BaseResultMap" type="com.ccsens.defaultwbs.bean.po.ProDeliverFile">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="deliver_id" jdbcType="BIGINT" property="deliverId" />
<result column="file_id" jdbcType="BIGINT" property="fileId" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, deliver_id, file_id, file_name, file_path, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFileExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_pro_deliver_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_pro_deliver_file
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_pro_deliver_file
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFileExample">
delete from t_pro_deliver_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFile">
insert into t_pro_deliver_file (id, deliver_id, file_id,
file_name, file_path, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{deliverId,jdbcType=BIGINT}, #{fileId,jdbcType=BIGINT},
#{fileName,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFile">
insert into t_pro_deliver_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="deliverId != null">
deliver_id,
</if>
<if test="fileId != null">
file_id,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="filePath != null">
file_path,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="deliverId != null">
#{deliverId,jdbcType=BIGINT},
</if>
<if test="fileId != null">
#{fileId,jdbcType=BIGINT},
</if>
<if test="fileName != null">
#{fileName,jdbcType=VARCHAR},
</if>
<if test="filePath != null">
#{filePath,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFileExample" resultType="java.lang.Long">
select count(*) from t_pro_deliver_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_pro_deliver_file
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.deliverId != null">
deliver_id = #{record.deliverId,jdbcType=BIGINT},
</if>
<if test="record.fileId != null">
file_id = #{record.fileId,jdbcType=BIGINT},
</if>
<if test="record.fileName != null">
file_name = #{record.fileName,jdbcType=VARCHAR},
</if>
<if test="record.filePath != null">
file_path = #{record.filePath,jdbcType=VARCHAR},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_pro_deliver_file
set id = #{record.id,jdbcType=BIGINT},
deliver_id = #{record.deliverId,jdbcType=BIGINT},
file_id = #{record.fileId,jdbcType=BIGINT},
file_name = #{record.fileName,jdbcType=VARCHAR},
file_path = #{record.filePath,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFile">
update t_pro_deliver_file
<set>
<if test="deliverId != null">
deliver_id = #{deliverId,jdbcType=BIGINT},
</if>
<if test="fileId != null">
file_id = #{fileId,jdbcType=BIGINT},
</if>
<if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if test="filePath != null">
file_path = #{filePath,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.defaultwbs.bean.po.ProDeliverFile">
update t_pro_deliver_file
set deliver_id = #{deliverId,jdbcType=BIGINT},
file_id = #{fileId,jdbcType=BIGINT},
file_name = #{fileName,jdbcType=VARCHAR},
file_path = #{filePath,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

3
src/main/resources/mbg.xml

@ -80,7 +80,8 @@
<!-- <table tableName="t_pro_member_stakeholder" domainObjectName="ProMemberStakeholder"></table>-->
<!-- <table tableName="t_pro_deliver" domainObjectName="ProDeliver"></table>-->
<!-- <table tableName="t_pro_deliver_checker" domainObjectName="ProDeliverChecker"></table>-->
<table tableName="t_file_commit" domainObjectName="FileCommit"></table>
<table tableName="t_pro_deliver_file" domainObjectName="ProDeliverFile"></table>
<!-- <table tableName="t_file_commit" domainObjectName="FileCommit"></table>-->
<!-- <table tableName="t_pro_clocking_in" domainObjectName="ProClockingIn"></table>-->
<!-- <table tableName="t_sys_holidays" domainObjectName="SysHolidays"></table>-->
<!-- <table tableName="t_pro_member_salary" domainObjectName="ProMemberSalary"></table>-->

Loading…
Cancel
Save