Commit 3cc2ba4f by danmo

Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev

2 parents 2c31dc7c 4105db98
Showing 19 changed files with 210 additions and 59 deletions
...@@ -3,12 +3,16 @@ package com.linkwechat.web.controller.wecom; ...@@ -3,12 +3,16 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.service.IWeChatCollectionService; import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 聊天工具 侧边栏栏 素材收藏 * 聊天工具 侧边栏栏 素材收藏
* *
...@@ -28,8 +32,8 @@ public class WeChatCollectionController extends BaseController { ...@@ -28,8 +32,8 @@ public class WeChatCollectionController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('chat:collection:add')") @PreAuthorize("@ss.hasPermi('chat:collection:add')")
@Log(title = "添加收藏", businessType = BusinessType.INSERT) @Log(title = "添加收藏", businessType = BusinessType.INSERT)
@PostMapping @PutMapping("addCollection")
public AjaxResult addCollection(@RequestParam(value = "materialId") Long materialId, @RequestParam(value = "userId") Long userId) { public AjaxResult addCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.addCollection(materialId, userId)); return toAjax(weChatCollectionService.addCollection(materialId, userId));
} }
...@@ -39,9 +43,20 @@ public class WeChatCollectionController extends BaseController { ...@@ -39,9 +43,20 @@ public class WeChatCollectionController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('chat:collection:delete')") @PreAuthorize("@ss.hasPermi('chat:collection:delete')")
@Log(title = "取消收藏", businessType = BusinessType.UPDATE) @Log(title = "取消收藏", businessType = BusinessType.UPDATE)
@PutMapping @PostMapping(value = "cancleCollection")
public AjaxResult cancleCollection(@RequestParam(value = "materialId") Long materialId, @RequestParam(value = "userId") Long userId) { public AjaxResult cancleCollection(@RequestParam(value = "materialId") Long materialId,@RequestParam(value = "userId") Long userId) {
return toAjax(weChatCollectionService.cancleCollection(materialId, userId)); return toAjax(weChatCollectionService.cancleCollection(materialId, userId));
} }
/**
* 收藏列表
*/
@PreAuthorize("@ss.hasPermi('chat:collection:list')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "userId") Long userId) {
startPage();
List<WeChatSideVo> collections = weChatCollectionService.collections(userId);
return getDataTable(collections);
}
} }
...@@ -3,15 +3,16 @@ package com.linkwechat.web.controller.wecom; ...@@ -3,15 +3,16 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.dto.WeChatItemDto; import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.service.IWeChatItemService; import com.linkwechat.wecom.service.IWeChatItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 聊天工具侧边栏 * 聊天工具侧边栏
...@@ -35,6 +36,15 @@ public class WeChatItemController extends BaseController { ...@@ -35,6 +36,15 @@ public class WeChatItemController extends BaseController {
return toAjax(weChatItemService.checkItems(chatItemDto)); return toAjax(weChatItemService.checkItems(chatItemDto));
} }
/**
* h5素材列表
*/
@PreAuthorize("@ss.hasPermi('chat:item:list')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "sideId") Long sideId) {
startPage();
List<WeChatSideVo> weChatSideVos = weChatItemService.chatItems(sideId);
return getDataTable(weChatSideVos);
}
} }
...@@ -5,22 +5,19 @@ import com.linkwechat.common.core.domain.AjaxResult; ...@@ -5,22 +5,19 @@ import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.WePoster; import com.linkwechat.wecom.domain.WePoster;
import com.linkwechat.wecom.domain.WePosterFont;
import com.linkwechat.wecom.domain.WePosterSubassembly; import com.linkwechat.wecom.domain.WePosterSubassembly;
import com.linkwechat.wecom.service.IWePosterFontService; import com.linkwechat.wecom.service.IWePosterFontService;
import com.linkwechat.wecom.service.IWePosterService; import com.linkwechat.wecom.service.IWePosterService;
import com.linkwechat.wecom.service.IWePosterSubassemblyService; import com.linkwechat.wecom.service.IWePosterSubassemblyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -46,8 +43,9 @@ public class WePosterController extends BaseController { ...@@ -46,8 +43,9 @@ public class WePosterController extends BaseController {
@PostMapping(value = "insert") @PostMapping(value = "insert")
@ApiOperation("创建海报") @ApiOperation("创建海报")
@PreAuthorize("@ss.hasAnyPermi('wecom:poster:insert')")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult insert(@RequestBody WePoster poster){ public AjaxResult insert(@RequestBody WePoster poster) {
wePosterService.generateSimpleImg(poster); wePosterService.generateSimpleImg(poster);
poster.setId(SnowFlakeUtil.nextId()); poster.setId(SnowFlakeUtil.nextId());
poster.setDelFlag(0); poster.setDelFlag(0);
...@@ -68,37 +66,38 @@ public class WePosterController extends BaseController { ...@@ -68,37 +66,38 @@ public class WePosterController extends BaseController {
@PutMapping(value = "update") @PutMapping(value = "update")
@ApiOperation("修改海报") @ApiOperation("修改海报")
@PreAuthorize("@ss.hasAnyPermi('wecom:poster:update')")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult update(@RequestBody WePoster poster){ public AjaxResult update(@RequestBody WePoster poster) {
if(poster.getId() == null){ if (poster.getId() == null) {
return AjaxResult.error("id为空"); return AjaxResult.error("id为空");
} }
poster.setMediaType(null); poster.setMediaType(null);
wePosterService.generateSimpleImg(poster); wePosterService.generateSimpleImg(poster);
wePosterService.saveOrUpdate(poster); wePosterService.saveOrUpdate(poster);
List<WePosterSubassembly> posterSubassemblyList = wePosterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId,poster.getId()).eq(WePosterSubassembly::getDelFlag,1).list(); List<WePosterSubassembly> posterSubassemblyList = wePosterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId, poster.getId()).eq(WePosterSubassembly::getDelFlag, 1).list();
Map<Long,WePosterSubassembly> posterSubassemblyMap = posterSubassemblyList.stream().collect(Collectors.toMap(WePosterSubassembly::getId,p->p)); Map<Long, WePosterSubassembly> posterSubassemblyMap = posterSubassemblyList.stream().collect(Collectors.toMap(WePosterSubassembly::getId, p -> p));
List<WePosterSubassembly> insertList = new ArrayList<>(); List<WePosterSubassembly> insertList = new ArrayList<>();
List<WePosterSubassembly> updateList = new ArrayList<>(); List<WePosterSubassembly> updateList = new ArrayList<>();
poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> { poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> {
if(wePosterSubassembly.getId() == null){ if (wePosterSubassembly.getId() == null) {
wePosterSubassembly.setId(SnowFlakeUtil.nextId()); wePosterSubassembly.setId(SnowFlakeUtil.nextId());
wePosterSubassembly.setPosterId(poster.getId()); wePosterSubassembly.setPosterId(poster.getId());
wePosterSubassembly.setDelFlag(0); wePosterSubassembly.setDelFlag(0);
insertList.add(wePosterSubassembly); insertList.add(wePosterSubassembly);
}else { } else {
posterSubassemblyMap.remove(wePosterSubassembly.getId()); posterSubassemblyMap.remove(wePosterSubassembly.getId());
updateList.add(wePosterSubassembly); updateList.add(wePosterSubassembly);
} }
}); });
if(!CollectionUtils.isEmpty(insertList)) { if (!CollectionUtils.isEmpty(insertList)) {
wePosterSubassemblyService.saveBatch(insertList); wePosterSubassemblyService.saveBatch(insertList);
} }
if(!CollectionUtils.isEmpty(updateList)) { if (!CollectionUtils.isEmpty(updateList)) {
wePosterSubassemblyService.updateBatchById(updateList); wePosterSubassemblyService.updateBatchById(updateList);
} }
List<WePosterSubassembly> deleteList = new ArrayList<>(posterSubassemblyMap.values()); List<WePosterSubassembly> deleteList = new ArrayList<>(posterSubassemblyMap.values());
if(!CollectionUtils.isEmpty(deleteList)){ if (!CollectionUtils.isEmpty(deleteList)) {
deleteList.forEach(wePosterSubassembly -> wePosterSubassembly.setDelFlag(1)); deleteList.forEach(wePosterSubassembly -> wePosterSubassembly.setDelFlag(1));
wePosterSubassemblyService.updateBatchById(deleteList); wePosterSubassemblyService.updateBatchById(deleteList);
} }
...@@ -118,19 +117,21 @@ public class WePosterController extends BaseController { ...@@ -118,19 +117,21 @@ public class WePosterController extends BaseController {
}*/ }*/
@GetMapping(value = "entity/{id}") @GetMapping(value = "entity/{id}")
@PreAuthorize("@ss.hasAnyPermi('wecom:poster:entity')")
@ApiOperation("查询海报详情") @ApiOperation("查询海报详情")
public AjaxResult entity(@PathVariable Long id){ public AjaxResult entity(@PathVariable Long id) {
return AjaxResult.success(wePosterService.selectOne(id)); return AjaxResult.success(wePosterService.selectOne(id));
} }
@GetMapping(value = "page") @GetMapping(value = "page")
@ApiOperation("分页查询海报") @ApiOperation("分页查询海报")
public AjaxResult page(Long categoryId,String name){ @PreAuthorize("@ss.hasAnyPermi('wecom:poster:page')")
public AjaxResult page(Long categoryId, String name) {
startPage(); startPage();
List<WePoster> fontList = wePosterService.lambdaQuery() List<WePoster> fontList = wePosterService.lambdaQuery()
.eq(WePoster::getDelFlag,0) .eq(WePoster::getDelFlag, 0)
.eq(categoryId != null,WePoster::getCategoryId,categoryId) .eq(categoryId != null, WePoster::getCategoryId, categoryId)
.like(StringUtils.isNotBlank(name),WePoster::getTitle,name) .like(StringUtils.isNotBlank(name), WePoster::getTitle, name)
.orderByDesc(WePoster::getCreateTime) .orderByDesc(WePoster::getCreateTime)
.list(); .list();
return AjaxResult.success(getDataTable(fontList)); return AjaxResult.success(getDataTable(fontList));
...@@ -138,14 +139,15 @@ public class WePosterController extends BaseController { ...@@ -138,14 +139,15 @@ public class WePosterController extends BaseController {
@DeleteMapping(value = "delete/{id}") @DeleteMapping(value = "delete/{id}")
@ApiOperation(value = "删除海报") @ApiOperation(value = "删除海报")
@PreAuthorize("@ss.hasAnyPermi('wecom:poster:delete')")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult deletePosterFont(@PathVariable Long id){ public AjaxResult deletePosterFont(@PathVariable Long id) {
wePosterService.lambdaUpdate().set(WePoster::getDelFlag,1).eq(WePoster::getId,id); wePosterService.update(
wePosterSubassemblyService.lambdaUpdate().set(WePosterSubassembly::getDelFlag,1).eq(WePosterSubassembly::getPosterId,id); wePosterService.lambdaUpdate().set(WePoster::getDelFlag, 1).eq(WePoster::getId, id));
wePosterSubassemblyService.update(
wePosterSubassemblyService.lambdaUpdate().set(WePosterSubassembly::getDelFlag, 1).eq(WePosterSubassembly::getPosterId, id));
return AjaxResult.success("删除成功"); return AjaxResult.success("删除成功");
} }
} }
...@@ -4,7 +4,6 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -4,7 +4,6 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.web.controller.common.CommonController;
import com.linkwechat.wecom.domain.WePosterFont; import com.linkwechat.wecom.domain.WePosterFont;
import com.linkwechat.wecom.service.IWePosterFontService; import com.linkwechat.wecom.service.IWePosterFontService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -30,7 +29,7 @@ public class WePosterFontController extends BaseController { ...@@ -30,7 +29,7 @@ public class WePosterFontController extends BaseController {
@PostMapping(value = "posterFont") @PostMapping(value = "posterFont")
@ApiOperation("创建海报字体") @ApiOperation("创建海报字体")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult insertPosterFont(@RequestBody WePosterFont posterFont){ public AjaxResult insertPosterFont(@RequestBody WePosterFont posterFont) {
posterFont.setId(SnowFlakeUtil.nextId()); posterFont.setId(SnowFlakeUtil.nextId());
posterFont.setDelFlag(0); posterFont.setDelFlag(0);
posterFont.setMediaType(MediaType.POSTER_FONT.getType()); posterFont.setMediaType(MediaType.POSTER_FONT.getType());
...@@ -42,8 +41,8 @@ public class WePosterFontController extends BaseController { ...@@ -42,8 +41,8 @@ public class WePosterFontController extends BaseController {
@PutMapping(value = "posterFont") @PutMapping(value = "posterFont")
@ApiOperation("修改海报字体") @ApiOperation("修改海报字体")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult updatePosterFont(@RequestBody WePosterFont posterFont){ public AjaxResult updatePosterFont(@RequestBody WePosterFont posterFont) {
if(posterFont.getId() == null){ if (posterFont.getId() == null) {
return AjaxResult.error("id为空"); return AjaxResult.error("id为空");
} }
posterFont.setMediaType(null); posterFont.setMediaType(null);
...@@ -53,9 +52,9 @@ public class WePosterFontController extends BaseController { ...@@ -53,9 +52,9 @@ public class WePosterFontController extends BaseController {
@GetMapping(value = "posterFontList") @GetMapping(value = "posterFontList")
@ApiOperation("列表查询海报字体") @ApiOperation("列表查询海报字体")
public AjaxResult selectPosterFontList(){ public AjaxResult selectPosterFontList() {
List<WePosterFont> fontList = wePosterFontService.lambdaQuery() List<WePosterFont> fontList = wePosterFontService.lambdaQuery()
.eq(WePosterFont::getDelFlag,0) .eq(WePosterFont::getDelFlag, 0)
.orderByDesc(WePosterFont::getOrder) .orderByDesc(WePosterFont::getOrder)
.orderByDesc(WePosterFont::getCreateTime) .orderByDesc(WePosterFont::getCreateTime)
.list(); .list();
...@@ -64,10 +63,10 @@ public class WePosterFontController extends BaseController { ...@@ -64,10 +63,10 @@ public class WePosterFontController extends BaseController {
@GetMapping(value = "posterFontPage") @GetMapping(value = "posterFontPage")
@ApiOperation("分页查询海报字体") @ApiOperation("分页查询海报字体")
public AjaxResult selectPosterFontPage(){ public AjaxResult selectPosterFontPage() {
startPage(); startPage();
List<WePosterFont> fontList = wePosterFontService.lambdaQuery() List<WePosterFont> fontList = wePosterFontService.lambdaQuery()
.eq(WePosterFont::getDelFlag,0) .eq(WePosterFont::getDelFlag, 0)
.orderByDesc(WePosterFont::getOrder) .orderByDesc(WePosterFont::getOrder)
.orderByDesc(WePosterFont::getCreateTime) .orderByDesc(WePosterFont::getCreateTime)
.list(); .list();
...@@ -77,11 +76,11 @@ public class WePosterFontController extends BaseController { ...@@ -77,11 +76,11 @@ public class WePosterFontController extends BaseController {
@DeleteMapping(value = "posterFont/{id}") @DeleteMapping(value = "posterFont/{id}")
@ApiOperation("删除海报字体") @ApiOperation("删除海报字体")
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public AjaxResult deletePosterFont(@PathVariable Long id){ public AjaxResult deletePosterFont(@PathVariable Long id) {
wePosterFontService.lambdaUpdate().set(WePosterFont::getDelFlag,1).eq(WePosterFont::getId,id); wePosterFontService.update(
wePosterFontService.lambdaUpdate().set(WePosterFont::getDelFlag, 1).eq(WePosterFont::getId, id));
return AjaxResult.success("删除成功"); return AjaxResult.success("删除成功");
} }
} }
...@@ -178,6 +178,8 @@ wecome: ...@@ -178,6 +178,8 @@ wecome:
- /externalcontact/get_unassigned_list - /externalcontact/get_unassigned_list
- /externalcontact/send_welcome_msg - /externalcontact/send_welcome_msg
- /externalcontact/unionid_to_external_userid - /externalcontact/unionid_to_external_userid
- /externalcontact/add_msg_template
- /externalcontact/get_group_msg_result
- /get_jsapi_ticket - /get_jsapi_ticket
- /ticket/get - /ticket/get
fileUplodUrl: /media/upload,/media/uploadimg fileUplodUrl: /media/upload,/media/uploadimg
......
...@@ -25,19 +25,6 @@ public class NetFileUtils { ...@@ -25,19 +25,6 @@ public class NetFileUtils {
private static final WebClient webClient = WebClient.create(vertx); private static final WebClient webClient = WebClient.create(vertx);
public static void main(String[] args) {
FileCallable fileCallable = getNetFile("https://pc-index-skin.cdn.bcebos.com/hiphoto/51631423522.jpg?x-bce-process=image/crop,x_0,y_13,w_1999,h_1250");
ByteArrayOutputStream byteArrayOutputStream = getByteArrayOutputStream(fileCallable,true);
StreamMultipartFile file = new StreamMultipartFile("你好啊.jpg",byteArrayOutputStream.toByteArray());
File f = new File("D:/网页/2.jpg");
try {
file.transferTo(f);
} catch (IOException e) {
e.printStackTrace();
}
}
public static FileCallable getNetFile(String urlPath){ public static FileCallable getNetFile(String urlPath){
FileCallable fileCallable = new FileCallable(); FileCallable fileCallable = new FileCallable();
......
...@@ -18,7 +18,7 @@ public class WeChatSide extends BaseEntity { ...@@ -18,7 +18,7 @@ public class WeChatSide extends BaseEntity {
/** /**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 * 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/ */
private Long mediaType; private String mediaType;
/** /**
* 聊天工具栏名称 * 聊天工具栏名称
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
/**
* 聊天侧边栏
* @author kewen
*/
@Data
public class WeChatSideVo {
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private String mediaType;
/**
* 素材id
*/
private Long materialId;
/**
* 本地资源文件地址
*/
private String materialUrl;
/**
* 文本内容、图片文案
*/
private String content;
/**
* 图片名称
*/
private String materialName;
}
...@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper; ...@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatCollection; import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 聊天工具 侧边栏栏 素材收藏 * 聊天工具 侧边栏栏 素材收藏
* *
...@@ -37,4 +40,12 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> { ...@@ -37,4 +40,12 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
*/ */
public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") Long userId); public int countCollectionByMaterialIdAndUserId(@Param("materialId") Long materialId,@Param("userId") Long userId);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> findCollections(Long userId);
} }
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatItem; import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto; import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -27,4 +28,12 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> { ...@@ -27,4 +28,12 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
*/ */
public int dropItem(@Param("sideId") Long sideId); public int dropItem(@Param("sideId") Long sideId);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public List<WeChatSideVo> findChatItems(@Param("sideId") Long sideId);
} }
...@@ -2,6 +2,8 @@ package com.linkwechat.wecom.mapper; ...@@ -2,6 +2,8 @@ package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeChatSide; import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -27,4 +29,6 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> { ...@@ -27,4 +29,6 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
*/ */
public int updateWeChatSideById(WeChatSide weChatSide); public int updateWeChatSideById(WeChatSide weChatSide);
} }
...@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service; ...@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatCollection; import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import java.util.List;
/** /**
* 聊天工具 侧边栏栏 素材收藏 * 聊天工具 侧边栏栏 素材收藏
...@@ -28,4 +31,12 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> { ...@@ -28,4 +31,12 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
*/ */
public int cancleCollection( Long materialId, Long userId); public int cancleCollection( Long materialId, Long userId);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public List<WeChatSideVo> collections(Long userId);
} }
...@@ -3,6 +3,9 @@ package com.linkwechat.wecom.service; ...@@ -3,6 +3,9 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeChatItem; import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.dto.WeChatItemDto; import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import java.util.List;
/** /**
* 聊天工具侧边栏 * 聊天工具侧边栏
...@@ -18,4 +21,12 @@ public interface IWeChatItemService extends IService<WeChatItem> { ...@@ -18,4 +21,12 @@ public interface IWeChatItemService extends IService<WeChatItem> {
*/ */
public int checkItems(WeChatItemDto chatItemDto); public int checkItems(WeChatItemDto chatItemDto);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public List<WeChatSideVo> chatItems(Long sideId);
} }
...@@ -3,11 +3,14 @@ package com.linkwechat.wecom.service.impl; ...@@ -3,11 +3,14 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.domain.WeChatCollection; import com.linkwechat.wecom.domain.WeChatCollection;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.mapper.WeChatCollectionMapper; import com.linkwechat.wecom.mapper.WeChatCollectionMapper;
import com.linkwechat.wecom.service.IWeChatCollectionService; import com.linkwechat.wecom.service.IWeChatCollectionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 聊天工具 侧边栏栏 素材收藏 * 聊天工具 侧边栏栏 素材收藏
* *
...@@ -34,4 +37,9 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap ...@@ -34,4 +37,9 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap
return weChatCollectionMapper.dropCollection(materialId,userId); return weChatCollectionMapper.dropCollection(materialId,userId);
} }
@Override
public List<WeChatSideVo> collections(Long userId) {
return weChatCollectionMapper.findCollections(userId);
}
} }
...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeChatItem; ...@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeChatItem;
import com.linkwechat.wecom.domain.WeChatSide; import com.linkwechat.wecom.domain.WeChatSide;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeChatItemDto; import com.linkwechat.wecom.domain.dto.WeChatItemDto;
import com.linkwechat.wecom.domain.vo.WeChatSideVo;
import com.linkwechat.wecom.mapper.WeChatItemMapper; import com.linkwechat.wecom.mapper.WeChatItemMapper;
import com.linkwechat.wecom.mapper.WeChatSideMapper; import com.linkwechat.wecom.mapper.WeChatSideMapper;
import com.linkwechat.wecom.service.IWeChatItemService; import com.linkwechat.wecom.service.IWeChatItemService;
...@@ -94,6 +95,11 @@ public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatI ...@@ -94,6 +95,11 @@ public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatI
return 1; return 1;
} }
@Override
public List<WeChatSideVo> chatItems(Long sideId) {
return weChatItemMapper.findChatItems(sideId);
}
/** /**
* 更新该次选择的素材数 * 更新该次选择的素材数
* *
......
...@@ -7,10 +7,12 @@ import com.linkwechat.common.utils.file.FileUploadUtils; ...@@ -7,10 +7,12 @@ import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.file.FileUtils; import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.common.utils.img.ImageUtils; import com.linkwechat.common.utils.img.ImageUtils;
import com.linkwechat.common.utils.img.NetFileUtils; import com.linkwechat.common.utils.img.NetFileUtils;
import com.linkwechat.wecom.domain.WeCategory;
import com.linkwechat.wecom.domain.WePoster; import com.linkwechat.wecom.domain.WePoster;
import com.linkwechat.wecom.domain.WePosterFont; import com.linkwechat.wecom.domain.WePosterFont;
import com.linkwechat.wecom.domain.WePosterSubassembly; import com.linkwechat.wecom.domain.WePosterSubassembly;
import com.linkwechat.wecom.mapper.WePosterMapper; import com.linkwechat.wecom.mapper.WePosterMapper;
import com.linkwechat.wecom.service.IWeCategoryService;
import com.linkwechat.wecom.service.IWePosterFontService; import com.linkwechat.wecom.service.IWePosterFontService;
import com.linkwechat.wecom.service.IWePosterService; import com.linkwechat.wecom.service.IWePosterService;
import com.linkwechat.wecom.service.IWePosterSubassemblyService; import com.linkwechat.wecom.service.IWePosterSubassemblyService;
...@@ -54,6 +56,9 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -54,6 +56,9 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
@Resource @Resource
private ServerConfig serverConfig; private ServerConfig serverConfig;
@Resource
private IWeCategoryService weCategoryService;
/** /**
* 查询一条 * 查询一条
...@@ -86,8 +91,10 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -86,8 +91,10 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
}); });
} }
} }
} }
/*if(poster.getCategoryId() != null){
weCategoryService.findWeCategoryById(poster.getId());
}*/
return poster; return poster;
} }
......
...@@ -23,5 +23,20 @@ ...@@ -23,5 +23,20 @@
material_id=#{materialId} AND user_id=#{userId} material_id=#{materialId} AND user_id=#{userId}
</where> </where>
</select> </select>
<select id="findCollections" resultType="com.linkwechat.wecom.domain.vo.WeChatSideVo">
SELECT
wcc.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_collection wcc
LEFT JOIN we_material wm ON wcc.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wcc.user_id=#{userId}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -20,4 +20,20 @@ ...@@ -20,4 +20,20 @@
side_id=#{sideId} side_id=#{sideId}
</where> </where>
</delete> </delete>
<select id="findChatItems" resultType="com.linkwechat.wecom.domain.vo.WeChatSideVo">
SELECT
wci.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_item wci
LEFT JOIN we_material wm ON wci.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wci.side_id=#{sideId}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -34,4 +34,5 @@ ...@@ -34,4 +34,5 @@
`using`=0 `using`=0
</where> </where>
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!