|
@ -5,13 +5,13 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
import com.ccsens.ptos_open.bean.dto.BusinessDto; |
|
|
import com.ccsens.ptos_open.bean.dto.PluginDto; |
|
|
import com.ccsens.ptos_open.bean.dto.PluginDto; |
|
|
import com.ccsens.ptos_open.bean.po.OpenPlugin; |
|
|
import com.ccsens.ptos_open.bean.po.*; |
|
|
import com.ccsens.ptos_open.bean.po.OpenPluginImg; |
|
|
import com.ccsens.ptos_open.bean.vo.BusinessVo; |
|
|
import com.ccsens.ptos_open.bean.po.OpenPluginImgExample; |
|
|
|
|
|
import com.ccsens.ptos_open.bean.po.OpenPluginWithBLOBs; |
|
|
|
|
|
import com.ccsens.ptos_open.bean.vo.PluginVo; |
|
|
import com.ccsens.ptos_open.bean.vo.PluginVo; |
|
|
import com.ccsens.ptos_open.persist.dao.PluginDao; |
|
|
import com.ccsens.ptos_open.persist.dao.PluginDao; |
|
|
|
|
|
import com.ccsens.ptos_open.persist.dao.UserDao; |
|
|
import com.ccsens.ptos_open.persist.mapper.OpenPluginImgMapper; |
|
|
import com.ccsens.ptos_open.persist.mapper.OpenPluginImgMapper; |
|
|
import com.ccsens.ptos_open.util.OpenCodeError; |
|
|
import com.ccsens.ptos_open.util.OpenCodeError; |
|
|
import com.ccsens.util.CodeEnum; |
|
|
import com.ccsens.util.CodeEnum; |
|
@ -34,7 +34,10 @@ import java.util.List; |
|
|
@Service |
|
|
@Service |
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
|
public class PluginService implements IPluginService { |
|
|
public class PluginService implements IPluginService { |
|
|
|
|
|
@Resource |
|
|
|
|
|
private OpenPluginImgMapper imgMapper; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private UserDao userDao; |
|
|
@Resource |
|
|
@Resource |
|
|
private PluginDao pluginDao; |
|
|
private PluginDao pluginDao; |
|
|
@Resource |
|
|
@Resource |
|
@ -169,6 +172,49 @@ public class PluginService implements IPluginService { |
|
|
pluginDao.updateByPrimaryKeySelective(plugin); |
|
|
pluginDao.updateByPrimaryKeySelective(plugin); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public PluginVo.PluginInfo queryIdPlugin(PluginDto.QueryIdPlugin param, Long userId) { |
|
|
|
|
|
|
|
|
|
|
|
//查询插件信息
|
|
|
|
|
|
OpenPluginWithBLOBs openPlugin = pluginDao.selectByPrimaryKey(param.getId()); |
|
|
|
|
|
if(ObjectUtil.isNull(openPlugin)){ |
|
|
|
|
|
throw new BaseException(OpenCodeError.NOT_PLUGIN); |
|
|
|
|
|
} |
|
|
|
|
|
//返回插件信息
|
|
|
|
|
|
PluginVo.PluginInfo pluginInfo = new PluginVo.PluginInfo(); |
|
|
|
|
|
pluginInfo.setId(openPlugin.getId()); |
|
|
|
|
|
pluginInfo.setName(openPlugin.getName()); |
|
|
|
|
|
pluginInfo.setVersions(openPlugin.getVersions()); |
|
|
|
|
|
pluginInfo.setIntro(openPlugin.getIntro()); |
|
|
|
|
|
pluginInfo.setUpdatedTime(openPlugin.getUpdatedAt().getTime()); |
|
|
|
|
|
pluginInfo.setAuthorId(openPlugin.getCreatorId()); |
|
|
|
|
|
//作者id查user表
|
|
|
|
|
|
String userName = userDao.getUserNameById(openPlugin.getCreatorId()); |
|
|
|
|
|
pluginInfo.setAuthorName(userName); |
|
|
|
|
|
//通过id查询预览图
|
|
|
|
|
|
OpenPluginImgExample imgExample = new OpenPluginImgExample(); |
|
|
|
|
|
imgExample.createCriteria().andPluginIdEqualTo(openPlugin.getId()).andTypeEqualTo((byte)0); |
|
|
|
|
|
List<OpenPluginImg> Img =imgMapper.selectByExample(imgExample); |
|
|
|
|
|
String path = null; |
|
|
|
|
|
if(Img != null && Img.size() != 0){ |
|
|
|
|
|
Img.get(0); |
|
|
|
|
|
path = Img.get(0).getFilePath(); |
|
|
|
|
|
} |
|
|
|
|
|
pluginInfo.setPreview(path); |
|
|
|
|
|
|
|
|
|
|
|
if(openPlugin.getCreatorId() == userId) { |
|
|
|
|
|
Byte main = 1; |
|
|
|
|
|
pluginInfo.setMine(main); |
|
|
|
|
|
} else { |
|
|
|
|
|
Byte main = 0; |
|
|
|
|
|
pluginInfo.setMine(main); |
|
|
|
|
|
} |
|
|
|
|
|
pluginInfo.setHtml(openPlugin.getHtml()); |
|
|
|
|
|
pluginInfo.setCss(openPlugin.getCss()); |
|
|
|
|
|
pluginInfo.setJs(openPlugin.getJs()); |
|
|
|
|
|
pluginInfo.setConfig(openPlugin.getConfig()); |
|
|
|
|
|
return pluginInfo; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|