فهرست منبع

Merge remote-tracking branch 'origin/master'

chenyi 2 سال پیش
والد
کامیت
293e947485

+ 18 - 19
RMS/src/main/java/cn/cslg/report/controller/CompareRecordsController.java

@@ -4,6 +4,7 @@ import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.vo.CompareRecordsVO;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.entity.CompareRecords;
 import cn.cslg.report.service.business.CompareRecordsService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -20,41 +21,39 @@ import java.io.IOException;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class CompareRecordsController {
     private final CompareRecordsService compareRecordsService;
-//    private  final  LoginUtils loginUtils;
+    private  final  LoginUtils loginUtils;
 
     @PostMapping(value = "/addCompareRecords")
     @Operation(summary = "增加对比记录数据")
-    public String addCompareRecords(@RequestBody CompareRecordsVO compareRecordsVO)throws IOException{
-        if (compareRecordsVO != null) {
-//loginUtils.getId();
-            return compareRecordsService.addCompareRecords(compareRecordsVO);
-
-        } else {
-            return Response.error("网络异常");
-        }
+    public String addCompareRecords(@RequestBody CompareRecords compareRecords)throws IOException{
 
+         return compareRecordsService.addCompareRecord(compareRecords);
     }
     @RequestMapping(value = "/deleCompareRecords", method = RequestMethod.GET)
     @Operation(summary = "删除对比记录数据")
     public String deleCompareRecords(int id) throws IOException{
         return compareRecordsService.deleCompareRecords(id);
     }
+
     @PostMapping(value = "/updateCompareRecords")
     @Operation(summary = "修改对比记录数据")
     @Transactional(rollbackFor = Exception.class)
-    public String updateCompareRecords(@RequestBody CompareRecordsVO compareRecordsVO) throws IOException{
-        if(compareRecordsVO !=null){
-            return compareRecordsService.updateCompareRecords(compareRecordsVO);
-        }
-        return Response.error("网络异常");
+    public String updateCompareRecords(@RequestBody CompareRecords compareRecord) throws IOException{
+        return compareRecordsService.updateCompareRecords(compareRecord);
+
+    }
+    @GetMapping(value = "/slectCompareRecord")
+    @Operation(summary ="查询对比记录")
+    public String getCompareRecords(int reportId,String  patentNo)throws IOException{
+        int i=loginUtils.getId();
+        return compareRecordsService.getCompareRecords( reportId, patentNo,i);
+
     }
-    @PostMapping(value = "/slectCompareRecords")
-    @Operation(summary = "分页查询对比记录数据")
-    public String slectCompareRecords(@RequestBody CompareRecordsVO compareRecordsVO) throws IOException{
-        return compareRecordsService.find(compareRecordsVO);
+
+
 
     }
 
 
 
-}
+

+ 10 - 2
RMS/src/main/java/cn/cslg/report/entity/CompareRecords.java

@@ -7,6 +7,8 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.util.List;
+
 /**
  * 对比记录表
  */
@@ -38,12 +40,18 @@ public class CompareRecords extends BaseEntity<CompareRecords> {
      */
     @TableField(value = "FEATURES_ID")
     private String featuresId;
+    @TableField(exist = false)
+    private List<Integer> featuresIdList;
 
     /**
      * 特征
      */
-    @TableField(value = "FEATURES")
-    private String features;
+//    @TableField(value = "FEATURES")
+//    private String features;
+//    @TableField(exist = false)
+//    private List<String> featuresList;
+
+
 
     /**
      * 对比人ID

+ 4 - 14
RMS/src/main/java/cn/cslg/report/mapper/CompareRecordsMapper.java

@@ -2,6 +2,8 @@ package cn.cslg.report.mapper;
 
 import cn.cslg.report.common.model.vo.CompareRecordsVO;
 import cn.cslg.report.entity.CompareRecords;
+import cn.cslg.report.entity.asso.AssoTaskPersonel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -9,18 +11,6 @@ import java.util.List;
 
 
 @Mapper
-public interface CompareRecordsMapper {
-    int add(CompareRecords compareRecords);
-    int deleCompareRecords(@Param("id")int id);
-    int updateCompareRecords(CompareRecords compareRecords);
-    /*
-    现未经过实践有待改善xml也要改
-     */
-    List<CompareRecords> find(CompareRecordsVO compareRecordsVO);
-    /*
-     /*
-    现未经过实践有待改善xml也要改
-
-     */
-    int total(CompareRecords compareRecords);
+public interface CompareRecordsMapper  extends BaseMapper<CompareRecords> {
+     List<CompareRecords> find(@Param("reportId") int reportId,@Param("patentNo") String  patentNo,@Param("personId") int personId);
 }

+ 1 - 0
RMS/src/main/java/cn/cslg/report/mapper/FeatureMapper.java

@@ -10,4 +10,5 @@ import java.util.List;
 @Mapper
 public interface FeatureMapper extends BaseMapper<Features> {
     public List<String> getSignPatentNo(@Param("contents") List<String> contents);
+    Features find(@Param("id") int id);
 }

+ 47 - 47
RMS/src/main/java/cn/cslg/report/service/business/CompareRecordsService.java

@@ -2,12 +2,23 @@ package cn.cslg.report.service.business;
 
 import cn.cslg.report.common.model.vo.CompareRecordsVO;
 import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.common.utils.StringUtils;
+import cn.cslg.report.entity.CompareFiles;
 import cn.cslg.report.entity.CompareRecords;
+import cn.cslg.report.entity.Features;
+import cn.cslg.report.entity.Report;
+import cn.cslg.report.mapper.CompareFilesMapper;
 import cn.cslg.report.mapper.CompareRecordsMapper;
+import cn.cslg.report.mapper.FeatureMapper;
+import cn.cslg.report.service.OutInterfaceService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -18,62 +29,51 @@ import java.util.Map;
 @Service
 @Slf4j
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class CompareRecordsService {
-    public final CompareRecordsMapper compareRecordsMapper;
-    public String addCompareRecords(CompareRecordsVO compareRecordsVO)throws IOException{
-        List<CompareRecordsVO.DFeatureObjects> featureObjects = compareRecordsVO.getDFeatureObjects();
-        for(CompareRecordsVO.DFeatureObjects a:featureObjects){
-            CompareRecords compareRecords=new CompareRecords();
-            compareRecords.setReportId(compareRecordsVO.getReportId());
-            compareRecords.setContent(compareRecordsVO.getContent());
-            compareRecords.setFeatures(a.getFeatures());
-            compareRecords.setFeaturesId(a.getFeaturesId());
-            compareRecords.setPatentNo(compareRecordsVO.getPatentNo());
-            compareRecords.setPersonId(compareRecordsVO.getPersonId());
-            compareRecords.setPosition(compareRecordsVO.getPosition());
-            compareRecordsMapper.add(compareRecords);
-        }
-
+public class CompareRecordsService extends ServiceImpl<CompareRecordsMapper, CompareRecords> {
+   public final CompareRecordsMapper compareRecordsMapper;
+   public final FeatureMapper featureMapper;
+    public String addCompareRecord(CompareRecords compareRecord) throws IOException{
+        compareRecord.setFeaturesId(StringUtils.join(compareRecord.getFeaturesIdList(),","));
+        compareRecord.insert();
         return Response.success();
+
     }
-    public String deleCompareRecords(int id) throws IOException{
-        compareRecordsMapper.deleCompareRecords(id);
-        return Response.success();
+    public String deleCompareRecords(int id)throws IOException{
+          this.removeById(id);
+          return Response.success();
     }
-    public String updateCompareRecords(CompareRecordsVO compareRecordsVO)throws IOException{
-        List<CompareRecordsVO.DFeatureObjects> featureObjects = compareRecordsVO.getDFeatureObjects();
-        for(CompareRecordsVO.DFeatureObjects a:featureObjects){
-            CompareRecords compareRecords=new CompareRecords();
-            compareRecords.setReportId(compareRecordsVO.getReportId());
-            compareRecords.setContent(compareRecordsVO.getContent());
-            compareRecords.setFeatures(a.getFeatures());
-            compareRecords.setFeaturesId(a.getFeaturesId());
-            compareRecords.setPatentNo(compareRecordsVO.getPatentNo());
-            compareRecords.setPersonId(compareRecordsVO.getPersonId());
-            compareRecords.setPosition(compareRecordsVO.getPosition());
-            compareRecordsMapper.updateCompareRecords(compareRecords);
-        }
+    public String updateCompareRecords(CompareRecords compareRecord)throws IOException{
+
+        compareRecord.setFeaturesId(StringUtils.join(compareRecord.getFeaturesIdList(),","));
+        compareRecord.updateById();
         return Response.success();
     }
-    public String find(CompareRecordsVO compareRecordsVO) throws IOException{
-        List<CompareRecordsVO.DFeatureObjects> featureObjects = compareRecordsVO.getDFeatureObjects();
+    public String getCompareRecords(int reportId,String  patentNo,int personId)throws IOException{
+        List<CompareRecords> compareRecords = compareRecordsMapper.find(reportId, patentNo, personId);
         List<CompareRecords> list=new ArrayList<>();
-        for(CompareRecordsVO.DFeatureObjects a:featureObjects){
-            CompareRecords compareRecords=new CompareRecords();
-            compareRecords.setReportId(compareRecordsVO.getReportId());
-            compareRecords.setContent(compareRecordsVO.getContent());
-            compareRecords.setFeatures(a.getFeatures());
-            compareRecords.setFeaturesId(a.getFeaturesId());
-            compareRecords.setPatentNo(compareRecordsVO.getPatentNo());
-            compareRecords.setPersonId(compareRecordsVO.getPersonId());
-            compareRecords.setPosition(compareRecordsVO.getPosition());
-           list = compareRecordsMapper.find(compareRecordsVO);
+        for(CompareRecords c:compareRecords){
+            String featuresId = c.getFeaturesId();
+            String[] split = featuresId.split(",");
+            List<Integer> list1=new ArrayList<>();
+            for(String str:split){
+                int i=Integer.parseInt(str);
+                Features features = featureMapper.find(i);
+
+
+                list1.add(i);
+            }
+
+            c.setFeaturesIdList(list1);
+
+
 
         }
-        Map<String,Object> map=new HashMap<>();
-        map.put("list",list);
-        return Response.success(map);
+
+        return  Response.success(compareRecords);
     }
 
 
+
+
+
 }

+ 3 - 90
RMS/src/main/resources/mapper/CompareRecordsMapper.xml

@@ -1,96 +1,9 @@
 <?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.report.mapper.CompareRecordsMapper">
-    <insert id="add" parameterType="cn.cslg.report.entity.CompareRecords" keyProperty="ID">
-        insert into COMPARE_RECORDS (PATENT_NO,POSITION,CONTENT,FEATURES_ID,FEATURES,PERSON_ID,REPORT_ID)
-         values(#{patentNo},#{position},#{content},#{featuresId},#{features},#{personId},#{reportId})
-
-    </insert>
-<delete id="deleCompareRecords">
-    delete from COMPARE_RECORDS where ID=#{id}
-</delete>
-<update id="updateCompareRecords">
-    update COMPARE_RECORDS
-<set>
-    <if test="patentNo !='' and patentNo !=null">
-        PATENT_NO=#{PATENT_NO}
-    </if>
-    <if test="position !='' and position !=null">
-        POSITION=#{position}
-    </if>
-    <if test="content !='' and content !=null">
-        CONTENT=#{content}
-    </if>
-    <if test="featuresId !='' and featuresId !=null">
-        FEATURES_ID=#{featuresId}
-    </if>
-    <if test="features !='' and features !=null">
-        FEATURES=#{features}
-    </if>
-    <if test="personId !='' and personId !=null">
-        PERSON_ID=#{PATENT_NO}
-    </if>
-    <if test="reportId !='' and reportId !=null">
-        REPORT_ID=#{reportId}
-    </if>
-</set>
-  where ID=#{id}
-</update>
-    <select id="total" resultType="int">
-        select count(*) from COMPARE_RECORDS
-
-    <where>
-        <if test="patentNo !='' and patentNo !=null">
-           PATENT_NO like concat('%', #{patentNo}, '%')
-        </if>
-        <if test="position !='' and position !=null">
-           and POSITION like concat('%', #{position}, '%')
-        </if>
-        <if test="content !='' and content !=null">
-           and CONTENT like concat('%', #{content}, '%')
-        </if>
-        <if test="featuresId !='' and featuresId !=null">
-           and FEATURES_ID like concat('%', #{featuresId}, '%')
-        </if>
-        <if test="features !='' and features !=null">
-           and FEATURES like concat('%', #{featuresId}, '%')
-        </if>
-        <if test="personId !='' and personId !=null">
-           and PERSON_ID like concat('%', #{personId}, '%')
-        </if>
-        <if test="reportId !='' and reportId !=null">
-          and REPORT_ID like concat('%', #{reportId}, '%')
-        </if>
-    </where>
-    </select>
-    <select id="find" resultType="cn.cslg.report.entity.CompareRecords">
-      <bind name="n" value="(pageNO-1)pageSize"/>
-       select * from COMPARE_RECORDS
-        <where>
-            <if test="patentNo !='' and patentNo !=null">
-              PATENT_NO like concat('%', #{patentNo}, '%')
-            </if>
-            <if test="position !='' and position !=null">
-                and POSITION like concat('%', #{position}, '%')
-            </if>
-            <if test="content !='' and content !=null">
-                and CONTENT like concat('%', #{content}, '%')
-            </if>
-            <if test="featuresId !='' and featuresId !=null">
-                and FEATURES_ID like concat('%', #{featuresId}, '%')
-            </if>
-            <if test="features !='' and features !=null">
-                and FEATURES like concat('%', #{featuresId}, '%')
-            </if>
-            <if test="personId !='' and personId !=null">
-                and PERSON_ID like concat('%', #{personId}, '%')
-            </if>
-            <if test="reportId !='' and reportId !=null">
-                and REPORT_ID like concat('%', #{reportId}, '%')
-            </if>
-        </where>
-          limit #{n},#{pageSize}
-    </select>
+   <select id="find" resultType="cn.cslg.report.entity.CompareRecords">
+       select *  from COMPARE_RECORDS where PATENT_NO=#{patentNo} and PERSON_ID=#{personId} and REPORT_ID=#{reportId}
+   </select>
 
 
 </mapper>

+ 3 - 0
RMS/src/main/resources/mapper/FeatureMapper.xml

@@ -13,4 +13,7 @@
         </if>
         </where>
     </select>
+    <select id="find" resultType="cn.cslg.report.entity.Features">
+        select * from FEATURES where ID=#{id}
+    </select>
 </mapper>