|
@@ -1,5 +1,6 @@
|
|
|
package com.example.nngkxxdp.service.impl;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.example.nngkxxdp.dao.ArticleDao;
|
|
|
+import com.example.nngkxxdp.dao.SmsMessageDao;
|
|
|
import com.example.nngkxxdp.entity.Article;
|
|
|
import com.example.nngkxxdp.service.ArticleService;
|
|
|
import com.example.nngkxxdp.util.Blank;
|
|
@@ -25,6 +27,9 @@ import com.example.nngkxxdp.util.SendUtil;
|
|
|
public class ArticleServiceImpl implements ArticleService {
|
|
|
@Resource
|
|
|
private ArticleDao articleDao;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SmsMessageDao smsMessageDao;
|
|
|
|
|
|
/**
|
|
|
* 通过ID查询单条数据
|
|
@@ -280,4 +285,48 @@ public class ArticleServiceImpl implements ArticleService {
|
|
|
|
|
|
return SendUtil.send(true, "", articleDao.getNewestOrHotArticle(articleType));
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getAllOfficialAccount() {
|
|
|
+ Integer num = 8;
|
|
|
+ List<Map<String, Object>> ofaList = smsMessageDao.getAllOfa();
|
|
|
+ List<Map<String, Object>> list = smsMessageDao.getAllOfaList(num);
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ JSONArray array;
|
|
|
+ if (Blank.notBlank(list)) {
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ String name = String.valueOf(map.get("officialAccount"));
|
|
|
+ if (Blank.isEmpty(obj.get(name))) {
|
|
|
+ array = new JSONArray();
|
|
|
+ } else {
|
|
|
+ array = obj.getJSONArray(name);
|
|
|
+ }
|
|
|
+ if (array.size() < num) {
|
|
|
+ array.add(map);
|
|
|
+ obj.put(name, array);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.notBlank(ofaList)) {
|
|
|
+ for (Map<String, Object> map : ofaList) {
|
|
|
+ map.remove("leadName");
|
|
|
+ map.remove("staffName");
|
|
|
+ map.remove("staffPhone");
|
|
|
+ map.remove("leadPhone");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("ofa", ofaList);
|
|
|
+ map.put("array", obj);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getOffocoalAccountByPaging(Map<String, Object> map) {
|
|
|
+ Integer count = smsMessageDao.getCountOffocoalAccount(map);
|
|
|
+ if (!Blank.notBlank(count) || count == 0) {
|
|
|
+ return SendUtil.layuiTable(0, null);
|
|
|
+ }
|
|
|
+ return SendUtil.layuiTable(count, smsMessageDao.getOffocoalAccountByPaging(map));
|
|
|
+ }
|
|
|
}
|