Merge remote-tracking branch 'origin/dev.yang' into dev

dev.yang
Yueng 2024-10-08 19:05:51 +08:00
commit daf43b843b
7 changed files with 57 additions and 8 deletions

View File

@ -43,4 +43,9 @@ public class FaultCodeCache {
*/ */
private List<FaultCode> faultCode; private List<FaultCode> faultCode;
/**
*
*/
private FaultLabel faultLabels;
} }

View File

@ -59,7 +59,10 @@ public class FaultConditionController {
if (faultConditionList.size()>0){ if (faultConditionList.size()>0){
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改"); return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
} }
faultConditionService.saveFaultCondition(FaultCondition.faultConditionadd(faultConditionAddReq)); boolean save = faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
if (save){
faultConditionService.RunCarCondition();
}
return Result.success(null,"规则制定成功"); return Result.success(null,"规则制定成功");
} }

View File

@ -33,11 +33,14 @@ public interface FaultConditionService extends IService<FaultCondition> {
*/ */
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq); List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
void saveFaultCondition(FaultCondition faultCondition);
/** /**
* *
* @return * @return
*/ */
List<FaultCondition> saveFaultConditionList(); List<FaultCondition> saveFaultConditionList();
/**
*
*/
void RunCarCondition();
} }

View File

@ -43,4 +43,9 @@ public interface FaultLabelService extends IService<FaultLabel> {
*/ */
Integer delfaultlabel(Integer messageTypeId); Integer delfaultlabel(Integer messageTypeId);
/**
*
* @param messageTypeId
*/
FaultLabel faultLabelList(long messageTypeId);
} }

View File

@ -13,6 +13,8 @@ import com.muyu.domain.resp.FaultLogListResp;
import com.muyu.server.mapper.FaultConditionMapper; import com.muyu.server.mapper.FaultConditionMapper;
import com.muyu.server.service.FaultConditionService; import com.muyu.server.service.FaultConditionService;
import com.muyu.server.util.ObtainRootLogin; import com.muyu.server.util.ObtainRootLogin;
import com.muyu.server.util.RunCarCondition;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,12 +31,14 @@ import java.util.List;
*/ */
@Service @Service
@AllArgsConstructor
public class FaultConditionServiceImpl public class FaultConditionServiceImpl
extends ServiceImpl<FaultConditionMapper, FaultCondition> extends ServiceImpl<FaultConditionMapper, FaultCondition>
implements FaultConditionService { implements FaultConditionService {
@Autowired @Autowired
private FaultConditionMapper faultConditionMapper; private FaultConditionMapper faultConditionMapper;
private final RunCarCondition runCarCondition;
@ -85,16 +89,19 @@ public class FaultConditionServiceImpl
return list; return list;
} }
@Override
public void saveFaultCondition(FaultCondition faultCondition) {
}
@Override @Override
public List<FaultCondition> saveFaultConditionList() { public List<FaultCondition> saveFaultConditionList() {
return this.list().stream().map(FaultCondition::faultConditionBuilder).toList(); return this.list().stream().map(FaultCondition::faultConditionBuilder).toList();
} }
/**
*
*/
@Override
public void RunCarCondition() {
runCarCondition.text();
}
// private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) { // private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) {
// FaultCodeCache faultCodeCache = new FaultCodeCache(); // FaultCodeCache faultCodeCache = new FaultCodeCache();
// //

View File

@ -78,4 +78,24 @@ public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLa
return faultLabelMapper.delete(queryWrapper); return faultLabelMapper.delete(queryWrapper);
} }
/**
*
* @param messageTypeId
*/
@Override
public FaultLabel faultLabelList(long messageTypeId) {
List<FaultLabel> list = this.list(new LambdaQueryWrapper<FaultLabel>().eq(StringUtils.isNotNull(messageTypeId),
FaultLabel::getMessageTypeId, messageTypeId)).stream().toList();
FaultLabel faultLabel1 = new FaultLabel();
if (!list.isEmpty()){
list.forEach(faultLabel -> {
faultLabel1.setMessageTypeId(faultLabel.getMessageTypeId());
faultLabel1.setMessageTypeName(faultLabel.getMessageTypeName());
faultLabel1.setMessageTypeCode(faultLabel.getMessageTypeCode());
faultLabel1.setMessageTypeBelongs(faultLabel.getMessageTypeBelongs());
});
}
return faultLabel1;
}
} }

View File

@ -30,9 +30,14 @@ public class RunCarCondition implements ApplicationRunner {
private final CarFenceService carFenceService; private final CarFenceService carFenceService;
private final WarnStrategyService warnStrategyService; private final WarnStrategyService warnStrategyService;
private final FaultCodeService faultCodeService; private final FaultCodeService faultCodeService;
private final FaultLabelService faultLabelService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
text();
}
public void text() {
List<FaultCondition> list = faultConditionService.saveFaultConditionList(); List<FaultCondition> list = faultConditionService.saveFaultConditionList();
list.forEach(faultCondition -> { list.forEach(faultCondition -> {
List<CarInformation> carInformationList = carInformationService.selectCarInformation(faultCondition.getCarTypeId()); List<CarInformation> carInformationList = carInformationService.selectCarInformation(faultCondition.getCarTypeId());
@ -47,6 +52,7 @@ public class RunCarCondition implements ApplicationRunner {
} }
if (StringUtils.isNotNull(faultCondition.getMessageTypeId())) { if (StringUtils.isNotNull(faultCondition.getMessageTypeId())) {
faultCodeCache.setFaultCode(faultCodeService.faultCodeList(faultCondition.getMessageTypeId())); faultCodeCache.setFaultCode(faultCodeService.faultCodeList(faultCondition.getMessageTypeId()));
faultCodeCache.setFaultLabels(faultLabelService.faultLabelList(faultCondition.getMessageTypeId()));
} }
ArrayList<CarInformation> carInformations = new ArrayList<>(); ArrayList<CarInformation> carInformations = new ArrayList<>();
carInformations.add(carInformation); carInformations.add(carInformation);