|  |  | @@ -1,14 +1,19 @@ | 
		
	
		
			
			|  |  |  | package com.iformall.service.impl; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
		
	
		
			
			|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
		
	
		
			
			|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
		
	
		
			
			|  |  |  | import com.github.pagehelper.PageHelper; | 
		
	
		
			
			|  |  |  | import com.github.pagehelper.PageInfo; | 
		
	
		
			
			|  |  |  | import com.iformall.common.CommonConstants; | 
		
	
		
			
			|  |  |  | import com.iformall.common.ErrorCode; | 
		
	
		
			
			|  |  |  | import com.iformall.common.IdWorker; | 
		
	
		
			
			|  |  |  | import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | 
		
	
		
			
			|  |  |  | import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | 
		
	
		
			
			|  |  |  | import com.iformall.domain.po.WxThirdPartyApi; | 
		
	
		
			
			|  |  |  | import com.iformall.domain.po.sm.ServiceInfo; | 
		
	
		
			
			|  |  |  | import com.iformall.exception.BizException; | 
		
	
		
			
			|  |  |  | import com.iformall.mapper.ServiceInfoMapper; | 
		
	
		
			
			|  |  |  | import com.iformall.mapper.WxThirdPartyApiMapper; | 
		
	
		
			
			|  |  |  | import com.iformall.service.WxThirdPartyApiService; | 
		
	
		
			
			|  |  |  | import com.iformall.utils.Constant; | 
		
	
	
		
			
				|  |  | @@ -32,6 +37,8 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @Autowired | 
		
	
		
			
			|  |  |  | WxThirdPartyApiMapper wxThirdPartyApiMapper; | 
		
	
		
			
			|  |  |  | @Autowired | 
		
	
		
			
			|  |  |  | private ServiceInfoMapper serviceInfoMapper; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @Autowired | 
		
	
		
			
			|  |  |  | @Qualifier("objectCommonRedisTemplate") | 
		
	
	
		
			
				|  |  | @@ -55,6 +62,7 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | 
		
	
		
			
			|  |  |  | WxThirdPartyApi apiQ = new WxThirdPartyApi(); | 
		
	
		
			
			|  |  |  | apiQ.setAppId(appId); | 
		
	
		
			
			|  |  |  | apiQ.setAppKey(appKey); | 
		
	
		
			
			|  |  |  | apiQ.setStatus(CommonConstants.STATUS_NORMAL); | 
		
	
		
			
			|  |  |  | apiConfig = wxThirdPartyApiMapper.selectOne(new QueryWrapper<>(apiQ)); | 
		
	
		
			
			|  |  |  | RedisCacheUtils.cache(redisTemplate, Constant.publicApi + appId, apiConfig,0l); | 
		
	
		
			
			|  |  |  | return apiConfig; | 
		
	
	
		
			
				|  |  | @@ -73,6 +81,14 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @Override | 
		
	
		
			
			|  |  |  | public void updateThirdPartyApiStatus(UpdateThirdPartyApiStatusDTO dto) { | 
		
	
		
			
			|  |  |  | WxThirdPartyApi thirdPartyApi = wxThirdPartyApiMapper.selectOne(new LambdaQueryWrapper<WxThirdPartyApi>().eq(WxThirdPartyApi::getId, dto.getId())); | 
		
	
		
			
			|  |  |  | if (thirdPartyApi == null) { | 
		
	
		
			
			|  |  |  | throw new BizException(ErrorCode.SECRET_NOT_EXISTS); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | ServiceInfo serviceInfo = serviceInfoMapper.selectOne(new LambdaQueryWrapper<ServiceInfo>().eq(ServiceInfo::getId, thirdPartyApi.getServiceId())); | 
		
	
		
			
			|  |  |  | if (serviceInfo == null || CommonConstants.STATUS_ABNORMAL.equals(serviceInfo.getStatus())) { | 
		
	
		
			
			|  |  |  | throw new BizException(ErrorCode.SERVICE_LOCKED); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | wxThirdPartyApiMapper.update(null, new LambdaUpdateWrapper<WxThirdPartyApi>() | 
		
	
		
			
			|  |  |  | .set(WxThirdPartyApi::getStatus, dto.getStatus()) | 
		
	
		
			
			|  |  |  | .eq(WxThirdPartyApi::getId, dto.getId())); | 
		
	
	
		
			
				|  |  | 
 |