|
|
@ -32,7 +32,6 @@ import com.epmet.dao.WxmpResiUserSubscribeDao; |
|
|
|
import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; |
|
|
|
import com.epmet.dao.WxmpUserSubscribeRecordDao; |
|
|
|
import com.epmet.dao.WxmpWorkUserSubscribeDao; |
|
|
|
import com.epmet.dto.UserWechatDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.*; |
|
|
@ -94,7 +93,17 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId, String templateId) { |
|
|
|
WxmpTemplateMsgSubscribeStatusEntity userSubscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId); |
|
|
|
String openId = null; |
|
|
|
switch (clientType) { |
|
|
|
case AppClientConstant.APP_GOV: |
|
|
|
openId = getWorkOpenId(userId); |
|
|
|
break; |
|
|
|
case AppClientConstant.APP_RESI: |
|
|
|
openId = getResiOpenId(userId); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
WxmpTemplateMsgSubscribeStatusEntity userSubscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId, openId); |
|
|
|
if (userSubscribeStatusEntity != null) { |
|
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
|
@ -107,6 +116,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
userSubscribeStatusEntity.setClientType(clientType); |
|
|
|
userSubscribeStatusEntity.setTemplateId(templateId); |
|
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
|
userSubscribeStatusEntity.setWxOpenId(openId); |
|
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
|
|
userSubscribeStatusEntity.setUserId(userId); |
|
|
|
msgSubscribeStatusDao.insert(userSubscribeStatusEntity); |
|
|
@ -439,7 +449,16 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public WxMsgAuthInfoResultDTO getAuthorizationInfo(String customerId, String clientType, String loginUserId, String templateId) { |
|
|
|
return msgSubscribeStatusDao.getUserSubscribeStatusDTO(loginUserId, customerId, clientType, templateId); |
|
|
|
String openId = null; |
|
|
|
switch (clientType) { |
|
|
|
case AppClientConstant.APP_RESI: |
|
|
|
openId = getResiOpenId(loginUserId); |
|
|
|
break; |
|
|
|
case AppClientConstant.APP_GOV: |
|
|
|
openId = getWorkOpenId(loginUserId); |
|
|
|
break; |
|
|
|
} |
|
|
|
return msgSubscribeStatusDao.getUserSubscribeStatusDTO(loginUserId, customerId, clientType, templateId, openId); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
@ -471,7 +490,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
subscribeRecordDao.insert(record); |
|
|
|
|
|
|
|
// 3.更新用户模板订阅状态
|
|
|
|
WxmpTemplateMsgSubscribeStatusEntity subscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId); |
|
|
|
WxmpTemplateMsgSubscribeStatusEntity subscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId, openId); |
|
|
|
if (subscribeStatusEntity == null) { |
|
|
|
subscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity(); |
|
|
|
subscribeStatusEntity.setUserId(userId); |
|
|
@ -480,6 +499,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
subscribeStatusEntity.setWxAlwaysVisit(wxAlwaysVisit); |
|
|
|
subscribeStatusEntity.setCustomerId(customerId); |
|
|
|
subscribeStatusEntity.setClientType(clientType); |
|
|
|
subscribeStatusEntity.setWxOpenId(openId); |
|
|
|
msgSubscribeStatusDao.insert(subscribeStatusEntity); |
|
|
|
return; |
|
|
|
} |
|
|
|