Merge remote-tracking branch 'origin/main'

new
@zhu-yuefeng 1 year ago
commit 37a3ca9723

@ -0,0 +1,7 @@
--
ALTER TABLE archives_bank_slip ADD COLUMN `staff_id` bigint(20) NULL DEFAULT NULL COMMENT 'id';
ALTER TABLE archives_bank_slip ADD COLUMN `staff_name` varchar(64) NULL DEFAULT NULL COMMENT '';
ALTER TABLE archives_bank_slip ADD COLUMN `subscription_status` varchar(64) NULL DEFAULT NULL COMMENT ' 0: 1 ';
ALTER TABLE archives_flow ADD COLUMN `password` varchar(64) NULL DEFAULT NULL COMMENT '';

@ -0,0 +1 @@
ALTER TABLE archives_bank_slip ADD COLUMN `file_url` varchar(64) NULL DEFAULT NULL COMMENT '';

@ -12,4 +12,9 @@ public interface ErrorCodeConstants {
ErrorCode ACCOUNTING_REPORT_NOT_EXISTS = new ErrorCode(500100, "会计报表不存在");
ErrorCode INVOICES_NOT_EXISTS = new ErrorCode(400100, "发票不存在");
ErrorCode FLOW_NOT_EXISTS = new ErrorCode(300400, "审批流程不存在");
ErrorCode BANK_SLIP_NOT_EXISTS = new ErrorCode(400500, "银行回单不存在");
}

