Commit 3e648009 authored by linruibiao's avatar linruibiao

Merge remote-tracking branch 'origin/develop' into develop

# Conflicts: # src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelInitServiceImpl.java
parents 8cc93b56 13963b70
...@@ -23,12 +23,16 @@ public class DataCenterConfig { ...@@ -23,12 +23,16 @@ public class DataCenterConfig {
@Value("${dc_client.interfaces.positionListUrl}") @Value("${dc_client.interfaces.positionListUrl}")
private String positionListUrl; private String positionListUrl;
@Value("${dc_client.interfaces.deptListUrl}") @Value("${dc_client.interfaces.deptListUrl}")
private String deptListUrl; private String deptListUrl;
@Value("${dc_client.interfaces.userTree}") @Value("${dc_client.interfaces.userTree}")
private String userTree; private String userTree;
@Value("${dc_client.interfaces.variableList}") @Value("${dc_client.interfaces.variableList}")
private String variableList; private String variableList;
@Value("${dc_client.interfaces.deviceList}") @Value("${dc_client.interfaces.deviceList}")
private String deviceList; private String deviceList;
...@@ -43,12 +47,16 @@ public class DataCenterConfig { ...@@ -43,12 +47,16 @@ public class DataCenterConfig {
@Value("${dc_client.interfaces.variableCodeHistoryList}") @Value("${dc_client.interfaces.variableCodeHistoryList}")
private String variableHistoryDataList; private String variableHistoryDataList;
@Value("${dc_client.interfaces.variableAllDataList}") @Value("${dc_client.interfaces.variableAllDataList}")
private String variableRealTimeDataList; private String variableRealTimeDataList;
@Value("${dc_client.interfaces.filedValue}") @Value("${dc_client.interfaces.filedValue}")
private String filedValue; private String filedValue;
@Value("${dc_client.interfaces.send}") @Value("${dc_client.interfaces.send}")
private String send; private String send;
@Value("${dc_client.interfaces.variableStatus}") @Value("${dc_client.interfaces.variableStatus}")
private String variableStatus; private String variableStatus;
...@@ -61,4 +69,7 @@ public class DataCenterConfig { ...@@ -61,4 +69,7 @@ public class DataCenterConfig {
@Value("${dc_client.interfaces.variableStatusRealTimeDataList}") @Value("${dc_client.interfaces.variableStatusRealTimeDataList}")
private String variableStatusRealTimeDataList; private String variableStatusRealTimeDataList;
@Value("${dc_client.interfaces.systemAdminByAppId}")
private String systemAdminByAppId;
} }
...@@ -34,8 +34,7 @@ public class InitController extends BaseRestController{ ...@@ -34,8 +34,7 @@ public class InitController extends BaseRestController{
@Autowired @Autowired
private InstrumentPanelInitService panelInitService; private InstrumentPanelInitService panelInitService;
@Autowired
private InstrumentPanelGroupService groupService;
@GetMapping("/app-id") @GetMapping("/app-id")
@ApiOperation("测试") @ApiOperation("测试")
...@@ -57,11 +56,8 @@ public class InitController extends BaseRestController{ ...@@ -57,11 +56,8 @@ public class InitController extends BaseRestController{
public R<Object> initPanel(HttpServletRequest request, @PathVariable String appId) { public R<Object> initPanel(HttpServletRequest request, @PathVariable String appId) {
return call(()->{ return call(()->{
CurrentUser currentUser = getCurrentUser(request); CurrentUser currentUser = getCurrentUser(request);
LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>(); panelInitService.initBatchPanel(currentUser.getToken(), request,appId);
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(InstrumentPanelGroup::getName, "全部分组");
List<InstrumentPanelGroup> list = groupService.list(where);
list.forEach(x-> panelInitService.initOnePanel(x.getAppId(),currentUser.getToken(), request));
}); });
} }
} }
...@@ -49,7 +49,7 @@ public class TenantController extends BaseRestController{ ...@@ -49,7 +49,7 @@ public class TenantController extends BaseRestController{
groupDTO.setParentId(null); groupDTO.setParentId(null);
groupDTO.setName("全部分组"); groupDTO.setName("全部分组");
groupService.saveGroup(groupDTO, appId); groupService.saveGroup(groupDTO, appId);
panelInitService.initOnePanel(appId,currentUser.getToken(),request); panelInitService.initOnePanel(appId,currentUser.getToken(),request,appId);
}); });
} }
......
...@@ -14,5 +14,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -14,5 +14,7 @@ import javax.servlet.http.HttpServletRequest;
**/ **/
public interface InstrumentPanelInitService extends IService<InstrumentPanel> { public interface InstrumentPanelInitService extends IService<InstrumentPanel> {
String initOnePanel(String appId,String token, HttpServletRequest request); String initOnePanel(String queryAppId,String token, HttpServletRequest request,String appId);
String initBatchPanel(String token, HttpServletRequest request,String appId);
} }
...@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.reflect.TypeToken;
import com.syc.slm.common.core.constant.SlmConstants; import com.syc.slm.common.core.constant.SlmConstants;
import com.syc.slm.common.core.util.R;
import com.syc.slm.common.core.util.RestTemplateUtils;
import com.syc.slm.slmbi.config.DataCenterConfig;
import com.syc.slm.slmbi.dao.InstrumentPanelMapper; import com.syc.slm.slmbi.dao.InstrumentPanelMapper;
import com.syc.slm.slmbi.dto.*; import com.syc.slm.slmbi.dto.*;
import com.syc.slm.slmbi.entity.*; import com.syc.slm.slmbi.entity.*;
import com.syc.slm.slmbi.enums.AccessType; import com.syc.slm.slmbi.enums.AccessType;
import com.syc.slm.slmbi.exception.SysException; import com.syc.slm.slmbi.exception.SysException;
import com.syc.slm.slmbi.service.*; import com.syc.slm.slmbi.service.*;
import com.syc.slm.slmbi.vo.UserTreeVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -21,6 +27,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -21,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* slm-bi * slm-bi
...@@ -34,7 +41,6 @@ import java.util.List; ...@@ -34,7 +41,6 @@ import java.util.List;
public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelMapper, InstrumentPanel> public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelMapper, InstrumentPanel>
implements InstrumentPanelInitService { implements InstrumentPanelInitService {
@Value("${initGroupName:默认模板}") @Value("${initGroupName:默认模板}")
private String initGroupName; private String initGroupName;
...@@ -43,48 +49,62 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM ...@@ -43,48 +49,62 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
@Value("${initPanelName2:售后服务综合看板}") @Value("${initPanelName2:售后服务综合看板}")
private String initPanelName2; private String initPanelName2;
@Value("${initConfigId1:82752b5ba8b2bd379c771a72c83f4b3a}") @Value("${initConfigId1:82752b5ba8b2bd379c771a72c83f4b3a}")
private String initConfig1 ; private String initConfig1 ;
@Value("${initConfigId2:29727c771a6fcb492d206a9e811e585d}") @Value("${initConfigId2:29727c771a6fcb492d206a9e811e585d}")
private String initConfig2; private String initConfig2;
@Autowired @Autowired
private InstrumentPanelConfigService configService; private InstrumentPanelConfigService configService;
@Autowired @Autowired
private InstrumentPanelGroupService panelGroupService; private InstrumentPanelGroupService panelGroupService;
@Autowired @Autowired
private InstrumentPanelService panelService; private InstrumentPanelService panelService;
@Autowired @Autowired
private InstrumentPanelTreeService treeService; private InstrumentPanelTreeService treeService;
@Autowired
private DataCenterConfig dataCenterConfig;
@Autowired
private InstrumentPanelGroupService groupService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String initOnePanel(String appId, String token,HttpServletRequest request) { public String initBatchPanel(String token, HttpServletRequest request, String appId) {
CurrentUser currentUser = new CurrentUser(); LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>();
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(InstrumentPanelGroup::getName, "全部分组");
List<InstrumentPanelGroup> list = groupService.list(where);
list.forEach(x-> this.initOnePanel(x.getAppId(),token,request,appId));
return "true";
}
request.setAttribute(token,SlmConstants.gson.toJson(currentUser)); @Override
@Transactional(rollbackFor = Exception.class)
public String initOnePanel(String queryAppId, String token,HttpServletRequest request,String appId) {
// 初始化request域
this.setRequestAttribute(token,queryAppId,appId,request);
LambdaQueryWrapper<InstrumentPanelGroup> groupWhere = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InstrumentPanelGroup> groupWhere = new LambdaQueryWrapper<>();
groupWhere.eq(InstrumentPanelGroup::getName, initGroupName); groupWhere.eq(InstrumentPanelGroup::getName, initGroupName);
groupWhere.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID); groupWhere.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
groupWhere.eq(BaseEntity::getAppId, appId); groupWhere.eq(BaseEntity::getAppId, queryAppId);
InstrumentPanelGroup one = panelGroupService.getOne(groupWhere); InstrumentPanelGroup one = panelGroupService.getOne(groupWhere);
if(ObjectUtils.isEmpty(one)){ if(ObjectUtils.isEmpty(one)){
LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InstrumentPanelGroup> where = new LambdaQueryWrapper<>();
where.eq(InstrumentPanelGroup::getName, "全部分组"); where.eq(InstrumentPanelGroup::getName, "全部分组");
where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID); where.eq(BaseEntity::getRecordStatus, SlmConstants.DATA_VALID);
where.eq(BaseEntity::getAppId, appId); where.eq(BaseEntity::getAppId, queryAppId);
InstrumentPanelGroup allGroup = panelGroupService.getOne(where); InstrumentPanelGroup allGroup = panelGroupService.getOne(where);
InstrumentPanelGroupDTO cGroup = new InstrumentPanelGroupDTO(); InstrumentPanelGroupDTO cGroup = new InstrumentPanelGroupDTO();
cGroup.setParentId(allGroup.getId()); cGroup.setParentId(allGroup.getId());
cGroup.setName("默认模板"); cGroup.setName("默认模板");
String groupId = panelGroupService.saveGroup(cGroup, appId); String groupId = panelGroupService.saveGroup(cGroup, queryAppId);
one= panelGroupService.getById(groupId); one= panelGroupService.getById(groupId);
} }
...@@ -145,4 +165,13 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM ...@@ -145,4 +165,13 @@ public class InstrumentPanelInitServiceImpl extends ServiceImpl<InstrumentPanelM
config.setPermission(permission); config.setPermission(permission);
return config; return config;
} }
private void setRequestAttribute(String token,String queryAppId,String appId,HttpServletRequest request){
Map<String,String> uriVariables = Maps.newHashMap();
uriVariables.put("queryAppId",queryAppId);
uriVariables.put("appId",appId);
String uri = dataCenterConfig.getDcClientHost() + dataCenterConfig.getSystemAdminByAppId();
R<CurrentUser> result = RestTemplateUtils.get(uri, new TypeToken<R<CurrentUser>>() {}.getType(), uriVariables);
request.setAttribute(token,SlmConstants.gson.toJson(result.detach()));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment