【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消息发送组件.这个组件在异步发送时可以达到每 ...
随机推荐
- Spring Boot 关闭 Actuator ,满足安全工具扫描
应用被安全工具,扫描出漏洞信息 [MSS]SpringBoot Actuator敏感接口未授权访问漏洞(Actuator)事件发现通告: 发现时间:2023-11-25 19:47:17 攻击时间:2 ...
- Batrix企业能力库之物流交易域能力建设实践
简介 Batrix企业能力库,是京东物流战略级项目-技术中台架构升级项目的基础底座.致力于建立企业级业务复用能力平台,依托能力复用业务框架Batrix,通过通用能力/扩展能力的定义及复用,灵活支持业务 ...
- Python 实现Word转HTML
将Word转换为HTML能将文档内容发布在网页上,这样,用户就可以通过浏览器直接查看或阅读文档而无需安装特定的软件.Word转HTML对于在线发布信息.创建在线文档库以及构建交互式网页应用程序都非常有 ...
- 0x04.信息收集
探针 被动:借助网上的一些接口查询或者网上已经获取到的,查看历史信息. 主动:使用工具,从本地流量出发,探测目标信息,会发送大量流量到对方服务器上. 谷歌语法 懒人语法:https://pentest ...
- Quartz核心原理之架构及基本元素介绍
1 什么是Quartz Quartz是一个作业调度框架,它可以与J2EE和J2SE应用相结合,也可以单独使用.它能够创建多个甚至数万个jobs这样复杂的程序,jobs可以做成标准的java组件或EJB ...
- 将mysql的输出文本写回mysql
1 准备工作 1.1 环境准备 操作系统:Microsoft Windows 10 专业工作站版 软件版本:Python 3.9.6 第三方包: pip install pandas2.1.0 pip ...
- 如何根据月份查询每月Xxx的总数
我以我的项目根据月份查询每月新增会员的总数为例 Controller @GetMapping("/getMemberReport.do") public R getMemberRe ...
- 探索 ECMAScript 2023 中的新数组方法
前言 ECMAScript 2023 引入了一些新功能,以改进语言并使其更加强大和无缝.这个新版本带来了令人兴奋的功能和新的 JavaScript 数组方法,使使用 JavaScript 编程更加愉快 ...
- 【UniApp】-uni-app-自定义组件
前言 经过上个章节的介绍,大家可以了解到 uni-app-网络请求的基本使用方法 那本章节来给大家介绍一下 uni-app-自定义组件 的基本使用方法 原本打算是直接写项目的,在写项目之前还有个内容需 ...
- django-celery-results - 使用 Django ORM/Cache 作为结果后端
https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html#django-celery-results-using-t ...