|
|
@@ -1,41 +1,38 @@
|
|
|
-package com.java110.api.listener.owner;
|
|
|
+package com.java110.user.cmd.owner;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.java110.api.bmo.owner.IOwnerBMO;
|
|
|
-import com.java110.api.listener.AbstractServiceApiPlusListener;
|
|
|
-import com.java110.core.annotation.Java110Listener;
|
|
|
-import com.java110.core.context.DataFlowContext;
|
|
|
-import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
|
+import com.java110.core.annotation.Java110Cmd;
|
|
|
+import com.java110.core.context.ICmdDataFlowContext;
|
|
|
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
|
|
|
+import com.java110.core.event.cmd.CmdEvent;
|
|
|
import com.java110.dto.RoomDto;
|
|
|
+import com.java110.dto.owner.OwnerAppUserDto;
|
|
|
import com.java110.dto.owner.OwnerCarDto;
|
|
|
import com.java110.dto.owner.OwnerDto;
|
|
|
-import com.java110.intf.community.ICommunityInnerServiceSMO;
|
|
|
+import com.java110.intf.community.IOwnerV1InnerServiceSMO;
|
|
|
import com.java110.intf.community.IRoomInnerServiceSMO;
|
|
|
+import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
|
|
|
+import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO;
|
|
|
import com.java110.intf.user.IOwnerCarInnerServiceSMO;
|
|
|
import com.java110.intf.user.IOwnerInnerServiceSMO;
|
|
|
-import com.java110.utils.constant.ServiceCodeConstant;
|
|
|
+import com.java110.po.owner.OwnerAppUserPo;
|
|
|
+import com.java110.po.owner.OwnerPo;
|
|
|
+import com.java110.utils.exception.CmdException;
|
|
|
import com.java110.utils.util.Assert;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import com.java110.core.log.LoggerFactory;
|
|
|
+import com.java110.utils.util.BeanConvertUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpMethod;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
-/**
|
|
|
- * 删除小区楼信息
|
|
|
- */
|
|
|
-@Java110Listener("deleteOwnerListener")
|
|
|
-public class DeleteOwnerListener extends AbstractServiceApiPlusListener {
|
|
|
-
|
|
|
- private static Logger logger = LoggerFactory.getLogger(DeleteOwnerListener.class);
|
|
|
+@Java110Cmd(serviceCode = "owner.deleteOwner")
|
|
|
+public class DeleteOwnerCmd extends AbstractServiceCmdListener {
|
|
|
|
|
|
@Autowired
|
|
|
- private IOwnerBMO ownerBMOImpl;
|
|
|
+ private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
|
|
|
+ private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl;
|
|
|
|
|
|
@Autowired
|
|
|
private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
|
|
|
@@ -44,21 +41,13 @@ public class DeleteOwnerListener extends AbstractServiceApiPlusListener {
|
|
|
private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
|
|
|
|
|
|
@Autowired
|
|
|
- private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
|
|
|
-
|
|
|
- @Override
|
|
|
- public String getServiceCode() {
|
|
|
- return ServiceCodeConstant.SERVICE_CODE_DELETE_OWNER;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HttpMethod getHttpMethod() {
|
|
|
- return HttpMethod.POST;
|
|
|
- }
|
|
|
+ private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl;
|
|
|
|
|
|
@Override
|
|
|
- protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
|
|
|
+ public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
|
Assert.jsonObjectHaveKey(reqJson, "memberId", "请求报文中未包含memberId");
|
|
|
Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId");
|
|
|
if (!"1001".equals(reqJson.getString("ownerTypeCd"))) { //不是业主成员不管
|
|
|
@@ -76,14 +65,7 @@ public class DeleteOwnerListener extends AbstractServiceApiPlusListener {
|
|
|
throw new IllegalArgumentException("请先删除业主下的成员");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
|
- JSONArray businesses = new JSONArray();
|
|
|
- ownerBMOImpl.deleteOwner(reqJson, context);
|
|
|
- if ("1001".equals(reqJson.getString("ownerTypeCd"))) {
|
|
|
+ if (OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) {
|
|
|
//ownerId 写为 memberId
|
|
|
reqJson.put("ownerId", reqJson.getString("memberId"));
|
|
|
RoomDto roomDto = new RoomDto();
|
|
|
@@ -104,12 +86,33 @@ public class DeleteOwnerListener extends AbstractServiceApiPlusListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
|
+ JSONArray businesses = new JSONArray();
|
|
|
|
|
|
- public ICommunityInnerServiceSMO getCommunityInnerServiceSMOImpl() {
|
|
|
- return communityInnerServiceSMOImpl;
|
|
|
- }
|
|
|
|
|
|
- public void setCommunityInnerServiceSMOImpl(ICommunityInnerServiceSMO communityInnerServiceSMOImpl) {
|
|
|
- this.communityInnerServiceSMOImpl = communityInnerServiceSMOImpl;
|
|
|
+ JSONObject businessOwner = new JSONObject();
|
|
|
+ businessOwner.put("memberId", reqJson.getString("memberId"));
|
|
|
+ businessOwner.put("communityId", reqJson.getString("communityId"));
|
|
|
+
|
|
|
+ OwnerPo ownerPo = BeanConvertUtil.covertBean(businessOwner, OwnerPo.class);
|
|
|
+ int flag = ownerV1InnerServiceSMOImpl.deleteOwner(ownerPo);
|
|
|
+
|
|
|
+ if (flag < 1) {
|
|
|
+ throw new CmdException("删除失败");
|
|
|
+ }
|
|
|
+ OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
|
|
|
+ ownerAppUserDto.setMemberId(reqJson.getString("ownerId"));
|
|
|
+ //查询app用户表
|
|
|
+ List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto);
|
|
|
+ if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) {
|
|
|
+ for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) {
|
|
|
+ OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class);
|
|
|
+ flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo);
|
|
|
+ if (flag < 1) {
|
|
|
+ throw new CmdException("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|