|
|
|
@ -69,16 +69,16 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
/*同步表,格式:同步设置表列名/同步设置表列名(子表时设置,主表不设置)/主表唯一列(多列逗号分隔)/主表关联列/子表关联列/数据库实际表/时间列/图片或文件列/数据条件/说明*/
|
|
|
|
|
private final String[] SYNC_TABLES= {
|
|
|
|
|
"entrustAction/////////委托验收","basicProducts//basic_udirel/uuid///updateTime///耗材字典","/basicProducts/basic_products/uuid,nameCode/uuid/uuid////耗材字典信息详情",
|
|
|
|
|
"entrustAction//basic_entrust_accept/id//////委托验收","basicProducts//basic_udirel/id///updateTime///耗材字典","/basicProducts/basic_products/id/uuid/uuid////耗材字典信息详情",
|
|
|
|
|
"//company_product_relevance////updateTime///供应商关联信息",
|
|
|
|
|
"basicCorp//basic_corp/erpId///updateTime///往来单位","typeThird//thr_bustype_origin/action,thirdSys///updateTime///第三方单据类型",
|
|
|
|
|
"basicThirdCorp//thr_corp/unitId,thirdSysFk///updateTime///第三方往来单位","//thr_dept/code,thirdSysFk///updateTime///第三方部门",
|
|
|
|
|
"//thr_inv_products/inventoryCode,batchNo,warehouseCode,spaceCode,thirdSysFk///updateTime///第三方库存","basicThirdInv//thr_inv_warehouse/code,thirdSysFk//////第三方仓库",
|
|
|
|
|
"basicThirdBusOrder//thr_order/billNo,thirdSysFk///updateTime///第三方业务单据","/basicThirdBusOrder/thr_order_detail/productId,orderIdFk,thirdSysFk///updateTime///第三方单据详情",
|
|
|
|
|
"basicThirdProducts//thr_products/code,thirdSysFk///updateTime///第三方产品信息","//sup_cert////updateTime/filePath//资质证书信息",
|
|
|
|
|
"//sup_cert_set////updateTime///供应商资质证书设置","companyCert//sup_company////updateTime///配送企业",
|
|
|
|
|
"manufacturerCert//sup_manufacturer////updateTime///生产企业","productCert//sup_product/productId,manufacturerIdFk,customerId///updateTime///产品资质信息",
|
|
|
|
|
"dbDiProducts//productinfo/nameCode,uuid,diType///updateTime///DI产品信息//udicompany/tyshxydm///updateTime///国际库医疗器械注册人信息"};
|
|
|
|
|
"basicCorp//basic_corp/id///updateTime///往来单位","typeThird//thr_bustype_origin/id///updateTime///第三方单据类型",
|
|
|
|
|
"basicThirdCorp//thr_corp/id///updateTime///第三方往来单位","//thr_dept/id///updateTime///第三方部门",
|
|
|
|
|
"//thr_inv_products/id///updateTime///第三方库存","basicThirdInv//thr_inv_warehouse/id//////第三方仓库",
|
|
|
|
|
"basicThirdBusOrder//thr_order/id///updateTime///第三方业务单据","/basicThirdBusOrder/thr_order_detail/orderIdFk///updateTime///第三方单据详情",
|
|
|
|
|
"basicThirdProducts//thr_products/id///updateTime///第三方产品信息","//sup_cert/id///updateTime/filePath//资质证书信息",
|
|
|
|
|
"//sup_cert_set/id///updateTime///供应商资质证书设置","companyCert//sup_company/customerId///updateTime///配送企业",
|
|
|
|
|
"manufacturerCert//sup_manufacturer/id///updateTime///生产企业","productCert//sup_product/id///updateTime///产品资质信息",
|
|
|
|
|
"dbDiProducts//productinfo/id///updateTime///DI产品信息","//udicompany/id///updateTime///国际库医疗器械注册人信息"};
|
|
|
|
|
|
|
|
|
|
private int orderNum=0;
|
|
|
|
|
|
|
|
|
@ -561,16 +561,15 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
if(col>0)
|
|
|
|
|
sql+=",";
|
|
|
|
|
columnList.get(i).put("attrName", columnList.get(i).get("columnName"));
|
|
|
|
|
String extra = columnList.get(i).get("extra")!=null&&columnList.get(i).get("extra").toLowerCase().contains("auto_i") ? "A" : "N";
|
|
|
|
|
sql+=extra.equals("N") ? columnList.get(i).get("columnName").toString() : "";
|
|
|
|
|
col+=extra.equals("N") ? 1 : 0;
|
|
|
|
|
sql+= columnList.get(i).get("columnName").toString() ;
|
|
|
|
|
col++;
|
|
|
|
|
if(uniqueColumn!=null&&columnList.get(i).get("columnKey")!=null&&(","+uniqueColumn+",").contains(","+columnList.get(i).get("columnName")+",")) {
|
|
|
|
|
keyColumn[key] = columnList.get(i).get("columnName").toString();
|
|
|
|
|
keyDataType[key]=columnList.get(i).get("dataType").toString().contains("char") ? "C" : columnList.get(i).get("dataType").toString().contains("date") ? "D" : "N";
|
|
|
|
|
key++;
|
|
|
|
|
} else {
|
|
|
|
|
if(columnList.get(i).get("columnKey")!=null&&!StringUtils.isEmpty(columnList.get(i).get("columnKey").toString())&&
|
|
|
|
|
("PRI,UNI,MUL".contains(columnList.get(i).get("columnKey").toString()))&&extra.equals("N")) {
|
|
|
|
|
("PRI".contains(columnList.get(i).get("columnKey").toString()))) {
|
|
|
|
|
keyColumn[key] = columnList.get(i).get("columnName").toString();
|
|
|
|
|
keyDataType[key]=columnList.get(i).get("dataType").toString().contains("char") ? "C" : columnList.get(i).get("dataType").toString().contains("date") ? "D" : "N";
|
|
|
|
|
key++;
|
|
|
|
@ -607,13 +606,12 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
int m = 0;
|
|
|
|
|
int h = 0;
|
|
|
|
|
for(int k=0;k<columnList.size();k++) {
|
|
|
|
|
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 value = list.get(i).get(attrName) !=null ? list.get(i).get(attrName).toString() : "";
|
|
|
|
|
value = DBAUtils.escape(value);
|
|
|
|
|
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" ;
|
|
|
|
|
if(extra.equals("N")) {
|
|
|
|
|
|
|
|
|
|
sql+=m>0 ? "," : "";
|
|
|
|
|
boolean ups = list.get(i).containsKey(attrName) ? true : false ;
|
|
|
|
|
updateSet+=ups&&h>0 ? "," : "";
|
|
|
|
@ -641,12 +639,12 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
dbDao.update(upd + updateSet+" where "+updateWhere);
|
|
|
|
|
h+=ups ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sql+=")";
|
|
|
|
|
n++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int m=0;m<6;m++) {
|
|
|
|
|
for(int m=0;m<30;m++) {
|
|
|
|
|
if(list.get(i).get("tableName"+m)!=null&&list.get(i).get("data"+m)!=null) {
|
|
|
|
|
Object obj = list.get(i).get("data"+m);
|
|
|
|
|
List<Map<String,Object>> chList = new ArrayList<Map<String,Object>>();
|
|
|
|
@ -654,6 +652,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
chList.add((Map<String,Object>)o);
|
|
|
|
|
}
|
|
|
|
|
analyData(list.get(i).get("tableName"+m).toString(),"",chList);
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|