Merge remote-tracking branch 'origin/feature/REQ-3581' into feature/REQ-3581
This commit is contained in:
commit
1c04458564
@ -3,7 +3,7 @@ package cn.axzo.nanopart.visa.api.request;
|
|||||||
import cn.axzo.framework.domain.ServiceException;
|
import cn.axzo.framework.domain.ServiceException;
|
||||||
import cn.axzo.nanopart.visa.api.enums.VisaLogTypeEnum;
|
import cn.axzo.nanopart.visa.api.enums.VisaLogTypeEnum;
|
||||||
import cn.axzo.nanopart.visa.api.enums.VisaStatusEnum;
|
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.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否编辑表单
|
* 是否编辑表单
|
||||||
|
|||||||
@ -33,4 +33,6 @@ public class VisaRelationReq {
|
|||||||
* 可为空,则查询所有关联的数据
|
* 可为空,则查询所有关联的数据
|
||||||
*/
|
*/
|
||||||
private VisaRelationFieldEnum fieldEnum;
|
private VisaRelationFieldEnum fieldEnum;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ public class ChangeRecordRelationController implements ChangeRecordRelationApi {
|
|||||||
return ApiResult.ok(changeRecordRelationService.findByCondition(VisaRelationDto.builder()
|
return ApiResult.ok(changeRecordRelationService.findByCondition(VisaRelationDto.builder()
|
||||||
.visaId(req.getVisaId())
|
.visaId(req.getVisaId())
|
||||||
.varName(Objects.nonNull(req.getFieldEnum()) ? req.getFieldEnum().name() : null)
|
.varName(Objects.nonNull(req.getFieldEnum()) ? req.getFieldEnum().name() : null)
|
||||||
|
.id(req.getId())
|
||||||
.build())
|
.build())
|
||||||
.stream().sorted(Comparator.comparing(ChangeRecordRelation::getCreateAt))
|
.stream().sorted(Comparator.comparing(ChangeRecordRelation::getCreateAt))
|
||||||
.map(i -> VisaRelationResp.builder()
|
.map(i -> VisaRelationResp.builder()
|
||||||
|
|||||||
@ -94,12 +94,29 @@ public class VisaLogParam {
|
|||||||
return fetchChangeAttach(oldAttach, newAttach);
|
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) {
|
public static List<String> uploadAttach(List<JSONObject> newAttach, List<JSONObject> oldAttach) {
|
||||||
return fetchChangeAttach(newAttach, oldAttach);
|
return fetchChangeAttach(newAttach, oldAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上传的附件信息
|
||||||
|
*/
|
||||||
|
public static List<String> uploadAttachWithObject(List<VisaDetailByIdResponse.VisaUploadFile> newAttach, List<VisaDetailByIdResponse.VisaUploadFile> oldAttach) {
|
||||||
|
return fetchChangeAttachWithObject(newAttach, oldAttach);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取变动的附件信息
|
* 获取变动的附件信息
|
||||||
* 计算集合的单差集,即只返回【集合1】中有,但是【集合2】中没有的元素,例如:
|
* 计算集合的单差集,即只返回【集合1】中有,但是【集合2】中没有的元素,例如:
|
||||||
@ -116,7 +133,26 @@ public class VisaLogParam {
|
|||||||
}
|
}
|
||||||
List<VisaDetailByIdResponse.VisaUploadFile> newFileDtoList = VisaDetailByIdResponse.VisaUploadFile.createListByJson(compareSec);
|
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)) {
|
if (CollectionUtils.isEmpty(substractList)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,4 +43,5 @@ public class VisaRelationDto {
|
|||||||
*/
|
*/
|
||||||
private Long createBy;
|
private Long createBy;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,9 +85,11 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
|
|||||||
GroupInfo group = groupChangedMessage.getGroup();
|
GroupInfo group = groupChangedMessage.getGroup();
|
||||||
AssertUtil.notNull(group, "group info is null");
|
AssertUtil.notNull(group, "group info is null");
|
||||||
try {
|
try {
|
||||||
sendCardAndMsgToImGroup(group);
|
// 转移到创建群聊立即发送卡片
|
||||||
|
// sendCardAndMsgToImGroup(group);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("send msg to im group error: {}", e.getMessage(), 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));
|
log.info("receive create im group event, handle success: {}", JSON.toJSONString(event));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,8 +100,8 @@ public class VisaHelper {
|
|||||||
.workspaceId(newContext.getWorkspaceId())
|
.workspaceId(newContext.getWorkspaceId())
|
||||||
.newAmountChange(newContext.getChangeRecord().getAmountChange())
|
.newAmountChange(newContext.getChangeRecord().getAmountChange())
|
||||||
.oldAmountChange(oldContext.getChangeRecord().getAmountChange())
|
.oldAmountChange(oldContext.getChangeRecord().getAmountChange())
|
||||||
.newAttach(newContext.getAttachList())
|
// .newAttach(newContext.getAttachList())
|
||||||
.oldAttach(oldContext.getAttachList())
|
// .oldAttach(oldContext.getAttachList())
|
||||||
.editFormFlag(true)
|
.editFormFlag(true)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.dto.OrgNodeUserDTO;
|
||||||
import cn.axzo.orggateway.api.nodeuser.req.ListOrgNodeUserReq;
|
import cn.axzo.orggateway.api.nodeuser.req.ListOrgNodeUserReq;
|
||||||
import cn.axzo.orgmanax.dto.nodeuser.req.ListNodeUserReq;
|
import cn.axzo.orgmanax.dto.nodeuser.req.ListNodeUserReq;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
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 lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -79,7 +80,7 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChangeRecordLog> buildLogList(Long visaId, VisaLogTypeEnum type, VisaLogParam param) {
|
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)) {
|
if (Objects.isNull(visaId) || Objects.isNull(type)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,9 @@ public class ChangeRecordRelationServiceImpl extends ServiceImpl<ChangeRecordRel
|
|||||||
.eq(StringUtils.hasText(dto.getContent()), ChangeRecordRelation::getContent, dto.getContent())
|
.eq(StringUtils.hasText(dto.getContent()), ChangeRecordRelation::getContent, dto.getContent())
|
||||||
.eq(StringUtils.hasText(dto.getContentExt()), ChangeRecordRelation::getContentExt, dto.getContentExt())
|
.eq(StringUtils.hasText(dto.getContentExt()), ChangeRecordRelation::getContentExt, dto.getContentExt())
|
||||||
.eq(Objects.nonNull(dto.getCreateBy()), ChangeRecordRelation::getCreateBy, dto.getCreateBy())
|
.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
|
@Override
|
||||||
|
|||||||
@ -246,6 +246,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean changeStatus(ChangeStatusRequest request) {
|
public Boolean changeStatus(ChangeStatusRequest request) {
|
||||||
|
log.info("changeStatus: {}", JSON.toJSONString(request));
|
||||||
request.check();
|
request.check();
|
||||||
ChangeRecord changeRecord = this.getById(request.getVisaId());
|
ChangeRecord changeRecord = this.getById(request.getVisaId());
|
||||||
// 1 构建前置状态与日志
|
// 1 构建前置状态与日志
|
||||||
@ -263,8 +264,8 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
|||||||
.oldStatus(changeRecord.getStatus())
|
.oldStatus(changeRecord.getStatus())
|
||||||
.newAmountChange(request.getNewAmountChange())
|
.newAmountChange(request.getNewAmountChange())
|
||||||
.oldAmountChange(request.getOldAmountChange())
|
.oldAmountChange(request.getOldAmountChange())
|
||||||
.uploadAttach(VisaLogParam.uploadAttach(request.getNewAttach(), request.getOldAttach()))
|
.uploadAttach(VisaLogParam.uploadAttachWithObject(request.getNewAttach(), request.getOldAttach()))
|
||||||
.deleteAttach(VisaLogParam.deleteAttach(request.getOldAttach(), request.getNewAttach())).build());
|
.deleteAttach(VisaLogParam.deleteAttachWithObject(request.getOldAttach(), request.getNewAttach())).build());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +301,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
|||||||
* 添加日志
|
* 添加日志
|
||||||
*/
|
*/
|
||||||
private void addLogWhenChangeStatus(ChangeStatusRequest request, VisaLogParam param) {
|
private void addLogWhenChangeStatus(ChangeStatusRequest request, VisaLogParam param) {
|
||||||
|
log.info("addLogWhenChangeStatus: request:{},param:{}", JSON.toJSONString(request), JSON.toJSONString(param));
|
||||||
List<ChangeRecordLog> logList = Lists.newArrayList();
|
List<ChangeRecordLog> logList = Lists.newArrayList();
|
||||||
// 1 由[决策中|执行中] -> [审批中] 执行变更签证属性变更
|
// 1 由[决策中|执行中] -> [审批中] 执行变更签证属性变更
|
||||||
if (Objects.nonNull(param.getOldStatus()) && Objects.nonNull(param.getNewStatus())
|
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()));
|
IM_GROUP_BIZ_INFO_VISA_TYPE, req.getType().name()));
|
||||||
GroupCreateResponse imGroup = msgCenterGateway.createImGroup(request);
|
GroupCreateResponse imGroup = msgCenterGateway.createImGroup(request);
|
||||||
AssertUtil.notNull(imGroup, "IM 群创建失败");
|
AssertUtil.notNull(imGroup, "IM 群创建失败");
|
||||||
|
|
||||||
updateImInfo(visaId, imGroup);
|
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()
|
changeStatus(ChangeStatusRequest.builder()
|
||||||
.visaId(visaId)
|
.visaId(visaId)
|
||||||
@ -707,6 +715,10 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
|||||||
public Long approveCreateVisaChangeRecord(VisaChangeApproveCreateReq req) {
|
public Long approveCreateVisaChangeRecord(VisaChangeApproveCreateReq req) {
|
||||||
/*校验*/
|
/*校验*/
|
||||||
validVisaChangeForm(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);
|
Long visaId = tempCreateVisaChangeRecord(req);
|
||||||
|
|
||||||
@ -717,16 +729,38 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
|
|||||||
// 更新主表中的审批字段,记录变量表的审批的信息
|
// 更新主表中的审批字段,记录变量表的审批的信息
|
||||||
updateApprovalInfo(visaId, processInstanceId);
|
updateApprovalInfo(visaId, processInstanceId);
|
||||||
|
|
||||||
// 更新主表状态
|
this.changeStatusWhenApproveCreate(visaId, req, oldChangeRecord, visaUploadFiles);
|
||||||
changeStatus(ChangeStatusRequest.builder()
|
|
||||||
|
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)
|
.visaId(visaId)
|
||||||
.updateStatus(VisaStatusEnum.APPROVING)
|
.updateStatus(VisaStatusEnum.APPROVING)
|
||||||
.personId(req.getOperatorPersonId())
|
.personId(req.getOperatorPersonId())
|
||||||
.ouId(req.getOperatorOuId())
|
.ouId(req.getOperatorOuId())
|
||||||
.workspaceId(req.getRelationWorkspaceId())
|
.workspaceId(req.getRelationWorkspaceId())
|
||||||
.editFormFlag(true)
|
.editFormFlag(true)
|
||||||
.build());
|
.newAmountChange(req.getAmountChange())
|
||||||
return visaId;
|
.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) {
|
private String createProcessInstance(VisaChangeApproveCreateReq req, Long visaId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user