| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.param.C3mChargingChargeParam; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.domain.C3mCharging; |
| | | import com.sandu.ximon.dao.domain.C3mChargingCharge; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.mapper.C3mChargingChargeMapper; |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | public boolean updateCharge(List<C3mChargingCharge> chargeEntities) { |
| | | public boolean updateCharge(List<C3mChargingCharge> chargeEntities) { //TODO |
| | | // 删除原本存在的费率 |
| | | c3mChargingChargeMapper.deleteCharge(chargeEntities.get(0).getC3Id()); |
| | | Integer c3Id = chargeEntities.get(0).getC3Id(); |
| | | |
| | | if (c3Id == null) { |
| | | throw new BusinessException("c3Id不能为空"); |
| | | } |
| | | c3mChargingChargeMapper.deleteCharge(c3Id); |
| | | Long timestamp = new Date().getTime(); |
| | | |
| | | C3ChargingService chargingService = SpringContextHolder.getBean(C3ChargingService.class); |
| | | C3mCharging byId = chargingService.getById(c3Id); |
| | | if (byId == null) { |
| | | throw new BusinessException("c3Id不存在"); |
| | | } |
| | | String s = chargingService.setRate(byId.getC3Mac(), chargeEntities); |
| | | if (!"操作成功".equals(s)) { |
| | | throw new BusinessException("设置失败,失败原因: " + s); |
| | | } |
| | | // 将费率添加至数据库 |
| | | for (C3mChargingCharge c3m : chargeEntities) { |
| | | c3m.setTimestamp(timestamp); |