|
|
|
@ -11,12 +11,15 @@ import com.glxp.api.dao.system.SyncDataSetDao;
|
|
|
|
|
import com.glxp.api.dao.thrsys.ThrSystemDetailDao;
|
|
|
|
|
import com.glxp.api.entity.system.ScheduledEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
|
|
|
|
|
import com.glxp.api.req.basic.GetSickRequest;
|
|
|
|
|
import com.glxp.api.req.system.ScheduledRequest;
|
|
|
|
|
import com.glxp.api.res.thrsys.ThirdSysInterfaceExecuteVo;
|
|
|
|
|
import com.glxp.api.service.basic.BasicSkSickerService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.service.thrsys.*;
|
|
|
|
|
import com.glxp.api.util.RedisUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
@ -126,8 +129,13 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
downloadThrOrder(thrSystemDetailEntity);
|
|
|
|
|
break;
|
|
|
|
|
case ThirdSysConstant.PI_SUBMIT_URL:
|
|
|
|
|
//提交产品信息
|
|
|
|
|
postRelProduct(thrSystemDetailEntity);
|
|
|
|
|
break;
|
|
|
|
|
case ThirdSysConstant.SICKER_QUERY_URL:
|
|
|
|
|
//下载患者信息
|
|
|
|
|
downloadSicker(thrSystemDetailEntity);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
//其他接口暂不处理
|
|
|
|
|
break;
|
|
|
|
@ -152,7 +160,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
orderService.submitOrderToThrSys(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("提交单据到第三方系统异常", e);
|
|
|
|
|
log.error("提交单据到第三方系统异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -174,7 +182,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrBusTypeOriginService.downloadThrBusType(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载第三方单据类型异常", e);
|
|
|
|
|
log.error("下载第三方单据类型异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -196,7 +204,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrProductsService.downloadThrPi(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载第三方产品信息异常", e);
|
|
|
|
|
log.error("下载第三方产品信息异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -218,7 +226,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrCorpService.downloadThrCorp(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载第三方往来单位异常", e);
|
|
|
|
|
log.error("下载第三方往来单位异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -240,7 +248,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrInvWarehouseService.downloadThrInv(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载第三方仓库信息异常", e);
|
|
|
|
|
log.error("下载第三方仓库信息异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
//保证任务标识一定会被修改回去
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
@ -263,7 +271,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrOrderService.downloadThrOrder(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载第三方业务单据", e);
|
|
|
|
|
log.error("下载第三方业务单据", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -285,7 +293,7 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
try {
|
|
|
|
|
thrProductsService.uploadThrProduct(thrSystemDetailEntity);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("开始上传关联第三方产品信息", e);
|
|
|
|
|
log.error("开始上传关联第三方产品信息", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
@ -294,6 +302,31 @@ public class SyncThirdSysTask implements SchedulingConfigurer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
BasicSkSickerService skSickerService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载患者信息
|
|
|
|
|
*/
|
|
|
|
|
private void downloadSicker(ThrSystemDetailEntity thrSystemDetailEntity) {
|
|
|
|
|
//校验任务并更新redis数据执行标识
|
|
|
|
|
if (verifyTask(thrSystemDetailEntity)) {
|
|
|
|
|
getExecutor().submit(() -> {
|
|
|
|
|
log.info("开始下载患者信息");
|
|
|
|
|
try {
|
|
|
|
|
skSickerService.downloadSicker(new GetSickRequest(), null);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("开始下载患者信息", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
} finally {
|
|
|
|
|
updateTask(getTaskKey(thrSystemDetailEntity));
|
|
|
|
|
}
|
|
|
|
|
log.info("开始下载患者信息完成");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新任务状态为已完成
|
|
|
|
|
*
|
|
|
|
|