| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.var; |
| | | import org.aspectj.weaver.AjAttribute; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ltkj.framework.datasource.DynamicDataSourceContextHolder.log; |
| | |
| | | private HisApiGetMethodService service; |
| | | @Autowired |
| | | private HisApiConfigService hisApiConfigService; |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | @GetMapping ("/getOperationPermissionsByTjNum") |
| | | @ApiOperation (value = "(初审页面 和 医生页面)根据体检号获取是否可操作权限接口 true可操作 反之不可") |
| | |
| | | // @Transactional |
| | | public AjaxResult dataSynchronization(@RequestParam String tjNumber) { |
| | | |
| | | RLock lock = redissonClient.getLock("lock:check:dataSynchronization:" + tjNumber); |
| | | try { |
| | | boolean tryLock = lock.tryLock(3L, TimeUnit.SECONDS); |
| | | if (tryLock){ |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | |
| | |
| | | } |
| | | return AjaxResult.error("未查到该人员体检记录"); |
| | | } |
| | | return AjaxResult.error("该人员数据正在同步中,请稍等"); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("该人员数据正在同步中,请稍等"); |
| | | }finally { |
| | | lock.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 同步sql server数据到本地数据库数据接口 |
| | |
| | | @RepeatSubmit |
| | | // @Transactional |
| | | public AjaxResult dataSynchronizationApi(@RequestParam String tjNumber) { |
| | | RLock lock = redissonClient.getLock("lock:check:dataSynchronization:" + tjNumber); |
| | | try { |
| | | boolean tryLock = lock.tryLock(3L, TimeUnit.SECONDS); |
| | | if (tryLock){ |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | |
| | |
| | | } |
| | | return AjaxResult.error("未查到该人员体检记录"); |
| | | } |
| | | return AjaxResult.error("该人员数据正在同步中,请稍等"); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("该人员数据正在同步中,请稍等"); |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | } |
| | | |
| | | private void saveHysqd(LtkjHysqd hysqd) { |
| | | if (ltkjHysqdService.save(hysqd)) { |