Browse Source

添加发送出库消息后添加到redis中的功能

lwx_dev
erdanergou 3 years ago
parent
commit
6c1919fff8
  1. 42
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  2. 3
      src/test/java/com/dreamchaser/depository_manage/OtherTest.java

42
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -2075,6 +2075,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
redisPool.getRedisTemplateByDb(15).opsForHash().put(key, "minRecord", minRecord);
}
// 删除在redis中的key
String redisOutKey = "wms_notificationOut_" + id;
redisPool.getRedisTemplateByDb(14).delete(redisOutKey);
// 获取出库仓库信息
Depository depositoryRecordById = depositoryMapper.findDepositoryById(applicationOutMinById.getDepositoryId());
// 设置子订单新编码
@ -2318,6 +2324,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 开启线程向仓库管理员发送消息
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
} else {
// 如果是通过仓库
@ -2371,6 +2381,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
}
@ -2929,8 +2943,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
s = "PangFuZhen,";
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token);
});
}
else {
} else {
String result = "";
// 开启线程更改其他用户卡片模板样式
String simpleTime = DateUtil.getSimpleTime(new Date());
@ -3045,9 +3058,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 开启线程向仓库管理员发送消息
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
}
else {
} else {
// 如果是通过仓库
@ -3098,6 +3114,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 开启线程向仓库管理员发送消息
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
}
}
@ -3366,8 +3386,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("state", "部门负责人审核未通过");
}
}
else {
} else {
// 如果是仓储中心负责人
// 获取点击的按钮类型
String clickKey = templateCard.getEventKey().split("_")[1];
@ -3469,9 +3488,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 开启线程向仓库管理员发送消息
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
}
else {
} else {
// 如果是通过仓库
@ -3522,6 +3544,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 开启线程向仓库管理员发送消息
SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey,stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey,72,TimeUnit.HOURS);
});
}
}

3
src/test/java/com/dreamchaser/depository_manage/OtherTest.java

@ -99,8 +99,7 @@ public class OtherTest {
@Test
public void someTest(){
Object usertoken = redisPool.getRedisTemplateByDb(5).opsForHash().get("HXGK_GO_ZhixingCollege:ScanCode:Authentication:LoginApi_dev_e3bfa398fe9d0e1ab78a00ff59eff788", "usertoken");
System.out.println(usertoken);
}
@Test

Loading…
Cancel
Save