lyhzzz hace 9 meses
padre
commit
926cff0102

+ 5 - 0
src/main/java/com/fdkankan/manage/httpClient/client/FdKKClient.java

@@ -2,7 +2,9 @@ package com.fdkankan.manage.httpClient.client;
 
 import com.alibaba.fastjson.JSONObject;
 import com.dtflys.forest.annotation.*;
+import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.httpClient.address.FdkkAddressSource;
+import com.fdkankan.manage.vo.request.CaseParam;
 
 import java.util.HashMap;
 
@@ -18,4 +20,7 @@ public interface FdKKClient {
 
     @Get("/ucenter/_manage/_copy_scene")
     JSONObject copyScene( @Query HashMap<String, Object> param ,@Header("sign") String sign);
+
+    @Post("/fusion/case/addScene")
+    ResultData addScene(@JSONBody CaseParam caseParam, @Header("token") String token);
 }

+ 4 - 0
src/main/java/com/fdkankan/manage/mapper/IDictFileMapper.java

@@ -1,7 +1,10 @@
 package com.fdkankan.manage.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.manage.entity.DictFile;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.manage.vo.request.DictFileParam;
+import com.fdkankan.manage.vo.response.DictFileVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IDictFileMapper extends BaseMapper<DictFile> {
 
+    Page<DictFileVo> pageList(Page<Object> objectPage, DictFileParam param);
 }

+ 1 - 3
src/main/java/com/fdkankan/manage/service/impl/CaseNumServiceImpl.java

@@ -59,11 +59,9 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNum> imp
             if(caseNumType == null){
                 caseNumType = new CaseNumType();
                 caseNumType.setType(type);
-                caseNumType.setNumList(Arrays.asList(caseNum.getNum()));
                 map.put(type,caseNumType);
-            }else {
-                caseNumType.getNumList().add(caseNum.getNum());
             }
+            caseNumType.getNumList().add(caseNum.getNum());
         }
         return map;
     }

+ 54 - 14
src/main/java/com/fdkankan/manage/service/impl/CaseServiceImpl.java

@@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.entity.Case;
 import com.fdkankan.manage.entity.CaseNum;
 import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.httpClient.client.FdKKClient;
 import com.fdkankan.manage.mapper.ICaseMapper;
 import com.fdkankan.manage.service.ICaseNumService;
 import com.fdkankan.manage.service.ICaseService;
 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 org.apache.commons.lang3.StringUtils;
@@ -65,10 +68,12 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
     public void checkNumInCase(String num) {
         List<Case> caseByNum = getCaseByNum(num);
         if(!caseByNum.isEmpty()){
-            throw new BusinessException(ResultCode.NUM_IN_CASE);
+            throw new BusinessException(ResultCode.USER_NOT_EXIST);
         }
     }
 
+    @Autowired
+    FdKKClient fdKKClient;
     @Override
     public void addOrUpdate(CaseParam param) {
         Case  caseEntity;
@@ -82,24 +87,59 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
         caseEntity.setUpdateTime(null);
         this.saveOrUpdate(caseEntity);
 
-        if(param.getCaseId() != null){
+        if(param.getSceneNumParam().isEmpty()){
+            caseNumService.delByCaseId(caseEntity.getCaseId());
+            return;
+        }
+
+        List<CaseNumType> newParam = new ArrayList<>();
+        for (CaseNumType caseNumType : param.getSceneNumParam()) {
+            List<Integer> numType = CaseNumTypeUtil.getNumType(caseNumType.getType());
 
-            HashMap<Integer,CaseNumType> map = caseNumService.getCaseNumTypeByCaseId(param.getCaseId());
-            List<Integer> typeKes = param.getSceneNumParam().stream().map(CaseNumType::getType).collect(Collectors.toList());
-            for (Integer key : map.keySet()) {
-                if(!typeKes.contains(key)){
-                    caseNumService.delByCaseIdAndNumList(param.getCaseId(),map.get(key).getNumList(),key);
-                }
+            for (Integer type : numType) {
+                List<String> numList = caseNumType.getNumList().stream().filter(e -> CaseNumTypeUtil.getCaseNumType(e, caseNumType.getType()).equals(type)).collect(Collectors.toList());
+                CaseNumType numType1 = new CaseNumType();
+                numType1.setType(type);
+                numType1.setNumList(numList);
+                newParam.add(numType1);
             }
+        }
+        param.setSceneNumParam(newParam);
 
-            for (CaseNumType paramType : param.getSceneNumParam()) {
-                CaseNumType dbType = map.get(paramType.getType());
-                List<String> delNums = dbType.getNumList().stream().filter(e -> !paramType.getNumList().contains(e)).collect(Collectors.toList());
-                List<String> addNums = paramType.getNumList().stream().filter(e -> !dbType.getNumList().contains(e)).collect(Collectors.toList());
-                caseNumService.saveByCaseIdAndNumList(param.getCaseId(),addNums,paramType.getType());
-                caseNumService.delByCaseIdAndNumList(param.getCaseId(),delNums,paramType.getType());
+        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){
+            throw new BusinessException(ResultCode.SYSTEM_ERROR);
         }
 
+
+
+//        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());
+//        }
+
     }
 }

+ 1 - 1
src/main/java/com/fdkankan/manage/service/impl/CommonUploadServiceImpl.java

@@ -42,7 +42,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         dictFile.setUploadId(upload.getId());
         dictFile.setDictId(dictId);
         dictFile.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
-        dictFileService.addOrUpdate(dictFile);
+        dictFileService.saveOrUpdate(dictFile);
 
         return upload;
     }

