Explorar o código

事件增删改查

lwhhszx hai 1 ano
pai
achega
7bcda134a1

+ 7 - 1
src/main/java/cn/cslg/pas/common/dto/business/EventDTO.java

@@ -3,9 +3,13 @@ package cn.cslg.pas.common.dto.business;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import org.joda.time.DateTime;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * <p>
@@ -30,6 +34,8 @@ public class EventDTO {
     @Schema(description = "场景id")
  private Integer scenarioId;
     @Schema(description = "发生时间")
- private DateTime eventDate;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date eventDate;
 
 }

+ 16 - 0
src/main/java/cn/cslg/pas/common/vo/ConditionVO.java

@@ -0,0 +1,16 @@
+package cn.cslg.pas.common.vo;
+
+import lombok.Data;
+
+/**
+ * 实体类栏位信息
+ */
+@Data
+public class ConditionVO {
+    private String name;
+    private String type;
+    private String value;
+    private Boolean ifSearch;
+    private Boolean ifGroup;
+
+}

+ 15 - 0
src/main/java/cn/cslg/pas/common/vo/EntityVO.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.common.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 实体类表以及栏位信息
+ */
+@Data
+public class EntityVO {
+    private String tableName;
+    private List<ConditionVO> conditionDTOList;
+
+}

+ 47 - 0
src/main/java/cn/cslg/pas/common/vo/business/EventVO.java

@@ -0,0 +1,47 @@
+package cn.cslg.pas.common.vo.business;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 事件DTO类
+ * </p>
+ *
+ * @author 李仁杰
+ * @since 2022-10-20
+ */
+@Data
+/*数据库中的表对应的类
+ */
+public class EventVO {
+    @Schema(description = "id")
+    private Integer id;
+    @Schema(description = "名称")
+    private String name;
+    @Schema(description = "描述")
+    private String description;
+    @Schema(description = "客户id")
+    private Integer clientId;
+    @Schema(description = "客户名称")
+    private String clientName;
+    @Schema(description = "场景id")
+    private Integer scenarioId;
+    @Schema(description = "场景名称")
+    private Integer scenarioName;
+    @Schema(description = "发生时间")
+   private Date eventDate;
+    @Schema(description = "创建时间")
+    private Date createTime;
+    @Schema(description = "创建人")
+    private String createName;
+    @Schema(description = "创建人Id")
+    private String createId;
+    @Schema(description = "报告数量")
+    private Integer reportProjectNum;
+    @Schema(description = "专题库数量")
+    private Integer patentProjectNum;
+}

+ 35 - 5
src/main/java/cn/cslg/pas/controller/CommonController.java

