| | |
| | | // 执行日志同步任务的方法 |
| | | public void executeTask(DictHosp dictHosp) { |
| | | // 获取锁,确保同一时间只有一个任务执行 |
| | | log.info("{}执行结果同步", dictHosp.getCode()); |
| | | dataSourceConfig.addDataSource(dictHosp.getDbname()); |
| | | DataSourceContextHolder.setDataSourceKey(dictHosp.getDbname()); |
| | | String dsqkssj = configService.selectConfigByKey("dsqkssj"); |
| | | String dsqjssj = configService.selectConfigByKey("dsqjssj"); |
| | | boolean panduandangqianshijian = panduandangqianshijian(dsqkssj, dsqjssj); |
| | | |
| | | log.info("{}执行结果同步加锁前",JSONUtil.toJsonStr(dictHosp)); |
| | | ReentrantLock reentrantLock = getLock(dictHosp.getCode()); |
| | | boolean lock = reentrantLock.tryLock(); |
| | | try { |
| | | log.info("{}执行结果同步加锁后",JSONUtil.toJsonStr(dictHosp)); |
| | | log.info("{}执行结果同步", dictHosp.getCode()); |
| | | dataSourceConfig.addDataSource(dictHosp.getDbname()); |
| | | DataSourceContextHolder.setDataSourceKey(dictHosp.getDbname()); |
| | | String dsqkssj = configService.selectConfigByKey("dsqkssj"); |
| | | String dsqjssj = configService.selectConfigByKey("dsqjssj"); |
| | | boolean panduandangqianshijian = panduandangqianshijian(dsqkssj, dsqjssj); |
| | | if (!panduandangqianshijian) { |
| | | if (lock) { |
| | | log.info("任务开始执行时间 -> {}", dateTimeFormat.format(new Date())); |
| | |
| | | awsService.saveBatch(awsList); |
| | | log.info("保存外送项目成功"); |
| | | } |
| | | List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s); |
| | | List<LtkjHysqd> wssq = testMapper.getWsxmLtkjHysqdByLisVi(s); |
| | | if(null !=wssq && !wssq.isEmpty())hysqdList.addAll(wssq); |
| | | if(null !=wssq && !wssq.isEmpty()){ |
| | | for (LtkjHysqd hysqd : wssq) { |
| | | LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh()); |
| | | if (null != jybgid) { |
| | | ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh()); |
| | | ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(hysqd.getTmh()); |
| | | } |
| | | if (ltkjHysqdService.save(hysqd)) { |
| | | List<LtkjHybgd> wsbg = testMapper.getWsxmLtkjHybgdByLisVi(s); |
| | | ltkjHybgdService.saveBatch(wsbg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s); |
| | | if (null != hysqdList && !hysqdList.isEmpty()) { |
| | | for (LtkjHysqd hysqd : hysqdList) { |
| | | LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh()); |
| | |
| | | } |
| | | if (ltkjHysqdService.save(hysqd)) { |
| | | List<LtkjHybgd> hybgdList = testMapper.getCcXZxYyLtkjHybgdByLisVi(hysqd.getTmh()); |
| | | List<LtkjHybgd> wsbg = testMapper.getWsxmLtkjHybgdByLisVi(s); |
| | | if(null !=wsbg && !wsbg.isEmpty())hybgdList.addAll(wsbg); |
| | | // List<LtkjHybgd> wsbg = testMapper.getWsxmLtkjHybgdByLisVi(s); |
| | | // if(null !=wsbg && !wsbg.isEmpty())hybgdList.addAll(wsbg); |
| | | ltkjHybgdService.saveBatch(hybgdList); |
| | | } |
| | | } |