Commit ad2c8b6a authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	sst-manager/pom.xml
parents f1c92e8e 8ae42570
package com.mortals.xhx.common.pdu.app;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
@Data
public class AppCategoryPdu extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
* 站点Id
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 分类编码
*/
private String categoryCode;
/**
* 分类名称
*/
private String categoryName;
/**
* 排序字段
*/
private Integer sort;
/**
* 封面
*/
private String cover;
/**
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof AppCategoryPdu) {
AppCategoryPdu tmp = (AppCategoryPdu) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.siteName = "";
this.categoryCode = "";
this.categoryName = "";
this.sort = 0;
this.cover = "";
this.remark = "";
}
}
......@@ -200,6 +200,11 @@ public class DevicePdu extends BaseEntityLong {
* 是否显示小程序二维码(0.否,1.是)
*/
private Integer showWechatQrCode;
/**
* 所属机构
*/
private String orgName;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -310,5 +315,4 @@ public class DevicePdu extends BaseEntityLong {
this.showWechatQrCode = 1;
}
}
\ No newline at end of file
......@@ -27,6 +27,7 @@ public class SiteTreeSelectVO implements Serializable {
* 区域编码
*/
private String areaCode;
private String areaName;
/**
* 是否叶子节点
*/
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.feign.app;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.AppCategoryPdu;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.pdu.app.DeviceBlackappPdu;
import com.mortals.xhx.common.pdu.device.DevicePdu;
......@@ -48,6 +49,15 @@ public interface IAppFeign extends IFeign {
*/
@PostMapping(value = "/device/blackapp/list")
Rest<RespData<List<DeviceBlackappPdu>>> blackappList(@RequestBody DeviceBlackappPdu appPdu);
/**
* 自助终端应用分类
*
* @param appPdu
* @return
*/
@PostMapping(value = "/app/category/list")
Rest<RespData<List<AppCategoryPdu>>> categoryList(@RequestBody AppCategoryPdu appPdu);
}
@Slf4j
......@@ -72,6 +82,11 @@ class AppFeignFallbackFactory implements FallbackFactory<IAppFeign> {
public Rest<RespData<List<DeviceBlackappPdu>>> blackappList(DeviceBlackappPdu appPdu) {
return Rest.fail("暂时无法获取设备应用黑名单,请稍后再试!");
}
@Override
public Rest<RespData<List<AppCategoryPdu>>> categoryList(AppCategoryPdu appPdu) {
return Rest.fail("暂时无法获取自助终端应用分类,请稍后再试!");
}
};
}
}
\ No newline at end of file
package com.mortals.xhx.feign.device;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.device.DeviceNotifyPdu;
......@@ -8,8 +9,10 @@ import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
......@@ -59,6 +62,15 @@ public interface IDeviceFeign extends IFeign {
@PostMapping(value = "/device/save")
Rest<RespData<DevicePdu>> save(@RequestBody DevicePdu devicePdu,@RequestHeader("Authorization") String authorization);
/**
* 设备启用停用
*
* @param devicePdu
* @return
*/
@PostMapping(value = "/device/enable")
String deviceEnable(@RequestBody DevicePdu devicePdu,@RequestHeader("Authorization") String authorization);
/**
* 接收第三方平台下发设备消息
* @param deviceNotifyPdu
......@@ -66,6 +78,9 @@ public interface IDeviceFeign extends IFeign {
*/
@PostMapping(value = "/notify/downMsg")
Rest<String> downMsg(@RequestBody DeviceNotifyPdu deviceNotifyPdu);
@PostMapping(value = "/device/importData",consumes= MediaType.MULTIPART_FORM_DATA_VALUE)
String importData(@RequestPart MultipartFile file,@RequestHeader("Authorization") String authorization,@RequestParam("siteId") Long siteId);
}
......@@ -95,10 +110,27 @@ class DeviceFeignFallbackFactory implements FallbackFactory<IDeviceFeign> {
return Rest.fail("暂时无法保存设备,请稍后再试!");
}
@Override
public String deviceEnable(DevicePdu devicePdu, String authorization) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", -1);
jsonObject.put("msg", "暂时无法启用停用设备,请稍后再试!");
return jsonObject.toJSONString();
}
@Override
public Rest<String> downMsg(DeviceNotifyPdu deviceNotifyPdu) {
return Rest.fail("暂时无法接收第三方平台下发设备消息,请稍后再试!");
}
@Override
public String importData(MultipartFile file, String authorization,Long siteId) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", -1);
jsonObject.put("msg", "暂时无法导入设备,请稍后再试!");
return jsonObject.toJSONString();
}
};
}
}
......
......@@ -236,18 +236,49 @@ PRIMARY KEY (`id`)
DROP TABLE IF EXISTS `mortals_xhx_converge_apps`;
CREATE TABLE mortals_xhx_converge_apps(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) COMMENT '站点id',
`equipmentId` bigint(20) COMMENT '设备ID',
`appEname` varchar(100) COMMENT '应用标识,具有唯一性',
`appName` varchar(100) COMMENT '应用名称',
`appSimpleName` varchar(100) COMMENT '应用简称',
`provider` varchar(100) COMMENT '应用提供方',
`origin` char(1) COMMENT '应用来源',
`pv` int(8) COMMENT '应用访问数',
`uv` int(8) COMMENT '应用访客数',
`totalPv` int(8) COMMENT '应用访问数',
`totalUv` int(8) COMMENT '应用访客数',
`opr` char(1) COMMENT '操作类型',
`siteId` bigint(20) COMMENT '站点id',
`statYearMonth` varchar(100) COMMENT '统计月份,格式yyyy-MM-dd',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备应用';
INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('省平台数据汇聚任务', 'provinceConvergeTask', '0', 'ProvinceConvergeTask', NULL, NULL, '1', '0', '23:30', NULL, NULL, NULL, '0', NOW(), '1', '系统管理员');
DROP TABLE IF EXISTS `mortals_xhx_converge_apps_access`;
CREATE TABLE `mortals_xhx_converge_apps_access` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '序号,主键,自增长',
`siteId` bigint(20) DEFAULT NULL COMMENT '站点id',
`applicationId` varchar(128) DEFAULT NULL COMMENT '应用ID',
`applicationName` varchar(128) DEFAULT NULL COMMENT '应用名称',
`startTime` datetime DEFAULT NULL COMMENT '应用打开时间',
`endTime` datetime DEFAULT NULL COMMENT '应用关闭时间',
`userId` varchar(128) DEFAULT NULL COMMENT '用户ID',
`userName` varchar(128) DEFAULT NULL COMMENT '用户名称',
`channelId` varchar(128) DEFAULT NULL COMMENT '渠道ID',
`channelName` varchar(128) DEFAULT NULL COMMENT '渠道名称',
`location` varchar(128) DEFAULT NULL COMMENT '地域',
`clientName` varchar(128) DEFAULT NULL COMMENT '客户端名称',
`version` varchar(128) DEFAULT NULL COMMENT '客户端版本号',
`ecode` varchar(128) DEFAULT NULL COMMENT '设备唯一标识',
`appSimpleName` varchar(128) DEFAULT NULL COMMENT '应用简称',
`provider` varchar(128) DEFAULT NULL COMMENT '应用提供方',
`origin` varchar(1) DEFAULT NULL COMMENT '应用来源',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='应用访问';
ALTER TABLE `mortals_xhx_sst_apps_desk` ADD COLUMN `clickSum` int(8) DEFAULT '0' COMMENT '应用点击次数';
ALTER TABLE `mortals_xhx_sst_apps` ADD COLUMN `clickSum` int(8) DEFAULT '0' COMMENT '应用点击次数';
ALTER TABLE `mortals_xhx_sst_agreement` ADD COLUMN `protocolType` tinyint(2) DEFAULT '1' COMMENT '协议类型' AFTER `name`;
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('协议类型', 'SstAgreement', 'protocolType', '1', '注册协议', '1', '4', '0', NULL, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('协议类型', 'SstAgreement', 'protocolType', '2', '申报协议', '1', '4', '0', NULL, NULL, NULL, NULL);
......@@ -30,6 +30,9 @@
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
......@@ -67,14 +70,11 @@
<profiles.kafka.brokers>127.0.0.1:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>info</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
</properties>
</profile>
......@@ -98,24 +98,6 @@
<profiles.filepath>/mortals/app/data</profiles.filepath>
</properties>
</profile>
<profile>
<id>sngx</id>
<properties>
<profiles.active>sngx</profiles.active>
<profiles.server.port>19211</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.kafka.brokers>127.0.0.1:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>info</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
</properties>
</profile>
</profiles>
<dependencies>
......
......@@ -3,13 +3,21 @@ package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsService;
import com.mortals.xhx.module.converge.service.ConvergeDeviceService;
import com.mortals.xhx.module.converge.service.ConvergeSiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
/**
* 省平台数据汇聚任务
*/
......@@ -21,16 +29,38 @@ public class ProvinceConvergeTaskImpl implements ITaskExcuteService {
private ConvergeSiteService convergeSiteService;
@Autowired
private ConvergeDeviceService convergeDeviceService;
@Autowired
private ConvergeAppsService convergeAppsService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("开始执行省平台数据汇聚任务...");
try {
convergeSiteService.doConvergeSite();
}catch (Exception e){
log.error("汇聚网点数据执行出错",e);
}
try {
convergeDeviceService.doConvergeDevice();
}catch (Exception e){
log.error("数据汇聚任务执行出错",e);
log.error("汇聚设备数据出错",e);
}
try {
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1);
String startTime = format.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
String endTime = format.format(calendar.getTime());
Map<String,String> condition = new HashMap<>();
condition.put("startTime",startTime);
condition.put("endTime",endTime);
convergeAppsService.doConvergeApps(condition);
}catch (Exception e){
log.error("汇聚应用数据出错",e);
}
log.info("省平台数据汇聚任务执行完成");
}
......@@ -39,4 +69,5 @@ public class ProvinceConvergeTaskImpl implements ITaskExcuteService {
public void stopTask(ITask task) throws AppException {
}
}
......@@ -32,4 +32,8 @@ public class AppsInfoVo extends BaseEntityLong {
* 应用主题id
*/
private String appThemeName;
/**
* 应用点击次数
*/
private Integer clickSum;
}
\ No newline at end of file
......@@ -62,9 +62,10 @@ public class AppsInfoServiceImpl extends AbstractCRUDServiceImpl<AppsInfoDao, Ap
public List<AppsInfoEntity> find(AppsInfoEntity entity) throws AppException {
AppPdu appPdu = new AppPdu();
appPdu.setSiteId(entity.getSiteId());
appPdu.setSize(999);
appPdu.setType(1);
appPdu.setShelves(1);
appPdu.setSize(-1);
appPdu.setType(1); //类型(1.终端应用,2.移动端应用)
appPdu.setShelves(1); //是否上架(0.下架,1.上架)
appPdu.setAppName(entity.getName());
Rest<RespData<List<AppPdu>>> rest = appFeign.list(appPdu);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
List<AppsInfoEntity> appsInfoEntities = new ArrayList<>();
......@@ -124,6 +125,7 @@ public class AppsInfoServiceImpl extends AbstractCRUDServiceImpl<AppsInfoDao, Ap
appsInfoEntity.setServiceApi(pdu.getServiceApi());
appsInfoEntity.setCustUrl(pdu.getCustUrl());
appsInfoEntity.setAppThemeName(pdu.getAppThemeName());
appsInfoEntity.setCreateTime(pdu.getCreateTime());
return appsInfoEntity;
}
}
\ 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.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.model.vo.AppsAccessVo;
import java.util.List;
import java.util.Map;
/**
* 应用访问Dao
* 应用访问 DAO接口
*
* @author zxfei
* @date 2023-07-03
*/
public interface ConvergeAppsAccessDao extends ICRUDDao<ConvergeAppsAccessEntity,Long>{
/**
* 应用浏览量PV统计
* @return
*/
List<AppsAccessVo> getAppsAccessPv(Map<String,String> condition);
/**
* 应用浏览量UV统计
* @return
*/
List<AppsAccessVo> getAppsAccessUv(Map<String,String> condition);
}
package com.mortals.xhx.module.converge.dao.ibatis;
import com.mortals.xhx.module.converge.model.vo.AppsAccessVo;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.converge.dao.ConvergeAppsAccessDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
import java.util.Map;
/**
* 应用访问DaoImpl DAO接口
*
* @author zxfei
* @date 2023-07-03
*/
@Repository("convergeAppsAccessDao")
public class ConvergeAppsAccessDaoImpl extends BaseCRUDDaoMybatis<ConvergeAppsAccessEntity,Long> implements ConvergeAppsAccessDao {
@Override
public List<AppsAccessVo> getAppsAccessPv(Map<String,String> condition) {
return this.getSqlSession().selectList(this.getSqlId("getAppsAccessPv"),condition);
}
@Override
public List<AppsAccessVo> getAppsAccessUv(Map<String,String> condition) {
return this.getSqlSession().selectList(this.getSqlId("getAppsAccessUv"),condition);
}
}
package com.mortals.xhx.module.converge.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
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.ConvergeAppsAccessVo;
import lombok.Data;
/**
* 应用访问实体对象
*
* @author zxfei
* @date 2023-07-04
*/
@Data
public class ConvergeAppsAccessEntity extends ConvergeAppsAccessVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 应用ID
*/
private String applicationId;
/**
* 应用名称
*/
private String applicationName;
/**
* 应用打开时间
*/
private Date startTime;
/**
* 应用关闭时间
*/
private Date endTime;
/**
* 用户ID
*/
private String userId;
/**
* 用户名称
*/
private String userName;
/**
* 渠道ID
*/
private String channelId;
/**
* 渠道名称
*/
private String channelName;
/**
* 地域
*/
private String location;
/**
* 客户端名称
*/
private String clientName;
/**
* 客户端版本号
*/
private String version;
/**
* 设备唯一标识
*/
private String ecode;
/**
* 应用简称
*/
private String appSimpleName;
/**
* 应用提供方
*/
private String provider;
/**
* 应用来源
*/
private String origin;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ConvergeAppsAccessEntity) {
ConvergeAppsAccessEntity tmp = (ConvergeAppsAccessEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.applicationId = "";
this.applicationName = "";
this.startTime = null;
this.endTime = null;
this.userId = "";
this.userName = "";
this.channelId = "";
this.channelName = "";
this.location = "";
this.clientName = "";
this.version = "";
this.ecode = "";
this.appSimpleName = "";
this.provider = "";
this.origin = "";
}
}
\ No newline at end of file
......@@ -10,12 +10,16 @@ import lombok.Data;
* 设备应用实体对象
*
* @author zxfei
* @date 2023-06-12
* @date 2023-07-06
*/
@Data
public class ConvergeAppsEntity extends ConvergeAppsVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 设备ID
*/
......@@ -43,19 +47,19 @@ public class ConvergeAppsEntity extends ConvergeAppsVo {
/**
* 应用访问数
*/
private Integer pv;
private Integer totalPv;
/**
* 应用访客数
*/
private Integer uv;
private Integer totalUv;
/**
* 操作类型
*/
private String opr;
/**
* 站点id
* 统计月份,格式yyyy-MM-dd
*/
private Long siteId;
private String statYearMonth;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -74,6 +78,8 @@ public class ConvergeAppsEntity extends ConvergeAppsVo {
public void initAttrValue(){
this.siteId = -1L;
this.equipmentId = -1L;
this.appEname = "";
......@@ -86,12 +92,12 @@ public class ConvergeAppsEntity extends ConvergeAppsVo {
this.origin = "";
this.pv = -1;
this.totalPv = -1;
this.uv = -1;
this.totalUv = -1;
this.opr = "";
this.siteId = -1L;
this.statYearMonth = "";
}
}
\ No newline at end of file
......@@ -27,11 +27,15 @@ public class AppVO {
/**
* 应用访问数
*/
private Integer pv;
private Integer totalPv;
/**
* 应用访客数
*/
private Integer uv;
private Integer totalUv;
/**
* 统计月份,格式yyyy-MM-dd
*/
private String statYearMonth;
/**
* 操作类型
*/
......
package com.mortals.xhx.module.converge.model.vo;
import lombok.Data;
@Data
public class AppsAccessVo {
/**
* 站点id
*/
private Long siteId;
/**
* 设备ID
*/
private String equipmentId;
/**
* 应用标识,具有唯一性
*/
private String appEname;
/**
* 应用名称
*/
private String appName;
/**
* 应用简称
*/
private String appSimpleName;
/**
* 应用提供方
*/
private String provider;
/**
* 应用来源
*/
private String origin;
/**
* 应用访问数
*/
private Integer totalPv;
/**
* 应用访客数
*/
private Integer totalUv;
/**
* 统计月份,格式yyyy-MM-dd
*/
private String statYearMonth;
}
package com.mortals.xhx.module.converge.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
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-07-03
*/
@Data
public class ConvergeAppsAccessVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.dao.ConvergeAppsAccessDao;
import com.mortals.xhx.module.converge.model.vo.AppsAccessVo;
import java.util.List;
import java.util.Map;
/**
* ConvergeAppsAccessService
*
* 应用访问 service接口
*
* @author zxfei
* @date 2023-07-03
*/
public interface ConvergeAppsAccessService extends ICRUDService<ConvergeAppsAccessEntity,Long>{
ConvergeAppsAccessDao getDao();
/**
* 应用浏览量PV统计
* @return
*/
List<AppsAccessVo> getAppsAccessPv(Map<String,String> condition) throws AppException;
/**
* 应用浏览量UV统计
* @return
*/
List<AppsAccessVo> getAppsAccessUv(Map<String,String> condition) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.model.ConvergeAppsEntity;
import com.mortals.xhx.module.converge.dao.ConvergeAppsDao;
import java.util.Map;
/**
* ConvergeAppsService
*
......@@ -13,4 +18,10 @@ import com.mortals.xhx.module.converge.dao.ConvergeAppsDao;
public interface ConvergeAppsService extends ICRUDService<ConvergeAppsEntity,Long>{
ConvergeAppsDao getDao();
/**
* 天府通办数据汇聚
* @throws AppException
*/
void doConvergeApps(Map<String,String> condition) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service.impl;
import com.mortals.xhx.module.converge.model.vo.AppsAccessVo;
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.ConvergeAppsAccessDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsAccessService;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
/**
* ConvergeAppsAccessService
* 应用访问 service实现
*
* @author zxfei
* @date 2023-07-03
*/
@Service("convergeAppsAccessService")
@Slf4j
public class ConvergeAppsAccessServiceImpl extends AbstractCRUDServiceImpl<ConvergeAppsAccessDao, ConvergeAppsAccessEntity, Long> implements ConvergeAppsAccessService {
@Override
public List<AppsAccessVo> getAppsAccessPv(Map<String,String> condition) throws AppException {
return dao.getAppsAccessPv(condition);
}
@Override
public List<AppsAccessVo> getAppsAccessUv(Map<String,String> condition) throws AppException {
return dao.getAppsAccessUv(condition);
}
}
\ No newline at end of file
package com.mortals.xhx.module.converge.service.impl;
import com.mortals.xhx.module.converge.model.*;
import com.mortals.xhx.module.converge.model.vo.AppsAccessVo;
import com.mortals.xhx.module.converge.service.ConvergeAppsAccessService;
import com.mortals.xhx.module.converge.service.ConvergeDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
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.ConvergeAppsDao;
import com.mortals.xhx.module.converge.model.ConvergeAppsEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ConvergeAppsService
* 设备应用 service实现
......@@ -18,4 +29,68 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ConvergeAppsServiceImpl extends AbstractCRUDServiceImpl<ConvergeAppsDao, ConvergeAppsEntity, Long> implements ConvergeAppsService {
@Autowired
private ConvergeAppsAccessService convergeAppsAccessService;
@Autowired
private ConvergeDeviceService convergeDeviceService;
@Override
public void doConvergeApps(Map<String,String> condition) throws AppException {
List<AppsAccessVo> accessPvList = convergeAppsAccessService.getAppsAccessPv(condition);
List<AppsAccessVo> accessUvList = convergeAppsAccessService.getAppsAccessUv(condition);
if(CollectionUtils.isEmpty(accessPvList)||CollectionUtils.isEmpty(accessUvList)){
return;
}else {
Map<String,AppsAccessVo> uvMap = new HashMap<>();
for (AppsAccessVo vo:accessUvList){
String key = vo.getSiteId()+"_"+vo.getEquipmentId()+"_"+vo.getAppEname()+"_"+vo.getStatYearMonth();
uvMap.put(key,vo);
}
List<ConvergeAppsEntity> appsList = new ArrayList<>();
Map<String, ConvergeDeviceEntity> deviceMap = new HashMap<>();
for(AppsAccessVo item:accessPvList){
ConvergeAppsEntity entity = new ConvergeAppsEntity();
if(deviceMap.containsKey(item.getEquipmentId())){
entity.setEquipmentId(deviceMap.get(item.getEquipmentId()).getId());
}else {
ConvergeDeviceEntity deviceEntity = convergeDeviceService.selectOne(new ConvergeDeviceQuery().logo(item.getEquipmentId()));
if(deviceEntity!=null){
deviceMap.put(item.getEquipmentId(),deviceEntity);
entity.setEquipmentId(deviceEntity.getId());
}else {
entity.setEquipmentId(-1l);
}
}
entity.setAppEname(item.getAppEname());
entity.setAppName(item.getAppName());
entity.setAppSimpleName(item.getAppSimpleName());
entity.setProvider(item.getProvider());
entity.setOrigin(item.getOrigin());
entity.setSiteId(item.getSiteId());
entity.setTotalPv(item.getTotalPv());
entity.setStatYearMonth(item.getStatYearMonth());
String key = item.getSiteId()+"_"+item.getEquipmentId()+"_"+item.getAppEname()+"_"+item.getStatYearMonth();
if(uvMap.containsKey(key)) {
entity.setTotalUv(uvMap.get(key).getTotalUv());
}
appsList.add(entity);
}
for(ConvergeAppsEntity item:appsList){
ConvergeAppsEntity temp = this.selectOne(new ConvergeAppsQuery().appEname(item.getAppEname()).equipmentId(item.getEquipmentId()).siteId(item.getSiteId()).statYearMonth(item.getStatYearMonth()));
if(temp!=null){
item.setId(temp.getId());
if(temp.getTotalPv()==item.getTotalPv()&&temp.getTotalUv()==item.getTotalUv()){
item.setOpr("P");
}else {
item.setOpr("U");
}
this.update(item);
}else {
item.setOpr("A");
this.save(item);
}
}
}
}
}
\ No newline at end of file
......@@ -6,11 +6,11 @@ import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.converge.model.ConvergeDeviceEntity;
import com.mortals.xhx.module.converge.model.ConvergeDeviceQuery;
import com.mortals.xhx.module.converge.model.ConvergeSiteQuery;
import com.mortals.xhx.module.converge.model.*;
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.service.ConvergeAppsService;
import com.mortals.xhx.module.converge.service.ConvergeDeviceService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
......@@ -20,7 +20,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.model.ConvergeSiteEntity;
import com.mortals.xhx.module.converge.service.ConvergeSiteService;
import lombok.extern.slf4j.Slf4j;
......@@ -45,6 +44,8 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
private ISiteFeign siteFeign;
@Autowired
private ConvergeDeviceService convergeDeviceService;
@Autowired
private ConvergeAppsService convergeAppsService;
@Override
public List<BranchVO> getConvergeData() throws AppException {
......@@ -60,7 +61,11 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
for (ConvergeDeviceEntity deviceEntity:deviceEntityList){
EquipmentVO equipmentVO = new EquipmentVO();
BeanUtils.copyProperties(deviceEntity,equipmentVO,BeanUtil.getNullPropertyNames(deviceEntity));
equipmentVO.setAppStats(Collections.emptyList());
List<ConvergeAppsEntity> apps = convergeAppsService.find(new ConvergeAppsQuery().siteId(deviceEntity.getSiteId()).equipmentId(deviceEntity.getId()));
if(CollectionUtils.isEmpty(apps)){
continue;
}
equipmentVO.setAppStats(convertAppVO(apps));
equipments.add(equipmentVO);
}
branchVO.setEquipments(equipments);
......@@ -137,4 +142,18 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
}
return true;
}
private List<AppVO> convertAppVO(List<ConvergeAppsEntity> apps){
if(CollectionUtils.isEmpty(apps)){
return Collections.emptyList();
}else {
List<AppVO> voList = new ArrayList<>();
for (ConvergeAppsEntity item:apps){
AppVO vo = new AppVO();
BeanUtils.copyProperties(item,vo,BeanUtil.getNullPropertyNames(item));
voList.add(vo);
}
return voList;
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.converge.web;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.utils.BeanUtil;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.BeanUtils;
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.ConvergeAppsAccessEntity;
import com.mortals.xhx.module.converge.service.ConvergeAppsAccessService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 应用访问
*
* @author zxfei
* @date 2023-07-03
*/
@RestController
@RequestMapping("converge/apps/access")
public class ConvergeAppsAccessController extends BaseCRUDJsonBodyMappingController<ConvergeAppsAccessService,ConvergeAppsAccessEntity,Long> {
@Autowired
private ParamService paramService;
public ConvergeAppsAccessController(){
super.setModuleDesc( "应用访问");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@Override
@PostMapping({"save"})
@UnAuth
public String save(@RequestBody ConvergeAppsAccessEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存" + this.getModuleDesc();
try {
this.saveBefore(entity, model, context);
if (entity.newEntity()) {
Class<ConvergeAppsAccessEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
ConvergeAppsAccessEntity initEntity = (ConvergeAppsAccessEntity)tClass.newInstance();
initEntity.initAttrValue();
BeanUtils.copyProperties(entity, initEntity, BeanUtil.getNullPropertyNames(entity));
entity = initEntity;
busiDesc = "新增" + this.getModuleDesc();
initEntity.setCreateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
initEntity.setCreateUserId(user.getId());
initEntity.setCreateUser(user.getLoginName());
initEntity.setCreateUserName(user.getRealName());
initEntity.setCreateUserDeptId(user.getDeptId());
initEntity.setCreateUserDeptName(user.getDeptName());
}
this.service.save(initEntity, context);
} else {
busiDesc = "修改" + this.getModuleDesc();
entity.setUpdateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
entity.setUpdateUserId(user.getId());
entity.setUpdateUser(user.getLoginName());
entity.setUpdateUserName(user.getRealName());
entity.setUpdateUserDeptId(user.getDeptId());
entity.setUpdateUserDeptName(user.getDeptName());
}
this.service.update(entity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
@GetMapping({"bury"})
@UnAuth
public String bury(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存" + this.getModuleDesc();
ConvergeAppsAccessEntity entity = new ConvergeAppsAccessEntity();
entity.setSiteId(DataUtil.converStr2Long(request.getParameter("siteId"),0l));
entity.setApplicationId(request.getParameter("applicationId"));
entity.setApplicationName(request.getParameter("applicationName"));
if(StringUtils.isNotEmpty(request.getParameter("startTime"))) {
entity.setStartTime(DateUtils.StrToDateTime(request.getParameter("startTime")));
}
if(StringUtils.isNotEmpty(request.getParameter("endTime"))) {
entity.setEndTime(DateUtils.StrToDateTime(request.getParameter("endTime")));
}
entity.setChannelId(request.getParameter("channelId"));
entity.setChannelName(request.getParameter("channelName"));
entity.setLocation(request.getParameter("location"));
entity.setClientName(request.getParameter("clientName"));
entity.setVersion(request.getParameter("version"));
entity.setEcode(request.getParameter("ecode"));
entity.setAppSimpleName(request.getParameter("appSimpleName"));
entity.setProvider(request.getParameter("provider"));
entity.setOrigin(request.getParameter("origin"));
try {
this.saveBefore(entity, model, context);
if (entity.newEntity()) {
Class<ConvergeAppsAccessEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
ConvergeAppsAccessEntity initEntity = (ConvergeAppsAccessEntity)tClass.newInstance();
initEntity.initAttrValue();
BeanUtils.copyProperties(entity, initEntity, BeanUtil.getNullPropertyNames(entity));
entity = initEntity;
busiDesc = "新增" + this.getModuleDesc();
initEntity.setCreateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
initEntity.setCreateUserId(user.getId());
initEntity.setCreateUser(user.getLoginName());
initEntity.setCreateUserName(user.getRealName());
initEntity.setCreateUserDeptId(user.getDeptId());
initEntity.setCreateUserDeptName(user.getDeptName());
}
this.service.save(initEntity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.converge.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.converge.model.vo.BranchVO;
import com.mortals.xhx.module.converge.service.ConvergeAppsService;
import com.mortals.xhx.module.converge.service.ConvergeDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -19,6 +23,7 @@ import com.mortals.xhx.module.converge.service.ConvergeSiteService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
......@@ -38,6 +43,10 @@ public class ConvergeSiteController extends BaseCRUDJsonBodyMappingController<Co
@Autowired
private ParamService paramService;
@Autowired
private ConvergeDeviceService convergeDeviceService;
@Autowired
private ConvergeAppsService convergeAppsService;
public ConvergeSiteController(){
super.setModuleDesc( "网点信息");
......@@ -80,4 +89,37 @@ public class ConvergeSiteController extends BaseCRUDJsonBodyMappingController<Co
}
return JSONObject.toJSONString(model.get("data"));
}
@Override
protected void doListBefore(ConvergeSiteEntity query, Map<String, Object> model, Context context) throws AppException {
log.info("开始执行省平台数据汇聚任务...");
try {
this.service.doConvergeSite();
}catch (Exception e){
log.error("汇聚网点数据执行出错",e);
}
try {
convergeDeviceService.doConvergeDevice();
}catch (Exception e){
log.error("汇聚设备数据出错",e);
}
try {
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1);
String startTime = format.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
String endTime = format.format(calendar.getTime());
Map<String,String> condition = new HashMap<>();
condition.put("startTime",startTime);
condition.put("endTime",endTime);
convergeAppsService.doConvergeApps(condition);
}catch (Exception e){
log.error("汇聚应用数据出错",e);
}
log.info("省平台数据汇聚任务执行完成");
}
}
\ No newline at end of file
......@@ -20,10 +20,12 @@ public class DeviceEntity extends DeviceVo {
/**
* 设备名称
*/
@Excel(name = "设备名称")
private String deviceName;
/**
* 设备编码,SN码等,默认为MAC地址
*/
@Excel(name = "设备编码")
private String deviceCode;
/**
* 设备的MAC地址
......@@ -40,6 +42,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 站点名称
*/
@Excel(name = "站点名称")
private String siteName;
/**
* 平台系统Id
......@@ -48,6 +51,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 平台系统名称
*/
@Excel(name = "平台系统名称")
private String platformName;
/**
* 产品Id
......@@ -56,6 +60,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 产品名称
*/
@Excel(name = "产品名称")
private String productName;
/**
* 皮肤id
......@@ -76,6 +81,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 设备生产厂商名称
*/
@Excel(name = "设备生产厂商名称")
private String deviceFirmname;
/**
* 设备来源(0.子设备,1.网关设备,2.直连设备)
......@@ -96,10 +102,12 @@ public class DeviceEntity extends DeviceVo {
/**
* 所属楼栋
*/
@Excel(name = "所属楼栋")
private Integer deviceInBuilding;
/**
* 所属楼层
*/
@Excel(name = "所属楼层")
private Integer deviceInFloor;
/**
* 保修期至
......@@ -108,10 +116,12 @@ public class DeviceEntity extends DeviceVo {
/**
* 负责人
*/
@Excel(name = "负责人")
private String leadingOfficial;
/**
* 联系电话
*/
@Excel(name = "联系电话")
private String leadingOfficialTelephone;
/**
* 是否接收异常短(0.否,1.是)
......@@ -168,6 +178,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 设备来源(0.旧设备,1.新设备)
*/
@Excel(name = "设备来源", readConverterExp = "0=旧设备,1=新设备")
private Integer source;
/**
* 设备SN码
......@@ -180,6 +191,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 产品编码
*/
@Excel(name = "产品类型")
private String productCode;
/**
* 大厅Id
......@@ -188,6 +200,7 @@ public class DeviceEntity extends DeviceVo {
/**
* 大厅名称
*/
@Excel(name = "大厅名称")
private String hallName;
/**
* 是否显示短信(0.否,1.是)
......
......@@ -25,11 +25,7 @@ public class DeviceVo extends BaseEntityLong {
*/
private String platformCode;
/**
* 产品编码
*/
@Excel(name = "产品类型",cacheDict = "productDict" ,type = Excel.Type.IMPORT)
private String productCode;
/**
......
package com.mortals.xhx.module.device.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
......@@ -27,11 +32,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -92,6 +95,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
model.put("notActive", not_active);
model.put("stopUsing", stop_using);
model.put("pageInfo", result.getPageInfo());
model.put("dict",result.getDict());
this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, model, context);
model.put("message_info", busiDesc + "成功");
......@@ -109,7 +113,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
return ret;
}
@RequestMapping(value = {"info"},method = {RequestMethod.POST, RequestMethod.GET})
@UnAuth
public String info(Long id) {
......@@ -313,4 +316,122 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
return ret;
}
@PostMapping({"m/save"})
@RepeatSubmit
public String save(@RequestBody DevicePdu devicePdu,@RequestHeader("Authorization") String authorization) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "保存" + this.getModuleDesc();
int code = 1;
try {
Rest<RespData<DevicePdu>> rest = deviceFeign.save(devicePdu,authorization);
if (rest.getCode()>0){
code = 1;
model.put("entity", rest.getData().getData());
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + devicePdu.getId() + "]");
}else {
code = -1;
model.put("message_info", rest.getMsg());
}
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", devicePdu);
this.init(model, context);
code = -1;
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
@PostMapping({"m/list"})
@UnAuth
public Rest<Object> mlist(@RequestBody DevicePdu query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
Rest<RespData<List<DevicePdu>>> rest = deviceFeign.list(query);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
model.put("data", rest.getData().getData());
int onlineTotal = 0;
int offlineTotal = 0;
int not_active = 0;
int stop_using = 0;
for (DevicePdu deviceEntity : rest.getData().getData()) {
if (deviceEntity.getDeviceStatus() == 0) {
not_active++;
}
if (deviceEntity.getDeviceStatus() == 1) {
offlineTotal++;
}
if (deviceEntity.getDeviceStatus() == 2) {
onlineTotal++;
}
if (deviceEntity.getEnabled() == 0) {
stop_using++;
}
}
model.put("online", onlineTotal);
model.put("offline", offlineTotal);
model.put("notActive", not_active);
model.put("stopUsing", stop_using);
model.put("pageInfo", rest.getData().getPageInfo());
//model.put("dict", rest.getData().getDict());
}
ret.setCode(rest.getCode());
ret.setMsg(rest.getMsg());
ret.setData(model);
ret.setDict(rest.getDict());
} catch (Exception var9) {
code = -1;
ret.setCode(code);
this.doException(this.request, busiDesc, model, var9);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
}
return ret;
}
/**
* 设备启用停用
*/
@PostMapping(value = "m/enable")
public String deviceEnable(@RequestBody DevicePdu devicePdu,@RequestHeader("Authorization") String authorization) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "启用停用设备";
try {
String resp = deviceFeign.deviceEnable(devicePdu,authorization);
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
log.error("设备启用停用消息", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
@PostMapping({"m/importData"})
public String importData(MultipartFile file,@RequestHeader("Authorization") String authorization,@RequestParam("siteId") Long siteId) {
return deviceFeign.importData(file,authorization,siteId);
}
}
\ No newline at end of file
package com.mortals.xhx.module.sst.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sst.model.vo.SstAgreementVo;
import lombok.Data;
/**
* 协议管理实体对象
*
* @author zxfei
* @date 2022-12-26
*/
* 协议管理实体对象
*
* @author zxfei
* @date 2023-07-10
*/
@Data
public class SstAgreementEntity extends SstAgreementVo {
private static final long serialVersionUID = 1L;
......@@ -32,70 +32,10 @@ public class SstAgreementEntity extends SstAgreementVo {
* 协议内容
*/
private String content;
public SstAgreementEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 协议名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 协议名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 协议描述
* @return String
* 协议类型
*/
public String getDescribe(){
return describe;
}
/**
* 设置 协议描述
* @param describe
*/
public void setDescribe(String describe){
this.describe = describe;
}
/**
* 获取 协议内容
* @return String
*/
public String getContent(){
return content;
}
/**
* 设置 协议内容
* @param content
*/
public void setContent(String content){
this.content = content;
}
private Integer protocolType;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -112,23 +52,16 @@ public class SstAgreementEntity extends SstAgreementVo {
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",name:").append(getName());
sb.append(",describe:").append(getDescribe());
sb.append(",content:").append(getContent());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteId = -1L;
this.name = "";
this.describe = "";
this.content = "";
this.protocolType = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.sst.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sst.model.vo.SstAppsDeskVo;
import lombok.Data;
/**
* 桌面终端应用编排实体对象
*
* @author zxfei
* @date 2023-04-09
*/
* 桌面终端应用编排实体对象
*
* @author zxfei
* @date 2023-07-05
*/
@Data
public class SstAppsDeskEntity extends SstAppsDeskVo {
private static final long serialVersionUID = 1L;
......@@ -52,140 +52,10 @@ public class SstAppsDeskEntity extends SstAppsDeskVo {
* 热门应用排序号
*/
private Integer hotSort;
public SstAppsDeskEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 应用id
* @return Long
*/
public Long getAppId(){
return appId;
}
/**
* 设置 应用id
* @param appId
*/
public void setAppId(Long appId){
this.appId = appId;
}
/**
* 获取 应用名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 应用名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 应用描述
* @return String
*/
public String getDescribe(){
return describe;
}
/**
* 设置 应用描述
* @param describe
*/
public void setDescribe(String describe){
this.describe = describe;
}
/**
* 获取 应用访问地址
* @return String
*/
public String getUrl(){
return url;
}
/**
* 设置 应用访问地址
* @param url
* 应用点击次数
*/
public void setUrl(String url){
this.url = url;
}
/**
* 获取 是否展示基础应用1是0否
* @return Integer
*/
public Integer getShowBasic(){
return showBasic;
}
/**
* 设置 是否展示基础应用1是0否
* @param showBasic
*/
public void setShowBasic(Integer showBasic){
this.showBasic = showBasic;
}
/**
* 获取 基础应用排序号
* @return Integer
*/
public Integer getBasicSort(){
return basicSort;
}
/**
* 设置 基础应用排序号
* @param basicSort
*/
public void setBasicSort(Integer basicSort){
this.basicSort = basicSort;
}
/**
* 获取 是否展示热门应用1是0否
* @return Integer
*/
public Integer getShowHot(){
return showHot;
}
/**
* 设置 是否展示热门应用1是0否
* @param showHot
*/
public void setShowHot(Integer showHot){
this.showHot = showHot;
}
/**
* 获取 热门应用排序号
* @return Integer
*/
public Integer getHotSort(){
return hotSort;
}
/**
* 设置 热门应用排序号
* @param hotSort
*/
public void setHotSort(Integer hotSort){
this.hotSort = hotSort;
}
private Integer clickSum;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -202,25 +72,11 @@ public class SstAppsDeskEntity extends SstAppsDeskVo {
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",appId:").append(getAppId());
sb.append(",name:").append(getName());
sb.append(",describe:").append(getDescribe());
sb.append(",url:").append(getUrl());
sb.append(",showBasic:").append(getShowBasic());
sb.append(",basicSort:").append(getBasicSort());
sb.append(",showHot:").append(getShowHot());
sb.append(",hotSort:").append(getHotSort());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteId = -1L;
this.appId = null;
this.appId = -1L;
this.name = "";
......@@ -230,10 +86,12 @@ public class SstAppsDeskEntity extends SstAppsDeskVo {
this.showBasic = 1;
this.basicSort = null;
this.basicSort = -1;
this.showHot = 1;
this.hotSort = null;
this.hotSort = -1;
this.clickSum = -1;
}
}
\ No newline at end of file
......@@ -3,11 +3,11 @@ package com.mortals.xhx.module.sst.model;
import java.util.List;
import com.mortals.xhx.module.sst.model.SstAppsDeskEntity;
/**
* 桌面终端应用编排查询对象
*
* @author zxfei
* @date 2023-04-09
*/
* 桌面终端应用编排查询对象
*
* @author zxfei
* @date 2023-07-05
*/
public class SstAppsDeskQuery extends SstAppsDeskEntity {
/** 开始 序号,主键,自增长 */
private Long idStart;
......@@ -171,6 +171,21 @@ public class SstAppsDeskQuery extends SstAppsDeskEntity {
/** 结束 更新时间 */
private String updateTimeEnd;
/** 开始 应用点击次数 */
private Integer clickSumStart;
/** 结束 应用点击次数 */
private Integer clickSumEnd;
/** 增加 应用点击次数 */
private Integer clickSumIncrement;
/** 应用点击次数列表 */
private List <Integer> clickSumList;
/** 应用点击次数排除列表 */
private List <Integer> clickSumNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<SstAppsDeskQuery> orConditionList;
......@@ -1068,6 +1083,87 @@ public class SstAppsDeskQuery extends SstAppsDeskEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 开始 应用点击次数
* @return clickSumStart
*/
public Integer getClickSumStart(){
return this.clickSumStart;
}
/**
* 设置 开始 应用点击次数
* @param clickSumStart
*/
public void setClickSumStart(Integer clickSumStart){
this.clickSumStart = clickSumStart;
}
/**
* 获取 结束 应用点击次数
* @return $clickSumEnd
*/
public Integer getClickSumEnd(){
return this.clickSumEnd;
}
/**
* 设置 结束 应用点击次数
* @param clickSumEnd
*/
public void setClickSumEnd(Integer clickSumEnd){
this.clickSumEnd = clickSumEnd;
}
/**
* 获取 增加 应用点击次数
* @return clickSumIncrement
*/
public Integer getClickSumIncrement(){
return this.clickSumIncrement;
}
/**
* 设置 增加 应用点击次数
* @param clickSumIncrement
*/
public void setClickSumIncrement(Integer clickSumIncrement){
this.clickSumIncrement = clickSumIncrement;
}
/**
* 获取 应用点击次数
* @return clickSumList
*/
public List<Integer> getClickSumList(){
return this.clickSumList;
}
/**
* 设置 应用点击次数
* @param clickSumList
*/
public void setClickSumList(List<Integer> clickSumList){
this.clickSumList = clickSumList;
}
/**
* 获取 应用点击次数
* @return clickSumNotList
*/
public List<Integer> getClickSumNotList(){
return this.clickSumNotList;
}
/**
* 设置 应用点击次数
* @param clickSumNotList
*/
public void setClickSumNotList(List<Integer> clickSumNotList){
this.clickSumNotList = clickSumNotList;
}
/**
* 设置 序号,主键,自增长
* @param id
......@@ -1613,6 +1709,60 @@ public class SstAppsDeskQuery extends SstAppsDeskEntity {
}
/**
* 设置 应用点击次数
* @param clickSum
*/
public SstAppsDeskQuery clickSum(Integer clickSum){
setClickSum(clickSum);
return this;
}
/**
* 设置 开始 应用点击次数
* @param clickSumStart
*/
public SstAppsDeskQuery clickSumStart(Integer clickSumStart){
this.clickSumStart = clickSumStart;
return this;
}
/**
* 设置 结束 应用点击次数
* @param clickSumEnd
*/
public SstAppsDeskQuery clickSumEnd(Integer clickSumEnd){
this.clickSumEnd = clickSumEnd;
return this;
}
/**
* 设置 增加 应用点击次数
* @param clickSumIncrement
*/
public SstAppsDeskQuery clickSumIncrement(Integer clickSumIncrement){
this.clickSumIncrement = clickSumIncrement;
return this;
}
/**
* 设置 应用点击次数
* @param clickSumList
*/
public SstAppsDeskQuery clickSumList(List<Integer> clickSumList){
this.clickSumList = clickSumList;
return this;
}
/**
* 设置 应用点击次数
* @param clickSumNotList
*/
public SstAppsDeskQuery clickSumNotList(List<Integer> clickSumNotList){
this.clickSumNotList = clickSumNotList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
package com.mortals.xhx.module.sst.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sst.model.vo.SstAppsVo;
import lombok.Data;
/**
* 应用编排实体对象
*
* @author zxfei
* @date 2022-12-26
*/
* 应用编排实体对象
*
* @author zxfei
* @date 2023-07-05
*/
@Data
public class SstAppsEntity extends SstAppsVo {
private static final long serialVersionUID = 1L;
......@@ -52,140 +52,10 @@ public class SstAppsEntity extends SstAppsVo {
* 应用id
*/
private Long appId;
public SstAppsEntity(){}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 应用名称
* @return String
*/
public String getName(){
return name;
}
/**
* 设置 应用名称
* @param name
*/
public void setName(String name){
this.name = name;
}
/**
* 获取 应用描述
* @return String
*/
public String getDescribe(){
return describe;
}
/**
* 设置 应用描述
* @param describe
*/
public void setDescribe(String describe){
this.describe = describe;
}
/**
* 获取 应用访问地址
* @return String
*/
public String getUrl(){
return url;
}
/**
* 设置 应用访问地址
* @param url
*/
public void setUrl(String url){
this.url = url;
}
/**
* 获取 是否展示基础应用1是0否
* @return Integer
*/
public Integer getShowBasic(){
return showBasic;
}
/**
* 设置 是否展示基础应用1是0否
* @param showBasic
* 应用点击次数
*/
public void setShowBasic(Integer showBasic){
this.showBasic = showBasic;
}
/**
* 获取 基础应用排序号
* @return Integer
*/
public Integer getBasicSort(){
return basicSort;
}
/**
* 设置 基础应用排序号
* @param basicSort
*/
public void setBasicSort(Integer basicSort){
this.basicSort = basicSort;
}
/**
* 获取 是否展示热门应用1是0否
* @return Integer
*/
public Integer getShowHot(){
return showHot;
}
/**
* 设置 是否展示热门应用1是0否
* @param showHot
*/
public void setShowHot(Integer showHot){
this.showHot = showHot;
}
/**
* 获取 热门应用排序号
* @return Integer
*/
public Integer getHotSort(){
return hotSort;
}
/**
* 设置 热门应用排序号
* @param hotSort
*/
public void setHotSort(Integer hotSort){
this.hotSort = hotSort;
}
/**
* 获取 应用id
* @return Long
*/
public Long getAppId(){
return appId;
}
/**
* 设置 应用id
* @param appId
*/
public void setAppId(Long appId){
this.appId = appId;
}
private Integer clickSum;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -202,23 +72,9 @@ public class SstAppsEntity extends SstAppsVo {
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",name:").append(getName());
sb.append(",describe:").append(getDescribe());
sb.append(",url:").append(getUrl());
sb.append(",showBasic:").append(getShowBasic());
sb.append(",basicSort:").append(getBasicSort());
sb.append(",showHot:").append(getShowHot());
sb.append(",hotSort:").append(getHotSort());
sb.append(",appId:").append(getAppId());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteId = -1L;
this.name = "";
......@@ -228,12 +84,14 @@ public class SstAppsEntity extends SstAppsVo {
this.showBasic = 1;
this.basicSort = null;
this.basicSort = -1;
this.showHot = 1;
this.hotSort = null;
this.hotSort = -1;
this.appId = -1L;
this.appId = null;
this.clickSum = -1;
}
}
\ No newline at end of file
......@@ -24,6 +24,8 @@ public class SstBasicVo extends BaseEntityLong {
/** 设备编码 */
private String deviceCode;
private String appName;
public String getShowAppIds() {
return showAppIds;
}
......@@ -63,4 +65,12 @@ public class SstBasicVo extends BaseEntityLong {
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ public interface SstAppsDeskService extends ICRUDService<SstAppsDeskEntity,Long>
* @param siteId 站点ID
* @return
*/
Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host);
Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host,String appName);
/**
* 应用下架
......@@ -44,4 +44,10 @@ public interface SstAppsDeskService extends ICRUDService<SstAppsDeskEntity,Long>
* @param userId
*/
void forbidden(Long appId,Long userId);
/**
* 增加应用点击次数
* @param appId
*/
void clickCountAdd(Long appId,Long siteId);
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ public interface SstAppsService extends ICRUDService<SstAppsEntity,Long>{
* @param siteId 站点ID
* @return
*/
Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host);
Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host,String appName);
/**
* 应用下架
......@@ -46,4 +46,10 @@ public interface SstAppsService extends ICRUDService<SstAppsEntity,Long>{
* @param userId
*/
void forbidden(Long appId,Long userId);
/**
* 增加应用点击次数
* @param appId
*/
void clickCountAdd(Long appId,Long siteId);
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.feign.app.IAppFeign;
import com.mortals.xhx.module.apps.model.AppsInfoEntity;
import com.mortals.xhx.module.apps.service.AppsInfoService;
import com.mortals.xhx.module.sst.model.SstAppsDeskEntity;
import com.mortals.xhx.module.sst.model.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -145,9 +145,10 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
}
@Override
public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host) {
public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host,String appName) {
SstAppsDeskEntity query = new SstAppsDeskEntity();
Map<String,String> orderCols = new HashMap<>();
orderCols.put("clickSum","DESC");
orderCols.put("basicSort","DESC");
query.setOrderCols(orderCols);
query.setSiteId(siteId);
......@@ -168,6 +169,7 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
}
AppsInfoEntity appsInfoQuery = new AppsInfoEntity();
appsInfoQuery.setSiteId(siteId);
appsInfoQuery.setName(appName);
List<AppsInfoEntity> allApps = appsInfoService.find(appsInfoQuery);
for(AppsInfoEntity appsInfoEntity:allApps){
if(com.mortals.framework.util.StringUtils.isNotEmpty(host)) {
......@@ -180,15 +182,20 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
if(CollectionUtils.isNotEmpty(appsEntities)){
List<AppsInfoEntity> showApps = new ArrayList<>();
List<AppsInfoEntity> hotApps = new ArrayList<>();
for(SstAppsDeskEntity SstAppsDeskEntity:appsEntities){
if(black.containsKey(SstAppsDeskEntity.getAppId())){
for(SstAppsDeskEntity sstAppsDeskEntity:appsEntities){
if(black.containsKey(sstAppsDeskEntity.getAppId())){
continue;
}
if(SstAppsDeskEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(SstAppsDeskEntity.getAppId()));
if(!appInfoMap.containsKey(sstAppsDeskEntity.getAppId())){
continue;
}
if(SstAppsDeskEntity.getShowHot()==1){
hotApps.add(appInfoMap.get(SstAppsDeskEntity.getAppId()));
appInfoMap.get(sstAppsDeskEntity.getAppId()).setClickSum(sstAppsDeskEntity.getClickSum());
appInfoMap.get(sstAppsDeskEntity.getAppId()).setSort(sstAppsDeskEntity.getBasicSort());
if(sstAppsDeskEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(sstAppsDeskEntity.getAppId()));
}
if(sstAppsDeskEntity.getShowHot()==1){
hotApps.add(appInfoMap.get(sstAppsDeskEntity.getAppId()));
}
}
siteApp.put("showApps", showApps);
......@@ -206,4 +213,16 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
condition.put("appId",appId);
this.dao.delete(condition);
}
@Override
public void clickCountAdd(Long appId, Long siteId) {
SstAppsDeskEntity sstAppsDeskEntity = this.selectOne(new SstAppsDeskQuery().appId(appId).siteId(siteId));
if(sstAppsDeskEntity!=null){
Map<String,Object> condition = new HashMap<>();
condition.put("id",sstAppsDeskEntity.getId());
Map<String,Object> data = new HashMap<>();
data.put("clickSumIncrement",1);
this.dao.update(data,condition);
}
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.feign.app.IAppFeign;
import com.mortals.xhx.module.apps.model.AppsInfoEntity;
import com.mortals.xhx.module.apps.service.AppsInfoService;
import com.mortals.xhx.module.sst.model.SstAppsQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -147,9 +148,10 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
}
@Override
public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host) {
public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host,String appName) {
SstAppsEntity query = new SstAppsEntity();
Map<String,String> orderCols = new HashMap<>();
orderCols.put("clickSum","DESC");
orderCols.put("basicSort","DESC");
query.setOrderCols(orderCols);
query.setSiteId(siteId);
......@@ -171,6 +173,7 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
AppsInfoEntity appsInfoQuery = new AppsInfoEntity();
appsInfoQuery.setSiteId(siteId);
appsInfoQuery.setName(appName);
List<AppsInfoEntity> allApps = appsInfoService.find(appsInfoQuery);
for(AppsInfoEntity appsInfoEntity:allApps){
if(com.mortals.framework.util.StringUtils.isNotEmpty(host)) {
......@@ -187,6 +190,11 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
if(black.containsKey(sstAppsEntity.getAppId())){
continue;
}
if(!appInfoMap.containsKey(sstAppsEntity.getAppId())){
continue;
}
appInfoMap.get(sstAppsEntity.getAppId()).setClickSum(sstAppsEntity.getClickSum());
appInfoMap.get(sstAppsEntity.getAppId()).setSort(sstAppsEntity.getBasicSort());
if(sstAppsEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(sstAppsEntity.getAppId()));
}
......@@ -209,4 +217,16 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
condition.put("appId",appId);
this.dao.delete(condition);
}
@Override
public void clickCountAdd(Long appId,Long siteId) {
SstAppsEntity sstAppsEntity = this.selectOne(new SstAppsQuery().appId(appId).siteId(siteId));
if(sstAppsEntity!=null){
Map<String,Object> condition = new HashMap<>();
condition.put("id",sstAppsEntity.getId());
Map<String,Object> data = new HashMap<>();
data.put("clickSumIncrement",1);
this.dao.update(data,condition);
}
}
}
\ No newline at end of file
......@@ -42,6 +42,7 @@ public class SstAgreementController extends BaseCRUDJsonBodyMappingController<Ss
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "protocolType", paramService.getParamBySecondOrganize("SstAgreement","protocolType"));
super.init(model, context);
}
......
package com.mortals.xhx.module.sst.web;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IUser;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.AppCategoryPdu;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.app.IAppFeign;
import com.mortals.xhx.module.sst.service.SstAppsDeskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -40,6 +46,8 @@ public class SstAppsController extends BaseCRUDJsonBodyMappingController<SstApps
private ParamService paramService;
@Autowired
private SstAppsDeskService sstAppsDeskService;
@Autowired
private IAppFeign appFeign;
public SstAppsController(){
super.setModuleDesc( "应用编排");
......@@ -79,4 +87,62 @@ public class SstAppsController extends BaseCRUDJsonBodyMappingController<SstApps
return ret;
}
@PostMapping({"category/list"})
@UnAuth
public Rest<Object> categoryList(@RequestBody AppCategoryPdu query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询应用分类列表";
int code;
try {
Rest<RespData<List<AppCategoryPdu>>> result = appFeign.categoryList(query);
code = result.getCode();
if(code > 0) {
model.put("data", result.getData().getData());
model.put("pageInfo", result.getData().getPageInfo());
model.put("dict", result.getData().getDict());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@GetMapping(value = {"click"})
@UnAuth
public String clickSum(@RequestParam("appId") Long appId,@RequestParam("siteId") Long siteId) {
Map<String, Object> model = new HashMap();
if (appId == null) {
return this.createFailJsonResp("请选择待查看" + this.getModuleDesc() + "信息");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "查看" + this.getModuleDesc();
Context context = this.getContext();
try {
this.service.clickCountAdd(appId,siteId);
model.put("message_info","操作成功");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.sst.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.IUser;
......@@ -34,7 +35,7 @@ import static com.mortals.framework.ap.SysConstains.*;
* @date 2023-04-09
*/
@RestController
@RequestMapping("sst/apps/desk")
@RequestMapping("apps/desk")
public class SstAppsDeskController extends BaseCRUDJsonBodyMappingController<SstAppsDeskService,SstAppsDeskEntity,Long> {
@Autowired
......@@ -76,4 +77,31 @@ public class SstAppsDeskController extends BaseCRUDJsonBodyMappingController<Sst
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@GetMapping(value = {"click"})
@UnAuth
public String clickSum(@RequestParam("appId") Long appId,@RequestParam("siteId") Long siteId) {
Map<String, Object> model = new HashMap();
if (appId == null) {
return this.createFailJsonResp("请选择待查看" + this.getModuleDesc() + "信息");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "查看" + this.getModuleDesc();
Context context = this.getContext();
try {
this.service.clickCountAdd(appId,siteId);
model.put("message_info","操作成功");
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
}
\ 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