|
@@ -0,0 +1,101 @@
|
|
|
+package cn.cslg.pas.controller;
|
|
|
+
|
|
|
+import cn.cslg.pas.common.core.base.Constants;
|
|
|
+import cn.cslg.pas.common.dto.business.EventDTO;
|
|
|
+import cn.cslg.pas.common.dto.business.UpdateEventDTO;
|
|
|
+import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
+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.ConditionException;
|
|
|
+import cn.cslg.pas.exception.UnLoginException;
|
|
|
+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;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author 李仁杰
|
|
|
+ * @date 2023/11/2
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RequestMapping(Constants.API_XiaoSHI + "/patentDigProject")
|
|
|
+@RestController
|
|
|
+public class PatentDigProjectController {
|
|
|
+ @Autowired
|
|
|
+ private BusinessFactory businessFactory;
|
|
|
+
|
|
|
+ @Operation(summary = "查询专利挖掘项目")
|
|
|
+ @PostMapping("/queryPatentDigProject")
|
|
|
+ public Response queryPatentDigProject(@RequestBody StringRequest stringRequest) throws Exception {
|
|
|
+ Business business = businessFactory.getClass("reportProjectService");
|
|
|
+ Records records = (Records) business.queryMessage(stringRequest);
|
|
|
+ return Response.success(records);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "添加专利挖掘项目")
|
|
|
+ @PostMapping("/addPatentDigProject")
|
|
|
+ public Response addPatentDigProject(String event, List<MultipartFile> files) throws Exception {
|
|
|
+ if (event != null) {
|
|
|
+ EventDTO eventDTO = JSONObject.parseObject(event, EventDTO.class);
|
|
|
+ Business business = businessFactory.getClass("eventService");
|
|
|
+ Integer id = null;
|
|
|
+ try {
|
|
|
+ id = (Integer) business.addMessage(eventDTO, files);
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (e instanceof XiaoShiException) {
|
|
|
+ return Response.error(e.getMessage());
|
|
|
+ } else if (e instanceof UnLoginException) {
|
|
|
+ return Response.unLogin(e.getMessage());
|
|
|
+ } else if (e instanceof ConditionException) {
|
|
|
+ return Response.conditionError(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Response.success(id);
|
|
|
+ } else {
|
|
|
+ return Response.error("网络异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "更新专利挖掘项目")
|
|
|
+ @PostMapping("/updatePatentDigProject")
|
|
|
+ public Response updatePatentDigProject(String event, List<MultipartFile> files) throws Exception {
|
|
|
+ if (event != null) {
|
|
|
+ UpdateEventDTO updateEventDTO = JSONObject.parseObject(event, UpdateEventDTO.class);
|
|
|
+ Business business = businessFactory.getClass("eventService");
|
|
|
+ business.updateMessage(updateEventDTO, files);
|
|
|
+ return Response.success(1);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return Response.error("网络异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "删除专利挖掘项目")
|
|
|
+ @PostMapping("/deletePatentDigProject")
|
|
|
+ public String deletePatentDigProject(@RequestBody List<Integer> ids) throws Exception {
|
|
|
+ Business business = businessFactory.getClass("eventService");
|
|
|
+ business.deleteMessage(ids);
|
|
|
+ return Response.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "分组专利挖掘项目")
|
|
|
+ @PostMapping("/groupPatentDigProject")
|
|
|
+ public Response groupPatentDigProject(@RequestBody StringGroupRequest stringGroupRequest) throws Exception {
|
|
|
+ Business business = businessFactory.getClass("eventService");
|
|
|
+ Records records = (Records)business.getGroup(stringGroupRequest,"event");
|
|
|
+ return Response.success(records);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|