Merge remote-tracking branch 'origin/feature/REQ-3581' into feature/REQ-3581

This commit is contained in:
yanglin 2025-02-20 17:22:14 +08:00
commit 1c04458564
10 changed files with 96 additions and 17 deletions

View File

@ -3,7 +3,7 @@ package cn.axzo.nanopart.visa.api.request;
import cn.axzo.framework.domain.ServiceException;
import cn.axzo.nanopart.visa.api.enums.VisaLogTypeEnum;
import cn.axzo.nanopart.visa.api.enums.VisaStatusEnum;
import com.alibaba.fastjson.JSONObject;
import cn.axzo.nanopart.visa.api.response.VisaDetailByIdResponse;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -73,11 +73,11 @@ public class ChangeStatusRequest {
/**
* 新的附件
*/
private List<JSONObject> newAttach;
private List<VisaDetailByIdResponse.VisaUploadFile> newAttach;
/**
* 原的附件
*/
private List<JSONObject> oldAttach;
private List<VisaDetailByIdResponse.VisaUploadFile> oldAttach;
/**
* 是否编辑表单

View File

@ -33,4 +33,6 @@ public class VisaRelationReq {
* 可为空则查询所有关联的数据
*/
private VisaRelationFieldEnum fieldEnum;
private Long id;
}

View File

