代码备份

version1
anthonywj 2 years ago
parent af338e94a0
commit cd0f947aba

@ -61,12 +61,12 @@ public class IdcServiceImpl implements IdcService {
private String filePath; private String filePath;
@Value("${back_file_path}") @Value("${back_file_path}")
private String backFilePath; private String backFilePath;
@Value("${API_KEY}") @Value("${API_KEY}")
private String apiKey; private String apiKey;
@Value("${API_SECRET}") @Value("${API_SECRET}")
private String apiSecret; private String apiSecret;
/*自助平台->UDI*/ /*自助平台->UDI*/
private final String[] SPMS_TO_UDI_TABLES= { private final String[] SPMS_TO_UDI_TABLES= {
"basic_udirel/updateTime//耗材字典","basic_products///耗材字典信息详情","company_product_relevance/updateTime//供应商关联信息", "basic_udirel/updateTime//耗材字典","basic_products///耗材字典信息详情","company_product_relevance/updateTime//供应商关联信息",
@ -90,19 +90,19 @@ public class IdcServiceImpl implements IdcService {
"productinfo/updateTime//国家库UDI数据,udicompany/updateTime//国际库医疗器械注册人信息"}; "productinfo/updateTime//国家库UDI数据,udicompany/updateTime//国际库医疗器械注册人信息"};
private int orderNum=0; private int orderNum=0;
@Resource @Resource
private SystemParamConfigService systemParamConfigService; private SystemParamConfigService systemParamConfigService;
@Resource @Resource
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Resource @Resource
private DbDao dbDao; private DbDao dbDao;
@Resource @Resource
private ScheduledDao scheduledDao; private ScheduledDao scheduledDao;
@Override @Override
public BaseResponse taskList(HttpServletRequest request,Map<String,Object> params) { public BaseResponse taskList(HttpServletRequest request,Map<String,Object> params) {
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
@ -110,7 +110,7 @@ public class IdcServiceImpl implements IdcService {
List<Map<String,Object>> list = dbDao.list(map); List<Map<String,Object>> list = dbDao.list(map);
return ResultVOUtils.success(list); return ResultVOUtils.success(list);
} }
@Override @Override
public BaseResponse download(HttpServletRequest request,Map<String,Object> params) { public BaseResponse download(HttpServletRequest request,Map<String,Object> params) {
Map<String,Object> map = dbDao.get("select * from basic_upload_status where taskId='"+params.get("taskId")+"'"); Map<String,Object> map = dbDao.get("select * from basic_upload_status where taskId='"+params.get("taskId")+"'");
@ -120,7 +120,7 @@ public class IdcServiceImpl implements IdcService {
JSONObject object = JSON.parseObject(json); JSONObject object = JSON.parseObject(json);
return ResultVOUtils.success(object); return ResultVOUtils.success(object);
} }
/*拉取前一级中继服务数据*/ /*拉取前一级中继服务数据*/
@Override @Override
public void pull() { public void pull() {
@ -138,14 +138,14 @@ public class IdcServiceImpl implements IdcService {
} }
} }
} }
@Async @Async
@Override @Override
public void asyncIdcTask() { public void asyncIdcTask() {
initTable(); initTable();
String[] tNames= {}; String[] tNames= {};
String direction = getDirection(); String direction = getDirection();
if(direction.equals("I")) { if(direction.equals("I")) {
tNames = SPMS_TO_UDI_TABLES; tNames = SPMS_TO_UDI_TABLES;
} else { } else {
@ -161,7 +161,7 @@ public class IdcServiceImpl implements IdcService {
uploadData(t); uploadData(t);
} }
} }
} }
private void uploadData(String t) { private void uploadData(String t) {
String[] tn = t.split("/"); String[] tn = t.split("/");
@ -196,7 +196,7 @@ public class IdcServiceImpl implements IdcService {
} }
//} //}
} }
private String pullData(String url,Map<String,Object> params) { private String pullData(String url,Map<String,Object> params) {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
@ -220,7 +220,7 @@ public class IdcServiceImpl implements IdcService {
} }
return result; return result;
} }
private String post(String url,Map<String,Object> params) { private String post(String url,Map<String,Object> params) {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
@ -241,8 +241,8 @@ public class IdcServiceImpl implements IdcService {
} }
return result; return result;
} }
public BaseResponse downlaodSuccess(HttpServletRequest request,Map<String,Object> params) { public BaseResponse downlaodSuccess(HttpServletRequest request,Map<String,Object> params) {
String sql = "update basic_upload_status set status='1' where taskId='"+params.get("taskId")+"'"; String sql = "update basic_upload_status set status='1' where taskId='"+params.get("taskId")+"'";
dbDao.update(sql); dbDao.update(sql);
@ -257,9 +257,9 @@ public class IdcServiceImpl implements IdcService {
String secretKey = request.getHeader("secretKey"); String secretKey = request.getHeader("secretKey");
/*******/ /*******/
JSONObject json = JSONObject.parseObject(content); JSONObject json = JSONObject.parseObject(content);
String datePath = DateUtil.formatDate(new Date(),"yyyy-MM-dd"); String datePath = DateUtil.formatDate(new Date(),"yyyy-MM-dd");
FileUtils.makeDirectory(filePath +datePath+"/"); FileUtils.makeDirectory(filePath +datePath+"/");
FileUtils.makeDirectory(backFilePath +datePath+"/"); FileUtils.makeDirectory(backFilePath +datePath+"/");
String fileName = filePath +datePath+"/"+json.getString("messageType")+"-"+json.getString("messageId")+".udi"; String fileName = filePath +datePath+"/"+json.getString("messageType")+"-"+json.getString("messageId")+".udi";
@ -284,7 +284,7 @@ public class IdcServiceImpl implements IdcService {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
saveUploadStatus(json.getString("messageType"),json.getString("messageId"),fileName); saveUploadStatus(json.getString("messageType"),json.getString("messageId"),fileName);
/*解析入库*/ /*解析入库*/
@ -298,8 +298,8 @@ public class IdcServiceImpl implements IdcService {
} }
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
/*数据同步,从数据库获取数据下发或上传下级中继服务*/ /*数据同步,从数据库获取数据下发或上传下级中继服务*/
@Override @Override
public BaseResponse send(Map<String,Object> params) { public BaseResponse send(Map<String,Object> params) {
@ -307,12 +307,12 @@ public class IdcServiceImpl implements IdcService {
} }
@Override @Override
public BaseResponse send(String messageType,String tableName,Map<String,Object> params) { public BaseResponse send(String messageType,String tableName,Map<String,Object> params) {
if(sendOnPage(messageType,tableName,params)) if(sendOnPage(messageType,tableName,params))
return ResultVOUtils.success(); return ResultVOUtils.success();
return ResultVOUtils.error(9999, ""); return ResultVOUtils.error(9999, "");
} }
private void saveUploadStatus(String messageType,String taskId,String fileName) { private void saveUploadStatus(String messageType,String taskId,String fileName) {
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
map.put("id", CustomUtil.getId()); map.put("id", CustomUtil.getId());
@ -323,7 +323,7 @@ public class IdcServiceImpl implements IdcService {
map.put("updateTime", new Date()); map.put("updateTime", new Date());
Map<String,Object> columns = getColumn("basic_upload_status"); Map<String,Object> columns = getColumn("basic_upload_status");
String sql = "insert into basic_upload_status "+DBAUtils.parseInsert(map, columns); String sql = "insert into basic_upload_status "+DBAUtils.parseInsert(map, columns);
dbDao.save(sql); dbDao.save(sql);
} }
private void saveDownloadStatus(String messageType,String taskId,String remark) { private void saveDownloadStatus(String messageType,String taskId,String remark) {
@ -336,7 +336,7 @@ public class IdcServiceImpl implements IdcService {
map.put("remark", remark); map.put("remark", remark);
Map<String,Object> columns = getColumn("basic_download_status"); Map<String,Object> columns = getColumn("basic_download_status");
String sql = "insert into basic_download_status "+DBAUtils.parseInsert(map, columns); String sql = "insert into basic_download_status "+DBAUtils.parseInsert(map, columns);
dbDao.save(sql); dbDao.save(sql);
} }
private void saveIdcLog(String messageType,String taskId,String content,int offset,int total) { private void saveIdcLog(String messageType,String taskId,String content,int offset,int total) {
@ -351,7 +351,7 @@ public class IdcServiceImpl implements IdcService {
map.put("total", total); map.put("total", total);
Map<String,Object> columns = getColumn("idc_log"); Map<String,Object> columns = getColumn("idc_log");
String sql = "insert into idc_log "+DBAUtils.parseInsert(map, columns); String sql = "insert into idc_log "+DBAUtils.parseInsert(map, columns);
dbDao.save(sql); dbDao.save(sql);
} }
private boolean sendOnPage(String messageType,String tableName,Map<String,Object> params) { private boolean sendOnPage(String messageType,String tableName,Map<String,Object> params) {
@ -359,10 +359,10 @@ public class IdcServiceImpl implements IdcService {
Map<String,String> table = dbDao.getMysql(tableName); Map<String,String> table = dbDao.getMysql(tableName);
if(!(table!=null&&table.get("tableName")!=null)) if(!(table!=null&&table.get("tableName")!=null))
return false; return false;
String sql = "select count(*) from "+tableName; String sql = "select count(*) from "+tableName;
Map<String,Object> column = getColumn(tableName); Map<String,Object> column = getColumn(tableName);
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String where = DBAUtils.convertWhere(column,params,""); String where = DBAUtils.convertWhere(column,params,"");
sql+=!StringUtils.isEmpty(where) ? " where "+where : ""; sql+=!StringUtils.isEmpty(where) ? " where "+where : "";
@ -370,7 +370,7 @@ public class IdcServiceImpl implements IdcService {
int total = dbDao.count(map); int total = dbDao.count(map);
String direction = getDirection(); String direction = getDirection();
String isEnd = params.get("isEnd")!=null ? params.get("isEnd").toString() : "0"; String isEnd = params.get("isEnd")!=null ? params.get("isEnd").toString() : "0";
int limit = 50; int limit = 50;
String[] files = new String[limit]; String[] files = new String[limit];
String filePathColumn = params.get("filePathColumn")!=null ? params.get("filePathColumn").toString() : ""; String filePathColumn = params.get("filePathColumn")!=null ? params.get("filePathColumn").toString() : "";
orderNum++; orderNum++;
@ -386,7 +386,7 @@ public class IdcServiceImpl implements IdcService {
orderNum++; orderNum++;
saveIdcLog(messageType,"",tableName +">"+where,i *limit,total); saveIdcLog(messageType,"",tableName +">"+where,i *limit,total);
if(data.get("data")!=null) { if(data.get("data")!=null) {
List<Map> list = JSONObject.parseArray(JSON.toJSONString(data.get("data")), Map.class); List<Map> list = JSONObject.parseArray(JSON.toJSONString(data.get("data")), Map.class);
if(list!=null&&list.size()>0) { if(list!=null&&list.size()>0) {
for(int m=0;m<list.size();m++) { for(int m=0;m<list.size();m++) {
@ -396,7 +396,7 @@ public class IdcServiceImpl implements IdcService {
recordSql+=!StringUtils.isEmpty(recordSql) ? "," : ""; recordSql+=!StringUtils.isEmpty(recordSql) ? "," : "";
recordSql+="('"+UUID.randomUUID().toString().replaceAll("-", "")+"','"+tableName+"','"+list.get(m).get("id")+"','"+isEnd+"',now())"; recordSql+="('"+UUID.randomUUID().toString().replaceAll("-", "")+"','"+tableName+"','"+list.get(m).get("id")+"','"+isEnd+"',now())";
} }
orderNum++; orderNum++;
String result = relay(direction,"",JSON.toJSONString(data),files); String result = relay(direction,"",JSON.toJSONString(data),files);
if(IDCUtils.isJson(result)) { if(IDCUtils.isJson(result)) {
@ -419,7 +419,7 @@ public class IdcServiceImpl implements IdcService {
} }
return success; return success;
} }
/*解析到数据库*/ /*解析到数据库*/
private void analyToDB(JSONObject jsonObject,MultipartFile[] files) { private void analyToDB(JSONObject jsonObject,MultipartFile[] files) {
if(!StringUtils.isEmpty(jsonObject.getString("tableName"))) { if(!StringUtils.isEmpty(jsonObject.getString("tableName"))) {
@ -428,7 +428,7 @@ public class IdcServiceImpl implements IdcService {
//图片处理 //图片处理
} }
} }
/*按表名解析数据到数据库,子表暂未处理*/ /*按表名解析数据到数据库,子表暂未处理*/
private void analyData(String tableName,List<Map<String,Object>> list) { private void analyData(String tableName,List<Map<String,Object>> list) {
String tName = DBAUtils.tableRealName(tableName); String tName = DBAUtils.tableRealName(tableName);
@ -455,7 +455,7 @@ public class IdcServiceImpl implements IdcService {
} }
} }
sql+=") values "; sql+=") values ";
if(list!=null&&list.size()>0) { if(list!=null&&list.size()>0) {
int n = 0; int n = 0;
int d = 0; int d = 0;
@ -470,10 +470,10 @@ public class IdcServiceImpl implements IdcService {
updateWhere+=keyColumn[z]+" = "+(keyDataType[z].equals("C") ? "'" :"") +list.get(i).get(keyColumn[z]) +(keyDataType[z].equals("C") ? "'" :""); updateWhere+=keyColumn[z]+" = "+(keyDataType[z].equals("C") ? "'" :"") +list.get(i).get(keyColumn[z]) +(keyDataType[z].equals("C") ? "'" :"");
} }
} }
if("A,D".contains(operateMode)&&!StringUtils.isEmpty(updateWhere)) if("A,D".contains(operateMode)&&!StringUtils.isEmpty(updateWhere))
dbDao.delete(del+updateWhere); dbDao.delete(del+updateWhere);
} }
/*A 新增 U 更新*/ /*A 新增 U 更新*/
if("A,U".contains(operateMode)) { if("A,U".contains(operateMode)) {
sql+=n>0 ? "," : ""; sql+=n>0 ? "," : "";
@ -484,7 +484,7 @@ public class IdcServiceImpl implements IdcService {
String extra = columnList.get(k).get("extra")!=null&&columnList.get(k).get("extra").toLowerCase().contains("auto") ? "A" : "N"; String extra = columnList.get(k).get("extra")!=null&&columnList.get(k).get("extra").toLowerCase().contains("auto") ? "A" : "N";
String attrName = columnList.get(k).get("attrName"); String attrName = columnList.get(k).get("attrName");
String value = list.get(i).get(attrName) !=null ? list.get(i).get(attrName).toString() : ""; String value = list.get(i).get(attrName) !=null ? list.get(i).get(attrName).toString() : "";
String dataType = columnList.get(k).get("dataType").toLowerCase().contains("char") || columnList.get(k).get("dataType").toLowerCase().contains("text") ? String dataType = columnList.get(k).get("dataType").toLowerCase().contains("char") || columnList.get(k).get("dataType").toLowerCase().contains("text") ?
"C" : columnList.get(k).get("dataType").toLowerCase().contains("date") ? "D" : "N" ; "C" : columnList.get(k).get("dataType").toLowerCase().contains("date") ? "D" : "N" ;
if(extra.equals("N")) { if(extra.equals("N")) {
sql+=m>0 ? "," : ""; sql+=m>0 ? "," : "";
@ -521,12 +521,12 @@ public class IdcServiceImpl implements IdcService {
} }
if(n>0) if(n>0)
dbDao.save(sql); dbDao.save(sql);
} }
} }
/*转发下级或上级中继服务*/ /*转发下级或上级中继服务*/
private String relay(String direction,String reqNo,String content,String[] files) { private String relay(String direction,String reqNo,String content,String[] files) {
String host = getNextHost(direction); String host = getNextHost(direction);
@ -540,20 +540,20 @@ public class IdcServiceImpl implements IdcService {
.readTimeout(30, TimeUnit.SECONDS)//设置读取超时时间 .readTimeout(30, TimeUnit.SECONDS)//设置读取超时时间
.build(); .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
MultipartBody.Builder builder = new MultipartBody.Builder(); MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM); builder.setType(MultipartBody.FORM);
String fileType = "application/octet-stream"; String fileType = "application/octet-stream";
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
if(!StringUtils.isEmpty(files[i])) { if(!StringUtils.isEmpty(files[i])) {
File file = new File(files[i]); File file = new File(files[i]);
builder.addFormDataPart("files",files[i], builder.addFormDataPart("files",files[i],
RequestBody.create(MediaType.parse(fileType), file)); RequestBody.create(MediaType.parse(fileType), file));
} }
} }
builder.addFormDataPart("content", content); builder.addFormDataPart("content", content);
RequestBody body = builder.build(); RequestBody body = builder.build();
Request req = new Request.Builder() Request req = new Request.Builder()
.url(host) .url(host)
.method("POST", body) .method("POST", body)
@ -573,13 +573,13 @@ public class IdcServiceImpl implements IdcService {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
log.debug("未配置中继服务地址"); log.debug("未配置中继服务地址");
} }
return result; return result;
} }
/*获取转发服务地址当前值允许单向只使用参数upper_server_ip*/ /*获取转发服务地址当前值允许单向只使用参数upper_server_ip*/
private String getNextHost(String direction) { private String getNextHost(String direction) {
SystemParamConfigEntity systemParamConfigEntity = getSystemParamConfig("upper_server_ip","中继上传服务地址" , "",""); SystemParamConfigEntity systemParamConfigEntity = getSystemParamConfig("upper_server_ip","中继上传服务地址" , "","");
@ -587,14 +587,14 @@ public class IdcServiceImpl implements IdcService {
//getSystemParamConfig("sync_idc_lower_host","下级(下发)中继服务地址" , "","") ; //getSystemParamConfig("sync_idc_lower_host","下级(下发)中继服务地址" , "","") ;
return systemParamConfigEntity.getParamValue(); return systemParamConfigEntity.getParamValue();
} }
/*判断是否最后一级*/ /*判断是否最后一级*/
private boolean isLastLevel(String direction) { private boolean isLastLevel(String direction) {
SystemParamConfigEntity systemParamConfigEntity = SystemParamConfigEntity systemParamConfigEntity =
direction.equals("I") ? getSystemParamConfig("sync_idc_top","是否顶级中继服务(连接自助平台)" , "0","01是(是,接收下级上传数据后解析入库)"): direction.equals("I") ? getSystemParamConfig("sync_idc_top","是否顶级中继服务(连接自助平台)" , "0","01是(是,接收下级上传数据后解析入库)"):
getSystemParamConfig("sync_idc_final","是否末级中继服务(连接UDI管理系统)" , "0","01是(是,接收上级下发数据后解析入库)") ; getSystemParamConfig("sync_idc_final","是否末级中继服务(连接UDI管理系统)" , "0","01是(是,接收上级下发数据后解析入库)") ;
return systemParamConfigEntity.getParamValue().equals("0") ? false : true ; return systemParamConfigEntity.getParamValue().equals("0") ? false : true ;
} }
/*检查当前系统为自助平台下发还是UDI系统(上传),返回传输方向,如果都未设置,默认返回下发*/ /*检查当前系统为自助平台下发还是UDI系统(上传),返回传输方向,如果都未设置,默认返回下发*/
private String getDirection() { private String getDirection() {
@ -606,13 +606,13 @@ public class IdcServiceImpl implements IdcService {
return "U"; return "U";
} }
return "I"; return "I";
} }
/*是否需要转发*/ /*是否需要转发*/
private boolean isRelay(String direction) { private boolean isRelay(String direction) {
String relayStr = direction.equals("U") ? "sync_upstream_enable" : "sync_downstream_enable"; String relayStr = direction.equals("U") ? "sync_upstream_enable" : "sync_downstream_enable";
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(relayStr); SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(relayStr);
if (systemParamConfigEntity!=null&&systemParamConfigEntity.getParamValue()!=null&& if (systemParamConfigEntity!=null&&systemParamConfigEntity.getParamValue()!=null&&
systemParamConfigEntity.getParamValue().equals("0")) { systemParamConfigEntity.getParamValue().equals("0")) {
@ -620,8 +620,8 @@ public class IdcServiceImpl implements IdcService {
} }
return true; return true;
} }
/*由表名获取数据*/ /*由表名获取数据*/
private Map<String,Object> getData(String messageType,String tableName,Map<String,Object> params) { private Map<String,Object> getData(String messageType,String tableName,Map<String,Object> params) {
String sql = "select "+tableName+".*,'A' as operateMode from "+tableName; String sql = "select "+tableName+".*,'A' as operateMode from "+tableName;
@ -641,10 +641,10 @@ public class IdcServiceImpl implements IdcService {
map.put("data", list); map.put("data", list);
return map; return map;
} }
private SystemParamConfigEntity getSystemParamConfig(String paramKey,String paramName,String defaultValue,String paramExplain) { private SystemParamConfigEntity getSystemParamConfig(String paramKey,String paramName,String defaultValue,String paramExplain) {
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(paramKey); SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(paramKey);
if(systemParamConfigEntity==null||(systemParamConfigEntity!=null&&StringUtils.isEmpty(systemParamConfigEntity.getParamKey()))) { if(systemParamConfigEntity==null||(systemParamConfigEntity!=null&&StringUtils.isEmpty(systemParamConfigEntity.getParamKey()))) {
@ -654,7 +654,7 @@ public class IdcServiceImpl implements IdcService {
systemParamConfigEntity.setParentId(0); systemParamConfigEntity.setParentId(0);
systemParamConfigEntity.setParamValue(defaultValue); systemParamConfigEntity.setParamValue(defaultValue);
systemParamConfigEntity.setParamExplain(paramExplain); systemParamConfigEntity.setParamExplain(paramExplain);
systemParamConfigEntity.setParamStatus(0); systemParamConfigEntity.setParamStatus(1);
systemParamConfigEntity.setParamType(0); systemParamConfigEntity.setParamType(0);
systemParamConfigService.insert(systemParamConfigEntity); systemParamConfigService.insert(systemParamConfigEntity);
} }
@ -671,8 +671,8 @@ public class IdcServiceImpl implements IdcService {
out.flush(); out.flush();
out.close(); out.close();
} }
/*把列数据转Map*/ /*把列数据转Map*/
private Map<String,Object> getColumn(String tableName) { private Map<String,Object> getColumn(String tableName) {
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
@ -684,7 +684,7 @@ public class IdcServiceImpl implements IdcService {
if(columnList!=null&&columnList.size()>0) { if(columnList!=null&&columnList.size()>0) {
for(int i=0;i<columnList.size();i++) { for(int i=0;i<columnList.size();i++) {
Map<String,Object> column = new HashMap<String,Object>(); 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")? 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(); String attrName = columnList.get(i).get("columnName").toString();
if(map.get(attrName)==null) { if(map.get(attrName)==null) {
@ -707,8 +707,8 @@ public class IdcServiceImpl implements IdcService {
} }
return map; return map;
} }
private String getUpdateTime(String id) { private String getUpdateTime(String id) {
String updateTime = ""; String updateTime = "";
Map<String,Object> map = dbDao.get("select * from idc_status where id='"+id+"'"); Map<String,Object> map = dbDao.get("select * from idc_status where id='"+id+"'");
@ -718,7 +718,7 @@ public class IdcServiceImpl implements IdcService {
updateTime = "2000-01-01 00:00:00"; updateTime = "2000-01-01 00:00:00";
String sql = "insert into idc_status (id,statusTime) values ('"+id+"',cast('"+updateTime+"' as datetime))"; String sql = "insert into idc_status (id,statusTime) values ('"+id+"',cast('"+updateTime+"' as datetime))";
dbDao.save(sql); dbDao.save(sql);
} }
return updateTime; return updateTime;
} }
private String setUpdateTime(String id,String updateTime) { private String setUpdateTime(String id,String updateTime) {
@ -730,7 +730,7 @@ public class IdcServiceImpl implements IdcService {
} else { } else {
sql = "insert into idc_status (id,statusTime) values ('"+id+"',cast('"+updateTime+"' as datetime))"; sql = "insert into idc_status (id,statusTime) values ('"+id+"',cast('"+updateTime+"' as datetime))";
dbDao.save(sql); dbDao.save(sql);
} }
return updateTime; return updateTime;
} }
private void initTable() { private void initTable() {
@ -744,7 +744,7 @@ public class IdcServiceImpl implements IdcService {
if(!(map!=null&&map.get("tableName")!=null)) { if(!(map!=null&&map.get("tableName")!=null)) {
jdbcTemplate.execute(sql); jdbcTemplate.execute(sql);
} }
} }
} }

Loading…
Cancel
Save