图片套版生成模块

This commit is contained in:
cuibaocheng 2021-06-01 18:25:43 +08:00
parent 60f61feb29
commit 82c7f08a0c
9 changed files with 116 additions and 1 deletions

View File

@ -1,7 +1,11 @@
package cn.com.tenlion.materialstore.service.materialdata;
import cn.com.tenlion.materialstore.pojo.MaterialTypeEnum;
import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO;
import cn.com.tenlion.materialstore.pojo.vos.materialdata.MaterialDataVO;
import ink.wgink.util.ReflectUtil;
import java.util.List;
public interface MaterialDataService {
@ -19,4 +23,12 @@ public interface MaterialDataService {
*/
public MaterialDataDTO getByMaterialId(String materialId);
/**
* 查询素材包素材
* @param token
* @param typeEnum
* @return 素材集对象
*/
public MaterialDataDTO getByToken(String token, MaterialTypeEnum typeEnum) throws ReflectUtil.ReflectException, Exception;
}

View File

@ -1,5 +1,6 @@
package cn.com.tenlion.materialstore.service.materialdata.impl;
import cn.com.tenlion.materialstore.pojo.MaterialTypeEnum;
import cn.com.tenlion.materialstore.pojo.dtos.materialaudio.MaterialAudioDTO;
import cn.com.tenlion.materialstore.pojo.dtos.materialdata.MaterialDataDTO;
import cn.com.tenlion.materialstore.pojo.dtos.materiallink.MaterialLinkDTO;
@ -21,14 +22,22 @@ import cn.com.tenlion.materialstore.service.materialmap.IMaterialMapService;
import cn.com.tenlion.materialstore.service.materialphoto.IMaterialPhotoService;
import cn.com.tenlion.materialstore.service.materialtext.IMaterialTextService;
import cn.com.tenlion.materialstore.service.materialvideo.IMaterialVideoService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SearchException;
import ink.wgink.pojo.app.AppTokenUser;
import ink.wgink.util.ReflectUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Primary
@Service
public class MaterialDataServiceImpl implements MaterialDataService {
public class MaterialDataServiceImpl extends DefaultBaseService implements MaterialDataService {
@Autowired
private IMaterialTextService materialTextService;
@ -131,4 +140,49 @@ public class MaterialDataServiceImpl implements MaterialDataService {
return dataDTO;
}
@Override
public MaterialDataDTO getByToken(String token, MaterialTypeEnum typeEnum) throws Exception {
MaterialDataDTO dataDTO = new MaterialDataDTO();
Map<String, Object> query = new HashMap<String, Object>();
AppTokenUser user = securityComponent.getAppTokenUser(token);
if(user == null || StringUtils.isEmpty(user.getId())) {
throw new SearchException("用户信息不存在");
}
query.put("creator", user.getId());
switch (typeEnum) {
case TEXT:
List<MaterialTextDTO> textDTOList = materialTextService.list(query);
dataDTO.setText(textDTOList);
break;
case PHOTO:
List<MaterialPhotoDTO> photoDTOList = materialPhotoService.list(query);
dataDTO.setPhoto(photoDTOList);
break;
case AUDIO:
List<MaterialAudioDTO> audioDTOList = materialAudioService.list(query);
dataDTO.setAudio(audioDTOList);
break;
case VIDEO:
List<MaterialVideoDTO> videoDTOList = materialVideoService.list(query);
dataDTO.setVideo(videoDTOList);
break;
case MAP:
List<MaterialMapDTO> mapDTOList = materialMapService.list(query);
dataDTO.setMap(mapDTOList);
break;
case LINK:
List<MaterialLinkDTO> linkDTOList = materialLinkService.list(query);
dataDTO.setLink(linkDTOList);
break;
default:
dataDTO.setText(materialTextService.list(query));
dataDTO.setPhoto(materialPhotoService.list(query));
dataDTO.setAudio(materialAudioService.list(query));
dataDTO.setVideo(materialVideoService.list(query));
dataDTO.setMap(materialMapService.list(query));
dataDTO.setLink(materialLinkService.list(query));
}
return dataDTO;
}
}

View File

@ -258,6 +258,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -272,6 +272,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -284,6 +284,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -262,6 +262,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -274,6 +274,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -258,6 +258,9 @@
<if test="materialId != '' and materialId != null">
AND t1.material_id = #{materialId}
</if>
<if test="creator != '' and creator != null">
AND t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC, t1.material_order
</select>

View File

@ -0,0 +1,31 @@
package cn.com.tenlion.materialstore.pojo;
public enum MaterialTypeEnum {
TEXT("TEXT", "文本"),
PHOTO("PHOTO", "图片"),
AUDIO("AUDIO", "音频"),
VIDEO("VIDEO", "视频"),
MAP("MAP", "经纬度"),
LINK("LINK", "链接");
private String type;
private String typeName;
MaterialTypeEnum(String type, String typeName) {
this.type = type;
this.typeName = typeName;
}
public String getType() {
return type;
}
public String getTypeName() {
return typeName;
}
// public static ArrayList<Map<String, String>> getType() {
// return type;
// }
}