|
@@ -4,7 +4,6 @@ import cn.reghao.file.api.iface.OssService;
|
|
|
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
|
|
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
|
|
|
import cn.reghao.tnb.common.db.SelectOption;
|
|
import cn.reghao.tnb.common.db.SelectOption;
|
|
|
import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
|
|
import cn.reghao.tnb.content.api.dto.geo.MallReplyDto;
|
|
|
-import cn.reghao.tnb.content.api.dto.geo.MallReplyPhotoDto;
|
|
|
|
|
import cn.reghao.tnb.content.app.geo.db.mapper.CameraPhotoMapper;
|
|
import cn.reghao.tnb.content.app.geo.db.mapper.CameraPhotoMapper;
|
|
|
import cn.reghao.tnb.content.app.geo.db.mapper.MallReplyMapper;
|
|
import cn.reghao.tnb.content.app.geo.db.mapper.MallReplyMapper;
|
|
|
import cn.reghao.tnb.content.app.geo.model.constant.GeoItem;
|
|
import cn.reghao.tnb.content.app.geo.model.constant.GeoItem;
|
|
@@ -40,27 +39,22 @@ public class PhotoMapService {
|
|
|
this.cameraPhotoMapper = cameraPhotoMapper;
|
|
this.cameraPhotoMapper = cameraPhotoMapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean checkReplyId(String replyId) {
|
|
|
|
|
- MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
|
|
|
|
|
- return mallReply != null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public synchronized void addTmallReply(MallReplyDto mallReplyDto) {
|
|
public synchronized void addTmallReply(MallReplyDto mallReplyDto) {
|
|
|
- String replyId = mallReplyDto.getReplyId();
|
|
|
|
|
|
|
+ long replyId = mallReplyDto.getReplyId();
|
|
|
MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
|
|
MallReply mallReply = mallReplyMapper.findByReplyId(replyId);
|
|
|
if (mallReply != null) {
|
|
if (mallReply != null) {
|
|
|
log.info("{} 已存在", replyId);
|
|
log.info("{} 已存在", replyId);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mallReply = new MallReply(mallReplyDto);
|
|
|
|
|
- List<CameraPhoto> list = mallReplyDto.getPhotos().stream()
|
|
|
|
|
- .map(mallReplyPhotoDto -> {
|
|
|
|
|
- CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
|
|
|
|
|
|
|
+ mallReply = new MallReply(replyId, mallReplyDto);
|
|
|
|
|
+ List<CameraPhoto> list = mallReplyDto.getCamPhotoList().stream()
|
|
|
|
|
+ .map(camPhoto -> {
|
|
|
|
|
+ CameraPhoto cameraPhoto = new CameraPhoto(replyId, camPhoto);
|
|
|
try {
|
|
try {
|
|
|
- String shotAtStr = mallReplyPhotoDto.getShotAt();
|
|
|
|
|
|
|
+ String shotAtStr = camPhoto.getShotAt();
|
|
|
if (shotAtStr != null) {
|
|
if (shotAtStr != null) {
|
|
|
- LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
|
|
|
|
|
|
|
+ LocalDateTime shotAt = DateTimeConverter.localDateTime2(camPhoto.getShotAt());
|
|
|
cameraPhoto.setShotAt(shotAt);
|
|
cameraPhoto.setShotAt(shotAt);
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -76,26 +70,6 @@ public class PhotoMapService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void addCameraPhotos(List<MallReplyPhotoDto> list) {
|
|
|
|
|
- List<CameraPhoto> locations = list.stream().map(mallReplyPhotoDto -> {
|
|
|
|
|
- CameraPhoto cameraPhoto = new CameraPhoto(mallReplyPhotoDto);
|
|
|
|
|
- try {
|
|
|
|
|
- String shotAtStr = mallReplyPhotoDto.getShotAt();
|
|
|
|
|
- if (shotAtStr != null) {
|
|
|
|
|
- LocalDateTime shotAt = DateTimeConverter.localDateTime2(mallReplyPhotoDto.getShotAt());
|
|
|
|
|
- cameraPhoto.setShotAt(shotAt);
|
|
|
|
|
- }
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- return cameraPhoto;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- if (!locations.isEmpty()) {
|
|
|
|
|
- cameraPhotoMapper.saveAll(locations);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void saveTmallReply(MallReply mallReply, List<CameraPhoto> list) {
|
|
public void saveTmallReply(MallReply mallReply, List<CameraPhoto> list) {
|
|
|
mallReplyMapper.save(mallReply);
|
|
mallReplyMapper.save(mallReply);
|