|
@@ -42,6 +42,7 @@ import java.io.ByteArrayInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -226,10 +227,10 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
public void syncOaPayLog(Integer workOrderId,String fileUrl) throws Exception {
|
|
|
PWorkOrderInfo pWorkOrderInfo = financialExpenditureDao.getWorkOrderInfo(workOrderId);
|
|
|
if (pWorkOrderInfo != null){
|
|
|
- Integer hasFinancial = financialExpenditureDao.findByBatchNoAndProcessNo(workOrderId);
|
|
|
- if(hasFinancial != null){
|
|
|
- return;
|
|
|
- }
|
|
|
+// Integer hasFinancial = financialExpenditureDao.findByBatchNoAndProcessNo(workOrderId);
|
|
|
+// if(hasFinancial != null){
|
|
|
+// return;
|
|
|
+// }
|
|
|
String formStructure = financialExpenditureDao.getFormStructure(workOrderId);
|
|
|
JSONObject formData = JSONObject.parseObject(financialExpenditureDao.getFormData(workOrderId));
|
|
|
OaFormStructureDto oaFormStructureDto = JSONObject.parseObject(formStructure, OaFormStructureDto.class);
|
|
@@ -378,8 +379,18 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
if(StringUtils.isNotEmpty(fileUrl)){
|
|
|
String[] split = fileUrl.split(",");
|
|
|
for (String s : split) {
|
|
|
- File file = FileUtils.toFile(new URL(s));
|
|
|
- financialExpenditures.addAll(financialExpenditureService.checkOaQuitMusicGroupExcel(FileUtils.readFileToByteArray(file), file.getName()));
|
|
|
+ URL url = new URL(s);
|
|
|
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
|
+ conn.setConnectTimeout(3*1000);
|
|
|
+ File file = File.createTempFile(UUID.randomUUID().toString(), ".xls");
|
|
|
+ FileUtils.copyInputStreamToFile(conn.getInputStream(),file);
|
|
|
+ byte[] bytes = FileUtils.readFileToByteArray(file);
|
|
|
+ String fileName = file.getName();
|
|
|
+ //删除临时文件
|
|
|
+ if (file.exists()) {
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ financialExpenditures.addAll(financialExpenditureService.checkOaQuitMusicGroupExcel(bytes, fileName));
|
|
|
}
|
|
|
//去除重复数据
|
|
|
financialExpenditures.removeAll(Collections.singleton(null));
|