Commit d242eb2e authored by 廖旭伟's avatar 廖旭伟

增加应用访问量点击接口;应用按访问量倒序;应用列表接口增加分类统计数据

parent 8c2a02f2
......@@ -32,4 +32,8 @@ public class AppsInfoVo extends BaseEntityLong {
* 应用主题id
*/
private String appThemeName;
/**
* 应用点击次数
*/
private Integer clickSum;
}
\ 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;
/**
* 站点id
*/
* 站点id
*/
private Long siteId;
/**
* 应用id
*/
* 应用id
*/
private Long appId;
/**
* 应用名称
*/
* 应用名称
*/
private String name;
/**
* 应用描述
*/
* 应用描述
*/
private String describe;
/**
* 应用访问地址
*/
* 应用访问地址
*/
private String url;
/**
* 是否展示基础应用1是0否
*/
* 是否展示基础应用1是0否
*/
private Integer showBasic;
/**
* 基础应用排序号
*/
* 基础应用排序号
*/
private Integer basicSort;
/**
* 是否展示热门应用1是0否
*/
* 是否展示热门应用1是0否
*/
private Integer showHot;
/**
* 热门应用排序号
*/
* 热门应用排序号
*/
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();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -196,44 +66,32 @@ public class SstAppsDeskEntity extends SstAppsDeskVo {
if (obj instanceof SstAppsDeskEntity) {
SstAppsDeskEntity tmp = (SstAppsDeskEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
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 = -1L;
this.appId = null;
this.name = "";
this.name = "";
this.describe = "";
this.describe = "";
this.url = "";
this.url = "";
this.showBasic = 1;
this.showBasic = 1;
this.basicSort = -1;
this.basicSort = null;
this.showHot = 1;
this.showHot = 1;
this.hotSort = -1;
this.hotSort = null;
this.clickSum = -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.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;
/**
* 站点id
*/
* 站点id
*/
private Long siteId;
/**
* 应用名称
*/
* 应用名称
*/
private String name;
/**
* 应用描述
*/
* 应用描述
*/
private String describe;
/**
* 应用访问地址
*/
* 应用访问地址
*/
private String url;
/**
* 是否展示基础应用1是0否
*/
* 是否展示基础应用1是0否
*/
private Integer showBasic;
/**
* 基础应用排序号
*/
* 基础应用排序号
*/
private Integer basicSort;
/**
* 是否展示热门应用1是0否
*/
* 是否展示热门应用1是0否
*/
private Integer showHot;
/**
* 热门应用排序号
*/
* 热门应用排序号
*/
private Integer hotSort;
/**
* 应用id
*/
* 应用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();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -196,44 +66,32 @@ public class SstAppsEntity extends SstAppsVo {
if (obj instanceof SstAppsEntity) {
SstAppsEntity tmp = (SstAppsEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
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 = "";
this.name = "";
this.describe = "";
this.describe = "";
this.url = "";
this.url = "";
this.showBasic = 1;
this.showBasic = 1;
this.basicSort = -1;
this.basicSort = null;
this.showHot = 1;
this.showHot = 1;
this.hotSort = -1;
this.hotSort = null;
this.appId = -1L;
this.appId = null;
this.clickSum = -1;
}
}
\ No newline at end of file
......@@ -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
......@@ -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;
......@@ -148,6 +148,7 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
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);
......@@ -188,6 +189,8 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
if(!appInfoMap.containsKey(sstAppsDeskEntity.getAppId())){
continue;
}
appInfoMap.get(sstAppsDeskEntity.getAppId()).setClickSum(sstAppsDeskEntity.getClickSum());
appInfoMap.get(sstAppsDeskEntity.getAppId()).setSort(sstAppsDeskEntity.getBasicSort());
if(sstAppsDeskEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(sstAppsDeskEntity.getAppId()));
}
......@@ -210,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;
......@@ -150,6 +151,7 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
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);
......@@ -191,6 +193,8 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
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()));
}
......@@ -213,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
......@@ -12,6 +12,7 @@ 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.*;
......@@ -117,4 +118,31 @@ public class SstAppsController extends BaseCRUDJsonBodyMappingController<SstApps
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
......@@ -366,6 +366,7 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
model.put("showApps", sstApps.get("showApps"));
model.put("hotApps", sstApps.get("hotApps"));
model.put("allApps", sstApps.get("allApps"));
model.put("appThemeCount",groupAppTheme((List<AppsInfoEntity>)sstApps.get("showApps")));
AppPdu appPdu = new AppPdu();
appPdu.setSiteId(query.getSiteId());
appPdu.setSize(999);
......@@ -418,6 +419,7 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
model.put("showApps", sstAppsDesk.get("showApps"));
model.put("hotApps", sstAppsDesk.get("hotApps"));
model.put("allApps", sstAppsDesk.get("allApps"));
model.put("appThemeCount",groupAppTheme((List<AppsInfoEntity>)sstAppsDesk.get("showApps")));
AppPdu appPdu = new AppPdu();
appPdu.setSiteId(query.getSiteId());
appPdu.setSize(999);
......@@ -441,4 +443,18 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
return ret;
}
private Map<String,Integer> groupAppTheme(List<AppsInfoEntity> appList){
if(CollectionUtils.isEmpty(appList)){
return null;
}
Map<String,List<AppsInfoEntity>> group = appList.stream().collect(Collectors.groupingBy(AppsInfoEntity::getAppThemeName));
Map<String,Integer> result = new HashMap<>();
for (Map.Entry<String, List<AppsInfoEntity>> itemMap: group.entrySet()) {
String key = itemMap.getKey();
List<AppsInfoEntity> value = itemMap.getValue();
result.put(key,value.size());
}
return result;
}
}
\ 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