|
@@ -3,7 +3,9 @@ package com.fdkankan.manage.service.impl;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.common.util.SecurityUtil;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.common.ResultData;
|
|
@@ -16,8 +18,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage.util.CaseNumTypeUtil;
|
|
|
import com.fdkankan.manage.vo.request.CaseNumType;
|
|
|
import com.fdkankan.manage.vo.request.CaseParam;
|
|
|
-import com.fdkankan.manage.vo.response.SceneAuthVo;
|
|
|
-import com.fdkankan.manage.vo.response.UserAuthSceneVo;
|
|
|
+import com.fdkankan.manage.vo.request.CaseUserSceneParam;
|
|
|
+import com.fdkankan.manage.vo.response.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.bouncycastle.jcajce.provider.asymmetric.rsa.AlgorithmParametersSpi;
|
|
@@ -43,6 +45,16 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
|
|
|
@Autowired
|
|
|
ICaseNumService caseNumService;
|
|
|
+ @Autowired
|
|
|
+ IJyUserService jyUserService;
|
|
|
+ @Autowired
|
|
|
+ IJySceneAuthService jySceneAuthService;
|
|
|
+ @Autowired
|
|
|
+ IJySceneUserAuthService jySceneUserAuthService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ ICaseFusionService caseFusionService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -90,78 +102,23 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
|
|
|
@Override
|
|
|
public void addOrUpdate(CaseParam param) {
|
|
|
- Case caseEntity;
|
|
|
- if(param.getCaseId() == null){
|
|
|
- caseEntity = new Case();
|
|
|
- caseEntity.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
- caseEntity.setUserName((String)StpUtil.getExtra("userName"));
|
|
|
- }else {
|
|
|
- caseEntity = this.getById(param.getCaseId());
|
|
|
+ if(param.getCaseId() != null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
- caseEntity.setCaseTitle(param.getCaseTitle());
|
|
|
- caseEntity.setUpdateTime(null);
|
|
|
- this.saveOrUpdate(caseEntity);
|
|
|
-
|
|
|
- HashMap<Integer,HashSet<String>> numTypeMap = new HashMap<>();
|
|
|
- for (Integer type : CaseNumTypeUtil.getNumType()) {
|
|
|
- numTypeMap.put(type,new HashSet<>());
|
|
|
+ JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
|
|
|
+ if(jyUser == null){
|
|
|
+ throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
|
}
|
|
|
+ Case caseEntity = new Case();
|
|
|
+ caseEntity.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
+ caseEntity.setPlatformId(jyUser.getPlatformId());
|
|
|
+ caseEntity.setUserName((String)StpUtil.getExtra("userName"));
|
|
|
+ caseEntity.setCaseTitle(param.getCaseTitle());
|
|
|
+ this.save(caseEntity);
|
|
|
|
|
|
for (CaseNumType caseNumType : param.getSceneNumParam()) {
|
|
|
- List<Integer> numType = CaseNumTypeUtil.getNumType(caseNumType.getType());
|
|
|
- for (Integer type : numType) {
|
|
|
- List<String> numList = caseNumType.getNumList().stream().filter(e ->StringUtils.isNotBlank(e) && CaseNumTypeUtil.getCaseNumType(e, caseNumType.getType()) != null
|
|
|
- && CaseNumTypeUtil.getCaseNumType(e, caseNumType.getType()).equals(type)).collect(Collectors.toList());
|
|
|
- if(numTypeMap.get(type) != null){
|
|
|
- numTypeMap.get(type).addAll(numList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<CaseNumType> newParam = new ArrayList<>();
|
|
|
- for (Integer type : numTypeMap.keySet()) {
|
|
|
- CaseNumType numType1 = new CaseNumType();
|
|
|
- numType1.setType(type);
|
|
|
- numType1.setNumList(new ArrayList<>(numTypeMap.get(type)));
|
|
|
- newParam.add(numType1);
|
|
|
- }
|
|
|
- param.setSceneNumParam(newParam);
|
|
|
- param.setCaseId(caseEntity.getCaseId());
|
|
|
- try {
|
|
|
- ResultData resultData = fdKKClient.addScene(param, StpUtil.getTokenValue());
|
|
|
- if(resultData.getCode() !=0){
|
|
|
- throw new BusinessException(resultData.getCode(),resultData.getMessage());
|
|
|
- }
|
|
|
- }catch (BusinessException e){
|
|
|
- throw e;
|
|
|
- }catch (Exception e){
|
|
|
- log.info("error:{}",e);
|
|
|
- throw new BusinessException(ResultCode.SYSTEM_ERROR);
|
|
|
+ caseNumService.add(caseEntity.getCaseId(),caseNumType);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// HashMap<Integer,CaseNumType> map = caseNumService.getCaseNumTypeByCaseId(caseEntity.getCaseId());
|
|
|
-// List<Integer> typeKes = param.getSceneNumParam().stream().map(CaseNumType::getType).collect(Collectors.toList());
|
|
|
-// for (Integer key : map.keySet()) {
|
|
|
-// if(!typeKes.contains(key)){
|
|
|
-// caseNumService.delByCaseIdAndNumList(caseEntity.getCaseId(),map.get(key).getNumList(),key);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// for (CaseNumType paramType : param.getSceneNumParam()) {
|
|
|
-// CaseNumType dbType = map.get(paramType.getType());
|
|
|
-// if(dbType == null || dbType.getNumList().isEmpty()){
|
|
|
-// caseNumService.saveByCaseIdAndNumList(caseEntity.getCaseId(),paramType.getNumList(),paramType.getType());
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<String> delNums = dbType.getNumList().stream().filter(e -> !paramType.getNumList().contains(e)).collect(Collectors.toList());
|
|
|
-// caseNumService.delByCaseIdAndNumList(caseEntity.getCaseId(),delNums,paramType.getType());
|
|
|
-//
|
|
|
-// List<String> addNums = paramType.getNumList().stream().filter(e -> !dbType.getNumList().contains(e)).collect(Collectors.toList());
|
|
|
-// caseNumService.saveByCaseIdAndNumList(caseEntity.getCaseId(),addNums,paramType.getType());
|
|
|
-// }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -175,4 +132,14 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updatePlatformIdById(Integer caseId, Integer platformId) {
|
|
|
+ LambdaUpdateWrapper<Case> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(Case::getCaseId,caseId);
|
|
|
+ wrapper.set(Case::getPlatformId,platformId);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|