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

new
parent b2bb1f94d2
commit 4a11a41d72

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

@ -124,11 +124,6 @@ public class BankSlipServiceImpl implements BankSlipService {
@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))

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

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

Loading…
Cancel
Save