|
|
|
@ -72,9 +72,6 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
@ -547,10 +544,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void openTextUploadFile (CommonTsMqData fpTsMqData,List<String> shList){ |
|
|
|
|
|
|
|
|
|
String uuid = null; |
|
|
|
|
File file = null; |
|
|
|
|
FileOutputStream fos = null; |
|
|
|
|
// File file = null;
|
|
|
|
|
// FileOutputStream fos = null;
|
|
|
|
|
try { |
|
|
|
|
uuid = UUID.randomUUID().toString(); |
|
|
|
|
String invoiceRedisLock = String.format(RedisConstant.REDIS_ORDER_LOCK_OPENTEXT_KEY, fpTsMqData.getFpTsMqData().getFpqqlsh()); |
|
|
|
@ -583,12 +579,13 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
//将base64 转为文件对象
|
|
|
|
|
if(fileDownLoadList != null && fileDownLoadList.size()> 0){ |
|
|
|
|
byte[] decode = Base64Encoding.decode(fileDownLoadList.get(0).getFileContent().getBytes()); |
|
|
|
|
file = new File(invoiceConfig.getOpenTextTempPath() + fileDownLoadList.get(0).getFileName()); |
|
|
|
|
fos = new FileOutputStream(file); |
|
|
|
|
fos.write(decode); |
|
|
|
|
fos.flush(); |
|
|
|
|
// file = new File(invoiceConfig.getOpenTextTempPath() + fileDownLoadList.get(0).getFileName());
|
|
|
|
|
// fos = new FileOutputStream(file);
|
|
|
|
|
// fos.write(decode);
|
|
|
|
|
// fos.flush();
|
|
|
|
|
|
|
|
|
|
String openTextResult = HttpUtils.uploadFile(file, invoiceConfig.getOpentextUrl(), invoiceConfig.getArcId(), invoiceConfig.getOpentextUserName(), invoiceConfig.getOpentextPasswd()); |
|
|
|
|
String openTextResult = OpentextUtils.uploadFile(decode, fileDownLoadList.get(0).getFileName()); |
|
|
|
|
// String openTextResult = HttpUtils.uploadFile(file, invoiceConfig.getOpentextUrl(), invoiceConfig.getArcId(), invoiceConfig.getOpentextUserName(), invoiceConfig.getOpentextPasswd());
|
|
|
|
|
log.info("调用opentext接口返回结果:{}",openTextResult); |
|
|
|
|
if(StringUtils.isNotBlank(openTextResult)){ |
|
|
|
|
List<OpenTextResult> openTextResults = JSONArray.parseArray(openTextResult, OpenTextResult.class); |
|
|
|
@ -601,13 +598,12 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("发送opentext异常:{}",e.getMessage()); |
|
|
|
|
} finally { |
|
|
|
|
try { |
|
|
|
|
if(file != null){file.delete();} |
|
|
|
|
if(fos != null) {fos.close();} |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.error("发送opentext关闭文件流异常:{}",e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
// if(file != null){file.delete();}
|
|
|
|
|
// if(fos != null) {fos.close();}
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// log.error("发送opentext关闭文件流异常:{}",e.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
String cacheFpqqlsh = String.format(RedisConstant.REDIS_ORDER_LOCK_OPENTEXT_KEY, fpTsMqData.getFpTsMqData().getFpqqlsh()); |
|
|
|
|
if (uuid.equals(redisService.get(cacheFpqqlsh))) { |
|
|
|
|
redisService.del(cacheFpqqlsh); |
|
|
|
|