数据同步,

master
anthonywj 2 years ago
parent 4785613797
commit 4236c930bf

@ -27,7 +27,7 @@ public class BasicProcessStatus {
public static final int BASIC_THIRD_ORDER = 6; //往来单位 public static final int BASIC_THIRD_ORDER = 6; //往来单位
public static final int NEW_ALL_DATA = 7; //所有最新数据 public static final int NEW_ALL_DATA = 7; //所有最新数据
public static final int NEW_ALL_BUS = 8; public static final int NEW_ALL_BUS = 8;
public static final int NEW_ALL_ORDER = 9; public static final String NEW_ALL_ORDER = "9";
public static final int NEW_ALL_DI = 10; public static final int NEW_ALL_DI = 10;
public static final int SCHEDULE_NORMAL = 1; //常规任务 public static final int SCHEDULE_NORMAL = 1; //常规任务

@ -207,6 +207,11 @@ public class Constant {
*/ */
public static final String ORDER_STATUS_AUDITED = "audited"; public static final String ORDER_STATUS_AUDITED = "audited";
/**
*
*/
public static final String ORDER_STATUS_WAIT_AUDITED = "waitAudited";
/** /**
* - * -
*/ */

@ -18,7 +18,7 @@ public class BasicDownloadStatusEntity {
private String taskId; private String taskId;
private String idDatas; private String idDatas;
private Integer status; private Integer status;
private Integer type; private String type;
private Date updateTime; private Date updateTime;
private Integer scheduleType; private Integer scheduleType;
private Date startTime; private Date startTime;

@ -9,7 +9,7 @@ public class BasicExportStatusEntity {
private String id; private String id;
private String idDatas; private String idDatas;
private Integer status; private Integer status;
private Integer type; private String type;
private Date updateTime; private Date updateTime;
private Integer scheduleType; private Integer scheduleType;
private Date startTime; private Date startTime;

@ -125,6 +125,7 @@ public class IdcServiceImpl implements IdcService {
logger.info("UDI管理系统同步任务开始--------"); logger.info("UDI管理系统同步任务开始--------");
asyncDataTask(true); asyncDataTask(true);
} }
/*自助平台生成任务,不上传*/ /*自助平台生成任务,不上传*/
@Override @Override
public void asyncSpsTask() { public void asyncSpsTask() {
@ -138,6 +139,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() {
@ -255,7 +257,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();
@ -332,6 +333,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,
@ -403,6 +405,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) {
@ -432,6 +435,7 @@ public class IdcServiceImpl implements IdcService {
dbDao.save(sql); dbDao.save(sql);
} }
private void saveDownloadStatus(String messageType, String taskId, String remark) { private void saveDownloadStatus(String messageType, String taskId, String remark) {
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());
@ -445,6 +449,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());
@ -610,7 +615,6 @@ public class IdcServiceImpl implements IdcService {
} }
/*解析到数据库*/ /*解析到数据库*/
private boolean analyToDB(JSONObject jsonObject, MultipartFile[] files) { private boolean analyToDB(JSONObject jsonObject, MultipartFile[] files) {
@ -852,6 +856,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);
@ -870,8 +875,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()))) {
@ -888,6 +891,7 @@ public class IdcServiceImpl implements IdcService {
System.out.print(JSON.toJSONString(systemParamConfigEntity) + "\n"); System.out.print(JSON.toJSONString(systemParamConfigEntity) + "\n");
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()) {
@ -912,7 +916,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);
@ -948,6 +953,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 + "'");
@ -960,6 +966,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(36),statusTime datetime,PRIMARY KEY (id))"); alterTable("idc_status", "create table idc_status (id varchar(36),statusTime datetime,PRIMARY KEY (id))");
@ -973,6 +980,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)) {

@ -547,6 +547,10 @@ public class IoOrderServiceImpl implements IoOrderService {
filterOrderRequest.setStatuses(Arrays.asList(1, 3, 5, 10, 7)); filterOrderRequest.setStatuses(Arrays.asList(1, 3, 5, 10, 7));
filterOrderRequest.setDealStatuses(Arrays.asList(1, 2, 3, 4)); filterOrderRequest.setDealStatuses(Arrays.asList(1, 2, 3, 4));
break; break;
case Constant.ORDER_STATUS_WAIT_AUDITED:
filterOrderRequest.setStatuses(Arrays.asList(10, 7));
filterOrderRequest.setDealStatuses(Arrays.asList(3, 4));
break;
default: default:
break; break;
} }

@ -36,7 +36,7 @@ public class AsyncSpsTask implements SchedulingConfigurer {
scheduledRequest.setCronName("syncIdcSps"); scheduledRequest.setCronName("syncIdcSps");
logger.info("syncIdcSps----------------"); logger.info("syncIdcSps----------------");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest); ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity != null ? scheduledEntity.getCron() : "* 0/30 * * * ?"; String cron = scheduledEntity != null ? scheduledEntity.getCron() : "0 0/1 * * * ?";
if (cron.isEmpty()) { if (cron.isEmpty()) {
logger.error("cron is null"); logger.error("cron is null");

Loading…
Cancel
Save