进度推送bim功能修改
This commit is contained in:
parent
ae472e644f
commit
e1ac73f9a8
@ -135,7 +135,9 @@ public class ProgressTask implements Serializable {
|
|||||||
@TableField(value = "create_user_id")
|
@TableField(value = "create_user_id")
|
||||||
@ApiModelProperty(value = "创建用户id")
|
@ApiModelProperty(value = "创建用户id")
|
||||||
private Long createUserId;
|
private Long createUserId;
|
||||||
|
/**
|
||||||
|
* 两套状态
|
||||||
|
*/
|
||||||
@TableField(value = "status")
|
@TableField(value = "status")
|
||||||
@ApiModelProperty(value = "状态,1:提前 2正常 3延迟")
|
@ApiModelProperty(value = "状态,1:提前 2正常 3延迟")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|||||||
@ -72,5 +72,7 @@ public interface ProgressTaskService extends IService<ProgressTask> {
|
|||||||
* @return 实际进度列表
|
* @return 实际进度列表
|
||||||
*/
|
*/
|
||||||
List<ActualProgressVO> actualProgress(String projectSn);
|
List<ActualProgressVO> actualProgress(String projectSn);
|
||||||
|
|
||||||
|
void autoTaskUpdateForBim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,15 @@ import java.util.HashMap;
|
|||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AsyBim {
|
public class AsyBim {
|
||||||
|
//测试
|
||||||
|
//String ipPort = "http://47.105.67.193:8086";
|
||||||
|
|
||||||
|
//生产
|
||||||
|
String ipPort = "http://124.71.79.109:8086";
|
||||||
|
|
||||||
@Async("bimExecutor")
|
@Async("bimExecutor")
|
||||||
public void asynAddProgressTask(BIMProgressTaskRqBody bimProgressTaskRqBody) {
|
public void asynAddProgressTask(BIMProgressTaskRqBody bimProgressTaskRqBody) {
|
||||||
String url = "http://47.105.67.193:8086/Other/SaveProgress";
|
String url = ipPort + "/Other/SaveProgress";
|
||||||
String body = JSON.toJSONString(bimProgressTaskRqBody);
|
String body = JSON.toJSONString(bimProgressTaskRqBody);
|
||||||
log.info("http调用bim保存进度:url:{},body:{}", url, body);
|
log.info("http调用bim保存进度:url:{},body:{}", url, body);
|
||||||
String rs = HttpUtil.post(url, body);
|
String rs = HttpUtil.post(url, body);
|
||||||
@ -56,7 +61,7 @@ public class AsyBim {
|
|||||||
|
|
||||||
@Async("bimExecutor")
|
@Async("bimExecutor")
|
||||||
public void asynDeleteProgressTask(String floor, String major) {
|
public void asynDeleteProgressTask(String floor, String major) {
|
||||||
String url = "http://47.105.67.193:8086/Other/DeleteProgress?floor=" + floor + "&major=" + major;
|
String url = ipPort + "/Other/DeleteProgress?floor=" + floor + "&major=" + major;
|
||||||
log.info("http调用bim删除进度:url:{}", url);
|
log.info("http调用bim删除进度:url:{}", url);
|
||||||
String rs = HttpUtil.post(url, new HashMap<>());
|
String rs = HttpUtil.post(url, new HashMap<>());
|
||||||
log.info("http调用bim删除进度结果:{}", rs);
|
log.info("http调用bim删除进度结果:{}", rs);
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import net.sf.mpxj.ProjectFile;
|
|||||||
import net.sf.mpxj.Relation;
|
import net.sf.mpxj.Relation;
|
||||||
import net.sf.mpxj.Task;
|
import net.sf.mpxj.Task;
|
||||||
import net.sf.mpxj.mpp.MPPReader;
|
import net.sf.mpxj.mpp.MPPReader;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -72,6 +73,8 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
*/
|
*/
|
||||||
public Pattern floorPattern = Pattern.compile("[-]?\\d+F");
|
public Pattern floorPattern = Pattern.compile("[-]?\\d+F");
|
||||||
|
|
||||||
|
private String basement = "地下室底板";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -84,7 +87,7 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
|
|
||||||
if (activeProfile.equals("zjsj")) {
|
if (activeProfile.equals("zjsj")) {
|
||||||
//调用BIM同步删除数据
|
//调用BIM同步删除数据
|
||||||
List<BIMProgressTaskRqBody> deleteList = getProgressTaskRqBodyData(progressTasks);
|
List<BIMProgressTaskRqBody> deleteList = getBimTasksByProgressTasks(progressTasks);
|
||||||
if (CollUtil.isNotEmpty(deleteList)) {
|
if (CollUtil.isNotEmpty(deleteList)) {
|
||||||
for (BIMProgressTaskRqBody body : deleteList) {
|
for (BIMProgressTaskRqBody body : deleteList) {
|
||||||
asyBim.asynDeleteProgressTask(body.getFloor(), body.getMajor());
|
asyBim.asynDeleteProgressTask(body.getFloor(), body.getMajor());
|
||||||
@ -98,7 +101,7 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
progressTaskMapper.insertBatch(progressTaskList);
|
progressTaskMapper.insertBatch(progressTaskList);
|
||||||
if (activeProfile.equals("zjsj")) {
|
if (activeProfile.equals("zjsj")) {
|
||||||
//调用BIM同步添加数据
|
//调用BIM同步添加数据
|
||||||
List<BIMProgressTaskRqBody> bimProgressTaskRqBodies = getProgressTaskRqBodyData(progressTasks);
|
List<BIMProgressTaskRqBody> bimProgressTaskRqBodies = getBimTasksByProgressTasks(progressTasks);
|
||||||
if (CollUtil.isNotEmpty(bimProgressTaskRqBodies)) {
|
if (CollUtil.isNotEmpty(bimProgressTaskRqBodies)) {
|
||||||
for (BIMProgressTaskRqBody bimProgressTaskRqBody : bimProgressTaskRqBodies) {
|
for (BIMProgressTaskRqBody bimProgressTaskRqBody : bimProgressTaskRqBodies) {
|
||||||
asyBim.asynAddProgressTask(bimProgressTaskRqBody);
|
asyBim.asynAddProgressTask(bimProgressTaskRqBody);
|
||||||
@ -114,7 +117,7 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
* @param progressTasks
|
* @param progressTasks
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<BIMProgressTaskRqBody> getProgressTaskRqBodyData(List<ProgressTask> progressTasks) {
|
private List<BIMProgressTaskRqBody> getBimTasksByProgressTasks(List<ProgressTask> progressTasks) {
|
||||||
ArrayList<BIMProgressTaskRqBody> bimProgressTaskRqBodies = new ArrayList<>();
|
ArrayList<BIMProgressTaskRqBody> bimProgressTaskRqBodies = new ArrayList<>();
|
||||||
Map<Long, ProgressTask> topIdMap = progressTasks.stream().filter(progressTask -> progressTask.getParentId().equals(0L))
|
Map<Long, ProgressTask> topIdMap = progressTasks.stream().filter(progressTask -> progressTask.getParentId().equals(0L))
|
||||||
.collect(Collectors.toMap(ProgressTask::getId, progressTask -> progressTask));
|
.collect(Collectors.toMap(ProgressTask::getId, progressTask -> progressTask));
|
||||||
@ -123,17 +126,17 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
ProgressTask pt = topIdMap.get(progressTask.getParentId());
|
ProgressTask pt = topIdMap.get(progressTask.getParentId());
|
||||||
Matcher matcher = floorPattern.matcher(progressTask.getTaskName());
|
Matcher matcher = floorPattern.matcher(progressTask.getTaskName());
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
BIMProgressTaskRqBody body = new BIMProgressTaskRqBody();
|
BIMProgressTaskRqBody body = buildBimTask(progressTask, pt.getTaskName(), matcher.group());
|
||||||
body.setFloor(matcher.group());
|
|
||||||
body.setMajor(pt.getTaskName());
|
|
||||||
body.setPlanStartTime(getDateFormatForBimAddProgressTask(progressTask.getStartDate()));
|
|
||||||
body.setPlanFinishTime(getDateFormatForBimAddProgressTask(progressTask.getFinishDate()));
|
|
||||||
body.setActualStartTime(getDateFormatForBimAddProgressTask(progressTask.getActualStartDate()));
|
|
||||||
body.setActualFinishTime(getDateFormatForBimAddProgressTask(progressTask.getActualFinishDate()));
|
|
||||||
body.setStatus(progressTask.getStatus());
|
|
||||||
String sign = getBimProgressTaskRqBodyMd5Sign(body);
|
|
||||||
body.setSign(sign);
|
|
||||||
bimProgressTaskRqBodies.add(body);
|
bimProgressTaskRqBodies.add(body);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
只有 地下室地板 是不带楼层的,那么我传给你:
|
||||||
|
major:结构施工,floor:地下室地板
|
||||||
|
*/
|
||||||
|
if (progressTask.getTaskName().contains(basement)) {
|
||||||
|
BIMProgressTaskRqBody body = buildBimTask(progressTask, "结构施工", basement);
|
||||||
|
bimProgressTaskRqBodies.add(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,22 +375,86 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
}
|
}
|
||||||
String newFloorName = getFloorName(progressTask);
|
String newFloorName = getFloorName(progressTask);
|
||||||
if (newFloorName != null) {
|
if (newFloorName != null) {
|
||||||
BIMProgressTaskRqBody body = new BIMProgressTaskRqBody();
|
BIMProgressTaskRqBody body = buildBimTask(progressTask, top.getTaskName(), newFloorName);
|
||||||
body.setFloor(newFloorName);
|
|
||||||
body.setMajor(top.getTaskName());
|
|
||||||
body.setPlanStartTime(getDateFormatForBimAddProgressTask(progressTask.getStartDate()));
|
|
||||||
body.setPlanFinishTime(getDateFormatForBimAddProgressTask(progressTask.getFinishDate()));
|
|
||||||
body.setActualStartTime(getDateFormatForBimAddProgressTask(progressTask.getActualStartDate()));
|
|
||||||
body.setActualFinishTime(getDateFormatForBimAddProgressTask(progressTask.getActualFinishDate()));
|
|
||||||
body.setStatus(progressTask.getStatus());
|
|
||||||
String sign = getBimProgressTaskRqBodyMd5Sign(body);
|
|
||||||
body.setSign(sign);
|
|
||||||
asyBim.asynAddProgressTask(body);
|
asyBim.asynAddProgressTask(body);
|
||||||
|
} else {
|
||||||
|
if (progressTask.getTaskName().contains(basement)) {
|
||||||
|
BIMProgressTaskRqBody body = buildBimTask(progressTask, "结构施工", basement);
|
||||||
|
asyBim.asynAddProgressTask(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建bim的task对象
|
||||||
|
*
|
||||||
|
* @param progressTask
|
||||||
|
* @param major
|
||||||
|
* @param newFloorName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private BIMProgressTaskRqBody buildBimTask(ProgressTask progressTask, String major, String newFloorName) {
|
||||||
|
BIMProgressTaskRqBody body = new BIMProgressTaskRqBody();
|
||||||
|
body.setFloor(convertFloorName(newFloorName));
|
||||||
|
body.setMajor(major);
|
||||||
|
body.setPlanStartTime(getDateFormatForBimAddProgressTask(progressTask.getStartDate()));
|
||||||
|
body.setPlanFinishTime(getDateFormatForBimAddProgressTask(progressTask.getFinishDate()));
|
||||||
|
body.setActualStartTime(getDateFormatForBimAddProgressTask(progressTask.getActualStartDate()));
|
||||||
|
body.setActualFinishTime(getDateFormatForBimAddProgressTask(progressTask.getActualFinishDate()));
|
||||||
|
body.setStatus(convertToBimProgressTaskStatus(progressTask));
|
||||||
|
String sign = getBimProgressTaskRqBodyMd5Sign(body);
|
||||||
|
body.setSign(sign);
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String convertFloorName(String floorName) {
|
||||||
|
/*
|
||||||
|
-1F 对应 地下一层,
|
||||||
|
-2F 对应 地下二层,
|
||||||
|
-3F 对应 地下三层
|
||||||
|
*/
|
||||||
|
if (StringUtils.isNotBlank(floorName)) {
|
||||||
|
switch (floorName) {
|
||||||
|
case "-1F":
|
||||||
|
return "地下一层";
|
||||||
|
case "-2F":
|
||||||
|
return "地下二层";
|
||||||
|
case "-3F":
|
||||||
|
return "地下三层";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return floorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer convertToBimProgressTaskStatus(ProgressTask progressTask) {
|
||||||
|
//实际开始,实际结束,当前时间
|
||||||
|
//0-未开始,1-已开始,2-已结束,3-已滞后
|
||||||
|
//0:
|
||||||
|
//1:实际开始!=null,实际开始<=计划开始,当前时间<=计划结束;
|
||||||
|
//2:实际开始!=null,实际结束!=null,实际结束<=计划时间
|
||||||
|
//3:已滞后
|
||||||
|
Long start = progressTask.getStartDate().getTime();
|
||||||
|
Long finish = progressTask.getFinishDate().getTime();
|
||||||
|
Long actStart = progressTask.getActualStartDate() != null ? progressTask.getActualStartDate().getTime() : null;
|
||||||
|
Long actFinish = progressTask.getActualFinishDate() != null ? progressTask.getActualFinishDate().getTime() : null;
|
||||||
|
long curTime = System.currentTimeMillis();
|
||||||
|
if (Objects.equals(progressTask.getStatus(), 0)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//已开始
|
||||||
|
if (actStart != null && actStart <= start && curTime <= finish) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//已结束
|
||||||
|
if (actStart != null && actFinish != null && actFinish <= finish) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
//已滞后
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addProgressTask(ProgressTask progressTask) {
|
public void addProgressTask(ProgressTask progressTask) {
|
||||||
checkSaveParam(progressTask);
|
checkSaveParam(progressTask);
|
||||||
@ -396,11 +463,18 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getFloorName(ProgressTask progressTask) {
|
private String getFloorName(ProgressTask progressTask) {
|
||||||
|
String name = null;
|
||||||
Matcher matcher = floorPattern.matcher(progressTask.getTaskName());
|
Matcher matcher = floorPattern.matcher(progressTask.getTaskName());
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
return matcher.group();
|
name = convertFloorName(matcher.group());
|
||||||
|
} else {
|
||||||
|
if (StringUtils.isNotBlank(progressTask.getTaskName())) {
|
||||||
|
if (progressTask.getTaskName().contains(basement)) {
|
||||||
|
name = basement;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -558,5 +632,23 @@ public class ProgressTaskServiceImpl extends ServiceImpl<ProgressTaskMapper, Pro
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void autoTaskUpdateForBim() {
|
||||||
|
if (activeProfile.equals("zjsj")) {
|
||||||
|
List<ProgressTask> progressTasks = progressTaskMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
|
List<BIMProgressTaskRqBody> bimTasksByProgressTasks = getBimTasksByProgressTasks(progressTasks);
|
||||||
|
if (CollUtil.isNotEmpty(bimTasksByProgressTasks)) {
|
||||||
|
for (BIMProgressTaskRqBody body : bimTasksByProgressTasks) {
|
||||||
|
//0未开始不同步,其他的全部同步
|
||||||
|
//0未开始 ,1进行中,2已完成,3已逾期
|
||||||
|
Integer status = body.getStatus();
|
||||||
|
if (!Objects.equals(status, 0)) {
|
||||||
|
asyBim.asynAddProgressTask(body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,6 +117,15 @@ public class ProgressAlarmTask {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中建四局定时推送进度状态给bim
|
||||||
|
*/
|
||||||
|
@SchedulerLock(name = "autoTaskUpdateForBim", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
|
||||||
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
|
public void autoTaskUpdateForBim() {
|
||||||
|
progressTaskService.autoTaskUpdateForBim();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每天7点对没有处理的逾期任务进行通知
|
* 每天7点对没有处理的逾期任务进行通知
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user