提交 74b804fe authored 作者: 李炎's avatar 李炎

国网视频任务

上级 60e7e8ce
...@@ -48,7 +48,7 @@ public class MaterialinventoryTimed implements Job { ...@@ -48,7 +48,7 @@ public class MaterialinventoryTimed implements Job {
/**设置定时器功能 /**设置定时器功能
* */ * */
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
iMaterialinventoryService.synchronization(null); iMaterialinventoryService.synchronization(null);
} }
......
...@@ -24,7 +24,7 @@ public class PhysicalIDTimed implements Job { ...@@ -24,7 +24,7 @@ public class PhysicalIDTimed implements Job {
/**测试定时*/ /**测试定时*/
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
physicalIDService.synchronization(null); physicalIDService.synchronization(null);
......
...@@ -28,7 +28,7 @@ public class ProductInventoryTimed implements Job { ...@@ -28,7 +28,7 @@ public class ProductInventoryTimed implements Job {
/**测试定时*/ /**测试定时*/
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
productInventoryService.synchronization(null); productInventoryService.synchronization(null);
......
...@@ -16,7 +16,7 @@ public class ProductionOrderTimed { ...@@ -16,7 +16,7 @@ public class ProductionOrderTimed {
@Autowired @Autowired
IProductionOrderService productionOrderService; IProductionOrderService productionOrderService;
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void job() throws ParseException { public void job() throws ParseException {
productionOrderService.synchronization(null); productionOrderService.synchronization(null);
} }
......
...@@ -16,7 +16,7 @@ public class ProductionSchedulingTimed { ...@@ -16,7 +16,7 @@ public class ProductionSchedulingTimed {
@Autowired @Autowired
IProductionSchedulingService productionSchedulingService; IProductionSchedulingService productionSchedulingService;
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void job() throws ParseException { public void job() throws ParseException {
productionSchedulingService.synchronization(null); productionSchedulingService.synchronization(null);
} }
......
...@@ -26,7 +26,7 @@ public class PurchaseorderTimed implements Job { ...@@ -26,7 +26,7 @@ public class PurchaseorderTimed implements Job {
* 测试定时 * 测试定时
*/ */
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000 * 60) // @Scheduled(fixedDelay = 1000 * 60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
iPurchaseorderService.synchronizationList(null); iPurchaseorderService.synchronizationList(null);
......
...@@ -30,7 +30,7 @@ public class ReserveStockTimed implements Job { ...@@ -30,7 +30,7 @@ public class ReserveStockTimed implements Job {
* 测试定时 * 测试定时
*/ */
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000 * 60) // @Scheduled(fixedDelay = 1000 * 60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
reserveStockService.synchronization(null); reserveStockService.synchronization(null);
......
...@@ -24,7 +24,7 @@ public class SalesOrderTimed { ...@@ -24,7 +24,7 @@ public class SalesOrderTimed {
@Autowired @Autowired
ISalesOrderService salesOrderService; ISalesOrderService salesOrderService;
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void job() throws ParseException { public void job() throws ParseException {
salesOrderService.synchronization(null); salesOrderService.synchronization(null);
} }
......
...@@ -25,7 +25,7 @@ public class SupplylistTimed implements Job { ...@@ -25,7 +25,7 @@ public class SupplylistTimed implements Job {
@Autowired @Autowired
ISupplyListIService supplyListIService; ISupplyListIService supplyListIService;
// @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点 // @Scheduled(cron = "0 0 1 * * ?")//cron表达式每天凌晨一点
@Scheduled(fixedDelay = 1000*60) // @Scheduled(fixedDelay = 1000*60)
public void Materialinventory() throws IOException, ParseException { public void Materialinventory() throws IOException, ParseException {
supplyListIService.synchronization(null); supplyListIService.synchronization(null);
......
package org.jeecg.modules.iost.API.Util;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class HlsUtil {
private String uuid;
private String originUrlpath;
private String preUrlPath;
private String rootPath;
private String fileName;
private String folderPath;
private int threadQuantity = 10;
public HlsUtil(String originUrlpath, String preUrlPath, String rootPath){
this.uuid = UUID.randomUUID().toString().replaceAll("-","");
this.originUrlpath = originUrlpath;
this.preUrlPath = preUrlPath;
this.rootPath = rootPath;
this.fileName = uuid+ ".mp4";
this.folderPath = rootPath + File.separator + uuid;
File file = new File(folderPath);
if(!file.exists()) file.mkdirs();
}
public static void main(String[] args) {
String originUrlpath = "http://localhost:8090/jintai/as/GetFile.m3u8";
// String originUrlpath ="http://127.0.0.1:8848/dsa/EZUIKit-JavaScript/adca19a95053481a836f23da28d3f55d-8498.m3u8";
System.out.println(originUrlpath);
String preUrlPath = originUrlpath.substring(0, originUrlpath.lastIndexOf("/")+1);
System.out.println(preUrlPath);
String rootPath = "E:\\Eip";
System.out.println(rootPath);
String fileName = "";
HlsUtil downLoader = new HlsUtil(originUrlpath, preUrlPath, rootPath);
// downLoader.setThreadQuantity(10);
try{
fileName = downLoader.download(true);
}
catch (Exception e) {
}
if(fileName.isEmpty()){
System.out.println("下载失败");
}else{
System.err.println("下载成功");
}
}
public String download(boolean isAsync) throws Exception {
String indexStr = getIndexFile();
System.out.println(indexStr);
List urlList = analysisIndex(indexStr);
System.out.println(urlList);
HashMap<Integer,String> keyFileMap = new HashMap<>();
// if(!isAsync){
// downLoadIndexFileAsync(urlList, keyFileMap);
//
// while (keyFileMap.size()<urlList.size()){
// //System.out.println("当前下载数量"+keyFileMap.size());
// Thread.sleep(3000);
// }
// }else{
keyFileMap = downLoadIndexFile(urlList);
// }
// System.out.println(keyFileMap);
// return composeFile(keyFileMap);
return "";
}
public String getIndexFile() throws Exception{
URL url = new URL(originUrlpath);
//下载资源
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8"));
String content = "" ;
String line;
while ((line = in.readLine()) != null) {
content += line + "\n";
}
in.close();
return content;
}
/* 解析索引文件 */
public List analysisIndex(String content) throws Exception{
Pattern pattern = Pattern.compile(".*ts");
Matcher ma = pattern.matcher(content);
List<String> list = new ArrayList<String>();
while(ma.find()){
list.add(ma.group());
}
return list;
}
/* 下载视频片段 */
public HashMap downLoadIndexFile(List<String> urlList) throws IOException {
HashMap<Integer,String> keyFileMap = new HashMap<>();
for(int i =0;i<urlList.size();i++){
String subUrlPath = urlList.get(i);
String fileOutPath = folderPath + File.separator + i + ".ts";
System.out.println("subUrlPath"+subUrlPath);
System.out.println("fileOutPath"+fileOutPath);
keyFileMap.put(i, fileOutPath);
try{
downloadNet(subUrlPath, fileOutPath);
System.out.println("成功:"+ (i + 1) +"/" + urlList.size());
}catch (Exception e){
System.err.println("失败:"+ (i + 1) +"/" + urlList.size());
}
}
return keyFileMap;
}
private void downloadNet(String fullUrlPath, String fileOutPath) throws Exception {
// 下载网络文件
int byteread = 0;
URL url = new URL(fullUrlPath);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(fileOutPath);
byte[] buffer = new byte[1204];
while ((byteread = inStream.read(buffer)) != -1) {
//bytesum += byteread;
fs.write(buffer, 0, byteread);
}
}
}
package org.jeecg.modules.iost.API.controller.video;//package org.jeecg.modules.iost.API.controller.view;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.JeecgSystemApplication;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@RequestMapping("/as")
@Slf4j
@Api(tags = "请求金蝶日志")
@RestController
public class HlsController {
private Map<String, String> urlPath = new HashMap<>();
@Value("${server.port}")
private int port;
@Value("${server.servlet.context-path}")
private String path;
private String ip = InetAddress.getLocalHost().getHostAddress();
public HlsController() throws UnknownHostException {
}
@GetMapping("/GetFile.m3u8")
public void getFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
urlPath=null;
// 读取路径下面的文件
String originUrlpath = "https://hls01open.ys7.com/openlive/6e0b2be040a943489ef0b9bb344b96b8.hd.m3u8";
//文件流返回格式设为.m3u8
response.setContentType("application/vnd.apple.mpegurl");
//读取指定路径下面的文件
String indexStr = getIndexFile(originUrlpath);//解析originUrlpath 返回为文本
List urlList = analysisIndex(indexStr);//解析indexStr获取.ts文件地址
String localPath = "http://" + ip + ":" + port + path + "/";
System.out.println(urlList);
Map<String, String> urlPathMap = new HashMap<String, String>();
for (int i = 0; i < urlList.size(); i++) {
String tsUrl = i + ".ts";//文件后缀,key
String localPathTs = localPath + "as/GetTs/" + tsUrl;
String url = urlList.get(i).toString();//
String resultA = indexStr.replaceAll(url, localPathTs);//文本中的“url”替换为“localPathTs”
urlPathMap.put(tsUrl, url);
indexStr = resultA;
}
urlPath = urlPathMap;
System.out.println("urlPath"+urlPath);
System.out.println(indexStr);
InputStream in = new ByteArrayInputStream(indexStr.getBytes());
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组
byte[] buff = new byte[1024];
//所读取的内容使用n来接收
int n;
//当没有读取完时,继续读取,循环
while ((n = in.read(buff)) != -1) {
//将字节数组的数据全部写入到输出流中
outputStream.write(buff, 0, n);
}
//强制将缓存区的数据进行输出
outputStream.flush();
//关流
outputStream.close();
in.close();
}
public String getIndexFile(String urlpath) throws Exception {
URL url = new URL(urlpath);
//下载资源
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
String content = "";
String line;
while ((line = in.readLine()) != null) {
content += line + "\n";
}
in.close();
return content;
}
/* 解析索引文件 */
public List analysisIndex(String content) throws Exception {
Pattern pattern = Pattern.compile(".*ts");
Matcher ma = pattern.matcher(content);
List<String> list = new ArrayList<String>();
while (ma.find()) {
list.add(ma.group());
}
return list;
}
/*读取网络文件*/
@GetMapping("/GetTs/{path}")
public void getFileInputStream(@PathVariable() String path, HttpServletResponse response) {
System.out.println("GetTs"+path);
String s = urlPath.get(path);
System.out.println("path"+s);
System.out.println(urlPath);
URL url = null;
try {
url = new URL(s+"?Usr=c1cbc1d4e86d49a0981f54beea95280a");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//设置超时间为3秒
conn.setConnectTimeout(3 * 1000);
//防止屏蔽程序抓取而返回403错误
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
//得到输入流
InputStream in = conn.getInputStream();
response.setContentType("application/x-linguist");
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组
byte[] buff = new byte[1024];
//所读取的内容使用n来接收
int n;
//当没有读取完时,继续读取,循环
while ((n = in.read(buff)) != -1) {
//将字节数组的数据全部写入到输出流中
outputStream.write(buff, 0, n);
}
//强制将缓存区的数据进行输出
outputStream.flush();
//关流
outputStream.close();
in.close();
} catch (Exception e) {
System.out.println("读取网络文件异常:" + path);
// logger.error("读取网络文件异常:"+path);
}
}
}
package org.jeecg.modules.iost.API.service.impl; package org.jeecg.modules.iost.API.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.ExternalInterface.PhysicalIDApi;
import org.jeecg.modules.iost.API.Util.JsonUtil; import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.entity.*; import org.jeecg.modules.iost.API.entity.Physicalid;
import org.jeecg.modules.iost.API.entity.Physicaliderror;
import org.jeecg.modules.iost.API.mapper.PhysicaliderrorMapper; import org.jeecg.modules.iost.API.mapper.PhysicaliderrorMapper;
import org.jeecg.modules.iost.API.ExternalInterface.PhysicalIDApi;
import org.jeecg.modules.iost.API.service.GridErrorService; import org.jeecg.modules.iost.API.service.GridErrorService;
import org.jeecg.modules.iost.API.service.IPhysicalIDerrorService; import org.jeecg.modules.iost.API.service.IPhysicalIDerrorService;
import org.jeecg.modules.iost.API.service.IPurchaseorderService; import org.jeecg.modules.iost.API.service.IPurchaseorderService;
...@@ -48,6 +48,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -48,6 +48,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
private ProductionOrderWebapi productionOrderWebapi; private ProductionOrderWebapi productionOrderWebapi;
@Autowired @Autowired
private IPurchaseorderService purchaseorderService; private IPurchaseorderService purchaseorderService;
@Override @Override
public String add(Map<String, String> map) { public String add(Map<String, String> map) {
...@@ -62,6 +63,15 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -62,6 +63,15 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
@Override @Override
public JSONObject selectInList(Map<String, String> map) throws ParseException { public JSONObject selectInList(Map<String, String> map) throws ParseException {
// Map<String, List<List<Object>>> list = physicalIDWebapi.selectInList(null, new LinkedHashMap<String, String>() {{
//// put("FApproveDate >", "2018-11-26T15:00:37.217");
// put("FApproveDate >", beforeDayByNowDay());
// put("FApproveDate =<", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()));
// }});
Map<String, List<Map>> stringListMap = physicalIDWebapi.TestselectInList(null, new LinkedHashMap<String, String>() {{
put("FApproveDate >", getTime());
// put("FApproveDate >", "'2021-07-26T15:00:37.217'");
put("FApproveDate <=", "'" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(new Date()) + "'");
}}); }});
System.out.println("stringListMap" + stringListMap); System.out.println("stringListMap" + stringListMap);
...@@ -76,9 +86,9 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -76,9 +86,9 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
Map<String, List<List<Object>>> stringListMap = null; Map<String, List<List<Object>>> stringListMap = null;
if (object == null) { if (object == null) {
stringListMap = physicalIDWebapi.selectInList(null, new HashMap<String, String>() {{ stringListMap = physicalIDWebapi.selectInList(null, new HashMap<String, String>() {{
put("FApproveDate >", "'"+getTime()+"'"); put("FApproveDate >", "'" + getTime() + "'");
// put("FApproveDate >", "'2021-08-20 15:00:37.217'"); // put("FApproveDate >", "'2021-08-20 15:00:37.217'");
put("FApproveDate <=", "'"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())+"'"); put("FApproveDate <=", "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + "'");
}}); }});
} else { } else {
stringListMap = physicalIDWebapi.selectWhere((String) object); stringListMap = physicalIDWebapi.selectWhere((String) object);
...@@ -99,12 +109,12 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -99,12 +109,12 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
} }
public Boolean grid(Map<String, String> stringStringMap) throws ParseException { public Boolean grid(Map<String, String> stringStringMap) throws ParseException {
Boolean aBoolean=false; Boolean aBoolean = false;
String rs = physicalIDApi.add(stringStringMap);//数据转存国网 String rs = physicalIDApi.add(stringStringMap);//数据转存国网
JSONObject jsonObject = JSONObject.fromObject(rs);//获取国网返回 JSONObject jsonObject = JSONObject.fromObject(rs);//获取国网返回
Boolean aBoolean1 = gridErrorService.setGridError(jsonObject, stringStringMap, BusinessNo);//日志记录国网请求 Boolean aBoolean1 = gridErrorService.setGridError(jsonObject, stringStringMap, BusinessNo);//日志记录国网请求
Boolean save = physicalidService.save(SplicingDetails(stringStringMap));//记录实物id明细 Boolean save = physicalidService.save(SplicingDetails(stringStringMap));//记录实物id明细
aBoolean=aBoolean1==save; aBoolean = aBoolean1 == save;
return aBoolean; return aBoolean;
} }
...@@ -179,7 +189,6 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -179,7 +189,6 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
List<List<Object>> list = stringListMap.get(key); List<List<Object>> list = stringListMap.get(key);
// Map<String, String> fid = new IdentityHashMap<String, String>(); // Map<String, String> fid = new IdentityHashMap<String, String>();
// for (List<Object> list1 : list) {//获取生产订单id 拼接查询条件 // for (List<Object> list1 : list) {//获取生产订单id 拼接查询条件
// fid.put(new String("fid = "), list1.get(7).toString()); // fid.put(new String("fid = "), list1.get(7).toString());
...@@ -232,7 +241,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe ...@@ -232,7 +241,7 @@ public class PhysicalIDerrorServiceImpl extends ServiceImpl<PhysicaliderrorMappe
return dateString; return dateString;
} }
//map转实体类
public Physicalid SplicingDetails(Map<String, String> stringStringMap) throws ParseException { public Physicalid SplicingDetails(Map<String, String> stringStringMap) throws ParseException {
String fApproveDate = stringStringMap.get("FApproveDate"); String fApproveDate = stringStringMap.get("FApproveDate");
Physicalid physicalid = JSON.parseObject(JSON.toJSONString(stringStringMap), Physicalid.class); Physicalid physicalid = JSON.parseObject(JSON.toJSONString(stringStringMap), Physicalid.class);
......
...@@ -74,6 +74,7 @@ public class SupplyListWebapi implements web_api { ...@@ -74,6 +74,7 @@ public class SupplyListWebapi implements web_api {
List<Map<String,String>> salesorderlist = new ArrayList<>(); List<Map<String,String>> salesorderlist = new ArrayList<>();
for (List<Object> list1:list) { for (List<Object> list1:list) {
Map<String,String> salesordermap = new HashMap<>(); Map<String,String> salesordermap = new HashMap<>();
salesordermap.put("purchaserHqCode","SGCC");
salesordermap.put("supplyno",list1.get(0).toString()); salesordermap.put("supplyno",list1.get(0).toString());
salesordermap.put("fbillno",list1.get(0).toString()); salesordermap.put("fbillno",list1.get(0).toString());
salesordermap.put("materialdesc",list1.get(2).toString()); salesordermap.put("materialdesc",list1.get(2).toString());
......
package org.jeecg.modules.iost.API.webapi.Util; package org.jeecg.modules.iost.API.webapi.Util;
import net.sf.json.JSONObject;
import org.jeecg.modules.iost.API.Util.JsonUtil; import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeJournal; import org.jeecg.modules.iost.API.entity.kingdeejournal.KingdeeJournal;
import org.jeecg.modules.iost.API.service.KingdeeJournalService; import org.jeecg.modules.iost.API.service.KingdeeJournalService;
...@@ -13,7 +14,6 @@ import java.util.List; ...@@ -13,7 +14,6 @@ import java.util.List;
/** /**
* 2021-08-18 * 2021-08-18
*
*/ */
@Component @Component
public class WebApiLog { public class WebApiLog {
...@@ -28,7 +28,7 @@ public class WebApiLog { ...@@ -28,7 +28,7 @@ public class WebApiLog {
uploadRooms.kingdeeJournalService = this.kingdeeJournalService; uploadRooms.kingdeeJournalService = this.kingdeeJournalService;
} }
public Boolean setKingdeeJournal(String setRequest, String setName,Integer businessNo ,List<List<Object>> setResponse) throws ParseException { public Boolean setKingdeeJournal(String setRequest, String setName, Integer businessNo, List<List<Object>> setResponse) throws ParseException {
boolean ny = false; boolean ny = false;
KingdeeJournal kingdeeJournal = new KingdeeJournal(); KingdeeJournal kingdeeJournal = new KingdeeJournal();
kingdeeJournal.setRequest(setRequest); kingdeeJournal.setRequest(setRequest);
...@@ -36,7 +36,7 @@ public class WebApiLog { ...@@ -36,7 +36,7 @@ public class WebApiLog {
kingdeeJournal.setResponse(JsonUtil.Listjson(setResponse)); kingdeeJournal.setResponse(JsonUtil.Listjson(setResponse));
kingdeeJournal.setBusinessNo(businessNo); kingdeeJournal.setBusinessNo(businessNo);
kingdeeJournal.setCreatetime(new Date()); kingdeeJournal.setCreatetime(new Date());
if (setResponse == null || setResponse.size() < 1 || setResponse.get(0).size() <= 1) {//判断请求是否错误 if (setResponse.size() == 1 && setResponse.get(0).size() == 1 && JSONObject.fromObject(setResponse.get(0)).get("Result") != null) {//判断请求是否错误
kingdeeJournal.setSynchronization(0); kingdeeJournal.setSynchronization(0);
ny = false; ny = false;
} else { } else {
......
...@@ -86,6 +86,18 @@ public class SecurityToolsTest { ...@@ -86,6 +86,18 @@ public class SecurityToolsTest {
log.info(jsonObject.get(data).toString()); log.info(jsonObject.get(data).toString());
return jsonObject; return jsonObject;
} }
@Test
public void S() {
Random r = new Random();
// 第一种方法
// int num = (int) (Math.random() * 5 + 1);
// System.out.println("num:" + num);
// 第二种方法
int a = r.nextInt(5) + 1;
System.out.println("a:" + a);
}
/** /**
* 测试定时 * 测试定时
...@@ -117,6 +129,24 @@ public class SecurityToolsTest { ...@@ -117,6 +129,24 @@ public class SecurityToolsTest {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Test
// @Scheduled(fixedDelay = 5000)
public void timdsaded() {
String sFormId = "PRD_INSTOCK";
log.info("123");
List<List<Object>> list = null;
try {
Boolean result = client.login(dbId, uid, pwd, lang);
if(result){
String content="";
List<List<Object>> lists = client.executeBillQuery(content);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论