单据同步问题

master
anthonywj 2 years ago
parent cfd81deb8b
commit c09497b01b

@ -100,14 +100,17 @@ public class IdcServiceImpl implements IdcService {
public BaseResponse download(HttpServletRequest request, Map<String, Object> params) { public BaseResponse download(HttpServletRequest request, Map<String, Object> params) {
return statusFile(params, "basic_export_status"); return statusFile(params, "basic_export_status");
} }
@Override @Override
public BaseResponse uploadStatus(HttpServletRequest request, Map<String, Object> params) { public BaseResponse uploadStatus(HttpServletRequest request, Map<String, Object> params) {
return statusFile(params, "basic_upload_status"); return statusFile(params, "basic_upload_status");
} }
@Override @Override
public BaseResponse downloadStatus(HttpServletRequest request, Map<String, Object> params) { public BaseResponse downloadStatus(HttpServletRequest request, Map<String, Object> params) {
return statusFile(params, "basic_download_status"); return statusFile(params, "basic_download_status");
} }
private BaseResponse statusFile(Map<String, Object> params, String tableName) { private BaseResponse statusFile(Map<String, Object> params, String tableName) {
String id = ""; String id = "";
if (params.containsKey("taskId") && params.get("taskId") != null) { if (params.containsKey("taskId") && params.get("taskId") != null) {
@ -119,9 +122,9 @@ public class IdcServiceImpl implements IdcService {
Map<String, Object> map = map = dbDao.get("select * from " + tableName + " where id='" + id + "'"); Map<String, Object> map = map = dbDao.get("select * from " + tableName + " where id='" + id + "'");
if (map == null) if (map == null)
return ResultVOUtils.error(9000, "下载任务不存在"); return ResultVOUtils.error(9000, "下载任务不存在" + tableName);
if (!(map.get("cacheFilePath") != null && FileUtils.isFileExist(map.get("cacheFilePath").toString()))) if (!(map.get("cacheFilePath") != null && FileUtils.isFileExist(map.get("cacheFilePath").toString())))
return ResultVOUtils.error(9000, "下载文件不存在"); return ResultVOUtils.error(9000, "下载文件不存在-" + tableName);
String json = FileUtils.readFileAll(map.get("cacheFilePath").toString()); String json = FileUtils.readFileAll(map.get("cacheFilePath").toString());
JSONObject object = JSON.parseObject(json); JSONObject object = JSON.parseObject(json);
@ -211,8 +214,7 @@ public class IdcServiceImpl implements IdcService {
String[] syncTables = TableUtils.syncTables(); String[] syncTables = TableUtils.syncTables();
for (int i = 0; i < syncTables.length; i++) { for (int i = 0; i < syncTables.length; i++) {
String[] tnames = syncTables[i].split("/"); String[] tnames = syncTables[i].split("/");
boolean sync = ((tnames[0]==null||StringUtils.isEmpty(tnames[0])||(tnames[0]!=null&&tnames[0].equals("null")))&& boolean sync = StringUtils.isEmpty(tnames[0]) ||
(tnames[1]==null||StringUtils.isEmpty(tnames[1])||(tnames[1]!=null&&tnames[1].equals("null"))))||
(!StringUtils.isEmpty(tnames[0]) && map != null && map.get(tnames[0]) != null && map.get(tnames[0]).toString().equals("1")); (!StringUtils.isEmpty(tnames[0]) && map != null && map.get(tnames[0]) != null && map.get(tnames[0]).toString().equals("1"));
saveIdcLog("---", "", map.get(tnames[0]) + syncTables[i], 0, 0); saveIdcLog("---", "", map.get(tnames[0]) + syncTables[i], 0, 0);
if (sync) { if (sync) {
@ -309,6 +311,7 @@ public class IdcServiceImpl implements IdcService {
return result; return result;
} }
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();
@ -359,7 +362,6 @@ public class IdcServiceImpl implements IdcService {
} }
public BaseResponse downlaodSuccess(HttpServletRequest request, Map<String, Object> params) { public BaseResponse downlaodSuccess(HttpServletRequest request, Map<String, Object> params) {
String sql = "update basic_export_status set receiveStatus='1',endTime=now() where id='" + params.get("taskId") + "'"; String sql = "update basic_export_status set receiveStatus='1',endTime=now() where id='" + params.get("taskId") + "'";
dbDao.update(sql); dbDao.update(sql);
@ -372,11 +374,13 @@ public class IdcServiceImpl implements IdcService {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@Override @Override
public BaseResponse uploadFile(HttpServletRequest request, public BaseResponse uploadFile(HttpServletRequest request,
String content, MultipartFile[] files) { String content, MultipartFile[] files) {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
/****/ /****/
@Override @Override
public BaseResponse receive(HttpServletRequest request, public BaseResponse receive(HttpServletRequest request,
@ -681,7 +685,8 @@ 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");
@ -724,7 +729,8 @@ public class IdcServiceImpl implements IdcService {
} }
private boolean analyMiddle(String host, JSONObject jsonObject, MultipartFile[] files, boolean isUpload, boolean isToDB) { private boolean analyMiddle(String host, JSONObject jsonObject, MultipartFile[] files, boolean isUpload,
boolean isToDB) {
if (jsonObject.get("data") != null) { if (jsonObject.get("data") != null) {
String tableName = ""; String tableName = "";
String uniqueColumn = ""; String uniqueColumn = "";
@ -787,7 +793,8 @@ public class IdcServiceImpl implements IdcService {
/*解析到数据库*/ /*解析到数据库*/
/*按表名解析数据到数据库,子表暂未处理*/ /*按表名解析数据到数据库,子表暂未处理*/
private boolean analyToDB(String host, String tableName, String uniqueColumn, String filePathColumn, List<Map<String, Object>> list, boolean isUpload) { private boolean analyToDB(String host, String tableName, String uniqueColumn, String
filePathColumn, List<Map<String, Object>> list, boolean isUpload) {
String tName = DBAUtils.tableRealName(tableName); String tName = DBAUtils.tableRealName(tableName);
String sql = "replace " + tName + "("; String sql = "replace " + tName + "(";
@ -1074,7 +1081,8 @@ public class IdcServiceImpl implements IdcService {
} }
/*由表名获取数据*/ /*由表名获取数据*/
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);
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("messageId", CustomUtil.getId()); map.put("messageId", CustomUtil.getId());
@ -1091,7 +1099,8 @@ 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()))) {
systemParamConfigEntity = new SystemParamConfigEntity(); systemParamConfigEntity = new SystemParamConfigEntity();

@ -5,6 +5,8 @@ package com.glxp.api.idc.utils;
*/ */
public class TableUtils { public class TableUtils {
/*同步表,格式:同步设置表列名/同步设置表列名(子表时设置,主表不设置)/主表唯一列(多列逗号分隔)/主表关联列/子表关联列/数据库实际表/时间列/图片或文件列/数据条件/说明*/ /*同步表,格式:同步设置表列名/同步设置表列名(子表时设置,主表不设置)/主表唯一列(多列逗号分隔)/主表关联列/子表关联列/数据库实际表/时间列/图片或文件列/数据条件/说明*/
//同步设置表字段(主表设置)/同步设置表字段(字表设置)/表名/主表唯一键/
private static final String[] SYNC_TABLES = { private static final String[] SYNC_TABLES = {
"basicProducts//basic_udirel/id///updateTime///耗材字典", "basicProducts//basic_udirel/id///updateTime///耗材字典",
"/basicProducts/basic_products/id/uuid/uuid////耗材字典信息详情", "/basicProducts/basic_products/id/uuid/uuid////耗材字典信息详情",
@ -19,9 +21,12 @@ public class TableUtils {
"/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///物资字典分类", "basicType//basic_hosp_type/id///updateTime///物资字典分类",
}; };
/** /**
* "//auth_dept/id///updateTime///部门信息",
* "//auth_warehouse/id///updateTime///仓库信息",
* "typeThird//thr_bustype_origin/id///updateTime///第三方单据类型", * "typeThird//thr_bustype_origin/id///updateTime///第三方单据类型",
* "basicThirdCorp//thr_corp/id///updateTime///第三方往来单位", * "basicThirdCorp//thr_corp/id///updateTime///第三方往来单位",
* "//thr_dept/id///updateTime///第三方部门", * "//thr_dept/id///updateTime///第三方部门",

@ -116,7 +116,7 @@ public class SpsSyncDownloadService {
} }
} }
} }
syncOrderResponse.setCodeEntities(codeEntities);
syncOrderResponse.setOrderDetailBizEntities(orderDetailBizEntities); syncOrderResponse.setOrderDetailBizEntities(orderDetailBizEntities);
syncOrderResponse.setOrderDetailCodeEntities(orderDetailCodeEntities); syncOrderResponse.setOrderDetailCodeEntities(orderDetailCodeEntities);
syncOrderResponse.setOrderDetailResultEntities(orderDetailResultEntities); syncOrderResponse.setOrderDetailResultEntities(orderDetailResultEntities);

@ -3,7 +3,7 @@ server:
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.0.66:3364/udi_spms_wmd?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true jdbc-url: jdbc:mysql://192.168.0.66:3364/udi_spms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: Glxp@6066 password: Glxp@6066
hikari: hikari:
@ -13,7 +13,7 @@ spring:
redis: redis:
database: 10 database: 10
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6404
# password: 123456 # password: 123456
timeout: 300 timeout: 300
jedis: jedis:
@ -43,8 +43,8 @@ logging:
level: level:
com.glxp.api.dao: debug com.glxp.api.dao: debug
file_path: D:/udi/udiwms/udiwmsfile/ file_path: /udi/udiwms/udiwmsfile/
back_file_path: D:/share/udisps/back/ back_file_path: /share/udisps/back/
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test
SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: dev active: pro
jmx: jmx:
enabled: false enabled: false
servlet: servlet:

@ -5,7 +5,7 @@
<select id="get" resultType="com.glxp.api.entity.auth.AuthLicense"> <select id="get" resultType="com.glxp.api.entity.auth.AuthLicense">
SELECT * SELECT *
FROM auth_license FROM auth_license
where id = #{id} where apiKey = #{id}
</select> </select>
<insert id="save" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthLicense"> <insert id="save" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthLicense">
INSERT INTO auth_license(id, appid, name, apiKey, secretKey, createDate, customerId, companyName) INSERT INTO auth_license(id, appid, name, apiKey, secretKey, createDate, customerId, companyName)

@ -140,8 +140,6 @@ CALL Pro_Temp_ColumnWork('inv_product', 'availableStock', 'int ', 1);
CALL Pro_Temp_ColumnWork('auth_warehouse', 'updateTime', 'datetime ', 1); CALL Pro_Temp_ColumnWork('auth_warehouse', 'updateTime', 'datetime ', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicType', 'tinyint', 1); CALL Pro_Temp_ColumnWork('sync_data_set', 'basicType', 'tinyint', 1);
CALL Pro_Temp_ColumnWork('sync_data_set', 'basicDept', 'tinyint', 1); CALL Pro_Temp_ColumnWork('sync_data_set', 'basicDept', 'tinyint', 1);

Loading…
Cancel
Save