浏览代码

feat:修改合作商和秘钥状态逻辑

photo
xmzhao71 1年前
父节点
当前提交
4dcfc2834f
共有 7 个文件被更改,包括 42 次插入5 次删除
  1. +0
    -1
      open-api/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java
  2. +3
    -0
      suimangService/src/main/java/com/iformall/common/ErrorCode.java
  3. +4
    -0
      suimangService/src/main/java/com/iformall/domain/dto/neuver/SaveServiceVideoRecordDTO.java
  4. +4
    -0
      suimangService/src/main/java/com/iformall/domain/dto/neuver/SaveThirdPartyApiDTO.java
  5. +1
    -0
      suimangService/src/main/java/com/iformall/domain/dto/neuver/UpdateThirdPartyApiStatusDTO.java
  6. +16
    -0
      suimangService/src/main/java/com/iformall/service/impl/WxThirdPartyApiServiceImpl.java
  7. +14
    -4
      suimangService/src/main/java/com/iformall/service/sm/impl/ServiceInfoServiceImpl.java

+ 0
- 1
open-api/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java 查看文件

@@ -68,7 +68,6 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
}
try{
logger.info("请求body{}--"+body);
// JSONObject parameterMap = JSON.parseObject(body);
Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class);
if(parameterMap.isEmpty()){
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数格式不正确");


+ 3
- 0
suimangService/src/main/java/com/iformall/common/ErrorCode.java 查看文件

@@ -678,6 +678,9 @@ public enum ErrorCode{
ORDER_CREAT_OVERRUN(64000, "重复生成次数超限"),

CODE_ALREADY_EXISTS(71000, "该code已存在"),

SECRET_NOT_EXISTS(71001, "该秘钥不存在"),
SERVICE_LOCKED(71002, "合作商被锁定,无法修改"),
;

private int code;


+ 4
- 0
suimangService/src/main/java/com/iformall/domain/dto/neuver/SaveServiceVideoRecordDTO.java 查看文件

@@ -4,14 +4,18 @@ import com.iformall.common.IdWorker;
import com.iformall.domain.po.sm.ServiceVideoRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@ApiModel(value = "新增生成视频时长记录")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SaveServiceVideoRecordDTO {
@ApiModelProperty("接入商标识")
private Long serviceId;


+ 4
- 0
suimangService/src/main/java/com/iformall/domain/dto/neuver/SaveThirdPartyApiDTO.java 查看文件

@@ -2,12 +2,16 @@ package com.iformall.domain.dto.neuver;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@ApiModel(value = "新增开放接口秘钥")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SaveThirdPartyApiDTO {
@ApiModelProperty("第三方类型(1:API接入,2:私有化接入)")
private Integer type;


+ 1
- 0
suimangService/src/main/java/com/iformall/domain/dto/neuver/UpdateThirdPartyApiStatusDTO.java 查看文件

@@ -2,6 +2,7 @@ package com.iformall.domain.dto.neuver;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

@ApiModel(value = "更新开放接口秘钥状态")


+ 16
- 0
suimangService/src/main/java/com/iformall/service/impl/WxThirdPartyApiServiceImpl.java 查看文件

@@ -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()));


+ 14
- 4
suimangService/src/main/java/com/iformall/service/sm/impl/ServiceInfoServiceImpl.java 查看文件

@@ -6,13 +6,12 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.CommonConstants;
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.exception.BizException;
import com.iformall.mapper.ServiceInfoMapper;
import com.iformall.mapper.WxThirdPartyApiMapper;
import com.iformall.service.WxThirdPartyApiService;
import com.iformall.service.sm.ServiceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +27,8 @@ public class ServiceInfoServiceImpl implements ServiceInfoService {
private ServiceInfoMapper serviceInfoMapper;
@Autowired
private WxThirdPartyApiService thirdPartyApiService;
@Autowired
private WxThirdPartyApiMapper wxThirdPartyApiMapper;

@Transactional(rollbackFor = Exception.class)
@Override
@@ -62,10 +63,19 @@ public class ServiceInfoServiceImpl implements ServiceInfoService {
serviceInfoMapper.updateById(UpdateServiceInfoDTO.mapping(dto));
}

@Transactional(rollbackFor = Exception.class)
@Override
public void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto) {
// 修改合作商状态
serviceInfoMapper.update(null, new LambdaUpdateWrapper<ServiceInfo>()
.set(ServiceInfo::getStatus, dto.getStatus())
.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()));
}
}
}

正在加载...
取消
保存