|
@@ -1,7 +1,12 @@
|
|
|
package com.example.nngkxxdp.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import com.example.nngkxxdp.dao.ColumnDao;
|
|
|
+import com.example.nngkxxdp.dao.DeptDao;
|
|
|
+import com.example.nngkxxdp.dao.HlwInterfaceDao;
|
|
|
import com.example.nngkxxdp.dao.UpdateStateDao;
|
|
|
import com.example.nngkxxdp.service.UpdateStateService;
|
|
|
+import com.example.nngkxxdp.util.ArrayUtil;
|
|
|
import com.example.nngkxxdp.util.Blank;
|
|
|
import com.example.nngkxxdp.util.ConstStr;
|
|
|
|
|
@@ -10,6 +15,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
@@ -32,11 +38,26 @@ public class UpdateStateServiceImpl implements UpdateStateService {
|
|
|
@Autowired
|
|
|
UpdateStateDao updateStateDao;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private HlwInterfaceDao hlwInterfaceDao;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ColumnDao columnDao;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> getSpecialState() {
|
|
|
Map<String, Object> result = new HashMap();
|
|
|
- List<Map<String, Object>> map = updateStateDao.SpecialStateSum();
|
|
|
+// List<Map<String, Object>> map = updateStateDao.SpecialStateSum();
|
|
|
+ List<Map<String, Object>> columns = columnDao.getColumnByType(1);
|
|
|
+ ArrayList<String> columnIds = new ArrayList<>();
|
|
|
+ for (int i = 0; i < columns.size(); i++) {
|
|
|
+ Map<String, Object> map = columns.get(i);
|
|
|
+ columnIds.add(Convert.toStr(map.get("chnlid")));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> map = hlwInterfaceDao.getColumnUpdateInfo(columnIds);
|
|
|
result.put("result", map);
|
|
|
+ result.put("columns", columns);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -128,7 +149,39 @@ public class UpdateStateServiceImpl implements UpdateStateService {
|
|
|
result.put("listDate", listDate);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getDetailSpecialStateNew(String columnId) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ List<Integer> listCount = new ArrayList<>();
|
|
|
+ List<String> dateList = getDateList(30);
|
|
|
+ List<Map<String, Object>> list = hlwInterfaceDao.countArticleBycolumnIdAndDates(dateList, columnId);
|
|
|
+ Map<String, Object> updateCountMap = ArrayUtil.listConvertMap(list, "date", "count");
|
|
|
+
|
|
|
+ for (int i = 0; i < dateList.size(); i++) {
|
|
|
+ String key = dateList.get(i);
|
|
|
+ listCount.add(Convert.toInt(updateCountMap.get(key), 0));
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("listDate", dateList);
|
|
|
+ map.put("listCount", listCount);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成今天之前指定天数,指定格式的日期(不包括当天)
|
|
|
+ * @param days
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static List<String> getDateList(Integer days) {
|
|
|
+ List<String> res = new ArrayList<>();
|
|
|
+ Date date = new Date();
|
|
|
+ for (int i = days - 1; i >= 0; i--) {
|
|
|
+ res.add(DateUtil.offsetDay(date, -i).toString("yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
System.err.println(DateUtil.weekOfYear(DateUtil.parse("2021-09-29")));
|
|
|
}
|