Browse Source

修改给仓库管理员发送消息后无法存储到redis的bug

lwx_dev
erdanergou 3 years ago
parent
commit
ccfef76a72
  1. 15
      src/main/java/com/dreamchaser/depository_manage/config/PublicConfig.java
  2. 13
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 12
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  4. 4
      src/main/resources/templates/pages/application/application-review.html
  5. 6
      src/test/java/com/dreamchaser/depository_manage/SomeTest.java
  6. 4
      target/classes/templates/pages/application/application-review.html

15
src/main/java/com/dreamchaser/depository_manage/config/PublicConfig.java

@ -181,4 +181,19 @@ public class PublicConfig {
exs.shutdownNow(); exs.shutdownNow();
} }
} }
/**
* 用于获取Map<String,String>
* @param jsonObject
* @return
*/
public static Map<String,String> returnMapString(JSONObject jsonObject){
Map<String,String> stringObjectMap = new HashMap<>();
for (String next : jsonObject.keySet()) {
String value = String.valueOf(jsonObject.get(next));
stringObjectMap.put(next,value);
}
return stringObjectMap;
}
} }

13
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -1946,11 +1946,7 @@ public class PageController {
// 获取当前出库仓库是否为开放仓库 // 获取当前出库仓库是否为开放仓库
int flagForOpenDepository = recordP.getFlagForOpenDepository(); int flagForOpenDepository = recordP.getFlagForOpenDepository();
if (flagForOpenDepository == 2) { mv.addObject("depositoryManagerText", "负责人");
mv.addObject("depositoryManagerText", "部门负责人");
} else {
mv.addObject("depositoryManagerText", "仓储负责人");
}
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMinP> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(recordP.getId()); List<ApplicationOutRecordMinP> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(recordP.getId());
@ -2051,7 +2047,10 @@ public class PageController {
balancePosterName.append(user.getName()).append(","); balancePosterName.append(user.getName()).append(",");
} }
} }
recordP.setBalancePosterTime(DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getBalancePosterTime()))); String balancePosterTime = recordP.getBalancePosterTime();
if (balancePosterTime != null && !"".equals(balancePosterTime) && !"0".equals(balancePosterTime)) {
recordP.setBalancePosterTime(DateUtil.TimeStampToDateTime(Long.valueOf(balancePosterTime)));
}
} }
// 获取出库的所有仓库 // 获取出库的所有仓库
@ -3627,8 +3626,6 @@ public class PageController {
} }
// 用于展示库存数据 // 用于展示库存数据
@GetMapping("/toShowInventory") @GetMapping("/toShowInventory")
public ModelAndView toShowInventory(@RequestParam Map<String, String> param) { public ModelAndView toShowInventory(@RequestParam Map<String, String> param) {

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

@ -2410,7 +2410,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -2491,7 +2491,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -3472,7 +3472,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -3551,7 +3551,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -3950,7 +3950,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -4028,7 +4028,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map stringObjectMap = jsonObject.toJavaObject(Map.class); Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });

4
src/main/resources/templates/pages/application/application-review.html

@ -102,7 +102,7 @@
<tr id="balancePosterNameT" style="display: none"> <tr id="balancePosterNameT" style="display: none">
<td>负责人</td> <td>负责人</td>
<td id="balancePosterName" th:text="${record.getBalancePosterName()}">部门负责人</td> <td id="balancePosterName" th:text="${record.getBalancePosterName()}"></td>
</tr> </tr>
<tr id="balancePosterMessageT" style="display: none"> <tr id="balancePosterMessageT" style="display: none">
<td>审核意见</td> <td>审核意见</td>
@ -268,7 +268,7 @@
$("#balancePosterNameT").show(); $("#balancePosterNameT").show();
$("#reviewForBalance").show(); $("#reviewForBalance").show();
} else if(balancePosterTime !== null && balancePosterTime !== "0"){ } else if(balancePosterTime !== null && balancePosterTime !== "0" && balancePosterTime !== ""){
$("#depositoryManagerNameT").show(); $("#depositoryManagerNameT").show();
$("#balancePosterNameT").show(); $("#balancePosterNameT").show();
$("#balancePosterMessageT").show(); $("#balancePosterMessageT").show();

6
src/test/java/com/dreamchaser/depository_manage/SomeTest.java

@ -314,4 +314,10 @@ public class SomeTest {
} }
@Test
public void tes(){
Integer a = 1;
System.out.println(String.valueOf(a));
}
} }

4
target/classes/templates/pages/application/application-review.html

@ -102,7 +102,7 @@
<tr id="balancePosterNameT" style="display: none"> <tr id="balancePosterNameT" style="display: none">
<td>负责人</td> <td>负责人</td>
<td id="balancePosterName" th:text="${record.getBalancePosterName()}">部门负责人</td> <td id="balancePosterName" th:text="${record.getBalancePosterName()}"></td>
</tr> </tr>
<tr id="balancePosterMessageT" style="display: none"> <tr id="balancePosterMessageT" style="display: none">
<td>审核意见</td> <td>审核意见</td>
@ -268,7 +268,7 @@
$("#balancePosterNameT").show(); $("#balancePosterNameT").show();
$("#reviewForBalance").show(); $("#reviewForBalance").show();
} else if(balancePosterTime !== null && balancePosterTime !== "0"){ } else if(balancePosterTime !== null && balancePosterTime !== "0" && balancePosterTime !== ""){
$("#depositoryManagerNameT").show(); $("#depositoryManagerNameT").show();
$("#balancePosterNameT").show(); $("#balancePosterNameT").show();
$("#balancePosterMessageT").show(); $("#balancePosterMessageT").show();

Loading…
Cancel
Save