|
|
@@ -0,0 +1,90 @@
|
|
|
+package com.java110.api.listener.meterWater;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.java110.api.bmo.fee.IFeeBMO;
|
|
|
+import com.java110.api.bmo.meterWater.IMeterWaterBMO;
|
|
|
+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.factory.GenerateCodeFactory;
|
|
|
+import com.java110.dto.fee.FeeAttrDto;
|
|
|
+import com.java110.dto.fee.FeeConfigDto;
|
|
|
+import com.java110.dto.fee.FeeDto;
|
|
|
+import com.java110.po.fee.FeeAttrPo;
|
|
|
+import com.java110.po.fee.PayFeePo;
|
|
|
+import com.java110.utils.constant.BusinessTypeConstant;
|
|
|
+import com.java110.utils.constant.CommonConstant;
|
|
|
+import com.java110.utils.constant.ServiceCodeMeterWaterConstant;
|
|
|
+import com.java110.utils.util.Assert;
|
|
|
+import com.java110.utils.util.BeanConvertUtil;
|
|
|
+import com.java110.utils.util.DateUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpMethod;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 保存商户侦听
|
|
|
+ * add by wuxw 2019-06-30
|
|
|
+ */
|
|
|
+@Java110Listener("saveProxyFeeListener")
|
|
|
+public class SaveProxyFeeListener extends AbstractServiceApiPlusListener {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMeterWaterBMO meterWaterBMOImpl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFeeBMO feeBMOImpl;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
|
|
|
+ //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
|
|
|
+
|
|
|
+ Assert.hasKeyAndValue(reqJson, "feeTypeCd", "请求报文中未包含费用类型");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "configId", "请求报文中未包含费用项");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "amount", "请求报文中未包含amount");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "consumption", "请求报文中未包含consumption");
|
|
|
+ Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
|
+
|
|
|
+
|
|
|
+ PayFeePo payFeePo = BeanConvertUtil.covertBean(reqJson, PayFeePo.class);
|
|
|
+ payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
|
|
|
+ payFeePo.setIncomeObjId(reqJson.getString("storeId"));
|
|
|
+ //payFeePo.setAmount("-1");
|
|
|
+ payFeePo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
|
|
|
+ payFeePo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
|
|
|
+ payFeePo.setPayerObjId(reqJson.getString("objId"));
|
|
|
+ payFeePo.setPayerObjType(reqJson.getString("objType"));
|
|
|
+ payFeePo.setFeeFlag(FeeDto.FEE_FLAG_ONCE);
|
|
|
+ payFeePo.setState(FeeDto.STATE_DOING);
|
|
|
+ payFeePo.setUserId(context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
|
|
|
+
|
|
|
+ super.insert(context, payFeePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
|
|
|
+
|
|
|
+ FeeAttrPo feeAttrPo = new FeeAttrPo();
|
|
|
+ feeAttrPo.setCommunityId(reqJson.getString("communityId"));
|
|
|
+ feeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_PROXY_CONSUMPTION);
|
|
|
+ feeAttrPo.setValue(reqJson.getString("consumption"));
|
|
|
+ feeAttrPo.setFeeId(payFeePo.getFeeId());
|
|
|
+ feeAttrPo.setAttrId("-1");
|
|
|
+ super.insert(context,feeAttrPo,BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getServiceCode() {
|
|
|
+ return ServiceCodeMeterWaterConstant.ADD_PROXY_FEE;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpMethod getHttpMethod() {
|
|
|
+ return HttpMethod.POST;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|