Compare commits

...

7 Commits

6 changed files with 53 additions and 22 deletions

16
pom.xml
View File

@ -39,6 +39,20 @@
<properties> <properties>
<native.classifier>windows-x86_64</native.classifier> <native.classifier>windows-x86_64</native.classifier>
</properties> </properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId>
<version>7.1.1-1.5.12</version>
<classifier>${native.classifier}</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.11.0-1.5.12</version>
<classifier>${native.classifier}</classifier>
</dependency>
</dependencies>
</profile> </profile>
<profile> <profile>
<id>prod-linux</id> <id>prod-linux</id>
@ -227,8 +241,6 @@
<groupId>org.bytedeco</groupId> <groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId> <artifactId>ffmpeg</artifactId>
<version>7.1.1-1.5.12</version> <version>7.1.1-1.5.12</version>
<scope>provided</scope>
<classifier>windows-x86_64</classifier>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bytedeco</groupId> <groupId>org.bytedeco</groupId>

View File

@ -5,6 +5,7 @@ import com.google.gson.reflect.TypeToken;
import com.imyeyu.api.bean.CaptchaFrom; import com.imyeyu.api.bean.CaptchaFrom;
import com.imyeyu.api.modules.common.bean.ImageType; import com.imyeyu.api.modules.common.bean.ImageType;
import com.imyeyu.api.modules.common.bean.SettingKey; import com.imyeyu.api.modules.common.bean.SettingKey;
import com.imyeyu.api.modules.common.bean.TempFileMetaData;
import com.imyeyu.api.modules.common.entity.Attachment; import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.entity.Setting; import com.imyeyu.api.modules.common.entity.Setting;
import com.imyeyu.api.modules.common.entity.Task; import com.imyeyu.api.modules.common.entity.Task;
@ -432,6 +433,7 @@ public class CommonController {
@RequestMapping("/temp/file/download/{fileId}") @RequestMapping("/temp/file/download/{fileId}")
public void tempFileDownload(@PathVariable String fileId, HttpServletResponse resp) { public void tempFileDownload(@PathVariable String fileId, HttpServletResponse resp) {
try { try {
TempFileMetaData metadata = tempFileService.metadata(fileId);
File file = tempFileService.get(fileId); File file = tempFileService.get(fileId);
if (TimiJava.isEmpty(file) && file.exists()) { if (TimiJava.isEmpty(file) && file.exists()) {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND); resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
@ -439,7 +441,7 @@ public class CommonController {
} }
String mimeType = new Tika().detect(file); String mimeType = new Tika().detect(file);
resp.setContentType(mimeType); resp.setContentType(mimeType);
resp.setHeader("Content-Disposition", Network.getFileDownloadHeader(file.getName())); resp.setHeader("Content-Disposition", Network.getFileDownloadHeader(metadata.getOriginalName()));
resp.setHeader("Accept-Ranges", "bytes"); resp.setHeader("Accept-Ranges", "bytes");
RequestRange range = TimiSpring.requestRange(file.length()); RequestRange range = TimiSpring.requestRange(file.length());

View File

@ -61,7 +61,6 @@ public class Travel extends Entity {
} }
/** 交通类型 */ /** 交通类型 */
@PageIgnore
private TransportationType transportationType; private TransportationType transportationType;
/** 标题 */ /** 标题 */
@ -75,7 +74,6 @@ public class Travel extends Entity {
private Long travelAt; private Long travelAt;
/** 天数 */ /** 天数 */
@PageIgnore
private Integer days; private Integer days;
/** 状态 */ /** 状态 */

View File

@ -27,23 +27,26 @@ public class TravelLocation extends Entity {
*/ */
public enum Type { public enum Type {
/** 景点 */ /** 美食 */
ATTRACTION, FOOD,
/** 酒店 */ /** 酒店 */
HOTEL, HOTEL,
/** 餐厅 */
RESTAURANT,
/** 交通站点 */ /** 交通站点 */
TRANSPORT, TRANSPORT,
/** 景点 */
ATTRACTION,
/** 购物 */ /** 购物 */
SHOPPING, SHOPPING,
/** 其他 */ /** 玩乐 */
OTHER PLAY,
/** 生活 */
LIFE,
} }
/** 旅行计划 ID */ /** 旅行计划 ID */
@ -73,9 +76,15 @@ public class TravelLocation extends Entity {
/** true 为需要身份证 */ /** true 为需要身份证 */
private Boolean requireIdCard; private Boolean requireIdCard;
/** 必要评分 */ /** true 为需要预约 */
private Boolean requireAppointment;
/** 评分 */
private Integer score; private Integer score;
/** 重要程度 */
private Integer importance;
@Transient @Transient
private Long[] attachmentIds; private Long[] attachmentIds;

View File

@ -62,16 +62,19 @@ public class TravelLocationServiceImplement extends AbstractEntityService<Travel
@Transactional(TimiServerDBConfig.ROLLBACKER) @Transactional(TimiServerDBConfig.ROLLBACKER)
@Override @Override
public void update(TravelLocation travelLocation) { public void update(TravelLocation travelLocation) {
super.update(travelLocation); // 使用 update 以允许设置 score 和 importance 为 null
mapper.update(travelLocation);
// 删除 // 删除
Set<Long> dbAttachSet = attachmentService.listByBizId(Attachment.BizType.JOURNAL_TRAVEL, travelLocation.getId(), MediaAttach.Type.THUMB) if (TimiJava.isNotEmpty(travelLocation.getAttachmentIds())) {
.stream() Set<Long> dbAttachSet = attachmentService.listByBizId(Attachment.BizType.JOURNAL_TRAVEL, travelLocation.getId(), MediaAttach.Type.THUMB)
.map(Attachment::getId) .stream()
.collect(Collectors.toSet()); .map(Attachment::getId)
Set<Long> retainIds = Set.of(TimiJava.firstNotEmpty(travelLocation.getAttachmentIds(), new Long[0])); .collect(Collectors.toSet());
dbAttachSet.removeAll(retainIds); Set<Long> retainIds = Set.of(travelLocation.getAttachmentIds());
for (Long removeId : dbAttachSet) { dbAttachSet.removeAll(retainIds);
attachmentService.deleteMedia(removeId); for (Long removeId : dbAttachSet) {
attachmentService.deleteMedia(removeId);
}
} }
// 新增 // 新增
for (String tempFileId : TimiJava.firstNotNull(travelLocation.getTempFileIds(), new String[0])) { for (String tempFileId : TimiJava.firstNotNull(travelLocation.getTempFileIds(), new String[0])) {

View File

@ -31,6 +31,13 @@ public class TravelServiceImplement extends AbstractEntityService<Travel, Long>
return mapper; return mapper;
} }
@Transactional(TimiServerDBConfig.ROLLBACKER)
@Override
public void update(Travel travel) {
// 使用 update 以允许设置 travelAt 和 days 为 null
mapper.update(travel);
}
@Transactional(TimiServerDBConfig.ROLLBACKER) @Transactional(TimiServerDBConfig.ROLLBACKER)
@Override @Override
public void delete(Long id) { public void delete(Long id) {