发票管理
parent
787dec8227
commit
8930029f8f
@ -0,0 +1,198 @@
|
||||
package cn.iocoder.yudao.module.accounting.controller.admin.invoices;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.FileUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.barcode.BarcodeUtil;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.BaiduInvoicesDO;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.Converter;
|
||||
import cn.iocoder.yudao.module.accounting.enums.AccountingStatusEnum;
|
||||
import cn.iocoder.yudao.module.bs.utils.BaiduOcrHandler;
|
||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import me.zhyd.oauth.log.Log;
|
||||
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 javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
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.accounting.controller.admin.invoices.vo.*;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
import cn.iocoder.yudao.module.accounting.convert.invoices.InvoicesConvert;
|
||||
import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "管理后台 - 发票")
|
||||
@RestController
|
||||
@RequestMapping("/accounting/invoices")
|
||||
@Validated
|
||||
public class InvoicesController {
|
||||
|
||||
@Resource
|
||||
private InvoicesService invoicesService;
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建发票")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:create')")
|
||||
public CommonResult<Long> createInvoices(@Valid @RequestBody InvoicesCreateReqVO createReqVO) {
|
||||
return success(invoicesService.createInvoices(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新发票")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:update')")
|
||||
public CommonResult<Boolean> updateInvoices(@Valid @RequestBody InvoicesUpdateReqVO updateReqVO) {
|
||||
invoicesService.updateInvoices(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除发票")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:delete')")
|
||||
public CommonResult<Boolean> deleteInvoices(@RequestParam("id") Long id) {
|
||||
invoicesService.deleteInvoices(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得发票")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:query')")
|
||||
public CommonResult<InvoicesRespVO> getInvoices(@RequestParam("id") Long id) {
|
||||
InvoicesDO invoices = invoicesService.getInvoices(id);
|
||||
return success(InvoicesConvert.INSTANCE.convert(invoices));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得发票列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:query')")
|
||||
public CommonResult<List<InvoicesRespVO>> getInvoicesList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<InvoicesDO> list = invoicesService.getInvoicesList(ids);
|
||||
return success(InvoicesConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得发票分页")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:query')")
|
||||
public CommonResult<PageResult<InvoicesRespVO>> getInvoicesPage(@Valid InvoicesPageReqVO pageVO) {
|
||||
PageResult<InvoicesDO> pageResult = invoicesService.getInvoicesPage(pageVO);
|
||||
return success(InvoicesConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出发票 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('accounting:invoices:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportInvoicesExcel(@Valid InvoicesExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InvoicesDO> list = invoicesService.getInvoicesList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InvoicesExcelVO> datas = InvoicesConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "发票.xls", "数据", InvoicesExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@PostMapping("/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;
|
||||
//发票识别
|
||||
if (fileExtension.equalsIgnoreCase("ofd")) {
|
||||
ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "ofd");
|
||||
}
|
||||
if (fileExtension.equalsIgnoreCase("pdf")) {
|
||||
ocrResult = BaiduOcrHandler.invoiceOCR(imageBase64Param, "pdf");
|
||||
}
|
||||
BaiduInvoicesDO parse = JSONObject.toJavaObject(ocrResult, BaiduInvoicesDO.class);
|
||||
InvoicesCreateReqVO invoicesDO = Converter.convertInvoiceToInvoicesDO(parse);
|
||||
//发票验真
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
// String dateFormat = invoicesDO.getInvoiceDate().format(formatter);
|
||||
// String checkCode = invoicesDO.getCheckCode();
|
||||
// String lastSixDigits = checkCode.substring(checkCode.length() - 6);
|
||||
// JSONObject jsonObjectVer = BaiduOcrHandler.invoiceVerification(invoicesDO.getInvoiceCode(),
|
||||
// invoicesDO.getInvoiceNum(),
|
||||
// dateFormat,
|
||||
// AccountingStatusEnum.ELEC_NORMAL_INVOICE.getValue(),
|
||||
// lastSixDigits,
|
||||
// invoicesDO.getTotalAmount());
|
||||
// byte num = 0;
|
||||
// if (jsonObjectVer.get("VerifyResult").equals("0001")) {
|
||||
// num = 1;
|
||||
// invoicesDO.setQrCheckCode(num);
|
||||
// } else {
|
||||
// invoicesDO.setQrCheckCode(num);
|
||||
// if (jsonObjectVer.get("VerifyMessage") != null) {
|
||||
// return error("验真失败" + jsonObjectVer.get("VerifyMessage"));
|
||||
// }
|
||||
// }
|
||||
//发票查重
|
||||
InvoicesExportReqVO queryIn = new InvoicesExportReqVO();
|
||||
queryIn.setInvoiceCode(invoicesDO.getInvoiceCode());
|
||||
queryIn.setInvoiceNum(invoicesDO.getInvoiceNum());
|
||||
List<InvoicesDO> invoicesList = invoicesService.getInvoicesList(queryIn);
|
||||
if (invoicesList.size()>0){
|
||||
invoicesDO.setDuplicateMark(Byte.valueOf(AccountingStatusEnum.DUPLICATE_INVOICE.getValue()));
|
||||
}else {
|
||||
invoicesDO.setDuplicateMark(Byte.valueOf(AccountingStatusEnum.UN_DUPLICATE_INVOICE.getValue()));
|
||||
}
|
||||
String url = getUrl(multipartFile);
|
||||
invoicesDO.setFileUrl(url);
|
||||
invoicesService.createInvoices(invoicesDO);
|
||||
return success(invoicesDO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/verification")
|
||||
@Operation(summary = "发票验真")
|
||||
public CommonResult verification(@RequestParam("invoice_code") String invoice_code,
|
||||
@RequestParam("invoice_num") String invoice_num,
|
||||
@RequestParam("invoice_date") String invoice_date,
|
||||
@RequestParam("invoice_type") String invoice_type,
|
||||
@RequestParam("check_code") String check_code,
|
||||
@RequestParam("total_amount") String total_amount) throws Exception {
|
||||
JSONObject jsonObjectVer = BaiduOcrHandler.invoiceVerification(invoice_code, invoice_num, invoice_date, invoice_type,
|
||||
check_code, total_amount);
|
||||
return success(jsonObjectVer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取发票地址
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
private String getUrl(MultipartFile file) throws Exception{
|
||||
String url="";
|
||||
url = fileService.createFile(null, null, IoUtil.readBytes(file.getInputStream()));
|
||||
return url;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 发票创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvoicesCreateReqVO extends InvoicesBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 发票 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvoicesRespVO extends InvoicesBaseVO {
|
||||
|
||||
@Schema(description = "发票id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5466")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 发票更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InvoicesUpdateReqVO extends InvoicesBaseVO {
|
||||
|
||||
@Schema(description = "发票id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5466")
|
||||
@NotNull(message = "发票id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.accounting.convert.invoices;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
|
||||
/**
|
||||
* 发票 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InvoicesConvert {
|
||||
|
||||
InvoicesConvert INSTANCE = Mappers.getMapper(InvoicesConvert.class);
|
||||
|
||||
InvoicesDO convert(InvoicesCreateReqVO bean);
|
||||
|
||||
InvoicesDO convert(InvoicesUpdateReqVO bean);
|
||||
|
||||
InvoicesRespVO convert(InvoicesDO bean);
|
||||
|
||||
List<InvoicesRespVO> convertList(List<InvoicesDO> list);
|
||||
|
||||
PageResult<InvoicesRespVO> convertPage(PageResult<InvoicesDO> page);
|
||||
|
||||
List<InvoicesExcelVO> convertList02(List<InvoicesDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package cn.iocoder.yudao.module.accounting.dal.dataobject.invoices;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaiduInvoicesDO {
|
||||
|
||||
private String log_id;
|
||||
private int words_result_num;
|
||||
private WordsResult words_result;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class WordsResult {
|
||||
private String InvoiceNumDigit;
|
||||
private String ServiceType;
|
||||
private String InvoiceNum;
|
||||
private String InvoiceNumConfirm;
|
||||
private String SellerName;
|
||||
private List<CommodityTaxRate> CommodityTaxRate;
|
||||
private String SellerBank;
|
||||
private String Checker;
|
||||
private String TotalAmount;
|
||||
private List<CommodityAmount> CommodityAmount;
|
||||
private String InvoiceDate;
|
||||
private List<CommodityTax> CommodityTax;
|
||||
private String PurchaserName;
|
||||
private String CheckCode;
|
||||
private List<CommodityNum> CommodityNum;
|
||||
private String Province;
|
||||
private String City;
|
||||
private String SheetNum;
|
||||
private String Agent;
|
||||
private String PurchaserBank;
|
||||
private String Remarks;
|
||||
private String Password;
|
||||
private String SellerAddress;
|
||||
private String PurchaserAddress;
|
||||
private String InvoiceCode;
|
||||
private String InvoiceCodeConfirm;
|
||||
private List<CommodityUnit> CommodityUnit;
|
||||
private String Payee;
|
||||
private String PurchaserRegisterNum;
|
||||
private List<CommodityPrice> CommodityPrice;
|
||||
private String NoteDrawer;
|
||||
private String AmountInWords;
|
||||
private String AmountInFiguers;
|
||||
private String TotalTax;
|
||||
private String InvoiceType;
|
||||
private String SellerRegisterNum;
|
||||
private List<CommodityName> CommodityName;
|
||||
private List<CommodityType> CommodityType;
|
||||
// Add other fields here...
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityTaxRate {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityAmount {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityTax {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityNum {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityUnit {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityPrice {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityName {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityType {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
// Add other inner classes here...
|
||||
}
|
||||
// Getters, setters, and other utility methods...
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.accounting.dal.dataobject.invoices;
|
||||
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesCreateReqVO;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class Converter {
|
||||
|
||||
public static InvoicesCreateReqVO convertInvoiceToInvoicesDO(BaiduInvoicesDO invoice) {
|
||||
if (invoice == null || invoice.getWords_result() == null) {
|
||||
return null; // or throw an appropriate exception
|
||||
}
|
||||
|
||||
BaiduInvoicesDO.WordsResult wordsResult = invoice.getWords_result();
|
||||
InvoicesCreateReqVO invoicesDO = new InvoicesCreateReqVO();
|
||||
|
||||
invoicesDO.setInvoiceCode(wordsResult.getInvoiceCode());
|
||||
invoicesDO.setInvoiceNum(wordsResult.getInvoiceNum());
|
||||
invoicesDO.setTotalTax(wordsResult.getTotalTax());
|
||||
invoicesDO.setTotalAmount(wordsResult.getTotalAmount());
|
||||
invoicesDO.setAmountinWords(wordsResult.getAmountInWords());
|
||||
if (wordsResult.getCommodityTaxRate()!=null) {
|
||||
if (wordsResult.getCommodityTaxRate().size()>0) {
|
||||
invoicesDO.setTaxRate(wordsResult.getCommodityTaxRate().get(0).getWord());
|
||||
}
|
||||
}
|
||||
if (wordsResult.getCommodityTax()!=null) {
|
||||
if (wordsResult.getCommodityTax().size()>0) {
|
||||
invoicesDO.setCommodityTax(wordsResult.getCommodityTax().get(0).getWord());
|
||||
}
|
||||
}
|
||||
if (wordsResult.getCommodityAmount()!=null) {
|
||||
if (wordsResult.getCommodityAmount().size()>0) {
|
||||
invoicesDO.setCommodityAmount(wordsResult.getCommodityAmount().get(0).getWord());
|
||||
}
|
||||
}
|
||||
invoicesDO.setAmountinFiguers(wordsResult.getAmountInFiguers());
|
||||
invoicesDO.setFoteDrawer(wordsResult.getNoteDrawer());
|
||||
invoicesDO.setSellerAddress(wordsResult.getSellerAddress());
|
||||
invoicesDO.setSellerRegisterNum(wordsResult.getSellerRegisterNum());
|
||||
invoicesDO.setSellerName(wordsResult.getSellerName());
|
||||
invoicesDO.setSellerBank(wordsResult.getSellerBank());
|
||||
invoicesDO.setPurchaserAddress(wordsResult.getPurchaserAddress());
|
||||
invoicesDO.setPurchaserBank(wordsResult.getPurchaserBank());
|
||||
invoicesDO.setPurchaserName(wordsResult.getPurchaserName());
|
||||
invoicesDO.setPurchaserRegisterNum(wordsResult.getPurchaserRegisterNum());
|
||||
invoicesDO.setRemarks(wordsResult.getRemarks());
|
||||
invoicesDO.setSellerBank(wordsResult.getSellerBank());
|
||||
invoicesDO.setPassword(wordsResult.getPassword());
|
||||
invoicesDO.setChecker(wordsResult.getChecker());
|
||||
invoicesDO.setInvoiceType(wordsResult.getInvoiceType());
|
||||
invoicesDO.setPayee(wordsResult.getPayee());
|
||||
invoicesDO.setCheckCode(wordsResult.getCheckCode());
|
||||
// ... and so on for the rest ...
|
||||
|
||||
// Example of a date conversion (assuming that the invoice date in Invoice is in String format)
|
||||
String invoiceDateStr = wordsResult.getInvoiceDate().replace("年", "-").replace("月", "-").replace("日", "").trim();
|
||||
LocalDate parse = LocalDate.parse(invoiceDateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
LocalDateTime invoiceDate = parse.atStartOfDay();;
|
||||
invoicesDO.setInvoiceDate(invoiceDate);
|
||||
|
||||
// Handle other possible transformations or mappings here
|
||||
|
||||
return invoicesDO;
|
||||
}
|
||||
}
|
@ -0,0 +1,313 @@
|
||||
package cn.iocoder.yudao.module.accounting.dal.dataobject.invoices;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 增值税发票验真实体类
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class invoiceVerification {
|
||||
private String log_id;
|
||||
private int words_result_num;
|
||||
private String VerifyFrequency;
|
||||
private String VerifyMessage;
|
||||
private String InvalidSign;
|
||||
private String InvoiceType;
|
||||
private String MachineCode;
|
||||
private String CheckCode;
|
||||
private String InvoiceCode;
|
||||
private String InvoiceDate;
|
||||
private String VerifyResult;
|
||||
private String InvoiceNum;
|
||||
private String TaxControlNum;
|
||||
private List<CommodityEndDate> CommodityEndDate;
|
||||
private String VehicleTonnage;
|
||||
private List<invoiceVerification.CommodityEndDate.CommodityVehicleType> CommodityVehicleType;
|
||||
private List<invoiceVerification.CommodityEndDate.CommodityStartDate> CommodityStartDate;
|
||||
private String SellerAddress;
|
||||
private List<CommodityPrice> CommodityPrice;
|
||||
private String TransportCargoInformation;
|
||||
private String NoteDrawer;
|
||||
private List<CommodityNum> CommodityNum;
|
||||
private String SellerRegisterNum;
|
||||
private String SellerBank;
|
||||
private String Remarks;
|
||||
private String TotalTax;
|
||||
private List<invoiceVerification.CommodityEndDate.CommodityTaxRate> CommodityTaxRate;
|
||||
private List<invoiceVerification.CommodityEndDate.CommodityExpenseItem> CommodityExpenseItem;
|
||||
private String ZeroTaxRateIndicator;
|
||||
private String Carrier;
|
||||
private String SenderCode;
|
||||
private String PurchaserRegisterNum;
|
||||
private String ReceiverCode;
|
||||
private String AmountInFiguers;
|
||||
private String PurchaserBank;
|
||||
private String Checker;
|
||||
private String TollSign;
|
||||
private String VehicleTypeNum;
|
||||
private String DepartureViaArrival;
|
||||
private String Receiver;
|
||||
private String Recipient;
|
||||
private String TotalAmount;
|
||||
private List<CommodityAmount> CommodityAmount;
|
||||
private String PurchaserName;
|
||||
private List<CommodityType> CommodityType;
|
||||
private String Sender;
|
||||
private String PurchaserAddress;
|
||||
private List<CommodityTax> CommodityTax;
|
||||
private String CarrierCode;
|
||||
private List<invoiceVerification.CommodityEndDate.CommodityPlateNum> CommodityPlateNum;
|
||||
private List<CommodityUnit> CommodityUnit;
|
||||
private String Payee;
|
||||
private String RecipientCode;
|
||||
private List<CommodityName> CommodityName;
|
||||
private String SellerName;
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityTax {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityNum {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityUnit {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityPrice {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityName {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityType {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityAmount {
|
||||
private String word;
|
||||
private String row;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityEndDate {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityVehicleType {
|
||||
private String row;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityStartDate {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityPrice {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityNum {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityTaxRate {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityExpenseItem {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityAmount {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityType {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityTax {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityPlateNum {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityUnit {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CommodityName {
|
||||
private String row;
|
||||
private String word;
|
||||
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
// Getters and setters omitted for brevity
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,156 @@
|
||||
package cn.iocoder.yudao.module.accounting.dal.mysql.invoices;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
|
||||
|
||||
/**
|
||||
* 发票 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InvoicesMapper extends BaseMapperX<InvoicesDO> {
|
||||
|
||||
default PageResult<InvoicesDO> selectPage(InvoicesPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InvoicesDO>()
|
||||
.eqIfPresent(InvoicesDO::getVoucherId, reqVO.getVoucherId())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceCode, reqVO.getInvoiceCode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceNum, reqVO.getInvoiceNum())
|
||||
.eqIfPresent(InvoicesDO::getAmountinWords, reqVO.getAmountinWords())
|
||||
.eqIfPresent(InvoicesDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(InvoicesDO::getTotalTax, reqVO.getTotalTax())
|
||||
.eqIfPresent(InvoicesDO::getTaxRate, reqVO.getTaxRate())
|
||||
.eqIfPresent(InvoicesDO::getTotalAmount, reqVO.getTotalAmount())
|
||||
.eqIfPresent(InvoicesDO::getCommodityTax, reqVO.getCommodityTax())
|
||||
.eqIfPresent(InvoicesDO::getCommodityAmount, reqVO.getCommodityAmount())
|
||||
.eqIfPresent(InvoicesDO::getAmountinFiguers, reqVO.getAmountinFiguers())
|
||||
.eqIfPresent(InvoicesDO::getFoteDrawer, reqVO.getFoteDrawer())
|
||||
.eqIfPresent(InvoicesDO::getSellerAddress, reqVO.getSellerAddress())
|
||||
.eqIfPresent(InvoicesDO::getCommodityNum, reqVO.getCommodityNum())
|
||||
.eqIfPresent(InvoicesDO::getSellerRegisterNum, reqVO.getSellerRegisterNum())
|
||||
.eqIfPresent(InvoicesDO::getMachineCode, reqVO.getMachineCode())
|
||||
.eqIfPresent(InvoicesDO::getRemarks, reqVO.getRemarks())
|
||||
.eqIfPresent(InvoicesDO::getSellerBank, reqVO.getSellerBank())
|
||||
.eqIfPresent(InvoicesDO::getCheckCode, reqVO.getCheckCode())
|
||||
.betweenIfPresent(InvoicesDO::getInvoiceDate, reqVO.getInvoiceDate())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserRegisterNum, reqVO.getPurchaserRegisterNum())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceTypeOrg, reqVO.getInvoiceTypeOrg())
|
||||
.eqIfPresent(InvoicesDO::getPassword, reqVO.getPassword())
|
||||
.eqIfPresent(InvoicesDO::getAgent, reqVO.getAgent())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserBank, reqVO.getPurchaserBank())
|
||||
.eqIfPresent(InvoicesDO::getChecker, reqVO.getChecker())
|
||||
.eqIfPresent(InvoicesDO::getCity, reqVO.getCity())
|
||||
.likeIfPresent(InvoicesDO::getPurchaserName, reqVO.getPurchaserName())
|
||||
.eqIfPresent(InvoicesDO::getCommodityType, reqVO.getCommodityType())
|
||||
.eqIfPresent(InvoicesDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceType, reqVO.getInvoiceType())
|
||||
.eqIfPresent(InvoicesDO::getSheetNum, reqVO.getSheetNum())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserAddress, reqVO.getPurchaserAddress())
|
||||
.eqIfPresent(InvoicesDO::getCommodityUnit, reqVO.getCommodityUnit())
|
||||
.eqIfPresent(InvoicesDO::getPayee, reqVO.getPayee())
|
||||
.likeIfPresent(InvoicesDO::getCommodityName, reqVO.getCommodityName())
|
||||
.likeIfPresent(InvoicesDO::getSellerName, reqVO.getSellerName())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceCheck, reqVO.getInvoiceCheck())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceSeal, reqVO.getInvoiceSeal())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceQrcode, reqVO.getInvoiceQrcode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceQrnum, reqVO.getInvoiceQrnum())
|
||||
.eqIfPresent(InvoicesDO::getQrCheckCode, reqVO.getQrCheckCode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceState, reqVO.getInvoiceState())
|
||||
.eqIfPresent(InvoicesDO::getPrintNum, reqVO.getPrintNum())
|
||||
.eqIfPresent(InvoicesDO::getInoutMark, reqVO.getInoutMark())
|
||||
.eqIfPresent(InvoicesDO::getInvalidMark, reqVO.getInvalidMark())
|
||||
.eqIfPresent(InvoicesDO::getDuplicateMark, reqVO.getDuplicateMark())
|
||||
.eqIfPresent(InvoicesDO::getCheckTrue, reqVO.getCheckTrue())
|
||||
.eqIfPresent(InvoicesDO::getEncrypt, reqVO.getEncrypt())
|
||||
.eqIfPresent(InvoicesDO::getCreateBy, reqVO.getCreateBy())
|
||||
.betweenIfPresent(InvoicesDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(InvoicesDO::getRecordId, reqVO.getRecordId())
|
||||
.eqIfPresent(InvoicesDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(InvoicesDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(InvoicesDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(InvoicesDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(InvoicesDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(InvoicesDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(InvoicesDO::getAttr1, reqVO.getAttr1())
|
||||
.eqIfPresent(InvoicesDO::getAttr2, reqVO.getAttr2())
|
||||
.eqIfPresent(InvoicesDO::getAttr3, reqVO.getAttr3())
|
||||
.eqIfPresent(InvoicesDO::getAttr4, reqVO.getAttr4())
|
||||
.eqIfPresent(InvoicesDO::getArchiveState, reqVO.getArchiveState())
|
||||
.orderByDesc(InvoicesDO::getId));
|
||||
}
|
||||
|
||||
default List<InvoicesDO> selectList(InvoicesExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InvoicesDO>()
|
||||
.eqIfPresent(InvoicesDO::getVoucherId, reqVO.getVoucherId())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceCode, reqVO.getInvoiceCode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceNum, reqVO.getInvoiceNum())
|
||||
.eqIfPresent(InvoicesDO::getAmountinWords, reqVO.getAmountinWords())
|
||||
.eqIfPresent(InvoicesDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(InvoicesDO::getTotalTax, reqVO.getTotalTax())
|
||||
.eqIfPresent(InvoicesDO::getTaxRate, reqVO.getTaxRate())
|
||||
.eqIfPresent(InvoicesDO::getTotalAmount, reqVO.getTotalAmount())
|
||||
.eqIfPresent(InvoicesDO::getCommodityTax, reqVO.getCommodityTax())
|
||||
.eqIfPresent(InvoicesDO::getCommodityAmount, reqVO.getCommodityAmount())
|
||||
.eqIfPresent(InvoicesDO::getAmountinFiguers, reqVO.getAmountinFiguers())
|
||||
.eqIfPresent(InvoicesDO::getFoteDrawer, reqVO.getFoteDrawer())
|
||||
.eqIfPresent(InvoicesDO::getSellerAddress, reqVO.getSellerAddress())
|
||||
.eqIfPresent(InvoicesDO::getCommodityNum, reqVO.getCommodityNum())
|
||||
.eqIfPresent(InvoicesDO::getSellerRegisterNum, reqVO.getSellerRegisterNum())
|
||||
.eqIfPresent(InvoicesDO::getMachineCode, reqVO.getMachineCode())
|
||||
.eqIfPresent(InvoicesDO::getRemarks, reqVO.getRemarks())
|
||||
.eqIfPresent(InvoicesDO::getSellerBank, reqVO.getSellerBank())
|
||||
.eqIfPresent(InvoicesDO::getCheckCode, reqVO.getCheckCode())
|
||||
.betweenIfPresent(InvoicesDO::getInvoiceDate, reqVO.getInvoiceDate())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserRegisterNum, reqVO.getPurchaserRegisterNum())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceTypeOrg, reqVO.getInvoiceTypeOrg())
|
||||
.eqIfPresent(InvoicesDO::getPassword, reqVO.getPassword())
|
||||
.eqIfPresent(InvoicesDO::getAgent, reqVO.getAgent())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserBank, reqVO.getPurchaserBank())
|
||||
.eqIfPresent(InvoicesDO::getChecker, reqVO.getChecker())
|
||||
.eqIfPresent(InvoicesDO::getCity, reqVO.getCity())
|
||||
.likeIfPresent(InvoicesDO::getPurchaserName, reqVO.getPurchaserName())
|
||||
.eqIfPresent(InvoicesDO::getCommodityType, reqVO.getCommodityType())
|
||||
.eqIfPresent(InvoicesDO::getProvince, reqVO.getProvince())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceType, reqVO.getInvoiceType())
|
||||
.eqIfPresent(InvoicesDO::getSheetNum, reqVO.getSheetNum())
|
||||
.eqIfPresent(InvoicesDO::getPurchaserAddress, reqVO.getPurchaserAddress())
|
||||
.eqIfPresent(InvoicesDO::getCommodityUnit, reqVO.getCommodityUnit())
|
||||
.eqIfPresent(InvoicesDO::getPayee, reqVO.getPayee())
|
||||
.likeIfPresent(InvoicesDO::getCommodityName, reqVO.getCommodityName())
|
||||
.likeIfPresent(InvoicesDO::getSellerName, reqVO.getSellerName())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceCheck, reqVO.getInvoiceCheck())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceSeal, reqVO.getInvoiceSeal())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceQrcode, reqVO.getInvoiceQrcode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceQrnum, reqVO.getInvoiceQrnum())
|
||||
.eqIfPresent(InvoicesDO::getQrCheckCode, reqVO.getQrCheckCode())
|
||||
.eqIfPresent(InvoicesDO::getInvoiceState, reqVO.getInvoiceState())
|
||||
.eqIfPresent(InvoicesDO::getPrintNum, reqVO.getPrintNum())
|
||||
.eqIfPresent(InvoicesDO::getInoutMark, reqVO.getInoutMark())
|
||||
.eqIfPresent(InvoicesDO::getInvalidMark, reqVO.getInvalidMark())
|
||||
.eqIfPresent(InvoicesDO::getDuplicateMark, reqVO.getDuplicateMark())
|
||||
.eqIfPresent(InvoicesDO::getCheckTrue, reqVO.getCheckTrue())
|
||||
.eqIfPresent(InvoicesDO::getEncrypt, reqVO.getEncrypt())
|
||||
.eqIfPresent(InvoicesDO::getCreateBy, reqVO.getCreateBy())
|
||||
.betweenIfPresent(InvoicesDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(InvoicesDO::getRecordId, reqVO.getRecordId())
|
||||
.eqIfPresent(InvoicesDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(InvoicesDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(InvoicesDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(InvoicesDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(InvoicesDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(InvoicesDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(InvoicesDO::getAttr1, reqVO.getAttr1())
|
||||
.eqIfPresent(InvoicesDO::getAttr2, reqVO.getAttr2())
|
||||
.eqIfPresent(InvoicesDO::getAttr3, reqVO.getAttr3())
|
||||
.eqIfPresent(InvoicesDO::getAttr4, reqVO.getAttr4())
|
||||
.eqIfPresent(InvoicesDO::getArchiveState, reqVO.getArchiveState())
|
||||
.orderByDesc(InvoicesDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.accounting.service.invoices;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 发票 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InvoicesService {
|
||||
|
||||
/**
|
||||
* 创建发票
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createInvoices(@Valid InvoicesCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新发票
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateInvoices(@Valid InvoicesUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除发票
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteInvoices(Long id);
|
||||
|
||||
/**
|
||||
* 获得发票
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 发票
|
||||
*/
|
||||
InvoicesDO getInvoices(Long id);
|
||||
|
||||
/**
|
||||
* 获得发票列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 发票列表
|
||||
*/
|
||||
List<InvoicesDO> getInvoicesList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得发票分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 发票分页
|
||||
*/
|
||||
PageResult<InvoicesDO> getInvoicesPage(InvoicesPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得发票列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 发票列表
|
||||
*/
|
||||
List<InvoicesDO> getInvoicesList(InvoicesExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.accounting.service.invoices;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.accounting.convert.invoices.InvoicesConvert;
|
||||
import cn.iocoder.yudao.module.accounting.dal.mysql.invoices.InvoicesMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 发票 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InvoicesServiceImpl implements InvoicesService {
|
||||
|
||||
@Resource
|
||||
private InvoicesMapper invoicesMapper;
|
||||
|
||||
@Override
|
||||
public Long createInvoices(InvoicesCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
InvoicesDO invoices = InvoicesConvert.INSTANCE.convert(createReqVO);
|
||||
invoicesMapper.insert(invoices);
|
||||
// 返回
|
||||
return invoices.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInvoices(InvoicesUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateInvoicesExists(updateReqVO.getId());
|
||||
// 更新
|
||||
InvoicesDO updateObj = InvoicesConvert.INSTANCE.convert(updateReqVO);
|
||||
invoicesMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInvoices(Long id) {
|
||||
// 校验存在
|
||||
validateInvoicesExists(id);
|
||||
// 删除
|
||||
invoicesMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateInvoicesExists(Long id) {
|
||||
if (invoicesMapper.selectById(id) == null) {
|
||||
throw exception(INVOICES_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvoicesDO getInvoices(Long id) {
|
||||
return invoicesMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InvoicesDO> getInvoicesList(Collection<Long> ids) {
|
||||
return invoicesMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InvoicesDO> getInvoicesPage(InvoicesPageReqVO pageReqVO) {
|
||||
return invoicesMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InvoicesDO> getInvoicesList(InvoicesExportReqVO exportReqVO) {
|
||||
return invoicesMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,647 @@
|
||||
package cn.iocoder.yudao.module.accounting.service.invoices;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
|
||||
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
||||
import cn.iocoder.yudao.module.accounting.dal.mysql.invoices.InvoicesMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link InvoicesServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(InvoicesServiceImpl.class)
|
||||
public class InvoicesServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private InvoicesServiceImpl invoicesService;
|
||||
|
||||
@Resource
|
||||
private InvoicesMapper invoicesMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateInvoices_success() {
|
||||
// 准备参数
|
||||
InvoicesCreateReqVO reqVO = randomPojo(InvoicesCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long invoicesId = invoicesService.createInvoices(reqVO);
|
||||
// 断言
|
||||
assertNotNull(invoicesId);
|
||||
// 校验记录的属性是否正确
|
||||
InvoicesDO invoices = invoicesMapper.selectById(invoicesId);
|
||||
assertPojoEquals(reqVO, invoices);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateInvoices_success() {
|
||||
// mock 数据
|
||||
InvoicesDO dbInvoices = randomPojo(InvoicesDO.class);
|
||||
invoicesMapper.insert(dbInvoices);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
InvoicesUpdateReqVO reqVO = randomPojo(InvoicesUpdateReqVO.class, o -> {
|
||||
o.setId(dbInvoices.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
invoicesService.updateInvoices(reqVO);
|
||||
// 校验是否更新正确
|
||||
InvoicesDO invoices = invoicesMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, invoices);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateInvoices_notExists() {
|
||||
// 准备参数
|
||||
InvoicesUpdateReqVO reqVO = randomPojo(InvoicesUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> invoicesService.updateInvoices(reqVO), INVOICES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteInvoices_success() {
|
||||
// mock 数据
|
||||
InvoicesDO dbInvoices = randomPojo(InvoicesDO.class);
|
||||
invoicesMapper.insert(dbInvoices);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbInvoices.getId();
|
||||
|
||||
// 调用
|
||||
invoicesService.deleteInvoices(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(invoicesMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteInvoices_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> invoicesService.deleteInvoices(id), INVOICES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetInvoicesPage() {
|
||||
// mock 数据
|
||||
InvoicesDO dbInvoices = randomPojo(InvoicesDO.class, o -> { // 等会查询到
|
||||
o.setVoucherId(null);
|
||||
o.setInvoiceCode(null);
|
||||
o.setInvoiceNum(null);
|
||||
o.setAmountinWords(null);
|
||||
o.setPrice(null);
|
||||
o.setTotalTax(null);
|
||||
o.setTaxRate(null);
|
||||
o.setTotalAmount(null);
|
||||
o.setCommodityTax(null);
|
||||
o.setCommodityAmount(null);
|
||||
o.setAmountinFiguers(null);
|
||||
o.setFoteDrawer(null);
|
||||
o.setSellerAddress(null);
|
||||
o.setCommodityNum(null);
|
||||
o.setSellerRegisterNum(null);
|
||||
o.setMachineCode(null);
|
||||
o.setRemarks(null);
|
||||
o.setSellerBank(null);
|
||||
o.setCheckCode(null);
|
||||
o.setInvoiceDate(null);
|
||||
o.setPurchaserRegisterNum(null);
|
||||
o.setInvoiceTypeOrg(null);
|
||||
o.setPassword(null);
|
||||
o.setAgent(null);
|
||||
o.setPurchaserBank(null);
|
||||
o.setChecker(null);
|
||||
o.setCity(null);
|
||||
o.setPurchaserName(null);
|
||||
o.setCommodityType(null);
|
||||
o.setProvince(null);
|
||||
o.setInvoiceType(null);
|
||||
o.setSheetNum(null);
|
||||
o.setPurchaserAddress(null);
|
||||
o.setCommodityUnit(null);
|
||||
o.setPayee(null);
|
||||
o.setCommodityName(null);
|
||||
o.setSellerName(null);
|
||||
o.setInvoiceCheck(null);
|
||||
o.setInvoiceSeal(null);
|
||||
o.setInvoiceQrcode(null);
|
||||
o.setInvoiceQrnum(null);
|
||||
o.setQrCheckCode(null);
|
||||
o.setInvoiceState(null);
|
||||
o.setPrintNum(null);
|
||||
o.setInoutMark(null);
|
||||
o.setInvalidMark(null);
|
||||
o.setDuplicateMark(null);
|
||||
o.setCheckTrue(null);
|
||||
o.setEncrypt(null);
|
||||
o.setCreateBy(null);
|
||||
o.setCreateTime(null);
|
||||
o.setRecordId(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setUserId(null);
|
||||
o.setRemark(null);
|
||||
o.setAttr1(null);
|
||||
o.setAttr2(null);
|
||||
o.setAttr3(null);
|
||||
o.setAttr4(null);
|
||||
o.setArchiveState(null);
|
||||
});
|
||||
invoicesMapper.insert(dbInvoices);
|
||||
// 测试 voucherId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setVoucherId(null)));
|
||||
// 测试 invoiceCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceCode(null)));
|
||||
// 测试 invoiceNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceNum(null)));
|
||||
// 测试 amountinWords 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAmountinWords(null)));
|
||||
// 测试 price 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPrice(null)));
|
||||
// 测试 totalTax 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTotalTax(null)));
|
||||
// 测试 taxRate 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTaxRate(null)));
|
||||
// 测试 totalAmount 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTotalAmount(null)));
|
||||
// 测试 commodityTax 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityTax(null)));
|
||||
// 测试 commodityAmount 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityAmount(null)));
|
||||
// 测试 amountinFiguers 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAmountinFiguers(null)));
|
||||
// 测试 foteDrawer 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setFoteDrawer(null)));
|
||||
// 测试 sellerAddress 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerAddress(null)));
|
||||
// 测试 commodityNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityNum(null)));
|
||||
// 测试 sellerRegisterNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerRegisterNum(null)));
|
||||
// 测试 machineCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setMachineCode(null)));
|
||||
// 测试 remarks 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRemarks(null)));
|
||||
// 测试 sellerBank 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerBank(null)));
|
||||
// 测试 checkCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCheckCode(null)));
|
||||
// 测试 invoiceDate 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceDate(null)));
|
||||
// 测试 purchaserRegisterNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserRegisterNum(null)));
|
||||
// 测试 invoiceTypeOrg 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceTypeOrg(null)));
|
||||
// 测试 password 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPassword(null)));
|
||||
// 测试 agent 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAgent(null)));
|
||||
// 测试 purchaserBank 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserBank(null)));
|
||||
// 测试 checker 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setChecker(null)));
|
||||
// 测试 city 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCity(null)));
|
||||
// 测试 purchaserName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserName(null)));
|
||||
// 测试 commodityType 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityType(null)));
|
||||
// 测试 province 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setProvince(null)));
|
||||
// 测试 invoiceType 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceType(null)));
|
||||
// 测试 sheetNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSheetNum(null)));
|
||||
// 测试 purchaserAddress 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserAddress(null)));
|
||||
// 测试 commodityUnit 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityUnit(null)));
|
||||
// 测试 payee 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPayee(null)));
|
||||
// 测试 commodityName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityName(null)));
|
||||
// 测试 sellerName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerName(null)));
|
||||
// 测试 invoiceCheck 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceCheck(null)));
|
||||
// 测试 invoiceSeal 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceSeal(null)));
|
||||
// 测试 invoiceQrcode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceQrcode(null)));
|
||||
// 测试 invoiceQrnum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceQrnum(null)));
|
||||
// 测试 qrCheckCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setQrCheckCode(null)));
|
||||
// 测试 invoiceState 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceState(null)));
|
||||
// 测试 printNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPrintNum(null)));
|
||||
// 测试 inoutMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInoutMark(null)));
|
||||
// 测试 invalidMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvalidMark(null)));
|
||||
// 测试 duplicateMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDuplicateMark(null)));
|
||||
// 测试 checkTrue 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCheckTrue(null)));
|
||||
// 测试 encrypt 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setEncrypt(null)));
|
||||
// 测试 createBy 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCreateBy(null)));
|
||||
// 测试 createTime 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCreateTime(null)));
|
||||
// 测试 recordId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRecordId(null)));
|
||||
// 测试 companyId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCompany(null)));
|
||||
// 测试 deptId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDeptName(null)));
|
||||
// 测试 userId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRemark(null)));
|
||||
// 测试 attr1 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr1(null)));
|
||||
// 测试 attr2 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr2(null)));
|
||||
// 测试 attr3 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr3(null)));
|
||||
// 测试 attr4 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr4(null)));
|
||||
// 测试 archiveState 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setArchiveState(null)));
|
||||
// 准备参数
|
||||
InvoicesPageReqVO reqVO = new InvoicesPageReqVO();
|
||||
reqVO.setVoucherId(null);
|
||||
reqVO.setInvoiceCode(null);
|
||||
reqVO.setInvoiceNum(null);
|
||||
reqVO.setAmountinWords(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setTotalTax(null);
|
||||
reqVO.setTaxRate(null);
|
||||
reqVO.setTotalAmount(null);
|
||||
reqVO.setCommodityTax(null);
|
||||
reqVO.setCommodityAmount(null);
|
||||
reqVO.setAmountinFiguers(null);
|
||||
reqVO.setFoteDrawer(null);
|
||||
reqVO.setSellerAddress(null);
|
||||
reqVO.setCommodityNum(null);
|
||||
reqVO.setSellerRegisterNum(null);
|
||||
reqVO.setMachineCode(null);
|
||||
reqVO.setRemarks(null);
|
||||
reqVO.setSellerBank(null);
|
||||
reqVO.setCheckCode(null);
|
||||
reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setPurchaserRegisterNum(null);
|
||||
reqVO.setInvoiceTypeOrg(null);
|
||||
reqVO.setPassword(null);
|
||||
reqVO.setAgent(null);
|
||||
reqVO.setPurchaserBank(null);
|
||||
reqVO.setChecker(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setPurchaserName(null);
|
||||
reqVO.setCommodityType(null);
|
||||
reqVO.setProvince(null);
|
||||
reqVO.setInvoiceType(null);
|
||||
reqVO.setSheetNum(null);
|
||||
reqVO.setPurchaserAddress(null);
|
||||
reqVO.setCommodityUnit(null);
|
||||
reqVO.setPayee(null);
|
||||
reqVO.setCommodityName(null);
|
||||
reqVO.setSellerName(null);
|
||||
reqVO.setInvoiceCheck(null);
|
||||
reqVO.setInvoiceSeal(null);
|
||||
reqVO.setInvoiceQrcode(null);
|
||||
reqVO.setInvoiceQrnum(null);
|
||||
reqVO.setQrCheckCode(null);
|
||||
reqVO.setInvoiceState(null);
|
||||
reqVO.setPrintNum(null);
|
||||
reqVO.setInoutMark(null);
|
||||
reqVO.setInvalidMark(null);
|
||||
reqVO.setDuplicateMark(null);
|
||||
reqVO.setCheckTrue(null);
|
||||
reqVO.setEncrypt(null);
|
||||
reqVO.setCreateBy(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setRecordId(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setAttr1(null);
|
||||
reqVO.setAttr2(null);
|
||||
reqVO.setAttr3(null);
|
||||
reqVO.setAttr4(null);
|
||||
reqVO.setArchiveState(null);
|
||||
|
||||
// 调用
|
||||
PageResult<InvoicesDO> pageResult = invoicesService.getInvoicesPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbInvoices, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetInvoicesList() {
|
||||
// mock 数据
|
||||
InvoicesDO dbInvoices = randomPojo(InvoicesDO.class, o -> { // 等会查询到
|
||||
o.setVoucherId(null);
|
||||
o.setInvoiceCode(null);
|
||||
o.setInvoiceNum(null);
|
||||
o.setAmountinWords(null);
|
||||
o.setPrice(null);
|
||||
o.setTotalTax(null);
|
||||
o.setTaxRate(null);
|
||||
o.setTotalAmount(null);
|
||||
o.setCommodityTax(null);
|
||||
o.setCommodityAmount(null);
|
||||
o.setAmountinFiguers(null);
|
||||
o.setFoteDrawer(null);
|
||||
o.setSellerAddress(null);
|
||||
o.setCommodityNum(null);
|
||||
o.setSellerRegisterNum(null);
|
||||
o.setMachineCode(null);
|
||||
o.setRemarks(null);
|
||||
o.setSellerBank(null);
|
||||
o.setCheckCode(null);
|
||||
o.setInvoiceDate(null);
|
||||
o.setPurchaserRegisterNum(null);
|
||||
o.setInvoiceTypeOrg(null);
|
||||
o.setPassword(null);
|
||||
o.setAgent(null);
|
||||
o.setPurchaserBank(null);
|
||||
o.setChecker(null);
|
||||
o.setCity(null);
|
||||
o.setPurchaserName(null);
|
||||
o.setCommodityType(null);
|
||||
o.setProvince(null);
|
||||
o.setInvoiceType(null);
|
||||
o.setSheetNum(null);
|
||||
o.setPurchaserAddress(null);
|
||||
o.setCommodityUnit(null);
|
||||
o.setPayee(null);
|
||||
o.setCommodityName(null);
|
||||
o.setSellerName(null);
|
||||
o.setInvoiceCheck(null);
|
||||
o.setInvoiceSeal(null);
|
||||
o.setInvoiceQrcode(null);
|
||||
o.setInvoiceQrnum(null);
|
||||
o.setQrCheckCode(null);
|
||||
o.setInvoiceState(null);
|
||||
o.setPrintNum(null);
|
||||
o.setInoutMark(null);
|
||||
o.setInvalidMark(null);
|
||||
o.setDuplicateMark(null);
|
||||
o.setCheckTrue(null);
|
||||
o.setEncrypt(null);
|
||||
o.setCreateBy(null);
|
||||
o.setCreateTime(null);
|
||||
o.setRecordId(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setUserId(null);
|
||||
o.setRemark(null);
|
||||
o.setAttr1(null);
|
||||
o.setAttr2(null);
|
||||
o.setAttr3(null);
|
||||
o.setAttr4(null);
|
||||
o.setArchiveState(null);
|
||||
});
|
||||
invoicesMapper.insert(dbInvoices);
|
||||
// 测试 voucherId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setVoucherId(null)));
|
||||
// 测试 invoiceCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceCode(null)));
|
||||
// 测试 invoiceNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceNum(null)));
|
||||
// 测试 amountinWords 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAmountinWords(null)));
|
||||
// 测试 price 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPrice(null)));
|
||||
// 测试 totalTax 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTotalTax(null)));
|
||||
// 测试 taxRate 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTaxRate(null)));
|
||||
// 测试 totalAmount 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setTotalAmount(null)));
|
||||
// 测试 commodityTax 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityTax(null)));
|
||||
// 测试 commodityAmount 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityAmount(null)));
|
||||
// 测试 amountinFiguers 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAmountinFiguers(null)));
|
||||
// 测试 foteDrawer 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setFoteDrawer(null)));
|
||||
// 测试 sellerAddress 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerAddress(null)));
|
||||
// 测试 commodityNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityNum(null)));
|
||||
// 测试 sellerRegisterNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerRegisterNum(null)));
|
||||
// 测试 machineCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setMachineCode(null)));
|
||||
// 测试 remarks 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRemarks(null)));
|
||||
// 测试 sellerBank 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerBank(null)));
|
||||
// 测试 checkCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCheckCode(null)));
|
||||
// 测试 invoiceDate 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceDate(null)));
|
||||
// 测试 purchaserRegisterNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserRegisterNum(null)));
|
||||
// 测试 invoiceTypeOrg 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceTypeOrg(null)));
|
||||
// 测试 password 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPassword(null)));
|
||||
// 测试 agent 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAgent(null)));
|
||||
// 测试 purchaserBank 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserBank(null)));
|
||||
// 测试 checker 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setChecker(null)));
|
||||
// 测试 city 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCity(null)));
|
||||
// 测试 purchaserName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserName(null)));
|
||||
// 测试 commodityType 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityType(null)));
|
||||
// 测试 province 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setProvince(null)));
|
||||
// 测试 invoiceType 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceType(null)));
|
||||
// 测试 sheetNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSheetNum(null)));
|
||||
// 测试 purchaserAddress 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPurchaserAddress(null)));
|
||||
// 测试 commodityUnit 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityUnit(null)));
|
||||
// 测试 payee 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPayee(null)));
|
||||
// 测试 commodityName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCommodityName(null)));
|
||||
// 测试 sellerName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setSellerName(null)));
|
||||
// 测试 invoiceCheck 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceCheck(null)));
|
||||
// 测试 invoiceSeal 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceSeal(null)));
|
||||
// 测试 invoiceQrcode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceQrcode(null)));
|
||||
// 测试 invoiceQrnum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceQrnum(null)));
|
||||
// 测试 qrCheckCode 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setQrCheckCode(null)));
|
||||
// 测试 invoiceState 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvoiceState(null)));
|
||||
// 测试 printNum 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setPrintNum(null)));
|
||||
// 测试 inoutMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInoutMark(null)));
|
||||
// 测试 invalidMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setInvalidMark(null)));
|
||||
// 测试 duplicateMark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDuplicateMark(null)));
|
||||
// 测试 checkTrue 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCheckTrue(null)));
|
||||
// 测试 encrypt 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setEncrypt(null)));
|
||||
// 测试 createBy 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCreateBy(null)));
|
||||
// 测试 createTime 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCreateTime(null)));
|
||||
// 测试 recordId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRecordId(null)));
|
||||
// 测试 companyId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setCompany(null)));
|
||||
// 测试 deptId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setDeptName(null)));
|
||||
// 测试 userId 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setUserId(null)));
|
||||
// 测试 remark 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setRemark(null)));
|
||||
// 测试 attr1 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr1(null)));
|
||||
// 测试 attr2 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr2(null)));
|
||||
// 测试 attr3 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr3(null)));
|
||||
// 测试 attr4 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setAttr4(null)));
|
||||
// 测试 archiveState 不匹配
|
||||
invoicesMapper.insert(cloneIgnoreId(dbInvoices, o -> o.setArchiveState(null)));
|
||||
// 准备参数
|
||||
InvoicesExportReqVO reqVO = new InvoicesExportReqVO();
|
||||
reqVO.setVoucherId(null);
|
||||
reqVO.setInvoiceCode(null);
|
||||
reqVO.setInvoiceNum(null);
|
||||
reqVO.setAmountinWords(null);
|
||||
reqVO.setPrice(null);
|
||||
reqVO.setTotalTax(null);
|
||||
reqVO.setTaxRate(null);
|
||||
reqVO.setTotalAmount(null);
|
||||
reqVO.setCommodityTax(null);
|
||||
reqVO.setCommodityAmount(null);
|
||||
reqVO.setAmountinFiguers(null);
|
||||
reqVO.setFoteDrawer(null);
|
||||
reqVO.setSellerAddress(null);
|
||||
reqVO.setCommodityNum(null);
|
||||
reqVO.setSellerRegisterNum(null);
|
||||
reqVO.setMachineCode(null);
|
||||
reqVO.setRemarks(null);
|
||||
reqVO.setSellerBank(null);
|
||||
reqVO.setCheckCode(null);
|
||||
reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setPurchaserRegisterNum(null);
|
||||
reqVO.setInvoiceTypeOrg(null);
|
||||
reqVO.setPassword(null);
|
||||
reqVO.setAgent(null);
|
||||
reqVO.setPurchaserBank(null);
|
||||
reqVO.setChecker(null);
|
||||
reqVO.setCity(null);
|
||||
reqVO.setPurchaserName(null);
|
||||
reqVO.setCommodityType(null);
|
||||
reqVO.setProvince(null);
|
||||
reqVO.setInvoiceType(null);
|
||||
reqVO.setSheetNum(null);
|
||||
reqVO.setPurchaserAddress(null);
|
||||
reqVO.setCommodityUnit(null);
|
||||
reqVO.setPayee(null);
|
||||
reqVO.setCommodityName(null);
|
||||
reqVO.setSellerName(null);
|
||||
reqVO.setInvoiceCheck(null);
|
||||
reqVO.setInvoiceSeal(null);
|
||||
reqVO.setInvoiceQrcode(null);
|
||||
reqVO.setInvoiceQrnum(null);
|
||||
reqVO.setQrCheckCode(null);
|
||||
reqVO.setInvoiceState(null);
|
||||
reqVO.setPrintNum(null);
|
||||
reqVO.setInoutMark(null);
|
||||
reqVO.setInvalidMark(null);
|
||||
reqVO.setDuplicateMark(null);
|
||||
reqVO.setCheckTrue(null);
|
||||
reqVO.setEncrypt(null);
|
||||
reqVO.setCreateBy(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setRecordId(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setAttr1(null);
|
||||
reqVO.setAttr2(null);
|
||||
reqVO.setAttr3(null);
|
||||
reqVO.setAttr4(null);
|
||||
reqVO.setArchiveState(null);
|
||||
|
||||
// 调用
|
||||
List<InvoicesDO> list = invoicesService.getInvoicesList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbInvoices, list.get(0));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue