Browse Source

# 缺陷显示问题修改

zhongwei
haungxing 1 year ago
parent
commit
e54e7f5173
  1. 61
      hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  3. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java
  4. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationPushConfigClient.java
  5. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationPushConfigService.java
  6. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  7. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java
  8. 53
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

61
hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java

@ -32,6 +32,67 @@ public class Condition extends org.springblade.core.mp.support.Condition {
return c; return c;
} }
public static <T> LambdaQueryWrapper<T> getQueryWrapper(Class<T> clazz, Object query) {
QueryWrapper qw = new QueryWrapper();
qw.setEntityClass(clazz);
Class queryClass = query.getClass();
List<Field> fieldList = new ArrayList<>();
while (null != queryClass){
fieldList.addAll(Arrays.asList(queryClass.getDeclaredFields()));
queryClass = queryClass.getSuperclass();
}
for(Field field:fieldList){
field.setAccessible(true);
QueryField queryField = field.getAnnotation(QueryField.class);
if(queryField==null) {
continue;
}
Object value;
try {
value = field.get(query);
} catch (Exception e) {
throw new ServiceException("获取属性性出错");
}
if(value==null) {
continue;
}
List list = null;
if(value instanceof List){
list = (List)value;
if(list.size()==0) {
continue;
}
}
String condition = queryField.condition();
if(Func.isBlank(condition)) {
continue;
}
String fileName = camel2under(field.getName());
if(SqlCondition.EQUAL.equals(condition)) {
qw.eq(fileName, value);
}else if(SqlCondition.LIKE.equals(condition)){
qw.like(fileName,value);
}else if(SqlCondition.LIKE_LEFT.equals(condition)){
qw.likeLeft(fileName,value);
}else if(SqlCondition.LIKE_RIGHT.equals(condition)){
qw.likeRight(fileName,value);
}else if(SqlCondition.NOT_IN.equals(condition)){
String columnName = queryField.columnName();
if(Func.isBlank(columnName)) {
throw new ServiceException("查询不包含条件时需要指定列名");
}
qw.notIn(camel2under(columnName),list);
}else if(SqlCondition.IN.equals(condition)){
String columnName = queryField.columnName();
if(Func.isBlank(columnName)) {
throw new ServiceException("查询包含条件时需要指定列名");
}
qw.in(camel2under(columnName),list);
}
}
return qw.lambda();
}
/** /**
* 支持配置化的模糊查询 * 支持配置化的模糊查询
* @param entity 数据库返回的对象实体 * @param entity 数据库返回的对象实体

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -328,7 +328,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
message.setTaskId(operPhenomenonEntity.getId()); message.setTaskId(operPhenomenonEntity.getId());
message.setTenantId("200000"); message.setTenantId("200000");
String countent = String countent =
"您的消缺流程待审批!现象名称:".concat(operPhenomenonEntity.getFaultName()) "您的消缺流程待审批!现象名称:".concat(Optional.ofNullable(operPhenomenonEntity.getFaultName()).orElse(""))
.concat(",审批环节:") .concat(",审批环节:")
.concat(processWorkFlowResponse.getTaskName()); .concat(processWorkFlowResponse.getTaskName());
message.setContent(countent); message.setContent(countent);

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java

@ -5,10 +5,13 @@ import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO; import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO;
import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import java.util.Optional;
/** /**
* 包装类,返回视图层所需的字段 * 包装类,返回视图层所需的字段
* *
@ -39,6 +42,11 @@ public class OperDefectStatisticsWrapper extends BaseEntityWrapper<OperDefectSta
User userHn = UserCache.getUser(entity.getHandler()); User userHn = UserCache.getUser(entity.getHandler());
vo.setHandlerName(userHn == null ? "" : userHn.getName()); vo.setHandlerName(userHn == null ? "" : userHn.getName());
// 赋值消缺处理人名称
vo.setPlanHandlerName(Optional.ofNullable(entity.getPlanHandler()).map(Long::parseLong).map(UserCache::getUser).map(User::getName).orElse(entity.getPlanHandler()));
// 赋值两票工作负责人名称
vo.setPrincipalName(Optional.ofNullable(entity.getPrincipal()).map(UserCache::getUser).map(User::getName).orElse(entity.getPrincipalManual()));
return vo; return vo;
} }

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationPushConfigClient.java

@ -0,0 +1,38 @@
package com.hnac.hzims.operational.station.feign;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName StationPushConfigClient
* @description: 站点类型推送配置feign接口
* @author: hx
* @create: 2023-07-14 09:06
* @Version 4.0
**/
@AllArgsConstructor
@RestController
public class StationPushConfigClient extends BladeController implements IStationPushConfigClient {
private final IStationPushConfigService stationPushConfigService;
private final IStationService stationService;
@Override
@GetMapping(GET_FDP_STATION_TYPE_BY_CODE)
public Integer getFdpStationTypeByCode(@RequestParam String stationCode) {
StationEntity request = new StationEntity();
request.setCode(stationCode);
StationEntity station = stationService.getOne(request);
if(ObjectUtil.isNotEmpty(station)) {
}
return null;
}
}

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationPushConfigService.java