+ 6 - 0
src/main/java/com/fdkankan/manage/service/impl/DictFileServiceImpl.java

@@ -49,6 +49,10 @@ public class DictFileServiceImpl extends ServiceImpl<IDictFileMapper, DictFile>
         if(StringUtils.isBlank(param.getTypeKey())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
+
+        Page<DictFileVo> pageVo = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
+
+
         LambdaQueryWrapper<DictFile> wrapper = new LambdaQueryWrapper<>();
         if(StringUtils.isNotBlank(param.getName())){
             wrapper.like(DictFile::getName,param.getName());
@@ -56,6 +60,8 @@ public class DictFileServiceImpl extends ServiceImpl<IDictFileMapper, DictFile>
         if(param.getDictId() != null){
             wrapper.eq(DictFile::getDictId,param.getDictId());
         }
+        if(param.getFileFormats() != null && !param.getFileFormats().isEmpty()){
+        }
         wrapper.eq(DictFile::getSysUserId, StpUtil.getLoginId());
         wrapper.orderByDesc(DictFile::getId);
 

+ 2 - 2
src/main/java/com/fdkankan/manage/util/CaseNumTypeUtil.java

@@ -18,9 +18,9 @@ public class CaseNumTypeUtil {
     }
     public static Integer getType(Integer numType){
         if(numType == 2 || numType == 5){
-            return 1;
+            return 0;
         }
-        return 0;
+        return 1;
     }
 
     public static List<Integer> getNumType(Integer type){

+ 11 - 0
src/main/java/com/fdkankan/manage/vo/request/CaseParam.java

@@ -8,6 +8,17 @@ import java.util.List;
 
 @Data
 public class CaseParam extends RequestBase{
+    /**
+     {
+     "caseTitle": "测试1",
+     "sceneNumParam": [
+     {"type":0,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]},
+     {"type":1,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]}
+     ]
+     }
+
+
+     */
 
     private Integer caseId;
     private String caseTitle;

+ 3 - 0
src/main/java/com/fdkankan/manage/vo/request/DictFileParam.java

@@ -2,10 +2,13 @@ package com.fdkankan.manage.vo.request;
 
 import lombok.Data;
 
+import java.util.List;
+
 @Data
 public class DictFileParam extends RequestBase{
     private String name;
     private Integer dictId;
     private String typeKey;
     private Integer fileType;
+    private List<String> fileFormats;
 }

+ 28 - 0
src/main/resources/mapper/manage/DictFileMapper.xml

@@ -2,4 +2,32 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.manage.mapper.IDictFileMapper">
 
+
+<!--    private String name;
+    private Integer dictId;
+    private String typeKey;
+    private Integer fileType;
+    private List<String> fileFormats;-->
+    <select id="pageList" resultType="com.fdkankan.manage.vo.response.DictFileVo">
+        SELECT * from t_dict_file df
+                          LEFT JOIN t_dict d on df.dict_id = d.id
+                          LEFT JOIN t_common_upload cu on df.upload_id = cu.id
+        where df.rec_status = 'A'
+        <if test="param.name != null and param.name !=''">
+            and df.name = #{param.name}
+        </if>
+        <if test="param.typeKey != null and param.typeKey !=''">
+            and df.type_key = #{param.typeKey}
+        </if>
+        <if test="param.fileType != null">
+            and cu.file_type = #{param.fileType}
+        </if>
+        <if test="param.fileFormats != null and param.fileFormats.size>0">
+            and cu.file_format in
+            <foreach collection="param.fileFormats" item="fileFormat" open="(" separator="," close=")">
+                #{fileFormat}
+            </foreach>
+        </if>
+
+        </select>
 </mapper>