Your Name
2023-03-08 5b734454bac18f2d4dee4e6bb5a24c31e982b2de
优化代码
1个文件已删除
3个文件已修改
133 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/chargeMachinePort/ChargeMachinePortDto.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachinePortCmd.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/chargeMachine/UpdateChargeMachinePortCmd.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/chargeMachinePort/ChargeMachinePortDto.java
@@ -22,6 +22,7 @@
    private String machineId;
    private String portName;
    private String state;
    private String stateName;
    private String portId;
    private String portCode;
    private String communityId;
@@ -96,4 +97,12 @@
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
    public String getStateName() {
        return stateName;
    }
    public void setStateName(String stateName) {
        this.stateName = stateName;
    }
}
service-common/src/main/java/com/java110/common/cmd/chargeMachine/ListChargeMachinePortCmd.java
@@ -27,8 +27,10 @@
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import com.java110.dto.chargeMachinePort.ChargeMachinePortDto;
import java.util.List;
import java.util.ArrayList;
import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpStatus;
import org.slf4j.Logger;
@@ -48,7 +50,7 @@
@Java110Cmd(serviceCode = "chargeMachine.listChargeMachinePort")
public class ListChargeMachinePortCmd extends Cmd {
  private static Logger logger = LoggerFactory.getLogger(ListChargeMachinePortCmd.class);
    private static Logger logger = LoggerFactory.getLogger(ListChargeMachinePortCmd.class);
    @Autowired
    private IChargeMachinePortV1InnerServiceSMO chargeMachinePortV1InnerServiceSMOImpl;
@@ -62,22 +64,36 @@
    @Override
    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);
        int count = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePortsCount(chargeMachinePortDto);
           List<ChargeMachinePortDto> chargeMachinePortDtos = null;
        List<ChargeMachinePortDto> chargeMachinePortDtos = null;
           if (count > 0) {
               chargeMachinePortDtos = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePorts(chargeMachinePortDto);
           } else {
               chargeMachinePortDtos = new ArrayList<>();
           }
        if (count > 0) {
            chargeMachinePortDtos = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePorts(chargeMachinePortDto);
           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, chargeMachinePortDtos);
            //调用 第三方查询 插槽状态
            queryPortState(chargeMachinePortDtos);
        } else {
            chargeMachinePortDtos = new ArrayList<>();
        }
           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, chargeMachinePortDtos);
           cmdDataFlowContext.setResponseEntity(responseEntity);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        cmdDataFlowContext.setResponseEntity(responseEntity);
    }
    private void queryPortState(List<ChargeMachinePortDto> chargeMachinePortDtos) {
        if (chargeMachinePortDtos == null || chargeMachinePortDtos.size() < 1) {
            return;
        }
        for (ChargeMachinePortDto chargeMachinePortDto : chargeMachinePortDtos) {
            chargeMachinePortDto.setStateName("空闲");
        }
    }
}
service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java
@@ -22,6 +22,7 @@
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.chargeMachinePort.ChargeMachinePortDto;
import com.java110.intf.common.IChargeMachinePortV1InnerServiceSMO;
import com.java110.po.chargeMachinePort.ChargeMachinePortPo;
import com.java110.utils.exception.CmdException;
@@ -60,6 +61,15 @@
        Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含state");
        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
        ChargeMachinePortDto chargeMachinePortDto = new ChargeMachinePortDto();
        chargeMachinePortDto.setMachineId(reqJson.getString("machineId"));
        chargeMachinePortDto.setPortCode(reqJson.getString("portCode"));
        chargeMachinePortDto.setCommunityId(reqJson.getString("communityId"));
        int flag = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePortsCount(chargeMachinePortDto);
        if (flag > 0) {
            throw new CmdException("插座已经存在");
        }
    }
    @Override
service-common/src/main/java/com/java110/common/cmd/chargeMachine/UpdateChargeMachinePortCmd.java
File was deleted