| @@ -68,7 +68,6 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| } | } | ||||
| try{ | try{ | ||||
| logger.info("请求body{}--"+body); | logger.info("请求body{}--"+body); | ||||
| // JSONObject parameterMap = JSON.parseObject(body); | |||||
| Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class); | Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class); | ||||
| if(parameterMap.isEmpty()){ | if(parameterMap.isEmpty()){ | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确"); | ||||
| @@ -678,6 +678,9 @@ public enum ErrorCode{ | |||||
| ORDER_CREAT_OVERRUN(64000, "重复生成次数超限"), | ORDER_CREAT_OVERRUN(64000, "重复生成次数超限"), | ||||
| CODE_ALREADY_EXISTS(71000, "该code已存在"), | CODE_ALREADY_EXISTS(71000, "该code已存在"), | ||||
| SECRET_NOT_EXISTS(71001, "该秘钥不存在"), | |||||
| SERVICE_LOCKED(71002, "合作商被锁定,无法修改"), | |||||
| ; | ; | ||||
| private int code; | private int code; | ||||
| @@ -4,14 +4,18 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.sm.ServiceVideoRecord; | import com.iformall.domain.po.sm.ServiceVideoRecord; | ||||
| import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | import lombok.Builder; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.NoArgsConstructor; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| @ApiModel(value = "新增生成视频时长记录") | @ApiModel(value = "新增生成视频时长记录") | ||||
| @Data | @Data | ||||
| @Builder | @Builder | ||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class SaveServiceVideoRecordDTO { | public class SaveServiceVideoRecordDTO { | ||||
| @ApiModelProperty("接入商标识") | @ApiModelProperty("接入商标识") | ||||
| private Long serviceId; | private Long serviceId; | ||||
| @@ -2,12 +2,16 @@ package com.iformall.domain.dto.neuver; | |||||
| import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | import lombok.Builder; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.NoArgsConstructor; | |||||
| @ApiModel(value = "新增开放接口秘钥") | @ApiModel(value = "新增开放接口秘钥") | ||||
| @Data | @Data | ||||
| @Builder | @Builder | ||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class SaveThirdPartyApiDTO { | public class SaveThirdPartyApiDTO { | ||||
| @ApiModelProperty("第三方类型(1:API接入,2:私有化接入)") | @ApiModelProperty("第三方类型(1:API接入,2:私有化接入)") | ||||
| private Integer type; | private Integer type; | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.dto.neuver; | |||||
| import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Builder; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| @ApiModel(value = "更新开放接口秘钥状态") | @ApiModel(value = "更新开放接口秘钥状态") | ||||
| @@ -1,14 +1,19 @@ | |||||
| package com.iformall.service.impl; | 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.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.CommonConstants; | import com.iformall.common.CommonConstants; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | ||||
| import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | import com.iformall.domain.dto.neuver.UpdateThirdPartyApiStatusDTO; | ||||
| import com.iformall.domain.po.WxThirdPartyApi; | 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.mapper.WxThirdPartyApiMapper; | ||||
| import com.iformall.service.WxThirdPartyApiService; | import com.iformall.service.WxThirdPartyApiService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -32,6 +37,8 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||||
| @Autowired | @Autowired | ||||
| WxThirdPartyApiMapper wxThirdPartyApiMapper; | WxThirdPartyApiMapper wxThirdPartyApiMapper; | ||||
| @Autowired | |||||
| private ServiceInfoMapper serviceInfoMapper; | |||||
| @Autowired | @Autowired | ||||
| @Qualifier("objectCommonRedisTemplate") | @Qualifier("objectCommonRedisTemplate") | ||||
| @@ -55,6 +62,7 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||||
| WxThirdPartyApi apiQ = new WxThirdPartyApi(); | WxThirdPartyApi apiQ = new WxThirdPartyApi(); | ||||
| apiQ.setAppId(appId); | apiQ.setAppId(appId); | ||||
| apiQ.setAppKey(appKey); | apiQ.setAppKey(appKey); | ||||
| apiQ.setStatus(CommonConstants.STATUS_NORMAL); | |||||
| apiConfig = wxThirdPartyApiMapper.selectOne(new QueryWrapper<>(apiQ)); | apiConfig = wxThirdPartyApiMapper.selectOne(new QueryWrapper<>(apiQ)); | ||||
| RedisCacheUtils.cache(redisTemplate, Constant.publicApi + appId, apiConfig,0l); | RedisCacheUtils.cache(redisTemplate, Constant.publicApi + appId, apiConfig,0l); | ||||
| return apiConfig; | return apiConfig; | ||||
| @@ -73,6 +81,14 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||||
| @Override | @Override | ||||
| public void updateThirdPartyApiStatus(UpdateThirdPartyApiStatusDTO dto) { | 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>() | wxThirdPartyApiMapper.update(null, new LambdaUpdateWrapper<WxThirdPartyApi>() | ||||
| .set(WxThirdPartyApi::getStatus, dto.getStatus()) | .set(WxThirdPartyApi::getStatus, dto.getStatus()) | ||||
| .eq(WxThirdPartyApi::getId, dto.getId())); | .eq(WxThirdPartyApi::getId, dto.getId())); | ||||
| @@ -6,13 +6,12 @@ import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.CommonConstants; | import com.iformall.common.CommonConstants; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.domain.dto.neuver.SaveServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.SaveThirdPartyApiDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoDTO; | |||||
| import com.iformall.domain.dto.neuver.UpdateServiceInfoStatusDTO; | |||||
| import com.iformall.domain.dto.neuver.*; | |||||
| import com.iformall.domain.po.WxThirdPartyApi; | |||||
| import com.iformall.domain.po.sm.ServiceInfo; | import com.iformall.domain.po.sm.ServiceInfo; | ||||
| import com.iformall.exception.BizException; | import com.iformall.exception.BizException; | ||||
| import com.iformall.mapper.ServiceInfoMapper; | import com.iformall.mapper.ServiceInfoMapper; | ||||
| import com.iformall.mapper.WxThirdPartyApiMapper; | |||||
| import com.iformall.service.WxThirdPartyApiService; | import com.iformall.service.WxThirdPartyApiService; | ||||
| import com.iformall.service.sm.ServiceInfoService; | import com.iformall.service.sm.ServiceInfoService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -28,6 +27,8 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||||
| private ServiceInfoMapper serviceInfoMapper; | private ServiceInfoMapper serviceInfoMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxThirdPartyApiService thirdPartyApiService; | private WxThirdPartyApiService thirdPartyApiService; | ||||
| @Autowired | |||||
| private WxThirdPartyApiMapper wxThirdPartyApiMapper; | |||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| @Override | @Override | ||||
| @@ -62,10 +63,19 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||||
| serviceInfoMapper.updateById(UpdateServiceInfoDTO.mapping(dto)); | serviceInfoMapper.updateById(UpdateServiceInfoDTO.mapping(dto)); | ||||
| } | } | ||||
| @Transactional(rollbackFor = Exception.class) | |||||
| @Override | @Override | ||||
| public void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto) { | public void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto) { | ||||
| // 修改合作商状态 | |||||
| serviceInfoMapper.update(null, new LambdaUpdateWrapper<ServiceInfo>() | serviceInfoMapper.update(null, new LambdaUpdateWrapper<ServiceInfo>() | ||||
| .set(ServiceInfo::getStatus, dto.getStatus()) | .set(ServiceInfo::getStatus, dto.getStatus()) | ||||
| .eq(ServiceInfo::getId, dto.getId())); | .eq(ServiceInfo::getId, dto.getId())); | ||||
| if (CommonConstants.STATUS_ABNORMAL.equals(dto.getStatus())) { | |||||
| // 若合作商为锁定状态,则修改秘钥状态 | |||||
| wxThirdPartyApiMapper.update(null, new LambdaUpdateWrapper<WxThirdPartyApi>() | |||||
| .set(WxThirdPartyApi::getStatus, dto.getStatus()) | |||||
| .eq(WxThirdPartyApi::getServiceId, dto.getId())); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||