Commit 4cdeed52 authored by tianbo's avatar tianbo

feat(jg): 更新压力观点装置质量评分

- 增加对项目设备数据质量评分的同步更新逻辑 - 三环设备认领时,增加发布设备创建或编辑事件 - 设置车辆使用信息内部编码字段
parent 20d0989c
...@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.biz.constats.Constants; import com.yeejoin.amos.boot.module.common.biz.constats.Constants;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto; import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto;
...@@ -22,6 +24,7 @@ import lombok.RequiredArgsConstructor; ...@@ -22,6 +24,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
...@@ -45,6 +48,8 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS ...@@ -45,6 +48,8 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
@Value("${grade.calculation.strategy:MAX_GRADE}") @Value("${grade.calculation.strategy:MAX_GRADE}")
private String activeStrategy; private String activeStrategy;
private final ESEquipmentCategory equipmentCategoryDao;
@Override @Override
public Boolean support(EquipCreateOrEditEvent.EquipType equipType) { public Boolean support(EquipCreateOrEditEvent.EquipType equipType) {
return EquipCreateOrEditEvent.EquipType.project.equals(equipType); return EquipCreateOrEditEvent.EquipType.project.equals(equipType);
...@@ -101,6 +106,14 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS ...@@ -101,6 +106,14 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
updateWrapper2.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId); updateWrapper2.eq(IdxBizJgUseInfo::getProjectContraptionId, projectContraptionId);
updateWrapper2.set(IdxBizJgUseInfo::getDataQualityScore, level); updateWrapper2.set(IdxBizJgUseInfo::getDataQualityScore, level);
idxBizJgUseInfoService.update(updateWrapper2); idxBizJgUseInfoService.update(updateWrapper2);
List<ESEquipmentCategoryDto> projectEquips = equipmentCategoryDao.findAllByProjectContraptionId(projectContraptionId);
if (!ValidationUtil.isEmpty(projectEquips)) {
for (ESEquipmentCategoryDto esEquipmentCategoryDto : projectEquips) {
esEquipmentCategoryDto.setDataQualityScore(level);
}
equipmentCategoryDao.saveAll(projectEquips);
}
}); });
} }
......
...@@ -21,7 +21,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum; ...@@ -21,7 +21,9 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.ShCarMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.ShCarMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IShCarService; import com.yeejoin.amos.boot.module.jg.api.service.IShCarService;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
...@@ -31,6 +33,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -31,6 +33,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -109,6 +112,9 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -109,6 +112,9 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
private final ShCarMapper shCarMapper; private final ShCarMapper shCarMapper;
@Autowired
private EventPublisher eventPublisher;
public ShCarServiceImpl(ShCarMapper shCarMapper) { public ShCarServiceImpl(ShCarMapper shCarMapper) {
this.shCarMapper = shCarMapper; this.shCarMapper = shCarMapper;
} }
...@@ -479,6 +485,7 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -479,6 +485,7 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
useInfo.setORegDate((String) paramMap.get("oRegDate")); useInfo.setORegDate((String) paramMap.get("oRegDate"));
useInfo.setOldUseRegistrationTable(JSON.toJSONString(paramMap.get("oldUseRegistrationTable"))); useInfo.setOldUseRegistrationTable(JSON.toJSONString(paramMap.get("oldUseRegistrationTable")));
useInfo.setOldUseRegistrationCertificate(JSON.toJSONString(paramMap.get("oldUseRegistrationCertificate"))); useInfo.setOldUseRegistrationCertificate(JSON.toJSONString(paramMap.get("oldUseRegistrationCertificate")));
useInfo.setUseInnerCode((String) paramMap.get("carNumber"));
idxBizJgUseInfoService.save(useInfo); idxBizJgUseInfoService.save(useInfo);
// 设计信息 // 设计信息
...@@ -572,6 +579,7 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp ...@@ -572,6 +579,7 @@ public class ShCarServiceImpl extends BaseService<ShCar, ShCar, ShCarMapper> imp
// 更新 equList 中的元素 // 更新 equList 中的元素
equList.set(i, equJson); equList.set(i, equJson);
} }
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), new HashSet<>(equRecords), EquipCreateOrEditEvent.EquipType.equip));
return equRecords; return equRecords;
} }
......
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