Commit 38f49653 by sunruig

Merge branch 'front_end_dev' of https://gitee.com/LinkWeChat/link-wechat into front_end_dev

2 parents be84da7f 609f4724
Showing 65 changed files with 2013 additions and 317 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<p></p> <p></p>
<p align="center"> <p align="center">
<img alt="logo" src="https://images.gitee.com/uploads/images/2020/1203/143430_03205b51_1480777.png" width="120" style="margin-bottom: 0px;"> <img alt="logo" src="https://images.gitee.com/uploads/images/2021/0107/210318_e1f66c96_1480777.png" width="120" style="margin-bottom: 0px;">
</p> </p>
<h2 align="center">LinkWeChat —— 让每个企业都是私域流量营销专家</h2> <h2 align="center">LinkWeChat —— 让每个企业都是私域流量营销专家</h2>
......
...@@ -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);
}
} }
...@@ -30,9 +30,9 @@ public class WeChatSideController extends BaseController { ...@@ -30,9 +30,9 @@ public class WeChatSideController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('chat:side:list')") @PreAuthorize("@ss.hasPermi('chat:side:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list() { public TableDataInfo list(@RequestParam(value = "h5") String h5) {
startPage(); startPage();
List<WeChatSide> weChatSides = weChatSideService.chatSides(); List<WeChatSide> weChatSides = weChatSideService.chatSides(h5);
return getDataTable(weChatSides); return getDataTable(weChatSides);
} }
......
...@@ -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
......
...@@ -216,7 +216,7 @@ public class ElasticSearch { ...@@ -216,7 +216,7 @@ public class ElasticSearch {
*/ */
public void insertBatchAsync(String idxName, List<JSONObject> list, List<Consumer<List<JSONObject>>> consumers) { public void insertBatchAsync(String idxName, List<JSONObject> list, List<Consumer<List<JSONObject>>> consumers) {
BulkRequest request = new BulkRequest(); BulkRequest request = new BulkRequest();
list.forEach(item -> request.add(new IndexRequest(idxName, "_doc").id(item.getString("msgid")) list.parallelStream().forEach(item -> request.add(new IndexRequest(idxName, "_doc").id(item.getString("msgid"))
.source(item, XContentType.JSON))); .source(item, XContentType.JSON)));
try { try {
restHighLevelClient.bulkAsync(request, RequestOptions.DEFAULT, getActionListener(list, consumers)); restHighLevelClient.bulkAsync(request, RequestOptions.DEFAULT, getActionListener(list, consumers));
......
...@@ -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();
......
# 开发环境配置
ENV = 'development'
# 塬微管理系统/开发环境
VUE_APP_BASE_API = 'http://106.13.201.219'
# VUE_APP_BASE_API = 'http://3x2d6z.natappfree.cc'
# 开发环境IP
VUE_APP_BASE_URL = 'http://192.168.0.101'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 生产环境配置
ENV = 'production'
# 塬微管理系统/生产环境api
VUE_APP_BASE_API = 'http://106.13.201.219'
# 生产环境IP
VUE_APP_BASE_URL = 'http://106.13.201.219'
...@@ -7793,6 +7793,11 @@ ...@@ -7793,6 +7793,11 @@
"integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=", "integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=",
"dev": true "dev": true
}, },
"normalize.css": {
"version": "8.0.1",
"resolved": "https://registry.npm.taobao.org/normalize.css/download/normalize.css-8.0.1.tgz",
"integrity": "sha1-m5iiCHOLnMJjTKrLxC0THJdIe/M="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz", "resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz",
...@@ -9014,7 +9019,7 @@ ...@@ -9014,7 +9019,7 @@
}, },
"pretty-error": { "pretty-error": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npm.taobao.org/pretty-error/download/pretty-error-2.1.2.tgz?cache=0&sync_timestamp=1609589450140&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpretty-error%2Fdownload%2Fpretty-error-2.1.2.tgz", "resolved": "https://registry.npm.taobao.org/pretty-error/download/pretty-error-2.1.2.tgz",
"integrity": "sha1-von4LYGxyG7I/fvDhQRYgnJ/k7Y=", "integrity": "sha1-von4LYGxyG7I/fvDhQRYgnJ/k7Y=",
"dev": true, "dev": true,
"requires": { "requires": {
...@@ -10876,7 +10881,7 @@ ...@@ -10876,7 +10881,7 @@
}, },
"uglify-js": { "uglify-js": {
"version": "3.4.10", "version": "3.4.10",
"resolved": "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.4.10.tgz?cache=0&sync_timestamp=1609477662986&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuglify-js%2Fdownload%2Fuglify-js-3.4.10.tgz", "resolved": "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.4.10.tgz?cache=0&sync_timestamp=1609159962920&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuglify-js%2Fdownload%2Fuglify-js-3.4.10.tgz",
"integrity": "sha1-mtlWPY6zrN+404WX0q8dgV9qdV8=", "integrity": "sha1-mtlWPY6zrN+404WX0q8dgV9qdV8=",
"dev": true, "dev": true,
"requires": { "requires": {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"normalize.css": "^8.0.1",
"vant": "^2.12.2", "vant": "^2.12.2",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
</head> <title><%= htmlWebpackPlugin.options.title %></title>
<body> <script src="./jweixin-1.2.0.js"></script>
<noscript> </head>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> <body>
<div id="app"></div> <noscript>
<!-- built files will be auto injected --> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
</body> Please enable it to continue.</strong>
</html> </noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
\ No newline at end of file \ No newline at end of file
<script> <script>
import { getAgentTicket, getAppTicket } from '@/api/common'
export default { export default {
name: 'App', name: 'App',
data() { data() {
...@@ -30,11 +31,7 @@ export default { ...@@ -30,11 +31,7 @@ export default {
</script> </script>
<template> <template>
<div id="app"> <div id="app">
<div id="nav"> <router-view class="page" />
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view />
</div> </div>
</template> </template>
...@@ -43,20 +40,6 @@ export default { ...@@ -43,20 +40,6 @@ export default {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50; color: #2c3e50;
} }
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style> </style>
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/chat'
/**
* 侧边栏列表
* @param {*} params
*/
export function getTypeList(params) {
return request({
url: service + '/side/list',
params: {
h5: 1,
},
})
}
/**
* 素材列表
* @param {*} sideId
*/
export function getMaterialList(sideId) {
return request({
url: service + '/item/list',
params: {
sideId,
},
})
}
/**
* 收藏列表(h5我的)
* @param {*} userId
*/
export function getCollectionList(userId) {
return request({
url: service + '/collection/list',
params: {
userId,
},
})
}
/**
* 添加收藏
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function addCollection(data) {
return request({
url: service + '/collection/addCollection',
method: 'post',
data,
})
}
/**
* 侧边栏抓取素材
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function cancleCollection(data) {
return request({
url: service + '/collection/cancleCollection',
method: 'put',
data,
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/ticket'
/**
* 获取应用的jsapi_ticket
* @param {*} url 页面url
*/
export function getAgentTicket(url) {
return request({
url: service + '/getAgentTicket',
params: {
url,
},
})
}
/**
* 获取企业的jsapi_ticket
* @param {*} url 页面url
*/
export function getAppTicket(url) {
return request({
url: service + '/getAppTicket',
params: {
url,
},
})
}
/**
* 收藏列表(h5我的)
* @param {*} userId
*/
export function getCollectionList(userId) {
return request({
url: service + '/collection/list',
params: {
userId,
},
})
}
/**
* 添加收藏
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function addCollection(data) {
return request({
url: service + '/collection/addCollection',
method: 'post',
data,
})
}
/**
* 侧边栏抓取素材
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function cancleCollection(data) {
return request({
url: service + '/collection/cancleCollection',
method: 'put',
data,
})
}
...@@ -13,10 +13,13 @@ const config = { ...@@ -13,10 +13,13 @@ const config = {
* @description api请求基础路径 * @description api请求基础路径
*/ */
// 测试服 // 测试服
domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.32:8888' : 'http://192.168.1.26:8888', // domain:
process.env.NODE_ENV === 'development'
? 'http://192.168.1.32:8888'
: 'http://192.168.1.26:8888', //
// 正式服 // 正式服
// domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.35:8118' : 'https://gateway.visualinsur.cn:8888', // // domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.35:8118' : 'https://gateway.visualinsur.cn:8888', //
/** /**
* @description 默认打开的首页的路由name值,默认为home * @description 默认打开的首页的路由name值,默认为home
*/ */
...@@ -36,6 +39,7 @@ const config = { ...@@ -36,6 +39,7 @@ const config = {
} }
config.services = { config.services = {
wecom: '/wecom',
} }
export default config
\ No newline at end of file \ No newline at end of file
export default config
import wx from '@/utils/jweixin-1.2.0.js'
import Vue from 'vue' import Vue from 'vue'
import config from '@/config'
window.CONFIG = config
import 'normalize.css/normalize.css'
import Vant from 'vant' import Vant from 'vant'
import 'vant/lib/index.css' import 'vant/lib/index.css'
Vue.use(Vant) Vue.use(Vant)
import '@/styles/index.less' // global css
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
window.wx = wx
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
......
import Vue from "vue"; import Vue from 'vue'
import VueRouter from "vue-router"; import VueRouter from 'vue-router'
import Home from "../views/Home.vue"; import Home from '../views/Home.vue'
Vue.use(VueRouter); Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: "/", path: '/',
name: "Home", name: 'Home',
component: Home component: Home,
meta: {
title: '首页',
},
}, },
{ {
path: "/about", path: '/chat',
name: "About", name: 'chat',
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => component: () => import(/* webpackChunkName: "about" */ '../views/chat'),
import(/* webpackChunkName: "about" */ "../views/About.vue") meta: {
} title: 'chat',
]; },
},
]
const router = new VueRouter({ const router = new VueRouter({
routes routes,
}); })
export default router; export default router
...@@ -33,9 +33,9 @@ td { ...@@ -33,9 +33,9 @@ td {
padding: 0; padding: 0;
} }
body,input, select, textarea /* for ie */ { body,input, select, textarea /* for ie */ {
font: 14px Microsoft YaHei, "宋体", arial, -apple-system, "PingFang SC", font: 14px Microsoft YaHei, '宋体', arial, -apple-system, 'PingFang SC',
"Helvetica Neue", Helvetica, "DejaVu Sans", "Lucida Grande", Tahoma, 'Helvetica Neue', Helvetica, 'DejaVu Sans', 'Lucida Grande', Tahoma,
"Hiragino Sans GB", STHeiti, SimSun, sans-serif; 'Hiragino Sans GB', STHeiti, SimSun, sans-serif;
line-height: 1.15; line-height: 1.15;
color: #333; /*touch-action: none*/ color: #333; /*touch-action: none*/
} /** 设置默认字体 **/ } /** 设置默认字体 **/
...@@ -119,18 +119,18 @@ a { ...@@ -119,18 +119,18 @@ a {
} }
/*click outline for firefox*/ /*click outline for firefox*/
button::-moz-focus-inner, button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner, input[type='reset']::-moz-focus-inner,
input[type="button"]::-moz-focus-inner, input[type='button']::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner, input[type='submit']::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner { input[type='file'] > input[type='button']::-moz-focus-inner {
border: none; border: none;
} }
/*click outline for IE and other browser*/ /*click outline for IE and other browser*/
button:focus, button:focus,
input[type="reset"]:focus, input[type='reset']:focus,
input[type="button"]:focus, input[type='button']:focus,
input[type="submit"]:focus, input[type='submit']:focus,
input[type="file"] > input[type="button"]:focus { input[type='file'] > input[type='button']:focus {
outline: none; outline: none;
} }
...@@ -203,6 +203,23 @@ textarea:-ms-input-placeholder { ...@@ -203,6 +203,23 @@ textarea:-ms-input-placeholder {
float: right; float: right;
position: relative; position: relative;
} }
.flex {
display: flex;
}
.fxbw {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
ais {
align-items: stretch;
}
.aic {
align-items: center;
}
.al { .al {
text-align: left; text-align: left;
} }
...@@ -255,6 +272,17 @@ textarea:-ms-input-placeholder { ...@@ -255,6 +272,17 @@ textarea:-ms-input-placeholder {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.line2-toe {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
display: -webkit-box;
white-space: pre-wrap;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
/*close*/ /*close*/
.close { .close {
position: relative; position: relative;
...@@ -278,3 +306,99 @@ textarea:-ms-input-placeholder { ...@@ -278,3 +306,99 @@ textarea:-ms-input-placeholder {
.cp { .cp {
cursor: pointer; cursor: pointer;
} }
.pt5 {
padding-top: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.pt10 {
padding-top: 10px;
}
.pt15 {
padding-top: 15px;
}
.pt20 {
padding-top: 20px;
}
.pr5 {
padding-right: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.pl5 {
padding-left: 5px;
}
.mt5 {
margin-top: 5px;
}
.mr5 {
margin-right: 5px;
}
.mb5 {
margin-bottom: 5px;
}
.mb8 {
margin-bottom: 8px;
}
.ml5 {
margin-left: 5px;
}
.mt10 {
margin-top: 10px;
}
.mr10 {
margin-right: 10px;
}
.mb10 {
margin-bottom: 10px;
}
.ml10 {
margin-left: 10px;
}
.mt15 {
margin-top: 15px;
}
.mr15 {
margin-right: 15px;
}
.mb15 {
margin-bottom: 15px;
}
.ml15 {
margin-left: 15px;
}
.mt20 {
margin-top: 20px;
}
.mr20 {
margin-right: 20px;
}
.mb20 {
margin-bottom: 20px;
}
.ml20 {
margin-left: 20px;
}
@import './common.css';
@import './transition.less';
\ No newline at end of file \ No newline at end of file
import axios from axios import axios from 'axios'
import config from "@/config"
function createAxios(baseUrl) { function createAxios(baseURL) {
const instance = axios.create({ const instance = axios.create({
baseUrl, baseURL,
headers: { headers: {
Auth_token: "" Auth_token: '',
}, },
timeout: 3000, timeout: 3000,
}) })
// 请求拦截 // 请求拦截
instance.interceptors.request.use(config => { instance.interceptors.request.use(
// console.log('request config: ' + JSON.stringify(config)) (config) => {
return config // console.log('request config: ' + JSON.stringify(config))
}, error => { return config
return Promise.reject(error) },
}) (error) => {
// 响应拦截 return Promise.reject(error)
instance.interceptors.response.use(res => {
// console.log('res: ' + res)
const { data, status } = res
// code 0:成功,-1/其它:错误
if (status === 200 && data.code === 0) {
return JSON.stringify(data.result) ? data.result : data.data
} else if (data.code === 201) {
// Message.error({
// content: `产品已存在`,
// duration: 3
// })
} else {
addErrorLog(res)
}
if (process.env.NODE_ENV === 'development') {
return Promise.reject(res) // 这样控制台会显示报错日志
} else {
return new Promise(() => { }) // 中断promise
} }
}, error => { )
if (error.response) { // 响应拦截
addErrorLog(error.response) instance.interceptors.response.use(
} else { (res) => {
// Message.error({ // console.log('res: ' + res)
// content: `服务器未启动或连接超时`, const { data, status } = res
// duration: 3 // code 0:成功,-1/其它:错误
// }) if (status === 200 && data.code === 0) {
console.error("服务器未启动或连接超时") return JSON.stringify(data.result) ? data.result : data.data
} else if (data.code === 201) {
// Message.error({
// content: `产品已存在`,
// duration: 3
// })
} else {
addErrorLog(res)
}
if (process.env.NODE_ENV === 'development') {
return Promise.reject(res) // 这样控制台会显示报错日志
} else {
return new Promise(() => {}) // 中断promise
}
},
(error) => {
if (error.response) {
addErrorLog(error.response)
} else {
// Message.error({
// content: `服务器未启动或连接超时`,
// duration: 3
// })
console.error('服务器未启动或连接超时')
}
return Promise.reject(error)
} }
return Promise.reject(error) )
})
// 错误日志 // 错误日志
const addErrorLog = errorInfo => { const addErrorLog = (errorInfo) => {
const { data, statusText, status, request: { responseText, responseURL } } = errorInfo const {
data,
statusText,
status,
request: { responseText, responseURL },
} = errorInfo
// let info = { // let info = {
// type: 'ajax', // type: 'ajax',
// code: status, // code: status,
...@@ -59,8 +69,8 @@ function createAxios(baseUrl) { ...@@ -59,8 +69,8 @@ function createAxios(baseUrl) {
// } // }
// if (!responseURL.includes('save_error_logger')) store.dispatch('addErrorLog', info) // if (!responseURL.includes('save_error_logger')) store.dispatch('addErrorLog', info)
process.env.NODE_ENV === 'development' process.env.NODE_ENV === 'development'
? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`,) ? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`)
: console.error(`${JSON.parse(responseText).message}`,) : console.error(`${JSON.parse(responseText).message}`)
} }
return instance return instance
...@@ -68,4 +78,4 @@ function createAxios(baseUrl) { ...@@ -68,4 +78,4 @@ function createAxios(baseUrl) {
// const httpRequest = createAxios() // const httpRequest = createAxios()
export default createAxios(config.domain)
\ No newline at end of file \ No newline at end of file
export default createAxios(process.env.VUE_APP_BASE_API)
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<template> <template>
<div class="home"> <div class="home">
<img alt="Vue logo" src="../assets/logo.png" /> <div class="logo ac">linkWeChat</div>
<HelloWorld msg="Welcome to Your Vue.js App" /> <router-link
class="router-link"
v-for="(item, index) in $router.options.routes"
:to="item.path"
:key="index"
>{{ item.meta.title }}</router-link
>
</div> </div>
</template> </template>
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
export default { export default {
name: "Home", name: 'Home',
components: { components: {},
HelloWorld }
}
};
</script> </script>
<style lang="less" scoped>
.logo {
margin: 0 auto;
width: 150px;
height: 50px;
line-height: 50px;
border: 2px solid #6582ff;
border-radius: 50px;
}
.router-link {
display: block;
text-align: center;
line-height: 40px;
}
</style>
<script>
import {
getMaterialList,
getCollectionList,
addCollection,
cancleCollection,
} from '@/api/chat'
export default {
components: {},
props: {
sideId: {
type: String,
default: '0',
},
userId: {
type: String,
default: '',
},
},
data() {
return {
list: [{}],
loading: false,
finished: false,
collectList: [],
}
},
watch: {},
computed: {},
created() {},
mounted() {},
methods: {
getList() {
this.loading = true
;(this.userId ? getCollectionList : getMaterialList)()
.then(({ rows, total }) => {
this.list = rows
this.loading = false
this.finished = true
})
.catch(() => {
this.loading = false
this.finished = true
})
},
getCollectionList() {
getCollectionList().then(({ rows, total }) => {
this.collectList = rows.map((d) => d.id)
})
},
isCollected(id) {
return this.collectList.includes(id)
},
send() {},
collect(materialId) {
;(this.isCollected(materialId) ? cancleCollection : addCollection)({
userId,
materialId,
}).then(({ data }) => {
this.isCollected.splice(this.isCollected.indexOf(materialId), 1)
})
},
},
}
</script>
<template>
<div>
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="getList"
>
<div v-for="(item, index) in list" class="list" :key="index">
<div class="title">dsdsds</div>
<div class="info">
素材库
<span>2020/2/4</span>
<div class="fr flex">
<div class="action" @click="send">发送</div>
<div class="action" @click="collect(item.id)">
{{ isCollected(item.id) ? '已' : '' }}收藏
</div>
</div>
</div>
</div>
</van-list>
</div>
</template>
<style lang="less" scoped></style>
<script>
import { getTypeList } from '@/api/chat'
import List from './List'
export default {
components: { List },
props: {},
data() {
return {
keywords: '',
active: 2,
list: [],
loading: false,
finished: false,
show: false,
}
},
watch: {},
computed: {},
created() {
this.getList()
},
mounted() {},
methods: {
getList() {
getTypeList().then(({ rows, total }) => {
this.list = rows
})
},
search() {},
add() {},
},
}
</script>
<template>
<div>
<van-search
v-model="keywords"
show-action
placeholder="请输入搜索关键词"
@search="search"
>
<!-- <template #action>
<van-icon name="plus" @click="add" />
</template> -->
</van-search>
<van-tabs v-model="active">
<van-tab title="标签 1">
<List></List>
</van-tab>
<van-tab title="标签 2"><List></List></van-tab>
</van-tabs>
<!-- <van-dialog
v-model="show"
:title="`添加&quot;我的&quot;${radio}`"
show-cancel-button
>
<van-form @submit="onSubmit">
<van-field name="radio" label="添加类型">
<template #input>
<van-radio-group v-model="radio" direction="horizontal">
<van-radio name="1">文本</van-radio>
<van-radio name="2">分类</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field
v-model="username"
name="分类名称"
label="分类名称"
placeholder="分类名称"
:rules="[{ required: true, message: '请填写分类名称' }]"
/>
<template>
<van-field
readonly
clickable
name="picker"
:value="value"
label="文本分类"
placeholder="点击选择文本分类"
@click="showPicker = true"
/>
<van-popup v-model="showPicker" position="bottom">
<van-picker
show-toolbar
:columns="columns"
@confirm="onConfirm"
@cancel="showPicker = false"
/>
</van-popup>
<van-field
v-model="message"
rows="5"
autosize
label="文本信息"
type="textarea"
maxlength="150"
placeholder="请输入文本信息"
show-word-limit
/>
</template>
</van-form>
</van-dialog> -->
</div>
</template>
<style lang="less" scoped>
.page {
height: 100vh;
background: #f6f6f6;
}
/deep/ .list {
padding: 10px;
background: #fff;
border-top: 1px solid #eee;
.info {
padding-top: 10px;
}
.action {
padding-left: 5px;
}
}
</style>
...@@ -76,10 +76,10 @@ public class RyTask { ...@@ -76,10 +76,10 @@ public class RyTask {
"", redisCache); "", redisCache);
if (CollectionUtil.isNotEmpty(chatDataList)){ if (CollectionUtil.isNotEmpty(chatDataList)){
try { try {
List<JSONObject> elasticSearchEntities = weChatContactMappingService.saveWeChatContactMapping(chatDataList);
List<Consumer<List<JSONObject>>> consumerList = Lists.newArrayList(); List<Consumer<List<JSONObject>>> consumerList = Lists.newArrayList();
consumerList.add(weChatContactMappingService::saveWeChatContactMapping);
consumerList.add(weSensitiveService::hitSensitive); consumerList.add(weSensitiveService::hitSensitive);
elasticSearch.insertBatchAsync(WeConstans.WECOM_FINANCE_INDEX, chatDataList, consumerList); elasticSearch.insertBatchAsync(WeConstans.WECOM_FINANCE_INDEX, elasticSearchEntities, consumerList);
} catch (Exception e) { } catch (Exception e) {
log.error("消息处理异常:ex:{}", e); log.error("消息处理异常:ex:{}", e);
e.printStackTrace(); e.printStackTrace();
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
"js-beautify": "1.10.2", "js-beautify": "1.10.2",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",
"jsencrypt": "3.0.0-rc.1", "jsencrypt": "3.0.0-rc.1",
"moment": "^2.29.1",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"path-to-regexp": "2.4.0", "path-to-regexp": "2.4.0",
......
...@@ -46,7 +46,7 @@ export function update(data) { ...@@ -46,7 +46,7 @@ export function update(data) {
export function getMaterial(data) { export function getMaterial(data) {
return request({ return request({
url: service + '/item', url: service + '/item',
method: 'POST', method: 'put',
data, data,
}) })
} }
import request from '@/utils/request'
const getTree=(params)=>{
return request({
url:'/chat/mapping/list',
method: 'get',
params,
})
}
const chatList=(params)=>{
return request({
url:'/wecom/finance/getChatContactList',
method: 'get',
params,
})
}
const listByCustomer=(params)=>{
return request({
url:'/chat/mapping/listByCustomer',
method: 'get',
params,
})
}
const getChatAllList=(params)=>{
return request({
url:'/wecom/finance/getChatAllList',
method: 'get',
params,
})
}
//
export const content={
getTree,
chatList,
listByCustomer,
getChatAllList
}
\ No newline at end of file \ No newline at end of file
<script>
import { getList } from '@/api/customer/tag'
import list from './list'
export default {
components: { list },
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false,
},
// title: {
// type: String,
// default: '',
// },
// 素材类型 0:'文本', 1:'图片'
type: {
type: String,
default: '0',
},
// 显示哪些素材类型标签
showArr: {
type: Array,
default: () => [0, 1],
},
},
data() {
return {
text: {},
image: {},
file: {},
}
},
watch: {},
computed: {
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
},
},
Ptype: {
get() {
return this.type
},
set(val) {
this.$emit('update:type', val)
},
},
},
created() {},
mounted() {},
methods: {
submit() {
this.Pvisible = false
this.$emit('success', this.text, this.image, this.file)
},
changeText(data) {
this.text = data
},
changeImage(data) {
this.image = data
},
},
}
</script>
<template>
<el-dialog title="选择素材" :visible.sync="Pvisible" width="650px">
<div>
<el-tabs v-model="Ptype">
<el-tab-pane name="0" v-if="showArr.includes(0)">
<span slot="label"> <i class="el-icon-date"></i> 文本 </span>
<list type="4" @change="changeText"> </list>
</el-tab-pane>
<el-tab-pane name="1" v-if="showArr.includes(1)">
<span slot="label"> <i class="el-icon-date"></i> 图片 </span>
<list type="0" @change="changeImage"> </list>
</el-tab-pane>
<!-- <el-tab-pane name="2">
<span slot="label"> <i class="el-icon-date"></i> 文件 </span>
<list>
<el-table :data="list" style="width: 100%">
<el-table-column width="50">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row.id"></el-radio>
</template>
</el-table-column>
<el-table-column prop="content"> </el-table-column>
</el-table>
</list>
</el-tab-pane> -->
</el-tabs>
</div>
<div slot="footer">
<el-button @click="Pvisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
</template>
<style lang="scss" scoped>
.user-list {
.el-row {
line-height: 26px;
}
}
.mr30 {
margin-right: 30px;
}
</style>
<script>
import { getTree, getList } from '@/api/material'
export default {
components: {},
props: {
type: {
type: String,
default: '4',
},
multiple: {
type: Boolean,
default: false,
},
selected: {
type: Array,
default: () => [],
},
},
data() {
return {
loading: true, // 遮罩层
// 查询条件
query: {
pageNum: 1,
pageSize: 10,
categoryId: '',
search: '',
mediaType: '4',
},
list: [], // 列表
total: 0, // 总条数
treeData: [], // 树
// 树props
treeProps: {
children: 'children',
label: 'name',
},
// 分组props
groupProps: {
// expandTrigger: 'hover',
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id',
emitPath: false,
},
radio: '',
// 树props
treeProps: {
children: 'children',
label: 'name',
},
}
},
watch: {
radio(val) {
this.$emit('change', val)
},
},
computed: {},
created() {
this.query.mediaType = this.type
this.getTree()
this.getList()
},
mounted() {},
methods: {
// 获取类目树
getTree() {
getTree(this.type).then(({ data }) => {
this.treeData = data
})
},
// 获取素材列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.$emit('listChange', this.list)
})
.catch(() => {
this.loading = false
})
},
// 节点单击事件
handleNodeClick(data) {
this.query.categoryId = data.id
this.getList(1)
},
// 多选框选中数据
handleSelectionChange(selection) {
this.$emit('update:selected', selection)
},
},
}
</script>
<template>
<div>
<template v-if="false">
<el-form ref="form" :model="query" label-width="80px">
<el-form-item label="选择分组">
<el-cascader
v-model="query.categoryId"
:options="treeData"
:props="groupProps"
></el-cascader>
<el-input
v-model="query.search"
class="ml10 mr10"
style="width: 150px;"
@keydown.enter="getList(1)"
></el-input>
<el-button
v-hasPermi="['contacts:organization:query']"
icon="el-icon-search"
circle
@click="getList(1)"
></el-button>
<el-pagination
class="fr"
@current-change="getList"
:current-page="query.pageNum"
:page-size="query.pageSize"
layout="prev, pager, next"
:total="total"
></el-pagination>
</el-form-item>
</el-form>
<!-- 文本 -->
<el-table
v-if="type == 4"
v-loading="loading"
:data="list"
:show-header="false"
>
<el-table-column width="30">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row">'</el-radio>
</template>
</el-table-column>
<el-table-column prop="content"> </el-table-column>
</el-table>
<!-- 图片 -->
<el-radio-group
v-if="type == 0"
v-loading="loading"
class="img-wrap"
v-model="radio"
>
<el-radio v-for="(item, index) in list" :label="item" :key="index">
<img class="img-li" :src="item.materialUrl" alt />
<div class="ac mt5">{{ item.materialName }}</div>
</el-radio>
</el-radio-group>
</template>
<el-row :gutter="10">
<el-col :span="6">
<el-tree
ref="tree"
:data="treeData"
:props="treeProps"
:expand-on-click-node="false"
highlight-current
default-expand-all
@node-click="handleNodeClick"
>
</el-tree>
</el-col>
<el-col :span="18">
<div class="fxbw">
素材库更新本分类素材后,自动同步到聊天工具栏
<el-pagination
class="fr"
@current-change="getList"
:current-page="query.pageNum"
:page-size="query.pageSize"
layout="prev, pager, next"
:total="total"
></el-pagination>
</div>
<el-table
v-if="[3, 4].includes(+type)"
:data="list"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column prop="content" label="文本内容"></el-table-column>
<el-table-column prop="createTime" label="时间"></el-table-column>
</el-table>
<el-row v-else :gutter="20">
<el-col
:span="6"
style="margin-bottom: 24px;min-width: 220px;"
v-for="(item, index) in list"
:key="index"
>
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image :src="item.materialUrl" fit="contain"></el-image>
</div>
<div style="padding: 14px;">
<el-checkbox v-model="ids" :label="item.id">{{
item.materialName
}}</el-checkbox>
</div>
</el-card>
</el-col>
</el-row>
</el-col>
</el-row>
</div>
</template>
<style lang="scss" scoped>
// .img-wrap {
// /deep/.el-radio__input {
// position: absolute;
// left: 50%;
// top: 50%;
// transform: translate(-50%, -50%);
// }
// }
.img-li {
width: 160px;
height: 160px;
border-radius: 8px;
border: 1px solid #e6ebf5;
}
.img-wrap {
position: relative;
height: 0;
padding: 70% 0 0 0;
border-bottom: 1px solid #e6ebf5;
.el-image {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
}
</style>
...@@ -52,6 +52,19 @@ export function resetForm(refName) { ...@@ -52,6 +52,19 @@ export function resetForm(refName) {
} }
} }
//年月日格式
export function yearMouthDay(data) {
var time = new Date(data);
var year = time.getFullYear();
var month = time.getMonth()+1;
var date = time.getDate();
console.log(year+'-'+add0(month)+'-'+add0(date))
return year+'-'+add0(month)+'-'+add0(date)
}
function add0(m){return m<10?'0'+m:m }
// 添加日期范围 // 添加日期范围
export function addDateRange(params, dateRange) { export function addDateRange(params, dateRange) {
var search = params; var search = params;
......
<script> <script>
import { getList, update, getMaterial } from '@/api/appTool/chatBar' import { getList, update, getMaterial } from '@/api/appTool/chatBar'
import SelectMaterialMult from '@/components/SelectMaterialMult/list'
export default { export default {
components: {}, components: { SelectMaterialMult },
props: {}, props: {},
data() { data() {
return { return {
...@@ -17,6 +18,14 @@ export default { ...@@ -17,6 +18,14 @@ export default {
4: '文本', 4: '文本',
5: '海报', 5: '海报',
}), }),
metarialParams: {
sideId: '',
materialIds: [], // '素材id列表',
mediaType: '', // '素材类型 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报',
checkAll: '1', // '是否全选 0 全选 1 非全选',
},
selectedMaterial: [],
} }
}, },
watch: {}, watch: {},
...@@ -37,21 +46,33 @@ export default { ...@@ -37,21 +46,33 @@ export default {
this.loading = false this.loading = false
}) })
}, },
getMaterial(data) { openDialog(data) {
this.dialogVisible = true
this.metarialParams.sideId = data.sideId
this.metarialParams.mediaType = data.mediaType
},
// 抓取素材
getMaterial() {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
}) })
// this.loading = true this.metarialParams.materialIds = this.selectedMaterial.map((d) => d.id)
getMaterial(data) if (metarialParams.checkAll == 0) {
this.metarialParams.materialIds = []
}
getMaterial(this.metarialParams)
.then(({ rows, total }) => { .then(({ rows, total }) => {
this.list = rows // this.list = rows
this.loading = false loading.close()
this.msgSuccess('操作成功')
this.dialogVisible = false
this.getList()
}) })
.catch(() => { .catch(() => {
this.loading = false loading.close()
}) })
}, },
update(data) { update(data) {
...@@ -113,7 +134,7 @@ export default { ...@@ -113,7 +134,7 @@ export default {
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" prop="operId"> <el-table-column label="操作" align="center" prop="operId">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleView(scope.row, scope.index)" <el-button type="text" @click="openDialog(scope.row)"
>抓取素材</el-button >抓取素材</el-button
> >
</template> </template>
...@@ -121,8 +142,7 @@ export default { ...@@ -121,8 +142,7 @@ export default {
</el-table> </el-table>
</el-card> </el-card>
<el-card class="mt20" shadow="never" header="红包工具栏"> <!-- <el-card class="mt20" shadow="never" header="红包工具栏">
<!-- <div slot="header"></div> -->
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10"> <el-col :span="10">
<div> <div>
...@@ -168,52 +188,25 @@ export default { ...@@ -168,52 +188,25 @@ export default {
> >
<div class="el-image logo" style> <div class="el-image logo" style>
<div class="el-image__error">加载失败</div> <div class="el-image__error">加载失败</div>
<!---->
</div> </div>
<el-image class="logo" :src="url" :fit="fit"></el-image> <el-image class="logo" :src="url" fit="fit"></el-image>
<div class="company-name">脑白金</div> <div class="company-name">脑白金</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-card> </el-card> -->
<el-dialog <el-dialog
title="抓取文本类型素材库" :title="`抓取${mediaType[metarialParams.mediaType]}类型素材库`"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:before-close="dialogBeforeClose"
> >
<el-row :gutter="10"> <SelectMaterialMult
<el-col :span="6"> :selected.sync="selectedMaterial"
<el-tree :data="d" :props="d" @node-click="d"></el-tree> :type="metarialParams.mediaType"
</el-col> ></SelectMaterialMult>
<el-col :span="18">
<div class="fxbw">
素材库更新本分类素材后,自动同步到聊天工具栏
<div class="filter-right">
<i class="el-icon-arrow-left"></i> 1/1
<i class="el-icon-arrow-right"></i>
</div>
</div>
<el-table :data="data" style="width: 100%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column
prop="prop"
label="文本内容"
width="width"
></el-table-column>
<el-table-column
prop="prop"
label="时间"
width="width"
></el-table-column>
</el-table>
</el-col>
</el-row>
<div slot="footer"> <div slot="footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="dialogVisible = false" <el-button type="primary" @click="getMaterial">确 定</el-button>
>确 定</el-button
>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
......
<template>
<div class="takecontent">
<ul>
<li v-for="(item,index) in allChat" :key="index">
<div :style="{'color':item.action=='send'?'#199ed8':'#999'}">{{item.from}} <span
:style="{'color':item.action=='send'?'#199ed8':'#999'}">{{parseTime(item.msgtime)}}</span></div>
<div v-if="item.msgtype=='text'" class="msgtypetext">
{{item.text.content}}
</div>
<div v-else-if="item.msgtype=='image'" class="msgtypeimg">
<img :src="item.image.attachment">
</div>
<div v-else-if="item.msgtype=='file'" class="msgtypefile" @click="down(item.file)">
{{item.file.filename}}
</div>
<!-- <div v-else-if="item.msgtype=='link'&&item.text" class="msgtypelink">
{{item.text.content}}
</div>-->
<div v-else-if="item.msgtype=='voice'" class="msgtypevoice">
<i class="el-icon-video-play" @click="play(item,'voice')"></i>
</div>
<div v-else-if="item.msgtype=='video'" class="msgtypevideo">
<i class="el-icon-video-play" @click="play(item,'video')"></i>
</div>
<div v-else-if="item.msgtype=='location'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">{{item.location.address}}</div>
</div>
<div v-else-if="item.msgtype=='weapp'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">小程序</div>
</div>
<div v-else-if="item.msgtype=='card'" class="msgtypecard ">
<div class="card_name">{{item.card.corpname}}</div>
<div class="card_foot">个人名片</div>
</div>
</li>
</ul>
<el-dialog :visible.sync="dia" :show-close='false'>
<p>播放</p>
</el-dialog>
</div>
</template>
<script>
import {
parseTime,
yearMouthDay,
} from '@/utils/common.js'
export default {
props: {
allChat: {
type: Array,
defluat: () => []
}
},
data() {
return {
dia: false
}
},
methods: {
play() {
this.dia = true
},
down(e){
//下载文件
}
}
}
</script>
<style lang="scss" scoped>
* {
padding: 0;
margin: 0;
}
.takecontent {
text-align: left;
width: 100%;
height: 600px;
overflow-y: scroll;
::-webkit-scrollbar {
display: none;
}
ul li {
padding: 8px;
}
.msgtypetext {
padding: 10px 0;
}
.msgtypevoice {
margin: 10px;
}
.msgtypefile {
margin: 10px;
width: 200px;
height: 40px;
line-height: 40px;
cursor: pointer;
color: #199ed8;
text-indent: 10px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 1px 4px 0 rgba(0, 0, 0, 0.19);
}
.card_name{ line-height: 80px;text-indent: 10px;}
.msgtypevideo {
margin: 10px;
font-size: 40px;
cursor: pointer;
color: #199ed8;
border-radius: 8px;
}
.msgtypeimg {
width: 100px;
height: 80px;
margin: 10px;
}
.msgtypecard {
width: 300px;
height: 140px;
margin: 10px;
border-radius: 8px;
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
position: relative;
.card_foot {
position: absolute;
height: 20px;
border-top: 1px solid #efefef;
text-align: left;
bottom: 15px;
padding: 10px;
color: #333;
font-weight: bold;
width: 100%;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length>=1">
<ul>
<li v-for="(item,index) in personList" :key="index" @click="liClick(item)">
<el-row style="padding:10px">
<el-col :span="4"> <img :src="item.finalChatContext.fromInfo.avatar"></el-col>
<el-col :span="20">
<p>{{item.roomInfo.groupName}} <span class="fr gray">{{parseTime(item.finalChatContext.msgtime)}}</span></p>
<p class="gray padt10" v-if="item.finalChatContext.text">{{item.finalChatContext.text.content}}</p>
</el-col>
</el-row>
</li>
</ul>
</div>
<div v-else></div>
</div>
</template>
<script>
import {parseTime} from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
},
},
data() {
return{
loadings:true
}
},
methods:{
liClick(e){
this.$emit('chatFn',e)
}
}
}
</script>
<style lang="scss" scoped>
*{ padding: 0;
margin: 0;}
.list {
overflow-y:scroll;
height: 652px;
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner{margin-top: 20px;}
.fr{float:right;}
.gray{color: #999;}
.padt10{padding-top: 10px;}
ul li {
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p{white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;}
:hover{ background: #efefef;}
img {
width: 40px;
height: 40px;
float: left
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="takecontent">
<ul>
<li v-for="(item,index) in allChat" :key="index">
<div :style="{'color':item.action=='send'?'#199ed8':'#999'}">{{item.from}} <span
:style="{'color':item.action=='send'?'#199ed8':'#999'}">{{parseTime(item.msgtime)}}</span></div>
<div v-if="item.msgtype=='text'" class="msgtypetext">
{{item.text.content}}
</div>
<div v-else-if="item.msgtype=='image'" class="msgtypeimg">
<img :src="item.image.attachment">
</div>
<div v-else-if="item.msgtype=='file'" class="msgtypefile" @click="down(item.file)">
{{item.file.filename}}
</div>
<!-- <div v-else-if="item.msgtype=='link'&&item.text" class="msgtypelink">
{{item.text.content}}
</div>-->
<div v-else-if="item.msgtype=='voice'" class="msgtypevoice">
<i class="el-icon-video-play" @click="play(item,'voice')"></i>
</div>
<div v-else-if="item.msgtype=='video'" class="msgtypevideo">
<i class="el-icon-video-play" @click="play(item,'video')"></i>
</div>
<div v-else-if="item.msgtype=='location'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">{{item.location.address}}</div>
</div>
<div v-else-if="item.msgtype=='weapp'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">小程序</div>
</div>
<div v-else-if="item.msgtype=='card'" class="msgtypecard ">
<div class="card_name">{{item.card.corpname}}</div>
<div class="card_foot">个人名片</div>
</div>
</li>
</ul>
<el-dialog :visible.sync="dia" :show-close='false'>
<p>播放</p>
</el-dialog>
</div>
</template>
<script>
import {
parseTime,
yearMouthDay,
} from '@/utils/common.js'
export default {
props: {
allChat: {
type: Array,
defluat: () => []
}
},
data() {
return {
dia: false
}
},
methods: {
play() {
this.dia = true
},
down(e){
//下载文件
}
}
}
</script>
<style lang="scss" scoped>
* {
padding: 0;
margin: 0;
}
.takecontent {
text-align: left;
width: 100%;
height: 600px;
overflow-y: scroll;
::-webkit-scrollbar {
display: none;
}
ul li {
padding: 8px;
}
.msgtypetext {
padding: 10px 0;
}
.msgtypevoice {
margin: 10px;
}
.msgtypefile {
margin: 10px;
width: 200px;
height: 40px;
line-height: 40px;
cursor: pointer;
color: #199ed8;
text-indent: 10px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 1px 4px 0 rgba(0, 0, 0, 0.19);
}
.card_name{ line-height: 80px;text-indent: 10px;}
.msgtypevideo {
margin: 10px;
font-size: 40px;
cursor: pointer;
color: #199ed8;
border-radius: 8px;
}
.msgtypeimg {
width: 100px;
height: 80px;
margin: 10px;
}
.msgtypecard {
width: 300px;
height: 140px;
margin: 10px;
border-radius: 8px;
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
position: relative;
.card_foot {
position: absolute;
height: 20px;
border-top: 1px solid #efefef;
text-align: left;
bottom: 15px;
padding: 10px;
color: #333;
font-weight: bold;
width: 100%;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length>=1">
<ul>
<li v-for="(item,index) in personList" :key="index" @click="liClick(item)">
<el-row style="padding:10px">
<el-col :span="4"> <img :src="item.receiveWeCustomer.avatar"></el-col>
<el-col :span="20">
<p>{{item.receiveWeCustomer.name}} <span class="fr gray">{{parseTime(item.finalChatContext.msgtime)}}</span></p>
<p class="gray padt10" v-if="item.finalChatContext.text">{{item.finalChatContext.text.content}}</p>
</el-col>
</el-row>
</li>
</ul>
</div>
<div v-else></div>
</div>
</template>
<script>
import {parseTime} from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
},
},
data() {
return{
loadings:true
}
},
methods:{
liClick(e){
this.$emit('chatFn',e)
}
}
}
</script>
<style lang="scss" scoped>
*{ padding: 0;
margin: 0;}
.list {
overflow-y:scroll;
height: 708px;
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner{margin-top: 20px;}
.fr{float:right;}
.gray{color: #999;}
.padt10{padding-top: 10px;}
ul li {
padding: 10px;
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p{white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;}
:hover{ background: #efefef;}
img {
width: 40px;
height: 40px;
float: left
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="content"> <div class="content">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="根据员工检测" name="1"> <el-tab-pane label="员工检索" name="1">
<employee></employee> <employee></employee>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="根据用户检测" name="2"> <el-tab-pane label="客户检索" name="2" >
<user></user> <user v-if="activeName==2"></user>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="全局检测" name="3"> <el-tab-pane label="全局检索" name="3">
<role></role> <role v-if="activeName==3"></role>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
<script> <script>
...@@ -33,3 +32,6 @@ import role from './page/roleTest.vue' ...@@ -33,3 +32,6 @@ import role from './page/roleTest.vue'
} }
} }
</script> </script>
<style scoped>
*{margin: 0;padding: 0;}
</style>
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<el-form :inline="true" :model="form" class="demo-form-inline"> <el-form :inline="true" :model="form" class="demo-form-inline">
<el-row> <el-row>
<el-form-item label="员工名称"> <el-form-item label="员工名称">
<el-select v-model="form.Ename" placeholder="员工名称" style="width:300px"> <el-input v-model="form.Ename" placeholder="客户名称" style="width:300px"></el-input>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户名称"> <el-form-item label="客户名称">
<el-input v-model="form.Cname" placeholder="客户名称" style="width:300px"></el-input> <el-input v-model="form.Cname" placeholder="客户名称" style="width:300px"></el-input>
...@@ -15,14 +15,16 @@ ...@@ -15,14 +15,16 @@
<el-input v-model="form.Scontent" placeholder="查找内容" style="width:300px"></el-input> <el-input v-model="form.Scontent" placeholder="查找内容" style="width:300px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="时间范围"> <el-form-item label="时间范围">
<el-time-picker is-range v-model="form.Stime" range-separator="至" start-placeholder="开始时间"
end-placeholder="结束时间" placeholder="选择时间范围"> <el-date-picker v-model="form.Stime" type="datetimerange" format='yyyy-MM-dd'
</el-time-picker> range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
align="right">
</el-date-picker>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row>
<el-form-item> <el-form-item>
<el-button type="primary">查询</el-button> <el-button type="primary" @click="init">查询</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button>导出列表</el-button> <el-button>导出列表</el-button>
...@@ -31,36 +33,64 @@ ...@@ -31,36 +33,64 @@
</el-form> </el-form>
<div class="content"> <div class="content">
<el-table :data="fileData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}"> <el-table :data="fileData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发送者" width="200"> <el-table-column prop="date" label="发送者" width="300">
<template slot-scope="scope">
{{scope.row.from}}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label=" 内容"> <el-table-column prop="name" label=" 内容">
<template slot-scope="scope" v-if="scope.row.text">
{{scope.row.text.content}}
</template>
</el-table-column> </el-table-column>
<el-table-column label="消息状态" width="200">
<el-table-column label="消息状态" width="200"> <template slot="header">
<template slot="header" > {{floorRange}}
{{floorRange}} <el-select size="mini" v-model="floorRange" class="noborder" @change="chechName(floorRange)">
<el-select size="mini" v-model="floorRange" class="noborder" @change="chechName(floorRange)">
<el-option v-for="item in displayOptions" :key="item.value" :label="item.label" <el-option v-for="item in displayOptions" :key="item.value" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
<template slot-scope="scope">
<div class="pers">
<span v-if="scope.row.action==''">
</span>
<span v-else-if="scope.row.action=='send'">
<span class="green"></span>
已发送
</span>
<span v-else-if="scope.row.action=='recall'">
<span class="red"></span>
已撤回
</span>
<span v-else-if="scope.row.action=='switch'">
<span class="gay"></span>
企业日志
</span>
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="发送时间" width="200"> <el-table-column prop="address" label="发送时间" width="200">
<template slot-scope="scope" v-if="scope.row.text">
{{parseTime(scope.row.msgtime)}}
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination background class="pagination" layout="prev, pager, next" :total="total"
:page-size="20" @current-change="currentChange" :current-page="currentPage">
style="padding:10px" </el-pagination>
:pager-count="11"
layout="prev, pager, next"
:total="1000">
</el-pagination>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {
content
} from '@/api/content.js'
import {
yearMouthDay,
parseTime
} from '@/utils/common.js'
export default { export default {
data() { data() {
return { return {
...@@ -70,54 +100,125 @@ ...@@ -70,54 +100,125 @@
Scontent: '', Scontent: '',
Stime: '' Stime: ''
}, },
currentPage: 1,
total: 0,
ac:'',
fileData: [], fileData: [],
floorRange:'全部', floorRange: '全部',
displayOptions: [{ displayOptions: [{
value: "0", value: "",
label: "全部" label: "全部"
}, },
{ {
value: "1", value: "send",
label: "已发送" label: "已发送"
}, },
{ {
value: "2", value: "recall",
label: "已撤回" label: "已撤回"
}, },
{ {
value: "3", value: "switch",
label: "切回企业日志" label: "切回企业日志"
} }
] ]
} }
}, },
methods:{ mounted() {
chechName(e){ this.init()
if(e==0){ },
this.floorRange='全部' methods: {
currentChange(e) {
this.currentPage = e
this.init(true)
},
init(flag) {
if (!!!flag) {
this.currentPage = 1
}
let query = {
userName: this.form.Ename,
customerName: this.form.Cname,
keyWord: this.form.Scontent,
beginTime: this.form.Stime ? yearMouthDay(this.form.Stime[0]) : "",
endTime: this.form.Stime ? yearMouthDay(this.form.Stime[1]) : "",
pageNum: this.currentPage,
action:this.ac
} }
else if(e==1){ content.getChatAllList(query).then(res => {
this.floorRange='已发送' console.log(res)
}else if(e==2){ this.fileData = res.rows;
this.floorRange='已撤回' this.total = Number(res.total)
}else{ })
this.floorRange='切回企业日志' },
chechName(e) {
if (e == 0) {
this.floorRange = '全部'
this.ac=''
} else if (e == 1) {
this.floorRange = '已发送'
this.ac='send'
} else if (e == 2) {
this.floorRange = '已撤回'
this.ac='recall'
} else {
this.floorRange = '切回企业日志'
this.ac='switch'
} }
this.init()
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.demo-form-inline { .demo-form-inline {
background: #efefef; background: #f1f1f1;
padding: 18px 10px 0 10px; padding: 18px 10px 0 10px;
} }
.content { .content {
margin-top: 15px; margin-top: 15px;
padding: 10px; padding: 10px;
} }
.pers {
position: relative;
.green {
background: greenyellow;
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
top: 10px;
left: -8px;
}
.red {
background: red;
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
top: 10px;
left: -8px;
}
.gay {
background: gray;
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
top: 10px;
left: -8px;
}
}
.noborder { .noborder {
/deep/ .el-input--mini .el-input__inner{width: 2px;border:none} /deep/ .el-input--mini .el-input__inner {
width: 2px;
border: none
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -4,16 +4,16 @@ import MaPage from '@/views/material/components/MaPage' ...@@ -4,16 +4,16 @@ import MaPage from '@/views/material/components/MaPage'
export default { export default {
name: 'Image', name: 'Image',
components: { MaPage }, components: { MaPage },
data () { data() {
return { return {
srcList: [], srcList: [],
ids: [], // 选中数组 ids: [], // 选中数组
} }
}, },
watch: {}, watch: {},
created () { }, created() {},
methods: { methods: {
listChange (data) { listChange(data) {
this.srcList = data.map((item) => item.materialUrl) this.srcList = data.map((item) => item.materialUrl)
}, },
}, },
......
...@@ -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;
...@@ -13,10 +15,10 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> { ...@@ -13,10 +15,10 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
/** /**
* 查询侧边栏列表 * 查询侧边栏列表
* * @param h5 0 pc 1 h5
* @return {@link WeChatSide}s * @return {@link WeChatSide}s
*/ */
public List<WeChatSide> selectWeChatSides(); public List<WeChatSide> selectWeChatSides(@Param("h5") String h5);
/** /**
...@@ -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);
} }
...@@ -70,7 +70,7 @@ public interface IWeChatContactMappingService extends IService<WeChatContactMapp ...@@ -70,7 +70,7 @@ public interface IWeChatContactMappingService extends IService<WeChatContactMapp
* *
* @param query * @param query
*/ */
public List<ElasticSearchEntity> saveWeChatContactMapping(List<JSONObject> query); public List<JSONObject> saveWeChatContactMapping(List<JSONObject> query);
/** /**
* 按客户查询关系映射列表 * 按客户查询关系映射列表
......
...@@ -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);
} }
...@@ -16,7 +16,7 @@ public interface IWeChatSideService extends IService<WeChatSide> { ...@@ -16,7 +16,7 @@ public interface IWeChatSideService extends IService<WeChatSide> {
* *
* @return {@link WeChatSide}s * @return {@link WeChatSide}s
*/ */
public List<WeChatSide> chatSides(); public List<WeChatSide> chatSides(String h5);
/** /**
* 更新侧边栏信息 * 更新侧边栏信息
......
...@@ -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);
}
} }
...@@ -160,11 +160,9 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa ...@@ -160,11 +160,9 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
* @param query * @param query
*/ */
@Override @Override
public List<ElasticSearchEntity> saveWeChatContactMapping(List<JSONObject> query) { public List<JSONObject> saveWeChatContactMapping(List<JSONObject> query) {
List<ElasticSearchEntity> resultList = new ArrayList<>(); List<JSONObject> resultList = new ArrayList<>();
query.stream().filter(chatData -> StringUtils.isNotEmpty(chatData.getString("from"))).forEach(chatData -> { query.stream().filter(chatData -> StringUtils.isNotEmpty(chatData.getString("from"))).forEach(chatData -> {
ElasticSearchEntity elasticSearchEntity = new ElasticSearchEntity();
elasticSearchEntity.setId(chatData.getString("msgid"));
//发送人映射数据 //发送人映射数据
WeChatContactMapping fromWeChatContactMapping = new WeChatContactMapping(); WeChatContactMapping fromWeChatContactMapping = new WeChatContactMapping();
String fromId = chatData.getString("from"); String fromId = chatData.getString("from");
...@@ -194,8 +192,7 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa ...@@ -194,8 +192,7 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
WeChatContactMapping reveiceWeChatContactMapping = from2ReveiceData(fromType, fromWeChatContactMapping); WeChatContactMapping reveiceWeChatContactMapping = from2ReveiceData(fromType, fromWeChatContactMapping);
insertWeChatContactMapping(fromWeChatContactMapping); insertWeChatContactMapping(fromWeChatContactMapping);
insertWeChatContactMapping(reveiceWeChatContactMapping); insertWeChatContactMapping(reveiceWeChatContactMapping);
elasticSearchEntity.setData(chatData); resultList.add(chatData);
resultList.add(elasticSearchEntity);
}); });
return resultList; return resultList;
} }
......
...@@ -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);
}
/** /**
* 更新该次选择的素材数 * 更新该次选择的素材数
* *
......
...@@ -21,8 +21,8 @@ public class WeChatSideServiceImpl extends ServiceImpl<WeChatSideMapper, WeChatS ...@@ -21,8 +21,8 @@ public class WeChatSideServiceImpl extends ServiceImpl<WeChatSideMapper, WeChatS
private WeChatSideMapper weChatSideMapper; private WeChatSideMapper weChatSideMapper;
@Override @Override
public List<WeChatSide> chatSides() { public List<WeChatSide> chatSides(String h5) {
return weChatSideMapper.selectWeChatSides(); return weChatSideMapper.selectWeChatSides(h5);
} }
@Override @Override
......
...@@ -68,8 +68,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS ...@@ -68,8 +68,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
.minimumShouldMatch(1); .minimumShouldMatch(1);
//时间范围查询 //时间范围查询
if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) { if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
Date beginTime = DateUtils.dateTime(query.getBeginTime(), DateUtils.YYYY_MM_DD); Date beginTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getBeginTime());
Date endTime = DateUtils.dateTime(query.getEndTime(), DateUtils.YYYY_MM_DD); Date endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getEndTime());
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime)); boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
} }
builder.query(boolQueryBuilder); builder.query(boolQueryBuilder);
...@@ -105,8 +105,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS ...@@ -105,8 +105,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
//时间范围查询 //时间范围查询
if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) { if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
Date beginTime = DateUtils.dateTime(query.getBeginTime(), DateUtils.YYYY_MM_DD); Date beginTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getBeginTime());
Date endTime = DateUtils.dateTime(query.getEndTime(), DateUtils.YYYY_MM_DD); Date endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getEndTime());
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime)); boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
} }
...@@ -194,8 +194,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS ...@@ -194,8 +194,8 @@ public class WeConversationArchiveServiceImpl implements IWeConversationArchiveS
//时间范围查询 //时间范围查询
if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) { if (StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
Date beginTime = DateUtils.dateTime(query.getBeginTime(), DateUtils.YYYY_MM_DD); Date beginTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getBeginTime());
Date endTime = DateUtils.dateTime(query.getEndTime(), DateUtils.YYYY_MM_DD); Date endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD,query.getEndTime());
boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime)); boolQueryBuilder.filter(QueryBuilders.rangeQuery("msgtime").gte(beginTime).lte(endTime));
} }
builder.query(boolQueryBuilder); builder.query(boolQueryBuilder);
......
...@@ -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;
} }
......
...@@ -22,6 +22,8 @@ import com.linkwechat.wecom.service.IWeUserService; ...@@ -22,6 +22,8 @@ import com.linkwechat.wecom.service.IWeUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
...@@ -30,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -165,6 +166,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -165,6 +166,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
@Override @Override
public void hitSensitive(List<JSONObject> entityList) { public void hitSensitive(List<JSONObject> entityList) {
log.info("执行敏感词命中过滤,time=[{}]", System.currentTimeMillis());
//获取所有的敏感词规则 //获取所有的敏感词规则
List<WeSensitive> allSensitiveRules = weSensitiveMapper.selectWeSensitiveList(new WeSensitive()); List<WeSensitive> allSensitiveRules = weSensitiveMapper.selectWeSensitiveList(new WeSensitive());
//根据规则过滤命中 //根据规则过滤命中
...@@ -175,18 +177,14 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -175,18 +177,14 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
List<String> users = getScopeUsers(weSensitive.getAuditUserScope()); List<String> users = getScopeUsers(weSensitive.getAuditUserScope());
jsonList.addAll(hitSensitiveInES(patternWords, users)); jsonList.addAll(hitSensitiveInES(patternWords, users));
//将命中结果插入es //将命中结果插入es
try { addHitSensitiveList(jsonList, weSensitive);
addHitSensitiveList(jsonList, weSensitive);
} catch (IOException e) {
log.warn("添加敏感词命中信息失败, jsonList={}, auditUserId={}, exception={}",
jsonList, weSensitive.getAuditUserId(), ExceptionUtils.getStackTrace(e));
}
}); });
} }
} }
@Override @Override
public PageInfo<JSONObject> getHitSensitiveList(WeSensitiveHitQuery weSensitiveHitQuery) { public PageInfo<JSONObject> getHitSensitiveList(WeSensitiveHitQuery weSensitiveHitQuery) {
elasticSearch.createIndex2(WeConstans.WECOM_SENSITIVE_HIT_INDEX, getSensitiveHitMapping());
List<String> userIds = Lists.newArrayList(); List<String> userIds = Lists.newArrayList();
if (weSensitiveHitQuery.getScopeType().equals(WeConstans.USE_SCOP_BUSINESSID_TYPE_USER)) { if (weSensitiveHitQuery.getScopeType().equals(WeConstans.USE_SCOP_BUSINESSID_TYPE_USER)) {
userIds.add(weSensitiveHitQuery.getAuditScopeId()); userIds.add(weSensitiveHitQuery.getAuditScopeId());
...@@ -218,9 +216,8 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -218,9 +216,8 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
return elasticSearch.searchPage(WeConstans.WECOM_SENSITIVE_HIT_INDEX, builder, pageNum, pageSize, JSONObject.class); return elasticSearch.searchPage(WeConstans.WECOM_SENSITIVE_HIT_INDEX, builder, pageNum, pageSize, JSONObject.class);
} }
private void addHitSensitiveList(List<JSONObject> json, WeSensitive weSensitive) throws IOException { private void addHitSensitiveList(List<JSONObject> json, WeSensitive weSensitive) {
//创建索引 elasticSearch.createIndex2(WeConstans.WECOM_SENSITIVE_HIT_INDEX, getSensitiveHitMapping());
elasticSearch.createIndex2(WeConstans.WECOM_SENSITIVE_HIT_INDEX, elasticSearch.getFinanceMapping());
if (weSensitive.getAlertFlag().equals(1)) { if (weSensitive.getAlertFlag().equals(1)) {
//针对每一条命中信息发送消息通知给相应的审计人 TODO //针对每一条命中信息发送消息通知给相应的审计人 TODO
} }
...@@ -270,4 +267,43 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -270,4 +267,43 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
builder.query(searchBuilder); builder.query(searchBuilder);
return elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, builder, JSONObject.class); return elasticSearch.search(WeConstans.WECOM_FINANCE_INDEX, builder, JSONObject.class);
} }
private XContentBuilder getSensitiveHitMapping() {
try {
//创建索引
XContentBuilder mapping = XContentFactory.jsonBuilder()
.startObject()
.startObject("properties")
.startObject("msgid")
.field("type", "keyword")
.endObject()
.startObject("seq")
.field("type", "long")
.endObject()
.startObject("action")
.field("type", "keyword")
.endObject()
.startObject("from")
.field("type", "keyword")
.endObject()
.startObject("roomid")
.field("type", "keyword")
.endObject()
.startObject("msgtime")
.field("type", "long")
.endObject()
.startObject("msgtype")
.field("type", "keyword")
.endObject()
.startObject("alerted")
.field("type", "keyword")
.endObject()
.endObject()
.endObject();
return mapping;
} catch (Exception e) {
log.warn("create sensitive-hit mapping failed, exception={}", ExceptionUtils.getStackTrace(e));
}
return null;
}
} }
...@@ -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
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
FROM FROM
we_chat_side we_chat_side
<where> <where>
`using`=0 <if test="h5!=null and h5!='' and h5=='1'.toString()">
`using`=0
</if>
</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!