Compare commits

..

No commits in common. "daf43b843bdfe6d6ea5aad1769df0bda7781c46b" and "8fa84a4562e0ee22b4ef24003ffe88348982990d" have entirely different histories.

7 changed files with 7 additions and 56 deletions

View File

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

View File

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

View File

@ -33,14 +33,11 @@ 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,9 +43,4 @@ public interface FaultLabelService extends IService<FaultLabel> {
*/ */
Integer delfaultlabel(Integer messageTypeId); Integer delfaultlabel(Integer messageTypeId);
/**
*
* @param messageTypeId
*/
FaultLabel faultLabelList(long messageTypeId);
} }

View File

@ -13,8 +13,6 @@ 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;
@ -31,14 +29,12 @@ 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;
@ -90,16 +86,13 @@ public class FaultConditionServiceImpl
} }
@Override @Override
public List<FaultCondition> saveFaultConditionList() { public void saveFaultCondition(FaultCondition faultCondition) {
return this.list().stream().map(FaultCondition::faultConditionBuilder).toList();
} }
/**
*
*/
@Override @Override
public void RunCarCondition() { public List<FaultCondition> saveFaultConditionList() {
runCarCondition.text(); return this.list().stream().map(FaultCondition::faultConditionBuilder).toList();
} }
// private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) { // private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) {

View File

@ -78,24 +78,4 @@ 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,14 +30,9 @@ 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());
@ -52,7 +47,6 @@ 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);