相关bug修改

master
anthonywj 2 years ago
parent b3c5f8cfef
commit b0249db132

@ -138,6 +138,7 @@ public class IdcServiceImpl implements IdcService {
logger.info("UDI管理系统同步任务开始--------"); logger.info("UDI管理系统同步任务开始--------");
asyncDataTask(true); asyncDataTask(true);
} }
/*自助平台生成任务,不上传*/ /*自助平台生成任务,不上传*/
@Override @Override
public void asyncSpsTask() { public void asyncSpsTask() {
@ -151,6 +152,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() {
@ -274,7 +276,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();
@ -352,6 +353,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,
@ -434,6 +436,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) {
@ -485,6 +488,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");
@ -496,6 +500,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());
@ -653,8 +658,7 @@ public class IdcServiceImpl implements IdcService {
/*增加同步任务状态*/ /*增加同步任务状态*/
private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success) { private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success) {
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";
@ -952,9 +956,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);
@ -987,7 +993,6 @@ public class IdcServiceImpl implements IdcService {
outputStream.flush(); outputStream.flush();
} catch (Exception e) { } catch (Exception e) {
@ -1036,6 +1041,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);
@ -1054,8 +1060,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()))) {
@ -1071,6 +1075,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()) {
@ -1095,7 +1100,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);
@ -1135,6 +1141,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 + "'");
@ -1147,6 +1154,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))");
@ -1162,6 +1170,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)) {

@ -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 0/50 * * * ?"; 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");

@ -4,9 +4,9 @@ server:
spring: spring:
datasource: datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy: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:p6spy:mysql://127.0.0.1:3306/udi_spms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: Glxp@6066 password: 123456
hikari: hikari:
connection-timeout: 60000 connection-timeout: 60000
maximum-pool-size: 20 maximum-pool-size: 20

Loading…
Cancel
Save