新增物资分类,部门信息,优化要同步表

master
anthonywj 2 years ago
parent 7aff592868
commit 9123c04905

@ -13,6 +13,9 @@ public class SyncDataSetEntity {
private boolean basicProducts; private boolean basicProducts;
private boolean basicCorp; private boolean basicCorp;
private boolean basicInv; private boolean basicInv;
private boolean basicType;
private boolean basicDept;
private boolean basicThirdProducts; private boolean basicThirdProducts;
private boolean basicThirdCorp; private boolean basicThirdCorp;
private boolean basicThirdInv; private boolean basicThirdInv;

@ -71,19 +71,31 @@ public class IdcServiceImpl implements IdcService {
/*同步表,格式:同步设置表列名/同步设置表列名(子表时设置,主表不设置)/主表唯一列(多列逗号分隔)/主表关联列/子表关联列/数据库实际表/时间列/图片或文件列/数据条件/说明*/ /*同步表,格式:同步设置表列名/同步设置表列名(子表时设置,主表不设置)/主表唯一列(多列逗号分隔)/主表关联列/子表关联列/数据库实际表/时间列/图片或文件列/数据条件/说明*/
private final String[] SYNC_TABLES = { private final String[] SYNC_TABLES = {
"entrustAction//basic_entrust_accept/id///updateTime///委托验收","basicProducts//basic_udirel/id///updateTime///耗材字典","/basicProducts/basic_products/id/uuid/uuid////耗材字典信息详情", "entrustAction//basic_entrust_accept/id///updateTime///委托验收",
"/companyCert/company_product_relevance/id/customerId/unitFk/updateTime///供应商关联信息", "basicProducts//basic_udirel/id///updateTime///耗材字典",
"basicCorp//basic_corp/id///updateTime///往来单位","typeThird//thr_bustype_origin/id///updateTime///第三方单据类型", "/basicProducts/basic_products/id/uuid/uuid////耗材字典信息详情",
"basicThirdCorp//thr_corp/id///updateTime///第三方往来单位","//thr_dept/id///updateTime///第三方部门", "basicCorp//basic_corp/id///updateTime///往来单位",
"//thr_inv_products/id///updateTime///第三方库存","basicThirdInv//thr_inv_warehouse/id//////第三方仓库", "//company_product_relevance/id///updateTime///供应商关联信息",
"basicThirdBusOrder//thr_order/id///updateTime///第三方业务单据","/basicThirdBusOrder/thr_order_detail/orderIdFk/id/orderIdFk/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/id/orderIdFk/updateTime///第三方单据详情",
"basicThirdProducts//thr_products/id///updateTime///第三方产品信息", "basicThirdProducts//thr_products/id///updateTime///第三方产品信息",
"//sup_cert_set/id///updateTime///供应商资质证书设置","companyCert//sup_company/customerId///updateTime///配送企业", "//sup_cert_set/id///updateTime///供应商资质证书设置",
"manufacturerCert//sup_manufacturer/id///updateTime///生产企业","productCert//sup_product/id///updateTime///产品资质信息", "companyCert//sup_company/customerId///updateTime///配送企业",
"manufacturerCert//sup_manufacturer/id///updateTime///生产企业",
"productCert//sup_product/id///updateTime///产品资质信息",
"/companyCert/sup_cert/id/customerId/customerId/updateTime/filePath/type=1/配送企业资质证书信息", "/companyCert/sup_cert/id/customerId/customerId/updateTime/filePath/type=1/配送企业资质证书信息",
"/manufacturerCert/sup_cert/id/manufacturerId/manufacturerIdFk/updateTime/filePath/type=2/生产企业资质证书信息", "/manufacturerCert/sup_cert/id/manufacturerId/manufacturerIdFk/updateTime/filePath/type=2/生产企业资质证书信息",
"/productCert/sup_cert/id/productId/productIdFk/updateTime/filePath/type=3/产品资质证书信息", "/productCert/sup_cert/id/productId/productIdFk/updateTime/filePath/type=3/产品资质证书信息",
"//udicompany/id///updateTime///国际库医疗器械注册人信息"}; "//udicompany/id///updateTime///国际库医疗器械注册人信息",
"basicType//basic_hosp_type/id///updateTime///物资字典分类",
"basicDept//auth_dept/id///updateTime///部门信息",
"basicInv//auth_warehouse/id///updateTime///仓库信息",
};
//"dbDiProducts//productinfo/id///updateTime///DI产品信息", //"dbDiProducts//productinfo/id///updateTime///DI产品信息",
//"basicInv/////////仓库字典", //"basicInv/////////仓库字典",
//"typeBus/////////业务单据类型", //"typeBus/////////业务单据类型",
@ -147,6 +159,7 @@ public class IdcServiceImpl implements IdcService {
logger.info("UDI管理系统同步任务开始--------"); logger.info("UDI管理系统同步任务开始--------");
asyncDataTask(true); asyncDataTask(true);
} }
/*自助平台生成任务,不上传*/ /*自助平台生成任务,不上传*/
@Override @Override
public void asyncSpsTask() { public void asyncSpsTask() {
@ -160,6 +173,7 @@ public class IdcServiceImpl implements IdcService {
public void asyncFetchUdiTask() { public void asyncFetchUdiTask() {
fetchTask(false); fetchTask(false);
} }
@Async @Async
@Override @Override
public void asyncFetchTask() { public void asyncFetchTask() {
@ -283,7 +297,6 @@ public class IdcServiceImpl implements IdcService {
} }
private String fetchData(String host, Map<String, Object> params) { private String fetchData(String host, Map<String, Object> params) {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
@ -362,6 +375,7 @@ public class IdcServiceImpl implements IdcService {
dbDao.update(sql); dbDao.update(sql);
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
/****/ /****/
@Override @Override
public BaseResponse receive(HttpServletRequest request, public BaseResponse receive(HttpServletRequest request,
@ -444,6 +458,7 @@ 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) {
@ -491,6 +506,7 @@ public class IdcServiceImpl implements IdcService {
dbDao.save(sql); dbDao.save(sql);
} }
private void saveDownloadStatus(Map<String, Object> params) { private void saveDownloadStatus(Map<String, Object> params) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("receiveStatus", "0"); map.put("receiveStatus", "0");
@ -501,6 +517,7 @@ public class IdcServiceImpl implements IdcService {
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) {
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());
@ -660,8 +677,7 @@ public class IdcServiceImpl implements IdcService {
/*增加同步任务状态*/ /*增加同步任务状态*/
private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success, Date startTime, boolean isEnd) { private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success, Date startTime, boolean isEnd) {
try try {
{
String content = JSON.toJSONString(json); String content = JSON.toJSONString(json);
String datePath = DateUtil.formatDate(new Date(), "yyyy-MM-dd"); String datePath = DateUtil.formatDate(new Date(), "yyyy-MM-dd");
String fileName = filePath + datePath + "/" + json.get("messageType") + "-" + json.get("messageId") + ".udi"; String fileName = filePath + datePath + "/" + json.get("messageType") + "-" + json.get("messageId") + ".udi";
@ -967,9 +983,11 @@ public class IdcServiceImpl implements IdcService {
} }
return success; return success;
} }
private boolean signleDownloadFile(String syncIp, String fileName) { private boolean signleDownloadFile(String syncIp, String fileName) {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build();; .build();
;
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "fileName=" + fileName); RequestBody body = RequestBody.create(mediaType, "fileName=" + fileName);
@ -1002,7 +1020,6 @@ public class IdcServiceImpl implements IdcService {
outputStream.flush(); outputStream.flush();
} catch (Exception e) { } catch (Exception e) {
@ -1050,6 +1067,7 @@ public class IdcServiceImpl implements IdcService {
List<Map<String, Object>> list = dbDao.list(map); List<Map<String, Object>> list = dbDao.list(map);
return list; return list;
} }
/*由表名获取数据*/ /*由表名获取数据*/
private Map<String, Object> getData(String messageType, String tableName, Map<String, Object> params, Map<String, Object> whereParams) { 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); List<Map<String, Object>> list = getList(tableName, whereParams);
@ -1068,8 +1086,6 @@ public class IdcServiceImpl implements IdcService {
} }
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()))) {
@ -1085,6 +1101,7 @@ public class IdcServiceImpl implements IdcService {
} }
return systemParamConfigEntity; return systemParamConfigEntity;
} }
private void writeFile(byte[] file, String filePath, String fileName) throws Exception { private void writeFile(byte[] file, String filePath, String fileName) throws Exception {
File targetFile = new File(filePath); File targetFile = new File(filePath);
if (!targetFile.exists()) { if (!targetFile.exists()) {
@ -1109,7 +1126,8 @@ public class IdcServiceImpl implements IdcService {
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) {
column.put("tableName", tname); column.put("tableName", tname);
@ -1149,6 +1167,7 @@ public class IdcServiceImpl implements IdcService {
} }
return updateTime; return updateTime;
} }
private String setUpdateTime(String id, String updateTime) { private String setUpdateTime(String id, String updateTime) {
String sql = ""; String sql = "";
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 + "'");
@ -1161,6 +1180,7 @@ public class IdcServiceImpl implements IdcService {
} }
return updateTime; return updateTime;
} }
private void initTable() { private void initTable() {
alterTable("idc_var", "create table idc_var (code varchar(60),content varchar(200),PRIMARY KEY (code))"); 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))"); alterTable("idc_status", "create table idc_status (id varchar(100),statusTime datetime,PRIMARY KEY (id))");
@ -1176,6 +1196,7 @@ public class IdcServiceImpl implements IdcService {
} }
} }
private void alterTable(String tableName, String sql) { private void alterTable(String tableName, String sql) {
Map<String, String> map = dbDao.getMysql(tableName); Map<String, String> map = dbDao.getMysql(tableName);
if (!(map != null && map.get("tableName") != null)) { if (!(map != null && map.get("tableName") != null)) {

@ -18,6 +18,10 @@ public class SyncDataSetResponse {
private boolean basicThirdCorp; private boolean basicThirdCorp;
private boolean basicThirdInv; private boolean basicThirdInv;
private boolean basicThirdBusOrder; private boolean basicThirdBusOrder;
private boolean basicType;
private boolean basicDept;
private boolean dbDiProducts; private boolean dbDiProducts;
private boolean downstreamEnable; private boolean downstreamEnable;
private boolean orderScanFinish; private boolean orderScanFinish;

@ -18,7 +18,7 @@
, basicThirdBusOrder, orderScanFinish, dbDiProducts, downstreamEnable, syncTime, , basicThirdBusOrder, orderScanFinish, dbDiProducts, downstreamEnable, syncTime,
orderUnReceive, orderUnCheck, busTypes, sysUser, orderSyncTime, orderSyncStart, orderUnReceive, orderUnCheck, busTypes, sysUser, orderSyncTime, orderSyncStart,
basicSyncStart, entrustAction basicSyncStart, entrustAction
, unCheckCert, checkedCert, companyCert, manufacturerCert, productCert) , unCheckCert, checkedCert, companyCert, manufacturerCert, productCert, basicType, basicDept)
values (#{id}, values (#{id},
#{typeBus}, #{typeBus},
#{typeScan}, #{typeScan},
@ -43,6 +43,6 @@
#{basicSyncStart}, #{basicSyncStart},
#{entrustAction}, #{entrustAction},
#{unCheckCert}, #{unCheckCert},
#{checkedCert}, #{companyCert}, #{manufacturerCert}, #{productCert}) #{checkedCert}, #{companyCert}, #{manufacturerCert}, #{productCert}, #{basicType}, #{basicDept})
</insert> </insert>
</mapper> </mapper>

@ -139,4 +139,8 @@ CALL Pro_Temp_ColumnWork('inv_product', 'onWayCount', 'int ', 1);
CALL Pro_Temp_ColumnWork('inv_product', 'availableStock', 'int ', 1); CALL Pro_Temp_ColumnWork('inv_product', 'availableStock', 'int ', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicDept', 'tinyint', 1);

Loading…
Cancel
Save