Browse Source

Merge branch 'dev_wx_msg' into dev_temp

dev_shibei_match
wxz 5 years ago
parent
commit
dc925559e4
  1. 6
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java
  2. 4
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java
  3. 4
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java
  4. 13
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml
  5. 12
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml

6
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java

@ -66,8 +66,10 @@ public interface WxmpResiUserSubscribeDao extends BaseDao<WxmpResiUserSubscribeE
*/ */
int clearResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId,@Param("userId") String userId); int clearResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId,@Param("userId") String userId);
WxmpResiUserSubscribeEntity getWxResiSubscribe(@Param("userId") String userId, @Param("customerId") String customerId, WxmpResiUserSubscribeEntity getWxResiSubscribe(@Param("userId") String userId,
@Param("templateId") String templateId); @Param("customerId") String customerId,
@Param("templateId") String templateId,
@Param("openId") String openId);
void incrSubscribeCount(@Param("incr") int incr, void incrSubscribeCount(@Param("incr") int incr,
@Param("userId") String userId, @Param("userId") String userId,

4
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java

@ -68,7 +68,9 @@ public interface WxmpWorkUserSubscribeDao extends BaseDao<WxmpWorkUserSubscribeE
WxmpWorkUserSubscribeEntity getWxWorkSubscribe(@Param("userId") String userId, WxmpWorkUserSubscribeEntity getWxWorkSubscribe(@Param("userId") String userId,
@Param("customerId") String customerId, @Param("customerId") String customerId,
@Param("templateId") String templateId); @Param("templateId") String templateId,
@Param("openId") String openId
);
void incrSubscribeCount(@Param("incr") int incr, void incrSubscribeCount(@Param("incr") int incr,
@Param("userId") String userId, @Param("userId") String userId,

4
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java

@ -497,7 +497,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService {
private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId,
String openId, String wxAlwaysVisit) { String openId, String wxAlwaysVisit) {
WxmpResiUserSubscribeEntity wxResiSubscribe = wxmpResiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId); WxmpResiUserSubscribeEntity wxResiSubscribe = wxmpResiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId, openId);
if (wxResiSubscribe == null) { if (wxResiSubscribe == null) {
WxmpResiUserSubscribeEntity insert = new WxmpResiUserSubscribeEntity(); WxmpResiUserSubscribeEntity insert = new WxmpResiUserSubscribeEntity();
insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0); insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0);
@ -529,7 +529,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService {
*/ */
private void saveWxWorkSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, private void saveWxWorkSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId,
String openId, String wxAlwaysVisit) { String openId, String wxAlwaysVisit) {
WxmpWorkUserSubscribeEntity wxWorkSubscribe = wxmpWorkUserSubscribeDao.getWxWorkSubscribe(userId, customerId, templateId); WxmpWorkUserSubscribeEntity wxWorkSubscribe = wxmpWorkUserSubscribeDao.getWxWorkSubscribe(userId, customerId, templateId, openId);
if (wxWorkSubscribe == null) { if (wxWorkSubscribe == null) {
WxmpWorkUserSubscribeEntity insert = new WxmpWorkUserSubscribeEntity(); WxmpWorkUserSubscribeEntity insert = new WxmpWorkUserSubscribeEntity();
insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0); insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0);

13
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml

@ -17,7 +17,8 @@
<update id="decreaseResiSubscribeCount"> <update id="decreaseResiSubscribeCount">
update Wxmp_Resi_User_Subscribe update Wxmp_Resi_User_Subscribe
set count = if(count <![CDATA[<]]> 1, 0, count - ${num} ) set count = if(count <![CDATA[<]]> 1, 0, count - ${num} ),
UPDATED_TIME = now()
where where
del_flag = 0 del_flag = 0
and customer_id = #{customerId} and customer_id = #{customerId}
@ -28,7 +29,8 @@
<update id="clearResiSubscribeCount" parameterType="String"> <update id="clearResiSubscribeCount" parameterType="String">
update Wxmp_Resi_User_Subscribe update Wxmp_Resi_User_Subscribe
set count = 0 set count = 0,
UPDATED_TIME = now()
where where
del_flag = 0 del_flag = 0
and customer_id = #{customerId} and customer_id = #{customerId}
@ -41,7 +43,8 @@
<update id="incrSubscribeCount"> <update id="incrSubscribeCount">
update wxmp_resi_user_subscribe update wxmp_resi_user_subscribe
set COUNT=COUNT + #{incr}, set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe' WX_SUBSCRIBE_STATUS = 'subscribe',
UPDATED_TIME = now()
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
@ -52,7 +55,8 @@
<update id="unSubscribe"> <update id="unSubscribe">
update wxmp_resi_user_subscribe update wxmp_resi_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe', set WX_SUBSCRIBE_STATUS = 'unsubscribe',
COUNT = 0 COUNT = 0,
UPDATED_TIME = now()
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
@ -77,6 +81,7 @@
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{openId}
</select> </select>
</mapper> </mapper>

12
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml

@ -5,7 +5,8 @@
<update id="incrSubscribeCount"> <update id="incrSubscribeCount">
update wxmp_work_user_subscribe update wxmp_work_user_subscribe
set COUNT=COUNT + #{incr}, set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe' WX_SUBSCRIBE_STATUS = 'subscribe',
UPDATED_TIME = now()
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
@ -26,7 +27,8 @@
<update id="decreaseWorkSubscribeCount"> <update id="decreaseWorkSubscribeCount">
update Wxmp_Work_User_Subscribe update Wxmp_Work_User_Subscribe
set count = if(count &lt; 1, 0, count - ${num} ) set count = if(count &lt; 1, 0, count - ${num} ),
UPDATED_TIME = now()
where where
del_flag =0 del_flag =0
and customer_id = #{customerId} and customer_id = #{customerId}
@ -36,7 +38,7 @@
</update> </update>
<update id="clearWorkSubscribeCount" parameterType="String"> <update id="clearWorkSubscribeCount" parameterType="String">
update Wxmp_Work_User_Subscribe update Wxmp_Work_User_Subscribe
set count = 0 set count = 0, UPDATED_TIME = now()
where where
del_flag =0 del_flag =0
and customer_id = #{customerId} and customer_id = #{customerId}
@ -48,7 +50,8 @@
<update id="unSubscribe"> <update id="unSubscribe">
update wxmp_work_user_subscribe update wxmp_work_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe', set WX_SUBSCRIBE_STATUS = 'unsubscribe',
COUNT = 0 COUNT = 0,
UPDATED_TIME = now()
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
@ -73,5 +76,6 @@
where USER_ID = #{userId} where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId} and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId} and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{openId}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save