| New file |
| | |
| | | package com.java110.store.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.store.dao.IMeterWaterServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 删除水电费信息 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessMeterWater:{} 水电费基本信息节点 |
| | | * 2、businessMeterWaterAttr:[{}] 水电费属性信息节点 |
| | | * 3、businessMeterWaterPhoto:[{}] 水电费照片信息节点 |
| | | * 4、businessMeterWaterCerdentials:[{}] 水电费证件信息节点 |
| | | * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("deleteMeterWaterInfoListener") |
| | | @Transactional |
| | | public class DeleteMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteMeterWaterInfoListener.class); |
| | | @Autowired |
| | | IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if(data.containsKey(MeterWaterPo.class.getSimpleName())){ |
| | | Object _obj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(_obj); |
| | | }else { |
| | | businessMeterWaters = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaters.size();_meterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(_meterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 instance数据 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | |
| | | //水电费信息 |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_DEL); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if( businessMeterWaterInfos != null && businessMeterWaterInfos.size() >0) { |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_INVALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | dataFlowContext.addParamOut("waterId",businessMeterWaterInfo.get("water_id")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * 从business表中查询到DEL的数据 将instance中的数据更新回来 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_INVALID); |
| | | |
| | | Map delInfo = new HashMap(); |
| | | delInfo.put("bId",business.getbId()); |
| | | delInfo.put("operate",StatusConstant.OPERATE_DEL); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if(meterWaterInfo != null && meterWaterInfo.size() > 0){ |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessMeterWaterInfos == null || businessMeterWaterInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(meterWater),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business,JSONObject businessMeterWater){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater,"waterId","businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if(businessMeterWater.getString("waterId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"waterId 错误,不能自动生成(必须已经存在的waterId)"+businessMeterWater); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessMeterWater(business,businessMeterWater); |
| | | } |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.store.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.store.dao.IMeterWaterServiceDao; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.entity.center.Business; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 保存 水电费信息 侦听 |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("saveMeterWaterInfoListener") |
| | | @Transactional |
| | | public class SaveMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener{ |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveMeterWaterInfoListener.class); |
| | | |
| | | @Autowired |
| | | private IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * 保存水电费信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if(data.containsKey(MeterWaterPo.class.getSimpleName())){ |
| | | Object bObj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if(bObj instanceof JSONObject){ |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(bObj); |
| | | }else { |
| | | businessMeterWaters = (JSONArray)bObj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int bMeterWaterIndex = 0; bMeterWaterIndex < businessMeterWaters.size();bMeterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(bMeterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if(bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * business 数据转移到 instance |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_ADD); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfo = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if( businessMeterWaterInfo != null && businessMeterWaterInfo.size() >0) { |
| | | reFreshShareColumn(info, businessMeterWaterInfo.get(0)); |
| | | meterWaterServiceDaoImpl.saveMeterWaterInfoInstance(info); |
| | | if(businessMeterWaterInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWaterInfo.get(0).get("water_id")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 刷 分片字段 |
| | | * |
| | | * @param info 查询对象 |
| | | * @param businessInfo 小区ID |
| | | */ |
| | | private void reFreshShareColumn(Map info, Map businessInfo) { |
| | | |
| | | if (info.containsKey("communityId")) { |
| | | return; |
| | | } |
| | | |
| | | if (!businessInfo.containsKey("community_id")) { |
| | | return; |
| | | } |
| | | |
| | | info.put("communityId", businessInfo.get("community_id")); |
| | | } |
| | | /** |
| | | * 撤单 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_VALID); |
| | | Map paramIn = new HashMap(); |
| | | paramIn.put("bId",bId); |
| | | paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if(meterWaterInfo != null && meterWaterInfo.size() > 0){ |
| | | reFreshShareColumn(paramIn, meterWaterInfo.get(0)); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business,JSONObject businessMeterWater){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater,"waterId","businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if(businessMeterWater.getString("waterId").startsWith("-")){ |
| | | //刷新缓存 |
| | | //flushMeterWaterId(business.getDatas()); |
| | | |
| | | businessMeterWater.put("waterId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_waterId)); |
| | | |
| | | } |
| | | |
| | | businessMeterWater.put("bId",business.getbId()); |
| | | businessMeterWater.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存水电费信息 |
| | | meterWaterServiceDaoImpl.saveBusinessMeterWaterInfo(businessMeterWater); |
| | | |
| | | } |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.store.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.store.dao.IMeterWaterServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 修改水电费信息 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessMeterWater:{} 水电费基本信息节点 |
| | | * 2、businessMeterWaterAttr:[{}] 水电费属性信息节点 |
| | | * 3、businessMeterWaterPhoto:[{}] 水电费照片信息节点 |
| | | * 4、businessMeterWaterCerdentials:[{}] 水电费证件信息节点 |
| | | * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("updateMeterWaterInfoListener") |
| | | @Transactional |
| | | public class UpdateMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateMeterWaterInfoListener.class); |
| | | @Autowired |
| | | private IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if(data.containsKey(MeterWaterPo.class.getSimpleName())){ |
| | | Object _obj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(_obj); |
| | | }else { |
| | | businessMeterWaters = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaters.size();_meterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(_meterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * business to instance 过程 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_ADD); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if( businessMeterWaterInfos != null && businessMeterWaterInfos.size() >0) { |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | if(businessMeterWaterInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWaterInfo.get("water_id")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_VALID); |
| | | Map delInfo = new HashMap(); |
| | | delInfo.put("bId",business.getbId()); |
| | | delInfo.put("operate",StatusConstant.OPERATE_DEL); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if(meterWaterInfo != null && meterWaterInfo.size() > 0){ |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessMeterWaterInfos == null || businessMeterWaterInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(meterWater),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business,JSONObject businessMeterWater){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater,"waterId","businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if(businessMeterWater.getString("waterId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"waterId 错误,不能自动生成(必须已经存在的waterId)"+businessMeterWater); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessMeterWater(business,businessMeterWater); |
| | | |
| | | businessMeterWater.put("bId",business.getbId()); |
| | | businessMeterWater.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存水电费信息 |
| | | meterWaterServiceDaoImpl.saveBusinessMeterWaterInfo(businessMeterWater); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.dto.meterWater; |
| | | |
| | | import com.java110.dto.PageDto; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName FloorDto |
| | | * @Description 水电费数据层封装 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 8:52 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | public class MeterWaterDto extends PageDto implements Serializable { |
| | | |
| | | private String remark; |
| | | private String curReadingTime; |
| | | private String waterId; |
| | | private String curDegrees; |
| | | private String meterType; |
| | | private String preDegrees; |
| | | private String objId; |
| | | private String preReadingTime; |
| | | private String communityId; |
| | | private String objType; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | | private String statusCd = "0"; |
| | | |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | public String getCurReadingTime() { |
| | | return curReadingTime; |
| | | } |
| | | public void setCurReadingTime(String curReadingTime) { |
| | | this.curReadingTime = curReadingTime; |
| | | } |
| | | public String getWaterId() { |
| | | return waterId; |
| | | } |
| | | public void setWaterId(String waterId) { |
| | | this.waterId = waterId; |
| | | } |
| | | public String getCurDegrees() { |
| | | return curDegrees; |
| | | } |
| | | public void setCurDegrees(String curDegrees) { |
| | | this.curDegrees = curDegrees; |
| | | } |
| | | public String getMeterType() { |
| | | return meterType; |
| | | } |
| | | public void setMeterType(String meterType) { |
| | | this.meterType = meterType; |
| | | } |
| | | public String getPreDegrees() { |
| | | return preDegrees; |
| | | } |
| | | public void setPreDegrees(String preDegrees) { |
| | | this.preDegrees = preDegrees; |
| | | } |
| | | public String getObjId() { |
| | | return objId; |
| | | } |
| | | public void setObjId(String objId) { |
| | | this.objId = objId; |
| | | } |
| | | public String getPreReadingTime() { |
| | | return preReadingTime; |
| | | } |
| | | public void setPreReadingTime(String preReadingTime) { |
| | | this.preReadingTime = preReadingTime; |
| | | } |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | public String getObjType() { |
| | | return objType; |
| | | } |
| | | public void setObjType(String objType) { |
| | | this.objType = objType; |
| | | } |
| | | |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.po.meterWater; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class MeterWaterPo implements Serializable { |
| | | |
| | | private String remark; |
| | | private String curReadingTime; |
| | | private String waterId; |
| | | private String curDegrees; |
| | | private String meterType; |
| | | private String preDegrees; |
| | | private String objId; |
| | | private String preReadingTime; |
| | | private String communityId; |
| | | private String objType; |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | public String getCurReadingTime() { |
| | | return curReadingTime; |
| | | } |
| | | public void setCurReadingTime(String curReadingTime) { |
| | | this.curReadingTime = curReadingTime; |
| | | } |
| | | public String getWaterId() { |
| | | return waterId; |
| | | } |
| | | public void setWaterId(String waterId) { |
| | | this.waterId = waterId; |
| | | } |
| | | public String getCurDegrees() { |
| | | return curDegrees; |
| | | } |
| | | public void setCurDegrees(String curDegrees) { |
| | | this.curDegrees = curDegrees; |
| | | } |
| | | public String getMeterType() { |
| | | return meterType; |
| | | } |
| | | public void setMeterType(String meterType) { |
| | | this.meterType = meterType; |
| | | } |
| | | public String getPreDegrees() { |
| | | return preDegrees; |
| | | } |
| | | public void setPreDegrees(String preDegrees) { |
| | | this.preDegrees = preDegrees; |
| | | } |
| | | public String getObjId() { |
| | | return objId; |
| | | } |
| | | public void setObjId(String objId) { |
| | | this.objId = objId; |
| | | } |
| | | public String getPreReadingTime() { |
| | | return preReadingTime; |
| | | } |
| | | public void setPreReadingTime(String preReadingTime) { |
| | | this.preReadingTime = preReadingTime; |
| | | } |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | public String getObjType() { |
| | | return objType; |
| | | } |
| | | public void setObjType(String objType) { |
| | | this.objType = objType; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public static final String CODE_PREFIX_typeUserId = "79"; |
| | | |
| | | |
| | | public static final String CODE_PREFIX_waterId = "78"; |
| | | |
| | | |
| | | /** |
| | | * 只有在不调用服务生成ID时有用 |
| | | */ |
| New file |
| | |
| | | package com.java110.core.smo.fee; |
| | | |
| | | import com.java110.core.feign.FeignConfiguration; |
| | | import com.java110.dto.meterWater.MeterWaterDto; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName IMeterWaterInnerServiceSMO |
| | | * @Description 水电费接口类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:04 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @FeignClient(name = "fee-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/meterWaterApi") |
| | | public interface IMeterWaterInnerServiceSMO { |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * |
| | | * @param meterWaterDto 数据对象分享 |
| | | * @return MeterWaterDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryMeterWaters", method = RequestMethod.POST) |
| | | List<MeterWaterDto> queryMeterWaters(@RequestBody MeterWaterDto meterWaterDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param meterWaterDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryMeterWatersCount", method = RequestMethod.POST) |
| | | int queryMeterWatersCount(@RequestBody MeterWaterDto meterWaterDto); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="meterWaterServiceDaoImpl"> |
| | | |
| | | <!-- 保存水电费信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveBusinessMeterWaterInfo" parameterType="Map"> |
| | | insert into business_meter_water( |
| | | remark,cur_reading_time,water_id,cur_degrees,operate,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type |
| | | ) values ( |
| | | #{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{createTime},#{meterType},#{preDegrees},#{objId},#{preReadingTime},#{bId},#{communityId},#{objType} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询水电费信息(Business) add by wuxw 2018-07-03 --> |
| | | <select id="getBusinessMeterWaterInfo" parameterType="Map" resultType="Map"> |
| | | select t.remark,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,t.create_time,t.create_time createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.obj_type,t.obj_type objType |
| | | from business_meter_water t |
| | | where 1 =1 |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="curReadingTime !=null and curReadingTime != ''"> |
| | | and t.cur_reading_time= #{curReadingTime} |
| | | </if> |
| | | <if test="waterId !=null and waterId != ''"> |
| | | and t.water_id= #{waterId} |
| | | </if> |
| | | <if test="curDegrees !=null and curDegrees != ''"> |
| | | and t.cur_degrees= #{curDegrees} |
| | | </if> |
| | | <if test="operate !=null and operate != ''"> |
| | | and t.operate= #{operate} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="meterType !=null and meterType != ''"> |
| | | and t.meter_type= #{meterType} |
| | | </if> |
| | | <if test="preDegrees !=null and preDegrees != ''"> |
| | | and t.pre_degrees= #{preDegrees} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="preReadingTime !=null and preReadingTime != ''"> |
| | | and t.pre_reading_time= #{preReadingTime} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 保存水电费信息至 instance表中 add by wuxw 2018-07-03 --> |
| | | <insert id="saveMeterWaterInfoInstance" parameterType="Map"> |
| | | insert into meter_water( |
| | | remark,status_cd,cur_reading_time,water_id,cur_degrees,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type |
| | | ) select t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.create_time,t.meter_type,t.pre_degrees,t.obj_id,t.pre_reading_time,t.b_id,t.community_id,t.obj_type from business_meter_water t where 1=1 |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="curReadingTime !=null and curReadingTime != ''"> |
| | | and t.cur_reading_time= #{curReadingTime} |
| | | </if> |
| | | <if test="waterId !=null and waterId != ''"> |
| | | and t.water_id= #{waterId} |
| | | </if> |
| | | <if test="curDegrees !=null and curDegrees != ''"> |
| | | and t.cur_degrees= #{curDegrees} |
| | | </if> |
| | | and t.operate= 'ADD' |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="meterType !=null and meterType != ''"> |
| | | and t.meter_type= #{meterType} |
| | | </if> |
| | | <if test="preDegrees !=null and preDegrees != ''"> |
| | | and t.pre_degrees= #{preDegrees} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="preReadingTime !=null and preReadingTime != ''"> |
| | | and t.pre_reading_time= #{preReadingTime} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <!-- 查询水电费信息 add by wuxw 2018-07-03 --> |
| | | <select id="getMeterWaterInfo" parameterType="Map" resultType="Map"> |
| | | select t.remark,t.status_cd,t.status_cd statusCd,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.create_time,t.create_time createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.obj_type,t.obj_type objType |
| | | from meter_water t |
| | | where 1 =1 |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="curReadingTime !=null and curReadingTime != ''"> |
| | | and t.cur_reading_time= #{curReadingTime} |
| | | </if> |
| | | <if test="waterId !=null and waterId != ''"> |
| | | and t.water_id= #{waterId} |
| | | </if> |
| | | <if test="curDegrees !=null and curDegrees != ''"> |
| | | and t.cur_degrees= #{curDegrees} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="meterType !=null and meterType != ''"> |
| | | and t.meter_type= #{meterType} |
| | | </if> |
| | | <if test="preDegrees !=null and preDegrees != ''"> |
| | | and t.pre_degrees= #{preDegrees} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="preReadingTime !=null and preReadingTime != ''"> |
| | | and t.pre_reading_time= #{preReadingTime} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 修改水电费信息 add by wuxw 2018-07-03 --> |
| | | <update id="updateMeterWaterInfoInstance" parameterType="Map"> |
| | | update meter_water t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="remark !=null and remark != ''"> |
| | | , t.remark= #{remark} |
| | | </if> |
| | | <if test="curReadingTime !=null and curReadingTime != ''"> |
| | | , t.cur_reading_time= #{curReadingTime} |
| | | </if> |
| | | <if test="curDegrees !=null and curDegrees != ''"> |
| | | , t.cur_degrees= #{curDegrees} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | , t.create_time= #{createTime} |
| | | </if> |
| | | <if test="meterType !=null and meterType != ''"> |
| | | , t.meter_type= #{meterType} |
| | | </if> |
| | | <if test="preDegrees !=null and preDegrees != ''"> |
| | | , t.pre_degrees= #{preDegrees} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | , t.obj_id= #{objId} |
| | | </if> |
| | | <if test="preReadingTime !=null and preReadingTime != ''"> |
| | | , t.pre_reading_time= #{preReadingTime} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | , t.community_id= #{communityId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | , t.obj_type= #{objType} |
| | | </if> |
| | | where 1=1 <if test="waterId !=null and waterId != ''"> |
| | | and t.water_id= #{waterId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询水电费数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryMeterWatersCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from meter_water t |
| | | where 1 =1 |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="curReadingTime !=null and curReadingTime != ''"> |
| | | and t.cur_reading_time= #{curReadingTime} |
| | | </if> |
| | | <if test="waterId !=null and waterId != ''"> |
| | | and t.water_id= #{waterId} |
| | | </if> |
| | | <if test="curDegrees !=null and curDegrees != ''"> |
| | | and t.cur_degrees= #{curDegrees} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="meterType !=null and meterType != ''"> |
| | | and t.meter_type= #{meterType} |
| | | </if> |
| | | <if test="preDegrees !=null and preDegrees != ''"> |
| | | and t.pre_degrees= #{preDegrees} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="preReadingTime !=null and preReadingTime != ''"> |
| | | and t.pre_reading_time= #{preReadingTime} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | |
| | | /** |
| | | * 保存水电费 |
| | | */ |
| | | public static final String BUSINESS_TYPE_SAVE_METER_WATER = "631100030001"; |
| | | /** |
| | | * 修改水电费 |
| | | */ |
| | | public static final String BUSINESS_TYPE_UPDATE_METER_WATER = "631100040001"; |
| | | /** |
| | | * 删除水电费 |
| | | */ |
| | | public static final String BUSINESS_TYPE_DELETE_METER_WATER = "631100050001"; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存代理商信息 |
| | | */ |
| | | public static final String BUSINESS_TYPE_SAVE_AGENT_INFO = "700100030001"; |
| New file |
| | |
| | | package com.java110.utils.constant; |
| | | |
| | | /** |
| | | * 水电费常量类 |
| | | * Created by wuxw on 2017/5/20. |
| | | */ |
| | | public class ServiceCodeMeterWaterConstant { |
| | | |
| | | /** |
| | | * 添加 水电费 |
| | | */ |
| | | public static final String ADD_METERWATER = "meterWater.saveMeterWater"; |
| | | |
| | | |
| | | /** |
| | | * 修改 水电费 |
| | | */ |
| | | public static final String UPDATE_METERWATER = "meterWater.updateMeterWater"; |
| | | /** |
| | | * 删除 水电费 |
| | | */ |
| | | public static final String DELETE_METERWATER = "meterWater.deleteMeterWater"; |
| | | |
| | | |
| | | /** |
| | | * 查询 水电费 |
| | | */ |
| | | public static final String LIST_METERWATERS = "meterWater.listMeterWaters"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.IApiBaseBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | |
| | | public interface IMeterWaterBMO extends IApiBaseBMO { |
| | | |
| | | |
| | | /** |
| | | * 添加水电费 |
| | | * @param paramInJson |
| | | * @param dataFlowContext |
| | | * @return |
| | | */ |
| | | void addMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 添加水电费信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void updateMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 删除水电费 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void deleteMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.meterWater.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.ApiBaseBMO; |
| | | import com.java110.api.bmo.meterWater.IMeterWaterBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.smo.fee.IMeterWaterInnerServiceSMO; |
| | | import com.java110.po.meterWater.MeterWaterPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("meterWaterBMOImpl") |
| | | public class MeterWaterBMOImpl extends ApiBaseBMO implements IMeterWaterBMO { |
| | | |
| | | @Autowired |
| | | private IMeterWaterInnerServiceSMO meterWaterInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void addMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | paramInJson.put("waterId", "-1"); |
| | | MeterWaterPo meterWaterPo = BeanConvertUtil.covertBean(paramInJson, MeterWaterPo.class); |
| | | super.insert(dataFlowContext, meterWaterPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_METER_WATER); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加活动信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void updateMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | MeterWaterPo meterWaterPo = BeanConvertUtil.covertBean(paramInJson, MeterWaterPo.class); |
| | | super.update(dataFlowContext, meterWaterPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_METER_WATER); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void deleteMeterWater(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | MeterWaterPo meterWaterPo = BeanConvertUtil.covertBean(paramInJson, MeterWaterPo.class); |
| | | super.update(dataFlowContext, meterWaterPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_METER_WATER); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.utils.constant.ServiceCodeMeterWaterConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | |
| | | /** |
| | | * 保存小区侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("deleteMeterWaterListener") |
| | | public class DeleteMeterWaterListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IMeterWaterBMO meterWaterBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "waterId", "waterId不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | meterWaterBMOImpl.deleteMeterWater(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeMeterWaterConstant.DELETE_METERWATER; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.smo.fee.IMeterWaterInnerServiceSMO; |
| | | import com.java110.dto.meterWater.MeterWaterDto; |
| | | import com.java110.utils.constant.ServiceCodeMeterWaterConstant; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 查询小区侦听类 |
| | | */ |
| | | @Java110Listener("listMeterWatersListener") |
| | | public class ListMeterWatersListener extends AbstractServiceApiListener { |
| | | |
| | | @Autowired |
| | | private IMeterWaterInnerServiceSMO meterWaterInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeMeterWaterConstant.LIST_METERWATERS; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.GET; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return DEFAULT_ORDER; |
| | | } |
| | | |
| | | |
| | | public IMeterWaterInnerServiceSMO getMeterWaterInnerServiceSMOImpl() { |
| | | return meterWaterInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setMeterWaterInnerServiceSMOImpl(IMeterWaterInnerServiceSMO meterWaterInnerServiceSMOImpl) { |
| | | this.meterWaterInnerServiceSMOImpl = meterWaterInnerServiceSMOImpl; |
| | | } |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | MeterWaterDto meterWaterDto = BeanConvertUtil.covertBean(reqJson, MeterWaterDto.class); |
| | | |
| | | int count = meterWaterInnerServiceSMOImpl.queryMeterWatersCount(meterWaterDto); |
| | | |
| | | List<MeterWaterDto> meterWaterDtos = null; |
| | | |
| | | if (count > 0) { |
| | | meterWaterDtos = meterWaterInnerServiceSMOImpl.queryMeterWaters(meterWaterDto); |
| | | } else { |
| | | meterWaterDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, meterWaterDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.utils.constant.ServiceCodeMeterWaterConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | /** |
| | | * 保存商户侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("saveMeterWaterListener") |
| | | public class SaveMeterWaterListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IMeterWaterBMO meterWaterBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "meterType", "请求报文中未包含meterType"); |
| | | Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); |
| | | Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId"); |
| | | Assert.hasKeyAndValue(reqJson, "preDegrees", "请求报文中未包含preDegrees"); |
| | | Assert.hasKeyAndValue(reqJson, "curDegrees", "请求报文中未包含curDegrees"); |
| | | Assert.hasKeyAndValue(reqJson, "preReadingTime", "请求报文中未包含preReadingTime"); |
| | | Assert.hasKeyAndValue(reqJson, "curReadingTime", "请求报文中未包含curReadingTime"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | meterWaterBMOImpl.addMeterWater(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeMeterWaterConstant.ADD_METERWATER; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.utils.constant.ServiceCodeMeterWaterConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | /** |
| | | * 保存水电费侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("updateMeterWaterListener") |
| | | public class UpdateMeterWaterListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IMeterWaterBMO meterWaterBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "waterId", "waterId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "meterType", "请求报文中未包含meterType"); |
| | | Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); |
| | | Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId"); |
| | | Assert.hasKeyAndValue(reqJson, "preDegrees", "请求报文中未包含preDegrees"); |
| | | Assert.hasKeyAndValue(reqJson, "curDegrees", "请求报文中未包含curDegrees"); |
| | | Assert.hasKeyAndValue(reqJson, "preReadingTime", "请求报文中未包含preReadingTime"); |
| | | Assert.hasKeyAndValue(reqJson, "curReadingTime", "请求报文中未包含curReadingTime"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | meterWaterBMOImpl.updateMeterWater(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeMeterWaterConstant.UPDATE_METERWATER; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.fee.dao; |
| | | |
| | | |
| | | import com.java110.utils.exception.DAOException; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 水电费组件内部之间使用,没有给外围系统提供服务能力 |
| | | * 水电费服务接口类,要求全部以字符串传输,方便微服务化 |
| | | * 新建客户,修改客户,删除客户,查询客户等功能 |
| | | * |
| | | * Created by wuxw on 2016/12/27. |
| | | */ |
| | | public interface IMeterWaterServiceDao { |
| | | |
| | | /** |
| | | * 保存 水电费信息 |
| | | * @param businessMeterWaterInfo 水电费信息 封装 |
| | | * @throws DAOException 操作数据库异常 |
| | | */ |
| | | void saveBusinessMeterWaterInfo(Map businessMeterWaterInfo) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询水电费信息(business过程) |
| | | * 根据bId 查询水电费信息 |
| | | * @param info bId 信息 |
| | | * @return 水电费信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getBusinessMeterWaterInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存 水电费信息 Business数据到 Instance中 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveMeterWaterInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询水电费信息(instance过程) |
| | | * 根据bId 查询水电费信息 |
| | | * @param info bId 信息 |
| | | * @return 水电费信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getMeterWaterInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改水电费信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void updateMeterWaterInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询水电费总数 |
| | | * |
| | | * @param info 水电费信息 |
| | | * @return 水电费数量 |
| | | */ |
| | | int queryMeterWatersCount(Map info); |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.fee.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 水电费服务 与数据库交互 |
| | | * Created by wuxw on 2017/4/5. |
| | | */ |
| | | @Service("meterWaterServiceDaoImpl") |
| | | //@Transactional |
| | | public class MeterWaterServiceDaoImpl extends BaseServiceDao implements IMeterWaterServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(MeterWaterServiceDaoImpl.class); |
| | | |
| | | /** |
| | | * 水电费信息封装 |
| | | * @param businessMeterWaterInfo 水电费信息 封装 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveBusinessMeterWaterInfo(Map businessMeterWaterInfo) throws DAOException { |
| | | businessMeterWaterInfo.put("month", DateUtil.getCurrentMonth()); |
| | | // 查询business_user 数据是否已经存在 |
| | | logger.debug("保存水电费信息 入参 businessMeterWaterInfo : {}",businessMeterWaterInfo); |
| | | int saveFlag = sqlSessionTemplate.insert("meterWaterServiceDaoImpl.saveBusinessMeterWaterInfo",businessMeterWaterInfo); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存水电费数据失败:"+ JSONObject.toJSONString(businessMeterWaterInfo)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询水电费信息 |
| | | * @param info bId 信息 |
| | | * @return 水电费信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getBusinessMeterWaterInfo(Map info) throws DAOException { |
| | | |
| | | logger.debug("查询水电费信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessMeterWaterInfos = sqlSessionTemplate.selectList("meterWaterServiceDaoImpl.getBusinessMeterWaterInfo",info); |
| | | |
| | | return businessMeterWaterInfos; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存水电费信息 到 instance |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveMeterWaterInfoInstance(Map info) throws DAOException { |
| | | logger.debug("保存水电费信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("meterWaterServiceDaoImpl.saveMeterWaterInfoInstance",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存水电费信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询水电费信息(instance) |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getMeterWaterInfo(Map info) throws DAOException { |
| | | logger.debug("查询水电费信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessMeterWaterInfos = sqlSessionTemplate.selectList("meterWaterServiceDaoImpl.getMeterWaterInfo",info); |
| | | |
| | | return businessMeterWaterInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改水电费信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateMeterWaterInfoInstance(Map info) throws DAOException { |
| | | logger.debug("修改水电费信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("meterWaterServiceDaoImpl.updateMeterWaterInfoInstance",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改水电费信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询水电费数量 |
| | | * @param info 水电费信息 |
| | | * @return 水电费数量 |
| | | */ |
| | | @Override |
| | | public int queryMeterWatersCount(Map info) { |
| | | logger.debug("查询水电费数据 入参 info : {}",info); |
| | | |
| | | List<Map> businessMeterWaterInfos = sqlSessionTemplate.selectList("meterWaterServiceDaoImpl.queryMeterWatersCount", info); |
| | | if (businessMeterWaterInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessMeterWaterInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.fee.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 水电费 服务侦听 父类 |
| | | * Created by wuxw on 2018/7/4. |
| | | */ |
| | | public abstract class AbstractMeterWaterBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener { |
| | | private static Logger logger = LoggerFactory.getLogger(AbstractMeterWaterBusinessServiceDataFlowListener.class); |
| | | |
| | | |
| | | /** |
| | | * 获取 DAO工具类 |
| | | * |
| | | * @return |
| | | */ |
| | | public abstract IMeterWaterServiceDao getMeterWaterServiceDaoImpl(); |
| | | |
| | | /** |
| | | * 刷新 businessMeterWaterInfo 数据 |
| | | * 主要将 数据库 中字段和 接口传递字段建立关系 |
| | | * |
| | | * @param businessMeterWaterInfo |
| | | */ |
| | | protected void flushBusinessMeterWaterInfo(Map businessMeterWaterInfo, String statusCd) { |
| | | businessMeterWaterInfo.put("newBId", businessMeterWaterInfo.get("b_id")); |
| | | businessMeterWaterInfo.put("remark", businessMeterWaterInfo.get("remark")); |
| | | businessMeterWaterInfo.put("curReadingTime", businessMeterWaterInfo.get("cur_reading_time")); |
| | | businessMeterWaterInfo.put("waterId", businessMeterWaterInfo.get("water_id")); |
| | | businessMeterWaterInfo.put("curDegrees", businessMeterWaterInfo.get("cur_degrees")); |
| | | businessMeterWaterInfo.put("operate", businessMeterWaterInfo.get("operate")); |
| | | businessMeterWaterInfo.put("createTime", businessMeterWaterInfo.get("create_time")); |
| | | businessMeterWaterInfo.put("meterType", businessMeterWaterInfo.get("meter_type")); |
| | | businessMeterWaterInfo.put("preDegrees", businessMeterWaterInfo.get("pre_degrees")); |
| | | businessMeterWaterInfo.put("objId", businessMeterWaterInfo.get("obj_id")); |
| | | businessMeterWaterInfo.put("preReadingTime", businessMeterWaterInfo.get("pre_reading_time")); |
| | | businessMeterWaterInfo.put("communityId", businessMeterWaterInfo.get("community_id")); |
| | | businessMeterWaterInfo.put("objType", businessMeterWaterInfo.get("obj_type")); |
| | | businessMeterWaterInfo.remove("bId"); |
| | | businessMeterWaterInfo.put("statusCd", statusCd); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中 |
| | | * |
| | | * @param businessMeterWater 水电费信息 |
| | | */ |
| | | protected void autoSaveDelBusinessMeterWater(Business business, JSONObject businessMeterWater) { |
| | | //自动插入DEL |
| | | Map info = new HashMap(); |
| | | info.put("waterId", businessMeterWater.getString("waterId")); |
| | | info.put("statusCd", StatusConstant.STATUS_CD_VALID); |
| | | List<Map> currentMeterWaterInfos = getMeterWaterServiceDaoImpl().getMeterWaterInfo(info); |
| | | if (currentMeterWaterInfos == null || currentMeterWaterInfos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info); |
| | | } |
| | | |
| | | Map currentMeterWaterInfo = currentMeterWaterInfos.get(0); |
| | | |
| | | currentMeterWaterInfo.put("bId", business.getbId()); |
| | | |
| | | currentMeterWaterInfo.put("remark", currentMeterWaterInfo.get("remark")); |
| | | currentMeterWaterInfo.put("curReadingTime", currentMeterWaterInfo.get("cur_reading_time")); |
| | | currentMeterWaterInfo.put("waterId", currentMeterWaterInfo.get("water_id")); |
| | | currentMeterWaterInfo.put("curDegrees", currentMeterWaterInfo.get("cur_degrees")); |
| | | currentMeterWaterInfo.put("operate", currentMeterWaterInfo.get("operate")); |
| | | currentMeterWaterInfo.put("createTime", currentMeterWaterInfo.get("create_time")); |
| | | currentMeterWaterInfo.put("meterType", currentMeterWaterInfo.get("meter_type")); |
| | | currentMeterWaterInfo.put("preDegrees", currentMeterWaterInfo.get("pre_degrees")); |
| | | currentMeterWaterInfo.put("objId", currentMeterWaterInfo.get("obj_id")); |
| | | currentMeterWaterInfo.put("preReadingTime", currentMeterWaterInfo.get("pre_reading_time")); |
| | | currentMeterWaterInfo.put("communityId", currentMeterWaterInfo.get("community_id")); |
| | | currentMeterWaterInfo.put("objType", currentMeterWaterInfo.get("obj_type")); |
| | | |
| | | |
| | | currentMeterWaterInfo.put("operate", StatusConstant.OPERATE_DEL); |
| | | getMeterWaterServiceDaoImpl().saveBusinessMeterWaterInfo(currentMeterWaterInfo); |
| | | for (Object key : currentMeterWaterInfo.keySet()) { |
| | | if (businessMeterWater.get(key) == null) { |
| | | businessMeterWater.put(key.toString(), currentMeterWaterInfo.get(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.fee.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.po.meterWater.MeterWaterPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 删除水电费信息 侦听 |
| | | * <p> |
| | | * 处理节点 |
| | | * 1、businessMeterWater:{} 水电费基本信息节点 |
| | | * 2、businessMeterWaterAttr:[{}] 水电费属性信息节点 |
| | | * 3、businessMeterWaterPhoto:[{}] 水电费照片信息节点 |
| | | * 4、businessMeterWaterCerdentials:[{}] 水电费证件信息节点 |
| | | * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("deleteMeterWaterInfoListener") |
| | | @Transactional |
| | | public class DeleteMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteMeterWaterInfoListener.class); |
| | | @Autowired |
| | | IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if (data.containsKey(MeterWaterPo.class.getSimpleName())) { |
| | | Object _obj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if (_obj instanceof JSONObject) { |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(_obj); |
| | | } else { |
| | | businessMeterWaters = (JSONArray) _obj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaters.size(); _meterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(_meterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if (_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 instance数据 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | |
| | | //水电费信息 |
| | | Map info = new HashMap(); |
| | | info.put("bId", business.getbId()); |
| | | info.put("operate", StatusConstant.OPERATE_DEL); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if (businessMeterWaterInfos != null && businessMeterWaterInfos.size() > 0) { |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size(); _meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo, StatusConstant.STATUS_CD_INVALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | dataFlowContext.addParamOut("waterId", businessMeterWaterInfo.get("water_id")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * 从business表中查询到DEL的数据 将instance中的数据更新回来 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId", bId); |
| | | info.put("statusCd", StatusConstant.STATUS_CD_INVALID); |
| | | |
| | | Map delInfo = new HashMap(); |
| | | delInfo.put("bId", business.getbId()); |
| | | delInfo.put("operate", StatusConstant.OPERATE_DEL); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if (meterWaterInfo != null && meterWaterInfo.size() > 0) { |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if (businessMeterWaterInfos == null || businessMeterWaterInfos.size() == 0) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(meterWater),程序内部异常,请检查! " + delInfo); |
| | | } |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size(); _meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo, StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business, JSONObject businessMeterWater) { |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater, "waterId", "businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if (businessMeterWater.getString("waterId").startsWith("-")) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "waterId 错误,不能自动生成(必须已经存在的waterId)" + businessMeterWater); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessMeterWater(business, businessMeterWater); |
| | | } |
| | | |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.fee.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.po.meterWater.MeterWaterPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 保存 水电费信息 侦听 |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("saveMeterWaterInfoListener") |
| | | @Transactional |
| | | public class SaveMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveMeterWaterInfoListener.class); |
| | | |
| | | @Autowired |
| | | private IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * 保存水电费信息 business 表中 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if (data.containsKey(MeterWaterPo.class.getSimpleName())) { |
| | | Object bObj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if (bObj instanceof JSONObject) { |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(bObj); |
| | | } else { |
| | | businessMeterWaters = (JSONArray) bObj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int bMeterWaterIndex = 0; bMeterWaterIndex < businessMeterWaters.size(); bMeterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(bMeterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if (bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * business 数据转移到 instance |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Map info = new HashMap(); |
| | | info.put("bId", business.getbId()); |
| | | info.put("operate", StatusConstant.OPERATE_ADD); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfo = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if (businessMeterWaterInfo != null && businessMeterWaterInfo.size() > 0) { |
| | | reFreshShareColumn(info, businessMeterWaterInfo.get(0)); |
| | | meterWaterServiceDaoImpl.saveMeterWaterInfoInstance(info); |
| | | if (businessMeterWaterInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWaterInfo.get(0).get("water_id")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 刷 分片字段 |
| | | * |
| | | * @param info 查询对象 |
| | | * @param businessInfo 小区ID |
| | | */ |
| | | private void reFreshShareColumn(Map info, Map businessInfo) { |
| | | |
| | | if (info.containsKey("communityId")) { |
| | | return; |
| | | } |
| | | |
| | | if (!businessInfo.containsKey("community_id")) { |
| | | return; |
| | | } |
| | | |
| | | info.put("communityId", businessInfo.get("community_id")); |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId", bId); |
| | | info.put("statusCd", StatusConstant.STATUS_CD_VALID); |
| | | Map paramIn = new HashMap(); |
| | | paramIn.put("bId", bId); |
| | | paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if (meterWaterInfo != null && meterWaterInfo.size() > 0) { |
| | | reFreshShareColumn(paramIn, meterWaterInfo.get(0)); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business, JSONObject businessMeterWater) { |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater, "waterId", "businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if (businessMeterWater.getString("waterId").startsWith("-")) { |
| | | //刷新缓存 |
| | | //flushMeterWaterId(business.getDatas()); |
| | | |
| | | businessMeterWater.put("waterId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_waterId)); |
| | | |
| | | } |
| | | |
| | | businessMeterWater.put("bId", business.getbId()); |
| | | businessMeterWater.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存水电费信息 |
| | | meterWaterServiceDaoImpl.saveBusinessMeterWaterInfo(businessMeterWater); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.fee.listener.meterWater; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.po.meterWater.MeterWaterPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 修改水电费信息 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessMeterWater:{} 水电费基本信息节点 |
| | | * 2、businessMeterWaterAttr:[{}] 水电费属性信息节点 |
| | | * 3、businessMeterWaterPhoto:[{}] 水电费照片信息节点 |
| | | * 4、businessMeterWaterCerdentials:[{}] 水电费证件信息节点 |
| | | * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E4%BF%AE%E6%94%B9%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("updateMeterWaterInfoListener") |
| | | @Transactional |
| | | public class UpdateMeterWaterInfoListener extends AbstractMeterWaterBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateMeterWaterInfoListener.class); |
| | | @Autowired |
| | | private IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_METER_WATER; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessMeterWater 节点 |
| | | if(data.containsKey(MeterWaterPo.class.getSimpleName())){ |
| | | Object _obj = data.get(MeterWaterPo.class.getSimpleName()); |
| | | JSONArray businessMeterWaters = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessMeterWaters = new JSONArray(); |
| | | businessMeterWaters.add(_obj); |
| | | }else { |
| | | businessMeterWaters = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessMeterWater = data.getJSONObject(MeterWaterPo.class.getSimpleName()); |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaters.size();_meterWaterIndex++) { |
| | | JSONObject businessMeterWater = businessMeterWaters.getJSONObject(_meterWaterIndex); |
| | | doBusinessMeterWater(business, businessMeterWater); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWater.getString("waterId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * business to instance 过程 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_ADD); |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(info); |
| | | if( businessMeterWaterInfos != null && businessMeterWaterInfos.size() >0) { |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | if(businessMeterWaterInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("waterId", businessMeterWaterInfo.get("water_id")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_VALID); |
| | | Map delInfo = new HashMap(); |
| | | delInfo.put("bId",business.getbId()); |
| | | delInfo.put("operate",StatusConstant.OPERATE_DEL); |
| | | //水电费信息 |
| | | List<Map> meterWaterInfo = meterWaterServiceDaoImpl.getMeterWaterInfo(info); |
| | | if(meterWaterInfo != null && meterWaterInfo.size() > 0){ |
| | | |
| | | //水电费信息 |
| | | List<Map> businessMeterWaterInfos = meterWaterServiceDaoImpl.getBusinessMeterWaterInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessMeterWaterInfos == null || businessMeterWaterInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(meterWater),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _meterWaterIndex = 0; _meterWaterIndex < businessMeterWaterInfos.size();_meterWaterIndex++) { |
| | | Map businessMeterWaterInfo = businessMeterWaterInfos.get(_meterWaterIndex); |
| | | flushBusinessMeterWaterInfo(businessMeterWaterInfo,StatusConstant.STATUS_CD_VALID); |
| | | meterWaterServiceDaoImpl.updateMeterWaterInfoInstance(businessMeterWaterInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessMeterWater 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessMeterWater 水电费节点 |
| | | */ |
| | | private void doBusinessMeterWater(Business business,JSONObject businessMeterWater){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessMeterWater,"waterId","businessMeterWater 节点下没有包含 waterId 节点"); |
| | | |
| | | if(businessMeterWater.getString("waterId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"waterId 错误,不能自动生成(必须已经存在的waterId)"+businessMeterWater); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessMeterWater(business,businessMeterWater); |
| | | |
| | | businessMeterWater.put("bId",business.getbId()); |
| | | businessMeterWater.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存水电费信息 |
| | | meterWaterServiceDaoImpl.saveBusinessMeterWaterInfo(businessMeterWater); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.fee.smo.impl; |
| | | |
| | | |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.core.smo.fee.IMeterWaterInnerServiceSMO; |
| | | import com.java110.core.smo.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.meterWater.MeterWaterDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.fee.dao.IMeterWaterServiceDao; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName FloorInnerServiceSMOImpl |
| | | * @Description 水电费内部服务实现类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:20 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @RestController |
| | | public class MeterWaterInnerServiceSMOImpl extends BaseServiceSMO implements IMeterWaterInnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private IMeterWaterServiceDao meterWaterServiceDaoImpl; |
| | | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public List<MeterWaterDto> queryMeterWaters(@RequestBody MeterWaterDto meterWaterDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = meterWaterDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | meterWaterDto.setPage((page - 1) * meterWaterDto.getRow()); |
| | | } |
| | | |
| | | List<MeterWaterDto> meterWaters = BeanConvertUtil.covertBeanList(meterWaterServiceDaoImpl.getMeterWaterInfo(BeanConvertUtil.beanCovertMap(meterWaterDto)), MeterWaterDto.class); |
| | | |
| | | if (meterWaters == null || meterWaters.size() == 0) { |
| | | return meterWaters; |
| | | } |
| | | |
| | | String[] userIds = getUserIds(meterWaters); |
| | | //根据 userId 查询用户信息 |
| | | List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds); |
| | | |
| | | for (MeterWaterDto meterWater : meterWaters) { |
| | | refreshMeterWater(meterWater, users); |
| | | } |
| | | return meterWaters; |
| | | } |
| | | |
| | | /** |
| | | * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中 |
| | | * |
| | | * @param meterWater 小区水电费信息 |
| | | * @param users 用户列表 |
| | | */ |
| | | private void refreshMeterWater(MeterWaterDto meterWater, List<UserDto> users) { |
| | | for (UserDto user : users) { |
| | | if (meterWater.getWaterId().equals(user.getUserId())) { |
| | | BeanConvertUtil.covertBean(user, meterWater); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取批量userId |
| | | * |
| | | * @param meterWaters 小区楼信息 |
| | | * @return 批量userIds 信息 |
| | | */ |
| | | private String[] getUserIds(List<MeterWaterDto> meterWaters) { |
| | | List<String> userIds = new ArrayList<String>(); |
| | | for (MeterWaterDto meterWater : meterWaters) { |
| | | userIds.add(meterWater.getWaterId()); |
| | | } |
| | | |
| | | return userIds.toArray(new String[userIds.size()]); |
| | | } |
| | | |
| | | @Override |
| | | public int queryMeterWatersCount(@RequestBody MeterWaterDto meterWaterDto) { |
| | | return meterWaterServiceDaoImpl.queryMeterWatersCount(BeanConvertUtil.beanCovertMap(meterWaterDto)); |
| | | } |
| | | |
| | | public IMeterWaterServiceDao getMeterWaterServiceDaoImpl() { |
| | | return meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public void setMeterWaterServiceDaoImpl(IMeterWaterServiceDao meterWaterServiceDaoImpl) { |
| | | this.meterWaterServiceDaoImpl = meterWaterServiceDaoImpl; |
| | | } |
| | | |
| | | public IUserInnerServiceSMO getUserInnerServiceSMOImpl() { |
| | | return userInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) { |
| | | this.userInnerServiceSMOImpl = userInnerServiceSMOImpl; |
| | | } |
| | | } |