old mode 100644
new mode 100755
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.machine.MachineDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.intf.common.IMachineInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn; |
| | | import com.java110.po.owner.OwnerPo; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | |
| | | * |
| | | * @desc add by 吴学文 18:58 |
| | | */ |
| | | @Component(value = "hcDeleteOwnerTransactionIotAdapt") |
| | | @Component(value = "deleteOwnerToIotAdapt") |
| | | public class DeleteOwnerToIotAdapt extends DatabusAdaptImpl { |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | IMachineInnerServiceSMO machineInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | |
| | | /** |
| | | * accessToken={access_token} |
| | | * &extCommunityUuid=01000 |
| | | * &extCommunityId=1 |
| | | * &devSn=111111111 |
| | | * &name=设备名称 |
| | | * &positionType=0 |
| | | * &positionUuid=1 |
| | | * { |
| | | * "userId": "702020042194860037", |
| | | * "machineCode": "101010" |
| | | * } |
| | | * |
| | | * @param business 当前处理业务 |
| | | * @param businesses 所有业务信息 |
| | |
| | | |
| | | OwnerPo ownerPo = BeanConvertUtil.covertBean(businessOwner, OwnerPo.class); |
| | | |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setStatusCd(StatusConstant.STATUS_CD_INVALID); |
| | | ownerDto.setMemberId(ownerPo.getMemberId()); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto); |
| | | |
| | | Assert.listOnlyOne(ownerDtos, "未找到删除的业主信息"); |
| | | //拿到小区ID |
| | | String communityId = ownerPo.getCommunityId(); |
| | | //根据小区ID查询现有设备 |
| | |
| | | locationObjIds.add(communityId); |
| | | machineDto.setLocationObjIds(locationObjIds.toArray(new String[locationObjIds.size()])); |
| | | List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto); |
| | | Assert.listOnlyOne(machineDtos, "未找到设备"); |
| | | for (MachineDto tmpMachineDto : machineDtos) { |
| | | if (!"9999".equals(tmpMachineDto.getMachineTypeCd())) { |
| | | continue; |
| | | } |
| | | MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>(); |
| | | |
| | | postParameters.add("extCommunityUuid", ownerPo.getCommunityId()); |
| | | postParameters.add("uuids", ownerPo.getMemberId()); |
| | | JSONObject postParameters = new JSONObject(); |
| | | postParameters.put("machineCode", tmpMachineDto.getMachineCode()); |
| | | postParameters.put("userId", ownerPo.getMemberId()); |
| | | postParameters.put("name", ownerDtos.get(0).getName()); |
| | | postParameters.put("extMachineId", tmpMachineDto.getMachineId()); |
| | | postParameters.put("extCommunityId", tmpMachineDto.getCommunityId()); |
| | | hcMachineAsynImpl.sendDeleteOwner(postParameters); |
| | | } |
| | | |