Commit 64c6ef17 by 水库浪子

修改群发相关BUG

1 parent 54f9f9d9
...@@ -8,6 +8,7 @@ import com.linkwechat.common.enums.BusinessType; ...@@ -8,6 +8,7 @@ import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.ResetCategoryDto; import com.linkwechat.wecom.domain.dto.ResetCategoryDto;
import com.linkwechat.wecom.domain.dto.TemporaryMaterialDto;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.dto.WeMediaDto;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO; import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
import com.linkwechat.wecom.service.IWeMaterialService; import com.linkwechat.wecom.service.IWeMaterialService;
...@@ -135,10 +136,12 @@ public class WeMaterialController extends BaseController { ...@@ -135,10 +136,12 @@ public class WeMaterialController extends BaseController {
//@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')") //@PreAuthorize("@ss.hasPermi('wechat:material:temporaryMaterialMediaId')")
@Log(title = "获取素材media_id", businessType = BusinessType.OTHER) @Log(title = "获取素材media_id", businessType = BusinessType.OTHER)
@GetMapping("/temporaryMaterialMediaId") @PostMapping("/temporaryMaterialMediaId")
@ApiOperation("获取素材media_id") @ApiOperation("获取素材media_id")
public AjaxResult temporaryMaterialMediaId(@RequestParam(value = "url") String url, @RequestParam(value = "type") String type,@RequestParam(value = "name") String name){ public AjaxResult temporaryMaterialMediaId(@RequestBody TemporaryMaterialDto temporaryMaterialDto){
WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(url, type,name); WeMediaDto weMediaDto = materialService.uploadTemporaryMaterial(temporaryMaterialDto.getUrl(),
temporaryMaterialDto.getType()
,temporaryMaterialDto.getName());
return AjaxResult.success(weMediaDto); return AjaxResult.success(weMediaDto);
} }
......
...@@ -121,8 +121,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -121,8 +121,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/wecom/ticket/**").anonymous() .antMatchers("/wecom/ticket/**").anonymous()
.antMatchers("/wecom/user/getUserInfo").anonymous() .antMatchers("/wecom/user/getUserInfo").anonymous()
// .antMatchers("/common/uploadFile2Cos").anonymous() // .antMatchers("/common/uploadFile2Cos").anonymous()
.antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous() // .antMatchers("/wecom/material/temporaryMaterialMediaId").anonymous()
.antMatchers("/wecom/portrait/**").anonymous() .antMatchers("/wecom/portrait/**").anonymous()
.antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*").anonymous() .antMatchers("/wecom/fission/poster", "/wecom/fission/*/progress/*").anonymous()
// 获取实际群活码和社群运营H5页面不需要登录 // 获取实际群活码和社群运营H5页面不需要登录
......
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
/**
* @description: 群发参数相关
* @author: HaoN
* @create: 2021-03-31 17:20
**/
@Data
public class TemporaryMaterialDto {
private String url;
private String type;
private String name;
}
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -70,14 +71,20 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS ...@@ -70,14 +71,20 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
private WeCustomerMessageTimeTaskMapper customerMessageTimeTaskMapper; private WeCustomerMessageTimeTaskMapper customerMessageTimeTaskMapper;
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException { public void addWeCustomerMessagePush(CustomerMessagePushDto customerMessagePushDto) throws JsonProcessingException, ParseException {
if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime())) // if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
&& DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm:ss")) > 0) { // && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
throw new WeComException("发送时间不能小于当前时间"); // throw new WeComException("发送时间不能小于当前时间");
// }
if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空");
} }
List<WeCustomer> customers = Lists.newArrayList(); List<WeCustomer> customers = Lists.newArrayList();
List<WeGroup> groups = new ArrayList<>(); List<WeGroup> groups = new ArrayList<>();
// 0 发给客户 // 0 发给客户
......
...@@ -148,7 +148,8 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM ...@@ -148,7 +148,8 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
weCustomerMessagePushDto.setText(customerMessagePushDto.getTextMessage()); weCustomerMessagePushDto.setText(customerMessagePushDto.getTextMessage());
} }
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.IMAGE.getMessageType())) {
if (customerMessagePushDto.getMessageType().equals(GroupMessageType.IMAGE.getType())) {
weCustomerMessagePushDto.setImage(customerMessagePushDto.getImageMessage()); weCustomerMessagePushDto.setImage(customerMessagePushDto.getImageMessage());
weCustomerMessagePushDto.setLink(null); weCustomerMessagePushDto.setLink(null);
weCustomerMessagePushDto.setMiniprogram(null); weCustomerMessagePushDto.setMiniprogram(null);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!