【HZERO】消息发送
消息发送
https://open.hand-china.com/community/detail/625843016338378752
新建模板



@Override
public String shipmentRelay(ShipmentRelayDTO dto) {
IfpShipment ifpShipment = ifpShipmentService.selectByPrimaryKey(dto.getShipmentGidOld());
//插入接力运单信息
IfpShipment newIfpShipment = new IfpShipment();
BeanUtils.copyProperties(ifpShipment, newIfpShipment, "id", "xid", "objectVersionNumber", "createdBy", "creationDate", "lastUpdatedBy", "lastUpdateDate", "vehicleGid", "driverGid", "loadDate", "loadWeight", "loadVolume", "loadItemCount", "unloadDate", "unloadWeight", "unloadVolume", "unloadItemCount", "loadAttachmentFile", "unloadAttachmentFile");
newIfpShipment.setDriverGid(dto.getDriverIdNew());
newIfpShipment.setVehicleGid(dto.getVehicleIdNew());
String newXid = ifpShipment.getXid() + "-1";
newIfpShipment.setXid(newXid);
newIfpShipment.setShipmentGidOld(dto.getShipmentGidOld());
newIfpShipment.setShipmentStatus("TO_CONFIRM_RELAY");
newIfpShipment.setSettleDriverGid(dto.getDriverIdNew());
if (null != dto.getTrailGid()) {
newIfpShipment.setTrailGid(dto.getTrailGid());
}
try {
newIfpShipment.setLoadAttachmentFile(JSONObject.parseObject(fileRemoteService.getAttachUUID(0L).getBody()).getString("content"));
newIfpShipment.setUnloadAttachmentFile(JSONObject.parseObject(fileRemoteService.getAttachUUID(0L).getBody()).getString("content"));
newIfpShipment.setSignAttachmentFile(JSONObject.parseObject(fileRemoteService.getAttachUUID(0L).getBody()).getString("content"));
newIfpShipment.setCostExplanationFile(JSONObject.parseObject(fileRemoteService.getAttachUUID(0L).getBody()).getString("content"));
}catch (Exception ignore){}
ifpShipmentService.insertSelective(newIfpShipment);
//生成新运单后要生成新的单次托运合同的承运合同的逻辑,单次托运合同是自动落章的,单次承运合同司机还要签章
//生成待装货运单,生成单次承运合同和单次托运合同
this.contractService.createFreightSignContract(ifpShipment.getTenantId(), dto.getDriverIdNew(), newIfpShipment.getId());
this.contractService.createShipperSingleContract(ifpShipment.getTenantId(), ifpShipment.getShipperCompanyId(), dto.getDriverIdNew(), newIfpShipment.getId());
//更新原运单接力运单id信息
ifpShipment.setShipmentGidNew(newIfpShipment.getId());
ifpShipment.setShipmentStatus("ALL_RELAY");
ifpShipmentService.updateByPrimaryKeySelective(ifpShipment);
//更新异常表相应的运单、司机、车辆信息
IfpExpection tempIfpExpection = new IfpExpection();
tempIfpExpection.setShipmentGidOld(dto.getShipmentGidOld());
IfpExpection ifpExpection = ifpExpectionService.selectOne(tempIfpExpection);
ifpExpection.setShipmentXidOld(ifpShipment.getXid());
ifpExpection.setShipmentGidNew(newIfpShipment.getId());
ifpExpection.setShipmentXidNew(newIfpShipment.getXid());
IfpDriver ifpDriver = ifpDriverService.selectByPrimaryKey(dto.getDriverIdNew());
ifpExpection.setDriverGidNew(dto.getDriverIdNew());
ifpExpection.setDriverNameNew(ifpDriver.getName());
ifpExpection.setDriverPhoneNew(ifpDriver.getPhone());
IfpVehicle ifpVehicle = iIfpVehicleService.selectByPrimaryKey(dto.getVehicleIdNew());
ifpExpection.setVehicleIdNew(dto.getVehicleIdNew());
ifpExpection.setIpnNew(ifpVehicle.getLpn());
ifpExpectionService.updateByPrimaryKey(ifpExpection);
return null;
}
根据角色发送消息
@PostMapping({"/bindVehicleAndDriverRelation"})
public ResponseEntity<?> bindVehicleAndDriverRelation(@PathVariable Long organizationId, @RequestBody IfpVehicle ifpVehicle,Long driverId) {
try {
//绑定重复性校验
IfpDriverVehicleRelation relation = new IfpDriverVehicleRelation();
relation.setDriverGid(driverId);
relation.setVehicleLpn(ifpVehicle.getLpn());
List<IfpDriverVehicleRelation> relations = this.ifpDriverVehicleRelationService.selectOptional(relation,null);
if (relations != null && relations.size()>0) {
return Results.success(new HtmsResult(false, "车辆不允许重复提交"));
}
IfpVehicle vehicle = new IfpVehicle();
vehicle.setLpn(ifpVehicle.getLpn());
List<IfpVehicle> ifpVehicleList = this.ifpVehicleService.select(vehicle);
if (ifpVehicleList == null || ifpVehicleList.size() == 0) {
ifpVehicle.setTenantId(organizationId);
//道路运输证号(为空时不校验)不能与车辆表的其他数据重复
if (null != ifpVehicle.getTransportLicenseNo()){
IfpVehicle TransportCheck = new IfpVehicle();
TransportCheck.setTransportLicenseNo(ifpVehicle.getTransportLicenseNo());
TransportCheck.setVehicleStatus("APPROVED");
List<IfpVehicle> TransportCheckList = this.ifpVehicleService.selectOptional(TransportCheck,new Criteria(TransportCheck));
if (null == ifpVehicle.getId()){
if (TransportCheckList.size() > 0){
return Results.success(new HtmsResult(false, "该道路运输证号已被使用"));
}
} else {
if (TransportCheckList.size() > 1 ){
return Results.success(new HtmsResult(false, "该道路运输证号已被使用"));
}
if (TransportCheckList.size() ==1 && !TransportCheckList.get(0).getId().equals(ifpVehicle.getId()) ) {
return Results.success(new HtmsResult(false, "该道路运输证号已被使用"));
}
}
}
// 默认'PENDING'
ifpVehicle.setVehicleStatus("PENDING");
ifpVehicle.setSubmitDate(new Date(System.currentTimeMillis()));
this.ifpVehicleService.insert(ifpVehicle);
List<IfpVehicle> vehicleList = new ArrayList<>();
vehicleList.add(ifpVehicle);
sinoiovService.pushVehicle(vehicleList);
insertDriverVerhicleRelation(organizationId, ifpVehicle, driverId);
this.commonService.sendWebMessageByRole("IFP.VEHICLE_AUDIT_TODO","injayunw", ifpVehicle.getLpn());
return Results.success(new HtmsResult(true, "提交成功,请耐心等待审核!"));
}
if (ifpVehicleList.size()>1) {
return Results.error(new HtmsResult(false, "车辆"+ifpVehicle.getLpn()+"存在重复数据!"));
}
if (ifpVehicleList.size()==1) {
IfpVehicle ifpVehicle1 = ifpVehicleList.get(0);
insertDriverVerhicleRelation(organizationId, ifpVehicle1, driverId);
if ("NEW,REJECTED,LAPSE".indexOf(ifpVehicle1.getVehicleStatus())>-1){
ifpVehicle.setSubmitDate(new Date(System.currentTimeMillis()));
ifpVehicle.setAuditPersonId(null);
ifpVehicle.setAuditDate(null);
ifpVehicle.setRejectReason(null);
ifpVehicle1.setVehicleStatus("PENDING");
this.ifpVehicleService.updateOptional(ifpVehicle1);
this.commonService.sendWebMessageByRole("IFP.VEHICLE_AUDIT_TODO","injayunw", ifpVehicle1.getLpn());
return Results.success(new HtmsResult(true, "提交成功,请耐心等待审核!"));
}else{
return Results.success(new HtmsResult(true, "添加成功"));
}
}
OperationRecord operationRecord = OperationRecord.newInstance(organizationId, ifpVehicle.getId(), ifpVehicle.getXid(), "IfpDriver", null, "移动端-司机-新建车辆与司机关系:" + ifpVehicle.getName());
this.operationRecordService.insertUseExecutor(operationRecord);
} catch (Exception var4) {
var4.printStackTrace();
return Results.success(new HtmsResult(false, var4.getMessage()));
}
return Results.success(new HtmsResult(true, "添加成功"));
}
/**
* 根据角色代码及消息模版发送站内消息
* @param roleCode 角色代码
* @return 用户列表
*/
void sendWebMessageByRole(String templateCode, String roleCode, String content);
public void sendWebMessageByRole(String templateCode, String roleCode, String content) {
try {
Map<String, String> args = new HashMap<>();
args.put("content", content);
List<User> userList = this.getRoleUserList(roleCode);
List<Receiver> receiverList = new ArrayList<>();
for(User user : userList){
receiverList.add(new Receiver().setUserId(user.getId()).setTargetUserTenantId(1L));
}
this.messageClient.async().sendWebMessage(1L, templateCode, receiverList, args);
}catch (Exception e){
e.printStackTrace();
}
}
public List<User> getRoleUserList(String roleCode) {
try {
User queryUser = new User();
Criteria criteria = new Criteria(queryUser);
criteria.select("id", "organizationId");
criteria.setWhereSql("EXISTS (SELECT 1 FROM HZERO_PLATFORM.IAM_ROLE RL, HZERO_PLATFORM.IAM_MEMBER_ROLE MRL WHERE RL.CODE = '" + roleCode + "' AND RL.ID = MRL.ROLE_ID AND MRL.MEMBER_ID = A.ID)");
return userMapper.selectOptional(queryUser, criteria);
}catch (Exception e){
e.printStackTrace();
return new ArrayList<>();
}
}
/*
* 发送站内信通知
*/
Map<String, String> args = new HashMap<>();
args.put("name", companyApplication.getName());
args.put("rejectReason", rejectReason);
String lang = "zh_CN";
messageClient.async().sendWebMessage(DetailsHelper.getUserDetails().getTenantId(), "NF.OWNER_AUTH_FAILED", lang, Collections.singletonList(new Receiver().setUserId(DetailsHelper.getUserDetails().getUserId()).setTargetUserTenantId(DetailsHelper.getUserDetails().getTenantId())), args);
messageClient.async().sendSms(DetailsHelper.getUserDetails().getTenantId(), "HZERO", "NF.OWNER_AUTH_FAILED", lang, Collections.singletonList(new Receiver().setPhone(companyApplication.getPhone())), args);
【HZERO】消息发送的更多相关文章
- C#开发微信门户及应用(19)-微信企业号的消息发送(文本、图片、文件、语音、视频、图文消息等)
我们知道,企业号主要是面向企业需求而生的,因此内部消息的交流显得非常重要,而且发送.回复消息数量应该很可观,对于大企业尤其如此,因此可以结合企业号实现内部消息的交流.企业号具有关注安全.消息无限制等特 ...
- [UWP]UWP中获取联系人/邮件发送/SMS消息发送操作
这篇博客将介绍如何在UWP程序中获取联系人/邮件发送/SMS发送的基础操作. 1. 获取联系人 UWP中联系人获取需要引入Windows.ApplicationModel.Contacts名称空间. ...
- Kafka、RabbitMQ、RocketMQ消息中间件的对比 —— 消息发送性能-转自阿里中间件
引言 分布式系统中,我们广泛运用消息中间件进行系统间的数据交换,便于异步解耦.现在开源的消息中间件有很多,前段时间我们自家的产品 RocketMQ (MetaQ的内核) 也顺利开源,得到大家的关注. ...
- iOS开发小技巧--即时通讯项目:消息发送框(UITextView)高度的变化; 以及UITextView光标复位的小技巧
1.即时通讯项目中输入框(UITextView)跟随输入文字的增多,高度变化的实现 最主要的方法就是监听UITextView的文字变化的方法- (void)textViewDidChange:(UIT ...
- activemq安装与简单消息发送接收实例
安装环境:Activemq5.11.1, jdk1.7(activemq5.11.1版本需要jdk升级到1.7),虚拟机: 192.168.147.131 [root@localhost softwa ...
- eBay 消息发送(2)
1.简介 Call Index Doc: http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/index.html 消息发送主要 ...
- eBay 消息发送(1)
1.简介 Call Index Doc: http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/index.html 消息发送主要 ...
- twitter storm源码走读之2 -- tuple消息发送场景分析
欢迎转载,转载请注明出处源自徽沪一郎.本文尝试分析tuple发送时的具体细节,本博的另一篇文章<bolt消息传递路径之源码解读>主要从消息接收方面来阐述问题,两篇文章互为补充. worke ...
- ActiveMQ点对点的消息发送案例
公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...
- 高效的TCP消息发送组件
目前的.net 架构下缺乏高效的TCP消息发送组件,而这种组件是构建高性能分布式应用所必需的.为此我结合多年的底层开发经验开发了一个.net 下的高效TCP消息发送组件.这个组件在异步发送时可以达到每 ...
随机推荐
- 0x00.常用名词、文件下载、反弹shell
下载文章 方法一:下载谷歌插件fireshot,捕捉整个页面 方法二:使用js代码 f12进入控制台,粘贴如下代码 (function(){ $("#side").remove() ...
- Linux笔记03: Linux常用命令_3.3文件操作命令
3.3 文件操作命令 3.3.1 stat命令 ●命令名称:stat. ●英文原意:display file or file system status. ●所在路径:/usr/bin/stat. ● ...
- [VBA] 实现SQLserver数据库的增删改查
[VBA] 实现 SQLserver数据库的增删改查 问题背景 用于库存管理的简单Excel系统实现,能够让库管员录入每日出入库信息并进能够按日期查询导出数据,生成简要报表,以及数据修改与删除.非科班 ...
- Redis入门实践
安装Redis 下载:官网:https://redis.io/download/,选择稳定版下载. 上传至linux 解压Redis:tar -zxvf redis-6.2.7.tar.gz,得到: ...
- MySQL运维11-Mycat分库分表之应用指定分片
一.应用指定分片 此规则是在运行阶段有应用自主决定路由到那个分片,根据提供的字段,然后按照指定的规则,截取该字段的部分子字符串当做分片的依据,该分别方法比较灵活,适用于某个字段有几个特殊的字符串拼接而 ...
- 神经网络优化篇:如何理解 dropout(Understanding Dropout)
理解 dropout Dropout可以随机删除网络中的神经单元,为什么可以通过正则化发挥如此大的作用呢? 直观上理解:不要依赖于任何一个特征,因为该单元的输入可能随时被清除,因此该单元通过这种方式传 ...
- startx详解
linux下startx命令详解 用途 初始化一个 X 会话. 语法 startx [ -d Display:0 ] [ -t | -w ] [ -x Startup | [ -r Resources ...
- 斯坦福 UE4 C++ ActionRoguelike游戏实例教程 13.使用GameplayTag实现使用钥匙卡打开箱子
斯坦福课程 UE4 C++ ActionRoguelike游戏实例教程 0.绪论 概述 本篇文章将会展示Gameplay另一个用法,也就是我们最常见的使用特定道具交互特定的机关.例如本文要实现的,获得 ...
- 深入了解RC4 Drop加密技术
一.引言 在网络安全领域,加密技术始终是重中之重.随着计算机技术的发展,加密算法也在不断更新换代.RC4(Rivest Cipher 4)加密算法因其高效.简洁的特性,在信息安全领域得到了广泛的应用. ...
- Provider MVVM架构
MVVM架构分为M(Model).V(View).VM(ViewModel)三个部分,他们分别处理自己的分工,在View和Model之间使用ViewModel作为中介者,使View和Model不受业务 ...