沙湖的进度推送bim修改
This commit is contained in:
parent
8fa50a4b08
commit
4aeff5cc9e
@ -1,11 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.project.controller;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.util.MD5Util;
|
||||
import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.async.AsyncProject;
|
||||
import com.zhgd.xmgl.entity.vo.ZwProjectDataVo;
|
||||
@ -407,11 +409,19 @@ public class ProjectController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "调外部接口,获取FMS监控⼤屏接⼊url", notes = "调外部接口,获取FMS监控⼤屏接⼊url", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "account", value = "账号", paramType = "query", required = true, dataType = "String")
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
||||
@GetMapping(value = "/getFmsMonitoringLargeScreenAccessUrl")
|
||||
public Result<Map<String, Object>> getFmsMonitoringLargeScreenAccessUrl(@RequestParam Map<String, Object> map) {
|
||||
HashMap<String, Object> rsMap = projectService.getFmsMonitoringLargeScreenAccessUrl(map);
|
||||
return Result.success(rsMap);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "调外部接口,获取桩桩接⼊url", notes = "调外部接口,获取桩桩接⼊url", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
||||
@GetMapping(value = "/getZhuangZhuangAccessUrl")
|
||||
public Result<Map<String, Object>> getZhuangZhuangAccessUrl(@RequestParam Map<String, Object> map) {
|
||||
HashMap<String, Object> rsMap = projectService.getZhuangZhuangAccessUrl(map);
|
||||
return Result.success(rsMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -257,4 +257,10 @@ public class Project implements Serializable {
|
||||
@ApiModelProperty(value = "fms监控大屏key")
|
||||
private String fmsMonitoringScreenKey;
|
||||
|
||||
@ApiModelProperty(value = "品茗用户名")
|
||||
private String pinMingUsername;
|
||||
|
||||
@ApiModelProperty(value = "品茗密码")
|
||||
private String pinMingPassword;
|
||||
|
||||
}
|
||||
|
||||
@ -70,4 +70,6 @@ public interface IProjectService extends IService<Project> {
|
||||
List<GroupByProjectProgressVo> groupByProjectProgress();
|
||||
|
||||
HashMap<String, Object> getFmsMonitoringLargeScreenAccessUrl(Map<String, Object> map);
|
||||
|
||||
HashMap<String, Object> getZhuangZhuangAccessUrl(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
||||
* @return
|
||||
*/
|
||||
private boolean isBIMAsyncEnable() {
|
||||
return profileJudgeUtil.isZjsj();
|
||||
return profileJudgeUtil.isZjsj() || profileJudgeUtil.isShahu();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -452,6 +452,8 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
||||
body.setStatus(convertToBimProgressTaskStatus(progressTask));
|
||||
if (profileJudgeUtil.isZjsj()) {
|
||||
body.setProjectId(1);
|
||||
} else if (profileJudgeUtil.isShahu()) {
|
||||
body.setProjectId(2);
|
||||
}
|
||||
String sign = getBimProgressTaskRqBodyMd5Sign(body);
|
||||
body.setSign(sign);
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.project.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -73,6 +75,8 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -85,6 +89,7 @@ import java.util.stream.Collectors;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
|
||||
private static Pattern ticketCompile = Pattern.compile("(?<='ticket':')\\S+(?=')");
|
||||
@Autowired
|
||||
private BimfaceConfigMapper bimfaceConfigMapper;
|
||||
@Autowired
|
||||
@ -614,19 +619,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
签名注意事项:
|
||||
请求参数需要分别进行url编码(UTF-8)
|
||||
*/
|
||||
String account = MapUtils.getString(map, "account");
|
||||
if (StringUtils.isBlank(account)) {
|
||||
throw new OpenAlertException("account不能为空");
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
if (StringUtils.isBlank(projectSn)) {
|
||||
throw new OpenAlertException("projectSn不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(fmsMonitoringScreenRequestHost)) {
|
||||
throw new OpenAlertException("fmsMonitoringScreenHost未配置");
|
||||
}
|
||||
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getFmsMonitoringScreenUsername, account));
|
||||
if (project == null) {
|
||||
throw new OpenAlertException("查询不到此用户,请检查配置");
|
||||
}
|
||||
|
||||
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, projectSn));
|
||||
String key = project.getFmsMonitoringScreenKey();
|
||||
String fmsMonitoringScreenUsername = project.getFmsMonitoringScreenUsername();
|
||||
if (StringUtils.isBlank(key) || StringUtils.isBlank(fmsMonitoringScreenUsername)) {
|
||||
throw new OpenAlertException("请检查配置");
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
String gmtTime = com.zhgd.xmgl.util.DateUtil.getGMTTime(now);
|
||||
@ -639,7 +644,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
|
||||
//获取access_token
|
||||
//hmac username="{用户名}", algorithm="hmac-sha256", headers="date request-line", signature="{签名}"
|
||||
String authorization = "hmac username=\"" + project.getFmsMonitoringScreenUsername() + "\", algorithm=\"" + algorithm + "\", headers=\"date request-line\", signature=\"" + signature + "\"";
|
||||
String authorization = "hmac username=\"" + fmsMonitoringScreenUsername + "\", algorithm=\"" + algorithm + "\", headers=\"date request-line\", signature=\"" + signature + "\"";
|
||||
String accessUrl = fmsMonitoringScreenRequestHost + "/api-gateway/v2/system/getAccessToken";
|
||||
log.info("accessUrl:{},authorization:{},date:{}", accessUrl, authorization, gmtTime);
|
||||
String rs = HttpRequest.get(accessUrl)
|
||||
@ -660,4 +665,40 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
rsMap.put("url", url);
|
||||
return rsMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getZhuangZhuangAccessUrl(Map<String, Object> map) {
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, projectSn));
|
||||
if (project == null) {
|
||||
return null;
|
||||
}
|
||||
String pinMingPassword = project.getPinMingPassword();
|
||||
String pinMingUsername = project.getPinMingUsername();
|
||||
if (StringUtils.isBlank(pinMingPassword) || StringUtils.isBlank(pinMingUsername)) {
|
||||
throw new OpenAlertException("请检查配置");
|
||||
}
|
||||
String rqUrl = "http://sso.pinming.cn/sso/login/jsonp.do?userName=" + pinMingUsername + "&password=" + SecureUtil.md5(pinMingPassword);
|
||||
log.info("getZhuangZhuangAccessUrl的url:{}", rqUrl);
|
||||
String rs = HttpUtil.get(rqUrl);
|
||||
log.info("rs:{}", rs);
|
||||
|
||||
//'ticket':'ca86c5f4-59d4-45f4-8a39-5e72b490c2a2-t'
|
||||
//正则获取ticket
|
||||
String ticket = null;
|
||||
Matcher matcher = ticketCompile.matcher(rs);
|
||||
try {
|
||||
if (matcher.find()) {
|
||||
ticket = matcher.group();
|
||||
} else {
|
||||
throw new OpenAlertException(MessageUtil.get("thirdErr"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new OpenAlertException(MessageUtil.get("thirdErr"));
|
||||
}
|
||||
String rtUrl = "https://zhuang.pinming.cn/console/panel/?ticket=" + ticket;
|
||||
HashMap<String, Object> rsMap = new HashMap<>();
|
||||
rsMap.put("url", rtUrl);
|
||||
return rsMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class ProgressAlarmTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* 中建四局定时推送进度状态给bim
|
||||
* 中建四局和中建四局沙湖定时推送进度状态给bim
|
||||
*/
|
||||
@SchedulerLock(name = "autoTaskUpdateForBim", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
|
||||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
|
||||
@ -69,6 +69,15 @@ public class ProfileJudgeUtil {
|
||||
return Stream.of("zjsj-gsx", "zjsj").anyMatch(s -> s.equals(activeProfile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否中建四局沙湖环境
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isShahu() {
|
||||
return Stream.of("shahu-gsx", "shahu").anyMatch(s -> s.equals(activeProfile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否云联万物生产环境
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user