保存抓取规则功能 #280
-1
@@ -288,7 +288,6 @@ public class CaseApplicationController extends BaseController {
|
||||
// @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')")
|
||||
@Log(title = "仲裁员审核裁决书", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/arbitrator/checkArbitrateRecord")
|
||||
// @PostMapping("/arbitratorCheckArbitrateRecord")
|
||||
public AjaxResult arbitratorCheckArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) {
|
||||
|
||||
return caseApplicationService.arbitratorCheckArbitrateRecord(caseApplication);
|
||||
|
||||
+27
@@ -177,4 +177,31 @@ public class DeptIdentifyController extends BaseController {
|
||||
public AjaxResult bindHandler(DeptIdentify deptIdentify){
|
||||
return deptIdentifyService.bindHandler(deptIdentify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板id查询抓取规则
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getFatchRuleByTemplateid")
|
||||
public AjaxResult getFatchRuleByTemplateid(@RequestBody TemplateManage templateManage){
|
||||
List<FatchRule> fatchRuleList = deptIdentifyService.getFatchRuleByTemplateid(templateManage);
|
||||
return AjaxResult.success(fatchRuleList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存抓取规则
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saveFatchRules")
|
||||
public AjaxResult saveFatchRules(@RequestBody TemplateManage templateManage){
|
||||
return deptIdentifyService.saveFatchRules(templateManage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,4 +20,10 @@ public class FatchRule extends BaseEntity {
|
||||
private String startContent;
|
||||
private String endContent;
|
||||
|
||||
private String column;
|
||||
private String columnName;
|
||||
private Integer isDefault;
|
||||
|
||||
private Long templateId;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.domain;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TemplateManage extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -49,4 +51,7 @@ public class TemplateManage extends BaseEntity {
|
||||
* 机构关联id
|
||||
*/
|
||||
private String identifyName;
|
||||
|
||||
List<FatchRule> fatchRules;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.wisdomarbitrate.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 模板抓取规则关联表
|
||||
*/
|
||||
@Data
|
||||
public class TemplateFatchRule {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
private Long templateId;
|
||||
private Long fatchRuleId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.mapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -16,4 +17,12 @@ public interface FatchRuleMapper {
|
||||
*/
|
||||
List<FatchRule> list(@Param("batchNumber")String batchNumber);
|
||||
|
||||
List<FatchRule> selectFatchRuleList(FatchRule fatchRule);
|
||||
|
||||
|
||||
List<FatchRule> selectFatchRuleListIsDefault(FatchRule fatchRule);
|
||||
|
||||
void deletebatchFatchRule(@Param("fatchRuleIds") List<Long> fatchRuleIds);
|
||||
|
||||
int insertFatchRule(FatchRule fatchRule);
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.wisdomarbitrate.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.TemplateFatchRule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TemplateFatchRuleMapper {
|
||||
int selectTemplateFatchRulecount(TemplateFatchRule templateFatchRule);
|
||||
|
||||
|
||||
List<TemplateFatchRule> selectTemplateFatchRuleList(TemplateFatchRule templateFatchRule);
|
||||
|
||||
void deleteTemplateFatchRule(Long id);
|
||||
|
||||
int insertTemplateFatchRule(TemplateFatchRule templateFatchRule);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SealManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
|
||||
@@ -51,4 +52,7 @@ public interface IDeptIdentifyService {
|
||||
|
||||
AjaxResult bindHandler(DeptIdentify deptIdentify);
|
||||
|
||||
List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage);
|
||||
|
||||
AjaxResult saveFatchRules(TemplateManage templateManage);
|
||||
}
|
||||
|
||||
+57
-8
@@ -18,15 +18,10 @@ import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SealManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.TemplateManageMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.TemplateFatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -34,11 +29,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.TemplateFatchRuleMapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
@@ -60,6 +57,10 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
private TemplateManageMapper templateManageMapper;
|
||||
@Autowired
|
||||
private SysUserPostMapper sysUserPostMapper;
|
||||
@Autowired
|
||||
private TemplateFatchRuleMapper templateFatchRuleMapper;
|
||||
@Autowired
|
||||
private FatchRuleMapper fatchRuleMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -530,6 +531,54 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage) {
|
||||
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
||||
templateFatchRule.setTemplateId(templateManage.getId());
|
||||
List<FatchRule> fatchRules = new ArrayList<>();
|
||||
int countTemplateFatchRule = templateFatchRuleMapper.selectTemplateFatchRulecount(templateFatchRule);
|
||||
if(countTemplateFatchRule!=0){
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setTemplateId(templateManage.getId());
|
||||
fatchRules = fatchRuleMapper.selectFatchRuleList(fatchRule);
|
||||
return fatchRules;
|
||||
}else {
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setIsDefault(1);
|
||||
fatchRules = fatchRuleMapper.selectFatchRuleListIsDefault(fatchRule);
|
||||
return fatchRules;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult saveFatchRules(TemplateManage templateManage) {
|
||||
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
||||
templateFatchRule.setTemplateId(templateManage.getId());
|
||||
List<TemplateFatchRule> templateFatchRulelist = templateFatchRuleMapper.selectTemplateFatchRuleList(templateFatchRule);
|
||||
if(templateFatchRulelist!=null&&templateFatchRulelist.size()>0){
|
||||
List<Long> fatchRuleIds = templateFatchRulelist.stream().map(TemplateFatchRule::getFatchRuleId).collect(Collectors.toList());
|
||||
fatchRuleMapper.deletebatchFatchRule(fatchRuleIds);
|
||||
templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
|
||||
}
|
||||
List<FatchRule> fatchRules = templateManage.getFatchRules();
|
||||
if(fatchRules!=null&&fatchRules.size()>0){
|
||||
for (FatchRule fatchRule : fatchRules) {
|
||||
//保存抓取规则数据
|
||||
fatchRule.setIsDefault(0);
|
||||
fatchRuleMapper.insertFatchRule(fatchRule);
|
||||
//保存模板抓取规则关联关系
|
||||
Long fatchRuleId = fatchRule.getId();
|
||||
if(fatchRuleId!=null){
|
||||
templateFatchRule.setFatchRuleId(fatchRuleId);
|
||||
templateFatchRuleMapper.insertTemplateFatchRule(templateFatchRule);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
private String getFileExtension(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
|
||||
|
||||
@@ -5,14 +5,71 @@
|
||||
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.FatchRuleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.wisdomarbitrate.domain.FatchRule" >
|
||||
<result column="id" property="id" />
|
||||
<result column="batch_number" property="batchNumber" />
|
||||
<result column="file_name" property="fileName" />
|
||||
<result column="start_content" property="startContent" />
|
||||
<result column="end_content" property="endContent" />
|
||||
|
||||
<result column="column" property="column" />
|
||||
<result column="is_default" property="isDefault" />
|
||||
<result column="columnName" property="columnName" />
|
||||
</resultMap>
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
select * from fatch_rule where batch_number=#{batchNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectFatchRuleList" parameterType="FatchRule" resultMap="BaseResultMap">
|
||||
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
||||
f.`column` ,f.is_default ,f.columnName
|
||||
FROM template_fatch_rule tf
|
||||
left join template_manage t on tf.template_id = t.id
|
||||
LEFT JOIN fatch_rule f on tf.fatch_rule_id = f.id
|
||||
<where>
|
||||
<if test="templateId != null">
|
||||
AND tf.template_id = #{templateId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
|
||||
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
||||
f.`column` ,f.is_default ,f.columnName
|
||||
FROM fatch_rule f
|
||||
<where>
|
||||
<if test="isDefault != null">
|
||||
AND f.is_default = #{isDefault}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deletebatchFatchRule">
|
||||
delete from fatch_rule where id in
|
||||
<foreach collection="fatchRuleIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertFatchRule" parameterType="FatchRule" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fatch_rule(
|
||||
<if test="fileName != null and fileName != ''">file_name,</if>
|
||||
<if test="startContent != null and startContent != ''">start_content,</if>
|
||||
<if test="endContent != null and endContent != ''">end_content,</if>
|
||||
<if test="column != null and column != ''">`column`,</if>
|
||||
<if test="columnName != null and columnName != ''">columnName,</if>
|
||||
<if test="isDefault != null">is_default</if>
|
||||
)values(
|
||||
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||
<if test="startContent != null and startContent != ''">#{startContent},</if>
|
||||
<if test="endContent != null and endContent != ''">#{endContent},</if>
|
||||
<if test="column != null and column != ''">#{column},</if>
|
||||
<if test="columnName != null and columnName != ''">#{columnName},</if>
|
||||
<if test="isDefault != null">#{isDefault}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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="com.ruoyi.wisdomarbitrate.mapper.TemplateFatchRuleMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.wisdomarbitrate.domain.vo.TemplateFatchRule" >
|
||||
<result column="id" property="id" />
|
||||
<result column="template_id" property="templateId" />
|
||||
<result column="fatch_rule_id" property="fatchRuleId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTemplateFatchRulecount" parameterType="TemplateFatchRule" resultType="Integer">
|
||||
select count(1) from template_fatch_rule t
|
||||
<where>
|
||||
<if test="templateId != null">
|
||||
AND t.template_id = #{templateId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTemplateFatchRuleList" parameterType="TemplateFatchRule" resultMap="BaseResultMap">
|
||||
SELECT t.id ,t.template_id ,t.fatch_rule_id
|
||||
from template_fatch_rule t
|
||||
<where>
|
||||
<if test="templateId != null">
|
||||
AND t.template_id = #{templateId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<delete id="deleteTemplateFatchRule" parameterType="Long">
|
||||
delete from template_fatch_rule where template_id=#{id}
|
||||
</delete>
|
||||
|
||||
<insert id="insertTemplateFatchRule" parameterType="TemplateFatchRule" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into template_fatch_rule(
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="fatchRuleId != null">fatch_rule_id</if>
|
||||
)values(
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="fatchRuleId != null">#{fatchRuleId}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user