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

This commit is contained in:
chenwenjian 2025-02-17 11:21:48 +08:00
commit 297e9fb63e
6 changed files with 38 additions and 33 deletions

View File

@ -16,7 +16,7 @@ public interface VisaConstant {
/**
* 用于发送待办的变量名
*/
String WORKFLOW_PENDING_TOPIC = "theme";
String WORKFLOW_PENDING_TOPIC = "topic";
String MSG_CENTER_APP_CODE = "nanopart-visa";
/**
* IM 群的扩展信息变洽签 ID

View File

@ -66,9 +66,10 @@ public class ImGroupAddMembersEventHandler implements EventHandler, Initializing
Map<Long, PersonProfileDto> profileMap = visaProfileGateway.getProfileMap(Lists.newArrayList(group.getOwnerPersonId(), member.getPersonId()));
String visaId = (String) group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, "");
Long visaId = Long.valueOf(group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, 0).toString());
String visaType = (String) group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_VISA_TYPE, "");
Long workspaceId = (Long) group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_INITIATOR_WORKSPACE_ID, 0L);
Long workspaceId = Long.valueOf(group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_INITIATOR_WORKSPACE_ID, 0).toString());
PersonProfileDto memberProfile = profileMap.getOrDefault(member.getPersonId(), null);
PersonProfileDto ownerProfile = profileMap.getOrDefault(group.getOwnerPersonId(), null);
@ -83,7 +84,7 @@ public class ImGroupAddMembersEventHandler implements EventHandler, Initializing
.imReceiveModel(new PersonV3DTO.ReceiveModel(member.getPersonOuId(), workspaceId))
.build()));
notice.setBizEventMappingCode(refreshableConfiguration.getImGroupAddMemberNoticeEventCode());
notice.setBizCode(visaId);
notice.setBizCode(String.valueOf(visaId));
notice.setBizExtParams(new JSONObject(Maps.of(
"initiatorName", ownerProfile.getRealName(),
"visaType", VisaTypeEnum.valueOfCode(visaType).getDesc(),

View File

@ -55,8 +55,7 @@ public class ImGroupRemoveMembersEventHandler implements EventHandler, Initializ
}
private void removeMemberVote(GroupInfo group, GroupMemberInfo member) {
Long visaId = (Long) group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, "");
Long visaId = Long.valueOf(group.getBizGroupInfo().getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, 0).toString());
changeRecordRelationService.clearImOperationParticipate(ImGroupOperationClearReq.builder()
.clearAll(false)

View File

@ -27,6 +27,7 @@ import cn.axzo.nanopart.visa.server.rpc.OrganizationalUnitGateway;
import cn.axzo.nanopart.visa.server.rpc.VisaProfileGateway;
import cn.axzo.nanopart.visa.server.service.ChangeRecordConfirmService;
import cn.axzo.nanopart.visa.server.service.ChangeRecordService;
import cn.axzo.nanopart.visa.server.service.VisaHelper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Sets;
@ -37,7 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@ -91,13 +91,14 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
Map<String, Object> bizGroupInfo = group.getBizGroupInfo();
HashSet<String> imReceiveAccounts = Sets.newHashSet(String.valueOf(group.getTid()));
GroupGetOwnerRequest ownerRequest = new GroupGetOwnerRequest();
ownerRequest.setTid(group.getTid());
GroupGetOwnerResponse groupOwner = msgCenterGateway.getGroupOwner(ownerRequest);
AssertUtil.isTrue(Objects.nonNull(groupOwner) && Objects.nonNull(groupOwner.getOwner()), "im group owner is null");
GroupMemberInfo owner = groupOwner.getOwner();
Long visaId = (Long) bizGroupInfo.getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, "");
Long visaId = Long.valueOf(bizGroupInfo.getOrDefault(IM_GROUP_BIZ_INFO_VISA_ID, 0).toString());
String visaType = (String) bizGroupInfo.getOrDefault(IM_GROUP_BIZ_INFO_VISA_TYPE, "");
Long ownerWorkspaceId = (Long) bizGroupInfo.getOrDefault(IM_GROUP_BIZ_INFO_INITIATOR_WORKSPACE_ID, 0L);
Long ownerWorkspaceId = Long.valueOf(bizGroupInfo.getOrDefault(IM_GROUP_BIZ_INFO_INITIATOR_WORKSPACE_ID, 0).toString());
ChangeRecord visa = changeRecordService.getById(visaId);
AssertUtil.notNull(visa, "visa record is null");
@ -121,20 +122,14 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
ChangeRecordConfirm creator = creators.get(0);
OrganizationalUnitVO unitInfo = organizationalUnitGateway.getUnitInfo(creator.getOuId());
PersonProfileDto profile = visaProfileGateway.getProfile(creator.getPersonId());
String amountDesc = "不变";
if (visa.getAmountChange().compareTo(BigDecimal.ZERO) > 0) {
amountDesc = "增加" + visa.getAmountChange().toPlainString() + "";
} else if (visa.getAmountChange().compareTo(BigDecimal.ZERO) < 0) {
amountDesc = "减少" + visa.getAmountChange().toPlainString() + "";
}
cardRequest.setBizParam(new JSONObject(Maps.of(
"topic", group.getName(),
"reason", visa.getReason(),
"initiatorName", profile.getRealName(),
"initiatorUnitName", unitInfo.getName(),
"visaType", VisaTypeEnum.valueOfCode(visaType).getDesc(),
"amountChange", amountDesc
"visaType", VisaTypeEnum.valueOf(visaType).getDesc(),
"amountChange", VisaHelper.buildChangeAmount(visa.getAmountChange())
)));
msgCenterGateway.sendCardToCroup(cardRequest);

View File

@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@ -229,4 +230,14 @@ public class VisaHelper {
});
return returnMap;
}
public static String buildChangeAmount(BigDecimal changeAmount) {
String amountDesc = "不变";
if (changeAmount.compareTo(BigDecimal.ZERO) > 0) {
amountDesc = "增加" + changeAmount.abs().toPlainString() + "";
} else if (changeAmount.compareTo(BigDecimal.ZERO) < 0) {
amountDesc = "减少" + changeAmount.abs().toPlainString() + "";
}
return amountDesc;
}
}

View File

@ -248,7 +248,9 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
// 1 构建前置状态与日志
List<VisaStatusEnum> preStatusList = this.buildPreStatus(request.getUpdateStatus());
// 2 更新状态
this.updateVisaStatus(request.getVisaId(), preStatusList, request.getUpdateStatus());
if (!this.updateVisaStatus(request.getVisaId(), preStatusList, request.getUpdateStatus())) {
return false;
}
// 3 新增日志
this.addLogWhenChangeStatus(request, VisaLogParam.builder()
.personId(request.getPersonId())
@ -281,6 +283,11 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
.set(ChangeRecord::getStatus, updateStatus)
.update();
if (!update) {
//单据最新的状态是更新状态
VisaDetailByIdResponse response = this.detailById(visaId);
if (response.getStatus().equals(updateStatus)) {
return false;
}
throw new ServiceException("更新状态失败");
}
return update;
@ -368,6 +375,9 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
return VisaDetailByIdResponse.builder().build();
}
ChangeRecord visa = this.getById(visaId);
if (Objects.isNull(visa) || Objects.isNull(visa.getId())) {
throw new ServiceException("未查询到单据信息");
}
PersonProfileDto profile = visaProfileGateway.getProfile(visa.getCreateBy());
List<ChangeRecordBill> changeRecordBills = changeRecordBillService.listById(visaId);
@ -731,13 +741,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
// 非必填项
if (Objects.nonNull(req.getAmountChange())) {
String amountDesc = "不变";
if (req.getAmountChange().compareTo(BigDecimal.ZERO) > 0) {
amountDesc = "增加" + req.getAmountChange().abs().toPlainString() + "";
} else if (req.getAmountChange().compareTo(BigDecimal.ZERO) < 0) {
amountDesc = "减少" + req.getAmountChange().abs().toPlainString() + "";
}
formVariables.put(FORM_FIELD_AMOUNT_CHANGE, amountDesc);
formVariables.put(FORM_FIELD_AMOUNT_CHANGE, VisaHelper.buildChangeAmount(req.getAmountChange()));
}
// 三种单据
@ -1390,7 +1394,8 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
return ChangeRecord.builder().build();
}
return this.lambdaQuery()
.eq(ChangeRecord::getId, visaId).one();
.eq(ChangeRecord::getId, visaId)
.eq(ChangeRecord::getIsDelete, 0).one();
}
@Override
@ -1535,12 +1540,6 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
OrganizationalUnitVO unitInfo = organizationalUnitGateway.getUnitInfo(req.getOperatorOuId());
PersonProfileDto profile = visaProfileGateway.getProfile(req.getOperatorPersonId());
String amountDesc = "不变";
if (visa.getAmountChange().compareTo(BigDecimal.ZERO) > 0) {
amountDesc = "增加" + visa.getAmountChange().toPlainString() + "";
} else if (visa.getAmountChange().compareTo(BigDecimal.ZERO) < 0) {
amountDesc = "减少" + visa.getAmountChange().toPlainString() + "";
}
cardRequest.setBizParam(new JSONObject(Maps.of(
"topic", visa.getTopic(),
@ -1548,7 +1547,7 @@ public class ChangeRecordServiceImpl extends ServiceImpl<ChangeRecordDao, Change
"initiatorName", profile.getRealName(),
"initiatorUnitName", unitInfo.getName(),
"visaType", visa.getType().getDesc(),
"amountChange", amountDesc
"amountChange", VisaHelper.buildChangeAmount(visa.getAmountChange())
)));
msgCenterGateway.sendCardToCroup(cardRequest);
}