|
|
|
@ -270,16 +270,16 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
if(dataList.get(k).get("tableName"+k) == null)
|
|
|
|
|
break;
|
|
|
|
|
if(dataList.get(k).get("data"+k)!=null && dataList.get(k).get("filePathColumn"+k)!=null) {
|
|
|
|
|
List<Map> childList = JSONObject.parseArray(JSON.toJSONString(dataList.get(i).get("data"+k)), Map.class);
|
|
|
|
|
for(int x =0 ;x <childList.size();x++) {
|
|
|
|
|
if (childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()) != null) {
|
|
|
|
|
String[] str = childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()).toString().split(",");
|
|
|
|
|
for (int s = 0; s < str.length; s++) {
|
|
|
|
|
if (!StringUtils.isEmpty(str[s]) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + str[s]))
|
|
|
|
|
files.add(filePath + filePathSlash + imagePath + str[s]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Map> childList = JSONObject.parseArray(JSON.toJSONString(dataList.get(i).get("data"+k)), Map.class);
|
|
|
|
|
for(int x =0 ;x <childList.size();x++) {
|
|
|
|
|
if (childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()) != null) {
|
|
|
|
|
String[] str = childList.get(x).get(dataList.get(k).get("filePathColumn"+k).toString()).toString().split(",");
|
|
|
|
|
for (int s = 0; s < str.length; s++) {
|
|
|
|
|
if (!StringUtils.isEmpty(str[s]) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + str[s]))
|
|
|
|
|
files.add(filePath + filePathSlash + imagePath + str[s]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -328,52 +328,52 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
map.put("page", i * limit);
|
|
|
|
|
List<Map<String,Object>> list = dbDao.list(map);
|
|
|
|
|
if(list!=null&&map.size()>0) {
|
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>();
|
|
|
|
|
for(int k=0;i<list.size();k++) {
|
|
|
|
|
String line = list.get(k).get("uniqueValue").toString();
|
|
|
|
|
JSONObject obj = JSON.parseObject(line);
|
|
|
|
|
String uniqueColumn = "";
|
|
|
|
|
for(String key : obj.keySet()){
|
|
|
|
|
uniqueColumn += uniqueColumn.length()>0 ? ","+key : key;
|
|
|
|
|
}
|
|
|
|
|
obj.put("uniqueColumn", uniqueColumn);
|
|
|
|
|
obj.put("operateMode", "D");
|
|
|
|
|
data.add(obj);
|
|
|
|
|
}
|
|
|
|
|
Map<String,Object> msg = new HashMap<String, Object>();
|
|
|
|
|
msg.put("messageId", CustomUtil.getId());
|
|
|
|
|
msg.put("messageType", tnames[9]+"(删除)");
|
|
|
|
|
msg.put("apiCode", "common");
|
|
|
|
|
msg.put("tableName", DBAUtils.tableAliasName(tnames[2]));
|
|
|
|
|
msg.put("sendTime", new Date());
|
|
|
|
|
msg.put("version", "1.0");
|
|
|
|
|
msg.put("total", data.size());
|
|
|
|
|
msg.put("data", data);
|
|
|
|
|
if (isUpload) {
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
result = relay("", JSON.toJSONString(msg), null, syncIp);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (IDCUtils.isJson(result)) {
|
|
|
|
|
JSONObject json = JSON.parseObject(result);
|
|
|
|
|
if (json.getInteger("code") == 20000) {
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
syncAddTaskStatus(msg, isUpload ? 1 : 0, true, startTime, isUpload,success);
|
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>();
|
|
|
|
|
for(int k=0;i<list.size();k++) {
|
|
|
|
|
String line = list.get(k).get("uniqueValue").toString();
|
|
|
|
|
JSONObject obj = JSON.parseObject(line);
|
|
|
|
|
String uniqueColumn = "";
|
|
|
|
|
for(String key : obj.keySet()){
|
|
|
|
|
uniqueColumn += uniqueColumn.length()>0 ? ","+key : key;
|
|
|
|
|
}
|
|
|
|
|
obj.put("uniqueColumn", uniqueColumn);
|
|
|
|
|
obj.put("operateMode", "D");
|
|
|
|
|
data.add(obj);
|
|
|
|
|
}
|
|
|
|
|
Map<String,Object> msg = new HashMap<String, Object>();
|
|
|
|
|
msg.put("messageId", CustomUtil.getId());
|
|
|
|
|
msg.put("messageType", tnames[9]+"(删除)");
|
|
|
|
|
msg.put("apiCode", "common");
|
|
|
|
|
msg.put("tableName", DBAUtils.tableAliasName(tnames[2]));
|
|
|
|
|
msg.put("sendTime", new Date());
|
|
|
|
|
msg.put("version", "1.0");
|
|
|
|
|
msg.put("total", data.size());
|
|
|
|
|
msg.put("data", data);
|
|
|
|
|
if (isUpload) {
|
|
|
|
|
String result = "";
|
|
|
|
|
try {
|
|
|
|
|
result = relay("", JSON.toJSONString(msg), null, syncIp);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (IDCUtils.isJson(result)) {
|
|
|
|
|
JSONObject json = JSON.parseObject(result);
|
|
|
|
|
if (json.getInteger("code") == 20000) {
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
|
|
|
|
|
}
|
|
|
|
|
syncAddTaskStatus(msg, isUpload ? 1 : 0, true, startTime, isUpload,success);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1188,23 +1188,23 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
try (InputStream inputStream = result.body().byteStream()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath+fileName);
|
|
|
|
|
FileOutputStream outputStream = new FileOutputStream(filePath + filePathSlash + imagePath+fileName);
|
|
|
|
|
|
|
|
|
|
byte b[] = new byte[1024];
|
|
|
|
|
byte b[] = new byte[1024];
|
|
|
|
|
|
|
|
|
|
int len = 0;
|
|
|
|
|
while ((len = inputStream.read(b)) != -1) {
|
|
|
|
|
total += len;
|
|
|
|
|
outputStream.write(b, 0, len);
|
|
|
|
|
int len = 0;
|
|
|
|
|
while ((len = inputStream.read(b)) != -1) {
|
|
|
|
|
total += len;
|
|
|
|
|
outputStream.write(b, 0, len);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
outputStream.close();
|
|
|
|
|
if(!(total>0)) {
|
|
|
|
|
new File(filePath + filePathSlash + imagePath+fileName).delete();
|
|
|
|
|
executeSql("delete from idc_file where filePath='"+fileName+"'");
|
|
|
|
|
}
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
outputStream.close();
|
|
|
|
|
if(!(total>0)) {
|
|
|
|
|
new File(filePath + filePathSlash + imagePath+fileName).delete();
|
|
|
|
|
executeSql("delete from idc_file where filePath='"+fileName+"'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
@ -1220,7 +1220,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return (total>0);
|
|
|
|
|
return (total>0);
|
|
|
|
|
}
|
|
|
|
|
// @Override
|
|
|
|
|
// public boolean signleDownloadFile(String syncIp, String fileName) {
|
|
|
|
@ -1355,7 +1355,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
return systemParamConfigEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*把列数据转Map*/
|
|
|
|
|