Compare commits

..

No commits in common. "b1e94239d757c91066e6641d1835196691607838" and "bf10ad0b6fde63a972226cff275c60f2b50328a7" have entirely different histories.

10 changed files with 29 additions and 142 deletions

View File

@ -23,7 +23,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.stream.Collectors;
/**
* web-adapter
@ -63,7 +62,7 @@ public class TaskLogController {
@ApiOperation("所有数据")
@GetMapping("/listAll/{workId}")
public MultiResponse<TaskLogCO> listAll(@PathVariable("workId") String workId) {
return MultiResponse.of(taskLogService.listAll(workId).stream().filter(taskLogCO -> taskLogCO.getStatus() != -1).collect(Collectors.toList()));
return MultiResponse.of(taskLogService.listAll(workId));
}
@ApiOperation("详情")

View File

@ -18,14 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
public class ConfinedSpaceRemoveExe {
private final ConfinedSpaceGateway confinedSpaceGateway;
/**
*
*
*
* @param id ID
* @return true
* @throws BizException
*/
@Transactional(rollbackFor = Exception.class)
public boolean execute(Long id) {
boolean res = confinedSpaceGateway.deletedConfinedSpaceById(id);

View File

@ -1,8 +1,6 @@
package com.zcloud.eightwork.command;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.cola.exception.BizException;
import com.alibaba.fastjson.JSONArray;
@ -13,6 +11,7 @@ import com.zcloud.eightwork.domain.gateway.TaskLogGateway;
import com.zcloud.eightwork.domain.gateway.EightworkSupplementaryInfoGateway;
import com.zcloud.eightwork.domain.model.MeasuresLogsE;
import com.zcloud.eightwork.domain.model.EightworkSupplementaryInfoE;
import com.zcloud.eightwork.domain.model.EightworkInfoE;
import com.zcloud.eightwork.domain.model.TaskLogE;
import com.zcloud.eightwork.domain.model.enums.BranchFlag;
import com.zcloud.eightwork.domain.model.enums.StepType;
@ -38,9 +37,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -147,11 +144,11 @@ public class TaskLogUpdateExe {
handleSignStepsIfNeeded(currentLog, cmd, actionLogs, logs);
}
// 批量更新 task_log
// 批量更新
taskLogRepository.updateBatchById(actionLogs);
// 批量更新 eightworkInfo.info只更新本次变化的步骤
updateEightworkInfo(cmd.getWorkId(), actionLogs);
// 更新 eightworkInfo.info 字段
updateEightworkInfo(cmd.getWorkId(), logs);
log.info("步骤流转完成: workId={}, currentStep={}", cmd.getWorkId(), currentLog.getStepName());
}
@ -182,17 +179,10 @@ public class TaskLogUpdateExe {
currentLog.setSignPath(cmd.getSignPath());
}
// 定位步骤,保存经纬度
if (PC_FLAG.equals(currentLog.getLocateStepFlag())) {
currentLog.setLatitude(cmd.getLatitude());
currentLog.setLongitude(cmd.getLongitude());
log.info("定位步骤已保存经纬度: latitude={}, longitude={}", cmd.getLatitude(), cmd.getLongitude());
}
// 发送待办完成事件
sendTodoCompleteEvent(currentLog.getId());
addActionLog(actionLogs, currentLog);
actionLogs.add(TaskLogConvertUtil.toDO(currentLog));
}
/**
@ -278,7 +268,7 @@ public class TaskLogUpdateExe {
// 修改当前步骤状态为已完成
currentLog.setStatus(TaskLogStatus.APPROVED.getCode());
addActionLog(actionLogs, currentLog);
actionLogs.add(TaskLogConvertUtil.toDO(currentLog));
// 延时转交步骤不自动流转下一步
return false;
@ -336,7 +326,7 @@ public class TaskLogUpdateExe {
currentLog.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
// 添加到待更新列表
addActionLog(actionLogs, currentLog);
actionLogs.add(TaskLogConvertUtil.toDO(currentLog));
log.info("气体检测记录已保存,当前填写次数: {}", currentTimes + 1);
@ -517,7 +507,7 @@ public class TaskLogUpdateExe {
for (TaskLogE next : nextSteps) {
next.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
addActionLog(actionLogs, next);
actionLogs.add(TaskLogConvertUtil.toDO(next));
// 发送待办通知
sendTodoAddEvent(workId, next, currentLog.getWorkType());
@ -569,7 +559,7 @@ public class TaskLogUpdateExe {
}
branchStep.setStatus(TaskLogStatus.IN_PROGRESS.getCode());
addActionLog(actionLogs, branchStep);
actionLogs.add(TaskLogConvertUtil.toDO(branchStep));
sendTodoAddEvent(getWorkId(currentLog.getWorkId()), branchStep, currentLog.getWorkType());
log.info("已激活分支步骤: stepName={}, mergeTo={}", branchStep.getStepName(), branchStep.getBranchMergeStep());
}
@ -601,7 +591,7 @@ public class TaskLogUpdateExe {
if (CAN_SKIP_FLAG.equals(currentLog.getCanSkip()) && signInfo.getActUser() == null) {
// 设置为跳过状态
signStepLog.setStatus(TaskLogStatus.SKIPPED.getCode());
addActionLog(actionLogs, signStepLog);
actionLogs.add(TaskLogConvertUtil.toDO(signStepLog));
log.info("步骤设置为跳过: {}", signStepLog.getStepName());
} else {
// 设置签字人
@ -612,7 +602,7 @@ public class TaskLogUpdateExe {
signInfo.getActUser(),
signInfo.getActUserName()
);
addActionLog(actionLogs, signStepLog);
actionLogs.add(TaskLogConvertUtil.toDO(signStepLog));
log.info("已设置签字人: step={}, user={}", signStepLog.getStepName(), signInfo.getActUserName());
}
}
@ -663,71 +653,10 @@ public class TaskLogUpdateExe {
}
/**
*
*
*
*
* @param actionLogs
* @param taskLogE
* eightworkInfo.info
* step_${step_id} key info
*/
private void addActionLog(List<TaskLogDO> actionLogs, TaskLogE taskLogE) {
TaskLogDO newDO = TaskLogConvertUtil.toDO(taskLogE);
// 查找是否已存在该步骤的记录
for (int i = 0; i < actionLogs.size(); i++) {
TaskLogDO existing = actionLogs.get(i);
if (existing.getId().equals(newDO.getId())) {
// 存在则合并:保留所有非空字段
mergeTaskLogDO(existing, newDO);
log.debug("合并步骤修改: stepId={}, stepName={}", taskLogE.getStepId(), taskLogE.getStepName());
return;
}
}
// 不存在则添加
actionLogs.add(newDO);
}
/**
* TaskLogDO
* source target
*
* @param target DO
* @param source DO
*/
private void mergeTaskLogDO(TaskLogDO target, TaskLogDO source) {
if (source.getStatus() != null) {
target.setStatus(source.getStatus());
}
if (source.getActUser() != null) {
target.setActUser(source.getActUser());
}
if (source.getActUserName() != null) {
target.setActUserName(source.getActUserName());
}
if (source.getActUserDepartment() != null) {
target.setActUserDepartment(source.getActUserDepartment());
}
if (source.getActUserDepartmentName() != null) {
target.setActUserDepartmentName(source.getActUserDepartmentName());
}
if (source.getSignPath() != null) {
target.setSignPath(source.getSignPath());
}
if (source.getCurrentFillTimes() != null) {
target.setCurrentFillTimes(source.getCurrentFillTimes());
}
}
/**
* eightworkInfo.info
*
*/
private void updateEightworkInfo(String workId, List<TaskLogDO> actionLogs) {
if (actionLogs == null || actionLogs.isEmpty()) {
return;
}
private void updateEightworkInfo(String workId, List<TaskLogE> logs) {
EightworkInfoDO infoDO = eightworkInfoRepository.getOne(
new LambdaQueryWrapper<EightworkInfoDO>()
.eq(EightworkInfoDO::getWorkId, workId)
@ -751,33 +680,23 @@ public class TaskLogUpdateExe {
infoJson = new JSONObject();
}
// 循环更新本次变化的步骤
for (TaskLogDO logDO : actionLogs) {
// 遍历所有步骤,更新 info
for (TaskLogE log : logs) {
JSONObject stepInfo = new JSONObject();
stepInfo.put("stepName", logDO.getStepName());
stepInfo.put("actUserDepartment", logDO.getActUserDepartment());
stepInfo.put("actUserDepartmentName", logDO.getActUserDepartmentName());
stepInfo.put("actUser", logDO.getActUser());
stepInfo.put("actUserName", logDO.getActUserName());
stepInfo.put("signPath", logDO.getSignPath());
stepInfo.put("signTime", DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN));
stepInfo.put("status", logDO.getStatus());
stepInfo.put("stepName", log.getStepName());
stepInfo.put("actUserDepartment", log.getActUserDepartment());
stepInfo.put("actUserDepartmentName", log.getActUserDepartmentName());
stepInfo.put("actUser", log.getActUser());
stepInfo.put("actUserName", log.getActUserName());
stepInfo.put("status", log.getStatus());
// 定位步骤,添加经纬度信息
if (logDO.getLatitude() != null || logDO.getLongitude() != null) {
JSONObject location = new JSONObject();
location.put("latitude", logDO.getLatitude());
location.put("longitude", logDO.getLongitude());
stepInfo.put("location", location);
}
infoJson.put("step_" + logDO.getStepId(), stepInfo);
infoJson.put("step_" + log.getStepId(), stepInfo);
}
// 更新到数据库
infoDO.setInfo(infoJson.toJSONString());
eightworkInfoRepository.updateById(infoDO);
log.info("已批量更新步骤 info: workId={}, count={}", workId, actionLogs.size());
log.info("已更新作业 info: workId={}", workId);
}
}

View File

@ -55,7 +55,7 @@ public class TaskLogServiceImpl implements TaskLogServiceI {
TaskLogNextCmd taskLogNextCmd = new TaskLogNextCmd(commitTaskLogDO.getId(),
commitTaskLogDO.getWorkId(),
commitTaskLogDO.getStepId(),
TaskLogStatus.APPROVED.getCode(),null,null,null,cmd.getOthers());
TaskLogStatus.APPROVED.getCode(),null,null,null,null);
taskLogUpdateExe.nextStep(taskLogNextCmd);
return SingleResponse.buildSuccess();

View File

@ -51,7 +51,5 @@ public class TaskLogAddCmd extends Command {
@ApiModelProperty(value = "部门id", name = "departmentId")
private Long departmentId;
@ApiModelProperty(value = "其他参数", name = "others")
private JSONObject others;
}

View File

@ -44,11 +44,5 @@ public class TaskLogNextCmd extends Command {
private List<TaskSignStepInfoCmd> signLogs;
@ApiModelProperty(value = "其他参数", name = "others")
private JSONObject others;
//纬度
@ApiModelProperty(value = "纬度")
private String latitude;
//经度
@ApiModelProperty(value = "经度")
private String longitude;
}

View File

@ -130,12 +130,6 @@ public class TaskLogCO extends ClientObject {
//持续步骤当前填写次数
@ApiModelProperty(value = "持续步骤当前填写次数")
private Integer currentFillTimes;
//纬度
@ApiModelProperty(value = "纬度")
private String latitude;
//经度
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "当前步骤需设置的签字人")
List<TaskLogCO> settingSignSteps;

View File

@ -89,10 +89,6 @@ public class TaskLogE extends BaseE {
private Long blockingStepId;
//持续步骤当前填写次数
private Integer currentFillTimes;
//纬度
private String latitude;
//经度
private String longitude;
public TaskLogE(TaskLogE log) {
this.taskLogId = log.getTaskLogId();
@ -126,8 +122,6 @@ public class TaskLogE extends BaseE {
this.minFillTimes = log.getMinFillTimes();
this.blockingStepId = log.getBlockingStepId();
this.currentFillTimes = log.getCurrentFillTimes();
this.latitude = log.getLatitude();
this.longitude = log.getLongitude();
}

View File

@ -22,6 +22,9 @@ public class MeasuresLogsDO extends BaseDO {
//作业类型
@ApiModelProperty(value = "作业类型")
private String workType;
//填写步骤名
@ApiModelProperty(value = "填写步骤名")
private String stepName;
//防护措施
@ApiModelProperty(value = "防护措施")
private String content;

View File

@ -128,12 +128,6 @@ public class TaskLogDO extends BaseDO {
//持续步骤当前填写次数
@ApiModelProperty(value = "持续步骤当前填写次数")
private Integer currentFillTimes;
//纬度
@ApiModelProperty(value = "纬度")
private String latitude;
//经度
@ApiModelProperty(value = "经度")
private String longitude;
public TaskLogDO(String taskLogId) {
this.taskLogId = taskLogId;