|
@@ -8,9 +8,12 @@ import com.sooka.sponest.data.index.domain.MenuInfo;
|
|
|
import com.sooka.sponest.data.index.mapper.IndexViewMapper;
|
|
|
import com.sooka.sponest.data.index.service.IndexViewService;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@@ -66,8 +69,7 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<IndexViewInfo> getBasicDataList() {
|
|
|
- MenuInfo menu = new MenuInfo();
|
|
|
+ public List<IndexViewInfo> getBasicDataList(MenuInfo menu) {
|
|
|
setSookaDataBase(menu);
|
|
|
List<IndexViewInfo> basicList = new ArrayList<>();
|
|
|
|
|
@@ -107,6 +109,7 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
|
|
|
String subclass = entry.getKey();
|
|
|
IndexViewInfo indexViewInfo = new IndexViewInfo();
|
|
|
indexViewInfo.setCount(0L);
|
|
|
+ indexViewInfo.setUpdataCount(0L);
|
|
|
|
|
|
// 分类名称映射
|
|
|
Map<String, String> categoryMap = new HashMap<>();
|
|
@@ -124,8 +127,17 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
|
|
|
|
|
|
List<MenuInfo> menuInfos = entry.getValue();
|
|
|
for (MenuInfo menuInfo : menuInfos) {
|
|
|
+ setSookaDataBase(menuInfo);
|
|
|
Long dataCount = indexViewMapper.getBasicDataCount(menuInfo);
|
|
|
indexViewInfo.setCount(indexViewInfo.getCount() + dataCount);
|
|
|
+ MenuInfo menuInfo1 = new MenuInfo();
|
|
|
+ setSookaDataBase(menuInfo1);
|
|
|
+ BeanUtils.copyProperties(menuInfo, menuInfo1);
|
|
|
+ menuInfo1.setStartDate(menu.getStartDate());
|
|
|
+ menuInfo1.setEndDate(menu.getEndDate());
|
|
|
+ Long updateCount = indexViewMapper.getBasicDataCount(menuInfo1);
|
|
|
+ indexViewInfo.setUpdataCount(indexViewInfo.getUpdataCount() + updateCount);
|
|
|
+
|
|
|
}
|
|
|
basicList.add(indexViewInfo);
|
|
|
}
|
|
@@ -213,8 +225,9 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Long> systemInfoReport() {
|
|
|
+ MenuInfo menu = new MenuInfo();
|
|
|
// 1.基础数据
|
|
|
- List<IndexViewInfo> basicDataList = this.getBasicDataList();
|
|
|
+ List<IndexViewInfo> basicDataList = this.getBasicDataList(menu);
|
|
|
// 2.四长人数、巡护距离
|
|
|
Map<String, Long> siZhang = this.getAllSiZhangNum();
|
|
|
Map<String, Long> fourLengthPatrolDistance = this.getFourLengthPatrolDistance();
|
|
@@ -292,5 +305,77 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
|
|
|
list.forEach(a -> map.put(MapUtils.getString(a, "name"), MapUtils.getLong(a, "num")));
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 数据中心-数据统计
|
|
|
+ *
|
|
|
+ * @author 韩福成
|
|
|
+ * @date 2023/11/3 11:19
|
|
|
+ */
|
|
|
+ public List<Map<String,Object>> dataStatistics(MenuInfo menuInfo) {
|
|
|
+ List<Map<String,Object>> list = new ArrayList<>();
|
|
|
+ setSookaDataBase(menuInfo);
|
|
|
+ // 获取菜单信息
|
|
|
+ List<MenuInfo> basicDataList = indexViewMapper.getBasicDataList(menuInfo);
|
|
|
+ /*List<MenuInfo> basicDataList = new ArrayList<>();
|
|
|
+ MenuInfo info = new MenuInfo();
|
|
|
+ info.setTableNameAndType("centerdata_t_emergency_team");
|
|
|
+ basicDataList.add(info);*/
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("铁东区","0,100,365,372");
|
|
|
+ map.put("铁西区","0,100,365,373");
|
|
|
+ map.put("双辽市","0,100,365,369");
|
|
|
+ map.put("伊通县","0,100,365,370");
|
|
|
+ map.put("梨树县","0,100,365,371");
|
|
|
+ for (Map.Entry<String, Object> m : map.entrySet()){
|
|
|
+ Map<String,Object> td = new HashMap<>();
|
|
|
+ Long updateCount = 0L;
|
|
|
+ Long count = 0L;
|
|
|
+ for (MenuInfo item : basicDataList) {
|
|
|
+ String[] tableNameAndType = item.getTableNameAndType().split("/");
|
|
|
+ item.setTableName(tableNameAndType[0]);
|
|
|
+ item.setDeptIds(String.valueOf(m.getValue()));
|
|
|
+ setSookaDataBase(item);
|
|
|
+ //总数
|
|
|
+ count += indexViewMapper.getBasicDataCount(item);
|
|
|
+ //更新数
|
|
|
+ MenuInfo info1 = new MenuInfo();
|
|
|
+ setSookaDataBase(info1);
|
|
|
+ BeanUtils.copyProperties(item,info1);
|
|
|
+ info1.setStartDate(menuInfo.getStartDate());
|
|
|
+ info1.setEndDate(menuInfo.getEndDate());
|
|
|
+ updateCount += indexViewMapper.getBasicDataCount(info1);
|
|
|
+ }
|
|
|
+ td.put("name",m.getKey());
|
|
|
+ td.put("count",count);
|
|
|
+ td.put("updateCount",updateCount);
|
|
|
+ BigDecimal updateRate = new BigDecimal(0);
|
|
|
+ if (updateCount!=0) {
|
|
|
+ BigDecimal counts = new BigDecimal(count);
|
|
|
+ BigDecimal updateCounts = new BigDecimal(updateCount);
|
|
|
+ updateRate = updateCounts.divide(counts,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ td.put("updateRate",updateRate+"%");
|
|
|
+ list.add(td);
|
|
|
+ }
|
|
|
+ List<IndexViewInfo> indexViewInfoList = this.getBasicDataList(menuInfo);
|
|
|
+ for (IndexViewInfo indexViewInfo : indexViewInfoList){
|
|
|
+ Map<String,Object> map1 = new HashMap<>();
|
|
|
+ if (!indexViewInfo.getCategory().equals("共有基础数据类型")){
|
|
|
+ map1.put("name",indexViewInfo.getCategory());
|
|
|
+ map1.put("count",indexViewInfo.getCount());
|
|
|
+ map1.put("updateCount",indexViewInfo.getUpdataCount());
|
|
|
+ BigDecimal updateRate = new BigDecimal(0);
|
|
|
+ if (indexViewInfo.getUpdataCount()!=0){
|
|
|
+ BigDecimal counts = new BigDecimal(indexViewInfo.getCount());
|
|
|
+ BigDecimal updateCounts = new BigDecimal(indexViewInfo.getUpdataCount());
|
|
|
+ updateRate = updateCounts.divide(counts,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ map1.put("updateRate",updateRate+"%");
|
|
|
+ list.add(map1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|
|
|
|