| New file |
| | |
| | | package com.java110.community.cmd.room; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.UnitDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.intf.community.*; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.po.owner.OwnerRoomRelPo; |
| | | import com.java110.po.room.RoomAttrPo; |
| | | import com.java110.po.room.RoomPo; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "room.deleteRoom") |
| | | public class DeleteRoomCmd extends AbstractServiceCmdListener { |
| | | |
| | | @Autowired |
| | | private IUnitV1InnerServiceSMO unitV1InnerServiceSMOImpl; |
| | | @Autowired |
| | | private IUnitInnerServiceSMO unitInnerServiceSMOImpl; |
| | | @Autowired |
| | | private IFloorV1InnerServiceSMO floorV1InnerServiceSMOImpl; |
| | | |
| | | |
| | | @Autowired |
| | | private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomAttrV1InnerServiceSMO roomAttrV1InnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "roomId", "请求报文中未包含roomId节点"); |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId节点"); |
| | | Assert.jsonObjectHaveKey(reqJson, "unitId", "请求报文中未包含unitId节点"); |
| | | |
| | | |
| | | UnitDto unitDto = new UnitDto(); |
| | | unitDto.setCommunityId(reqJson.getString("communityId")); |
| | | unitDto.setUnitId(reqJson.getString("unitId")); |
| | | //校验小区楼ID和小区是否有对应关系 |
| | | List<UnitDto> units = unitInnerServiceSMOImpl.queryUnitsByCommunityId(unitDto); |
| | | |
| | | if (units == null || units.size() < 1) { |
| | | throw new IllegalArgumentException("传入单元ID不是该小区的单元"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.putAll(reqJson); |
| | | RoomPo roomPo = BeanConvertUtil.covertBean(businessUnit, RoomPo.class); |
| | | int flag = roomV1InnerServiceSMOImpl.deleteRoom(roomPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("删除房屋失败"); |
| | | } |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | |
| | | |
| | | } |