|
|
@ -11,6 +11,7 @@ import org.dromara.business.service.IBusinessAlertStatisticsService; |
|
|
|
import org.dromara.common.core.exception.ServiceException; |
|
|
|
import org.dromara.common.redis.utils.RedisUtils; |
|
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
|
import org.dromara.system.api.RemoteDataScopeService; |
|
|
|
import org.dromara.system.api.RemoteDeptService; |
|
|
|
import org.dromara.system.api.RemoteLabelPostService; |
|
|
|
import org.dromara.system.api.RemotePostService; |
|
|
@ -52,6 +53,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
@DubboReference |
|
|
|
RemotePostService remotePostService; |
|
|
|
|
|
|
|
@DubboReference(timeout = 30000) |
|
|
|
RemoteDataScopeService remoteDataScopeService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 按照月份分类预警数量 |
|
|
@ -60,6 +63,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StatObj> countMonthAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getDeptId())){ |
|
|
|
List<RemoteDeptVo> remoteDeptVoList = remoteDeptService.selectListByParentId(businessAlertBo.getDeptId()); |
|
|
|
List<Long> departIdList = remoteDeptVoList.stream().map(RemoteDeptVo::getDeptId).toList(); |
|
|
@ -75,6 +81,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<StatObj>countDepartAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId())); |
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
@ -85,6 +93,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<StatObj> countMonthAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = baseMapper.listMonthAlertStatus(businessAlertBo); |
|
|
@ -105,6 +115,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<StatObj> countDepartAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId())); |
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
@ -131,6 +143,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
|
return baseMapper.countAlertCompare(businessAlertBo); |
|
|
@ -145,6 +159,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
public StatObj countPanelAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
LocalDate today = LocalDate.now(); |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
|
if (ObjectUtil.isEmpty(getAiLabel(businessAlertBo.getPostCode()))){ |
|
|
|
return new StatObj(0, 0,0,0,0,0); |
|
|
@ -206,6 +223,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> countAlertTypeCompare(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
|
return baseMapper.countAlertTypeCompare(businessAlertBo); |
|
|
@ -218,6 +237,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String,Object> countPanelTotalAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
@ -285,6 +306,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
public Map<String, Object> countCurrentDayAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
|
|
|
|
@ -314,6 +338,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
@Override |
|
|
|
public List<StatObj> countPostDayAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
List<StatObj> result = new ArrayList<>(); |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
//查询所有的职能岗位
|
|
|
|
List<RemotePostVo> postVoList = remotePostService.listPost(); |
|
|
|
|
|
|
@ -338,6 +366,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StatObj> countPostAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
//查询所有的职能岗位
|
|
|
|
List<RemotePostVo> postVoList = remotePostService.listPost(); |
|
|
|
|
|
|
@ -388,6 +420,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StatObj> handlerRate(BusinessAlertBo businessAlertBo) { |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
//查询所有的职能岗位
|
|
|
|
List<RemotePostVo> postVoList = remotePostService.listPost(); |
|
|
|
|
|
|
@ -434,6 +470,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
throw new ServiceException("【postCode】 岗位编码为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
List<RemoteAiLabelPostVo> labelList = getAiLabel(businessAlertBo.getPostCode()); |
|
|
@ -572,6 +611,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
//-------------------------------------------------------条件构建--------------------------------------------
|
|
|
|
|
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
|
|
|
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
@ -639,6 +681,18 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
return keyMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取app本周预警个数 |
|
|
|
* @param businessAlertBo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, Object> listAppAlertCount(BusinessAlertBo businessAlertBo) { |
|
|
|
//构建查询数据权限
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
return baseMapper.listAppAlertCount(businessAlertBo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取近6个月的月份集合(格式:yyyy-MM) |
|
|
|
*/ |
|
|
@ -683,4 +737,15 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
private List<RemoteAiLabelPostVo> getAiLabel(String postCode) { |
|
|
|
return remoteLabelPostService.selectLabelByList(postCode,null); |
|
|
|
} |
|
|
|
|
|
|
|
private void createPermissions(BusinessAlertBo businessAlertBo) { |
|
|
|
String roleCustom = remoteDataScopeService.getRoleCustom(LoginHelper.getLoginUser().getRoles().getFirst().getRoleId()); |
|
|
|
if (roleCustom.equalsIgnoreCase("-1")){ |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
}else { |
|
|
|
businessAlertBo.setDeptIdList(Arrays.stream(roleCustom.split(",")) |
|
|
|
.map(Long::parseLong) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|