|
@@ -351,29 +351,20 @@ public class ApiCarFreeServiceImpl extends BaseService implements ApiCarFreeServ
|
|
|
|
|
|
@Override
|
|
|
public ApiResponseData findInvoice(JSONObject param) {
|
|
|
- List<InvoiceResult> dtoList = searchInvoiceResultService.getSearchInvoiceResult(param.getString("num"), param.getLong("userId"));
|
|
|
- if (dtoList.size() != 0) {
|
|
|
- SearchInvoiceDto searchInvoiceDto = searchInvoiceService.getSearchInvoiceByNum(param.getString("num"));
|
|
|
- InvoiceResultDto invoiceResultDto = new InvoiceResultDto();
|
|
|
- BeanUtil.copyProperties(invoiceResultDto, searchInvoiceDto);
|
|
|
- invoiceResultDto.setResult(dtoList);
|
|
|
- return ApiResponseData.success(ApiResponseCodeEnum.CODE_200.getValue(), JSON.toJSONString(invoiceResultDto));
|
|
|
- } else {
|
|
|
- try {
|
|
|
- CarFreeCarrierBillStartPo po = wayBillStartService.getBillStartByNum(param.getString("num"));
|
|
|
-// if (po == null) {
|
|
|
-// throw new ApiRequestException("业务校验错误:运单编号错误或该运单不存在\n", 803);
|
|
|
-// }
|
|
|
- if (po == null) {
|
|
|
- po = new CarFreeCarrierBillStartPo();
|
|
|
- po.setNum(param.getString("num"));
|
|
|
- po.setUserId(param.getLong("userId"));
|
|
|
- wayBillStartService.saveBillStart(po);
|
|
|
- }
|
|
|
- return apiCarFreeChargeService.charge(po);
|
|
|
- } catch (ServiceException se) {
|
|
|
- throw new ApiRequestException(se.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
|
|
|
+ try {
|
|
|
+ CarFreeCarrierBillStartPo po = wayBillStartService.getBillStartByNum(param.getString("num"));
|
|
|
+ if (po == null) {
|
|
|
+ po = new CarFreeCarrierBillStartPo();
|
|
|
+ po.setNum(param.getString("num"));
|
|
|
+ po.setUserId(param.getLong("userId"));
|
|
|
+ po.setIsSearch(2);
|
|
|
+ wayBillStartService.saveBillStart(po);
|
|
|
+ } else {
|
|
|
+ wayBillStartService.updateBillStartIsSearch(param.getString("num"));
|
|
|
}
|
|
|
+ return apiCarFreeChargeService.charge(po);
|
|
|
+ } catch (ServiceException se) {
|
|
|
+ throw new ApiRequestException(se.getMessage(), ApiResponseCodeEnum.CODE_200.getValue());
|
|
|
}
|
|
|
}
|
|
|
}
|