Commit bf5d4b07 by danmo

1、任务宝新增bug修复

2、海报bug修复
1 parent 305b72d9
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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;
...@@ -45,21 +46,13 @@ public class WePosterController extends BaseController { ...@@ -45,21 +46,13 @@ 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.setDelFlag(0);
poster.setMediaType(MediaType.POSTER.getType()); poster.setMediaType(MediaType.POSTER.getType());
/*if(poster.getCategoryId() == null){
return AjaxResult.error("请选择海报分类");
}*/
wePosterService.saveOrUpdate(poster); wePosterService.saveOrUpdate(poster);
if(!CollectionUtils.isEmpty(poster.getPosterSubassemblyList())) { if(CollectionUtil.isNotEmpty(poster.getPosterSubassemblyList())) {
poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> { poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> {
wePosterSubassembly.setDelFlag(0);
wePosterSubassembly.setId(SnowFlakeUtil.nextId());
wePosterSubassembly.setPosterId(poster.getId()); wePosterSubassembly.setPosterId(poster.getId());
}); });
wePosterSubassemblyService.saveBatch(poster.getPosterSubassemblyList()); wePosterSubassemblyService.saveBatch(poster.getPosterSubassemblyList());
...@@ -86,9 +79,7 @@ public class WePosterController extends BaseController { ...@@ -86,9 +79,7 @@ public class WePosterController extends BaseController {
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.setPosterId(poster.getId()); wePosterSubassembly.setPosterId(poster.getId());
wePosterSubassembly.setDelFlag(0);
insertList.add(wePosterSubassembly); insertList.add(wePosterSubassembly);
} else { } else {
posterSubassemblyMap.remove(wePosterSubassembly.getId()); posterSubassemblyMap.remove(wePosterSubassembly.getId());
...@@ -109,17 +100,7 @@ public class WePosterController extends BaseController { ...@@ -109,17 +100,7 @@ public class WePosterController extends BaseController {
return AjaxResult.success("修改成功"); return AjaxResult.success("修改成功");
} }
/*@GetMapping(value = "list")
@ApiOperation("列表查询海报")
public AjaxResult list(Long categoryId,String name){
List<WePoster> fontList = wePosterService.lambdaQuery()
.eq(WePoster::getDelFlag,0)
.eq(categoryId != null,WePoster::getCategoryId,categoryId)
.like(StringUtils.isNotBlank(name),WePoster::getTitle,name)
.orderByDesc(WePoster::getCreateTime)
.list();
return AjaxResult.success(fontList);
}*/
@GetMapping(value = "entity/{id}") @GetMapping(value = "entity/{id}")
// @PreAuthorize("@ss.hasAnyPermi('wecom:poster:entity')") // @PreAuthorize("@ss.hasAnyPermi('wecom:poster:entity')")
......
...@@ -31,8 +31,6 @@ public class WePosterFontController extends BaseController { ...@@ -31,8 +31,6 @@ public class WePosterFontController extends BaseController {
@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.setDelFlag(0);
posterFont.setMediaType(MediaType.POSTER_FONT.getType()); posterFont.setMediaType(MediaType.POSTER_FONT.getType());
wePosterFontService.save(posterFont); wePosterFontService.save(posterFont);
return AjaxResult.success("创建成功"); return AjaxResult.success("创建成功");
......
...@@ -130,13 +130,8 @@ public class WeTaskFissionController extends BaseController { ...@@ -130,13 +130,8 @@ public class WeTaskFissionController extends BaseController {
@Log(title = "任务宝", businessType = BusinessType.INSERT) @Log(title = "任务宝", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
public AjaxResult add(@RequestBody WeTaskFission weTaskFission) { public AjaxResult add(@RequestBody WeTaskFission weTaskFission) {
Long fissionTaskId = weTaskFissionService.insertWeTaskFission(weTaskFission); weTaskFissionService.insertWeTaskFission(weTaskFission);
if (fissionTaskId != null) { return AjaxResult.success();
JSONObject json = new JSONObject();
json.put("id", fissionTaskId);
return AjaxResult.success(json.toJSONString());
}
return AjaxResult.error();
} }
/** /**
...@@ -183,14 +178,13 @@ public class WeTaskFissionController extends BaseController { ...@@ -183,14 +178,13 @@ public class WeTaskFissionController extends BaseController {
/** /**
* 发送裂变任务 * 发送裂变任务
*/ */
@ApiOperation(value = "发送裂变任务", httpMethod = "GET") /*@ApiOperation(value = "发送裂变任务", httpMethod = "GET")
// @PreAuthorize("@ss.hasPermi('wecom:fission:send')")
@Log(title = "发送裂变任务", businessType = BusinessType.OTHER) @Log(title = "发送裂变任务", businessType = BusinessType.OTHER)
@GetMapping("/send/{id}") @GetMapping("/send/{id}")
public AjaxResult send(@PathVariable Long id) throws Exception { public AjaxResult send(@PathVariable Long id) throws Exception {
weTaskFissionService.sendWeTaskFission(id); weTaskFissionService.sendWeTaskFission(id);
return AjaxResult.success(); return AjaxResult.success();
} }*/
/** /**
* 添加群裂变完成记录 * 添加群裂变完成记录
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -8,10 +9,12 @@ import io.swagger.annotations.ApiModel; ...@@ -8,10 +9,12 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
/** /**
* 海报 * 海报
*
* @author ws * @author ws
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
...@@ -20,7 +23,7 @@ import java.util.List; ...@@ -20,7 +23,7 @@ import java.util.List;
@ApiModel(value = "海报") @ApiModel(value = "海报")
public class WePoster extends BaseEntity { public class WePoster extends BaseEntity {
@TableId @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
...@@ -53,10 +56,6 @@ public class WePoster extends BaseEntity { ...@@ -53,10 +56,6 @@ public class WePoster extends BaseEntity {
private Long type; private Long type;
@TableField @TableField
@ApiModelProperty(value = "海报状态 0 启用 1 关闭")
private Integer delFlag;
@TableField
@ApiModelProperty(value = "海报背景宽度") @ApiModelProperty(value = "海报背景宽度")
private Integer width; private Integer width;
...@@ -76,11 +75,16 @@ public class WePoster extends BaseEntity { ...@@ -76,11 +75,16 @@ public class WePoster extends BaseEntity {
@ApiModelProperty("其他字段") @ApiModelProperty("其他字段")
private String otherField; private String otherField;
@ApiModelProperty("状态 0-启用 1-不启用")
private Integer status;
@ApiModelProperty(value = "删除状态 0-正常 1-删除")
private Integer delFlag;
/** /**
* 海报组件数组 * 海报组件数组
*/ */
@TableField(exist = false) @TableField(exist = false)
private List<WePosterSubassembly> posterSubassemblyList; private List<WePosterSubassembly> posterSubassemblyList;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -22,7 +23,7 @@ public class WePosterFont extends BaseEntity { ...@@ -22,7 +23,7 @@ public class WePosterFont extends BaseEntity {
/** /**
* id * id
*/ */
@TableId @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -19,7 +20,7 @@ import lombok.EqualsAndHashCode; ...@@ -19,7 +20,7 @@ import lombok.EqualsAndHashCode;
@ApiModel(value = "海报组成部件") @ApiModel(value = "海报组成部件")
public class WePosterSubassembly extends BaseEntity { public class WePosterSubassembly extends BaseEntity {
@TableId @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
......
...@@ -41,7 +41,7 @@ public interface IWeTaskFissionService extends IService<WeTaskFission> { ...@@ -41,7 +41,7 @@ public interface IWeTaskFissionService extends IService<WeTaskFission> {
* @param weTaskFission 任务宝 * @param weTaskFission 任务宝
* @return 结果 * @return 结果
*/ */
public Long insertWeTaskFission(WeTaskFission weTaskFission); public void insertWeTaskFission(WeTaskFission weTaskFission);
/** /**
* 修改任务宝 * 修改任务宝
...@@ -70,9 +70,9 @@ public interface IWeTaskFissionService extends IService<WeTaskFission> { ...@@ -70,9 +70,9 @@ public interface IWeTaskFissionService extends IService<WeTaskFission> {
/** /**
* 发送任务 * 发送任务
* *
* @param id 任务id * @param weTaskFission 任务
*/ */
public void sendWeTaskFission(Long id) throws Exception; public void sendWeTaskFission(WeTaskFission weTaskFission) throws Exception;
/** /**
* 生成裂变任务海报 * 生成裂变任务海报
......
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
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;
...@@ -12,24 +12,20 @@ import com.linkwechat.wecom.domain.WePoster; ...@@ -12,24 +12,20 @@ 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;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
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 org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.List; import java.util.List;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -72,22 +68,15 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -72,22 +68,15 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
*/ */
@Override @Override
public WePoster selectOne(Long id) { public WePoster selectOne(Long id) {
WePoster poster = this.lambdaQuery() WePoster poster = this.getById(id);
.eq(WePoster::getId, id) List<WePosterSubassembly> subassemblyList = posterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId, id).list();
.eq(WePoster::getDelFlag, 0) if (CollectionUtil.isNotEmpty(subassemblyList)) {
.list().get(0); List<Long> fontIdList = subassemblyList.stream().filter(wePosterSubassembly -> wePosterSubassembly.getFontId() != null).map(WePosterSubassembly::getFontId).distinct().collect(Collectors.toList());
if (poster == null) { if (CollectionUtil.isNotEmpty(fontIdList)) {
return null;
}
poster.setPosterSubassemblyList(posterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId, poster.getId()).list());
if (!CollectionUtils.isEmpty(poster.getPosterSubassemblyList())) {
List<Long> fontIdList = poster.getPosterSubassemblyList().stream().filter(wePosterSubassembly -> wePosterSubassembly.getFontId() != null).map(WePosterSubassembly::getFontId).distinct().collect(Collectors.toList());
if (!CollectionUtils.isEmpty(fontIdList)) {
List<WePosterFont> fontList = posterFontService.lambdaQuery().in(WePosterFont::getId, fontIdList).list(); List<WePosterFont> fontList = posterFontService.lambdaQuery().in(WePosterFont::getId, fontIdList).list();
if (!CollectionUtils.isEmpty(fontList)) { if (CollectionUtil.isNotEmpty(fontList)) {
Map<Long, WePosterFont> fontMap = fontList.stream().collect(Collectors.toMap(WePosterFont::getId, f -> f)); Map<Long, WePosterFont> fontMap = fontList.stream().collect(Collectors.toMap(WePosterFont::getId, f -> f));
poster.getPosterSubassemblyList().stream().filter(wePosterSubassembly -> wePosterSubassembly.getFontId() != null).forEach(wePosterSubassembly -> { subassemblyList.stream().filter(wePosterSubassembly -> wePosterSubassembly.getFontId() != null).forEach(wePosterSubassembly -> {
WePosterFont font = fontMap.get(wePosterSubassembly.getFontId()); WePosterFont font = fontMap.get(wePosterSubassembly.getFontId());
if (font != null) { if (font != null) {
wePosterSubassembly.setFont(font); wePosterSubassembly.setFont(font);
...@@ -95,11 +84,8 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -95,11 +84,8 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
}); });
} }
} }
poster.setPosterSubassemblyList(subassemblyList);
} }
/*if(poster.getCategoryId() != null){
weCategoryService.findWeCategoryById(poster.getId());
}*/
return poster; return poster;
} }
...@@ -147,27 +133,14 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -147,27 +133,14 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
.collect(Collectors.toMap(wePosterSubassembly -> { .collect(Collectors.toMap(wePosterSubassembly -> {
return wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle(); return wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle();
}, wePosterSubassembly -> posterFontService.getFont(wePosterSubassembly.getFontId(), wePosterSubassembly.getFontSize(), wePosterSubassembly.getFontStyle()))); }, wePosterSubassembly -> posterFontService.getFont(wePosterSubassembly.getFontId(), wePosterSubassembly.getFontSize(), wePosterSubassembly.getFontStyle())));
Map<String, NetFileUtils.FileCallable> fileCallableMap = poster.getPosterSubassemblyList().stream().map(WePosterSubassembly::getImgPath).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toMap(s -> s, NetFileUtils::getNetFile)); Map<String, NetFileUtils.FileCallable> fileCallableMap = poster.getPosterSubassemblyList().stream().map(WePosterSubassembly::getImgPath).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toMap(s -> s, NetFileUtils::getNetFile));
if (CollectionUtils.isEmpty(fileCallableMap)) { if (CollectionUtils.isEmpty(fileCallableMap)) {
fileCallableMap = new HashMap<>(); fileCallableMap = new HashMap<>();
} }
fileCallableMap.put(poster.getBackgroundImgPath(), NetFileUtils.getNetFile(poster.getBackgroundImgPath())); fileCallableMap.put(poster.getBackgroundImgPath(), NetFileUtils.getNetFile(poster.getBackgroundImgPath()));
Map<String, BufferedImage> bufferedImageMap = fileCallableMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, stringFileCallableEntry -> { Map<String, BufferedImage> bufferedImageMap = fileCallableMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, stringFileCallableEntry -> {
try { try {
ByteArrayOutputStream byteArrayOutputStream = NetFileUtils.getByteArrayOutputStream(stringFileCallableEntry.getValue(), false); ByteArrayOutputStream byteArrayOutputStream = NetFileUtils.getByteArrayOutputStream(stringFileCallableEntry.getValue(), false);
return ImageUtils.copyBufferedImage(ImageIO.read(new ByteArrayInputStream(Objects.requireNonNull(byteArrayOutputStream).toByteArray())), return ImageUtils.copyBufferedImage(ImageIO.read(new ByteArrayInputStream(Objects.requireNonNull(byteArrayOutputStream).toByteArray())),
BufferedImage.TYPE_INT_ARGB); BufferedImage.TYPE_INT_ARGB);
} catch (IOException e) { } catch (IOException e) {
...@@ -176,15 +149,11 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -176,15 +149,11 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
} }
})); }));
BufferedImage backgroundImg = bufferedImageMap.get(poster.getBackgroundImgPath()); BufferedImage backgroundImg = bufferedImageMap.get(poster.getBackgroundImgPath());
poster.setWidth(backgroundImg.getWidth()); poster.setWidth(backgroundImg.getWidth());
poster.setHeight(backgroundImg.getHeight()); poster.setHeight(backgroundImg.getHeight());
poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> { poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> {
if (wePosterSubassembly.getType().equals(1)) { if (wePosterSubassembly.getType().equals(1)) {
Font font = fontMap.get(wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle()); Font font = fontMap.get(wePosterSubassembly.getFontId() + "_" + wePosterSubassembly.getFontSize() + "_" + wePosterSubassembly.getFontStyle());
...@@ -233,12 +202,12 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -233,12 +202,12 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
return poster.getSampleImgPath(); return poster.getSampleImgPath();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("图片生成错误"); throw new WeComException("图片生成错误");
} }
} }
@Override @Override
public List<WeMaterial> findWePosterToWeMaterial(String categoryId,String name) { public List<WeMaterial> findWePosterToWeMaterial(String categoryId, String name) {
return this.baseMapper.findWePosterToWeMaterial(categoryId, name); return this.baseMapper.findWePosterToWeMaterial(categoryId, name);
} }
} }
...@@ -125,8 +125,8 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -125,8 +125,8 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = {Exception.class,WeComException.class})
public Long insertWeTaskFission(WeTaskFission weTaskFission) { public void insertWeTaskFission(WeTaskFission weTaskFission) {
weTaskFission.setCreateBy(SecurityUtils.getUsername()); weTaskFission.setCreateBy(SecurityUtils.getUsername());
weTaskFission.setCreateTime(DateUtils.getNowDate()); weTaskFission.setCreateTime(DateUtils.getNowDate());
groupQrcodeHandler(weTaskFission); groupQrcodeHandler(weTaskFission);
...@@ -140,8 +140,12 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -140,8 +140,12 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
weTaskFissionStaffService.insertWeTaskFissionStaffList(weTaskFission.getTaskFissionStaffs()); weTaskFissionStaffService.insertWeTaskFissionStaffList(weTaskFission.getTaskFissionStaffs());
} }
} }
try {
sendWeTaskFission(weTaskFission);
} catch (Exception e) {
throw new WeComException(e.getMessage());
}
} }
return weTaskFission.getId();
} }
/** /**
...@@ -197,15 +201,13 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -197,15 +201,13 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
@Override @Override
public void sendWeTaskFission(Long id) throws Exception { public void sendWeTaskFission(WeTaskFission weTaskFission) throws Exception {
WeTaskFission weTaskFission = selectWeTaskFissionById(id);
//海报路径 //海报路径
String postersPath = weTaskFission.getPostersUrl(); String postersPath = weTaskFission.getPostersUrl();
//目标员工id //目标员工id
String fissStaffId = weTaskFission.getFissionTargetId(); String fissStaffId = weTaskFission.getFissionTargetId();
//H5生成海报页面路径 //H5生成海报页面路径
String pageUrlStr = StringUtils.format(pageUrl,id,fissStaffId,weTaskFission.getPostersId()); String pageUrlStr = StringUtils.format(pageUrl,weTaskFission.getId(),fissStaffId,weTaskFission.getPostersId());
WeAddGroupMessageQuery messageQuery = new WeAddGroupMessageQuery(); WeAddGroupMessageQuery messageQuery = new WeAddGroupMessageQuery();
messageQuery.setChatType(1); messageQuery.setChatType(1);
...@@ -219,16 +221,13 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W ...@@ -219,16 +221,13 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
weMessageTemplate.setPicUrl(postersPath); weMessageTemplate.setPicUrl(postersPath);
messageQuery.setAttachmentsList(ListUtil.toList(weMessageTemplate)); messageQuery.setAttachmentsList(ListUtil.toList(weMessageTemplate));
if (weTaskFission.getStartTime() != null && weTaskFission.getStartTime().getTime() <= System.currentTimeMillis()) { if (weTaskFission.getStartTime() != null && weTaskFission.getStartTime().getTime() <= System.currentTimeMillis()) {
messageQuery.setIsTask(0); messageQuery.setIsTask(0);
}else { }else {
messageQuery.setIsTask(1); messageQuery.setIsTask(1);
messageQuery.setSendTime(weTaskFission.getStartTime()); messageQuery.setSendTime(weTaskFission.getStartTime());
} }
List<WeTaskFissionStaff> weTaskFissionStaffList = weTaskFission.getTaskFissionStaffs();
//查询发起成员
List<WeTaskFissionStaff> weTaskFissionStaffList = weTaskFissionStaffService.selectWeTaskFissionStaffByTaskId(id);
//获取部门id //获取部门id
String departmentIds = Optional.ofNullable(weTaskFissionStaffList).orElseGet(ArrayList::new).stream().filter(weTaskFissionStaff -> String departmentIds = Optional.ofNullable(weTaskFissionStaffList).orElseGet(ArrayList::new).stream().filter(weTaskFissionStaff ->
WeConstans.USE_SCOP_BUSINESSID_TYPE_ORG.equals(weTaskFissionStaff.getStaffType())) WeConstans.USE_SCOP_BUSINESSID_TYPE_ORG.equals(weTaskFissionStaff.getStaffType()))
......
...@@ -11,14 +11,15 @@ ...@@ -11,14 +11,15 @@
id id
FROM FROM
we_poster we_poster
where where 1=1
del_flag=0
<if test="categoryId !=null and categoryId !=''"> <if test="categoryId !=null and categoryId !=''">
AND category_id = #{categoryId} AND category_id = #{categoryId}
</if> </if>
<if test="name !=null and name !=''"> <if test="name !=null and name !=''">
AND title like concat('%',#{name,jdbcType=VARCHAR},'%') AND title like concat('%',#{name,jdbcType=VARCHAR},'%')
</if> </if>
and status = 0
and del_flag=0
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!