会计凭证批量修改 银行回单优化

new
parent b2bb1f94d2
commit 4a11a41d72

@ -97,10 +97,13 @@ public class VoucherController {
@Operation(summary = "删除会计凭证") @Operation(summary = "删除会计凭证")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('accounting:voucher:delete')") @PreAuthorize("@ss.hasPermission('accounting:voucher:delete')")
public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteVoucher(@RequestParam("id") Long[] id) {
VoucherDO voucher = voucherService.getVoucher(id); List<Long> listId = new ArrayList(Arrays.asList(id)) ;
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){ List<VoucherDO> voucherList = voucherService.getVoucherList(listId);
return error("该凭证已归档,请勿删除!"); for (VoucherDO voucher : voucherList) {
if (voucher.getFileStatus().equals(AccountingStatusEnum.LOGFILE.getValue())){
return error("凭证号:"+voucher.getVoucherNum()+" 该凭证已归档,请勿删除!");
}
} }
voucherService.deleteVoucher(id); voucherService.deleteVoucher(id);
return success(true); return success(true);

@ -124,11 +124,6 @@ public class BankSlipServiceImpl implements BankSlipService {
@Override @Override
public BankSlipDO jsonToJavaObject(BankReceiptDO bankReceiptDO, MultipartFile multipartFile) throws IOException { public BankSlipDO jsonToJavaObject(BankReceiptDO bankReceiptDO, MultipartFile multipartFile) throws IOException {
BankSlipDO bankSlipDO = new BankSlipDO(); 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都是中文的 //这里用中文是因为调用百度ocr银行回单的接口返回的数据json都是中文的
bankSlipDO bankSlipDO
.setBank(bankReceiptDO.getWords_result().get().get(0)) .setBank(bankReceiptDO.getWords_result().get().get(0))

@ -40,7 +40,7 @@ public interface VoucherService {
* *
* @param id * @param id
*/ */
void deleteVoucher(Long id); void deleteVoucher(Long[] id);
/** /**
* *

@ -118,11 +118,10 @@ public class VoucherServiceImpl implements VoucherService {
} }
@Override @Override
public void deleteVoucher(Long id) { public void deleteVoucher(Long[] id) {
// 校验存在 ArrayList<Long> listId = new ArrayList(Arrays.asList(id)) ;
validateVoucherExists(id);
// 删除 // 删除
voucherMapper.deleteById(id); voucherMapper.deleteBatchIds(listId);
} }
private void validateVoucherExists(Long id) { private void validateVoucherExists(Long id) {

Loading…
Cancel
Save