@ -37,6 +37,7 @@ public class ChangeRecordRelationController implements ChangeRecordRelationApi {
return ApiResult.ok(changeRecordRelationService.findByCondition(VisaRelationDto.builder()
.visaId(req.getVisaId())
.varName(Objects.nonNull(req.getFieldEnum()) ? req.getFieldEnum().name() : null)
.id(req.getId())
.build())
.stream().sorted(Comparator.comparing(ChangeRecordRelation::getCreateAt))
.map(i -> VisaRelationResp.builder()

View File

@ -94,12 +94,29 @@ public class VisaLogParam {
return fetchChangeAttach(oldAttach, newAttach);
}
/**
* 获取删除附件信息
*/
public static List<String> deleteAttachWithObject(List<VisaDetailByIdResponse.VisaUploadFile> oldAttach, List<VisaDetailByIdResponse.VisaUploadFile> newAttach) {
return fetchChangeAttachWithObject(oldAttach, newAttach);
}
/**
* 获取上传的附件信息
*/
public static List<String> uploadAttach(List<JSONObject> newAttach, List<JSONObject> oldAttach) {
return fetchChangeAttach(newAttach, oldAttach);
}
/**
* 获取上传的附件信息
*/
public static List<String> uploadAttachWithObject(List<VisaDetailByIdResponse.VisaUploadFile> newAttach, List<VisaDetailByIdResponse.VisaUploadFile> oldAttach) {
return fetchChangeAttachWithObject(newAttach, oldAttach);
}
/**
* 获取变动的附件信息
* 计算集合的单差集即只返回集合1中有但是集合2中没有的元素例如
@ -116,7 +133,26 @@ public class VisaLogParam {
}
List<VisaDetailByIdResponse.VisaUploadFile> newFileDtoList = VisaDetailByIdResponse.VisaUploadFile.createListByJson(compareSec);
Collection<VisaDetailByIdResponse.VisaUploadFile> substractList = CollUtil.subtractToList(oldFileDtoList, newFileDtoList);
return fetchChangeAttachWithObject(oldFileDtoList, newFileDtoList);
}
/**
* 获取变动的附件信息
* 计算集合的单差集即只返回集合1中有但是集合2中没有的元素例如
* subtractToList([1,2,3,4],[2,3,4,5]) - [1]
*/
private static List<String> fetchChangeAttachWithObject(List<VisaDetailByIdResponse.VisaUploadFile> compareFir, List<VisaDetailByIdResponse.VisaUploadFile> compareSec) {
if (CollectionUtils.isEmpty(compareFir)) {
return Lists.newArrayList();
}
if (CollectionUtils.isEmpty(compareSec)) {
return compareFir.stream().map(VisaDetailByIdResponse.VisaUploadFile::getFileName).collect(Collectors.toList());
}
Collection<VisaDetailByIdResponse.VisaUploadFile> substractList = CollUtil.subtractToList(compareFir, compareSec);
if (CollectionUtils.isEmpty(substractList)) {
return Lists.newArrayList();
}

View File

@ -43,4 +43,5 @@ public class VisaRelationDto {
*/
private Long createBy;
private Long id;
}

View File

@ -85,9 +85,11 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
GroupInfo group = groupChangedMessage.getGroup();
AssertUtil.notNull(group, "group info is null");
try {
sendCardAndMsgToImGroup(group);
// 转移到创建群聊立即发送卡片
// sendCardAndMsgToImGroup(group);
} catch (Exception e) {
log.error("send msg to im group error: {}", e.getMessage(), e);
throw e;
}
log.info("receive create im group event, handle success: {}", JSON.toJSONString(event));
}

View File

@ -100,8 +100,8 @@ public class VisaHelper {
.workspaceId(newContext.getWorkspaceId())
.newAmountChange(newContext.getChangeRecord().getAmountChange())
.oldAmountChange(oldContext.getChangeRecord().getAmountChange())
.newAttach(newContext.getAttachList())
.oldAttach(oldContext.getAttachList())
// .newAttach(newContext.getAttachList())
// .oldAttach(oldContext.getAttachList())
.editFormFlag(true)
.build());
}

View File

@ -16,6 +16,7 @@ import cn.axzo.nanopart.visa.server.utils.Constants;
import cn.axzo.orggateway.api.nodeuser.dto.OrgNodeUserDTO;
import cn.axzo.orggateway.api.nodeuser.req.ListOrgNodeUserReq;
import cn.axzo.orgmanax.dto.nodeuser.req.ListNodeUserReq;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
@ -79,7 +80,7 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
@Override
public List<ChangeRecordLog> buildLogList(Long visaId, VisaLogTypeEnum type, VisaLogParam param) {
log.info("buildLogList,visaId={},type={},param={}", visaId, type, JSON.toJSONString(param));
if (Objects.isNull(visaId) || Objects.isNull(type)) {
return Lists.newArrayList();
}

View File

@ -150,7 +150,9 @@ public class ChangeRecordRelationServiceImpl extends ServiceImpl<ChangeRecordRel
.eq(StringUtils.hasText(dto.getContent()), ChangeRecordRelation::getContent, dto.getContent())
.eq(StringUtils.hasText(dto.getContentExt()), ChangeRecordRelation::getContentExt, dto.getContentExt())
.eq(Objects.nonNull(dto.getCreateBy()), ChangeRecordRelation::getCreateBy, dto.getCreateBy())
.eq(ChangeRecordRelation::getIsDelete, 0).list();
.eq(ChangeRecordRelation::getIsDelete, 0)
.eq(Objects.nonNull(dto.getId()), ChangeRecordRelation::getId, dto.getId())
.list();
}
@Override

View File

@ -246,6 +246,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
*/
@Override
public Boolean changeStatus(ChangeStatusRequest request) {
log.info("changeStatus: {}", JSON.toJSONString(request));
request.check();
ChangeRecord changeRecord = this.getById(request.getVisaId());
// 1 构建前置状态与日志
@ -263,8 +264,8 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
.oldStatus(changeRecord.getStatus())
.newAmountChange(request.getNewAmountChange())
.oldAmountChange(request.getOldAmountChange())
.uploadAttach(VisaLogParam.uploadAttach(request.getNewAttach(), request.getOldAttach()))
.deleteAttach(VisaLogParam.deleteAttach(request.getOldAttach(), request.getNewAttach())).build());
.uploadAttach(VisaLogParam.uploadAttachWithObject(request.getNewAttach(), request.getOldAttach()))
.deleteAttach(VisaLogParam.deleteAttachWithObject(request.getOldAttach(), request.getNewAttach())).build());
return true;
}
@ -300,7 +301,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
* 添加日志
*/
private void addLogWhenChangeStatus(ChangeStatusRequest request, VisaLogParam param) {
log.info("addLogWhenChangeStatus: request:{},param:{}", JSON.toJSONString(request), JSON.toJSONString(param));
List<ChangeRecordLog> logList = Lists.newArrayList();
// 1 [决策中执行中] -> [审批中] 执行变更签证属性变更
if (Objects.nonNull(param.getOldStatus()) && Objects.nonNull(param.getNewStatus())
@ -671,8 +672,15 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
IM_GROUP_BIZ_INFO_VISA_TYPE, req.getType().name()));
GroupCreateResponse imGroup = msgCenterGateway.createImGroup(request);
AssertUtil.notNull(imGroup, "IM 群创建失败");
updateImInfo(visaId, imGroup);
ChangeRecord visa = changeRecordService.getById(visaId);
sendCardAndMsgToImGroup(ChangeRecordButtonOperationReq.builder()
.operatorPersonId(req.getOperatorPersonId())
.operatorOuId(req.getOperatorOuId())
.operatorWorkspaceId(req.getRelationWorkspaceId())
.build(), visa);
// 更新主表状态
changeStatus(ChangeStatusRequest.builder()
.visaId(visaId)
@ -707,6 +715,10 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
public Long approveCreateVisaChangeRecord(VisaChangeApproveCreateReq req) {
/*校验*/
validVisaChangeForm(req);
ChangeRecord changeRecord = this.getById(req.getId());
ChangeRecord oldChangeRecord = BeanUtil.copyProperties(changeRecord, ChangeRecord.class);
List<VisaDetailByIdResponse.VisaUploadFile> visaUploadFiles = this.buildAttachUploadFile(req.getId());
/*保存签证信息*/
Long visaId = tempCreateVisaChangeRecord(req);
@ -717,16 +729,38 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
// 更新主表中的审批字段记录变量表的审批的信息
updateApprovalInfo(visaId, processInstanceId);
// 更新主表状态
changeStatus(ChangeStatusRequest.builder()
this.changeStatusWhenApproveCreate(visaId, req, oldChangeRecord, visaUploadFiles);
return visaId;
}
/**
* 更改状态-申请审批时
* @param visaId 变更签证id
* @param req 请求主要是获取最新的属性比如变更金额/附件
* @param changeRecord 变更签证对象主要获取老的属性比如变更金额
* @param visaUploadFiles 上传附件主要是老的属性
*/
public void changeStatusWhenApproveCreate(Long visaId, VisaChangeApproveCreateReq req, ChangeRecord changeRecord, List<VisaDetailByIdResponse.VisaUploadFile> visaUploadFiles) {
ChangeStatusRequest changeStatusRequest = ChangeStatusRequest.builder()
.visaId(visaId)
.updateStatus(VisaStatusEnum.APPROVING)
.personId(req.getOperatorPersonId())
.ouId(req.getOperatorOuId())
.workspaceId(req.getRelationWorkspaceId())
.editFormFlag(true)
.build());
return visaId;
.newAmountChange(req.getAmountChange())
.oldAmountChange(changeRecord.getAmountChange())
.build();
if (CollectionUtils.isNotEmpty(req.getAttach())) {
changeStatusRequest.setNewAttach(BeanUtil.copyToList(req.getAttach(), VisaDetailByIdResponse.VisaUploadFile.class));
}
if (CollectionUtils.isNotEmpty(visaUploadFiles)) {
changeStatusRequest.setOldAttach(visaUploadFiles);
}
// 更新主表状态
changeStatus(changeStatusRequest);
}
private String createProcessInstance(VisaChangeApproveCreateReq req, Long visaId) {