| | |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.chargeMachine.ChargeMachineFactorySpecDto; |
| | | import com.java110.intf.common.IChargeMachineFactorySpecV1InnerServiceSMO; |
| | | import com.java110.intf.common.IChargeMachineFactoryV1InnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.java110.dto.chargeMachineFactory.ChargeMachineFactoryDto; |
| | | import com.java110.dto.chargeMachine.ChargeMachineFactoryDto; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | @Autowired |
| | | private IChargeMachineFactoryV1InnerServiceSMO chargeMachineFactoryV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IChargeMachineFactorySpecV1InnerServiceSMO chargeMachineFactorySpecV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "查询小区ID"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | if (count > 0) { |
| | | chargeMachineFactoryDtos = chargeMachineFactoryV1InnerServiceSMOImpl.queryChargeMachineFactorys(chargeMachineFactoryDto); |
| | | freshSpecs(chargeMachineFactoryDtos); |
| | | } else { |
| | | chargeMachineFactoryDtos = new ArrayList<>(); |
| | | } |
| | |
| | | |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | |
| | | /** |
| | | * 刷入配置 |
| | | * |
| | | * @param chargeMachineFactoryDtos |
| | | */ |
| | | private void freshSpecs(List<ChargeMachineFactoryDto> chargeMachineFactoryDtos) { |
| | | |
| | | if (chargeMachineFactoryDtos == null || chargeMachineFactoryDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | List<String> factoryIds = new ArrayList<>(); |
| | | for (ChargeMachineFactoryDto chargeMachineFactoryDto : chargeMachineFactoryDtos) { |
| | | factoryIds.add(chargeMachineFactoryDto.getFactoryId()); |
| | | } |
| | | |
| | | ChargeMachineFactorySpecDto chargeMachineFactorySpecDto = new ChargeMachineFactorySpecDto(); |
| | | chargeMachineFactorySpecDto.setFactoryIds(factoryIds.toArray(new String[factoryIds.size()])); |
| | | |
| | | List<ChargeMachineFactorySpecDto> machineFactorySpecDtos = chargeMachineFactorySpecV1InnerServiceSMOImpl.queryChargeMachineFactorySpecs(chargeMachineFactorySpecDto); |
| | | |
| | | if (machineFactorySpecDtos == null || machineFactorySpecDtos.size() < 1) { |
| | | return; |
| | | } |
| | | List<ChargeMachineFactorySpecDto> specs = null; |
| | | for (ChargeMachineFactoryDto chargeMachineFactoryDto : chargeMachineFactoryDtos) { |
| | | specs = new ArrayList<>(); |
| | | for (ChargeMachineFactorySpecDto tmpMeterMachineFactorySpecDto : machineFactorySpecDtos) { |
| | | if (chargeMachineFactoryDto.getFactoryId().equals(tmpMeterMachineFactorySpecDto.getFactoryId())) { |
| | | specs.add(tmpMeterMachineFactorySpecDto); |
| | | } |
| | | } |
| | | chargeMachineFactoryDto.setSpecs(specs); |
| | | } |
| | | } |
| | | } |