|
@@ -27,8 +27,10 @@ import com.java110.utils.util.BeanConvertUtil;
|
|
|
import com.java110.vo.ResultVo;
|
|
import com.java110.vo.ResultVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import com.java110.dto.chargeMachinePort.ChargeMachinePortDto;
|
|
import com.java110.dto.chargeMachinePort.ChargeMachinePortDto;
|
|
|
|
|
+
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -48,7 +50,7 @@ import org.slf4j.LoggerFactory;
|
|
|
@Java110Cmd(serviceCode = "chargeMachine.listChargeMachinePort")
|
|
@Java110Cmd(serviceCode = "chargeMachine.listChargeMachinePort")
|
|
|
public class ListChargeMachinePortCmd extends Cmd {
|
|
public class ListChargeMachinePortCmd extends Cmd {
|
|
|
|
|
|
|
|
- private static Logger logger = LoggerFactory.getLogger(ListChargeMachinePortCmd.class);
|
|
|
|
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(ListChargeMachinePortCmd.class);
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IChargeMachinePortV1InnerServiceSMO chargeMachinePortV1InnerServiceSMOImpl;
|
|
private IChargeMachinePortV1InnerServiceSMO chargeMachinePortV1InnerServiceSMOImpl;
|
|
|
|
|
|
|
@@ -62,22 +64,36 @@ public class ListChargeMachinePortCmd extends Cmd {
|
|
|
@Override
|
|
@Override
|
|
|
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
|
|
|
|
|
|
- ChargeMachinePortDto chargeMachinePortDto = BeanConvertUtil.covertBean(reqJson, ChargeMachinePortDto.class);
|
|
|
|
|
|
|
+ ChargeMachinePortDto chargeMachinePortDto = BeanConvertUtil.covertBean(reqJson, ChargeMachinePortDto.class);
|
|
|
|
|
+
|
|
|
|
|
+ int count = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePortsCount(chargeMachinePortDto);
|
|
|
|
|
+
|
|
|
|
|
+ List<ChargeMachinePortDto> chargeMachinePortDtos = null;
|
|
|
|
|
|
|
|
- int count = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePortsCount(chargeMachinePortDto);
|
|
|
|
|
|
|
+ if (count > 0) {
|
|
|
|
|
+ chargeMachinePortDtos = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePorts(chargeMachinePortDto);
|
|
|
|
|
|
|
|
- List<ChargeMachinePortDto> chargeMachinePortDtos = null;
|
|
|
|
|
|
|
+ //调用 第三方查询 插槽状态
|
|
|
|
|
+ queryPortState(chargeMachinePortDtos);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ chargeMachinePortDtos = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (count > 0) {
|
|
|
|
|
- chargeMachinePortDtos = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePorts(chargeMachinePortDto);
|
|
|
|
|
- } else {
|
|
|
|
|
- chargeMachinePortDtos = new ArrayList<>();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, chargeMachinePortDtos);
|
|
|
|
|
+
|
|
|
|
|
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
|
|
|
+
|
|
|
|
|
+ cmdDataFlowContext.setResponseEntity(responseEntity);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, chargeMachinePortDtos);
|
|
|
|
|
|
|
+ private void queryPortState(List<ChargeMachinePortDto> chargeMachinePortDtos) {
|
|
|
|
|
+ if (chargeMachinePortDtos == null || chargeMachinePortDtos.size() < 1) {
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
- ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- cmdDataFlowContext.setResponseEntity(responseEntity);
|
|
|
|
|
|
|
+ for (ChargeMachinePortDto chargeMachinePortDto : chargeMachinePortDtos) {
|
|
|
|
|
+ chargeMachinePortDto.setStateName("空闲");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|