feat: 增加参引入库对应生成接口

dev
huangfeng 8 months ago
parent 87f544707a
commit 6f0d2f02dd

@ -112,4 +112,11 @@ public class IcdConfigController extends BasicController {
return Response.success("OK");
}
@PostMapping("generateParamindex")
@ApiOperation("生成rptparamindex表的基础数据")
public Response<String> generateParamindex() throws Exception {
configService.generateParamindex();
return Response.success("OK");
}
}

@ -74,10 +74,10 @@ public class ParamBindController extends BasicController {
return Response.success(result);
}
@PostMapping("generateParamindex")
@ApiOperation("生成rptparamindex表的相关绑定数据")
public Response<String> generateParamindex() throws Exception {
String msg = bindService.generateParamindex();
@PostMapping("updateParamindex")
@ApiOperation("更新rptparamindex表的相关绑定数据")
public Response<String> updateParamindex() throws Exception {
String msg = bindService.updateParamindex();
return Response.success(msg);
}

@ -15,6 +15,8 @@ public interface RptparamindexRepository extends JpaRepository<Rptparamindex, St
List<Rptparamindex> findAllByParamindexStartingWith(String param);
List<Rptparamindex> findAllByParamindexEquals(String param);
List<Rptparamindex> findAllByParamindexEqualsAndEqmidIsNotNullAndTablenameIsNotNullAndColnameIsNotNull(String paramindex);
}

@ -24,4 +24,6 @@ public interface IcdFileConfigService {
void clearAll();
List<String> compare61850();
void generateParamindex() throws Exception;
}

@ -24,7 +24,7 @@ public interface ParamBindService {
BindDetail getBind(Integer sensorId) throws Exception;
String generateParamindex() throws Exception;
String updateParamindex() throws Exception;
void clearAll();
}

@ -212,4 +212,30 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
return result;
}
@Override
public void generateParamindex() throws Exception {
List<IcdConfigType> typeLIst = configRepository.findAll();
for (IcdConfigType type : typeLIst) {
List<IcdConfigTypeInst> instList = instRepository.findByIcdConfigTypeId(type.getId());
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
for (IcdConfigTypeInst inst : instList) {
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
+ inst.getInst();
for (IcdConfigTypeAtt att : attList) {
if (att.containInst(inst.getInst())) {
String paramindex = param + "$" + att.getParam();
List<Rptparamindex> rptList = rptparamindexRepository.findAllByParamindexEquals(paramindex);
if (CollectionUtils.isEmpty(rptList)) {
Rptparamindex rpt = Rptparamindex.builder()
.paramindex(paramindex)
.objid(0)
.build();
rptparamindexRepository.save(rpt);
}
}
}
}
}
}
}

@ -282,7 +282,7 @@ public class ParamBindServiceImpl implements ParamBindService {
}
@Override
public String generateParamindex() throws Exception {
public String updateParamindex() throws Exception {
List<NSensor> sensorList = sensorRepository.findByIcdIdIsNotNull();
if (!CollectionUtils.isEmpty(sensorList)) {
for (NSensor item : sensorList) {

Loading…
Cancel
Save