|
@@ -15,6 +15,7 @@ import cn.com.ty.lift.business.project.dao.entity.model.response.ProjectUserResp
|
|
|
import cn.com.ty.lift.business.project.dao.mapper.ProjectMapper;
|
|
|
import cn.com.ty.lift.business.push.service.PushUserService;
|
|
|
import cn.com.ty.lift.common.base.ExportRequest;
|
|
|
+import cn.com.ty.lift.common.constants.CommonEnum;
|
|
|
import cn.com.ty.lift.common.constants.CommonEnum.ProjectStatus;
|
|
|
import cn.com.ty.lift.common.export.ExportUtils;
|
|
|
import cn.com.ty.lift.common.model.PushMessage;
|
|
@@ -91,6 +92,61 @@ public class ProjectService extends ServiceImpl<ProjectMapper,Project> {
|
|
|
put("endDate", "结束时间");
|
|
|
}};
|
|
|
|
|
|
+ /**
|
|
|
+ * @return 项目列表
|
|
|
+ * @description 查询项目列表
|
|
|
+ * @date 2020/2/9 4:02 下午
|
|
|
+ */
|
|
|
+ public List<Project> queryProjectList() {
|
|
|
+ LambdaQueryWrapper<Project> lambdaQueryWrapper = new QueryWrapper<Project>().lambda();
|
|
|
+ lambdaQueryWrapper.lt(Project::getEndDate, LocalDate.now());
|
|
|
+ lambdaQueryWrapper.eq(Project::getProjectStatus, ProjectStatus.IN_SERVICE.getCode());
|
|
|
+ return list(lambdaQueryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param list 项目列表
|
|
|
+ * @description 更新项目状态
|
|
|
+ * @date 2020/2/10 4:16 下午
|
|
|
+ */
|
|
|
+ public void updateBatch(List<Project> list) {
|
|
|
+ list.forEach(project -> project.setProjectStatus(CommonEnum.ProjectStatus.OVERDUE.getCode()));
|
|
|
+ updateBatchById(list, list.size());
|
|
|
+ log.info("批量更新项目状态" + list.size() + "条");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param projectId 项目ID
|
|
|
+ * @param mtCompanyId 公司ID
|
|
|
+ * @return
|
|
|
+ * @description 项目逾期消息推送
|
|
|
+ * @date 2020/5/5 9:26 下午
|
|
|
+ */
|
|
|
+ public void sendOverdueMessage(Long projectId, Long mtCompanyId) {
|
|
|
+ //消息推送
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
+ Region region = pushUserService.findRegionByProject(projectId, mtCompanyId);
|
|
|
+ if (Objects.nonNull(region)) {
|
|
|
+ userIds.addAll(region.members());
|
|
|
+ }
|
|
|
+ List<PushUserInfo> director = pushUserService.listEnterpriseAdmin(mtCompanyId);
|
|
|
+ List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
+ List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
+ pushUserInfos.addAll(userInfos);
|
|
|
+ }
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
+ ProjectDetailResponse detail = projectAppService.detail(projectId);
|
|
|
+ PushMessage pushMessage = PushMessage.workProjectOverdue(detail.getAreaName(), detail.getProjectName());
|
|
|
+ pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfos);
|
|
|
+ List<Long> sendToUserIdList = pushUserInfos.stream().map(PushUserInfo::getUserId).collect(Collectors.toList());
|
|
|
+ //推送pc端
|
|
|
+ SendMessageUtil.sendMessageToPC(jmsMessagingTemplate, sendToUserIdList, pushMessage.getContent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @param request 项目列表查询条件
|
|
|
* @return RestResponse 结果集
|