|
@@ -7,23 +7,25 @@ import com.java110.api.listener.AbstractServiceApiListener;
|
|
|
import com.java110.core.annotation.Java110Listener;
|
|
import com.java110.core.annotation.Java110Listener;
|
|
|
import com.java110.core.context.DataFlowContext;
|
|
import com.java110.core.context.DataFlowContext;
|
|
|
import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
|
-import com.java110.dto.RoomDto;
|
|
|
|
|
|
|
+import com.java110.core.factory.GenerateCodeFactory;
|
|
|
import com.java110.dto.contract.ContractDto;
|
|
import com.java110.dto.contract.ContractDto;
|
|
|
import com.java110.dto.fee.FeeAttrDto;
|
|
import com.java110.dto.fee.FeeAttrDto;
|
|
|
import com.java110.dto.fee.FeeConfigDto;
|
|
import com.java110.dto.fee.FeeConfigDto;
|
|
|
import com.java110.dto.fee.FeeDto;
|
|
import com.java110.dto.fee.FeeDto;
|
|
|
-import com.java110.dto.owner.OwnerDto;
|
|
|
|
|
|
|
+import com.java110.dto.payFeeBatch.PayFeeBatchDto;
|
|
|
|
|
+import com.java110.dto.user.UserDto;
|
|
|
import com.java110.entity.center.AppService;
|
|
import com.java110.entity.center.AppService;
|
|
|
-import com.java110.intf.community.IRoomInnerServiceSMO;
|
|
|
|
|
import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
|
|
import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
|
|
|
|
|
+import com.java110.intf.fee.IPayFeeBatchV1InnerServiceSMO;
|
|
|
import com.java110.intf.store.IContractInnerServiceSMO;
|
|
import com.java110.intf.store.IContractInnerServiceSMO;
|
|
|
import com.java110.intf.user.IOwnerInnerServiceSMO;
|
|
import com.java110.intf.user.IOwnerInnerServiceSMO;
|
|
|
|
|
+import com.java110.intf.user.IUserInnerServiceSMO;
|
|
|
|
|
+import com.java110.po.payFeeBatch.PayFeeBatchPo;
|
|
|
import com.java110.utils.constant.CommonConstant;
|
|
import com.java110.utils.constant.CommonConstant;
|
|
|
import com.java110.utils.constant.ServiceCodeConstant;
|
|
import com.java110.utils.constant.ServiceCodeConstant;
|
|
|
import com.java110.utils.util.Assert;
|
|
import com.java110.utils.util.Assert;
|
|
|
import com.java110.utils.util.DateUtil;
|
|
import com.java110.utils.util.DateUtil;
|
|
|
import com.java110.utils.util.StringUtil;
|
|
import com.java110.utils.util.StringUtil;
|
|
|
-import org.apache.http.annotation.Contract;
|
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -64,6 +66,12 @@ public class SaveContractCreateFeeListener extends AbstractServiceApiListener {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
|
|
private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IPayFeeBatchV1InnerServiceSMO payFeeBatchV1InnerServiceSMOImpl;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IUserInnerServiceSMO userInnerServiceSMOImpl;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getServiceCode() {
|
|
public String getServiceCode() {
|
|
|
return ServiceCodeConstant.SERVICE_CODE_SAVE_CONTRACT_CREATE_FEE;
|
|
return ServiceCodeConstant.SERVICE_CODE_SAVE_CONTRACT_CREATE_FEE;
|
|
@@ -90,7 +98,7 @@ public class SaveContractCreateFeeListener extends AbstractServiceApiListener {
|
|
|
protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
|
logger.debug("ServiceDataFlowEvent : {}", event);
|
|
logger.debug("ServiceDataFlowEvent : {}", event);
|
|
|
String storeId = context.getRequestCurrentHeaders().get("store-id");
|
|
String storeId = context.getRequestCurrentHeaders().get("store-id");
|
|
|
- reqJson.put("storeId",storeId);
|
|
|
|
|
|
|
+ reqJson.put("storeId", storeId);
|
|
|
List<ContractDto> contractDtos = null;
|
|
List<ContractDto> contractDtos = null;
|
|
|
FeeConfigDto feeConfigDto = new FeeConfigDto();
|
|
FeeConfigDto feeConfigDto = new FeeConfigDto();
|
|
|
feeConfigDto.setCommunityId(reqJson.getString("communityId"));
|
|
feeConfigDto.setCommunityId(reqJson.getString("communityId"));
|
|
@@ -114,6 +122,8 @@ public class SaveContractCreateFeeListener extends AbstractServiceApiListener {
|
|
|
throw new IllegalArgumentException("结束时间错误" + reqJson.getString("endTime"));
|
|
throw new IllegalArgumentException("结束时间错误" + reqJson.getString("endTime"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //生成批次号
|
|
|
|
|
+ generatorBatch(reqJson);
|
|
|
//判断收费范围
|
|
//判断收费范围
|
|
|
ContractDto contractDto = new ContractDto();
|
|
ContractDto contractDto = new ContractDto();
|
|
|
/*if (reqJson.containsKey("roomState") && RoomDto.STATE_SELL.equals(reqJson.getString("roomState"))) {
|
|
/*if (reqJson.containsKey("roomState") && RoomDto.STATE_SELL.equals(reqJson.getString("roomState"))) {
|
|
@@ -126,7 +136,7 @@ public class SaveContractCreateFeeListener extends AbstractServiceApiListener {
|
|
|
|
|
|
|
|
contractDto.setContractId(reqJson.getString("contractId"));
|
|
contractDto.setContractId(reqJson.getString("contractId"));
|
|
|
|
|
|
|
|
- contractDto.setCommunityId(reqJson.getString("communityId"));
|
|
|
|
|
|
|
+ contractDto.setCommunityId(reqJson.getString("communityId"));
|
|
|
contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto);
|
|
contractDtos = contractInnerServiceSMOImpl.queryContracts(contractDto);
|
|
|
|
|
|
|
|
if (contractDtos == null || contractDtos.size() < 1) {
|
|
if (contractDtos == null || contractDtos.size() < 1) {
|
|
@@ -135,6 +145,33 @@ public class SaveContractCreateFeeListener extends AbstractServiceApiListener {
|
|
|
dealContractFee(contractDtos, context, reqJson, event);
|
|
dealContractFee(contractDtos, context, reqJson, event);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生成批次号
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param reqJson
|
|
|
|
|
+ */
|
|
|
|
|
+ private void generatorBatch(JSONObject reqJson) {
|
|
|
|
|
+ PayFeeBatchPo payFeeBatchPo = new PayFeeBatchPo();
|
|
|
|
|
+ payFeeBatchPo.setBatchId(GenerateCodeFactory.getGeneratorId("12"));
|
|
|
|
|
+ payFeeBatchPo.setCommunityId(reqJson.getString("communityId"));
|
|
|
|
|
+ payFeeBatchPo.setCreateUserId(reqJson.getString("userId"));
|
|
|
|
|
+ UserDto userDto = new UserDto();
|
|
|
|
|
+ userDto.setUserId(reqJson.getString("userId"));
|
|
|
|
|
+ List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto);
|
|
|
|
|
+
|
|
|
|
|
+ Assert.listOnlyOne(userDtos, "用户不存在");
|
|
|
|
|
+ payFeeBatchPo.setCreateUserName(userDtos.get(0).getUserName());
|
|
|
|
|
+ payFeeBatchPo.setState(PayFeeBatchDto.STATE_NORMAL);
|
|
|
|
|
+ payFeeBatchPo.setMsg("正常");
|
|
|
|
|
+ int flag = payFeeBatchV1InnerServiceSMOImpl.savePayFeeBatch(payFeeBatchPo);
|
|
|
|
|
+
|
|
|
|
|
+ if (flag < 1) {
|
|
|
|
|
+ throw new IllegalArgumentException("生成批次失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ reqJson.put("batchId", payFeeBatchPo.getBatchId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void dealContractFee(List<ContractDto> contractDtos, DataFlowContext context, JSONObject reqJson, ServiceDataFlowEvent event) {
|
|
private void dealContractFee(List<ContractDto> contractDtos, DataFlowContext context, JSONObject reqJson, ServiceDataFlowEvent event) {
|
|
|
AppService service = event.getAppService();
|
|
AppService service = event.getAppService();
|
|
|
List<String> roomIds = new ArrayList<>();
|
|
List<String> roomIds = new ArrayList<>();
|