新购任务--批量发送短信sendSMS
This commit is contained in:
parent
c1abbcbba5
commit
ed83f77055
|
|
@ -3,8 +3,12 @@ package com.bonus.material.purchase.controller;
|
|||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -106,6 +110,18 @@ public class PurchaseNoticePersonController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量发送短信
|
||||
*/
|
||||
@ApiOperation(value = "批量发送短信")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("purchase:person:edit")
|
||||
@SysLog(title = "批量发送短信", businessType = OperaType.UPDATE, module = "仓储管理->批量发送短信")
|
||||
@PutMapping("/batchSendSms")
|
||||
public AjaxResult batchSendSms(@NotNull @Valid @RequestBody PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
||||
return purchaseNoticePersonService.batchSendSms(purchaseNoticePersonDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改新购短信通知人员
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.material.purchase.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.material.purchase.dto
|
||||
* @CreateTime: 2024-10-21 14:37
|
||||
* @Description: 描述
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
public class PurchaseNoticePersonDto {
|
||||
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
@NotEmpty(message = "电话号码不能为空")
|
||||
@ApiModelProperty(value = "电话号码")
|
||||
private List<String> phoneNumbers;
|
||||
|
||||
/**
|
||||
* 短信内容
|
||||
*/
|
||||
@NotNull(message = "短信内容不能为空")
|
||||
@ApiModelProperty(value = "短信内容")
|
||||
private String content;
|
||||
}
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.material.purchase.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
|
||||
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
|
||||
|
||||
/**
|
||||
* 新购短信通知人员Service接口
|
||||
|
|
@ -26,6 +29,12 @@ public interface IPurchaseNoticePersonService {
|
|||
*/
|
||||
public List<PurchaseNoticePerson> selectPurchaseNoticePersonList(PurchaseNoticePerson purchaseNoticePerson);
|
||||
|
||||
/**
|
||||
* 批量发送短信
|
||||
* @param purchaseNoticePersonDto 短信发送信息dto
|
||||
*/
|
||||
AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto);
|
||||
|
||||
/**
|
||||
* 新增新购短信通知人员
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,12 +3,17 @@ package com.bonus.material.purchase.service.impl;
|
|||
import java.util.List;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.sms.SmsUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.purchase.mapper.PurchaseNoticePersonMapper;
|
||||
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
|
||||
import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 新购短信通知人员Service业务层处理
|
||||
*
|
||||
|
|
@ -17,9 +22,14 @@ import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
|
|||
*/
|
||||
@Service
|
||||
public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonService {
|
||||
@Autowired
|
||||
|
||||
@Resource
|
||||
private PurchaseNoticePersonMapper purchaseNoticePersonMapper;
|
||||
|
||||
@Resource
|
||||
private SmsUtils smsUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 查询新购短信通知人员
|
||||
*
|
||||
|
|
@ -42,6 +52,17 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
|||
return purchaseNoticePersonMapper.selectPurchaseNoticePersonList(purchaseNoticePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
||||
String splitPhoneNumber = String.join(",", purchaseNoticePersonDto.getPhoneNumbers());
|
||||
try {
|
||||
String sendResult = SmsUtils.smsToken(splitPhoneNumber, purchaseNoticePersonDto.getContent(), null);
|
||||
return AjaxResult.success(sendResult);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("短信发送异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增新购短信通知人员
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue