文件不存在不加入上传列表

version1
chengqf 2 years ago
parent ff2ca28cf4
commit e09a1f1143

@ -57,6 +57,20 @@ public class IdcController {
return idcService.receive(request, content, files);
}
@RequestMapping(value = "/spssync/common/uploadJson")
@ResponseBody
public BaseResponse uploadJson(HttpServletRequest request,@RequestBody Map<String, Object> params) {
//
return idcService.receiveJson(request, params);
}
@RequestMapping(value = "/spssync/common/uploadFile")
public BaseResponse uploadFile(HttpServletRequest request,
@RequestParam("content") String content,
@RequestParam(value = "files", required = false) MultipartFile[] files) {
//
return idcService.receive(request, content, files);
}
//@Log("数据同步测试")
@RequestMapping(value = "/spssync/common/test")

@ -16,7 +16,9 @@ public interface IdcService {
BaseResponse receive(HttpServletRequest request,
String content,MultipartFile[] files);
BaseResponse receiveJson(HttpServletRequest request,Map<String, Object> params);
BaseResponse uploadFile(HttpServletRequest request,
String content,MultipartFile[] files);
BaseResponse send(Map<String,Object> params);
BaseResponse send(String messageType,String tableName,Map<String,Object> params);

@ -119,7 +119,7 @@ public class IdcServiceImpl implements IdcService {
BaseResponse response = JSON.parseObject(json, BaseResponse.class);
return response;
}
logger.info("json-->" + json);
return ResultVOUtils.success(object);
}
@ -348,6 +348,17 @@ public class IdcServiceImpl implements IdcService {
return ResultVOUtils.success();
}
@Override
public BaseResponse receiveJson(HttpServletRequest request,Map<String, Object> params) {
return ResultVOUtils.success();
}
@Override
public BaseResponse uploadFile(HttpServletRequest request,
String content,MultipartFile[] files) {
return ResultVOUtils.success();
}
/****/
@Override
public BaseResponse receive(HttpServletRequest request,
@ -573,7 +584,7 @@ public class IdcServiceImpl implements IdcService {
String fileNames = list.get(m).get(filePathColumn).toString();
String[] str = fileNames.split(",");
for (int r = 0; r < str.length; r++) {
if (!StringUtils.isEmpty(str[r]))
if (!StringUtils.isEmpty(str[r])&&FileUtils.isFileExist(filePath + filePathSlash + "register/file/image2/" + str[r]))
files.add(filePath + filePathSlash + "register/file/image2/" + str[r]);
}
}
@ -596,7 +607,8 @@ public class IdcServiceImpl implements IdcService {
if (childList.get(i).get(chidTnames[7]) != null) {
String[] str = childList.get(i).get(chidTnames[7]).toString().split(",");
for (int s = 0; s < str.length; s++) {
files.add(filePath + filePathSlash + "register/file/image2/" + str[s]);
if (!StringUtils.isEmpty(str[s])&&FileUtils.isFileExist(filePath + filePathSlash + "register/file/image2/" + str[s]))
files.add(filePath + filePathSlash + "register/file/image2/" + str[s]);
}
}
}
@ -927,7 +939,7 @@ public class IdcServiceImpl implements IdcService {
try {
Response response = client.newCall(req).execute();
result = response.body().string();
log.debug("result--->" + result);
log.info("result--->" + result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -1161,10 +1173,13 @@ public class IdcServiceImpl implements IdcService {
alterTable("idc_log", "create table idc_log (id varchar(36),orderNum int,taskId varchar(60),type varchar(60),content varchar(2000),offset int,total int,createTime datetime,PRIMARY KEY (id))");
dbDao.delete("delete from idc_record where createTime<date_sub(now(),interval 2 day) and isEnd='0'");
try {
jdbcTemplate.execute("alter table basic_export_status add column cacheFilePath varchar(255)");
jdbcTemplate.execute("alter table basic_upload_status add column cacheFilePath varchar(255)");
jdbcTemplate.execute("alter table idc_status modify column id varchar(100)");
jdbcTemplate.execute("delete from idc_log where createTime<date_sub(now(),interval 3 day)");
executeSql("alter table basic_export_status add column cacheFilePath varchar(255)");
executeSql("alter table basic_upload_status add column cacheFilePath varchar(255)");
executeSql("alter table idc_status modify column id varchar(100)");
executeSql("delete from idc_log where createTime<date_sub(now(),interval 3 day)");
executeSql("alter table basic_export_status add column msg varchar(255)");
executeSql("alter table basic_upload_status add column msg varchar(255)");
executeSql("alter table basic_download_status add column msg varchar(255)");
} catch (Exception e) {
}
@ -1173,10 +1188,19 @@ 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)) {
jdbcTemplate.execute(sql);
executeSql(sql);
}
}
private void executeSql(String sql) {
try {
jdbcTemplate.execute(sql);
} catch (Exception e) {
}
}
}

Loading…
Cancel
Save