|
@@ -21,10 +21,7 @@ import com.ym.mec.biz.dal.entity.InspectionItemPlan;
|
|
|
import com.ym.mec.biz.service.InspectionItemPlanService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -148,18 +145,24 @@ public class InspectionItemPlanServiceImpl extends BaseServiceImpl<Long, Inspect
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public List<InspectionItemPlan> pushNotice() {
|
|
|
List<InspectionItemPlan> startPlans = inspectionItemPlanDao.getStartPlan(new Date());
|
|
|
- Map<Integer, List<InspectionItemPlan>> userPlanMap = startPlans.stream().collect(Collectors.groupingBy(InspectionItemPlan::getUserId));
|
|
|
- userPlanMap.forEach((userId, plans) -> {
|
|
|
- //push
|
|
|
-// Map<Integer, String> userMap = new HashMap<>(1);
|
|
|
-// userMap.put(userId, userId.toString());
|
|
|
-// sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
-// MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, userMap, null, 0, "1", "STUDENT",
|
|
|
-// studentRegistration.getName(), studentPaymentOrder.getActualAmount());
|
|
|
-
|
|
|
- });
|
|
|
+ Set<Integer> userIds = startPlans.stream().map(InspectionItemPlan::getUserId).collect(Collectors.toSet());
|
|
|
+ List<Long> ids = startPlans.stream().map(InspectionItemPlan::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ inspectionItemPlanDao.updatePushedStatus(ids);
|
|
|
+
|
|
|
+ //发送推送信息
|
|
|
+ Map<Integer, String> userMap = new HashMap<>();
|
|
|
+ for (Integer userId : userIds) {
|
|
|
+ userMap.put(userId, userId.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
|
|
|
+ String pushUrl = baseApiUrl + "/#/musicInspection";
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_INSPECTION_NOTICE,
|
|
|
+ userMap, null, 0, "8?" + pushUrl, "EDU_TEACHER");
|
|
|
return startPlans;
|
|
|
}
|
|
|
}
|