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

增加应用黑名单过滤

parent 9915b628
package com.mortals.xhx.common.pdu.app;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
@Data
public class DeviceBlackappPdu extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 设备id
*/
private Long deviceId;
/**
* 设备编码
*/
private String deviceCode;
/**
* 设备名称
*/
private String deviceName;
/**
* 应用id
*/
private Long appId;
/**
* 应用编码
*/
private String appCode;
/**
* 应用名称
*/
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 DeviceBlackappPdu) {
DeviceBlackappPdu tmp = (DeviceBlackappPdu) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = null;
this.deviceId = null;
this.deviceCode = "";
this.deviceName = "";
this.appId = null;
this.appCode = "";
this.appName = null;
}
}
...@@ -3,6 +3,7 @@ package com.mortals.xhx.feign.app; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.feign.app;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.AppPdu; import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.pdu.app.DeviceBlackappPdu;
import com.mortals.xhx.common.pdu.device.DevicePdu; import com.mortals.xhx.common.pdu.device.DevicePdu;
import com.mortals.xhx.feign.IFeign; import com.mortals.xhx.feign.IFeign;
import com.mortals.xhx.feign.device.IDeviceFeign; import com.mortals.xhx.feign.device.IDeviceFeign;
...@@ -39,6 +40,14 @@ public interface IAppFeign extends IFeign { ...@@ -39,6 +40,14 @@ public interface IAppFeign extends IFeign {
*/ */
@GetMapping(value = "/app/info") @GetMapping(value = "/app/info")
Rest<AppPdu> info(@RequestParam(value = "id") Long id); Rest<AppPdu> info(@RequestParam(value = "id") Long id);
/**
* 设备应用黑名单
* @param appPdu
* @return
*/
@PostMapping(value = "/device/blackapp/list")
Rest<RespData<List<DeviceBlackappPdu>>> blackappList(@RequestBody DeviceBlackappPdu appPdu);
} }
@Slf4j @Slf4j
...@@ -58,6 +67,11 @@ class AppFeignFallbackFactory implements FallbackFactory<IAppFeign> { ...@@ -58,6 +67,11 @@ class AppFeignFallbackFactory implements FallbackFactory<IAppFeign> {
public Rest<AppPdu> info(Long id) { public Rest<AppPdu> info(Long id) {
return Rest.fail("暂时无法获取自助终端应用,请稍后再试!"); return Rest.fail("暂时无法获取自助终端应用,请稍后再试!");
} }
@Override
public Rest<RespData<List<DeviceBlackappPdu>>> blackappList(DeviceBlackappPdu appPdu) {
return Rest.fail("暂时无法获取设备应用黑名单,请稍后再试!");
}
}; };
} }
} }
\ No newline at end of file
...@@ -21,6 +21,9 @@ public class SstBasicVo extends BaseEntityLong { ...@@ -21,6 +21,9 @@ public class SstBasicVo extends BaseEntityLong {
/** 桌面热门应用 */ /** 桌面热门应用 */
private String deskHotAppIds; private String deskHotAppIds;
/** 设备编码 */
private String deviceCode;
public String getShowAppIds() { public String getShowAppIds() {
return showAppIds; return showAppIds;
} }
...@@ -52,4 +55,12 @@ public class SstBasicVo extends BaseEntityLong { ...@@ -52,4 +55,12 @@ public class SstBasicVo extends BaseEntityLong {
public void setDeskHotAppIds(String deskHotAppIds) { public void setDeskHotAppIds(String deskHotAppIds) {
this.deskHotAppIds = deskHotAppIds; this.deskHotAppIds = deskHotAppIds;
} }
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
} }
\ No newline at end of file
...@@ -36,7 +36,7 @@ public interface SstAppsDeskService extends ICRUDService<SstAppsDeskEntity,Long> ...@@ -36,7 +36,7 @@ public interface SstAppsDeskService extends ICRUDService<SstAppsDeskEntity,Long>
* @param siteId 站点ID * @param siteId 站点ID
* @return * @return
*/ */
Map<String, Object> getAppListBySite(Long siteId,String host); Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host);
/** /**
* 应用下架 * 应用下架
......
...@@ -38,7 +38,7 @@ public interface SstAppsService extends ICRUDService<SstAppsEntity,Long>{ ...@@ -38,7 +38,7 @@ public interface SstAppsService extends ICRUDService<SstAppsEntity,Long>{
* @param siteId 站点ID * @param siteId 站点ID
* @return * @return
*/ */
Map<String, Object> getAppListBySite(Long siteId,String host); Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host);
/** /**
* 应用下架 * 应用下架
......
package com.mortals.xhx.module.sst.service.impl; package com.mortals.xhx.module.sst.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.DeviceBlackappPdu;
import com.mortals.xhx.common.utils.StringUtils; 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.model.AppsInfoEntity;
import com.mortals.xhx.module.apps.service.AppsInfoService; import com.mortals.xhx.module.apps.service.AppsInfoService;
import com.mortals.xhx.module.sst.model.SstAppsDeskEntity; import com.mortals.xhx.module.sst.model.SstAppsDeskEntity;
...@@ -29,6 +34,8 @@ import java.util.stream.Collectors; ...@@ -29,6 +34,8 @@ import java.util.stream.Collectors;
public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskDao, SstAppsDeskEntity, Long> implements SstAppsDeskService { public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskDao, SstAppsDeskEntity, Long> implements SstAppsDeskService {
@Autowired @Autowired
private AppsInfoService appsInfoService; private AppsInfoService appsInfoService;
@Autowired
private IAppFeign appFeign;
@Override @Override
public Map<String, Object> getAppsBySiteId(Long siteId) throws AppException { public Map<String, Object> getAppsBySiteId(Long siteId) throws AppException {
...@@ -138,14 +145,27 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD ...@@ -138,14 +145,27 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
} }
@Override @Override
public Map<String, Object> getAppListBySite(Long siteId,String host) { public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host) {
SstAppsDeskEntity query = new SstAppsDeskEntity(); SstAppsDeskEntity query = new SstAppsDeskEntity();
Map<String,String> orderCols = new HashMap<>(); Map<String,String> orderCols = new HashMap<>();
orderCols.put("basicSort","DESC"); orderCols.put("basicSort","DESC");
query.setOrderCols(orderCols); query.setOrderCols(orderCols);
query.setSiteId(siteId); query.setSiteId(siteId);
List<SstAppsDeskEntity> appsEntities = this.find(query); List<SstAppsDeskEntity> appsEntities = this.find(query);
Map<Long,Long> black = new HashMap<>();
if(StringUtils.isNotEmpty(deviceCode)){
DeviceBlackappPdu blackappPdu = new DeviceBlackappPdu();
blackappPdu.setSiteId(siteId);
blackappPdu.setDeviceCode(deviceCode);
Rest<RespData<List<DeviceBlackappPdu>>> rest = appFeign.blackappList(blackappPdu);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
List<AppsInfoEntity> appsInfoEntities = new ArrayList<>();
for(DeviceBlackappPdu pdu:rest.getData().getData()){
black.put(pdu.getAppId(),pdu.getAppId());
}
}
}
AppsInfoEntity appsInfoQuery = new AppsInfoEntity(); AppsInfoEntity appsInfoQuery = new AppsInfoEntity();
appsInfoQuery.setSiteId(siteId); appsInfoQuery.setSiteId(siteId);
List<AppsInfoEntity> allApps = appsInfoService.find(appsInfoQuery); List<AppsInfoEntity> allApps = appsInfoService.find(appsInfoQuery);
...@@ -161,6 +181,9 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD ...@@ -161,6 +181,9 @@ public class SstAppsDeskServiceImpl extends AbstractCRUDServiceImpl<SstAppsDeskD
List<AppsInfoEntity> showApps = new ArrayList<>(); List<AppsInfoEntity> showApps = new ArrayList<>();
List<AppsInfoEntity> hotApps = new ArrayList<>(); List<AppsInfoEntity> hotApps = new ArrayList<>();
for(SstAppsDeskEntity SstAppsDeskEntity:appsEntities){ for(SstAppsDeskEntity SstAppsDeskEntity:appsEntities){
if(black.containsKey(SstAppsDeskEntity.getAppId())){
continue;
}
if(SstAppsDeskEntity.getShowBasic()==1){ if(SstAppsDeskEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(SstAppsDeskEntity.getAppId())); showApps.add(appInfoMap.get(SstAppsDeskEntity.getAppId()));
} }
......
package com.mortals.xhx.module.sst.service.impl; package com.mortals.xhx.module.sst.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.pdu.app.DeviceBlackappPdu;
import com.mortals.xhx.common.utils.StringUtils; 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.model.AppsInfoEntity;
import com.mortals.xhx.module.apps.service.AppsInfoService; import com.mortals.xhx.module.apps.service.AppsInfoService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -30,6 +36,8 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA ...@@ -30,6 +36,8 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
@Autowired @Autowired
private AppsInfoService appsInfoService; private AppsInfoService appsInfoService;
@Autowired
private IAppFeign appFeign;
@Override @Override
public Map<String, Object> getAppsBySiteId(Long siteId) throws AppException { public Map<String, Object> getAppsBySiteId(Long siteId) throws AppException {
...@@ -139,13 +147,27 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA ...@@ -139,13 +147,27 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
} }
@Override @Override
public Map<String, Object> getAppListBySite(Long siteId,String host) { public Map<String, Object> getAppListBySite(String deviceCode,Long siteId,String host) {
SstAppsEntity query = new SstAppsEntity(); SstAppsEntity query = new SstAppsEntity();
Map<String,String> orderCols = new HashMap<>(); Map<String,String> orderCols = new HashMap<>();
orderCols.put("basicSort","DESC"); orderCols.put("basicSort","DESC");
query.setOrderCols(orderCols); query.setOrderCols(orderCols);
query.setSiteId(siteId); query.setSiteId(siteId);
List<SstAppsEntity> appsEntities = this.find(query); List<SstAppsEntity> appsEntities = this.find(query);
Map<Long,Long> black = new HashMap<>();
if(StringUtils.isNotEmpty(deviceCode)){
DeviceBlackappPdu blackappPdu = new DeviceBlackappPdu();
blackappPdu.setSiteId(siteId);
blackappPdu.setDeviceCode(deviceCode);
Rest<RespData<List<DeviceBlackappPdu>>> rest = appFeign.blackappList(blackappPdu);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
List<AppsInfoEntity> appsInfoEntities = new ArrayList<>();
for(DeviceBlackappPdu pdu:rest.getData().getData()){
black.put(pdu.getAppId(),pdu.getAppId());
}
}
}
AppsInfoEntity appsInfoQuery = new AppsInfoEntity(); AppsInfoEntity appsInfoQuery = new AppsInfoEntity();
appsInfoQuery.setSiteId(siteId); appsInfoQuery.setSiteId(siteId);
...@@ -162,6 +184,9 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA ...@@ -162,6 +184,9 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
List<AppsInfoEntity> showApps = new ArrayList<>(); List<AppsInfoEntity> showApps = new ArrayList<>();
List<AppsInfoEntity> hotApps = new ArrayList<>(); List<AppsInfoEntity> hotApps = new ArrayList<>();
for(SstAppsEntity sstAppsEntity:appsEntities){ for(SstAppsEntity sstAppsEntity:appsEntities){
if(black.containsKey(sstAppsEntity.getAppId())){
continue;
}
if(sstAppsEntity.getShowBasic()==1){ if(sstAppsEntity.getShowBasic()==1){
showApps.add(appInfoMap.get(sstAppsEntity.getAppId())); showApps.add(appInfoMap.get(sstAppsEntity.getAppId()));
} }
......
...@@ -247,7 +247,7 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas ...@@ -247,7 +247,7 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
host=""; host="";
} }
log.info("server-name:"+serverName+",server-port:"+serverPort); log.info("server-name:"+serverName+",server-port:"+serverPort);
Map<String, Object> sstApps = sstAppsService.getAppListBySite(query.getSiteId(),host); Map<String, Object> sstApps = sstAppsService.getAppListBySite(query.getDeviceCode(),query.getSiteId(),host);
model.put("showApps", sstApps.get("showApps")); model.put("showApps", sstApps.get("showApps"));
model.put("hotApps", sstApps.get("hotApps")); model.put("hotApps", sstApps.get("hotApps"));
model.put("allApps", sstApps.get("allApps")); model.put("allApps", sstApps.get("allApps"));
...@@ -296,10 +296,19 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas ...@@ -296,10 +296,19 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
host=""; host="";
} }
log.info("server-name:"+serverName+",server-port:"+serverPort); log.info("server-name:"+serverName+",server-port:"+serverPort);
Map<String, Object> sstAppsDesk = sstAppsDeskService.getAppListBySite(query.getSiteId(),host); Map<String, Object> sstAppsDesk = sstAppsDeskService.getAppListBySite(query.getDeviceCode(),query.getSiteId(),host);
model.put("showApps", sstAppsDesk.get("showApps")); model.put("showApps", sstAppsDesk.get("showApps"));
model.put("hotApps", sstAppsDesk.get("hotApps")); model.put("hotApps", sstAppsDesk.get("hotApps"));
model.put("allApps", sstAppsDesk.get("allApps")); model.put("allApps", sstAppsDesk.get("allApps"));
AppPdu appPdu = new AppPdu();
appPdu.setSiteId(query.getSiteId());
appPdu.setSize(999);
appPdu.setType(1);
appPdu.setShelves(1);
Rest<RespData<List<AppPdu>>> rest = appFeign.list(appPdu);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
model.put("dict",rest.getData().getDict());
}
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) { } catch (Exception var9) {
......
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