|
|
@@ -7,11 +7,14 @@ import com.java110.common.constant.*;
|
|
|
import com.java110.common.exception.ListenerExecuteException;
|
|
|
import com.java110.common.util.Assert;
|
|
|
import com.java110.common.util.BeanConvertUtil;
|
|
|
+import com.java110.common.util.DateUtil;
|
|
|
import com.java110.core.annotation.Java110Listener;
|
|
|
import com.java110.core.context.DataFlowContext;
|
|
|
import com.java110.core.smo.community.ICommunityInnerServiceSMO;
|
|
|
+import com.java110.core.smo.fee.IFeeInnerServiceSMO;
|
|
|
import com.java110.core.smo.owner.IOwnerRoomRelInnerServiceSMO;
|
|
|
import com.java110.dto.CommunityMemberDto;
|
|
|
+import com.java110.dto.FeeDto;
|
|
|
import com.java110.dto.OwnerRoomRelDto;
|
|
|
import com.java110.entity.center.AppService;
|
|
|
import com.java110.event.service.api.ServiceDataFlowEvent;
|
|
|
@@ -22,6 +25,7 @@ import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -40,6 +44,9 @@ public class ExitRoomListener extends AbstractServiceApiDataFlowListener {
|
|
|
@Autowired
|
|
|
private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
|
private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
|
|
|
@@ -75,6 +82,10 @@ public class ExitRoomListener extends AbstractServiceApiDataFlowListener {
|
|
|
//添加单元信息
|
|
|
businesses.add(exitRoom(paramObj, dataFlowContext));
|
|
|
|
|
|
+
|
|
|
+ //删除费用信息
|
|
|
+ businesses.add(exitPropertyFee(paramObj, dataFlowContext));
|
|
|
+
|
|
|
JSONObject paramInObj = super.restToCenterProtocol(businesses, dataFlowContext.getRequestCurrentHeaders());
|
|
|
|
|
|
//将 rest header 信息传递到下层服务中去
|
|
|
@@ -117,6 +128,42 @@ public class ExitRoomListener extends AbstractServiceApiDataFlowListener {
|
|
|
return business;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除物业费用信息
|
|
|
+ *
|
|
|
+ * @param paramInJson 接口调用放传入入参
|
|
|
+ * @param dataFlowContext 数据上下文
|
|
|
+ * @return 订单服务能够接受的报文
|
|
|
+ */
|
|
|
+ private JSONObject exitPropertyFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
|
|
|
+
|
|
|
+
|
|
|
+ //校验物业费是否已经交清
|
|
|
+ FeeDto feeDto = new FeeDto();
|
|
|
+ feeDto.setCommunityId(paramInJson.getString("communityId"));
|
|
|
+ feeDto.setIncomeObjId(paramInJson.getString("storeId"));
|
|
|
+ feeDto.setPayerObjId(paramInJson.getString("roomId"));
|
|
|
+ feeDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_PROPERTY);
|
|
|
+ List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
|
|
|
+
|
|
|
+ if (feeDtos == null || feeDtos.size() != 1) {
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "数据存在问题,物业费对应关系不是一条");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_FEE_INFO);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ JSONObject businessFee = new JSONObject();
|
|
|
+ //businessUnit.putAll(paramInJson);
|
|
|
+ businessFee.put("feeId", feeDtos.get(0).getFeeId());
|
|
|
+ //businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessFee);
|
|
|
+
|
|
|
+ return business;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 数据校验
|
|
|
*
|
|
|
@@ -128,15 +175,42 @@ public class ExitRoomListener extends AbstractServiceApiDataFlowListener {
|
|
|
Assert.jsonObjectHaveKey(paramIn, "communityId", "请求报文中未包含communityId节点");
|
|
|
Assert.jsonObjectHaveKey(paramIn, "ownerId", "请求报文中未包含ownerId节点");
|
|
|
Assert.jsonObjectHaveKey(paramIn, "roomId", "请求报文中未包含roomId节点");
|
|
|
+ Assert.jsonObjectHaveKey(paramIn, "storeId", "请求报文中未包含storeId节点");
|
|
|
|
|
|
JSONObject paramObj = JSONObject.parseObject(paramIn);
|
|
|
Assert.hasLength(paramObj.getString("communityId"), "小区ID不能为空");
|
|
|
Assert.hasLength(paramObj.getString("ownerId"), "ownerId不能为空");
|
|
|
Assert.hasLength(paramObj.getString("roomId"), "roomId不能为空");
|
|
|
+ Assert.hasLength(paramObj.getString("storeId"), "storeId不能为空");
|
|
|
//
|
|
|
|
|
|
super.communityHasOwner(paramObj, communityInnerServiceSMOImpl);
|
|
|
|
|
|
+ //校验物业费是否已经交清
|
|
|
+ FeeDto feeDto = new FeeDto();
|
|
|
+ feeDto.setCommunityId(paramObj.getString("communityId"));
|
|
|
+ feeDto.setIncomeObjId(paramObj.getString("storeId"));
|
|
|
+ feeDto.setPayerObjId(paramObj.getString("roomId"));
|
|
|
+ feeDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_PROPERTY);
|
|
|
+ List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
|
|
|
+
|
|
|
+ if (feeDtos == null || feeDtos.size() == 0) {
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未包含物业费,数据异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(feeDtos.size() > 1){
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "包含多条物业费,数据异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ FeeDto feeDtoData = feeDtos.get(0);
|
|
|
+
|
|
|
+ Calendar calc =Calendar.getInstance();
|
|
|
+ calc.setTime(feeDtoData.getEndTime());
|
|
|
+ calc.add(Calendar.DATE, 30);
|
|
|
+ if(calc.getTime().getTime() < DateUtil.getCurrentDate().getTime()){
|
|
|
+ throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "你还有物业费没有缴清,请先缴清欠款");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -160,4 +234,12 @@ public class ExitRoomListener extends AbstractServiceApiDataFlowListener {
|
|
|
public void setOwnerRoomRelInnerServiceSMOImpl(IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl) {
|
|
|
this.ownerRoomRelInnerServiceSMOImpl = ownerRoomRelInnerServiceSMOImpl;
|
|
|
}
|
|
|
+
|
|
|
+ public IFeeInnerServiceSMO getFeeInnerServiceSMOImpl() {
|
|
|
+ return feeInnerServiceSMOImpl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setFeeInnerServiceSMOImpl(IFeeInnerServiceSMO feeInnerServiceSMOImpl) {
|
|
|
+ this.feeInnerServiceSMOImpl = feeInnerServiceSMOImpl;
|
|
|
+ }
|
|
|
}
|