|
|
@ -7,9 +7,7 @@ import com.ccsens.ptos_open.bean.dto.BusinessDto; |
|
|
|
import com.ccsens.ptos_open.bean.po.OpenBusiness; |
|
|
|
import com.ccsens.ptos_open.bean.po.OpenBusinessPlugin; |
|
|
|
import com.ccsens.ptos_open.bean.po.OpenBusinessPluginExample; |
|
|
|
import com.ccsens.ptos_open.bean.po.OpenPluginWithBLOBs; |
|
|
|
import com.ccsens.ptos_open.bean.vo.BusinessVo; |
|
|
|
import com.ccsens.ptos_open.bean.vo.PluginVo; |
|
|
|
import com.ccsens.ptos_open.persist.dao.BusinessDao; |
|
|
|
import com.ccsens.ptos_open.persist.dao.PluginDao; |
|
|
|
import com.ccsens.ptos_open.persist.mapper.OpenBusinessPluginMapper; |
|
|
@ -18,7 +16,6 @@ import com.ccsens.ptos_open.util.OpenCodeError; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
@ -45,8 +42,8 @@ public class BusinessService implements IBusinessService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<BusinessVo.BusinessInfo> queryBusiness(BusinessDto.QueryByPage param, Long userId) { |
|
|
|
PageHelper.startPage(param.getPageNum(),param.getPageSize()); |
|
|
|
List<BusinessVo.BusinessInfo> pluginInfos = businessDao.queryBusinessList(param.getDepth(), param.getName(),param.getPub(),userId); |
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize()); |
|
|
|
List<BusinessVo.BusinessInfo> pluginInfos = businessDao.queryBusinessList(param.getDepth(), param.getName(), param.getPub(), userId); |
|
|
|
return new PageInfo<>(pluginInfos); |
|
|
|
} |
|
|
|
|
|
|
@ -78,19 +75,19 @@ public class BusinessService implements IBusinessService { |
|
|
|
public void relevancePlugin(BusinessDto.RelevancePlugin param, Long userId) { |
|
|
|
//判断插件是否存在
|
|
|
|
Boolean p = pluginDao.verifyById(param.getPluginId()); |
|
|
|
if(p == null || !p){ |
|
|
|
if (p == null || !p) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_PLUGIN); |
|
|
|
} |
|
|
|
//判断业务是否存在
|
|
|
|
Boolean b = businessDao.verifyById(param.getBusinessId()); |
|
|
|
if(b == null || !b){ |
|
|
|
if (b == null || !b) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_BUSINESS); |
|
|
|
} |
|
|
|
//验证业务下已经关联此插件,则提示
|
|
|
|
OpenBusinessPluginExample businessPluginExample = new OpenBusinessPluginExample(); |
|
|
|
businessPluginExample.createCriteria().andBusinessIdEqualTo(param.getBusinessId()).andPluginIdEqualTo(param.getPluginId()); |
|
|
|
List<OpenBusinessPlugin> openBusinessPlugins = businessPluginMapper.selectByExample(businessPluginExample); |
|
|
|
if(CollectionUtil.isNotEmpty(openBusinessPlugins)){ |
|
|
|
if (CollectionUtil.isNotEmpty(openBusinessPlugins)) { |
|
|
|
throw new BaseException(OpenCodeError.BUSINESS_PLUGIN); |
|
|
|
} |
|
|
|
//添加业务插件关联关系
|
|
|
@ -105,8 +102,8 @@ public class BusinessService implements IBusinessService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<BusinessVo.BusinessPlugin> businessQueryPlugin(BusinessDto.BusinessQueryPlugin param, Long userId) { |
|
|
|
PageHelper.startPage(param.getPageNum(),param.getPageSize()); |
|
|
|
List<BusinessVo.BusinessPlugin> businessPluginList = businessDao.businessQueryPlugin(param.getBusinessId(),userId); |
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize()); |
|
|
|
List<BusinessVo.BusinessPlugin> businessPluginList = businessDao.businessQueryPlugin(param.getBusinessId(), userId); |
|
|
|
return new PageInfo<>(businessPluginList); |
|
|
|
} |
|
|
|
|
|
|
@ -114,11 +111,11 @@ public class BusinessService implements IBusinessService { |
|
|
|
public void updateConfig(BusinessDto.UpdateConfig param, Long userId) { |
|
|
|
//检查关联的插件是否存在
|
|
|
|
OpenBusinessPlugin businessPlugin = businessPluginMapper.selectByPrimaryKey(param.getBusinessPluginId()); |
|
|
|
if(ObjectUtil.isNull(businessPlugin)){ |
|
|
|
if (ObjectUtil.isNull(businessPlugin)) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_PLUGIN); |
|
|
|
} |
|
|
|
Boolean p = pluginDao.verifyById(businessPlugin.getPluginId()); |
|
|
|
if(!p){ |
|
|
|
if (!p) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_PLUGIN); |
|
|
|
} |
|
|
|
//修改关联的信息
|
|
|
@ -126,4 +123,27 @@ public class BusinessService implements IBusinessService { |
|
|
|
businessPlugin.setDebug(param.getDebug()); |
|
|
|
businessPluginMapper.updateByPrimaryKeySelective(businessPlugin); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public BusinessVo.BusinessInfo queryIdBusiness(BusinessDto.QueryIdBusiness param, Long userId) { |
|
|
|
//检查该id业务是否存在
|
|
|
|
Boolean b = businessDao.verifyById(param.getBusinessId()); |
|
|
|
if (b == null || !b) { |
|
|
|
throw new BaseException(OpenCodeError.NOT_BUSINESS); |
|
|
|
} |
|
|
|
//查询业务信息
|
|
|
|
OpenBusiness openBusiness = businessDao.selectByPrimaryKey(param.getBusinessId()); |
|
|
|
BusinessVo.BusinessInfo businessInfo = new BusinessVo.BusinessInfo(); |
|
|
|
businessInfo.setId(openBusiness.getId()); |
|
|
|
businessInfo.setName(openBusiness.getName()); |
|
|
|
businessInfo.setSecret(openBusiness.getSecret()); |
|
|
|
businessInfo.setPub(openBusiness.getPub()); |
|
|
|
businessInfo.setCreateTime(openBusiness.getCreatedAt().getTime()); |
|
|
|
businessInfo.setUpdateTime(openBusiness.getUpdatedAt().getTime()); |
|
|
|
businessInfo.setDescription(openBusiness.getDescription()); |
|
|
|
businessInfo.setStartUsing(openBusiness.getStartUsing()); |
|
|
|
businessInfo.setAppId(openBusiness.getAppId()); |
|
|
|
return businessInfo; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|