xhxu 5 лет назад
Родитель
Сommit
ef1ac12885
3 измененных файлов: 5 добавлений и 8 удалений
  1. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java
  3. +3
    -6
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java Просмотреть файл

@@ -39,5 +39,5 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> {


void updateMsgCount(WxCUser user); void updateMsgCount(WxCUser user);


void updateMsgCountDown(@Param("tenantId")String tenantId, @Param("openIds")List<String> list);
void updateMsgCountDown(@Param("tenantId")String tenantId, @Param("openId")String openId);
} }

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java Просмотреть файл

@@ -119,7 +119,6 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService {
// wxMaService.getMsgService().sendTemplateMsg(templateMessage); // wxMaService.getMsgService().sendTemplateMsg(templateMessage);


String[] split = smartAppMsg.getTo().split(","); String[] split = smartAppMsg.getTo().split(",");
wxCUserMapper.updateMsgCountDown(tenantEntity.getTenantId(),Arrays.asList(split));


for (String to:split) { for (String to:split) {
try { try {
@@ -134,6 +133,7 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService {
.build(); .build();


wxMaService.getMsgService().sendSubscribeMsg(subscribeMessage); wxMaService.getMsgService().sendSubscribeMsg(subscribeMessage);
wxCUserMapper.updateMsgCountDown(tenantEntity.getTenantId(),to);
} catch (Exception e) { } catch (Exception e) {
logger.error("openId:"+to+"-----发送订阅消息失败"); logger.error("openId:"+to+"-----发送订阅消息失败");
} }


+ 3
- 6
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -258,19 +258,16 @@
</if> </if>
</update> </update>


<update id="updateMsgCountDown" parameterType="list">
<update id="updateMsgCountDown">
update wx_c_user set msg_count = msg_count-1 update wx_c_user set msg_count = msg_count-1
where msg_count &gt; 0 where msg_count &gt; 0
<if test=" null != tenantId and '' != tenantId"> <if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId} and `tenant_id` = #{tenantId}
</if> </if>
and `open_id` in
<foreach collection="openIds" index="index" item="openId" open="(" separator="," close=")" >
#{openId}
</foreach>
and `open_id` = #{openId}
</update> </update>


<select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap">
<select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUsupdateMsgCountDowner" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_c_user select <include refid="allColumns"/> from wx_c_user
where `app_id` = #{appId} and `open_id` = #{openId} where `app_id` = #{appId} and `open_id` = #{openId}
</select> </select>


Загрузка…
Отмена
Сохранить