|
@@ -1,15 +1,14 @@
|
|
package com.boman.web.core.service.bomanMessageReceive;
|
|
package com.boman.web.core.service.bomanMessageReceive;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.boman.common.core.utils.DateUtils;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
import com.boman.domain.dto.AjaxResult;
|
|
import com.boman.domain.dto.AjaxResult;
|
|
import com.boman.web.core.service.select.IBaseSelectService;
|
|
import com.boman.web.core.service.select.IBaseSelectService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author tjf
|
|
* @author tjf
|
|
@@ -45,4 +44,46 @@ public class BomanMessageReceiveServiceImpl implements IBomanMessageReceiveServi
|
|
}
|
|
}
|
|
return Objects.requireNonNull(AjaxResult.success().put("receiveUserNameList", receiveUserNameList)).put("receiveDeptNameList",receiveDeptNameList);
|
|
return Objects.requireNonNull(AjaxResult.success().put("receiveUserNameList", receiveUserNameList)).put("receiveDeptNameList",receiveDeptNameList);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 小程序首页统计
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult getIndexInfo(String userId) {
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("send_user_id",userId);
|
|
|
|
+ //备注,boman_message表中create_time需要在gen_table_column中设置like
|
|
|
|
+ jsonObject.put("create_time", DateUtils.getDate());
|
|
|
|
+ jsonObject.put("message_situation","1");
|
|
|
|
+ //查询今日发文
|
|
|
|
+ List<JSONObject> bomanMessage = selectService.getByMap("boman_message", jsonObject);
|
|
|
|
+ long toDaySend = 0;
|
|
|
|
+ if (bomanMessage != null && bomanMessage.size() > 0){
|
|
|
|
+ toDaySend = bomanMessage.size();
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObjectTwo = new JSONObject();
|
|
|
|
+ jsonObjectTwo.put("receive_user_id",userId);
|
|
|
|
+ jsonObjectTwo.put("visible","Y");
|
|
|
|
+ List<JSONObject> bomanMessageReceive = selectService.getByMap("boman_message_receive", jsonObjectTwo);
|
|
|
|
+ long unread = 0L;
|
|
|
|
+ long read = 0L;
|
|
|
|
+ long todayReceipt = 0L;
|
|
|
|
+ if (bomanMessageReceive != null && bomanMessageReceive.size() > 0){
|
|
|
|
+ //未读
|
|
|
|
+ unread = bomanMessageReceive.stream().filter(e -> e.get("status") == "N").count();
|
|
|
|
+ //已读
|
|
|
|
+ read = bomanMessageReceive.stream().filter(e -> e.get("status") == "Y").count();
|
|
|
|
+ //今日收文
|
|
|
|
+ todayReceipt = bomanMessageReceive.stream().filter(e -> DateUtils.formatDate(e.get("send_message_time"), DateUtils.YYYY_MM_DD).equals(DateUtils.getDate())).count();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Long> map = new HashMap<>();
|
|
|
|
+ map.put("toDaySend", toDaySend);
|
|
|
|
+ map.put("unread", unread);
|
|
|
|
+ map.put("read", read);
|
|
|
|
+ map.put("todayReceipt", todayReceipt);
|
|
|
|
+ return AjaxResult.success(map);
|
|
|
|
+ }
|
|
}
|
|
}
|