@@ -2,19 +2,49 @@ package cn.cslg.pas.controller;
 
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.EntityVO;
+import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
+import cn.cslg.pas.service.business.CommonService;
+import cn.cslg.pas.service.business.SystemDictService;
+import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Slf4j
 @RequestMapping(Constants.API_XiaoSHI + "/common")
 @RestController
 public class CommonController {
-    private String getQueryConditions(String aa) {
-
+    @Autowired
+    private SystemDictService systemDictService;
+    @Autowired
+    private CommonService commonService;
 
-        return "";
+    @PostMapping("getParams")
+    @Operation(summary = "获得实体类栏位信息")
+    public Response getQueryConditions(@RequestBody List<String> tables) {
+        List<EntityVO> vos = commonService.getQueryConditions(tables);
+        return Response.success(vos);
     }
 
+    @GetMapping("data")
+    @Operation(summary = "通用数据")
+    public Object getCommonData(String keys) {
+        List<String> typeList = StringUtils.changeStringToString(keys, ",");
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(typeList);
+        Map<String, Object> map = new HashMap<>();
+        for (String type : typeList) {
+            map.put(type, systemDictList.stream().filter(item -> item.getType().equals(type)).collect(Collectors.toList()));
+        }
+        return Response.success(map);
+    }
 
 }

+ 24 - 14
src/main/java/cn/cslg/pas/controller/EventController.java

@@ -6,6 +6,7 @@ import cn.cslg.pas.common.model.cronModel.GroupVO;
 import cn.cslg.pas.common.model.request.StringGroupRequest;
 import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
 import com.alibaba.fastjson.JSONObject;
@@ -30,52 +31,61 @@ import java.util.List;
 public class EventController {
     @Autowired
     private BusinessFactory businessFactory;
+
     @Operation(summary = "查询事件")
     @PostMapping("/queryEvent")
-    public String  queryEvent( StringRequest stringRequest) throws Exception {
-  Business business = businessFactory.getClass("eventService");
+    public Response queryEvent(StringRequest stringRequest) throws Exception {
+        Business business = businessFactory.getClass("eventService");
         business.queryMessage(stringRequest);
- return "";
+        return null;
     }
 
 
     @Operation(summary = "添加事件")
     @PostMapping("/addEvent")
-    public Response  addEvent(String event, List<MultipartFile> files) throws Exception {
+    public Response addEvent(String event,List<MultipartFile> files) throws Exception {
         if (event != null) {
             EventDTO eventDTO = JSONObject.parseObject(event, EventDTO.class);
             Business business = businessFactory.getClass("eventService");
-           Integer id= (Integer) business.addMessage(eventDTO,files);
+            Integer id =null;
+            try {
+                 id = (Integer) business.addMessage(eventDTO, files);
+            }
+            catch (Exception e){
+                if(e instanceof XiaoShiException) {
+                    return Response.error(e.getMessage());
+                }
+            }
             return Response.success(id);
-        }
-        else {
+        } else {
             return Response.error("网络异常");
         }
     }
 
     @Operation(summary = "更新事件")
     @PostMapping("/updateEvent")
-    public Response  updateEvent(String event, List<MultipartFile> files) throws Exception {
+    public Response updateEvent(String event, List<MultipartFile> files) throws Exception {
         if (event != null) {
             EventDTO eventDTO = JSONObject.parseObject(event, EventDTO.class);
             Business business = businessFactory.getClass("eventService");
-            business.updateMessage(eventDTO,files);
+            business.updateMessage(eventDTO, files);
             return Response.success(1);
         } else {
             return Response.error("网络异常");
         }
     }
+
     @Operation(summary = "删除事件")
     @PostMapping("/deleteEvent")
-    public String  queryEvent(@RequestBody List<Integer> ids) throws Exception {
-            Business business = businessFactory.getClass("eventService");
-            business.deleteMessage(ids);
-            return Response.success();
+    public String queryEvent(@RequestBody List<Integer> ids) throws Exception {
+        Business business = businessFactory.getClass("eventService");
+        business.deleteMessage(ids);
+        return Response.success();
     }
 
     @Operation(summary = "分组事件")
     @PostMapping("/groupEvent")
-    public Response  groupEvent(StringGroupRequest stringGroupRequest) throws Exception {
+    public Response groupEvent(StringGroupRequest stringGroupRequest) throws Exception {
         Business business = businessFactory.getClass("eventService");
         GroupVO groupVO = business.getGroup(stringGroupRequest);
         return Response.success(groupVO);

+ 36 - 0
src/main/java/cn/cslg/pas/domain/business/SystemDict.java

@@ -0,0 +1,36 @@
+package cn.cslg.pas.domain.business;
+
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * <p>
+ * 系统字典
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-30
+ */
+@Data
+@TableName("os_system_dict")
+public class SystemDict extends BaseEntity<SystemDict> {
+    /**
+     * 名称
+     */
+    private String label;
+    /**
+     * 数值
+     */
+    private String value;
+    /**
+     * 类型
+     */
+    private String type;
+
+    public SystemDict() {
+        this.label = "-";
+        this.value = "-1";
+    }
+}

+ 2 - 1
src/main/java/cn/cslg/pas/mapper/EventMapper.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.mapper;
 
+import cn.cslg.pas.common.vo.business.EventVO;
 import cn.cslg.pas.domain.business.Event;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -15,6 +16,6 @@ import java.util.List;
  */
 @Repository
 public interface EventMapper extends BaseMapper<Event> {
-    public List<Integer> getEvent(String sql);
+    public List<EventVO> getEvent(String sql);
     public List<String> getGroups(String sql,String tableName,String groupField);
 }

+ 17 - 0
src/main/java/cn/cslg/pas/mapper/SystemDictMapper.java

@@ -0,0 +1,17 @@
+package cn.cslg.pas.mapper;
+
+
+import cn.cslg.pas.domain.business.SystemDict;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 系统字典 Mapper 接口
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-30
+ */
+public interface SystemDictMapper extends BaseMapper<SystemDict> {
+
+}

+ 39 - 5
src/main/java/cn/cslg/pas/service/business/CommonService.java

@@ -1,22 +1,35 @@
 package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.model.common.QueryCondition;
+import cn.cslg.pas.common.model.cronModel.GroupConfig;
+import cn.cslg.pas.common.vo.ConditionVO;
+import cn.cslg.pas.common.vo.EntityVO;
 import com.alibaba.fastjson.JSON;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+
 import java.io.*;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
+/**
+ * 公用服务类
+ *
+ * @author lrj
+ */
 @Service
 @Slf4j
-public class CommonService{
+public class CommonService {
+    /**
+     * 根据获得文件json
+     *
+     * @param fileName
+     * @return
+     */
     public static String readJsonFile(String fileName) {
         String json = "";
         try {
-            File file = new File("src/main/resources/jsons/"+fileName);
+            File file = new File("src/main/resources/jsons/" + fileName);
             Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
             int ch = 0;
             StringBuffer buffer = new StringBuffer();
@@ -31,4 +44,25 @@ public class CommonService{
             return null;
         }
     }
+
+    public List<EntityVO> getQueryConditions(List<String> tableNames) {
+        List<EntityVO> entityVOS = new ArrayList<>();
+        tableNames.forEach(item -> {
+            String json = null;
+            try {
+                json = CommonService.readJsonFile(item + ".json");
+
+            } catch (Exception e) {
+
+            }
+            if (json != null) {
+                EntityVO entityVO = new EntityVO();
+                entityVO.setTableName(item);
+                List<ConditionVO> queryConditions = JSON.parseArray(json, ConditionVO.class);
+                entityVO.setConditionDTOList(queryConditions);
+                entityVOS.add(entityVO);
+            }
+        });
+        return entityVOS;
+    }
 }

+ 119 - 89
src/main/java/cn/cslg/pas/service/business/EventService.java

@@ -3,14 +3,15 @@ package cn.cslg.pas.service.business;
 import cn.cslg.pas.common.dto.business.EventDTO;
 import cn.cslg.pas.common.model.cronModel.GroupConfig;
 import cn.cslg.pas.common.model.cronModel.GroupVO;
-import cn.cslg.pas.common.model.cronModel.SqlObject;
 import cn.cslg.pas.common.model.request.*;
 
 import cn.cslg.pas.common.utils.parseQueryToTree.expressManager;
 import cn.cslg.pas.common.utils.parseQueryToTree.operateNode;
 import cn.cslg.pas.common.utils.parseQueryToTree.treeNode;
+import cn.cslg.pas.common.vo.business.EventVO;
 import cn.cslg.pas.domain.business.AssoEventFile;
 import cn.cslg.pas.domain.business.Event;
+import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.factorys.reGroupFactory.QueryGroupFactory;
 import cn.cslg.pas.factorys.reGroupFactory.QueryGroupImp;
@@ -33,105 +34,118 @@ import java.util.stream.Collectors;
 
 @Service
 @Slf4j
-public class EventService  extends ServiceImpl<EventMapper, Event> implements Business {
+public class EventService extends ServiceImpl<EventMapper, Event> implements Business {
     @Autowired
-    private  EventMapper eventMapper;
+    private EventMapper eventMapper;
+
     @Autowired
     private FormatQueryService formatQueryService;
+
     @Autowired
     private FileManagerService fileManagerService;
+
     @Autowired
     private AssoEventFileService assoEventFileService;
 
     @Autowired
     private QueryGroupFactory queryGroupFactory;
-    public String getEvent(String sql){
+
+    public String getEvent(String sql) {
         eventMapper.getEvent(sql);
-        return  "";
+        return "";
     }
+
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
-    //合成检索式
-        StringRequest stringRequest =null;
-        if(queryRequest instanceof MapRequest){
+        //合成检索式
+        StringRequest stringRequest = null;
+        if (queryRequest instanceof MapRequest) {
 
+        } else {
+            stringRequest = (StringRequest) queryRequest;
         }
-        else {
-            stringRequest =(StringRequest)queryRequest;
-        }
-  String condition =stringRequest.getSearchQuery();
-  //将检索式转换为二叉树
-    treeNode tree = expressManager.getInstance().Parse(condition, false);
-    //格式化检索式
-   String sql = formatQueryService.ToString((operateNode) tree);
-   //格式化排序
-        if(queryRequest.getOrderDTOList()!=null&&queryRequest.getOrderDTOList().size()!=0) {
+        String condition = stringRequest.getSearchQuery();
+
+        //将检索式转换为二叉树
+        treeNode tree = expressManager.getInstance().Parse(condition, false);
+
+        //格式化检索式
+        String sql = formatQueryService.ToString((operateNode) tree);
+
+        //格式化排序
+        if (queryRequest.getOrderDTOList() != null && queryRequest.getOrderDTOList().size() != 0) {
             String orderSql = formatQueryService.orderToString(queryRequest.getOrderDTOList());
-            sql+=orderSql;
+            sql += orderSql;
         }
+
         //格式化 分页信息
-        if(queryRequest.getSize()!=null&&queryRequest.getCurrent()!=null) {
-            Long size =queryRequest.getSize();
-            Long current =queryRequest.getCurrent();
-           String page= " limit "+((current-1)*size)+","+size;
-           sql +=page;
+        if (queryRequest.getSize() != null && queryRequest.getCurrent() != null) {
+            Long size = queryRequest.getSize();
+            Long current = queryRequest.getCurrent();
+            String page = " limit " + ((current - 1) * size) + "," + size;
+            sql += page;
         }
+
         //根据sql查询事件信息
-  List<Integer> ids = eventMapper.getEvent(sql);
+        List<EventVO> eventVOS = eventMapper.getEvent(sql);
 
-  System.out.println(ids);
+         //装载事件信息
+        this.loadEvent(eventVOS);
         return "";
     }
 
     @Override
     public Integer addMessage(Object object, List<MultipartFile> files) {
-        EventDTO eventDTO =(EventDTO)object;
-        //检查事件格式 TODO
+        EventDTO eventDTO = (EventDTO) object;
+        //检查事件格式
+        if(eventDTO.getScenarioId()==null){
+            throw new XiaoShiException("参数错误");
+        }
+
         //根据名称查询是否重复
         eventDTO.setName(eventDTO.getName().trim());
-    String name  = eventDTO.getName();
-    LambdaQueryWrapper<Event> queryWrapper =new LambdaQueryWrapper<>();
-    queryWrapper.eq(Event::getName,name);
-    List<Event> events =this.list(queryWrapper);
-    if(events==null||events.size()==0){
-        return null;
-    }
-        Event event =new Event();
-        BeanUtils.copyProperties(eventDTO,event);
+        String name = eventDTO.getName();
+        LambdaQueryWrapper<Event> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Event::getName, name);
+        List<Event> events = this.list(queryWrapper);
+        if (events != null && events.size() != 0) {
+           throw new XiaoShiException("参数错误");
+        }
+
+        //事件入库
+        Event event = new Event();
+        BeanUtils.copyProperties(eventDTO, event);
         event.insert();
-        if (files != null && files.size() != 0)
-        {
+        if (files != null && files.size() != 0) {
             try {
                 List<String> guids = fileManagerService.uploadFileGetGuid(files);
-                List<AssoEventFile> assoEventFiles =new ArrayList<>();
-                guids.forEach(item->{
-                    AssoEventFile assoEventFile =new AssoEventFile();
+                List<AssoEventFile> assoEventFiles = new ArrayList<>();
+                guids.forEach(item -> {
+                    AssoEventFile assoEventFile = new AssoEventFile();
                     assoEventFile.setEventId(event.getId());
                     assoEventFile.setFileGuid(item);
                     assoEventFile.setCreateId(1);
                     assoEventFiles.add(assoEventFile);
                 });
-                if(assoEventFiles!=null&&assoEventFiles.size()!=0){
+                if (assoEventFiles != null && assoEventFiles.size() != 0) {
                     assoEventFileService.saveBatch(assoEventFiles);
                 }
-            }
-            catch (Exception e){
+            } catch (Exception e) {
             }
         }
-
         return event.getId();
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Object deleteMessage(List<Integer> ids) {
-   //根据事件id删除事件
+        //根据事件id删除事件
         this.removeBatchByIds(ids);
         //根据事件id删除事件和文件关联
-        LambdaQueryWrapper<AssoEventFile> queryWrapper =new LambdaQueryWrapper<>();
-        queryWrapper.in(AssoEventFile::getId,ids);
-        List<AssoEventFile> assoEventFiles =assoEventFileService.list(queryWrapper);
-        List<String> guids =assoEventFiles.stream().map(AssoEventFile::getFileGuid).collect(Collectors.toList());
+        LambdaQueryWrapper<AssoEventFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(AssoEventFile::getId, ids);
+        List<AssoEventFile> assoEventFiles = assoEventFileService.list(queryWrapper);
+        List<String> guids = assoEventFiles.stream().map(AssoEventFile::getFileGuid).collect(Collectors.toList());
         //TODO 根据guid删除文件
         //删除事件和文件关联表
         assoEventFiles.remove(queryWrapper);
@@ -140,53 +154,56 @@ public class EventService  extends ServiceImpl<EventMapper, Event> implements Bu
 
     @Override
     public Object updateMessage(Object object, List<MultipartFile> files) {
-        EventDTO eventDTO =(EventDTO)object;
+        EventDTO eventDTO = (EventDTO) object;
         //检查事件格式 TODO
         //根据名称查询是否重复
         eventDTO.setName(eventDTO.getName().trim());
-        String name  = eventDTO.getName();
-        LambdaQueryWrapper<Event> queryWrapper =new LambdaQueryWrapper<>();
-        queryWrapper.eq(Event::getName,name);
-        List<Event> events =this.list(queryWrapper);
-        if(events==null||events.size()==0){
+        String name = eventDTO.getName();
+        LambdaQueryWrapper<Event> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Event::getName, name);
+        List<Event> events = this.list(queryWrapper);
+        if (events == null || events.size() == 0) {
             return null;
         }
-        Event event =new Event();
-        BeanUtils.copyProperties(eventDTO,event);
+        Event event = new Event();
+        BeanUtils.copyProperties(eventDTO, event);
         event.insert();
-        if (files != null && files.size() != 0)
-        {
+        if (files != null && files.size() != 0) {
             try {
                 List<String> guids = fileManagerService.uploadFileGetGuid(files);
-                List<AssoEventFile> assoEventFiles =new ArrayList<>();
-                guids.forEach(item->{
-                    AssoEventFile assoEventFile =new AssoEventFile();
+                List<AssoEventFile> assoEventFiles = new ArrayList<>();
+                guids.forEach(item -> {
+                    AssoEventFile assoEventFile = new AssoEventFile();
                     assoEventFile.setEventId(event.getId());
                     assoEventFile.setFileGuid(item);
                     assoEventFile.setCreateId(1);
                     assoEventFiles.add(assoEventFile);
                 });
-                if(assoEventFiles!=null&&assoEventFiles.size()!=0){
+                if (assoEventFiles != null && assoEventFiles.size() != 0) {
                     assoEventFileService.saveBatch(assoEventFiles);
                 }
-            }
-            catch (Exception e){
+            } catch (Exception e) {
             }
         }
 
         return event.getId();
     }
 
+    /**
+     * 查询事件分组信息
+     * @param groupRequest
+     * @return
+     * @throws Exception
+     */
     public GroupVO getGroup(GroupRequest groupRequest) throws Exception {
         //合成检索式
-       StringGroupRequest stringGroupRequest =null;
-        if(groupRequest instanceof MapGroupRequest){
+        StringGroupRequest stringGroupRequest = null;
+        if (groupRequest instanceof MapGroupRequest) {
 
+        } else {
+            stringGroupRequest = (StringGroupRequest) groupRequest;
         }
-        else {
-            stringGroupRequest =(StringGroupRequest)groupRequest;
-        }
-        String condition =stringGroupRequest.getSearchQuery();
+        String condition = stringGroupRequest.getSearchQuery();
 
         //将检索式转换为二叉树
         treeNode tree = expressManager.getInstance().Parse(condition, false);
@@ -195,36 +212,49 @@ public class EventService  extends ServiceImpl<EventMapper, Event> implements Bu
         String sql = formatQueryService.ToString((operateNode) tree);
 
         //格式化 分组
-        String json =  CommonService.readJsonFile("event_group.json");
-        List<GroupConfig> groupConfigs = JSON.parseArray(json,GroupConfig.class);
-        GroupConfig groupConfig = groupConfigs.stream().filter(item->item.getField().equals(groupRequest.getGroupBy())).findFirst().orElse(null);
-        if(groupConfig!=null){
-       sql+=" group by "+groupConfig.getSqlField()+" ";
+        String json = CommonService.readJsonFile("event_group.json");
+        List<GroupConfig> groupConfigs = JSON.parseArray(json, GroupConfig.class);
+        GroupConfig groupConfig = groupConfigs.stream().filter(item -> item.getField().equals(groupRequest.getGroupBy())).findFirst().orElse(null);
+        if (groupConfig != null) {
+            sql += " group by " + groupConfig.getSqlField() + " ";
         }
 
         //格式化排序
-        if(groupRequest.getOrderDTOList()!=null&&groupRequest.getOrderDTOList().size()!=0) {
+        if (groupRequest.getOrderDTOList() != null && groupRequest.getOrderDTOList().size() != 0) {
             String orderSql = formatQueryService.orderToString(groupRequest.getOrderDTOList());
-            sql+=orderSql;
+            sql += orderSql;
         }
 
         //格式化 分页信息
-        if(groupRequest.getSize()!=null&&groupRequest.getCurrent()!=null) {
-            Long size =groupRequest.getSize();
-            Long current =groupRequest.getCurrent();
-            String page= " limit "+((current-1)*size)+","+size;
-            sql +=page;
+        if (groupRequest.getSize() != null && groupRequest.getCurrent() != null) {
+            Long size = groupRequest.getSize();
+            Long current = groupRequest.getCurrent();
+            String page = " limit " + ((current - 1) * size) + "," + size;
+            sql += page;
         }
 
         //返回分组数据
-       QueryGroupImp queryGroupImp = queryGroupFactory.getClass(groupConfig.getGroupClass());
-            List<String> strs =   queryGroupImp.getGroup(sql,"event",groupConfig.getSqlField());
+        QueryGroupImp queryGroupImp = queryGroupFactory.getClass(groupConfig.getGroupClass());
+        List<String> strs = queryGroupImp.getGroup(sql, "event", groupConfig.getSqlField());
 
-            //装载数据
-        GroupVO groupVO =new GroupVO();
+        //装载数据
+        GroupVO groupVO = new GroupVO();
         groupVO.setField(groupRequest.getGroupBy());
         groupVO.setValues(strs);
         return groupVO;
     }
 
+
+    private  void loadEvent(List<EventVO> eventVO){
+       //查询创建人名称
+
+        //查询客户名称
+
+        //查询应用场景
+
+        //装载文件信息
+
+    }
+
+
 }

+ 51 - 0
src/main/java/cn/cslg/pas/service/business/SystemDictService.java

@@ -0,0 +1,51 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.mapper.SystemDictMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 系统字典 服务类
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-30
+ */
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class SystemDictService extends ServiceImpl<SystemDictMapper, SystemDict> {
+
+    public List<SystemDict> getSystemDictListByType(List<String> type) {
+        if (type == null || type.size() == 0) {
+            return new ArrayList<>();
+        }
+        LambdaQueryWrapper<SystemDict> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(SystemDict::getType, type);
+        return this.list(queryWrapper);
+    }
+
+    public String getSystemDictLabelByTypeAndValue(String type, Object value) {
+        LambdaQueryWrapper<SystemDict> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SystemDict::getType, type);
+        queryWrapper.eq(SystemDict::getValue, value);
+        SystemDict systemDict = this.getOne(queryWrapper);
+        if (systemDict != null) {
+            return systemDict.getLabel();
+        }
+        return "";
+    }
+
+
+}

+ 19 - 2
src/main/resources/jsons/event.json

@@ -8,13 +8,30 @@
     "type":"String",
     "value":"createName",
     "ifSearch":"true",
-    "ifGroup": "true"
+    "ifGroup": "false"
   },
   {"name":"创建时间",
     "type":"DateTime",
     "value":"createTime",
     "ifSearch":"true",
     "ifGroup": "true"
+  },
+  {"name":"发生时间",
+    "type":"DateTime",
+    "value":"eventDate",
+    "ifSearch":"true",
+    "ifGroup": "true"
+  },
+  {"name":"描述",
+    "type":"String",
+    "value":"description",
+    "ifSearch":"true",
+    "ifGroup": "false"
+  },
+  {"name":"应用场景",
+    "type":"Integer",
+    "value":"scenarioId",
+    "ifSearch":"true",
+    "ifGroup": "true"
   }
-
 ]

+ 8 - 2
src/main/resources/mapper/Event.xml

@@ -1,13 +1,19 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.cslg.pas.mapper.EventMapper">
-  <select id="getEvent"  resultType="java.lang.Integer">
-   select id from event
+  <select id="getEvent"  resultType="cn.cslg.pas.common.vo.business.EventVO">
+   select id,name,description,client_id as clientId,scenario_id as scenarioId,event_date as eventDate from event
        <where>
        ${sql}
     </where>
   </select>
 
+    <select id="getEventCount" resultType="java.lang.Integer">
+        select count(*) from event
+        <where>
+            ${sql}
+        </where>
+    </select>
     <select id="getGroups"  resultType="java.lang.String">
         select ${groupField} from  ${tableName}
         <where>

+ 11 - 1
src/test/java/cn/cslg/pas/service/CommonServiceTests.java

@@ -3,13 +3,16 @@ package cn.cslg.pas.service;
 import cn.cslg.pas.common.model.common.QueryCondition;
 import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.model.request.StringRequest;
+import cn.cslg.pas.controller.CommonController;
 import cn.cslg.pas.controller.EventController;
 import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.permissions.PermissionService;
+import org.assertj.core.internal.Arrays;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -22,12 +25,19 @@ public class CommonServiceTests {
     private EventController eventController;
     @Autowired
     private PermissionService permissionService;
+    @Autowired
+    private CommonController commonController;
     @Test
     void test() throws Exception {
      String aa=   permissionService.getPersonIdByNamePCS("朱");
      System.out.println(aa);
     }
 
-
+    @Test
+    void getQueryConditions() throws Exception {
+        List<String> list =new ArrayList<>();
+        list.add("event");
+        commonController.getQueryConditions(list);
+    }
 
 }

+ 2 - 1
src/test/java/cn/cslg/pas/service/EventServiceTests.java

@@ -47,10 +47,11 @@ public class EventServiceTests {
     @Test
     void add() throws Exception {
         JSONObject jsonObj = new JSONObject();
-        jsonObj.put("name", "事件1");
+        jsonObj.put("name", "事件4");
         jsonObj.put("description", "描述1");
         jsonObj.put("clientId", 1);
         jsonObj.put("scenarioId", 2);
+        jsonObj.put("eventDate","");
         String json_to_string = JSONObject.toJSONString(jsonObj);
         List<MultipartFile> list = new ArrayList<>();
         File file = new File("C:\\Users\\admin\\Desktop\\test.txt");