|
|
@@ -31,10 +31,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.Instant;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
@@ -56,7 +55,7 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
private IIsMaterialsTypeService isMaterialsTypeService;
|
|
|
@Resource
|
|
|
private NotifySendService notifySendService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private IIsMaterialsReminderService iIsMaterialsReminderService;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -122,13 +121,13 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
// && materialsLoan.getRestitutionToId() == null) {
|
|
|
if (!"1".equals(materialsLoan.getStatus())) {
|
|
|
// 没有归还则需要开始新增提醒消息
|
|
|
- // IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
- // Map<String, Object> templateParams = new HashMap<>();
|
|
|
- // templateParams.put("借出时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getLoanTime()));
|
|
|
- // templateParams.put("物资", materials.getMaterialsName());
|
|
|
- // templateParams.put("归还时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getRestitutionTime()));
|
|
|
- // notifySendService.sendSingleNotifyToMember(materialsLoan.getLoanUserId(),
|
|
|
- // "REMINDER_RETURN", templateParams);
|
|
|
+ IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
+ templateParams.put("借出时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getLoanTime()));
|
|
|
+ templateParams.put("物资", materials.getMaterialsName());
|
|
|
+ templateParams.put("归还时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getRestitutionTime()));
|
|
|
+ notifySendService.sendSingleNotifyToMember(materialsLoan.getLoanUserId(),
|
|
|
+ "REMINDER_RETURN", templateParams);
|
|
|
|
|
|
// 存储到is_materials_reminder
|
|
|
IsMaterialsReminder isMaterialsReminder = new IsMaterialsReminder();
|
|
|
@@ -156,6 +155,7 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
* 发送归还报警
|
|
|
* @param messageId
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
public void sendAlarmMessage(String messageId) {
|
|
|
Long materialsLoanId = messages.get(messageId);
|
|
|
if (materialsLoanId != null) {
|
|
|
@@ -171,13 +171,13 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
|
|
|
if (!"1".equals(materialsLoan.getStatus())) {
|
|
|
// 没有归还则需要开始新增提醒消息
|
|
|
- //IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
- //Map<String, Object> templateParams = new HashMap<>();
|
|
|
- //templateParams.put("借出时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getLoanTime()));
|
|
|
- //templateParams.put("物资", materials.getMaterialsName());
|
|
|
- //templateParams.put("归还时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getRestitutionTime()));
|
|
|
- //notifySendService.sendSingleNotifyToMember(materialsLoan.getLoanUserId(),
|
|
|
- // "ALARM_RETURN", templateParams);
|
|
|
+ IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
+ templateParams.put("借出时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getLoanTime()));
|
|
|
+ templateParams.put("物资", materials.getMaterialsName());
|
|
|
+ templateParams.put("归还时间", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialsLoan.getRestitutionTime()));
|
|
|
+ notifySendService.sendSingleNotifyToMember(materialsLoan.getLoanUserId(),
|
|
|
+ "ALARM_RETURN", templateParams);
|
|
|
|
|
|
// 存储到is_materials_reminder
|
|
|
IsMaterialsReminder isMaterialsReminder = new IsMaterialsReminder();
|
|
|
@@ -288,7 +288,6 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
|
|
|
if (materials != null && materials.getAvailableTimes() != null) {
|
|
|
set.set(IsMaterials::getLoanState, materials.getAvailableTimes() - 1);
|
|
|
}
|
|
|
- isMaterialsService.update(set);
|
|
|
return i;
|
|
|
}
|
|
|
|