add: ceshi

This commit is contained in:
ls
2025-03-17 19:15:06 +08:00
parent 8562655e51
commit 6f889937b7
10 changed files with 57 additions and 33 deletions

View File

@@ -8,9 +8,10 @@
package com.boge;
import io.swagger.annotations.Api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@Api(hidden = true)
@SpringBootApplication
public class BaseApplication {
@@ -19,4 +20,4 @@ public class BaseApplication {
SpringApplication.run(BaseApplication.class, args);
}
}
}

View File

@@ -60,5 +60,9 @@ public class ContractEntity implements Serializable {
* 备注
*/
private String remarks;
/**
* 文件id
*/
private String storageId;
}

View File

@@ -10,16 +10,13 @@ import com.boge.modules.tickets.service.LocalStorageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -36,15 +33,15 @@ public class LocalStorageController {
@ApiOperation("查询文件")
@GetMapping
public ResponseEntity<Object> query() {
return new ResponseEntity(this.localStorageService.queryAll(), HttpStatus.OK);
public ResponseEntity<Object> query(@RequestParam Integer contractId) {
return new ResponseEntity(this.localStorageService.queryAll(contractId), HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping({"/download"})
public void download(HttpServletResponse response) throws IOException {
public void download(@RequestParam Integer contractId ,HttpServletResponse response) throws IOException {
this.localStorageService.download(this.localStorageService.queryAll(), response);
this.localStorageService.download(this.localStorageService.queryAll(contractId), response);
}
@ApiOperation("上传文件")

View File

@@ -18,7 +18,7 @@ import com.boge.common.utils.R;
/**
*
*
*
* @author ls
* @email dengpbs@163.com

View File

@@ -14,7 +14,7 @@ import java.sql.Timestamp;
@Entity
@Data
@Table(
name = "tool_local_storage"
name = "local_storage"
)
public class LocalStorage implements Serializable {
@@ -22,14 +22,10 @@ public class LocalStorage implements Serializable {
@Column(
name = "storage_id"
)
@ApiModelProperty(
value = "ID",
hidden = true
)
@GeneratedValue(
strategy = GenerationType.IDENTITY
)
private Long id;
private Long storageId;
@ApiModelProperty("真实文件名")
private String realName;
@ApiModelProperty("文件名")
@@ -60,7 +56,7 @@ public class LocalStorage implements Serializable {
value = "更新人",
hidden = true
)
private String updatedBy;
private String updateBy;
@CreationTimestamp
@Column(
name = "create_time",
@@ -81,6 +77,8 @@ public class LocalStorage implements Serializable {
)
private Timestamp updateTime;
public LocalStorage(String realName, String name, String suffix, String path, String type, String size) {
this.realName = realName;
this.name = name;

View File

@@ -8,8 +8,8 @@ import java.util.Date;
import lombok.Data;
/**
*
*
*
*
* @author ls
* @email dengpbs@163.com
* @date 2025-03-05 14:29:12
@@ -23,7 +23,7 @@ public class TicketsEntity implements Serializable {
* 工单id
*/
@TableId
private String ticketsId;
private Long ticketsId;
/**
* 小车类型
*/
@@ -73,4 +73,6 @@ public class TicketsEntity implements Serializable {
*/
private Date updateTime;
}

View File

@@ -1,6 +1,5 @@
package com.boge.modules.tickets.service;
import com.boge.modules.tickets.dto.LocalStorageDto;
import com.boge.modules.tickets.entity.LocalStorage;
import org.springframework.web.multipart.MultipartFile;
@@ -10,7 +9,7 @@ import java.util.List;
public interface LocalStorageService {
List<LocalStorage> queryAll();
List<LocalStorage> queryAll(Integer contractId);
LocalStorage create(String name, MultipartFile file);

View File

@@ -3,34 +3,43 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boge.common.exception.RRException;
import com.boge.common.utils.FileProperties;
import com.boge.common.utils.FileUtil;
import com.boge.modules.contract.entity.ContractEntity;
import com.boge.modules.contract.service.ContractService;
import com.boge.modules.tickets.dao.LocalStorageMapper;
import com.boge.modules.tickets.entity.LocalStorage;
import com.boge.modules.tickets.entity.LocalStorageQueryCriteria;
import com.boge.modules.tickets.repository.LocalStorageRepository;
import com.boge.modules.tickets.service.LocalStorageService;
import net.bytebuddy.implementation.bytecode.Throw;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@Service
public class LocalStorageServiceImpl extends ServiceImpl<LocalStorageMapper, LocalStorage> implements LocalStorageService {
public class LocalStorageServiceImpl implements LocalStorageService {
private final LocalStorageRepository localStorageRepository;
private final LocalStorageMapper localStorageMapper;
private final FileProperties properties;
public List<LocalStorage> queryAll() {
return localStorageMapper.selectList(new QueryWrapper<LocalStorage>());
@Autowired
private ContractService contractService;
public List<LocalStorage> queryAll(Integer contractId) {
ContractEntity contract = contractService.getById(contractId);
if (ObjectUtil.isNull(contract)) {
throw new RRException("合同为空");
}
if (StrUtil.isEmpty(contract.getStorageId())){
return null;
}
String[] split = contract.getStorageId().split(",");
return localStorageMapper.selectList(new QueryWrapper<LocalStorage>().in("storage_id", Arrays.asList(split)));
}

View File

@@ -69,4 +69,18 @@ renren:
flowable:
async-executor-activate: false
database-schema-update: true
# 文件存储路径
file:
mac:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5