|
|
|
@ -138,6 +138,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
logger.info("UDI管理系统同步任务开始--------");
|
|
|
|
|
asyncDataTask(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*自助平台生成任务,不上传*/
|
|
|
|
|
@Override
|
|
|
|
|
public void asyncSpsTask() {
|
|
|
|
@ -151,6 +152,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
public void asyncFetchUdiTask() {
|
|
|
|
|
fetchTask(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
@Override
|
|
|
|
|
public void asyncFetchTask() {
|
|
|
|
@ -274,7 +276,6 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String fetchData(String host, Map<String, Object> params) {
|
|
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
|
|
.build();
|
|
|
|
@ -352,6 +353,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
dbDao.update(sql);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****/
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse receive(HttpServletRequest request,
|
|
|
|
@ -434,6 +436,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse send(String messageType, String tableName, Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
@ -485,6 +488,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
dbDao.save(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveDownloadStatus(Map<String, Object> params) {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("receiveStatus", "0");
|
|
|
|
@ -496,6 +500,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
dbDao.save(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveIdcLog(String messageType, String taskId, String content, int offset, int total) {
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("id", CustomUtil.getId());
|
|
|
|
@ -653,8 +658,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
/*增加同步任务状态*/
|
|
|
|
|
private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success) {
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
String content = JSON.toJSONString(json);
|
|
|
|
|
String datePath = DateUtil.formatDate(new Date(), "yyyy-MM-dd");
|
|
|
|
|
String fileName = filePath + datePath + "/" + json.get("messageType") + "-" + json.get("messageId") + ".udi";
|
|
|
|
@ -952,9 +956,11 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean signleDownloadFile(String syncIp, String fileName) {
|
|
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
|
|
.build();;
|
|
|
|
|
.build();
|
|
|
|
|
;
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
|
|
|
|
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, "fileName=" + fileName);
|
|
|
|
@ -987,7 +993,6 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1036,6 +1041,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
List<Map<String, Object>> list = dbDao.list(map);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*由表名获取数据*/
|
|
|
|
|
private Map<String, Object> getData(String messageType, String tableName, Map<String, Object> params, Map<String, Object> whereParams) {
|
|
|
|
|
List<Map<String, Object>> list = getList(tableName, whereParams);
|
|
|
|
@ -1054,8 +1060,6 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SystemParamConfigEntity getSystemParamConfig(String paramKey, String paramName, String defaultValue, String paramExplain) {
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(paramKey);
|
|
|
|
|
if (systemParamConfigEntity == null || (systemParamConfigEntity != null && StringUtils.isEmpty(systemParamConfigEntity.getParamKey()))) {
|
|
|
|
@ -1071,6 +1075,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
return systemParamConfigEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void writeFile(byte[] file, String filePath, String fileName) throws Exception {
|
|
|
|
|
File targetFile = new File(filePath);
|
|
|
|
|
if (!targetFile.exists()) {
|
|
|
|
@ -1095,7 +1100,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
for (int i = 0; i < columnList.size(); i++) {
|
|
|
|
|
Map<String, Object> column = new HashMap<String, Object>();
|
|
|
|
|
String dataType = columnList.get(i).get("dataType").toLowerCase().contains("char") || columnList.get(i).get("dataType").toLowerCase().contains("text") ?
|
|
|
|
|
"C" : columnList.get(i).get("dataType").toLowerCase().contains("date") ? "D" : "N" ;;
|
|
|
|
|
"C" : columnList.get(i).get("dataType").toLowerCase().contains("date") ? "D" : "N";
|
|
|
|
|
;
|
|
|
|
|
String attrName = columnList.get(i).get("columnName").toString();
|
|
|
|
|
if (map.get(attrName) == null) {
|
|
|
|
|
column.put("tableName", tname);
|
|
|
|
@ -1135,6 +1141,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
return updateTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String setUpdateTime(String id, String updateTime) {
|
|
|
|
|
String sql = "";
|
|
|
|
|
Map<String, Object> map = dbDao.get("select * from idc_status where id='" + id + "'");
|
|
|
|
@ -1147,6 +1154,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
return updateTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initTable() {
|
|
|
|
|
alterTable("idc_var", "create table idc_var (code varchar(60),content varchar(200),PRIMARY KEY (code))");
|
|
|
|
|
alterTable("idc_status", "create table idc_status (id varchar(100),statusTime datetime,PRIMARY KEY (id))");
|
|
|
|
@ -1162,6 +1170,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void alterTable(String tableName, String sql) {
|
|
|
|
|
Map<String, String> map = dbDao.getMysql(tableName);
|
|
|
|
|
if (!(map != null && map.get("tableName") != null)) {
|
|
|
|
|