Commit 7b678f88 authored by 廖旭伟's avatar 廖旭伟

数据汇聚应用信息表

parent f5a6147a
......@@ -292,4 +292,19 @@ CREATE TABLE `mortals_xhx_converge_apps_interface` (
`totalInvokeSum` int(8) DEFAULT NULL COMMENT '接口调用次数',
`createTime` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='应用接口';
\ No newline at end of file
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='应用接口';
---------------
--2023-10-17
---------------
DROP TABLE IF EXISTS `mortals_xhx_converge_apps_info`;
CREATE TABLE mortals_xhx_converge_apps_info(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`appEname` varchar(128) COMMENT '应用ID',
`appName` varchar(128) COMMENT '应用名称',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应用信息';
\ No newline at end of file
package com.mortals.xhx.module.converge.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import java.util.List;
/**
* 应用信息Dao
* 应用信息 DAO接口
*
* @author zxfei
* @date 2023-10-17
*/
public interface ConvergeAppsInfoDao extends ICRUDDao<ConvergeAppsInfoEntity,Long>{
}
package com.mortals.xhx.module.converge.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.converge.dao.ConvergeAppsInfoDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 应用信息DaoImpl DAO接口
*
* @author zxfei
* @date 2023-10-17
*/
@Repository("convergeAppsInfoDao")
public class ConvergeAppsInfoDaoImpl extends BaseCRUDDaoMybatis<ConvergeAppsInfoEntity,Long> implements ConvergeAppsInfoDao {
}
package com.mortals.xhx.module.converge.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.converge.model.vo.ConvergeAppsInfoVo;
import lombok.Data;
/**
* 应用信息实体对象
*
* @author zxfei
* @date 2023-10-17
*/
@Data
public class ConvergeAppsInfoEntity extends ConvergeAppsInfoVo {
private static final long serialVersionUID = 1L;
/**
* 应用ID
*/
private String appEname;
/**
* 应用名称
*/
private String appName;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ConvergeAppsInfoEntity) {
ConvergeAppsInfoEntity tmp = (ConvergeAppsInfoEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.appEname = "";
this.appName = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.converge.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 应用信息视图对象
*
* @author zxfei
* @date 2023-10-17
*/
@Data
public class ConvergeAppsInfoVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import com.mortals.xhx.module.converge.dao.ConvergeAppsInfoDao;
/**
* ConvergeAppsInfoService
*
* 应用信息 service接口
*
* @author zxfei
* @date 2023-10-17
*/
public interface ConvergeAppsInfoService extends ICRUDService<ConvergeAppsInfoEntity,Long>{
ConvergeAppsInfoDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.converge.dao.ConvergeAppsInfoDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsInfoService;
import lombok.extern.slf4j.Slf4j;
/**
* ConvergeAppsInfoService
* 应用信息 service实现
*
* @author zxfei
* @date 2023-10-17
*/
@Service("convergeAppsInfoService")
@Slf4j
public class ConvergeAppsInfoServiceImpl extends AbstractCRUDServiceImpl<ConvergeAppsInfoDao, ConvergeAppsInfoEntity, Long> implements ConvergeAppsInfoService {
}
\ No newline at end of file
......@@ -12,9 +12,7 @@ import com.mortals.xhx.module.converge.model.vo.AppVO;
import com.mortals.xhx.module.converge.model.vo.BranchVO;
import com.mortals.xhx.module.converge.model.vo.EquipmentVO;
import com.mortals.xhx.module.converge.model.vo.InterfaceStatsVO;
import com.mortals.xhx.module.converge.service.ConvergeAppsInterfaceService;
import com.mortals.xhx.module.converge.service.ConvergeAppsService;
import com.mortals.xhx.module.converge.service.ConvergeDeviceService;
import com.mortals.xhx.module.converge.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,7 +21,6 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.converge.dao.ConvergeSiteDao;
import com.mortals.xhx.module.converge.service.ConvergeSiteService;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
......@@ -49,6 +46,8 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
private ConvergeAppsService convergeAppsService;
@Autowired
private ConvergeAppsInterfaceService convergeAppsInterfaceService;
@Autowired
private ConvergeAppsInfoService convergeAppsInfoService;
@Override
public List<BranchVO> getConvergeData() throws AppException {
......@@ -62,6 +61,13 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
// calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
// String currMonthEnd = format.format(calendar.getTime());
// String currMonth = DateUtils.getCurrDateTime("yyyy-MM");
List<ConvergeAppsInfoEntity> appsInfoList = convergeAppsInfoService.getAllList();
Map<String,String> appsInfoMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(appsInfoList)) {
appsInfoList.forEach(i -> {
appsInfoMap.put(i.getAppEname(), i.getAppName());
});
}
for(ConvergeSiteEntity siteEntity:siteList){
BranchVO branchVO = new BranchVO();
BeanUtils.copyProperties(siteEntity,branchVO,BeanUtil.getNullPropertyNames(siteEntity));
......@@ -91,7 +97,7 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
}
item.setInterfaceEntityList(interfaceEntityList);
}
equipmentVO.setAppStats(convertAppVO(apps));
equipmentVO.setAppStats(convertAppVO(apps,appsInfoMap));
if(CollectionUtils.isEmpty(equipmentVO.getAppStats())){
continue;
}
......@@ -172,7 +178,7 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
return true;
}
private List<AppVO> convertAppVO(List<ConvergeAppsEntity> apps){
private List<AppVO> convertAppVO(List<ConvergeAppsEntity> apps,Map<String,String> appsInfoMap){
if(CollectionUtils.isEmpty(apps)){
return Collections.emptyList();
}else {
......@@ -183,6 +189,9 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
}
AppVO vo = new AppVO();
BeanUtils.copyProperties(item,vo,BeanUtil.getNullPropertyNames(item));
if(appsInfoMap.containsKey(item.getAppEname())){
vo.setAppName(appsInfoMap.get(item.getAppEname()));
}
vo.setInterfaceStats(item.getInterfaceEntityList());
voList.add(vo);
}
......
package com.mortals.xhx.module.converge.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.converge.model.ConvergeAppsInfoEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsInfoService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 应用信息
*
* @author zxfei
* @date 2023-10-17
*/
@RestController
@RequestMapping("converge/apps/info")
public class ConvergeAppsInfoController extends BaseCRUDJsonBodyMappingController<ConvergeAppsInfoService,ConvergeAppsInfoEntity,Long> {
@Autowired
private ParamService paramService;
public ConvergeAppsInfoController(){
super.setModuleDesc( "应用信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment