企业库
This commit is contained in:
parent
4eef37d7ef
commit
ac021103b8
|
|
@ -10,10 +10,7 @@ import com.bonus.common.domain.mainDatabase.vo.EnterpriseVo;
|
|||
import com.bonus.common.enums.OperaType;
|
||||
import com.bonus.web.service.enterprise.EnterpriseService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -43,7 +40,7 @@ public class EnterpriseController extends BaseController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "主体库", notes = "新增主体库")
|
||||
@GetMapping("addData")
|
||||
@PostMapping("addData")
|
||||
@SysLog(title = "主体库", module = "主体库->新增主体库", businessType = OperaType.INSERT, details = "新增主体库", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:enterprise:add")
|
||||
public AjaxResult addData(@RequestBody EnterpriseDto dto) {
|
||||
|
|
@ -51,7 +48,7 @@ public class EnterpriseController extends BaseController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "主体库", notes = "修改主体库")
|
||||
@GetMapping("editData")
|
||||
@PostMapping("editData")
|
||||
@SysLog(title = "主体库", module = "主体库->修改主体库", businessType = OperaType.UPDATE, details = "修改主体库", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:enterprise:edit")
|
||||
public AjaxResult editData(@RequestBody EnterpriseDto dto) {
|
||||
|
|
@ -59,7 +56,7 @@ public class EnterpriseController extends BaseController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "主体库", notes = "删除主体库")
|
||||
@GetMapping("delData")
|
||||
@PostMapping("delData")
|
||||
@SysLog(title = "主体库", module = "主体库->删除主体库", businessType = OperaType.DELETE, details = "删除主体库", logType = 1)
|
||||
@RequiresPermissions("enterpriseLibrary:enterprise:del")
|
||||
public AjaxResult delData(@RequestBody EnterpriseDto dto) {
|
||||
|
|
|
|||
|
|
@ -75,12 +75,17 @@ public class EnterpriseService {
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addData(EnterpriseDto dto) {
|
||||
// 1.校验数据是否合法
|
||||
// 校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(dto, EnterpriseDto.ADD.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// 1.公司名称和统一社会信用代码不能重复
|
||||
int result = imdEnterpriseService.isRepeat(dto);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("企业名称或统一社会信用代码已存在");
|
||||
}
|
||||
// 2.添加主体库数据
|
||||
imdEnterpriseService.operEnterpriseData(dto, 1);
|
||||
// 3.添加文件
|
||||
|
|
@ -120,6 +125,11 @@ public class EnterpriseService {
|
|||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// 1.公司名称和统一社会信用代码不能重复
|
||||
int result = imdEnterpriseService.isRepeat(dto);
|
||||
if(result > 0){
|
||||
return AjaxResult.error("企业名称或统一社会信用代码已存在");
|
||||
}
|
||||
// 2.修改主体库数据
|
||||
imdEnterpriseService.operEnterpriseData(dto, 2);
|
||||
// 3.如果存在新增文件则添加文件
|
||||
|
|
@ -214,6 +224,6 @@ public class EnterpriseService {
|
|||
}
|
||||
}
|
||||
detailVo.setFileList(fileVoList);
|
||||
return AjaxResult.success();
|
||||
return AjaxResult.success(detailVo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,7 @@ public class ResourceFileVo {
|
|||
|
||||
/**业务类型*/
|
||||
private String businessType;
|
||||
|
||||
/**文件类型 1.图片 2.文件*/
|
||||
private String fileType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.bonus.common.domain.mainDatabase.dto;
|
|||
import com.bonus.common.core.domain.model.LoginUser;
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
|
@ -62,6 +64,8 @@ public class EnterpriseDto {
|
|||
* 成立日期
|
||||
*/
|
||||
@NotNull(message = "成立日期不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date establishedDate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package com.bonus.common.domain.mainDatabase.vo;
|
|||
|
||||
import com.bonus.common.domain.file.vo.ResourceFileVo;
|
||||
import com.bonus.common.domain.mainDatabase.dto.EnterpriseDto;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
@ -99,6 +101,8 @@ public class EnterpriseVo {
|
|||
/**
|
||||
* 成立日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date establishedDate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ public class FileUploadService {
|
|||
try{
|
||||
String fileUrl = minioUtil.getFileUrl(minioConfig.getBucketName(), filePath, 60 * 60 * 12);
|
||||
String lsUrl= fileUrl.replace(minioConfig.getEndpoint(),minioConfig.getUrl());
|
||||
log.info("临时路径:{}",lsUrl);
|
||||
return SysFile.builder()
|
||||
.name("文件名称")
|
||||
.url(lsUrl).build();
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ public class FileUtil {
|
|||
|
||||
// 常见的图片格式
|
||||
private static final List<String> IMAGE_EXTENSIONS = Arrays.asList(
|
||||
"jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "ico",
|
||||
"tiff", "tif", "psd", "raw", "heic", "avif"
|
||||
".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".svg", ".ico",
|
||||
".tiff", ".tif", ".psd", ".raw", ".heic", ".avif"
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -153,4 +153,5 @@ public class FileUtil {
|
|||
String extension = getFileExtension(fileName).toLowerCase();
|
||||
return IMAGE_EXTENSIONS.contains(extension);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getFilesByTable" resultType="com.bonus.common.domain.file.vo.ResourceFileVo">
|
||||
SELECT source_id AS sourceId,
|
||||
file_path AS filePath,
|
||||
source_file_name AS sourceFileName,
|
||||
business_type AS businessType
|
||||
source_file_name AS fileName,
|
||||
business_type AS businessType,
|
||||
file_type AS fileType
|
||||
FROM sys_resource_file
|
||||
WHERE business_id = #{businessId} AND source_table = #{dataBaseName} AND del_flag = '0'
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -61,4 +61,13 @@ public interface IMDEnterpriseMapper {
|
|||
* @date 2025/10/23 13:29
|
||||
*/
|
||||
EnterpriseVo.EnterpriseDetailVo getEnterpriseData(EnterpriseDto dto);
|
||||
|
||||
/**
|
||||
* 公司名称和统一社会信用代码不能重复
|
||||
* @param dto
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/10/23 14:08
|
||||
*/
|
||||
int isRepeat(EnterpriseDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,4 +49,13 @@ public interface IMDEnterpriseService {
|
|||
* @date 2025/10/23 13:27
|
||||
*/
|
||||
EnterpriseVo.EnterpriseDetailVo getEnterpriseData(EnterpriseDto dto);
|
||||
|
||||
/**
|
||||
* 公司名称和统一社会信用代码不能重复
|
||||
* @param dto
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/10/23 14:07
|
||||
*/
|
||||
int isRepeat(EnterpriseDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,14 @@ public class MDEnterpriseServiceImpl implements IMDEnterpriseService {
|
|||
return new EnterpriseVo.EnterpriseDetailVo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isRepeat(EnterpriseDto dto) {
|
||||
try {
|
||||
return Optional.ofNullable(imdEnterpriseMapper.isRepeat(dto)).orElse(0);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,9 +65,18 @@
|
|||
FROM tb_enterprise
|
||||
WHERE enterprise_id = #{enterpriseId}
|
||||
</select>
|
||||
<!--公司名称和统一社会信用代码不能重复-->
|
||||
<select id="isRepeat" resultType="java.lang.Integer">
|
||||
<if test="enterpriseId == null">
|
||||
SELECT COUNT(*) FROM tb_enterprise WHERE (enterprise_name = #{enterpriseName} OR enterprise_code = #{enterpriseCode}) AND del_flag = '0';
|
||||
</if>
|
||||
<if test="enterpriseId!=null">
|
||||
SELECT COUNT(*) FROM tb_enterprise WHERE (enterprise_name = #{enterpriseName} AND enterprise_code = #{enterpriseCode}) AND del_flag = '0' AND enterprise_id !=#{enterpriseId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--操作主体库数据-->
|
||||
<insert id="operEnterpriseData" useGeneratedKeys="true" keyColumn="enterpriseId">
|
||||
<insert id="operEnterpriseData" useGeneratedKeys="true" keyProperty="params.enterpriseId" keyColumn="enterprise_id">
|
||||
<if test="type == 1">
|
||||
INSERT INTO tb_enterprise
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -75,7 +84,7 @@
|
|||
<if test="params.enterpriseCode != null and params.enterpriseCode!=''">enterprise_code,</if>
|
||||
<if test="params.registeredCapital != null and params.registeredCapital!=''">registered_capital,</if>
|
||||
<if test="params.businessTerm != null and params.businessTerm!=''">business_term,</if>
|
||||
<if test="params.establishedDate != null and params.establishedDate!=''">established_date,</if>
|
||||
<if test="params.establishedDate != null">established_date,</if>
|
||||
<if test="params.residence != null and params.residence!=''">residence,</if>
|
||||
<if test="params.businessScope != null and params.businessScope!=''">business_scope,</if>
|
||||
<if test="params.legalPersonName != null and params.legalPersonName!=''">legal_person_name,</if>
|
||||
|
|
@ -85,13 +94,17 @@
|
|||
<if test="params.legalPersonPhone != null and params.legalPersonPhone!=''">legal_person_phone,</if>
|
||||
<if test="params.openingBank != null and params.openingBank!=''">opening_bank,</if>
|
||||
<if test="params.openingAccount != null and params.openingAccount!=''">opening_account,</if>
|
||||
create_user_id,
|
||||
create_user_name,
|
||||
update_user_id,
|
||||
update_user_name
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="params.enterpriseName != null and params.enterpriseName!=''">#{params.enterpriseName},</if>
|
||||
<if test="params.enterpriseCode != null and params.enterpriseCode!=''">#{params.enterpriseCode},</if>
|
||||
<if test="params.registeredCapital != null and params.registeredCapital!=''">#{params.registeredCapital},</if>
|
||||
<if test="params.businessTerm != null and params.businessTerm!=''">#{params.businessTerm},</if>
|
||||
<if test="params.establishedDate != null and params.establishedDate!=''">#{params.establishedDate},</if>
|
||||
<if test="params.establishedDate != null">#{params.establishedDate},</if>
|
||||
<if test="params.residence != null and params.residence!=''">#{params.residence},</if>
|
||||
<if test="params.businessScope != null and params.businessScope!=''">#{params.businessScope},</if>
|
||||
<if test="params.legalPersonName != null and params.legalPersonName!=''">#{params.legalPersonName},</if>
|
||||
|
|
@ -101,6 +114,10 @@
|
|||
<if test="params.legalPersonPhone != null and params.legalPersonPhone!=''">#{params.legalPersonPhone},</if>
|
||||
<if test="params.openingBank != null and params.openingBank!=''">#{params.openingBank},</if>
|
||||
<if test="params.openingAccount != null and params.openingAccount!=''">#{params.openingAccount},</if>
|
||||
#{params.createUserId},
|
||||
#{params.createUserName},
|
||||
#{params.updateUserId},
|
||||
#{params.updateUserName},
|
||||
</trim>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ public class OcrService {
|
|||
// 设置 Accept 头
|
||||
httpPost.setHeader("Accept", "application/json");
|
||||
|
||||
log.info("OCR服务开始识别");
|
||||
// 执行请求
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
HttpEntity entity = response.getEntity();
|
||||
|
|
|
|||
Loading…
Reference in New Issue