This commit is contained in:
linfso 2024-09-25 22:51:35 +08:00
parent 80910dbac6
commit 951686b39b
4 changed files with 17 additions and 19 deletions

View File

@ -23,6 +23,7 @@ import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.redis.RedissonService;
import com.xdadan.erp.oms.common.enums.BusinessType;
import com.xdadan.erp.oms.common.utils.DateUtils;
import com.xdadan.erp.oms.domain.EmisSmsSendRecord;
import com.xdadan.erp.oms.domain.exception.EmisBizError;
import com.xdadan.erp.oms.domain.vo.AddressParseResult;
import com.xdadan.erp.oms.service.*;
@ -78,7 +79,6 @@ public class Oms2cCommonController extends BaseController
@Autowired
private WxMaService wxMaService;
@Autowired
private OmsBaseService omsBaseService;
@ -290,21 +290,17 @@ public class Oms2cCommonController extends BaseController
*
*/
@Log(title = "发送小程序通知", businessType = BusinessType.OTHER)
@RequestMapping(value = "/sendWxSappNotifyToUser")
public AjaxResult sendWxSappNotifyToUser(String billCode,String openId,String tplId,String paramStr)
@RequestMapping(value = "/sendWxSappNotify")
public AjaxResult sendWxSappNotify(String billCode)
{
WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()
.toUser(openId)
.templateId(tplId)
.page("pages/post/query?billCode="+billCode)
.build();
JSONObject jObjParam = JSONObject.parseObject(paramStr);
jObjParam.forEach( (k,v)-> { wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, (String)v));} );
try {
wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
} catch (WxErrorException e) {
e.printStackTrace();
log.error("==>sendWxSappNotify start billCode:"+billCode;
try{
EmisSmsSendRecord emisSmsSendRecord=new EmisSmsSendRecord();
emisSmsSendRecord.setBillCode(billCode);
omsBaseService.autoDoWxSappNotifySend(emisSmsSendRecord);
}catch(Exception ex){
ex.printStackTrace();
log.error("==>sendWxSappNotify exception:"+ex.getMessage());
}
return AjaxResult.success("发送成功");
@ -322,7 +318,8 @@ public class Oms2cCommonController extends BaseController
// 加锁查询
redissonService.lock(lockKey,300);
try{
omsBaseService.autoDoWxSappNotifySend();
EmisSmsSendRecord emisSmsSendRecord=new EmisSmsSendRecord();
omsBaseService.autoDoWxSappNotifySend(emisSmsSendRecord);
}catch(Exception ex){
ex.printStackTrace();
log.error("triggerSendWxSappNotify exception:"+ex.getMessage());

View File

@ -29,7 +29,7 @@ public interface EmisSmsSendRecordMapper extends BaseMapper<EmisSmsSendRecord>
* 查询列表
* @return 集合
*/
public List<EmisSmsSendRecord> selectWxSappNotifyList();
public List<EmisSmsSendRecord> selectWxSappNotifyList(EmisSmsSendRecord emisSmsSendRecord);
public int updateWxSappNotifyStatus(EmisSmsSendRecord emisSmsSendRecord);

View File

@ -67,9 +67,9 @@ public class OmsBaseService {
/**
* 通知发送发送
*/
public void autoDoWxSappNotifySend() {
public void autoDoWxSappNotifySend(EmisSmsSendRecord emisSmsSendRecord) {
List<EmisSmsSendRecord> list = emisSmsSendRecordMapper.selectWxSappNotifyList();
List<EmisSmsSendRecord> list = emisSmsSendRecordMapper.selectWxSappNotifyList(emisSmsSendRecord);
if(!CollectionUtil.isEmpty(list)){
for(EmisSmsSendRecord dt:list){
log.error("===>Start 发送微信通知:"+dt.getBillCode()+","+dt.getPhone()+" :smsType:"+dt.getSmsType());

View File

@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
del_flag='0' and wx_notify_status='0'
and create_time <![CDATA[ > ]]> DATE_SUB(CURDATE(), INTERVAL 30 DAY)
and create_time <![CDATA[ < ]]> SUBDATE(now(),INTERVAL 2 hour)
<if test="billCode != null and billCode != ''"> and bill_code = #{billCode}</if>
</where>
order by create_time desc
limit 300