@ -6,6 +6,7 @@ import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO; import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@ -26,4 +27,25 @@ public interface IStationPushConfigService extends BaseService<StationPushConfig
*/ */
IPage<StationPushConfigVO> listPage(Query query,StationPushConfigDTO request); IPage<StationPushConfigVO> listPage(Query query,StationPushConfigDTO request);
/**
* 保存
* @param request
* @return
*/
Boolean doSave(StationPushConfigDTO request);
/**
* 根据ID更新站点推送配置
* @param request 更新内容
* @return
*/
Boolean updateById(StationPushConfigDTO request);
/**
* 获取唯一配置
* @param request 筛选条件
* @return
*/
StationPushConfigVO getOne(StationPushConfigDTO request);
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -47,9 +47,6 @@ public interface IStationService extends BaseService<StationEntity> {
List<User> getUsersByStationId(String stationId); List<User> getUsersByStationId(String stationId);
@Override
boolean updateById(StationEntity req);
StationVO getStationByCode(String code); StationVO getStationByCode(String code);
List<StationEntity> getInRefDept(List<Long> depeIds,String stationType,List<String> types); List<StationEntity> getInRefDept(List<Long> depeIds,String stationType,List<String> types);

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.station.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.station.dto.StationPushConfigDTO; import com.hnac.hzims.operational.station.dto.StationPushConfigDTO;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity; import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.mapper.StationPushConfigMapper; import com.hnac.hzims.operational.station.mapper.StationPushConfigMapper;
@ -10,18 +11,21 @@ import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import com.hnac.hzims.operational.station.wrapper.StationPushConfigWrapper; import com.hnac.hzims.operational.station.wrapper.StationPushConfigWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List; import java.util.List;
/** /**
* @ClassName StationPushConfigServiceImpl * @ClassName StationPushConfigServiceImpl
* @description: * @description: 站点类型推送配置服务类
* @author: hx * @author: hx
* @create: 2023-07-04 16:24 * @create: 2023-07-04 16:24
* @Version 4.0 * @Version 4.0
@ -47,4 +51,37 @@ public class StationPushConfigServiceImpl extends BaseServiceImpl<StationPushCon
return page; return page;
} }
@Override
public Boolean doSave(StationPushConfigDTO request) {
// 站点类型配置唯一性验证
LambdaQueryWrapper<StationPushConfigEntity> lambda = Wrappers.<StationPushConfigEntity>lambdaQuery().eq(StationPushConfigEntity::getStationType, request.getStationType());
List<StationPushConfigEntity> exist = this.list(lambda);
Assert.isTrue(CollectionUtil.isEmpty(exist),() -> {
throw new ServiceException("该站点类型已录入数据,请找到相应数据项进行修改操作");
});
return this.save(BeanUtil.copy(request,StationPushConfigEntity.class));
}
@Override
public Boolean updateById(StationPushConfigDTO request) {
// 站点类型配置唯一性验证
LambdaQueryWrapper<StationPushConfigEntity> lambda = Wrappers.<StationPushConfigEntity>lambdaQuery()
.eq(StationPushConfigEntity::getStationType, request.getStationType())
.ne(StationPushConfigEntity::getId,request.getId());
List<StationPushConfigEntity> exist = this.list(lambda);
Assert.isTrue(CollectionUtil.isEmpty(exist),() -> {
throw new ServiceException("该站点类型已录入数据,请找到相应数据项进行修改操作");
});
return this.updateById(BeanUtil.copy(request,StationPushConfigEntity.class));
}
@Override
public StationPushConfigVO getOne(StationPushConfigDTO request) {
LambdaQueryWrapper<StationPushConfigEntity> lambda = Condition.getQueryWrapper(BeanUtil.copy(request, StationPushConfigEntity.class)).lambda();
lambda.eq(Func.isNotEmpty(request.getStatus()),StationPushConfigEntity::getStatus,request.getStatus());
StationPushConfigEntity pushConfigEntity = this.getOne(lambda);
return StationPushConfigWrapper.build().entityVO(pushConfigEntity);
}
} }

53
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -11,8 +11,10 @@ import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.main.vo.StationCountVo; import com.hnac.hzims.operational.main.vo.StationCountVo;
import com.hnac.hzims.operational.station.StationConstants; import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.dto.StationPushConfigDTO;
import com.hnac.hzims.operational.station.entity.ControlUsersEntity; import com.hnac.hzims.operational.station.entity.ControlUsersEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.mapper.ControlUsersMapper; import com.hnac.hzims.operational.station.mapper.ControlUsersMapper;
import com.hnac.hzims.operational.station.mapper.StationMapper; import com.hnac.hzims.operational.station.mapper.StationMapper;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
@ -20,6 +22,7 @@ import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HzimsStationCountVo; import com.hnac.hzims.operational.station.vo.HzimsStationCountVo;
import com.hnac.hzims.operational.station.vo.StationAndDeptVo; import com.hnac.hzims.operational.station.vo.StationAndDeptVo;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import com.hnac.hzims.operational.station.vo.StationVO; import com.hnac.hzims.operational.station.vo.StationVO;
import com.hnac.hzims.operational.station.wrapper.StationWrapper; import com.hnac.hzims.operational.station.wrapper.StationWrapper;
/*import com.hnac.hzinfo.sdk.core.response.Result; /*import com.hnac.hzinfo.sdk.core.response.Result;
@ -98,11 +101,25 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
Assert.isTrue(this.saveOrUpdate(req), () -> { Assert.isTrue(this.saveOrUpdate(req), () -> {
throw new ServiceException("创建/修改站点信息失败!"); throw new ServiceException("创建/修改站点信息失败!");
}); });
this.update(Wrappers.<StationEntity>lambdaUpdate().set(Func.isNotEmpty(req.getIsAbroad()),StationEntity::getIsAbroad, req.getIsAbroad()).eq(StationEntity::getId, req.getId())); this.pushStation(req);
}
/**
* 推送站点
* @param req 推送站点内容
*/
private void pushStation(StationEntity req) {
// 读取站点类型配置确定是否推送FDP
StationPushConfigEntity config = StationPushConfigEntity.builder().stationType(req.getType()).build();
StationPushConfigVO configVO = stationPushConfigService.getOne(BeanUtil.copy(config, StationPushConfigDTO.class));
if(ObjectUtil.isNotEmpty(configVO) && configVO.getIsPush()) {
log.info("{}站点开始智能诊断站点推送",req.getCode());
new Thread(() -> questionClient.submitStationInfo(configVO.getFdpStationType(), req.getCode(), ""), "智能诊断站点推送").start();
}
// 如果设备数据来源未选定其他 则进行站点初始化操作 // 如果设备数据来源未选定其他 则进行站点初始化操作
if (!(StationConstants.FILL.equals(req.getDataOrigin()) || StationConstants.HZ3000_OTHER.equals(req.getDataSource()))) { if (StationConstants.GATHER.equals(req.getDataOrigin()) && !StationConstants.HZ3000_OTHER.equals(req.getDataSource())) {
new Thread(() -> questionClient.submitStationInfo(req.getCode(), ""), "智能诊断站点推送").start(); log.info("{}站点开始数据平台新建项目",req.getCode());
new Thread(() -> this.instanceProject(req), "新建项目").start(); new Thread(() -> this.instanceProject(req), "数据平台新建项目").start();
} }
} }
@ -222,34 +239,6 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
} }
@Override @Override
public boolean updateById(StationEntity req) {
return super.update(Wrappers.<StationEntity>lambdaUpdate()
.set(StationEntity::getCode, req.getCode())
.set(StationEntity::getName, req.getName())
.set(StationEntity::getType, req.getType())
.set(StationEntity::getCommissionTime, req.getCommissionTime())
.set(StationEntity::getEnableControl, req.getEnableControl())
.set(StationEntity::getLgtd, req.getLgtd())
.set(StationEntity::getLttd, req.getLttd())
.set(StationEntity::getRefDept, req.getRefDept())
.set(StationEntity::getAreaCode, req.getAreaCode())
.set(StationEntity::getRefDomain, req.getRefDomain())
.set(StationEntity::getRefBasin, req.getRefBasin())
.set(StationEntity::getRefArea, req.getRefArea())
.set(StationEntity::getRemark, req.getRemark())
.set(StationEntity::getPic, req.getPic())
.set(StationEntity::getContact, req.getContact())
.set(StationEntity::getContactor, req.getContactor())
.set(StationEntity::getAddress, req.getAddress())
.set(StationEntity::getCompany, req.getCompany())
.set(StationEntity::getCreateDept, req.getCreateDept())
.set(StationEntity::getServeType, req.getServeType())
.set(StationEntity::getLimitWaterLevel, req.getLimitWaterLevel())
.eq(StationEntity::getId, req.getId()));
}
@Override
public List<StationEntity> getInRefDept(List<Long> depeIds, String stationType, List<String> types) { public List<StationEntity> getInRefDept(List<Long> depeIds, String stationType, List<String> types) {
return this.baseMapper.selectInRefDept(depeIds, stationType, types); return this.baseMapper.selectInRefDept(depeIds, stationType, types);
} }

Loading…
Cancel
Save