Commit 8be650b3 by 高晓磊

获取已经设置的预警人员id

parent 9f2dc139
......@@ -56,7 +56,7 @@ public class StationDaoImpl extends AbstractBaseDao implements StationDao, Stat
@Override
public List<KObject> listStationInfoByRegionalCompany(UUID regionalCompanyId) {
KClass bean = Amino.getStaticMetadataContext().getBean(StationConstant.ENTITY, KClass.class);
KClass bean = Amino.getStaticMetadataContext().getBean(ENTITY, KClass.class);
DetachedCriteria detachedCriteria = DetachedCriteria.forEntityName(bean.getName());
detachedCriteria.add(Restrictions.eq("del", false));
......
package com.xyst.dinas.biz.warn;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.Nullable;
......@@ -26,14 +24,14 @@ public class WarningServiceImpl implements WarningService{
@Autowired
private WarnSettingDao warnSettingDao;
/**
* 新增预警设置<br/>
* 自动触发预警
*/
@Override
public UUID insertWarnSetting(WarnSetting warnSetting) {
String billType = warnSetting.getBillType();
String warnCalculator = warnSetting.warnCalculator();
Assert.notNull(billType, "The billType must not be null!");
......@@ -63,18 +61,18 @@ public class WarningServiceImpl implements WarningService{
baseBusinessWarn.warn();
return warSettingId;
}
/**
* 更新预警设置<br/>
* 自动触发预警
*/
@Override
public void updateWarnSetting(WarnSettingReq warnSetting) {
UUID warSettingId = warnSetting.getId();
Assert.notNull(warSettingId, "The warSettingId must not be null");
KObject warSettingIdObj = warnSettingDao.queryWarnSettingById(warSettingId);
List<UUID> personnel = warnSetting.getPersonnel();
if (personnel!=null) {
String personnelStr = UuidListToString(personnel);
......@@ -91,7 +89,7 @@ public class WarningServiceImpl implements WarningService{
BaseBusinessWarn baseBusinessWarn = new BaseBusinessWarn(warSettingId);
baseBusinessWarn.warn();
}
/**
* 新增预警执行记录
* @param warnExeRecord
......@@ -99,7 +97,7 @@ public class WarningServiceImpl implements WarningService{
*/
@Override
public UUID insertWarnExe(WarnExeRecord warnExeRecord) {
KClass type = Amino.getApplicationMetadataContext().getBean(WarnSettingConstant.ENTITY_WARNINGEXE, KClass.class);
JsonNode json = JSONObjectUtils.toJson(warnExeRecord);
KObject object = JSONObjectUtils.toObject(json, type);
......@@ -112,7 +110,7 @@ public class WarningServiceImpl implements WarningService{
object.set(WarnSettingConstant.ACTUAL_VALUE, warnExeRecord.getActualValue());
return warnSettingDao.create(object);
}
@Override
public void updateWarnExe(WarnExeRecord warnExeRecord) {
KObject object = warnSettingDao.queryWarningExeById(warnExeRecord.getId());
......@@ -122,14 +120,14 @@ public class WarningServiceImpl implements WarningService{
if(warnExeRecord.getActualValue()!=null) object.set("actualValue", warnExeRecord.getActualValue());
warnSettingDao.update(object);
}
/**
* 结束一条预警设置的预警执行记录
* @param warnSettingId
*/
@Override
public void endWarnStateBySettingId(UUID warnSettingId) {
KObject warnExeRecord = warnSettingDao.queryWarnExeRecordBySettingId(warnSettingId);
warnSettingDao.endWarnRecordState(warnExeRecord);
}
......@@ -138,7 +136,7 @@ public class WarningServiceImpl implements WarningService{
public WarnSetting getWarnSetting(UUID warnSettingId) {
return warnSettingDao.getWarnSetting(warnSettingId);
}
@Override
public WarnSetting getWarnSetting(String billType, UUID billId, String target) {
return warnSettingDao.getWarnSetting(billType, billId, target);
......@@ -147,7 +145,7 @@ public class WarningServiceImpl implements WarningService{
public List<KObject> queryWarnSettings(String billType, @Nullable UUID billId,@Nullable String target){
return warnSettingDao.queryWarnSettings(billType, billId, target);
}
@Override
public WarnExeRecord queryWarnExeRecord(UUID warnSettingId) {
return warnSettingDao.queryWarnExeRecord(warnSettingId);
......@@ -171,7 +169,7 @@ public class WarningServiceImpl implements WarningService{
}
@Override
@Override
public KObject queryWarnSettingById(UUID id) {
KObject KObj = warnSettingDao.queryWarnSettingById(id);
return KObj;
......@@ -193,7 +191,7 @@ public class WarningServiceImpl implements WarningService{
KObject warnExeRecord = warnSettingDao.queryWarnExeRecordBySettingId(warnSettingId);
warnSettingDao.endWarnRecordState(warnExeRecord);
}
/**
* 开启或关闭预警设置; 可重复开启或关闭
* @param warnSettingId 预警设置ID
......@@ -251,4 +249,21 @@ public class WarningServiceImpl implements WarningService{
return new BaseBusinessWarn(warnSettingId);
}
@Override
public ArrayList<String> getExistedWarningSettingPersonnelByBillType(UUID id) {
WarnSetting warnSetting = warnSettingDao.getWarnSetting(id);
List<KObject> kObjects = warnSettingDao.queryWarnSettings(warnSetting.getBillType(), null, null);
HashSet<String> strings = new HashSet<>();
kObjects.forEach(a ->
{
String[] personnels = Optional.ofNullable(a.getString("personnel")).orElse("").split(",");
strings.addAll(Arrays.asList(personnels));
}
);
strings.remove("");
return new ArrayList<>(strings);
}
}
package com.xyst.dinas.biz.warn.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
......@@ -95,4 +96,6 @@ public interface WarningService {
void ignoreWarnExeRecord(UUID id);
HashMap<String, Object> warnRecodeGroupInfo(List<UUID> regionalCompanyIds, List<String> targets);
ArrayList<String> getExistedWarningSettingPersonnelByBillType(UUID id);
}
......@@ -64,8 +64,15 @@ public class WarnSettingController {
}
/**
* 获取已经设置的预警通知人员
* @param id
* @return
*/
@GetMapping("/warnsetting/getExistedWarningSettingPersonnel/{id}")
public ResponseObj getExistedWarningSetting(@PathVariable("id")UUID id) {
List<String> personnel = warningService.getExistedWarningSettingPersonnelByBillType(id);
return ResponseObj.success("查询成功",personnel);
}
}
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