新增自动分段关键词处理
parent
d5f5403d0c
commit
a0ddec488c
@ -1,50 +0,0 @@
|
|||||||
package com.docus.server;
|
|
||||||
|
|
||||||
import com.docus.infrastructure.WebConfig;
|
|
||||||
import com.docus.infrastructure.web.json.JsonSerializerModule;
|
|
||||||
import com.docus.server.common.serializer.DefJsonSerializerModule;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
|
||||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class DefaultWebConfig extends WebConfig {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonSerializerModule jsonSerializerModu1e() {
|
|
||||||
super.jsonSerializerModu1e();
|
|
||||||
return new DefJsonSerializerModule();
|
|
||||||
}
|
|
||||||
|
|
||||||
//http请求工具 restTemplate
|
|
||||||
@ConditionalOnMissingBean
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() {
|
|
||||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
|
||||||
requestFactory.setReadTimeout(3 * 60 * 1000);
|
|
||||||
requestFactory.setConnectTimeout(3 * 60 * 1000);
|
|
||||||
RestTemplate restTemplate = new RestTemplate(requestFactory);
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
//]忽略未定义的属性
|
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
List<HttpMessageConverter<?>> messageConverters = restTemplate.getMessageConverters();
|
|
||||||
messageConverters.removeIf(converter -> converter instanceof StringHttpMessageConverter);
|
|
||||||
messageConverters.add(1, new StringHttpMessageConverter(Charset.forName("UTF-8")));
|
|
||||||
HttpMessageConverter<?> jsonConverter = messageConverters.stream()
|
|
||||||
.filter(p -> p instanceof MappingJackson2HttpMessageConverter).findFirst().orElse(null);
|
|
||||||
if (jsonConverter != null) {
|
|
||||||
((MappingJackson2HttpMessageConverter) jsonConverter).setObjectMapper(objectMapper);
|
|
||||||
}
|
|
||||||
return restTemplate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.docus.server.service;
|
package com.docus.server.common.service;
|
||||||
|
|
||||||
import com.docus.server.vo.scheduling.management.schcollectorversionfile.UploadFileVO;
|
import com.docus.server.vo.scheduling.management.schcollectorversionfile.UploadFileVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.docus.server.api.segmentation;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.web.request.SearchDTO;
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
|
||||||
|
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特殊策略表 API
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@FeignClient(value = "docus-segmentation", contextId = "docus-segmentation.OcrSpRuleApi")
|
||||||
|
@RequestMapping("/ocrSpRule")
|
||||||
|
public interface OcrSpRuleApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查询
|
||||||
|
*
|
||||||
|
* @param id 主键id
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@GetMapping("/find/{id}")
|
||||||
|
OcrSpRuleVO findById(@PathVariable(value = "id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有
|
||||||
|
*
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@GetMapping("/findAll")
|
||||||
|
List<OcrSpRuleVO> findAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键字搜索
|
||||||
|
*
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/search")
|
||||||
|
PageResult<OcrSpRuleVO> search(@RequestBody SearchDTO searchDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param addOcrSpRuleDTO 新增参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
boolean add(@RequestBody AddOcrSpRuleDTO addOcrSpRuleDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param editOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@PutMapping("/edit")
|
||||||
|
boolean edit(@RequestBody EditOcrSpRuleDTO editOcrSpRuleDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param deleteOcrSpRuleDTO 删除参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
int delete(@RequestBody DeleteOcrSpRuleDTO deleteOcrSpRuleDTO);
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.docus.server.dto.segmentation.ocrsprule;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import com.docus.server.enums.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 AddDTO
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value="AddOcrSpRuleDTO对象", description="特殊策略表")
|
||||||
|
public class AddOcrSpRuleDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String assortId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则开始json")
|
||||||
|
private String startJson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则结束json")
|
||||||
|
private String endJson;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.docus.server.dto.segmentation.ocrsprule;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import com.docus.server.enums.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 DeleteDTO
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value="DeleteOcrSpRuleDTO对象", description="特殊策略表")
|
||||||
|
public class DeleteOcrSpRuleDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ids")
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.docus.server.dto.segmentation.ocrsprule;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import com.docus.server.enums.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 EditDTO
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value="EditOcrSpRuleDTO对象", description="特殊策略表")
|
||||||
|
public class EditOcrSpRuleDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String assortId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则开始json")
|
||||||
|
private String startJson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则结束json")
|
||||||
|
private String endJson;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.docus.server.entity.segmentation;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import com.docus.server.enums.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("ocr_sp_rule")
|
||||||
|
@ApiModel(value="OcrSpRule对象", description="特殊策略表")
|
||||||
|
public class OcrSpRule implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@TableField("assort_id")
|
||||||
|
private String assortId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则开始json")
|
||||||
|
@TableField("start_json")
|
||||||
|
private String startJson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则结束json")
|
||||||
|
@TableField("end_json")
|
||||||
|
private String endJson;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.docus.server.vo.segmentation.ocrsprule;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import com.docus.server.enums.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 VO
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value="OcrSpRuleVO对象", description="特殊策略表")
|
||||||
|
public class OcrSpRuleVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
private String assortId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则开始json")
|
||||||
|
private String startJson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则结束json")
|
||||||
|
private String endJson;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,52 +0,0 @@
|
|||||||
package com.docus.server.common;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.docus.server.api.scheduling.management.SchVirtualLogApi;
|
|
||||||
import com.docus.server.common.utils.SystemInfoUtils;
|
|
||||||
import com.docus.server.dto.scheduling.management.schvirtuallog.AddSchVirtualLogDTO;
|
|
||||||
import com.xxl.job.core.util.IpUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class SchVirtualLogTask {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SchVirtualLogApi schVirtualLogApi;
|
|
||||||
|
|
||||||
//定时任务
|
|
||||||
// 5 * * * * ? 在每分钟的5秒执行
|
|
||||||
@Scheduled(cron = "${docus.vm-task-cron}")
|
|
||||||
public void runTask() {
|
|
||||||
try {
|
|
||||||
log.info("收集虚拟机信息定时任务: 开始执行");
|
|
||||||
|
|
||||||
JSONObject info = SystemInfoUtils.getInfo();
|
|
||||||
|
|
||||||
AddSchVirtualLogDTO addSchVirtualLogDTO = new AddSchVirtualLogDTO();
|
|
||||||
addSchVirtualLogDTO.setCpuUtilization((String) ((JSONObject) info.get("cpuInfo")).get("cSys"));
|
|
||||||
addSchVirtualLogDTO.setMemoryTotal((String) ((JSONObject) info.get("memInfo")).get("total"));
|
|
||||||
addSchVirtualLogDTO.setMemoryAllowance((String) ((JSONObject) info.get("memInfo")).get("free"));
|
|
||||||
addSchVirtualLogDTO.setUplinkRate((String) ((JSONObject) info.get("networkInfo")).get("txPercent"));
|
|
||||||
addSchVirtualLogDTO.setDescendingRate((String) ((JSONObject) info.get("networkInfo")).get("rxPercent"));
|
|
||||||
addSchVirtualLogDTO.setIp(IpUtil.getIp());
|
|
||||||
addSchVirtualLogDTO.setClientTime(new Date());
|
|
||||||
addSchVirtualLogDTO.setDiskJson(info.get("sysFileInfo").toString());
|
|
||||||
schVirtualLogApi.add(addSchVirtualLogDTO);
|
|
||||||
System.out.println(info);
|
|
||||||
|
|
||||||
log.info("收集虚拟机信息定时任务: 执行完毕");
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("收集虚拟机信息定时任务执行出错", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.docus.server.controller;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.web.request.SearchDTO;
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
import com.docus.server.api.segmentation.OcrSpRuleApi;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
|
||||||
|
import com.docus.server.service.IOcrSpRuleService;
|
||||||
|
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特殊策略表 控制器类
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Api(value = "特殊策略表任务管理接口", tags = "特殊策略表任务管理接口")
|
||||||
|
@RestController
|
||||||
|
public class OcrSpRuleController implements OcrSpRuleApi {
|
||||||
|
@Resource
|
||||||
|
private IOcrSpRuleService iOcrSpRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查询
|
||||||
|
*
|
||||||
|
* @param id 主键Id
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@ApiOperation("按主键查询")
|
||||||
|
@Override
|
||||||
|
public OcrSpRuleVO findById(Long id) {
|
||||||
|
return iOcrSpRuleService.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有
|
||||||
|
*
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询所有")
|
||||||
|
@Override
|
||||||
|
public List<OcrSpRuleVO> findAll() {
|
||||||
|
return iOcrSpRuleService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键字搜索
|
||||||
|
*
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("关键字搜索")
|
||||||
|
@Override
|
||||||
|
public PageResult<OcrSpRuleVO> search(SearchDTO searchDTO) {
|
||||||
|
return iOcrSpRuleService.search(searchDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param addOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增")
|
||||||
|
@Override
|
||||||
|
public boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO) {
|
||||||
|
return iOcrSpRuleService.add(addOcrSpRuleDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param editOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@ApiOperation("编辑")
|
||||||
|
@Override
|
||||||
|
public boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO) {
|
||||||
|
return iOcrSpRuleService.edit(editOcrSpRuleDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param deleteOcrSpRuleDTO 删除参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@ApiOperation("批量删除")
|
||||||
|
@Override
|
||||||
|
public int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO) {
|
||||||
|
return iOcrSpRuleService.delete(deleteOcrSpRuleDTO);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.docus.server.convert;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
import com.docus.server.entity.segmentation.OcrSpRule;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
|
||||||
|
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mappings;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 服务转换器
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OcrSpRuleConvert {
|
||||||
|
|
||||||
|
OcrSpRuleConvert INSTANCE = Mappers.getMapper(OcrSpRuleConvert.class);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OcrSpRule convertDO(AddOcrSpRuleDTO addOcrSpRuleDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OcrSpRule convertDO(EditOcrSpRuleDTO editOcrSpRuleDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OcrSpRule> convertAddDOList(List<AddOcrSpRuleDTO> addOcrSpRuleDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OcrSpRule> convertEditDOList(List<EditOcrSpRuleDTO> editOcrSpRuleDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OcrSpRuleVO convertVO(OcrSpRule ocrSpRule);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<OcrSpRuleVO> convertVO(List<OcrSpRule> ocrSpRuleList);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
PageResult<OcrSpRuleVO> convertVO(PageResult<OcrSpRule> pageResult);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.docus.server.infrastructure.dao;
|
||||||
|
import com.docus.server.entity.segmentation.OcrSpRule;
|
||||||
|
import com.docus.infrastructure.core.db.dao.IBaseDao;
|
||||||
|
import com.docus.infrastructure.web.request.SearchDTO;
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 数据访问接口
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
public interface IOcrSpRuleDao extends IBaseDao<OcrSpRule> {
|
||||||
|
/**
|
||||||
|
* 按主键查询
|
||||||
|
* @param id 主键id
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
OcrSpRule findById(Long id);
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param ocrSpRule 新增参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
boolean add(OcrSpRule ocrSpRule);
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param ocrSpRule 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
boolean edit(OcrSpRule ocrSpRule);
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param ids 主键ids
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
int delete(List<Long> ids);
|
||||||
|
/**
|
||||||
|
* 关键字搜索
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
PageResult<OcrSpRule> search(SearchDTO searchDTO);
|
||||||
|
/**
|
||||||
|
* 名称不重复
|
||||||
|
* @param id 主键
|
||||||
|
* @param name 名称
|
||||||
|
* @return 名称重复数量
|
||||||
|
*/
|
||||||
|
int findByIdAndName(Long id, String name);
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.docus.server.infrastructure.mapper;
|
||||||
|
|
||||||
|
import com.docus.server.entity.segmentation.OcrSpRule;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 Mapper 接口
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OcrSpRuleMapper extends BaseMapper<OcrSpRule> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.docus.server.service;
|
||||||
|
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
|
||||||
|
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
|
||||||
|
import com.docus.server.entity.segmentation.OcrSpRule;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.web.request.SearchDTO;
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 服务接口
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
public interface IOcrSpRuleService {
|
||||||
|
/**
|
||||||
|
* 按主键查询
|
||||||
|
* @param id 主键id
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
OcrSpRuleVO findById(Long id);
|
||||||
|
/**
|
||||||
|
* 查询所有
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
List<OcrSpRuleVO> findAll();
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param addOcrSpRuleDTO 新增参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO);
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param editOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO);
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param deleteOcrSpRuleDTO 删除参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO);
|
||||||
|
/**
|
||||||
|
* 关键字搜索
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
PageResult<OcrSpRuleVO> search(SearchDTO searchDTO);
|
||||||
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
package com.docus.server.service.impl;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.redis.service.IdService;
|
||||||
|
import com.docus.infrastructure.web.request.SearchDTO;
|
||||||
|
import com.docus.infrastructure.web.response.PageResult;
|
||||||
|
import com.docus.server.convert.OcrSpRuleConvert;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.AddOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.DeleteOcrSpRuleDTO;
|
||||||
|
import com.docus.server.dto.segmentation.ocrsprule.EditOcrSpRuleDTO;
|
||||||
|
import com.docus.server.entity.segmentation.OcrSpRule;
|
||||||
|
import com.docus.server.infrastructure.dao.IOcrSpRuleDao;
|
||||||
|
import com.docus.server.service.IOcrSpRuleService;
|
||||||
|
import com.docus.server.vo.segmentation.ocrsprule.OcrSpRuleVO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 特殊策略表 服务实现类
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-08-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OcrSpRuleServiceImpl implements IOcrSpRuleService {
|
||||||
|
@Resource
|
||||||
|
private IOcrSpRuleDao iOcrSpRuleDao;
|
||||||
|
@Resource
|
||||||
|
private IdService idService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*按主键查询
|
||||||
|
* @param id 主键Id
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OcrSpRuleVO findById(Long id) {
|
||||||
|
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.findById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*查询所有
|
||||||
|
* @return 实体
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OcrSpRuleVO> findAll() {
|
||||||
|
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.findAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键字搜索
|
||||||
|
* @param searchDTO 搜索参数
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<OcrSpRuleVO> search(SearchDTO searchDTO) {
|
||||||
|
return OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.search(searchDTO));
|
||||||
|
|
||||||
|
//PageResult<OcrSpRuleVO> result = OcrSpRuleConvert.INSTANCE.convertVO(iOcrSpRuleDao.search(searchDTO));
|
||||||
|
|
||||||
|
//if (CollectionUtils.isEmpty(result.getList())) {
|
||||||
|
//return new PageResult<>();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//Map<String, SchSystemParams> map = iSchSystemParamsService.find(ListUtils.distinctSelect(result.getList(), SchCollectorVO::getCollectorId));
|
||||||
|
|
||||||
|
//result.getList().forEach(p -> {
|
||||||
|
// String collectorId = String.valueOf(p.getCollectorId());
|
||||||
|
// if (map.containsKey(collectorId)) {
|
||||||
|
// p.setCollectorName(map.get(collectorId).getParamName());
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
|
||||||
|
//return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param addOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean add(AddOcrSpRuleDTO addOcrSpRuleDTO) {
|
||||||
|
OcrSpRule ocrSpRule =OcrSpRuleConvert.INSTANCE.convertDO(addOcrSpRuleDTO);
|
||||||
|
ocrSpRule.setId(1);
|
||||||
|
return iOcrSpRuleDao.add(ocrSpRule);
|
||||||
|
|
||||||
|
// String name = addOcrSpRuleDTO.getName();
|
||||||
|
|
||||||
|
//OcrSpRule ocrSpRule = iOcrSpRuleDao.findOneBy("name", name);
|
||||||
|
|
||||||
|
//if (Func.notNull(ocrSpRule)) {
|
||||||
|
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "特殊策略表已经存在");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// OcrSpRule ocrSpRule =OcrSpRuleConvert.INSTANCE.convertDO(addOcrSpRuleDTO);
|
||||||
|
// ocrSpRule.setId(idService.getDateSeq());
|
||||||
|
|
||||||
|
// return iOcrSpRuleDao.add(schCollector);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param editOcrSpRuleDTO 编辑参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean edit(EditOcrSpRuleDTO editOcrSpRuleDTO) {
|
||||||
|
OcrSpRule ocrSpRule =OcrSpRuleConvert.INSTANCE.convertDO(editOcrSpRuleDTO);
|
||||||
|
return iOcrSpRuleDao.edit(ocrSpRule);
|
||||||
|
|
||||||
|
// Long id = editOcrSpRuleDTO.getId();
|
||||||
|
|
||||||
|
// OcrSpRule ocrSpRule = iOcrSpRuleDao.findById(id);
|
||||||
|
|
||||||
|
// if (Func.isNull(ocrSpRule)) {
|
||||||
|
// throw new ApiException(ExceptionCode.ParamIllegal.getCode(), "特殊策略表,无法更新!");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ocrSpRule.setUpdateTime(LocalDateTime.now());
|
||||||
|
// return iOcrSpRuleDao.edit(ocrSpRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param deleteOcrSpRuleDTO 删除参数
|
||||||
|
* @return 成功或失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int delete(DeleteOcrSpRuleDTO deleteOcrSpRuleDTO) {
|
||||||
|
return iOcrSpRuleDao.delete(deleteOcrSpRuleDTO.getIds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +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="com.docus.server.infrastructure.mapper.OcrSpRuleMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap"
|
||||||
|
type="com.docus.server.entity.segmentation.OcrSpRule">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="assort_id" property="assortId"/>
|
||||||
|
<result column="start_json" property="startJson"/>
|
||||||
|
<result column="end_json" property="endJson"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, assort_id, start_json, end_json
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue