|
@@ -103,6 +103,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
|
|
redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 发送归还提醒
|
|
|
|
|
+ * @param messageId
|
|
|
|
|
+ */
|
|
|
private void sendReminderMessage(String messageId) {
|
|
private void sendReminderMessage(String messageId) {
|
|
|
Long materialsLoanId = messages.get(messageId);
|
|
Long materialsLoanId = messages.get(messageId);
|
|
|
if (materialsLoanId != null) {
|
|
if (materialsLoanId != null) {
|
|
@@ -112,9 +116,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
IsMaterialsLoan materialsLoan = getById(materialsLoanId);
|
|
IsMaterialsLoan materialsLoan = getById(materialsLoanId);
|
|
|
if (materialsLoan != null) {
|
|
if (materialsLoan != null) {
|
|
|
// 1.1数据存在开始判断消息是否需要发送
|
|
// 1.1数据存在开始判断消息是否需要发送
|
|
|
- if (materialsLoan.getRestitutionUserId() == null
|
|
|
|
|
- && materialsLoan.getActualRestitutionTime() == null
|
|
|
|
|
- && materialsLoan.getRestitutionToId() == null) {
|
|
|
|
|
|
|
+ // if (materialsLoan.getRestitutionUserId() == null
|
|
|
|
|
+ // && materialsLoan.getActualRestitutionTime() == null
|
|
|
|
|
+ // && materialsLoan.getRestitutionToId() == null) {
|
|
|
|
|
+ if (!"1".equals(materialsLoan.getStatus())) {
|
|
|
// 没有归还则需要开始新增提醒消息
|
|
// 没有归还则需要开始新增提醒消息
|
|
|
IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
@@ -145,7 +150,12 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
|
|
redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void sendAlarmMessage(String messageId) {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 发送归还报警
|
|
|
|
|
+ * @param messageId
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void sendAlarmMessage(String messageId) {
|
|
|
Long materialsLoanId = messages.get(messageId);
|
|
Long materialsLoanId = messages.get(messageId);
|
|
|
if (materialsLoanId != null) {
|
|
if (materialsLoanId != null) {
|
|
|
// 发送消息的逻辑
|
|
// 发送消息的逻辑
|
|
@@ -154,9 +164,11 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
IsMaterialsLoan materialsLoan = getById(materialsLoanId);
|
|
IsMaterialsLoan materialsLoan = getById(materialsLoanId);
|
|
|
if (materialsLoan != null) {
|
|
if (materialsLoan != null) {
|
|
|
// 1.1数据存在开始判断消息是否需要发送
|
|
// 1.1数据存在开始判断消息是否需要发送
|
|
|
- if (materialsLoan.getRestitutionUserId() == null
|
|
|
|
|
- && materialsLoan.getActualRestitutionTime() == null
|
|
|
|
|
- && materialsLoan.getRestitutionToId() == null) {
|
|
|
|
|
|
|
+ // if (materialsLoan.getRestitutionUserId() == null
|
|
|
|
|
+ // && materialsLoan.getActualRestitutionTime() == null
|
|
|
|
|
+ // && materialsLoan.getRestitutionToId() == null) {
|
|
|
|
|
+
|
|
|
|
|
+ if (!"1".equals(materialsLoan.getStatus())) {
|
|
|
// 没有归还则需要开始新增提醒消息
|
|
// 没有归还则需要开始新增提醒消息
|
|
|
IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
@@ -171,6 +183,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
isMaterialsReminder.setReminderType(1);
|
|
isMaterialsReminder.setReminderType(1);
|
|
|
isMaterialsReminder.setReadFlag(0);
|
|
isMaterialsReminder.setReadFlag(0);
|
|
|
iIsMaterialsReminderService.save(isMaterialsReminder);
|
|
iIsMaterialsReminderService.save(isMaterialsReminder);
|
|
|
|
|
+ // 更新借出记录为-超时未归还
|
|
|
|
|
+ update(Wrappers.<IsMaterialsLoan>lambdaUpdate()
|
|
|
|
|
+ .eq(IsMaterialsLoan::getMaterialsLoanId, materialsLoanId)
|
|
|
|
|
+ .set(IsMaterialsLoan::getStatus, 2));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -345,6 +361,7 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
.eq(IsMaterialsLoan::getMaterialsLoanId, loanList.get(0).getMaterialsLoanId())
|
|
.eq(IsMaterialsLoan::getMaterialsLoanId, loanList.get(0).getMaterialsLoanId())
|
|
|
.set(IsMaterialsLoan::getRestitutionUserId, dto.getRestitutionUserId())
|
|
.set(IsMaterialsLoan::getRestitutionUserId, dto.getRestitutionUserId())
|
|
|
.set(IsMaterialsLoan::getRestitutionToId, dto.getRestitutionToId())
|
|
.set(IsMaterialsLoan::getRestitutionToId, dto.getRestitutionToId())
|
|
|
|
|
+ .set(IsMaterialsLoan::getStatus, 1)
|
|
|
.set(IsMaterialsLoan::getActualRestitutionTime, new Date()));
|
|
.set(IsMaterialsLoan::getActualRestitutionTime, new Date()));
|
|
|
// 3.开始更新物资信息
|
|
// 3.开始更新物资信息
|
|
|
isMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()
|
|
isMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()
|