|
|
@@ -7,13 +7,19 @@ import com.usoftchina.bi.server.model.po.ChartsConfigToDash;
|
|
|
import com.usoftchina.bi.core.base.RepCode;
|
|
|
import com.usoftchina.bi.core.base.RepEntity;
|
|
|
import com.usoftchina.bi.core.base.TestPage;
|
|
|
+import com.usoftchina.bi.server.model.po.TokenData;
|
|
|
+import com.usoftchina.bi.server.model.po.User;
|
|
|
import com.usoftchina.bi.server.model.vo.configVo.*;
|
|
|
import com.usoftchina.bi.server.service.chart.*;
|
|
|
+import com.usoftchina.bi.server.service.user.UserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.locks.Lock;
|
|
|
+import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
|
/*
|
|
|
看板中调用生成图表
|
|
|
@@ -36,11 +42,25 @@ public class DashboardsToChartsUtilService {
|
|
|
ShowPopulationService showPopulationService;
|
|
|
@Autowired
|
|
|
ShowScatterService showScatterService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
|
|
|
private int chartId;
|
|
|
|
|
|
+ private Lock lock = new ReentrantLock();
|
|
|
+
|
|
|
public RepEntity getChartsInDash(ChartsToDashInfo chartsToDashInfo, String token) throws SQLException {
|
|
|
- chartId = chartsToDashInfo.getDashCreateId();
|
|
|
+ if (StringUtils.isEmpty(token)) {
|
|
|
+ User user = userService.getUserById(chartsToDashInfo.getDashboardCreatorId()).getData();
|
|
|
+ LoginInfo loginInfo = new LoginInfo(user.getUserName(), user.getPassWord());
|
|
|
+ token = userService.login(loginInfo).getData().getToken();
|
|
|
+ }
|
|
|
+ lock.lock();
|
|
|
+ try {
|
|
|
+ chartId = chartsToDashInfo.getChartId();
|
|
|
+ } finally {
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
//拿到图表配置
|
|
|
ChartsConfigToDash chartsConfigToDash = chartsConfigMapper.getChartConfigToDash(chartId);
|
|
|
if (chartsConfigToDash == null || "".equals(chartsConfigToDash)){
|