Merge remote-tracking branch 'origin/feature/REQ-3300' into feature/REQ-3300
This commit is contained in:
commit
92ecc974e8
@ -1,6 +1,7 @@
|
||||
package cn.axzo.nanopart.visa.server.mq.listener.im;
|
||||
|
||||
import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.basics.profiles.dto.basic.PersonProfileDto;
|
||||
import cn.axzo.framework.rocketmq.Event;
|
||||
import cn.axzo.framework.rocketmq.EventConsumer;
|
||||
import cn.axzo.framework.rocketmq.EventHandler;
|
||||
@ -12,6 +13,7 @@ import cn.axzo.im.center.api.vo.req.GroupGetOwnerRequest;
|
||||
import cn.axzo.im.center.api.vo.req.SendChatMessageRequest;
|
||||
import cn.axzo.im.center.api.vo.resp.GroupGetOwnerResponse;
|
||||
import cn.axzo.im.center.common.enums.AppTypeEnum;
|
||||
import cn.axzo.maokai.api.vo.response.OrganizationalUnitVO;
|
||||
import cn.axzo.msg.center.service.dto.PeerPerson;
|
||||
import cn.axzo.msg.center.service.pending.request.CardSendRequest;
|
||||
import cn.axzo.nanopart.visa.api.enums.VisaConfirmBizTypeEnum;
|
||||
@ -21,6 +23,7 @@ import cn.axzo.nanopart.visa.server.domain.ChangeRecord;
|
||||
import cn.axzo.nanopart.visa.server.domain.ChangeRecordConfirm;
|
||||
import cn.axzo.nanopart.visa.server.dto.VisaConfirmDto;
|
||||
import cn.axzo.nanopart.visa.server.rpc.MsgCenterGateway;
|
||||
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;
|
||||
@ -34,6 +37,7 @@ 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;
|
||||
@ -61,11 +65,13 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
|
||||
@Resource
|
||||
private RefreshableConfiguration refreshableConfiguration;
|
||||
@Resource
|
||||
private VisaProfileGateway visaProfileGateway;
|
||||
private OrganizationalUnitGateway organizationalUnitGateway;
|
||||
@Resource
|
||||
private ChangeRecordService changeRecordService;
|
||||
@Resource
|
||||
private ChangeRecordConfirmService changeRecordConfirmService;
|
||||
@Resource
|
||||
private VisaProfileGateway visaProfileGateway;
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event, EventConsumer.Context context) {
|
||||
@ -100,7 +106,7 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
|
||||
.visaId(visaId)
|
||||
.bizType(VisaConfirmBizTypeEnum.CREATE)
|
||||
.build());
|
||||
AssertUtil.notEmpty(creators, "creators is empty");
|
||||
AssertUtil.notEmpty(creators, "visa creator is null");
|
||||
|
||||
|
||||
// 发送卡片
|
||||
@ -111,14 +117,24 @@ public class ImGroupsCreatedEventHandler implements EventHandler, InitializingBe
|
||||
cardRequest.setSender(PeerPerson.create(owner.getPersonId(), owner.getPersonOuId(), ownerWorkspaceId));
|
||||
cardRequest.setImSenderAccountAppType(AppTypeEnum.CMP);
|
||||
cardRequest.setImReceiveAccounts(imReceiveAccounts);
|
||||
// TODO
|
||||
|
||||
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", creators.get(0),
|
||||
"initiatorUnitName", "",
|
||||
"initiatorName", profile.getRealName(),
|
||||
"initiatorUnitName", unitInfo.getName(),
|
||||
"visaType", VisaTypeEnum.valueOfCode(visaType).getDesc(),
|
||||
"amountChange", ""
|
||||
"amountChange", amountDesc
|
||||
)));
|
||||
msgCenterGateway.sendCardToCroup(cardRequest);
|
||||
|
||||
|
||||
@ -25,6 +25,14 @@ public class OrganizationalUnitGateway {
|
||||
|
||||
private final OrganizationalUnitApi organizationalUnitApi;
|
||||
|
||||
@MethodAroundLog(target = "maokai", source = "nanopart", value = "获取单位信息")
|
||||
public OrganizationalUnitVO getUnitInfo(Long unitId) {
|
||||
ApiResult<OrganizationalUnitVO> unitResponse = organizationalUnitApi.getById(unitId);
|
||||
if (unitResponse.isSuccess() && Objects.nonNull(unitResponse.getData())) {
|
||||
return unitResponse.getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 获取单位集合
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user