|
@@ -3,22 +3,19 @@ package com.om.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.om.entity.dto.AppBaseDTO;
|
|
|
+import com.om.entity.dto.GuidDTO;
|
|
|
import com.om.entity.dto.VciQueryPageDTO;
|
|
|
-import com.om.entity.po.DiagnosticLog;
|
|
|
-import com.om.entity.po.User;
|
|
|
-import com.om.entity.po.UserVci;
|
|
|
-import com.om.entity.po.VciInfo;
|
|
|
-import com.om.entity.vo.DiaLogQueryPageVO;
|
|
|
-import com.om.entity.vo.UserVciVO;
|
|
|
-import com.om.entity.vo.VciQueryPageVO;
|
|
|
+import com.om.entity.po.*;
|
|
|
+import com.om.entity.vo.*;
|
|
|
import com.om.exception.BadReqException;
|
|
|
import com.om.mapper.UserMapper;
|
|
|
import com.om.mapper.VciInfoMapper;
|
|
|
-import com.om.service.IUserService;
|
|
|
-import com.om.service.IUserVciService;
|
|
|
-import com.om.service.IVciInfoService;
|
|
|
+import com.om.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.om.utils.JwtUtils;
|
|
|
import com.om.utils.Result;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -26,6 +23,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -44,6 +42,31 @@ public class VciInfoServiceImpl extends ServiceImpl<VciInfoMapper, VciInfo> impl
|
|
|
@Resource
|
|
|
private IUserVciService userVciService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private JwtUtils jwtUtils;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ISdkClientsService sdkClientsService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ISdkVersionInfoService sdkVersionInfoService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ISdkVersionDescribeService sdkVersionDescribeService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IPcbVersionInfoService pcbVersionInfoService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IAppService appService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IAppVersionDescribeService appVersionDescribeService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IAppsClientsService appsClientsService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Result addVci(VciInfo vciInfo) {
|
|
|
if (BeanUtil.isEmpty(vciInfo)){
|
|
@@ -159,5 +182,94 @@ public class VciInfoServiceImpl extends ServiceImpl<VciInfoMapper, VciInfo> impl
|
|
|
return Result.ok(vo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result<AppSDKVO> VciUpdate(AppBaseDTO dto) {
|
|
|
+ if (BeanUtil.isEmpty(dto)){
|
|
|
+ throw new BadReqException("数据为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String guid = dto.getGuid();
|
|
|
+ GuidDTO guidDTO = jwtUtils.getGuidDTOFromToken(guid);
|
|
|
+ String clientNum = guidDTO.getClientNum();
|
|
|
+ String language = dto.getLanguage();
|
|
|
+ Integer userId = guidDTO.getUserId();
|
|
|
+
|
|
|
+ AppSDKVO appSDKVO = new AppSDKVO();
|
|
|
+ List<SDKData> sdkData = new ArrayList<>();
|
|
|
+ List<appData> appData = new ArrayList<>();
|
|
|
+
|
|
|
+ //根据客户端clientNum查询sdk
|
|
|
+ List<Integer> sdkIds = sdkClientsService.lambdaQuery()
|
|
|
+ .eq(SdkClients::getClientNum, clientNum)
|
|
|
+ .list().stream().map(c -> c.getSdkId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<SdkVersionInfo> sdkVersionInfos = sdkVersionInfoService.listByIds(sdkIds);
|
|
|
+ for (SdkVersionInfo sdkVersionInfo : sdkVersionInfos) {
|
|
|
+ SDKData sdk = BeanUtil.copyProperties(sdkVersionInfo, SDKData.class);
|
|
|
+ sdk.setVersion(sdkVersionInfo.getVersionNum());
|
|
|
+ sdk.setUrl(sdkVersionInfo.getSavePath());
|
|
|
+
|
|
|
+ //根据pcbId查询pcb
|
|
|
+ PcbVersionInfo pcbVersionInfo = pcbVersionInfoService.getById(sdkVersionInfo.getId());
|
|
|
+ if(BeanUtil.isEmpty(pcbVersionInfo)){
|
|
|
+ throw new BadReqException("该PCB版本不存在!!!");
|
|
|
+ }
|
|
|
+
|
|
|
+ SdkVersionDescribe sdkVersionDescribe = sdkVersionDescribeService.lambdaQuery()
|
|
|
+ .eq(SdkVersionDescribe::getSdkId, sdkVersionInfo.getId())
|
|
|
+ .eq(SdkVersionDescribe::getLanguage, language)
|
|
|
+ .one();
|
|
|
+
|
|
|
+ if (BeanUtil.isEmpty(sdkVersionDescribe)){
|
|
|
+ throw new BadReqException("SDK版本描述不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ sdk.setDescription(sdkVersionDescribe.getDescription());
|
|
|
+ sdk.setPcbVersion(pcbVersionInfo.getVersionNum());
|
|
|
+ sdkData.add(sdk);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> appIds = appsClientsService.lambdaQuery()
|
|
|
+ .eq(AppsClients::getClientNum, clientNum)
|
|
|
+ .list().stream().map(c -> c.getAppId()).collect(Collectors.toList());
|
|
|
+ List<App> apps = appService.listByIds(appIds);
|
|
|
+ if (apps.isEmpty()){
|
|
|
+ return Result.ok();
|
|
|
+ }
|
|
|
+ for (App app : apps) {
|
|
|
+ appData appData1 = BeanUtil.copyProperties(app, appData.class);
|
|
|
+ appData1.setVersion(app.getVersionNum());
|
|
|
+ appData1.setUrl(app.getSavePath());
|
|
|
+
|
|
|
+ AppVersionDescribe appVersionDescribe = appVersionDescribeService.lambdaQuery()
|
|
|
+ .eq(AppVersionDescribe::getAppId, app.getId())
|
|
|
+ .eq(AppVersionDescribe::getLanguage, language)
|
|
|
+ .one();
|
|
|
+ if (BeanUtil.isEmpty(appVersionDescribe)){
|
|
|
+ throw new BadReqException("app版本描述不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ appData1.setDescription(appVersionDescribe.getDescription());
|
|
|
+ Integer sdkId = app.getSdkId();
|
|
|
+ //根据sdkid查询sdk版本
|
|
|
+ SdkVersionInfo sdkVersionInfo = sdkVersionInfoService.getById(sdkId);
|
|
|
+ if (BeanUtil.isEmpty(sdkVersionInfo)){
|
|
|
+ throw new BadReqException("该sdk版本不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ appData1.setMinSdkVersion(sdkVersionInfo.getVersionNum());
|
|
|
+
|
|
|
+ appData.add(appData1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ appSDKVO.setAppData(appData);
|
|
|
+ appSDKVO.setSdkData(sdkData);
|
|
|
+ return Result.ok(appSDKVO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|