| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.C3mChargingChargeParam; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.dao.domain.C3mChargingCharge; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.mapper.C3mChargingChargeMapper; |
| | | import com.sandu.ximon.dao.mapper.C3mChargingMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @AllArgsConstructor |
| | | public class C3mChargingChargeService extends BaseServiceImpl<C3mChargingChargeMapper, C3mChargingCharge> { |
| | | private final C3mChargingChargeMapper c3mChargingChargeMapper; |
| | | private final PoleBindingService bindingService; |
| | | private final C3mChargingMapper chargingMapper; |
| | | |
| | | /** |
| | | * 修改费率 |
| | |
| | | c3m.setTimestamp(timestamp); |
| | | save(c3m); |
| | | } |
| | | // LogService.getBean().log(userId,username,"修改C3m费率",null, |
| | | // "{ "+ JSON.toJSONString(chargeEntities)+" }"); |
| | | |
| | | /** |
| | | * c3充电桩费率更改 日志记录开始 |
| | | */ |
| | | String content = "c3充电桩费率更改:" + JSON.toJSONString(chargeEntities); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "c3充电桩费率更改", content); |
| | | /** |
| | | * c3充电桩费率更改 日志记录结束 |
| | | */ |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 插入费率 |
| | | * |
| | | * @param c3 |
| | | * @return |
| | | */ |
| | |
| | | BeanUtil.copyProperties(c3, charge); |
| | | charge.setTimestamp(new Date().getTime()); |
| | | // c3mChargingChargeMapper.insertCharge(charge); |
| | | |
| | | |
| | | return save(charge); |
| | | } |
| | | |
| | | /** |
| | | * 自动插入默认费率 |
| | | * |
| | | * @param c3Id |
| | | */ |
| | | public void initCharge(Integer c3Id) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据灯杆id查找费率 |
| | | * |
| | | * @param poleId |
| | | * @return |
| | | */ |
| | | public List<C3mChargingCharge> getChargeByPoleId(Long poleId) { |
| | | PoleBinding one = bindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceType, 2).eq(PoleBinding::getPoleId, poleId)); |
| | | if (one == null) { |
| | | throw new BusinessException("未找到绑定关系"); |
| | | } |
| | | Long c3Id = chargingMapper.getAllByC3Mac(one.getDeviceCode()).getC3Id(); |
| | | return getChargeByC3Id(c3Id.intValue()); |
| | | } |
| | | |
| | | public boolean deleteC3mCharging(Integer c3mId) { |
| | | return c3mChargingChargeMapper.deleteCharge(c3mId); |
| | | } |
| | | } |