|
|
@@ -0,0 +1,59 @@
|
|
|
+package com.java110.community.cmd.visit;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.java110.core.annotation.Java110Cmd;
|
|
|
+import com.java110.core.context.CmdContextUtils;
|
|
|
+import com.java110.core.context.ICmdDataFlowContext;
|
|
|
+import com.java110.core.event.cmd.Cmd;
|
|
|
+import com.java110.core.event.cmd.CmdEvent;
|
|
|
+import com.java110.dto.IotDataDto;
|
|
|
+import com.java110.dto.owner.OwnerAppUserDto;
|
|
|
+import com.java110.intf.job.IIotInnerServiceSMO;
|
|
|
+import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO;
|
|
|
+import com.java110.intf.user.IUserV1InnerServiceSMO;
|
|
|
+import com.java110.utils.exception.CmdException;
|
|
|
+import com.java110.utils.util.Assert;
|
|
|
+import com.java110.utils.util.ListUtil;
|
|
|
+import com.java110.vo.ResultVo;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Java110Cmd(serviceCode = "visit.queryOwnerVisit")
|
|
|
+public class QueryOwnerVisitCmd extends Cmd {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IIotInnerServiceSMO iotInnerServiceSMOImpl;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
|
|
|
+ Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
|
|
|
+
|
|
|
+
|
|
|
+ String userId = CmdContextUtils.getUserId(context);
|
|
|
+
|
|
|
+
|
|
|
+ OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
|
|
|
+ ownerAppUserDto.setUserId(userId);
|
|
|
+ ownerAppUserDto.setCommunityId(reqJson.getString("communityId"));
|
|
|
+ List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserV1InnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
|
|
|
+ if (ListUtil.isNull(ownerAppUserDtos)) {
|
|
|
+ throw new CmdException("未认证房屋");
|
|
|
+ }
|
|
|
+
|
|
|
+ reqJson.put("ownerId", ownerAppUserDtos.get(0).getMemberId());
|
|
|
+
|
|
|
+ ResultVo resultVo = iotInnerServiceSMOImpl.postIotData(new IotDataDto("listVisitBmoImpl", reqJson));
|
|
|
+
|
|
|
+ context.setResponseEntity(ResultVo.createResponseEntity(resultVo));
|
|
|
+ }
|
|
|
+}
|