|
|
@@ -26,6 +26,7 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Collections;
|
|
|
@@ -170,9 +171,10 @@ public class ParkingChangeStrategyService {
|
|
|
* 删除收费策略
|
|
|
* @param id
|
|
|
*/
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void deleteChangeStrategy(Long id) {
|
|
|
log.info("删除收费策略,id:{}", id);
|
|
|
- // 新增
|
|
|
+ // 1.s删除
|
|
|
if (id == null) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_NOT_FOUND, "id不能为空");
|
|
|
}
|
|
|
@@ -180,8 +182,14 @@ public class ParkingChangeStrategyService {
|
|
|
if (changeStrategy == null) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.DRIVER_NOT_FOUND, "收费策略不存在");
|
|
|
}
|
|
|
- changeStrategy.setDelFlag(Global.YES);
|
|
|
- parkingChangeStrategyRepository.updateById(changeStrategy);
|
|
|
+ parkingChangeStrategyRepository.removeById(changeStrategy);
|
|
|
+
|
|
|
+ // 2.删除分配公司
|
|
|
+ List<KwtParkingChargeStrategyUnit> strategyUnitList = parkingChangeStrategyUnitRepository.queryByStrategyId(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(strategyUnitList)) {
|
|
|
+ Set<Long> ids = strategyUnitList.stream().map(KwtParkingChargeStrategyUnit::getId).collect(Collectors.toSet());
|
|
|
+ parkingChangeStrategyUnitRepository.removeBatchByIds(ids);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|