|
@@ -47,6 +47,7 @@ import com.google.common.collect.Lists;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -88,7 +89,6 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
private WindRelationService windRelationService;
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean createWindField(WindFieldDto windFieldDto) {
|
|
@@ -149,7 +149,7 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
|
|
|
// 校验数据非空
|
|
|
for (WindFieldExceVo exceVo : windFieldExceVoList) {
|
|
|
- if (StringUtils.isEmpty(exceVo.getCityName()) || StringUtils.isEmpty(exceVo.getProvinceName())||StringUtils.isEmpty(exceVo.getAreaCode())) {
|
|
|
+ if (StringUtils.isEmpty(exceVo.getCityName()) || StringUtils.isEmpty(exceVo.getProvinceName()) || StringUtils.isEmpty(exceVo.getAreaCode())) {
|
|
|
return ResultResp.FAIL("当前导入风场数据未填写区域,请核查导入数据!");
|
|
|
}
|
|
|
if (exceVo.getLongitude() == null || exceVo.getLatitude() == null) {
|
|
@@ -159,7 +159,7 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
|
|
|
// 校验是否有重复的风场名称
|
|
|
Set<String> fieldNameStrings = windFieldExceVoList.stream().map(item -> item.getFieldName()).collect(Collectors.toSet());
|
|
|
- if(windFieldExceVoList.size()!=fieldNameStrings.size()){
|
|
|
+ if (windFieldExceVoList.size() != fieldNameStrings.size()) {
|
|
|
return ResultResp.FAIL("当前导入风场数据有重复风场名称,请核查导入数据!");
|
|
|
}
|
|
|
// 数据校验是否有重名风场
|
|
@@ -281,7 +281,7 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
Example.Criteria criteria = queryExample.createCriteria();
|
|
|
criteria.andEqualTo("fieldCode", fieldCode);
|
|
|
|
|
|
- if(windFieldMapper.updateByExampleSelective(windFieldPO, queryExample) <=0){
|
|
|
+ if (windFieldMapper.updateByExampleSelective(windFieldPO, queryExample) <= 0) {
|
|
|
return false;
|
|
|
}
|
|
|
WindRelationDelDto windRelationDelDto = new WindRelationDelDto();
|
|
@@ -322,8 +322,8 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
// 查询企业对象
|
|
|
WindCompanyDelDto windCompanyDelDto = new WindCompanyDelDto();
|
|
|
windCompanyDelDto.setCompanyCode(po.getCompanyCode());
|
|
|
- WindCompanyVo windCompanyVo = windCompanyService.getWindCompany(windCompanyDelDto);
|
|
|
- if(windCompanyVo!=null){
|
|
|
+ WindCompanyVo windCompanyVo = windCompanyService.getWindCompany(windCompanyDelDto);
|
|
|
+ if (windCompanyVo != null) {
|
|
|
windFieldVo.setCompanyName(windCompanyVo.getCompanyName());
|
|
|
}
|
|
|
|
|
@@ -409,21 +409,9 @@ public class WindFieldServiceImpl extends BaseServiceImpl<WindFieldPO> implement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<WindFieldNameVo> getWindFieldNames() {
|
|
|
-
|
|
|
- Example queryExample = new Example(WindFieldPO.class);
|
|
|
- Example.Criteria criteria = queryExample.createCriteria();
|
|
|
- criteria.andEqualTo("state", Constants.GLOBAL_IN_USE);
|
|
|
- criteria.andEqualTo("delState", DeleteStatusEnum.NODELETE.getCode());
|
|
|
- List<WindFieldPO> list = windFieldMapper.selectByExample(queryExample);
|
|
|
- WindFieldNameVo windFieldNameVo = null;
|
|
|
- List<WindFieldNameVo> windFieldNameVos = Lists.newArrayList();
|
|
|
- for(WindFieldPO po : list){
|
|
|
- windFieldNameVo = new WindFieldNameVo();
|
|
|
- BeanUtil.copyProperties(po,windFieldNameVo);
|
|
|
- windFieldNameVos.add(windFieldNameVo);
|
|
|
- }
|
|
|
- return windFieldNameVos;
|
|
|
+ public List<WindFieldNameVo> getWindFieldNames(Integer userId, Integer roleId) {
|
|
|
+ List<WindFieldNameVo> list = windFieldMapper.selectWindFieldNamesByUserId(userId, roleId);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Override
|