|
@ -32,7 +32,6 @@ import com.epmet.dao.WxmpResiUserSubscribeDao; |
|
|
import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; |
|
|
import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; |
|
|
import com.epmet.dao.WxmpUserSubscribeRecordDao; |
|
|
import com.epmet.dao.WxmpUserSubscribeRecordDao; |
|
|
import com.epmet.dao.WxmpWorkUserSubscribeDao; |
|
|
import com.epmet.dao.WxmpWorkUserSubscribeDao; |
|
|
import com.epmet.dto.UserWechatDTO; |
|
|
|
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.entity.*; |
|
|
import com.epmet.entity.*; |
|
@ -94,7 +93,17 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId, String templateId) { |
|
|
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) { |
|
|
if (userSubscribeStatusEntity != null) { |
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
@ -107,6 +116,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
userSubscribeStatusEntity.setClientType(clientType); |
|
|
userSubscribeStatusEntity.setClientType(clientType); |
|
|
userSubscribeStatusEntity.setTemplateId(templateId); |
|
|
userSubscribeStatusEntity.setTemplateId(templateId); |
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); |
|
|
|
|
|
userSubscribeStatusEntity.setWxOpenId(openId); |
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
|
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); |
|
|
userSubscribeStatusEntity.setUserId(userId); |
|
|
userSubscribeStatusEntity.setUserId(userId); |
|
|
msgSubscribeStatusDao.insert(userSubscribeStatusEntity); |
|
|
msgSubscribeStatusDao.insert(userSubscribeStatusEntity); |
|
@ -440,7 +450,16 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public WxMsgAuthInfoResultDTO getAuthorizationInfo(String customerId, String clientType, String loginUserId, String templateId) { |
|
|
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 |
|
|
@Transactional |
|
@ -472,7 +491,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
subscribeRecordDao.insert(record); |
|
|
subscribeRecordDao.insert(record); |
|
|
|
|
|
|
|
|
// 3.更新用户模板订阅状态
|
|
|
// 3.更新用户模板订阅状态
|
|
|
WxmpTemplateMsgSubscribeStatusEntity subscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId); |
|
|
WxmpTemplateMsgSubscribeStatusEntity subscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId, openId); |
|
|
if (subscribeStatusEntity == null) { |
|
|
if (subscribeStatusEntity == null) { |
|
|
subscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity(); |
|
|
subscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity(); |
|
|
subscribeStatusEntity.setUserId(userId); |
|
|
subscribeStatusEntity.setUserId(userId); |
|
@ -481,6 +500,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
subscribeStatusEntity.setWxAlwaysVisit(wxAlwaysVisit); |
|
|
subscribeStatusEntity.setWxAlwaysVisit(wxAlwaysVisit); |
|
|
subscribeStatusEntity.setCustomerId(customerId); |
|
|
subscribeStatusEntity.setCustomerId(customerId); |
|
|
subscribeStatusEntity.setClientType(clientType); |
|
|
subscribeStatusEntity.setClientType(clientType); |
|
|
|
|
|
subscribeStatusEntity.setWxOpenId(openId); |
|
|
msgSubscribeStatusDao.insert(subscribeStatusEntity); |
|
|
msgSubscribeStatusDao.insert(subscribeStatusEntity); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -598,4 +618,24 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { |
|
|
} |
|
|
} |
|
|
return staffBasicInfo.getOpenId(); |
|
|
return staffBasicInfo.getOpenId(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Description 消息-获取订阅消息模板列表 |
|
|
|
|
|
* @author sun |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO) { |
|
|
|
|
|
List<WxmpTemplateListResultDTO> resultList = new ArrayList<>(); |
|
|
|
|
|
CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class); |
|
|
|
|
|
List<CustomerTemplateListResultDTO> list = customerTemplateList(dto); |
|
|
|
|
|
list.forEach(l->{ |
|
|
|
|
|
if(formDTO.getClientType().equals(l.getClientType())){ |
|
|
|
|
|
WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class); |
|
|
|
|
|
resultList.add(result); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return resultList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|