| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.charge.IChargeFactoryAdapt; |
| | | import com.java110.dto.chargeMachine.ChargeMachineDto; |
| | | import com.java110.dto.chargeMachineOrder.NotifyChargeOrderDto; |
| | | import com.java110.dto.chargeMachineOrder.NotifyChargePortDto; |
| | | import com.java110.dto.chargeMachinePort.ChargeMachinePortDto; |
| | | import com.java110.dto.charge.ChargeMachineDto; |
| | | import com.java110.dto.charge.NotifyChargeOrderDto; |
| | | import com.java110.dto.charge.NotifyChargePortDto; |
| | | import com.java110.dto.charge.ChargeMachinePortDto; |
| | | import com.java110.intf.common.IChargeMachineOrderV1InnerServiceSMO; |
| | | import com.java110.po.charge.ChargeMachineOrderPo; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | private static final String QUERY_PORT_URL = DingdingChargeUtils.URL + "/equipments/ID/PORT"; |
| | | |
| | | private static final String QUERY_CHARGE_STATE_URL = DingdingChargeUtils.URL + "/equipments/code/ID"; |
| | | private static final String QUERY_CHARGE_STATE_URL = DingdingChargeUtils.URL + "/equipments/ID"; |
| | | |
| | | |
| | | //开始充电 |
| | |
| | | |
| | | //关闭充电 |
| | | private static final String STOP_CHARGE_URL = DingdingChargeUtils.URL + "/equipments/ID/PORT/close"; |
| | | |
| | | @Autowired |
| | | private IChargeMachineOrderV1InnerServiceSMO chargeMachineOrderV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public ResultVo startCharge(ChargeMachineDto chargeMachineDto, ChargeMachinePortDto chargeMachinePortDto, String chargeType, double duration, String orderId) { |
| | |
| | | chargeMachineDto.setState(ChargeMachineDto.STATE_OFFLINE); |
| | | chargeMachineDto.setStateName("离线"); |
| | | } |
| | | |
| | | @Override |
| | | public void workHeartbeat(ChargeMachineDto chargeMachineDto, String bodyParam) { |
| | | |
| | | JSONArray params = JSONArray.parseArray(bodyParam); |
| | | |
| | | if (params == null || params.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | JSONObject param = null; |
| | | for(int paramIndex = 0 ;paramIndex < params.size() ; paramIndex ++){ |
| | | doWorkHeartbeat(chargeMachineDto,params.getJSONObject(paramIndex)); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 工作心跳 |
| | | * @param chargeMachineDto |
| | | * @param param |
| | | */ |
| | | private void doWorkHeartbeat(ChargeMachineDto chargeMachineDto, JSONObject param) { |
| | | |
| | | ChargeMachineOrderPo chargeMachineOrderPo = new ChargeMachineOrderPo(); |
| | | chargeMachineOrderPo.setOrderId(param.getString("chargeId")); |
| | | |
| | | chargeMachineOrderPo.setCommunityId(chargeMachineDto.getCommunityId()); |
| | | chargeMachineOrderPo.setEnergy(param.getString("energy")); |
| | | |
| | | chargeMachineOrderV1InnerServiceSMOImpl.updateChargeMachineOrder(chargeMachineOrderPo); |
| | | } |
| | | } |