|
|
@ -31,6 +31,8 @@ import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.CpUserDetailRedis; |
|
|
|
import com.epmet.constant.CodeConstant; |
|
|
|
import com.epmet.constant.ModuleConstant; |
|
|
|
import com.epmet.constant.PaConstant; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.*; |
|
|
@ -102,6 +104,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust |
|
|
|
private WxMaCodeService wxMaCodeService; |
|
|
|
@Autowired |
|
|
|
private AuthorizationInfoDao authorizationInfoDao; |
|
|
|
@Autowired |
|
|
|
private ComponentAccessTokenDao componentAccessTokenDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PaCustomerDTO> page(Map<String, Object> params) { |
|
|
@ -641,4 +645,56 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 获取客户第三方token |
|
|
|
* @NEI https://nei.netease.com/interface/detail/res/?pid=52285&id=323480
|
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.08.25 14:51 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public CustomerTokensResultDTO tokenList(CommonCustomerIdFormDTO param) { |
|
|
|
CustomerTokensResultDTO result = new CustomerTokensResultDTO(); |
|
|
|
String customerName = baseDao.selectCustomerName(param.getCustomerId()); |
|
|
|
String componentAccessToken = componentAccessTokenDao.selectComponentAccessToken(); |
|
|
|
List<AuthAccessTokenClientResultDTO> clientList = authorizationInfoDao.selectClientToken(param.getCustomerId()); |
|
|
|
result.setCustomerId(param.getCustomerId()); |
|
|
|
result.setComponentAccessToken(StringUtils.isBlank(componentAccessToken) ? "" : componentAccessToken); |
|
|
|
result.setCustomerName(StringUtils.isBlank(customerName) ? "" : customerName); |
|
|
|
if(null != clientList || !clientList.isEmpty()){ |
|
|
|
clientList.forEach(client -> { |
|
|
|
if(StringUtils.equals(CodeConstant.WORK,client.getClientType())){ |
|
|
|
result.setWorkAuthorizerToken(client.getAccessToken()); |
|
|
|
}else if(StringUtils.equals(CodeConstant.RESI,client.getClientType())){ |
|
|
|
result.setResiAuthorizerToken(client.getAccessToken()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 公众号客户删除 |
|
|
|
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323482
|
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.08.25 15:46 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param) { |
|
|
|
if(StringUtils.equals(ModuleConstant.SRC_PROD,param.getSource())){ |
|
|
|
logger.warn("有人试图删除用户的生产数据,试图删除的客户Id:{},操作者Id:{}",param.getCustomerId(),param.getUserId()); |
|
|
|
throw new RenException("禁止对生产环境数据进行删除操作!"); |
|
|
|
} |
|
|
|
String check = baseDao.selectSourceById(param.getCustomerId(),param.getSource()); |
|
|
|
if (!StringUtils.equals(check,param.getCustomerId())) { |
|
|
|
logger.warn("com.epmet.service.impl.PaCustomerServiceImpl.clearPublicCustomer,客户来源信息不匹配,客户Id:{},来源:{}",param.getCustomerId(),param.getSource()); |
|
|
|
return ; |
|
|
|
} |
|
|
|
baseDao.clearCustomerInfo(param.getCustomerId()); |
|
|
|
} |
|
|
|
|
|
|
|
} |