@ -54,7 +54,7 @@ public class AttachmentController {
@PostMapping("/upload")
@Operation(summary = "上传会计附件")
@Parameter(name = "multipartFile", description = "文件", required = true)
@PreAuthorize("@ss.hasPermission('accounting:other:create')")
@PreAuthorize("@ss.hasPermission('accounting:attachment:create')")
public CommonResult<FileDO> upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException {
String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
FilePageReqVO pageReqVO = new FilePageReqVO();

@ -1,34 +1,39 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip;
import cn.hutool.core.io.IoUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.*;
import cn.iocoder.yudao.module.accounting.convert.bankslip.BankSlipConvert;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankReceiptDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.module.accounting.service.bankslip.BankSlipService;
import cn.iocoder.yudao.module.bs.utils.BaiduOcrHandler;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.DataInput;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.module.archives.convert.bankslip.BankSlipConvert;
import cn.iocoder.yudao.module.archives.service.bankslip.BankSlipService;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 银行回单")
@RestController
@ -42,6 +47,7 @@ public class BankSlipController {
@Resource
private PasswordsService passwordsService;
@PostMapping("/create")
@Operation(summary = "创建银行回单")
@PreAuthorize("@ss.hasPermission('archives:bank-slip:create')")
@ -50,7 +56,7 @@ public class BankSlipController {
}
@PutMapping("/update")
@Operation(summary = "更新银行回单")
@Operation(summary = "更新/认款银行回单")
@PreAuthorize("@ss.hasPermission('archives:bank-slip:update')")
public CommonResult<Boolean> updateBankSlip(@Valid @RequestBody BankSlipUpdateReqVO updateReqVO) {
bankSlipService.updateBankSlip(updateReqVO);
@ -95,7 +101,7 @@ public class BankSlipController {
@GetMapping("/downloadXml")
@Operation(summary = "获得银行回单分页Xml")
@PreAuthorize("@ss.hasPermission('accounting:invoices:query')")
public void downloadXml(@Valid BankSlipPageReqVO pageVO,HttpServletResponse response) throws IOException {
public void downloadXml(@Valid BankSlipPageReqVO pageVO, HttpServletResponse response) throws IOException {
PageResult<BankSlipDO> pageResult = bankSlipService.getBankSlipPage(pageVO);
PageResult<BankSlipRespVO> invoicesRespVOPageResult = BankSlipConvert.INSTANCE.convertPage(pageResult);
String jsonString = JSONObject.toJSONString(invoicesRespVOPageResult);
@ -122,4 +128,33 @@ public class BankSlipController {
ExcelUtils.write(response, "银行回单.xls", "数据", BankSlipExcelVO.class, datas);
}
@PostMapping("/bankReceipt/identify")
@Operation(summary = "银行回单识别")
public CommonResult identify(@RequestParam("multipartFile") MultipartFile multipartFile) throws Exception {
String imageBase64Param = BaiduOcrHandler.getImageBase64Param(multipartFile);
String originalFileName = multipartFile.getOriginalFilename();
int lastDotIndex = originalFileName.lastIndexOf(".");
String fileExtension = originalFileName.substring(lastDotIndex + 1);
JSONObject ocrResult = null;
//发票识别
switch (fileExtension.toLowerCase()) {
case "pdf":
ocrResult = BaiduOcrHandler.bankReceiptOcr(imageBase64Param, "pdf");
break;
default:
// 获取文件大小(以字节为单位)
long fileSize = multipartFile.getSize();
// 判断文件大小是否小于6MB
if (fileSize < 6 * 1024 * 1024) {
ocrResult = BaiduOcrHandler.bankReceiptOcr(imageBase64Param, "image");
} else {
return error("图像数据base64编码后进行urlencode要求base64编码和urlencode后大小不超过6M最短边至少15px最长边最大4096px支持jpg/jpeg/png/bmp格式");
}
}
System.out.println(ocrResult);
BankReceiptDO wordsResult = JSONObject.toJavaObject( ocrResult, BankReceiptDO.class);
BankSlipDO bankSlipDO = bankSlipService.jsonToJavaObject(wordsResult, multipartFile);
return success(bankSlipDO);
}
}

@ -1,15 +1,11 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
@ -140,4 +136,17 @@ public class BankSlipBaseVO {
@Schema(description = "密码")
private String password;
@Schema(description = "认款员工id")
private String staffId;
@Schema(description = "认款员工名称")
private String staffName;
@Schema(description = "认款状态 0:未认款 1 已认款")
private String subscriptionStatus;
@Schema(description = "银行回单地址")
private String fileUrl;
}

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 银行回单创建 Request VO")
@Data

@ -1,14 +1,9 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Excel VO

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 银行回单 Excel 导出 Request VO参数和 BankSlipPageReqVO 是一致的")

@ -1,10 +1,12 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 银行回单 Response VO")

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 银行回单更新 Request VO")
@Data

@ -1,39 +1,40 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow;
package cn.iocoder.yudao.module.accounting.controller.admin.flow;
import cn.hutool.core.io.IoUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.*;
import cn.iocoder.yudao.module.accounting.convert.flow.FlowConvert;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.module.accounting.service.flow.FlowService;
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.*;
import javax.servlet.http.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
import cn.iocoder.yudao.module.archives.service.flow.FlowService;
import org.springframework.web.multipart.MultipartFile;
import sun.security.util.Password;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 审批流程")
@RestController
@ -55,28 +56,23 @@ public class FlowController {
@Operation(summary = "创建审批流程")
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
public CommonResult<Long> createFlow(@Valid @RequestBody FlowCreateReqVO createReqVO) {
createReqVO.setFlowCode(execute());
return success(flowService.createFlow(createReqVO));
}
/**
* 簿
*/
@PostMapping("/upload")
@Operation(summary = "上传审批流程图")
@Operation(summary = "上传审批流程img")
@Parameter(name = "multipartFile", description = "文件", required = true)
@PreAuthorize("@ss.hasPermission('archives:flow:create')")
public Long uploadAccountingBook(@RequestPart("multipartFile") MultipartFile multipartFile) {
FlowCreateReqVO vo = new FlowCreateReqVO();
try {
String uri = fileService.createFile(multipartFile.getName(), multipartFile.getOriginalFilename(), multipartFile.getBytes());
vo.setSuffix(multipartFile.getOriginalFilename())
.setFileUrl(uri)
.setFileAp(uri)
.setFlowCode(execute());
}catch (Exception e){
e.printStackTrace();
}
return flowService.createFlow(vo);
public CommonResult<FileDO> upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException {
String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
FilePageReqVO pageReqVO = new FilePageReqVO();
String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
pageReqVO.setPath(lastSegment);
PageResult<FileDO> filePage = fileService.getFilePage(pageReqVO);
return success(filePage.getList().get(0));
}
/**

@ -1,12 +1,7 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import lombok.Data;
/**
* Base VO VO 使

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 审批流程创建 Request VO")
@Data

@ -1,13 +1,9 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Excel VO

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 审批流程 Excel 导出 Request VO参数和 FlowPageReqVO 是一致的")

@ -1,10 +1,12 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 审批流程 Response VO")

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.archives.controller.admin.flow.vo;
package cn.iocoder.yudao.module.accounting.controller.admin.flow.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 审批流程更新 Request VO")
@Data

@ -1,5 +1,25 @@
package cn.iocoder.yudao.module.accounting.controller.admin.voucher;
import cn.iocoder.yudao.module.accounting.controller.admin.attachment.vo.AttachmentCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.attachment.vo.AttachmentExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipPageReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipRespVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesRespVO;
import cn.iocoder.yudao.module.accounting.convert.bankslip.BankSlipConvert;
import cn.iocoder.yudao.module.accounting.convert.invoices.InvoicesConvert;
import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
import cn.iocoder.yudao.module.accounting.service.attachment.AttachmentService;
import cn.iocoder.yudao.module.accounting.service.bankslip.BankSlipService;
import cn.iocoder.yudao.module.accounting.service.flow.FlowService;
import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService;
import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -38,6 +58,18 @@ public class VoucherController {
@Resource
private VoucherService voucherService;
@Resource
private AttachmentService attachmentService;
@Resource
private BankSlipService bankSlipService;
@Resource
private InvoicesService invoicesService;
@Resource
private FlowService flowService;
@Resource
private PasswordsService passwordsService;
@PostMapping("/create")
@Operation(summary = "创建会计凭证")
@ -87,12 +119,74 @@ public class VoucherController {
return success(VoucherConvert.INSTANCE.convertList(list));
}
@GetMapping("/downloadXml")
@Operation(summary = "获得会计凭证分页Xml")
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public void downloadXml(@Valid VoucherPageReqVO pageVO, HttpServletResponse response) throws IOException {
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
PageResult<VoucherRespVO> voucherRespVOPageResult = VoucherConvert.INSTANCE.convertPage(pageResult);
String jsonString = JSONObject.toJSONString(voucherRespVOPageResult);
passwordsService.jsonToXmlConverter(response,pageVO.getInputPassword(),jsonString);
}
@GetMapping("/page")
@Operation(summary = "获得会计凭证分页")
@PreAuthorize("@ss.hasPermission('accounting:voucher:query')")
public CommonResult<PageResult<VoucherRespVO>> getVoucherPage(@Valid VoucherPageReqVO pageVO) {
PageResult<VoucherDO> pageResult = voucherService.getVoucherPage(pageVO);
return success(VoucherConvert.INSTANCE.convertPage(pageResult));
int i=0;
String remark="";
//完整性检查
List<VoucherDO> list = pageResult.getList();
for (VoucherDO voucherDO:list
) {
Long id = voucherDO.getId();
AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO();
attachmentExportReqVO.setVoucherId(id);
List<AttachmentDO> attachmentList = attachmentService.getAttachmentList(attachmentExportReqVO);
if (attachmentList.size()<1){
remark=remark+"缺少附件";
}else {
i++;
}
FlowExportReqVO flowExportReqVO = new FlowExportReqVO();
flowExportReqVO.setVoucherId(id);
List<FlowDO> flowList = flowService.getFlowList(flowExportReqVO);
if (flowList.size()<1){
remark=remark+";缺少审批流程";
}else {
i++;
}
InvoicesExportReqVO invoicesExportReqVO = new InvoicesExportReqVO().setVoucherId(id);
List<InvoicesDO> invoicesList = invoicesService.getInvoicesList(invoicesExportReqVO);
if (invoicesList.size()<1){
remark=remark+";缺少电子发票";
}else {
i++;
}
BankSlipExportReqVO bankSlipExportReqVO = new BankSlipExportReqVO();
bankSlipExportReqVO.setVoucherId(id);
List<BankSlipDO> bankSlipList = bankSlipService.getBankSlipList(bankSlipExportReqVO);
if (bankSlipList.size()<1){
remark=remark+";缺少银行回单";
}else {
i++;
}
if(i!=4){
voucherDO.setCherks(0);
}else {
voucherDO.setCherks(1);
}
VoucherUpdateReqVO voucherUpdateReqVO = new VoucherUpdateReqVO();
voucherUpdateReqVO.setId(id);
voucherUpdateReqVO.setCherks(voucherDO.getCherks());
voucherUpdateReqVO.setRemark(remark);
voucherService.updateVoucher(voucherUpdateReqVO);
}
PageResult<VoucherDO> pageResult2 = voucherService.getVoucherPage(pageVO);
return success(VoucherConvert.INSTANCE.convertPage(pageResult2));
}
@GetMapping("/export-excel")

@ -108,4 +108,7 @@ public class VoucherPageReqVO extends PageParam {
@Schema(description = "档案柜ID", example = "1586")
private Long cabinetId;
@Schema(description = "密码", example = "1586")
private String inputPassword;
}

@ -1,13 +1,16 @@
package cn.iocoder.yudao.module.archives.convert.bankslip;
package cn.iocoder.yudao.module.accounting.convert.bankslip;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExcelVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipRespVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipUpdateReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.bankslip.BankSlipDO;
import java.util.List;
/**
* Convert

@ -1,13 +1,15 @@
package cn.iocoder.yudao.module.archives.convert.flow;
import java.util.*;
package cn.iocoder.yudao.module.accounting.convert.flow;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExcelVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowRespVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowUpdateReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
import java.util.List;
/**
* Convert

@ -0,0 +1,109 @@
package cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.*;
import java.io.DataInput;
import java.util.List;
/**
*
*/
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class BankReceiptDO {
private String log_id;
private int words_result_num;
private WordsResult words_result;
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class WordsResult {
private List<PaymentAccount> ;
private List<TransactionDate> ;
private List<String> ;
private List<String> ;
private List<String> ;
private List<String> ;
private List<LowerAmount> ;
private List<PaymentAccount> ;
private List<UpperAmount> ;
private List<String> ;
private List<String> ;
private List<String> ;
private List<String> ;
private List<String> ;
// 添加相应的 getter 和 setter 方法
}
// @Data
// @ToString(callSuper = true)
// @NoArgsConstructor
// @AllArgsConstructor
// public static class WordsResultData {
// private PaymentAccount 付款人账号;
// private TransactionDate 交易日期;
// private String 用途;
// private String 流水号;
// private String 摘要;
// private String 付款人户名;
// private LowerAmount 小写金额;
// private PaymentAccount 收款人账号;
// private UpperAmount 大写金额;
// private String 收款人户名;
// private String 标题;
// private String 回单编号;
// private String 付款人开户银行;
// private String 收款人开户银行;
//
// // 添加相应的 getter 和 setter 方法
// }
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class PaymentAccount {
private String word;
// 添加相应的 getter 和 setter 方法
}
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class TransactionDate {
private String word;
// 添加相应的 getter 和 setter 方法
}
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class LowerAmount {
private String word;
// 添加相应的 getter 和 setter 方法
}
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public static class UpperAmount {
private String word;
}
}

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.archives.dal.dataobject.bankslip;
package cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
@ -17,6 +17,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@TableName("archives_bank_slip")
@KeySequence("archives_bank_slip_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@ -190,4 +191,25 @@ public class BankSlipDO extends BaseDO {
*/
private String password;
/**
* id
*/
private String staffId;
/**
*
*/
private String staffName;
/**
* 0: 1
*/
private String subscriptionStatus;
/**
*
*/
private String fileUrl;
}

@ -1,13 +1,10 @@
package cn.iocoder.yudao.module.archives.dal.dataobject.flow;
package cn.iocoder.yudao.module.accounting.dal.dataobject.flow;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.experimental.Accessors;
/**

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.archives.dal.mysql.bankslip;
import java.util.*;
package cn.iocoder.yudao.module.accounting.dal.mysql.bankslip;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.archives.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipPageReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo.*;
import java.util.List;
/**
* Mapper

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.archives.dal.mysql.flow;
import java.util.*;
package cn.iocoder.yudao.module.accounting.dal.mysql.flow;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowPageReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
import java.util.List;
/**
* Mapper

@ -1,10 +1,19 @@
package cn.iocoder.yudao.module.archives.service.bankslip;
package cn.iocoder.yudao.module.accounting.service.bankslip;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipPageReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipUpdateReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankReceiptDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
/**
* Service
@ -74,4 +83,10 @@ public interface BankSlipService {
* @return
*/
PageResult<BankSlipDO> getBankSlipPageTime(Long months);
/**
* json
* @param ocrResult
*/
BankSlipDO jsonToJavaObject(BankReceiptDO ocrResult, MultipartFile multipartFile) throws IOException;
}

@ -0,0 +1,151 @@
package cn.iocoder.yudao.module.accounting.service.bankslip;
import cn.hutool.core.io.IoUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipPageReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipUpdateReqVO;
import cn.iocoder.yudao.module.accounting.convert.bankslip.BankSlipConvert;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankReceiptDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.bankslip.BankSlipMapper;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.DataInput;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.BANK_SLIP_NOT_EXISTS;
/**
* Service
*
* @author
*/
@Service
@Validated
public class BankSlipServiceImpl implements BankSlipService {
@Resource
private BankSlipMapper bankSlipMapper;
@Resource
private FileService fileService;
@Override
public Long createBankSlip(BankSlipCreateReqVO createReqVO) {
// 插入
BankSlipDO bankSlip = BankSlipConvert.INSTANCE.convert(createReqVO);
bankSlipMapper.insert(bankSlip);
// 返回
return bankSlip.getId();
}
@Override
public void updateBankSlip(BankSlipUpdateReqVO updateReqVO) {
// 校验存在
validateBankSlipExists(updateReqVO.getId());
// 更新
BankSlipDO updateObj = BankSlipConvert.INSTANCE.convert(updateReqVO);
bankSlipMapper.updateById(updateObj);
}
@Override
public void deleteBankSlip(Long id) {
// 校验存在
validateBankSlipExists(id);
// 删除
bankSlipMapper.deleteById(id);
}
private void validateBankSlipExists(Long id) {
if (bankSlipMapper.selectById(id) == null) {
throw exception(BANK_SLIP_NOT_EXISTS);
}
}
@Override
public BankSlipDO getBankSlip(Long id) {
return bankSlipMapper.selectById(id);
}
@Override
public List<BankSlipDO> getBankSlipList(Collection<Long> ids) {
return bankSlipMapper.selectBatchIds(ids);
}
@Override
public PageResult<BankSlipDO> getBankSlipPage(BankSlipPageReqVO pageReqVO) {
return bankSlipMapper.selectPage(pageReqVO);
}
@Override
public List<BankSlipDO> getBankSlipList(BankSlipExportReqVO exportReqVO) {
return bankSlipMapper.selectList(exportReqVO);
}
/**
*
*
* @param months
* @return
*/
@Override
public PageResult<BankSlipDO> getBankSlipPageTime(Long months) {
QueryWrapper<BankSlipDO> wrapper = new QueryWrapper<>();
wrapper.ge("trad_time", LocalDateTime.now().minusMonths(months));
List<BankSlipDO> invoicesDOS = bankSlipMapper.selectList(wrapper);
PageResult<BankSlipDO> pageResult = new PageResult<>();
pageResult.setList(invoicesDOS);
long size =(long) invoicesDOS.size();
pageResult.setTotal(size);
return pageResult;
}
/**
* json
* @param bankReceiptDO
*/
@Override
public BankSlipDO jsonToJavaObject(BankReceiptDO bankReceiptDO, MultipartFile multipartFile) throws IOException {
BankSlipDO bankSlipDO = new BankSlipDO();
String invoiceDateStr = bankReceiptDO.getWords_result().get().get(0).getWord().replace("年", "-").replaceAll("月", "-").replaceAll("日", "").trim();
LocalDate parse = LocalDate.parse(invoiceDateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDateTime date = parse.atStartOfDay();;
bankSlipDO.setTradTime(date);
// 将日期字符串解析为 LocalDate 对象
//这里用中文是因为调用百度ocr银行回单的接口返回的数据json都是中文的
bankSlipDO
.setBank(bankReceiptDO.getWords_result().get().get(0))
.setMyCompany(bankReceiptDO.getWords_result().get().get(0))
.setMyNum(bankReceiptDO.getWords_result().get().get(0).getWord())
.setAdverseCompany(bankReceiptDO.getWords_result().get().get(0))
.setAdverseNum(bankReceiptDO.getWords_result().get().get(0).getWord())
.setSerialNum(bankReceiptDO.getWords_result().get().get(0))
.setTradMoney(bankReceiptDO.getWords_result().get().get(0).getWord())
.setReceiptNum(bankReceiptDO.getWords_result().get().get(0))
.setDigest(bankReceiptDO.getWords_result().get().get(0))
.setPurpose(bankReceiptDO.getWords_result().get().get(0))
;
bankSlipDO.setFileUrl(
fileService.createFile(null, null, IoUtil.readBytes(multipartFile.getInputStream())));
return bankSlipDO;
}
}

@ -1,10 +1,17 @@
package cn.iocoder.yudao.module.archives.service.flow;
package cn.iocoder.yudao.module.accounting.service.flow;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowPageReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowUpdateReqVO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* Service

@ -1,19 +1,24 @@
package cn.iocoder.yudao.module.archives.service.flow;
package cn.iocoder.yudao.module.accounting.service.flow;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowCreateReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowPageReqVO;
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowUpdateReqVO;
import cn.iocoder.yudao.module.accounting.convert.flow.FlowConvert;
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.flow.FlowMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.archives.controller.admin.flow.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.flow.FlowDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.archives.convert.flow.FlowConvert;
import cn.iocoder.yudao.module.archives.dal.mysql.flow.FlowMapper;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.FLOW_NOT_EXISTS;
/**
* Service

@ -1,6 +1,6 @@
<?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.iocoder.yudao.module.archives.dal.mysql.bankslip.BankSlipMapper">
<mapper namespace="cn.iocoder.yudao.module.accounting.dal.mysql.bankslip.BankSlipMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。

@ -1,6 +1,6 @@
<?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.iocoder.yudao.module.archives.dal.mysql.flow.FlowMapper">
<mapper namespace="cn.iocoder.yudao.module.accounting.dal.mysql.flow.FlowMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。

@ -11,8 +11,6 @@ public interface ErrorCodeConstants {
ErrorCode AUTHENTICATE_NOT_EXISTS = new ErrorCode(300300,"档案鉴定历史不存在");
ErrorCode FLOW_NOT_EXISTS = new ErrorCode(300400, "审批流程不存在");
ErrorCode BANK_SLIP_NOT_EXISTS = new ErrorCode(400500, "银行回单不存在");
}

@ -1,101 +0,0 @@
package cn.iocoder.yudao.module.archives.service.bankslip;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*;
import cn.iocoder.yudao.module.archives.controller.admin.bankslip.vo.*;
import cn.iocoder.yudao.module.archives.dal.dataobject.bankslip.BankSlipDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.archives.convert.bankslip.BankSlipConvert;
import cn.iocoder.yudao.module.archives.dal.mysql.bankslip.BankSlipMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class BankSlipServiceImpl implements BankSlipService {
@Resource
private BankSlipMapper bankSlipMapper;
@Override
public Long createBankSlip(BankSlipCreateReqVO createReqVO) {
// 插入
BankSlipDO bankSlip = BankSlipConvert.INSTANCE.convert(createReqVO);
bankSlipMapper.insert(bankSlip);
// 返回
return bankSlip.getId();
}
@Override
public void updateBankSlip(BankSlipUpdateReqVO updateReqVO) {
// 校验存在
validateBankSlipExists(updateReqVO.getId());
// 更新
BankSlipDO updateObj = BankSlipConvert.INSTANCE.convert(updateReqVO);
bankSlipMapper.updateById(updateObj);
}
@Override
public void deleteBankSlip(Long id) {
// 校验存在
validateBankSlipExists(id);
// 删除
bankSlipMapper.deleteById(id);
}
private void validateBankSlipExists(Long id) {
if (bankSlipMapper.selectById(id) == null) {
throw exception(BANK_SLIP_NOT_EXISTS);
}
}
@Override
public BankSlipDO getBankSlip(Long id) {
return bankSlipMapper.selectById(id);
}
@Override
public List<BankSlipDO> getBankSlipList(Collection<Long> ids) {
return bankSlipMapper.selectBatchIds(ids);
}
@Override
public PageResult<BankSlipDO> getBankSlipPage(BankSlipPageReqVO pageReqVO) {
return bankSlipMapper.selectPage(pageReqVO);
}
@Override
public List<BankSlipDO> getBankSlipList(BankSlipExportReqVO exportReqVO) {
return bankSlipMapper.selectList(exportReqVO);
}
/**
*
*
* @param months
* @return
*/
@Override
public PageResult<BankSlipDO> getBankSlipPageTime(Long months) {
QueryWrapper<BankSlipDO> wrapper = new QueryWrapper<>();
wrapper.ge("trad_time", LocalDateTime.now().minusMonths(months));
List<BankSlipDO> invoicesDOS = bankSlipMapper.selectList(wrapper);
PageResult<BankSlipDO> pageResult = new PageResult<>();
pageResult.setList(invoicesDOS);
long size =(long) invoicesDOS.size();
pageResult.setTotal(size);
return pageResult;
}
}

@ -55,4 +55,9 @@ public interface BaiduOcrConstant {
* ofdpdf
*/
String INVOICEURL_VERIFICATION = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice_verification";
/**
* img,pdf
*/
String BANK_RECEIPT = "https://aip.baidubce.com/rest/2.0/ocr/v1/bank_receipt_new";
}

@ -333,6 +333,34 @@ public class BaiduOcrHandler {
return null;
}
/**
*
* @param baseStr
* @param fileType
* @return
* @throws Exception
*/
public static JSONObject bankReceiptOcr(String baseStr, String fileType) throws Exception {
String accessToken = getAccessToken();
if (StringUtils.isEmpty(accessToken)) {
throw new RuntimeException("获取token失败");
}
String image = "image";
if (fileType.equals("pdf")) {
image = "pdf_file";
}
String param = image + "=" +baseStr;
String jsonStr = HttpUtil.post(BaiduOcrConstant.BANK_RECEIPT, accessToken, param);
JSONObject jsonObject = JSON.parseObject(jsonStr);
if (!jsonObject.containsKey("words_result")) {
log.error("银行回单识别失败"+jsonObject.toString());
throw exception("银行回单识别失败"+jsonObject.toString());
}
return jsonObject;
}
/**
*
* @param baseStr

@ -45,13 +45,13 @@ spring:
datasource:
master:
name: ruoyi-vue-pro
url: jdbc:mysql://127.0.0.1:3307/lyr-one?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://127.0.0.1:3306/lyr-one?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
username: root
password: 123456
password: root
# username: sa
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
# slave: # 模拟从库,可根据自己需要修改

Loading…
Cancel
Save