java110
2022-01-17 28e7d3937f819a3486b22bfa1c84aee172aaccb4
service-job/src/main/java/com/java110/job/adapt/hcIot/machine/DeleteMachineToIotAdapt.java
old mode 100644 new mode 100755
@@ -23,11 +23,11 @@
import com.java110.job.adapt.DatabusAdaptImpl;
import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
import com.java110.po.machine.MachinePo;
import com.java110.utils.constant.StatusConstant;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.util.List;
@@ -48,13 +48,9 @@
    IMachineInnerServiceSMO machineInnerServiceSMOImpl;
    /**
     * accessToken={access_token}
     * &extCommunityUuid=01000
     * &extCommunityId=1
     * &devSn=111111111
     * &name=设备名称
     * &positionType=0
     * &positionUuid=1
     * {
     * "extMachineId": "702020042194860037"
     * }
     *
     * @param business   当前处理业务
     * @param businesses 所有业务信息
@@ -82,19 +78,17 @@
    }
    private void doSendMachine(Business business, JSONObject businessMachine) {
        MachinePo machinePo = BeanConvertUtil.covertBean(businessMachine, MachinePo.class);
        MachineDto machineDto = new MachineDto();
        machineDto.setMachineId(machinePo.getMachineId());
//        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
//
//        Assert.listOnlyOne(machineDtos, "未找到设备");
        MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
        postParameters.add("extCommunityUuid", machinePo.getCommunityId());
        postParameters.add("devSns", machinePo.getMachineCode());
        //postParameters.add("uuids", machinePo.getMachineId());
        hcMachineAsynImpl.deleteSend(postParameters);
        machineDto.setStatusCd(StatusConstant.STATUS_CD_INVALID);
        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
        Assert.listOnlyOne(machineDtos, "未找到设备");
        JSONObject postParameters = new JSONObject();
        postParameters.put("extMachineId", machinePo.getMachineId());
        postParameters.put("machineCode", machineDtos.get(0).getMachineCode());
        postParameters.put("machineName", machineDtos.get(0).getMachineName());
        postParameters.put("extCommunityId", machineDtos.get(0).getCommunityId());
        hcMachineAsynImpl.deleteMachine(postParameters);
    }
}