| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | 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.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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、businessParkingSpaceAttr:{} 车位属性基本信息节点 |
| | | * 2、businessParkingSpaceAttrAttr:[{}] 车位属性属性信息节点 |
| | | * 3、businessParkingSpaceAttrPhoto:[{}] 车位属性照片信息节点 |
| | | * 4、businessParkingSpaceAttrCerdentials:[{}] 车位属性证件信息节点 |
| | | * 协议地址 :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("deleteParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class DeleteParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteParkingSpaceAttrInfoListener.class); |
| | | @Autowired |
| | | IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object _obj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(_obj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrs.size();_parkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(_parkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 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> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfos != null && businessParkingSpaceAttrInfos.size() >0) { |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_INVALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | dataFlowContext.addParamOut("attrId",businessParkingSpaceAttrInfo.get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | |
| | | //车位属性信息 |
| | | List<Map> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessParkingSpaceAttrInfos == null || businessParkingSpaceAttrInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(parkingSpaceAttr),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessParkingSpaceAttr); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessParkingSpaceAttr(business,businessParkingSpaceAttr); |
| | | } |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | 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.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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("saveParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class SaveParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener{ |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveParkingSpaceAttrInfoListener.class); |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * 保存车位属性信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object bObj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(bObj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(bObj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)bObj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int bParkingSpaceAttrIndex = 0; bParkingSpaceAttrIndex < businessParkingSpaceAttrs.size();bParkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(bParkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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> businessParkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfo != null && businessParkingSpaceAttrInfo.size() >0) { |
| | | reFreshShareColumn(info, businessParkingSpaceAttrInfo.get(0)); |
| | | parkingSpaceAttrServiceDaoImpl.saveParkingSpaceAttrInfoInstance(info); |
| | | if(businessParkingSpaceAttrInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttrInfo.get(0).get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | reFreshShareColumn(paramIn, parkingSpaceAttrInfo.get(0)); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | //刷新缓存 |
| | | //flushParkingSpaceAttrId(business.getDatas()); |
| | | |
| | | businessParkingSpaceAttr.put("attrId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId)); |
| | | |
| | | } |
| | | |
| | | businessParkingSpaceAttr.put("bId",business.getbId()); |
| | | businessParkingSpaceAttr.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存车位属性信息 |
| | | parkingSpaceAttrServiceDaoImpl.saveBusinessParkingSpaceAttrInfo(businessParkingSpaceAttr); |
| | | |
| | | } |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | 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.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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、businessParkingSpaceAttr:{} 车位属性基本信息节点 |
| | | * 2、businessParkingSpaceAttrAttr:[{}] 车位属性属性信息节点 |
| | | * 3、businessParkingSpaceAttrPhoto:[{}] 车位属性照片信息节点 |
| | | * 4、businessParkingSpaceAttrCerdentials:[{}] 车位属性证件信息节点 |
| | | * 协议地址 :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("updateParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class UpdateParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateParkingSpaceAttrInfoListener.class); |
| | | @Autowired |
| | | private IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object _obj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(_obj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrs.size();_parkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(_parkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 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> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfos != null && businessParkingSpaceAttrInfos.size() >0) { |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | if(businessParkingSpaceAttrInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttrInfo.get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | |
| | | //车位属性信息 |
| | | List<Map> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessParkingSpaceAttrInfos == null || businessParkingSpaceAttrInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(parkingSpaceAttr),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessParkingSpaceAttr); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessParkingSpaceAttr(business,businessParkingSpaceAttr); |
| | | |
| | | businessParkingSpaceAttr.put("bId",business.getbId()); |
| | | businessParkingSpaceAttr.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存车位属性信息 |
| | | parkingSpaceAttrServiceDaoImpl.saveBusinessParkingSpaceAttrInfo(businessParkingSpaceAttr); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.dto.parkingSpaceAttr; |
| | | |
| | | 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 ParkingSpaceAttrDto extends PageDto implements Serializable { |
| | | |
| | | private String attrId; |
| | | private String psId; |
| | | private String specCd; |
| | | private String communityId; |
| | | private String value; |
| | | |
| | | |
| | | private Date createTime; |
| | | |
| | | private String statusCd = "0"; |
| | | |
| | | |
| | | public String getAttrId() { |
| | | return attrId; |
| | | } |
| | | public void setAttrId(String attrId) { |
| | | this.attrId = attrId; |
| | | } |
| | | public String getPsId() { |
| | | return psId; |
| | | } |
| | | public void setPsId(String psId) { |
| | | this.psId = psId; |
| | | } |
| | | public String getSpecCd() { |
| | | return specCd; |
| | | } |
| | | public void setSpecCd(String specCd) { |
| | | this.specCd = specCd; |
| | | } |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | 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.parkingSpaceAttr; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class ParkingSpaceAttrPo implements Serializable { |
| | | |
| | | private String attrId; |
| | | private String psId; |
| | | private String specCd; |
| | | private String communityId; |
| | | private String value; |
| | | public String getAttrId() { |
| | | return attrId; |
| | | } |
| | | public void setAttrId(String attrId) { |
| | | this.attrId = attrId; |
| | | } |
| | | public String getPsId() { |
| | | return psId; |
| | | } |
| | | public void setPsId(String psId) { |
| | | this.psId = psId; |
| | | } |
| | | public String getSpecCd() { |
| | | return specCd; |
| | | } |
| | | public void setSpecCd(String specCd) { |
| | | this.specCd = specCd; |
| | | } |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.core.smo.community; |
| | | |
| | | import com.java110.config.feign.FeignConfiguration; |
| | | import com.java110.dto.parkingSpaceAttr.ParkingSpaceAttrDto; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | 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 IParkingSpaceAttrInnerServiceSMO |
| | | * @Description 车位属性接口类 |
| | | * @Author wuxw |
| | | * @Date 2019/4/24 9:04 |
| | | * @Version 1.0 |
| | | * add by wuxw 2019/4/24 |
| | | **/ |
| | | @FeignClient(name = "community-service", configuration = {FeignConfiguration.class}) |
| | | @RequestMapping("/parkingSpaceAttrApi") |
| | | public interface IParkingSpaceAttrInnerServiceSMO { |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * @param parkingSpaceAttrDto 数据对象分享 |
| | | * @return ParkingSpaceAttrDto 对象数据 |
| | | */ |
| | | @RequestMapping(value = "/queryParkingSpaceAttrs", method = RequestMethod.POST) |
| | | List<ParkingSpaceAttrDto> queryParkingSpaceAttrs(@RequestBody ParkingSpaceAttrDto parkingSpaceAttrDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param parkingSpaceAttrDto 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/queryParkingSpaceAttrsCount", method = RequestMethod.POST) |
| | | int queryParkingSpaceAttrsCount(@RequestBody ParkingSpaceAttrDto parkingSpaceAttrDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param parkingSpaceAttrPo 数据对象分享 |
| | | * @return 小区下的小区楼记录数 |
| | | */ |
| | | @RequestMapping(value = "/saveParkingSpaceAttr", method = RequestMethod.POST) |
| | | public int saveParkingSpaceAttr(@RequestBody ParkingSpaceAttrPo parkingSpaceAttrPo); |
| | | } |
| 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="parkingSpaceAttrServiceDaoImpl"> |
| | | |
| | | <!-- 保存车位属性信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveBusinessParkingSpaceAttrInfo" parameterType="Map"> |
| | | insert into business_parking_space_attr( |
| | | attr_id,operate,create_time,ps_id,spec_cd,community_id,b_id,value |
| | | ) values ( |
| | | #{attrId},#{operate},#{createTime},#{psId},#{specCd},#{communityId},#{bId},#{value} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <insert id="saveParkingSpaceAttr" parameterType="Map"> |
| | | insert into parking_space_attr( |
| | | attr_id,ps_id,spec_cd,community_id,b_id,value |
| | | ) values ( |
| | | #{attrId},#{psId},#{specCd},#{communityId},'-1',#{value} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询车位属性信息(Business) add by wuxw 2018-07-03 --> |
| | | <select id="getBusinessParkingSpaceAttrInfo" parameterType="Map" resultType="Map"> |
| | | select t.attr_id,t.attr_id attrId,t.operate,t.create_time,t.create_time createTime,t.ps_id,t.ps_id |
| | | psId,t.spec_cd,t.spec_cd specCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.value |
| | | from business_parking_space_attr t |
| | | where 1 =1 |
| | | <if test="attrId !=null and attrId != ''"> |
| | | and t.attr_id= #{attrId} |
| | | </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="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <if test="specCd !=null and specCd != ''"> |
| | | and t.spec_cd= #{specCd} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="value !=null and value != ''"> |
| | | and t.value= #{value} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <!-- 保存车位属性信息至 instance表中 add by wuxw 2018-07-03 --> |
| | | <insert id="saveParkingSpaceAttrInfoInstance" parameterType="Map"> |
| | | insert into parking_space_attr( |
| | | attr_id,create_time,ps_id,spec_cd,status_cd,community_id,b_id,value |
| | | ) select t.attr_id,t.create_time,t.ps_id,t.spec_cd,'0',t.community_id,t.b_id,t.value from |
| | | business_parking_space_attr t where 1=1 |
| | | <if test="attrId !=null and attrId != ''"> |
| | | and t.attr_id= #{attrId} |
| | | </if> |
| | | and t.operate= 'ADD' |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <if test="specCd !=null and specCd != ''"> |
| | | and t.spec_cd= #{specCd} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="value !=null and value != ''"> |
| | | and t.value= #{value} |
| | | </if> |
| | | |
| | | </insert> |
| | | |
| | | |
| | | <!-- 查询车位属性信息 add by wuxw 2018-07-03 --> |
| | | <select id="getParkingSpaceAttrInfo" parameterType="Map" resultType="Map"> |
| | | select t.attr_id,t.attr_id attrId,t.create_time,t.create_time createTime,t.ps_id,t.ps_id |
| | | psId,t.spec_cd,t.spec_cd specCd,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id |
| | | communityId,t.b_id,t.b_id bId,t.value |
| | | from parking_space_attr t |
| | | where 1 =1 |
| | | <if test="attrId !=null and attrId != ''"> |
| | | and t.attr_id= #{attrId} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <if test="specCd !=null and specCd != ''"> |
| | | and t.spec_cd= #{specCd} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="value !=null and value != ''"> |
| | | and t.value= #{value} |
| | | </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="updateParkingSpaceAttrInfoInstance" parameterType="Map"> |
| | | update parking_space_attr t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | , t.create_time= #{createTime} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | , t.ps_id= #{psId} |
| | | </if> |
| | | <if test="specCd !=null and specCd != ''"> |
| | | , t.spec_cd= #{specCd} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | , t.community_id= #{communityId} |
| | | </if> |
| | | <if test="value !=null and value != ''"> |
| | | , t.value= #{value} |
| | | </if> |
| | | where 1=1 |
| | | <if test="attrId !=null and attrId != ''"> |
| | | and t.attr_id= #{attrId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询车位属性数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryParkingSpaceAttrsCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from parking_space_attr t |
| | | where 1 =1 |
| | | <if test="attrId !=null and attrId != ''"> |
| | | and t.attr_id= #{attrId} |
| | | </if> |
| | | <if test="createTime !=null and createTime != ''"> |
| | | and t.create_time= #{createTime} |
| | | </if> |
| | | <if test="psId !=null and psId != ''"> |
| | | and t.ps_id= #{psId} |
| | | </if> |
| | | <if test="specCd !=null and specCd != ''"> |
| | | and t.spec_cd= #{specCd} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="bId !=null and bId != ''"> |
| | | and t.b_id= #{bId} |
| | | </if> |
| | | <if test="value !=null and value != ''"> |
| | | and t.value= #{value} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | { |
| | | "autoMove": true, |
| | | "id": "attrId", |
| | | "name": "ownerCarAttr", |
| | | "desc": "业主车辆属性", |
| | | "name": "parkingSpaceAttr", |
| | | "desc": "车位属性", |
| | | "shareParam": "communityId", |
| | | "shareColumn": "community_id", |
| | | "shareName": "user", |
| | | "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_OWNER_CAR_ATTR", |
| | | "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_OWNER_CAR_ATTR", |
| | | "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_OWNER_CAR_ATTR", |
| | | "newBusinessTypeCdValue": "111200030002", |
| | | "updateBusinessTypeCdValue": "111200040002", |
| | | "deleteBusinessTypeCdValue": "111200050002", |
| | | "businessTableName": "business_owner_car_attr", |
| | | "tableName": "owner_car_attr", |
| | | "shareName": "community", |
| | | "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_PARKING_SPACE_ATTR", |
| | | "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_PARKING_SPACE_ATTR", |
| | | "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_PARKING_SPACE_ATTR", |
| | | "newBusinessTypeCdValue": "540100030002", |
| | | "updateBusinessTypeCdValue": "540100040002", |
| | | "deleteBusinessTypeCdValue": "540100050002", |
| | | "businessTableName": "business_parking_space_attr", |
| | | "tableName": "parking_space_attr", |
| | | "param": { |
| | | "communityId": "community_id", |
| | | "carId": "car_id", |
| | | "psId": "ps_id", |
| | | "bId": "b_id", |
| | | "attrId": "attr_id", |
| | | "specCd": "spec_cd", |
| | |
| | | public static final String BUSINESS_TYPE_DELETE_PARKING_SPACE = "540100050001"; |
| | | |
| | | /** |
| | | * 增加车位 |
| | | */ |
| | | public static final String BUSINESS_TYPE_SAVE_PARKING_SPACE_ATTR = "540100030002"; |
| | | |
| | | /** |
| | | * 修改车位 |
| | | */ |
| | | public static final String BUSINESS_TYPE_UPDATE_PARKING_SPACE_ATTR = "540100040002"; |
| | | |
| | | |
| | | /** |
| | | * 删除车位 |
| | | */ |
| | | public static final String BUSINESS_TYPE_DELETE_PARKING_SPACE_ATTR = "540100050002"; |
| | | |
| | | /** |
| | | * 添加进场记录 |
| | | */ |
| | | public static final String BUSINESS_TYPE_SAVE_CAR_INOUT = "541110030001"; |
| New file |
| | |
| | | package com.java110.utils.constant; |
| | | |
| | | /** |
| | | * 车位属性常量类 |
| | | * Created by wuxw on 2017/5/20. |
| | | */ |
| | | public class ServiceCodeParkingSpaceAttrConstant { |
| | | |
| | | /** |
| | | * 添加 车位属性 |
| | | */ |
| | | public static final String ADD_PARKINGSPACEATTR = "parkingSpace.saveParkingSpaceAttr"; |
| | | |
| | | |
| | | /** |
| | | * 修改 车位属性 |
| | | */ |
| | | public static final String UPDATE_PARKINGSPACEATTR = "parkingSpace.updateParkingSpaceAttr"; |
| | | /** |
| | | * 删除 车位属性 |
| | | */ |
| | | public static final String DELETE_PARKINGSPACEATTR = "parkingSpace.deleteParkingSpaceAttr"; |
| | | |
| | | |
| | | /** |
| | | * 查询 车位属性 |
| | | */ |
| | | public static final String LIST_PARKINGSPACEATTRS = "parkingSpace.listParkingSpaceAttrs"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.parkingSpaceAttr; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.IApiBaseBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | |
| | | public interface IParkingSpaceAttrBMO extends IApiBaseBMO { |
| | | |
| | | |
| | | /** |
| | | * 添加车位属性 |
| | | * @param paramInJson |
| | | * @param dataFlowContext |
| | | * @return |
| | | */ |
| | | void addParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 添加车位属性信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void updateParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | /** |
| | | * 删除车位属性 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | void deleteParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext); |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.bmo.parkingSpaceAttr.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.ApiBaseBMO; |
| | | import com.java110.api.bmo.parkingSpaceAttr.IParkingSpaceAttrBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.smo.community.IParkingSpaceAttrInnerServiceSMO; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | 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("parkingSpaceAttrBMOImpl") |
| | | public class ParkingSpaceAttrBMOImpl extends ApiBaseBMO implements IParkingSpaceAttrBMO { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrInnerServiceSMO parkingSpaceAttrInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void addParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | paramInJson.put("attrId", "-1"); |
| | | ParkingSpaceAttrPo parkingSpaceAttrPo = BeanConvertUtil.covertBean(paramInJson, ParkingSpaceAttrPo.class); |
| | | super.insert(dataFlowContext, parkingSpaceAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE_ATTR); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加活动信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void updateParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | ParkingSpaceAttrPo parkingSpaceAttrPo = BeanConvertUtil.covertBean(paramInJson, ParkingSpaceAttrPo.class); |
| | | super.update(dataFlowContext, parkingSpaceAttrPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE_ATTR); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void deleteParkingSpaceAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | ParkingSpaceAttrPo parkingSpaceAttrPo = BeanConvertUtil.covertBean(paramInJson, ParkingSpaceAttrPo.class); |
| | | super.update(dataFlowContext, parkingSpaceAttrPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_PARKING_SPACE_ATTR); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.parkingSpace; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.parkingSpaceAttr.IParkingSpaceAttrBMO; |
| | | 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.ServiceCodeParkingSpaceAttrConstant; |
| | | 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("deleteParkingSpaceAttrListener") |
| | | public class DeleteParkingSpaceAttrListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrBMO parkingSpaceAttrBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "attrId", "attrId不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | parkingSpaceAttrBMOImpl.deleteParkingSpaceAttr(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeParkingSpaceAttrConstant.DELETE_PARKINGSPACEATTR; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.parkingSpace; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.smo.community.IParkingSpaceAttrInnerServiceSMO; |
| | | import com.java110.dto.parkingSpaceAttr.ParkingSpaceAttrDto; |
| | | import com.java110.utils.constant.ServiceCodeParkingSpaceAttrConstant; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | 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("listParkingSpaceAttrsListener") |
| | | public class ListParkingSpaceAttrsListener extends AbstractServiceApiListener { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrInnerServiceSMO parkingSpaceAttrInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeParkingSpaceAttrConstant.LIST_PARKINGSPACEATTRS; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.GET; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return DEFAULT_ORDER; |
| | | } |
| | | |
| | | |
| | | public IParkingSpaceAttrInnerServiceSMO getParkingSpaceAttrInnerServiceSMOImpl() { |
| | | return parkingSpaceAttrInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrInnerServiceSMOImpl(IParkingSpaceAttrInnerServiceSMO parkingSpaceAttrInnerServiceSMOImpl) { |
| | | this.parkingSpaceAttrInnerServiceSMOImpl = parkingSpaceAttrInnerServiceSMOImpl; |
| | | } |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | ParkingSpaceAttrDto parkingSpaceAttrDto = BeanConvertUtil.covertBean(reqJson, ParkingSpaceAttrDto.class); |
| | | |
| | | int count = parkingSpaceAttrInnerServiceSMOImpl.queryParkingSpaceAttrsCount(parkingSpaceAttrDto); |
| | | |
| | | List<ParkingSpaceAttrDto> parkingSpaceAttrDtos = null; |
| | | |
| | | if (count > 0) { |
| | | parkingSpaceAttrDtos = parkingSpaceAttrInnerServiceSMOImpl.queryParkingSpaceAttrs(parkingSpaceAttrDto); |
| | | } else { |
| | | parkingSpaceAttrDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, parkingSpaceAttrDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.parkingSpace; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.parkingSpaceAttr.IParkingSpaceAttrBMO; |
| | | 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.ServiceCodeParkingSpaceAttrConstant; |
| | | 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("saveParkingSpaceAttrListener") |
| | | public class SaveParkingSpaceAttrListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrBMO parkingSpaceAttrBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "specCd", "请求报文中未包含specCd"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | parkingSpaceAttrBMOImpl.addParkingSpaceAttr(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeParkingSpaceAttrConstant.ADD_PARKINGSPACEATTR; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.listener.parkingSpace; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.parkingSpaceAttr.IParkingSpaceAttrBMO; |
| | | 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.ServiceCodeParkingSpaceAttrConstant; |
| | | 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("updateParkingSpaceAttrListener") |
| | | public class UpdateParkingSpaceAttrListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrBMO parkingSpaceAttrBMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "attrId", "attrId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "specCd", "请求报文中未包含specCd"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | parkingSpaceAttrBMOImpl.updateParkingSpaceAttr(reqJson, context); |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeParkingSpaceAttrConstant.UPDATE_PARKINGSPACEATTR; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.dao; |
| | | |
| | | |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.entity.merchant.BoMerchant; |
| | | import com.java110.entity.merchant.BoMerchantAttr; |
| | | import com.java110.entity.merchant.Merchant; |
| | | import com.java110.entity.merchant.MerchantAttr; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 车位属性组件内部之间使用,没有给外围系统提供服务能力 |
| | | * 车位属性服务接口类,要求全部以字符串传输,方便微服务化 |
| | | * 新建客户,修改客户,删除客户,查询客户等功能 |
| | | * |
| | | * Created by wuxw on 2016/12/27. |
| | | */ |
| | | public interface IParkingSpaceAttrServiceDao { |
| | | |
| | | /** |
| | | * 保存 车位属性信息 |
| | | * @param businessParkingSpaceAttrInfo 车位属性信息 封装 |
| | | * @throws DAOException 操作数据库异常 |
| | | */ |
| | | void saveBusinessParkingSpaceAttrInfo(Map businessParkingSpaceAttrInfo) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询车位属性信息(business过程) |
| | | * 根据bId 查询车位属性信息 |
| | | * @param info bId 信息 |
| | | * @return 车位属性信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getBusinessParkingSpaceAttrInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存 车位属性信息 Business数据到 Instance中 |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveParkingSpaceAttrInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询车位属性信息(instance过程) |
| | | * 根据bId 查询车位属性信息 |
| | | * @param info bId 信息 |
| | | * @return 车位属性信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getParkingSpaceAttrInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改车位属性信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void updateParkingSpaceAttrInfoInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询车位属性总数 |
| | | * |
| | | * @param info 车位属性信息 |
| | | * @return 车位属性数量 |
| | | */ |
| | | int queryParkingSpaceAttrsCount(Map info); |
| | | |
| | | int saveParkingSpaceAttr(Map beanCovertMap); |
| | | } |
| New file |
| | |
| | | package com.java110.community.dao.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.community.dao.IParkingSpaceAttrServiceDao; |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | 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("parkingSpaceAttrServiceDaoImpl") |
| | | //@Transactional |
| | | public class ParkingSpaceAttrServiceDaoImpl extends BaseServiceDao implements IParkingSpaceAttrServiceDao { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ParkingSpaceAttrServiceDaoImpl.class); |
| | | |
| | | /** |
| | | * 车位属性信息封装 |
| | | * |
| | | * @param businessParkingSpaceAttrInfo 车位属性信息 封装 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveBusinessParkingSpaceAttrInfo(Map businessParkingSpaceAttrInfo) throws DAOException { |
| | | businessParkingSpaceAttrInfo.put("month", DateUtil.getCurrentMonth()); |
| | | // 查询business_user 数据是否已经存在 |
| | | logger.debug("保存车位属性信息 入参 businessParkingSpaceAttrInfo : {}", businessParkingSpaceAttrInfo); |
| | | int saveFlag = sqlSessionTemplate.insert("parkingSpaceAttrServiceDaoImpl.saveBusinessParkingSpaceAttrInfo", businessParkingSpaceAttrInfo); |
| | | |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存车位属性数据失败:" + JSONObject.toJSONString(businessParkingSpaceAttrInfo)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询车位属性信息 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return 车位属性信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getBusinessParkingSpaceAttrInfo(Map info) throws DAOException { |
| | | |
| | | logger.debug("查询车位属性信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessParkingSpaceAttrInfos = sqlSessionTemplate.selectList("parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo", info); |
| | | |
| | | return businessParkingSpaceAttrInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存车位属性信息 到 instance |
| | | * |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveParkingSpaceAttrInfoInstance(Map info) throws DAOException { |
| | | logger.debug("保存车位属性信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("parkingSpaceAttrServiceDaoImpl.saveParkingSpaceAttrInfoInstance", 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> getParkingSpaceAttrInfo(Map info) throws DAOException { |
| | | logger.debug("查询车位属性信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessParkingSpaceAttrInfos = sqlSessionTemplate.selectList("parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo", info); |
| | | |
| | | return businessParkingSpaceAttrInfos; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改车位属性信息 |
| | | * |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateParkingSpaceAttrInfoInstance(Map info) throws DAOException { |
| | | logger.debug("修改车位属性信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance", info); |
| | | |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改车位属性信息Instance数据失败:" + JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询车位属性数量 |
| | | * |
| | | * @param info 车位属性信息 |
| | | * @return 车位属性数量 |
| | | */ |
| | | @Override |
| | | public int queryParkingSpaceAttrsCount(Map info) { |
| | | logger.debug("查询车位属性数据 入参 info : {}", info); |
| | | |
| | | List<Map> businessParkingSpaceAttrInfos = sqlSessionTemplate.selectList("parkingSpaceAttrServiceDaoImpl.queryParkingSpaceAttrsCount", info); |
| | | if (businessParkingSpaceAttrInfos.size() < 1) { |
| | | return 0; |
| | | } |
| | | |
| | | return Integer.parseInt(businessParkingSpaceAttrInfos.get(0).get("count").toString()); |
| | | } |
| | | |
| | | @Override |
| | | public int saveParkingSpaceAttr(Map info) { |
| | | logger.debug("修改车位属性信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("parkingSpaceAttrServiceDaoImpl.saveParkingSpaceAttr", info); |
| | | |
| | | return saveFlag; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.community.dao.IParkingSpaceAttrServiceDao; |
| | | import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener; |
| | | import com.java110.entity.center.Business; |
| | | 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 AbstractParkingSpaceAttrBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener { |
| | | private static Logger logger = LoggerFactory.getLogger(AbstractParkingSpaceAttrBusinessServiceDataFlowListener.class); |
| | | |
| | | |
| | | /** |
| | | * 获取 DAO工具类 |
| | | * |
| | | * @return |
| | | */ |
| | | public abstract IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl(); |
| | | |
| | | /** |
| | | * 刷新 businessParkingSpaceAttrInfo 数据 |
| | | * 主要将 数据库 中字段和 接口传递字段建立关系 |
| | | * |
| | | * @param businessParkingSpaceAttrInfo |
| | | */ |
| | | protected void flushBusinessParkingSpaceAttrInfo(Map businessParkingSpaceAttrInfo, String statusCd) { |
| | | businessParkingSpaceAttrInfo.put("newBId", businessParkingSpaceAttrInfo.get("b_id")); |
| | | businessParkingSpaceAttrInfo.put("attrId", businessParkingSpaceAttrInfo.get("attr_id")); |
| | | businessParkingSpaceAttrInfo.put("operate", businessParkingSpaceAttrInfo.get("operate")); |
| | | businessParkingSpaceAttrInfo.put("createTime", businessParkingSpaceAttrInfo.get("create_time")); |
| | | businessParkingSpaceAttrInfo.put("psId", businessParkingSpaceAttrInfo.get("ps_id")); |
| | | businessParkingSpaceAttrInfo.put("specCd", businessParkingSpaceAttrInfo.get("spec_cd")); |
| | | businessParkingSpaceAttrInfo.put("communityId", businessParkingSpaceAttrInfo.get("community_id")); |
| | | businessParkingSpaceAttrInfo.put("value", businessParkingSpaceAttrInfo.get("value")); |
| | | businessParkingSpaceAttrInfo.remove("bId"); |
| | | businessParkingSpaceAttrInfo.put("statusCd", statusCd); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中 |
| | | * |
| | | * @param businessParkingSpaceAttr 车位属性信息 |
| | | */ |
| | | protected void autoSaveDelBusinessParkingSpaceAttr(Business business, JSONObject businessParkingSpaceAttr) { |
| | | //自动插入DEL |
| | | Map info = new HashMap(); |
| | | info.put("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | info.put("statusCd", StatusConstant.STATUS_CD_VALID); |
| | | List<Map> currentParkingSpaceAttrInfos = getParkingSpaceAttrServiceDaoImpl().getParkingSpaceAttrInfo(info); |
| | | if (currentParkingSpaceAttrInfos == null || currentParkingSpaceAttrInfos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info); |
| | | } |
| | | |
| | | Map currentParkingSpaceAttrInfo = currentParkingSpaceAttrInfos.get(0); |
| | | |
| | | currentParkingSpaceAttrInfo.put("bId", business.getbId()); |
| | | |
| | | currentParkingSpaceAttrInfo.put("attrId", currentParkingSpaceAttrInfo.get("attr_id")); |
| | | currentParkingSpaceAttrInfo.put("operate", currentParkingSpaceAttrInfo.get("operate")); |
| | | currentParkingSpaceAttrInfo.put("createTime", currentParkingSpaceAttrInfo.get("create_time")); |
| | | currentParkingSpaceAttrInfo.put("psId", currentParkingSpaceAttrInfo.get("ps_id")); |
| | | currentParkingSpaceAttrInfo.put("specCd", currentParkingSpaceAttrInfo.get("spec_cd")); |
| | | currentParkingSpaceAttrInfo.put("communityId", currentParkingSpaceAttrInfo.get("community_id")); |
| | | currentParkingSpaceAttrInfo.put("value", currentParkingSpaceAttrInfo.get("value")); |
| | | |
| | | |
| | | currentParkingSpaceAttrInfo.put("operate", StatusConstant.OPERATE_DEL); |
| | | getParkingSpaceAttrServiceDaoImpl().saveBusinessParkingSpaceAttrInfo(currentParkingSpaceAttrInfo); |
| | | for (Object key : currentParkingSpaceAttrInfo.keySet()) { |
| | | if (businessParkingSpaceAttr.get(key) == null) { |
| | | businessParkingSpaceAttr.put(key.toString(), currentParkingSpaceAttrInfo.get(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | 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.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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、businessParkingSpaceAttr:{} 车位属性基本信息节点 |
| | | * 2、businessParkingSpaceAttrAttr:[{}] 车位属性属性信息节点 |
| | | * 3、businessParkingSpaceAttrPhoto:[{}] 车位属性照片信息节点 |
| | | * 4、businessParkingSpaceAttrCerdentials:[{}] 车位属性证件信息节点 |
| | | * 协议地址 :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("deleteParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class DeleteParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeleteParkingSpaceAttrInfoListener.class); |
| | | @Autowired |
| | | IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 3; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_DELETE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object _obj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(_obj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrs.size();_parkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(_parkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 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> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfos != null && businessParkingSpaceAttrInfos.size() >0) { |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_INVALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | dataFlowContext.addParamOut("attrId",businessParkingSpaceAttrInfo.get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | |
| | | //车位属性信息 |
| | | List<Map> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessParkingSpaceAttrInfos == null || businessParkingSpaceAttrInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(parkingSpaceAttr),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessParkingSpaceAttr); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessParkingSpaceAttr(business,businessParkingSpaceAttr); |
| | | } |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.StatusConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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("saveParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class SaveParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener{ |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveParkingSpaceAttrInfoListener.class); |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * 保存车位属性信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object bObj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(bObj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(bObj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)bObj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int bParkingSpaceAttrIndex = 0; bParkingSpaceAttrIndex < businessParkingSpaceAttrs.size();bParkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(bParkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(bObj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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> businessParkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfo != null && businessParkingSpaceAttrInfo.size() >0) { |
| | | reFreshShareColumn(info, businessParkingSpaceAttrInfo.get(0)); |
| | | parkingSpaceAttrServiceDaoImpl.saveParkingSpaceAttrInfoInstance(info); |
| | | if(businessParkingSpaceAttrInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttrInfo.get(0).get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | reFreshShareColumn(paramIn, parkingSpaceAttrInfo.get(0)); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(paramIn); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | //刷新缓存 |
| | | //flushParkingSpaceAttrId(business.getDatas()); |
| | | |
| | | businessParkingSpaceAttr.put("attrId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId)); |
| | | |
| | | } |
| | | |
| | | businessParkingSpaceAttr.put("bId",business.getbId()); |
| | | businessParkingSpaceAttr.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存车位属性信息 |
| | | parkingSpaceAttrServiceDaoImpl.saveBusinessParkingSpaceAttrInfo(businessParkingSpaceAttr); |
| | | |
| | | } |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.community.listener.parkingSpaceAttr; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | 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.community.dao.IParkingSpaceAttrServiceDao; |
| | | 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、businessParkingSpaceAttr:{} 车位属性基本信息节点 |
| | | * 2、businessParkingSpaceAttrAttr:[{}] 车位属性属性信息节点 |
| | | * 3、businessParkingSpaceAttrPhoto:[{}] 车位属性照片信息节点 |
| | | * 4、businessParkingSpaceAttrCerdentials:[{}] 车位属性证件信息节点 |
| | | * 协议地址 :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("updateParkingSpaceAttrInfoListener") |
| | | @Transactional |
| | | public class UpdateParkingSpaceAttrInfoListener extends AbstractParkingSpaceAttrBusinessServiceDataFlowListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateParkingSpaceAttrInfoListener.class); |
| | | @Autowired |
| | | private IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 2; |
| | | } |
| | | |
| | | @Override |
| | | public String getBusinessTypeCd() { |
| | | return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE_ATTR; |
| | | } |
| | | |
| | | /** |
| | | * business过程 |
| | | * @param dataFlowContext 上下文对象 |
| | | * @param business 业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | |
| | | //处理 businessParkingSpaceAttr 节点 |
| | | if(data.containsKey(ParkingSpaceAttrPo.class.getSimpleName())){ |
| | | Object _obj = data.get(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | JSONArray businessParkingSpaceAttrs = null; |
| | | if(_obj instanceof JSONObject){ |
| | | businessParkingSpaceAttrs = new JSONArray(); |
| | | businessParkingSpaceAttrs.add(_obj); |
| | | }else { |
| | | businessParkingSpaceAttrs = (JSONArray)_obj; |
| | | } |
| | | //JSONObject businessParkingSpaceAttr = data.getJSONObject(ParkingSpaceAttrPo.class.getSimpleName()); |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrs.size();_parkingSpaceAttrIndex++) { |
| | | JSONObject businessParkingSpaceAttr = businessParkingSpaceAttrs.getJSONObject(_parkingSpaceAttrIndex); |
| | | doBusinessParkingSpaceAttr(business, businessParkingSpaceAttr); |
| | | if(_obj instanceof JSONObject) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttr.getString("attrId")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 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> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(info); |
| | | if( businessParkingSpaceAttrInfos != null && businessParkingSpaceAttrInfos.size() >0) { |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | if(businessParkingSpaceAttrInfo.size() == 1) { |
| | | dataFlowContext.addParamOut("attrId", businessParkingSpaceAttrInfo.get("attr_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> parkingSpaceAttrInfo = parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(info); |
| | | if(parkingSpaceAttrInfo != null && parkingSpaceAttrInfo.size() > 0){ |
| | | |
| | | //车位属性信息 |
| | | List<Map> businessParkingSpaceAttrInfos = parkingSpaceAttrServiceDaoImpl.getBusinessParkingSpaceAttrInfo(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessParkingSpaceAttrInfos == null || businessParkingSpaceAttrInfos.size() == 0){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(parkingSpaceAttr),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | for (int _parkingSpaceAttrIndex = 0; _parkingSpaceAttrIndex < businessParkingSpaceAttrInfos.size();_parkingSpaceAttrIndex++) { |
| | | Map businessParkingSpaceAttrInfo = businessParkingSpaceAttrInfos.get(_parkingSpaceAttrIndex); |
| | | flushBusinessParkingSpaceAttrInfo(businessParkingSpaceAttrInfo,StatusConstant.STATUS_CD_VALID); |
| | | parkingSpaceAttrServiceDaoImpl.updateParkingSpaceAttrInfoInstance(businessParkingSpaceAttrInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessParkingSpaceAttr 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessParkingSpaceAttr 车位属性节点 |
| | | */ |
| | | private void doBusinessParkingSpaceAttr(Business business,JSONObject businessParkingSpaceAttr){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessParkingSpaceAttr,"attrId","businessParkingSpaceAttr 节点下没有包含 attrId 节点"); |
| | | |
| | | if(businessParkingSpaceAttr.getString("attrId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessParkingSpaceAttr); |
| | | } |
| | | //自动保存DEL |
| | | autoSaveDelBusinessParkingSpaceAttr(business,businessParkingSpaceAttr); |
| | | |
| | | businessParkingSpaceAttr.put("bId",business.getbId()); |
| | | businessParkingSpaceAttr.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存车位属性信息 |
| | | parkingSpaceAttrServiceDaoImpl.saveBusinessParkingSpaceAttrInfo(businessParkingSpaceAttr); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.community.smo.impl; |
| | | |
| | | |
| | | import com.java110.community.dao.IParkingSpaceAttrServiceDao; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.core.smo.community.IParkingSpaceAttrInnerServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.parkingSpaceAttr.ParkingSpaceAttrDto; |
| | | import com.java110.po.parkingSpaceAttr.ParkingSpaceAttrPo; |
| | | 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 ParkingSpaceAttrInnerServiceSMOImpl extends BaseServiceSMO implements IParkingSpaceAttrInnerServiceSMO { |
| | | |
| | | @Autowired |
| | | private IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl; |
| | | |
| | | |
| | | @Override |
| | | public List<ParkingSpaceAttrDto> queryParkingSpaceAttrs(@RequestBody ParkingSpaceAttrDto parkingSpaceAttrDto) { |
| | | |
| | | //校验是否传了 分页信息 |
| | | |
| | | int page = parkingSpaceAttrDto.getPage(); |
| | | |
| | | if (page != PageDto.DEFAULT_PAGE) { |
| | | parkingSpaceAttrDto.setPage((page - 1) * parkingSpaceAttrDto.getRow()); |
| | | } |
| | | |
| | | List<ParkingSpaceAttrDto> parkingSpaceAttrs = BeanConvertUtil.covertBeanList(parkingSpaceAttrServiceDaoImpl.getParkingSpaceAttrInfo(BeanConvertUtil.beanCovertMap(parkingSpaceAttrDto)), ParkingSpaceAttrDto.class); |
| | | |
| | | |
| | | return parkingSpaceAttrs; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取批量userId |
| | | * |
| | | * @param parkingSpaceAttrs 小区楼信息 |
| | | * @return 批量userIds 信息 |
| | | */ |
| | | private String[] getUserIds(List<ParkingSpaceAttrDto> parkingSpaceAttrs) { |
| | | List<String> userIds = new ArrayList<String>(); |
| | | for (ParkingSpaceAttrDto parkingSpaceAttr : parkingSpaceAttrs) { |
| | | userIds.add(parkingSpaceAttr.getAttrId()); |
| | | } |
| | | |
| | | return userIds.toArray(new String[userIds.size()]); |
| | | } |
| | | |
| | | @Override |
| | | public int queryParkingSpaceAttrsCount(@RequestBody ParkingSpaceAttrDto parkingSpaceAttrDto) { |
| | | return parkingSpaceAttrServiceDaoImpl.queryParkingSpaceAttrsCount(BeanConvertUtil.beanCovertMap(parkingSpaceAttrDto)); |
| | | } |
| | | |
| | | @Override |
| | | public int saveParkingSpaceAttr(@RequestBody ParkingSpaceAttrPo parkingSpaceAttrPo ) { |
| | | return parkingSpaceAttrServiceDaoImpl.saveParkingSpaceAttr(BeanConvertUtil.beanCovertMap(parkingSpaceAttrPo)); |
| | | } |
| | | |
| | | public IParkingSpaceAttrServiceDao getParkingSpaceAttrServiceDaoImpl() { |
| | | return parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | public void setParkingSpaceAttrServiceDaoImpl(IParkingSpaceAttrServiceDao parkingSpaceAttrServiceDaoImpl) { |
| | | this.parkingSpaceAttrServiceDaoImpl = parkingSpaceAttrServiceDaoImpl; |
| | | } |
| | | |
| | | |
| | | } |