| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 数据检索服务 |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class DataQueryService { |
| | | @Autowired |
| | | PathHelper pathHelper; |
| | |
| | | @Autowired |
| | | AttachService attachService; |
| | | |
| | | /** |
| | | * 上传文件 |
| | | */ |
| | | public Integer uploadFiles(UserEntity ue, String tabName, String eventid, MultipartFile[] files, HttpServletRequest req) throws IOException { |
| | | List<AttachEntity> list = new ArrayList<AttachEntity>(); |
| | | for (MultipartFile file : files) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 传输文件 |
| | | String fileName = file.getOriginalFilename(); |
| | | String filePath = pathHelper.getTempPath() + File.separator + fileName; |
| | | File newFile = new File(filePath); |
| | | file.transferTo(newFile); |
| | | double sizes = FileHelper.sizeToMb(file.getSize()); |
| | | |
| | | // 获取MD5 |
| | | String md5 = FileHelper.getFileMd5(filePath); |
| | | AttachEntity entity = attachService.selectByGuid(md5); |
| | | |
| | |
| | | return attachService.inserts(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取附件实体类 |
| | | */ |
| | | protected AttachEntity getAttachEntity(UserEntity ue, String tabName, String eventid, String fileName, String md5, double sizes) { |
| | | AttachEntity entity = new AttachEntity(); |
| | | entity.setTab(tabName); |