记得上下班打卡 | git大法好,push需谨慎

Commit 2c0b39a8 authored by stonepy's avatar stonepy

宣传手册添加餐饮攻略和相册上传链接,失物招领问卷星id, 地图

parent eb4e048b
...@@ -9,6 +9,7 @@ public class SweetConstant { ...@@ -9,6 +9,7 @@ public class SweetConstant {
public final static String REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST = "sweet:manual:notify:manual:"; public final static String REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST = "sweet:manual:notify:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_RICH_TEXT = "sweet:manual:richText:manual:"; public final static String REDIS_KEY_SWEET_MANUAL_RICH_TEXT = "sweet:manual:richText:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_SORT = "sweet:manual:sort:manual:"; public final static String REDIS_KEY_SWEET_MANUAL_SORT = "sweet:manual:sort:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_EXT_CONFIG = "sweet:manual:extConfig:manual:";
public final static String REDIS_KEY_SWEET_ARTISTS_RELATION = "sweet:artists:relation:uid:"; public final static String REDIS_KEY_SWEET_ARTISTS_RELATION = "sweet:artists:relation:uid:";
public final static String REDIS_KEY_SWEET_ARTISTS_DETAILS = "sweet:artists:details:"; public final static String REDIS_KEY_SWEET_ARTISTS_DETAILS = "sweet:artists:details:";
public final static String REDIS_KEY_SWEET_SHOP = "sweet:artists:shop:manual:"; public final static String REDIS_KEY_SWEET_SHOP = "sweet:artists:shop:manual:";
......
package com.liquidnet.service.sweet.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("草莓音乐节手册扩展配置参数")
public class SweetManualExtConfigParam implements Serializable {
@ApiModelProperty(value = "电子手册id", required = true)
private String manualId;
@ApiModelProperty("餐饮攻略链接")
private String foodGuideUrl;
@ApiModelProperty("相册链接")
private String albumUrl;
@ApiModelProperty("失物招领问卷星ID")
private String lostFoundWjxId;
@ApiModelProperty("地图GeoJSON文件地址")
private String mapGeojsonUrl;
}
package com.liquidnet.service.sweet.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualExtConfigDto;
import com.liquidnet.service.sweet.param.SweetManualExtConfigParam;
import org.springframework.web.multipart.MultipartFile;
public interface ISweetManualExtConfigService {
ResponseDto<SweetManualExtConfigDto> get(String manualId);
ResponseDto<Boolean> save(SweetManualExtConfigParam param);
ResponseDto<String> uploadGeojson(MultipartFile file);
}
package com.liquidnet.service.sweet.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("草莓音乐节手册扩展配置")
public class SweetManualExtConfigDto implements Serializable {
@ApiModelProperty("电子手册id")
private String manualId;
@ApiModelProperty("餐饮攻略链接")
private String foodGuideUrl;
@ApiModelProperty("相册链接")
private String albumUrl;
@ApiModelProperty("失物招领问卷星ID")
private String lostFoundWjxId;
@ApiModelProperty("地图GeoJSON文件地址")
private String mapGeojsonUrl;
}
...@@ -50,6 +50,26 @@ public class SweetManual implements Serializable,Cloneable { ...@@ -50,6 +50,26 @@ public class SweetManual implements Serializable,Cloneable {
*/ */
private Integer isReleaseManual; private Integer isReleaseManual;
/**
* 餐饮攻略链接
*/
private String foodGuideUrl;
/**
* 相册链接
*/
private String albumUrl;
/**
* 失物招领问卷星ID
*/
private String lostFoundWjxId;
/**
* 地图GeoJSON文件地址
*/
private String mapGeojsonUrl;
/** /**
* 创建时间 * 创建时间
*/ */
......
use ln_scene;
ALTER TABLE `sweet_manual`
ADD COLUMN `food_guide_url` varchar(500) NOT NULL DEFAULT '' COMMENT '餐饮攻略链接' AFTER `is_release_manual`,
ADD COLUMN `album_url` varchar(500) NOT NULL DEFAULT '' COMMENT '相册链接' AFTER `food_guide_url`,
ADD COLUMN `lost_found_wjx_id` varchar(200) NOT NULL DEFAULT '' COMMENT '失物招领问卷星ID' AFTER `album_url`,
ADD COLUMN `map_geojson_url` varchar(500) NOT NULL DEFAULT '' COMMENT '地图GeoJSON文件地址' AFTER `lost_found_wjx_id`;
...@@ -5,6 +5,7 @@ import com.liquidnet.service.base.ResponseDto; ...@@ -5,6 +5,7 @@ import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualAppletDto; import com.liquidnet.service.sweet.dto.SweetManualAppletDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto; import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto;
import com.liquidnet.service.sweet.dto.SweetManualArtistListDto; import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualExtConfigDto;
import com.liquidnet.service.sweet.dto.SweetPerformArtistTimeListDto; import com.liquidnet.service.sweet.dto.SweetPerformArtistTimeListDto;
import com.liquidnet.service.sweet.entity.SweetManualNotify; import com.liquidnet.service.sweet.entity.SweetManualNotify;
import com.liquidnet.service.sweet.entity.SweetManualShop; import com.liquidnet.service.sweet.entity.SweetManualShop;
...@@ -228,6 +229,15 @@ public class SweetAppletController { ...@@ -228,6 +229,15 @@ public class SweetAppletController {
return ResponseDto.success(redisDataUtils.getRichTextRedisData(manualId, type)); return ResponseDto.success(redisDataUtils.getRichTextRedisData(manualId, type));
} }
@GetMapping("manualExt")
@ApiOperation("草莓音乐节手册扩展配置")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
})
public ResponseDto<SweetManualExtConfigDto> manualExt(@RequestParam String manualId) {
return ResponseDto.success(redisDataUtils.getManualExtConfigRedisData(manualId));
}
@PostMapping("artistsWatch") @PostMapping("artistsWatch")
@ApiOperation("艺人-想看") @ApiOperation("艺人-想看")
@ApiImplicitParams({ @ApiImplicitParams({
......
package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.SweetManualExtConfigDto;
import com.liquidnet.service.sweet.param.SweetManualExtConfigParam;
import com.liquidnet.service.sweet.service.ISweetManualExtConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@Api(tags = "草莓音乐节手册扩展配置")
@RestController
@RequestMapping("/sweet-manual-ext")
public class SweetManualExtConfigController {
@Autowired
private ISweetManualExtConfigService sweetManualExtConfigService;
@GetMapping("get")
@ApiOperation("获取手册扩展配置")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "manualId", value = "电子手册id", required = true),
})
public ResponseDto<SweetManualExtConfigDto> get(@RequestParam String manualId) {
return sweetManualExtConfigService.get(manualId);
}
@PostMapping("save")
@ApiOperation("保存手册扩展配置")
public ResponseDto<Boolean> save(@RequestBody SweetManualExtConfigParam param) {
return sweetManualExtConfigService.save(param);
}
@PostMapping("uploadGeojson")
@ApiOperation("上传地图GeoJSON文件")
public ResponseDto<String> uploadGeojson(@RequestPart("file") MultipartFile file) {
return sweetManualExtConfigService.uploadGeojson(file);
}
}
package com.liquidnet.service.sweet.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.basicServices.UploadVo;
import com.liquidnet.service.sweet.dto.SweetManualExtConfigDto;
import com.liquidnet.service.sweet.entity.SweetManual;
import com.liquidnet.service.sweet.mapper.SweetManualMapper;
import com.liquidnet.service.sweet.param.SweetManualExtConfigParam;
import com.liquidnet.service.sweet.service.ISweetManualExtConfigService;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
@Service
public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigService {
private static final String GEOJSON_IMG_PREFIX = "https://img.zhengzai.tv/";
@Value("${liquidnet.service.platform.url}")
private String platformUrl;
@Autowired
private SweetManualMapper sweetManualMapper;
@Autowired
private RedisDataUtils redisDataUtils;
@Override
public ResponseDto<SweetManualExtConfigDto> get(String manualId) {
SweetManual manual = sweetManualMapper.selectOne(
Wrappers.lambdaQuery(SweetManual.class).eq(SweetManual::getManualId, manualId));
if (manual == null) {
return ResponseDto.failure("手册不存在");
}
return ResponseDto.success(toDto(manual));
}
@Override
public ResponseDto<Boolean> save(SweetManualExtConfigParam param) {
if (StringUtil.isBlank(param.getManualId())) {
return ResponseDto.failure("手册id不能为空");
}
SweetManual exist = sweetManualMapper.selectOne(
Wrappers.lambdaQuery(SweetManual.class).eq(SweetManual::getManualId, param.getManualId()));
if (exist == null) {
return ResponseDto.failure("手册不存在");
}
SweetManual update = SweetManual.getNew();
update.setFoodGuideUrl(nullToEmpty(param.getFoodGuideUrl()));
update.setAlbumUrl(nullToEmpty(param.getAlbumUrl()));
update.setLostFoundWjxId(nullToEmpty(param.getLostFoundWjxId()));
update.setMapGeojsonUrl(nullToEmpty(param.getMapGeojsonUrl()));
update.setUpdatedAt(LocalDateTime.now());
sweetManualMapper.update(update, Wrappers.lambdaUpdate(SweetManual.class)
.eq(SweetManual::getManualId, param.getManualId()));
redisDataUtils.setManualExtConfigRedisData(param.getManualId(), toDto(exist, param));
return ResponseDto.success(true);
}
@Override
public ResponseDto<String> uploadGeojson(MultipartFile file) {
if (file == null || file.isEmpty()) {
return ResponseDto.failure("文件不能为空");
}
String filename = file.getOriginalFilename();
if (StringUtil.isBlank(filename)
|| (!filename.toLowerCase().endsWith(".geojson") && !filename.toLowerCase().endsWith(".json"))) {
return ResponseDto.failure("仅支持上传.geojson或.json文件");
}
try {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
ByteArrayResource fileResource = new ByteArrayResource(file.getBytes()) {
@Override
public String getFilename() {
return filename;
}
};
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("file", fileResource);
body.add("pathName", "sweet/manual/geojson");
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
ResponseEntity<String> response = restTemplate.postForEntity(
platformUrl.concat("/platform/basicServices/alOss/upload"),
requestEntity,
String.class);
ResponseDto<UploadVo> dto = JsonUtils.fromJson(response.getBody(), new TypeReference<ResponseDto<UploadVo>>() {
});
if (dto == null || dto.getData() == null || StringUtil.isBlank(dto.getData().getOssPath())) {
return ResponseDto.failure("文件上传失败");
}
return ResponseDto.success(GEOJSON_IMG_PREFIX.concat(dto.getData().getOssPath()));
} catch (Exception e) {
return ResponseDto.failure("文件上传失败");
}
}
private SweetManualExtConfigDto toDto(SweetManual manual) {
SweetManualExtConfigDto dto = new SweetManualExtConfigDto();
dto.setManualId(manual.getManualId());
dto.setFoodGuideUrl(manual.getFoodGuideUrl());
dto.setAlbumUrl(manual.getAlbumUrl());
dto.setLostFoundWjxId(manual.getLostFoundWjxId());
dto.setMapGeojsonUrl(manual.getMapGeojsonUrl());
return dto;
}
private SweetManualExtConfigDto toDto(SweetManual exist, SweetManualExtConfigParam param) {
SweetManualExtConfigDto dto = new SweetManualExtConfigDto();
dto.setManualId(param.getManualId());
dto.setFoodGuideUrl(nullToEmpty(param.getFoodGuideUrl()));
dto.setAlbumUrl(nullToEmpty(param.getAlbumUrl()));
dto.setLostFoundWjxId(nullToEmpty(param.getLostFoundWjxId()));
dto.setMapGeojsonUrl(nullToEmpty(param.getMapGeojsonUrl()));
return dto;
}
private String nullToEmpty(String value) {
return value == null ? "" : value;
}
}
...@@ -179,6 +179,40 @@ public class RedisDataUtils { ...@@ -179,6 +179,40 @@ public class RedisDataUtils {
} }
} }
public SweetManualExtConfigDto setManualExtConfigRedisData(String manualId, SweetManualExtConfigDto content) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_EXT_CONFIG.concat(manualId);
SweetManualExtConfigDto configDto;
if (content != null) {
configDto = content;
} else {
SweetManual manual = sweetManualMapper.selectOne(
Wrappers.lambdaQuery(SweetManual.class).eq(SweetManual::getManualId, manualId));
configDto = new SweetManualExtConfigDto();
if (manual != null) {
configDto.setManualId(manual.getManualId());
configDto.setFoodGuideUrl(manual.getFoodGuideUrl());
configDto.setAlbumUrl(manual.getAlbumUrl());
configDto.setLostFoundWjxId(manual.getLostFoundWjxId());
configDto.setMapGeojsonUrl(manual.getMapGeojsonUrl());
}
}
redisUtil.set(redisKey, configDto);
return configDto;
}
public SweetManualExtConfigDto getManualExtConfigRedisData(String manualId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_EXT_CONFIG.concat(manualId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return setManualExtConfigRedisData(manualId, null);
}
return (SweetManualExtConfigDto) obj;
}
public void deleteManualExtConfigRedisData(String manualId) {
redisUtil.del(SweetConstant.REDIS_KEY_SWEET_MANUAL_EXT_CONFIG.concat(manualId));
}
public List<String> setTagRedisData(String manualId) { public List<String> setTagRedisData(String manualId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_SORT.concat(manualId); String redisKey = SweetConstant.REDIS_KEY_SWEET_MANUAL_SORT.concat(manualId);
SweetManualSort data = sweetManualSortMapper.selectOne(Wrappers.lambdaQuery(SweetManualSort.class).eq(SweetManualSort::getManualId, manualId)); SweetManualSort data = sweetManualSortMapper.selectOne(Wrappers.lambdaQuery(SweetManualSort.class).eq(SweetManualSort::getManualId, manualId));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment