| @@ -24,5 +24,7 @@ public class WxTemplateMsg extends TenantEntity { | |||||
| private Date createDate; | private Date createDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="消息开关(0/1)",name="onOff") | |||||
| private Integer onOff; | |||||
| } | } | ||||
| @@ -7,10 +7,5 @@ import com.iformall.domain.po.WxTemplateMsg; | |||||
| public interface WxTemplateMsgMapper extends CommonMapper<WxTemplateMsg, Long> { | public interface WxTemplateMsgMapper extends CommonMapper<WxTemplateMsg, Long> { | ||||
| List<WxTemplateMsg> findList(WxTemplateMsg wxTemplateMsg); | List<WxTemplateMsg> findList(WxTemplateMsg wxTemplateMsg); | ||||
| } | } | ||||
| @@ -980,7 +980,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| )); | )); | ||||
| try { | try { | ||||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| //mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("支付通知发送失败: " + e.getMessage()); | logger.error("支付通知发送失败: " + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | ||||
| @@ -1014,7 +1014,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| )); | )); | ||||
| try { | try { | ||||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| // mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("支付通知发送失败: " + e.getMessage()); | logger.error("支付通知发送失败: " + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | ||||
| @@ -244,7 +244,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { | |||||
| )); | )); | ||||
| try { | try { | ||||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| // mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("砍价成功通知发送失败: " + e.getMessage()); | logger.error("砍价成功通知发送失败: " + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | ||||
| @@ -76,22 +76,22 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { | |||||
| // throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); | // throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); | ||||
| return; | return; | ||||
| } | } | ||||
| JSONObject customParam = JSON.parseObject(msg.getCustomParam()); | |||||
| String url = customParam.getString("url"); | |||||
| String emphasis = customParam.getString("emphasis"); | |||||
| // build template data list | |||||
| List<String> dataList = smartAppMsg.getDataList(); | |||||
| JSONArray indexArr = customParam.getJSONArray("index"); | |||||
| List<WxMaSubscribeMessage.Data> dataTempList = new ArrayList<>(); | |||||
| for(int i=0;i<indexArr.size();i++) { | |||||
| String key = indexArr.getString(i); | |||||
| String value = dataList.get(i); | |||||
| WxMaSubscribeMessage.Data templateData = new WxMaSubscribeMessage.Data(key, value); | |||||
| dataTempList.add(templateData); | |||||
| } | |||||
| if(0 == msg.getOnOff().intValue()){ | |||||
| JSONObject customParam = JSON.parseObject(msg.getCustomParam()); | |||||
| // String url = customParam.getString("url"); | |||||
| // String emphasis = customParam.getString("emphasis"); | |||||
| // build template data list | |||||
| List<String> dataList = smartAppMsg.getDataList(); | |||||
| JSONArray indexArr = customParam.getJSONArray("index"); | |||||
| List<WxMaSubscribeMessage.Data> dataTempList = new ArrayList<>(); | |||||
| for(int i=0;i<indexArr.size();i++) { | |||||
| String key = indexArr.getString(i); | |||||
| String value = dataList.get(i); | |||||
| WxMaSubscribeMessage.Data templateData = new WxMaSubscribeMessage.Data(key, value); | |||||
| dataTempList.add(templateData); | |||||
| } | |||||
| // List<WxMaTemplateData> dataTempList = new ArrayList<>(); | // List<WxMaTemplateData> dataTempList = new ArrayList<>(); | ||||
| // for(int i=0;i<indexArr.size();i++) { | // for(int i=0;i<indexArr.size();i++) { | ||||
| @@ -112,15 +112,17 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { | |||||
| // .build(); | // .build(); | ||||
| // wxMaService.getMsgService().sendTemplateMsg(templateMessage); | // wxMaService.getMsgService().sendTemplateMsg(templateMessage); | ||||
| subscribeMessage = WxMaSubscribeMessage.builder() | |||||
| .templateId(msg.getTemplateId()) | |||||
| .toUser(smartAppMsg.getTo()) | |||||
| .lang(WxMaConstants.MiniprogramLang.ZH_CN) | |||||
| .miniprogramState(WxMaConstants.MiniprogramState.FORMAL) | |||||
| .page(smartAppMsg.getGotopage()) | |||||
| .data(dataTempList) | |||||
| .build(); | |||||
| subscribeMessage = WxMaSubscribeMessage.builder() | |||||
| .templateId(msg.getTemplateId()) | |||||
| .toUser(smartAppMsg.getTo()) | |||||
| .lang(WxMaConstants.MiniprogramLang.ZH_CN) | |||||
| .miniprogramState(WxMaConstants.MiniprogramState.FORMAL) | |||||
| .page(smartAppMsg.getGotopage()) | |||||
| .data(dataTempList) | |||||
| .build(); | |||||
| wxMaService.getMsgService().sendSubscribeMsg(subscribeMessage); | |||||
| } | |||||
| wxMaService.getMsgService().sendSubscribeMsg(subscribeMessage); | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,10 +9,11 @@ | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | <result column="type" jdbcType="INTEGER" property="type"/> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="on_off" jdbcType="INTEGER" property="onOff"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`template_id`,`type`,`create_date`,`update_date` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`template_id`,`type`,`create_date`,`update_date`,`on_off` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -44,6 +45,9 @@ | |||||
| <if test=" null != updateDate "> | <if test=" null != updateDate "> | ||||
| and `update_date` = #{updateDate} | and `update_date` = #{updateDate} | ||||
| </if> | </if> | ||||
| <if test=" null != onOff "> | |||||
| and `on_off` = #{onOff} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||