@Test public void testOperateTransactionLog() throws Exception { }
@Override @Transactional public CommonResult operateTransactionLog(RegistrationParam registrationParam){ Integer registrationId = registrationParam.getRegistrationId(); Integer newCashierId = registrationParam.getNewCashierId(); String appointmentDateStr = registrationParam.getAppointmentDateStr(); Byte timeSlot = registrationParam.getTimeSlot(); Integer doctorId = registrationParam.getRoleId(); Short registrationLevelId = registrationParam.getRegistrationLevelId(); Integer departmentId = registrationParam.getDepartmentId(); String invoiceCode; if (registrationParam.getPatientCaseStatus() == 1){ int count = 0; TransactionLog originalTransactionLog = transactionLogMapper.getLogByRegistrationIdAndType(registrationId, "挂号费"); if (originalTransactionLog == null) return CommonResult.fail(); String originalInvoiceCode = originalTransactionLog.getInvoiceCode(); originalTransactionLog.setStatus((byte)3); count += transactionLogMapper.update(originalTransactionLog); synchronized (this) { CommonResult result = invoiceService.getNextInvoiceCode(); invoiceCode = (String) result.getData(); } TransactionLog newTransactionLog = (TransactionLog) originalTransactionLog.clone(); newTransactionLog.setId(null); newTransactionLog.setStatus((byte)4); newTransactionLog.setCashierId(newCashierId); newTransactionLog.setInvoiceCode(invoiceCode); newTransactionLog.setTotalMoney(newTransactionLog.getTotalMoney().negate()); CommonResult insertResult = transactionService.insertTransactionLog(newTransactionLog); if (insertResult.getCode() == 500) return insertResult; invoiceService.updateStatus((byte)3, invoiceCode); CommonResult insertExceptionResult = transactionService.insertTransactionExceptionLog( originalInvoiceCode,null, invoiceCode, newCashierId, "挂号退费" ); if (insertExceptionResult.getCode() == 500) return insertExceptionResult; count += registrationMapper.updateStatusById(registrationId); count += patientCaseMapper.deletePatientCaseById(registrationId); count += arrangementMapper.updateRemainingAppointment(appointmentDateStr, timeSlot, doctorId, registrationLevelId, 1, departmentId); if (count != 4) return CommonResult.fail(); else return CommonResult.success(invoiceCode); } else return CommonResult.fail(E_701); }
WithdrawRegistrationServiceImpl implements WithdrawRegistrationService { @Override @Transactional public CommonResult operateTransactionLog(RegistrationParam registrationParam){ Integer registrationId = registrationParam.getRegistrationId(); Integer newCashierId = registrationParam.getNewCashierId(); String appointmentDateStr = registrationParam.getAppointmentDateStr(); Byte timeSlot = registrationParam.getTimeSlot(); Integer doctorId = registrationParam.getRoleId(); Short registrationLevelId = registrationParam.getRegistrationLevelId(); Integer departmentId = registrationParam.getDepartmentId(); String invoiceCode; if (registrationParam.getPatientCaseStatus() == 1){ int count = 0; TransactionLog originalTransactionLog = transactionLogMapper.getLogByRegistrationIdAndType(registrationId, "挂号费"); if (originalTransactionLog == null) return CommonResult.fail(); String originalInvoiceCode = originalTransactionLog.getInvoiceCode(); originalTransactionLog.setStatus((byte)3); count += transactionLogMapper.update(originalTransactionLog); synchronized (this) { CommonResult result = invoiceService.getNextInvoiceCode(); invoiceCode = (String) result.getData(); } TransactionLog newTransactionLog = (TransactionLog) originalTransactionLog.clone(); newTransactionLog.setId(null); newTransactionLog.setStatus((byte)4); newTransactionLog.setCashierId(newCashierId); newTransactionLog.setInvoiceCode(invoiceCode); newTransactionLog.setTotalMoney(newTransactionLog.getTotalMoney().negate()); CommonResult insertResult = transactionService.insertTransactionLog(newTransactionLog); if (insertResult.getCode() == 500) return insertResult; invoiceService.updateStatus((byte)3, invoiceCode); CommonResult insertExceptionResult = transactionService.insertTransactionExceptionLog( originalInvoiceCode,null, invoiceCode, newCashierId, "挂号退费" ); if (insertExceptionResult.getCode() == 500) return insertExceptionResult; count += registrationMapper.updateStatusById(registrationId); count += patientCaseMapper.deletePatientCaseById(registrationId); count += arrangementMapper.updateRemainingAppointment(appointmentDateStr, timeSlot, doctorId, registrationLevelId, 1, departmentId); if (count != 4) return CommonResult.fail(); else return CommonResult.success(invoiceCode); } else return CommonResult.fail(E_701); } }
WithdrawRegistrationServiceImpl implements WithdrawRegistrationService { @Override @Transactional public CommonResult operateTransactionLog(RegistrationParam registrationParam){ Integer registrationId = registrationParam.getRegistrationId(); Integer newCashierId = registrationParam.getNewCashierId(); String appointmentDateStr = registrationParam.getAppointmentDateStr(); Byte timeSlot = registrationParam.getTimeSlot(); Integer doctorId = registrationParam.getRoleId(); Short registrationLevelId = registrationParam.getRegistrationLevelId(); Integer departmentId = registrationParam.getDepartmentId(); String invoiceCode; if (registrationParam.getPatientCaseStatus() == 1){ int count = 0; TransactionLog originalTransactionLog = transactionLogMapper.getLogByRegistrationIdAndType(registrationId, "挂号费"); if (originalTransactionLog == null) return CommonResult.fail(); String originalInvoiceCode = originalTransactionLog.getInvoiceCode(); originalTransactionLog.setStatus((byte)3); count += transactionLogMapper.update(originalTransactionLog); synchronized (this) { CommonResult result = invoiceService.getNextInvoiceCode(); invoiceCode = (String) result.getData(); } TransactionLog newTransactionLog = (TransactionLog) originalTransactionLog.clone(); newTransactionLog.setId(null); newTransactionLog.setStatus((byte)4); newTransactionLog.setCashierId(newCashierId); newTransactionLog.setInvoiceCode(invoiceCode); newTransactionLog.setTotalMoney(newTransactionLog.getTotalMoney().negate()); CommonResult insertResult = transactionService.insertTransactionLog(newTransactionLog); if (insertResult.getCode() == 500) return insertResult; invoiceService.updateStatus((byte)3, invoiceCode); CommonResult insertExceptionResult = transactionService.insertTransactionExceptionLog( originalInvoiceCode,null, invoiceCode, newCashierId, "挂号退费" ); if (insertExceptionResult.getCode() == 500) return insertExceptionResult; count += registrationMapper.updateStatusById(registrationId); count += patientCaseMapper.deletePatientCaseById(registrationId); count += arrangementMapper.updateRemainingAppointment(appointmentDateStr, timeSlot, doctorId, registrationLevelId, 1, departmentId); if (count != 4) return CommonResult.fail(); else return CommonResult.success(invoiceCode); } else return CommonResult.fail(E_701); }  }
WithdrawRegistrationServiceImpl implements WithdrawRegistrationService { @Override @Transactional public CommonResult operateTransactionLog(RegistrationParam registrationParam){ Integer registrationId = registrationParam.getRegistrationId(); Integer newCashierId = registrationParam.getNewCashierId(); String appointmentDateStr = registrationParam.getAppointmentDateStr(); Byte timeSlot = registrationParam.getTimeSlot(); Integer doctorId = registrationParam.getRoleId(); Short registrationLevelId = registrationParam.getRegistrationLevelId(); Integer departmentId = registrationParam.getDepartmentId(); String invoiceCode; if (registrationParam.getPatientCaseStatus() == 1){ int count = 0; TransactionLog originalTransactionLog = transactionLogMapper.getLogByRegistrationIdAndType(registrationId, "挂号费"); if (originalTransactionLog == null) return CommonResult.fail(); String originalInvoiceCode = originalTransactionLog.getInvoiceCode(); originalTransactionLog.setStatus((byte)3); count += transactionLogMapper.update(originalTransactionLog); synchronized (this) { CommonResult result = invoiceService.getNextInvoiceCode(); invoiceCode = (String) result.getData(); } TransactionLog newTransactionLog = (TransactionLog) originalTransactionLog.clone(); newTransactionLog.setId(null); newTransactionLog.setStatus((byte)4); newTransactionLog.setCashierId(newCashierId); newTransactionLog.setInvoiceCode(invoiceCode); newTransactionLog.setTotalMoney(newTransactionLog.getTotalMoney().negate()); CommonResult insertResult = transactionService.insertTransactionLog(newTransactionLog); if (insertResult.getCode() == 500) return insertResult; invoiceService.updateStatus((byte)3, invoiceCode); CommonResult insertExceptionResult = transactionService.insertTransactionExceptionLog( originalInvoiceCode,null, invoiceCode, newCashierId, "挂号退费" ); if (insertExceptionResult.getCode() == 500) return insertExceptionResult; count += registrationMapper.updateStatusById(registrationId); count += patientCaseMapper.deletePatientCaseById(registrationId); count += arrangementMapper.updateRemainingAppointment(appointmentDateStr, timeSlot, doctorId, registrationLevelId, 1, departmentId); if (count != 4) return CommonResult.fail(); else return CommonResult.success(invoiceCode); } else return CommonResult.fail(E_701); }  @Override @Transactional CommonResult operateTransactionLog(RegistrationParam registrationParam); }
WithdrawRegistrationServiceImpl implements WithdrawRegistrationService { @Override @Transactional public CommonResult operateTransactionLog(RegistrationParam registrationParam){ Integer registrationId = registrationParam.getRegistrationId(); Integer newCashierId = registrationParam.getNewCashierId(); String appointmentDateStr = registrationParam.getAppointmentDateStr(); Byte timeSlot = registrationParam.getTimeSlot(); Integer doctorId = registrationParam.getRoleId(); Short registrationLevelId = registrationParam.getRegistrationLevelId(); Integer departmentId = registrationParam.getDepartmentId(); String invoiceCode; if (registrationParam.getPatientCaseStatus() == 1){ int count = 0; TransactionLog originalTransactionLog = transactionLogMapper.getLogByRegistrationIdAndType(registrationId, "挂号费"); if (originalTransactionLog == null) return CommonResult.fail(); String originalInvoiceCode = originalTransactionLog.getInvoiceCode(); originalTransactionLog.setStatus((byte)3); count += transactionLogMapper.update(originalTransactionLog); synchronized (this) { CommonResult result = invoiceService.getNextInvoiceCode(); invoiceCode = (String) result.getData(); } TransactionLog newTransactionLog = (TransactionLog) originalTransactionLog.clone(); newTransactionLog.setId(null); newTransactionLog.setStatus((byte)4); newTransactionLog.setCashierId(newCashierId); newTransactionLog.setInvoiceCode(invoiceCode); newTransactionLog.setTotalMoney(newTransactionLog.getTotalMoney().negate()); CommonResult insertResult = transactionService.insertTransactionLog(newTransactionLog); if (insertResult.getCode() == 500) return insertResult; invoiceService.updateStatus((byte)3, invoiceCode); CommonResult insertExceptionResult = transactionService.insertTransactionExceptionLog( originalInvoiceCode,null, invoiceCode, newCashierId, "挂号退费" ); if (insertExceptionResult.getCode() == 500) return insertExceptionResult; count += registrationMapper.updateStatusById(registrationId); count += patientCaseMapper.deletePatientCaseById(registrationId); count += arrangementMapper.updateRemainingAppointment(appointmentDateStr, timeSlot, doctorId, registrationLevelId, 1, departmentId); if (count != 4) return CommonResult.fail(); else return CommonResult.success(invoiceCode); } else return CommonResult.fail(E_701); }  @Override @Transactional CommonResult operateTransactionLog(RegistrationParam registrationParam);  }