Parcourir la source

加入车辆属性功能

java110 il y a 5 ans
Parent
commit
0d9efe77f8
24 fichiers modifiés avec 2213 ajouts et 39 suppressions
  1. 175 0
      docs/document/services/ownerCarAttr/DeleteOwnerCarAttrInfo.md
  2. 175 0
      docs/document/services/ownerCarAttr/SaveOwnerCarAttrInfo.md
  3. 188 0
      docs/document/services/ownerCarAttr/UpdateOwnerCarAttrInfo.md
  4. 76 0
      java110-bean/src/main/java/com/java110/dto/ownerCarAttr/OwnerCarAttrDto.java
  5. 46 0
      java110-bean/src/main/java/com/java110/po/ownerCarAttr/OwnerCarAttrPo.java
  6. 42 0
      java110-core/src/main/java/com/java110/core/smo/user/IOwnerCarAttrInnerServiceSMO.java
  7. 187 0
      java110-db/src/main/resources/mapper/user/OwnerCarAttrServiceDaoImplMapper.xml
  8. 1 1
      java110-generator/src/main/java/com/java110/code/back/BackCoderGeneratorStart.java
  9. 19 38
      java110-generator/src/main/resources/back/template_1.json
  10. 16 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  11. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeOwnerCarAttrConstant.java
  12. 38 0
      service-api/src/main/java/com/java110/api/bmo/ownerCarAttr/IOwnerCarAttrBMO.java
  13. 61 0
      service-api/src/main/java/com/java110/api/bmo/ownerCarAttr/impl/OwnerCarAttrBMOImpl.java
  14. 49 0
      service-api/src/main/java/com/java110/api/listener/ownerCarAttr/DeleteOwnerCarAttrListener.java
  15. 82 0
      service-api/src/main/java/com/java110/api/listener/ownerCarAttr/ListOwnerCarAttrsListener.java
  16. 47 0
      service-api/src/main/java/com/java110/api/listener/ownerCarAttr/SaveOwnerCarAttrListener.java
  17. 47 0
      service-api/src/main/java/com/java110/api/listener/ownerCarAttr/UpdateOwnerCarAttrListener.java
  18. 81 0
      service-user/src/main/java/com/java110/user/dao/IOwnerCarAttrServiceDao.java
  19. 130 0
      service-user/src/main/java/com/java110/user/dao/impl/OwnerCarAttrServiceDaoImpl.java
  20. 90 0
      service-user/src/main/java/com/java110/user/listener/ownerCarAttr/AbstractOwnerCarAttrBusinessServiceDataFlowListener.java
  21. 176 0
      service-user/src/main/java/com/java110/user/listener/ownerCarAttr/DeleteOwnerCarAttrInfoListener.java
  22. 176 0
      service-user/src/main/java/com/java110/user/listener/ownerCarAttr/SaveOwnerCarAttrInfoListener.java
  23. 189 0
      service-user/src/main/java/com/java110/user/listener/ownerCarAttr/UpdateOwnerCarAttrInfoListener.java
  24. 91 0
      service-user/src/main/java/com/java110/user/smo/impl/OwnerCarAttrInnerServiceSMOImpl.java

+ 175 - 0
docs/document/services/ownerCarAttr/DeleteOwnerCarAttrInfo.md

@@ -0,0 +1,175 @@
+package com.java110.user.listener.ownerCarAttr;
+
+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.user.dao.IOwnerCarAttrServiceDao;
+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、businessOwnerCarAttr:{} 业主车辆属性基本信息节点
+ * 2、businessOwnerCarAttrAttr:[{}] 业主车辆属性属性信息节点
+ * 3、businessOwnerCarAttrPhoto:[{}] 业主车辆属性照片信息节点
+ * 4、businessOwnerCarAttrCerdentials:[{}] 业主车辆属性证件信息节点
+ * 协议地址 :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("deleteOwnerCarAttrInfoListener")
+@Transactional
+public class DeleteOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteOwnerCarAttrInfoListener.class);
+    @Autowired
+    IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessOwnerCarAttr 节点
+            if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+                Object _obj = data.get(OwnerCarAttrPo.class.getSimpleName());
+                JSONArray businessOwnerCarAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessOwnerCarAttrs = new JSONArray();
+                    businessOwnerCarAttrs.add(_obj);
+                }else {
+                    businessOwnerCarAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+                for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrs.size();_ownerCarAttrIndex++) {
+                    JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(_ownerCarAttrIndex);
+                    doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfos != null && businessOwnerCarAttrInfos.size() >0) {
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_INVALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+                dataFlowContext.addParamOut("attrId",businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+
+            //业主车辆属性信息
+            List<Map> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessOwnerCarAttrInfos == null ||  businessOwnerCarAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(ownerCarAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessOwnerCarAttr);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessOwnerCarAttr(business,businessOwnerCarAttr);
+    }
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+}

+ 175 - 0
docs/document/services/ownerCarAttr/SaveOwnerCarAttrInfo.md

@@ -0,0 +1,175 @@
+package com.java110.user.listener.ownerCarAttr;
+
+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.user.dao.IOwnerCarAttrServiceDao;
+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("saveOwnerCarAttrInfoListener")
+@Transactional
+public class SaveOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveOwnerCarAttrInfoListener.class);
+
+    @Autowired
+    private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * 保存业主车辆属性信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwnerCarAttr 节点
+        if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+            Object bObj = data.get(OwnerCarAttrPo.class.getSimpleName());
+            JSONArray businessOwnerCarAttrs = null;
+            if(bObj instanceof JSONObject){
+                businessOwnerCarAttrs = new JSONArray();
+                businessOwnerCarAttrs.add(bObj);
+            }else {
+                businessOwnerCarAttrs = (JSONArray)bObj;
+            }
+            //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+            for (int bOwnerCarAttrIndex = 0; bOwnerCarAttrIndex < businessOwnerCarAttrs.size();bOwnerCarAttrIndex++) {
+                JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(bOwnerCarAttrIndex);
+                doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfo = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfo != null && businessOwnerCarAttrInfo.size() >0) {
+            reFreshShareColumn(info, businessOwnerCarAttrInfo.get(0));
+            ownerCarAttrServiceDaoImpl.saveOwnerCarAttrInfoInstance(info);
+            if(businessOwnerCarAttrInfo.size() == 1) {
+                dataFlowContext.addParamOut("attrId", businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+            reFreshShareColumn(paramIn, ownerCarAttrInfo.get(0));
+            ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            //刷新缓存
+            //flushOwnerCarAttrId(business.getDatas());
+
+            businessOwnerCarAttr.put("attrId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+
+        }
+
+        businessOwnerCarAttr.put("bId",business.getbId());
+        businessOwnerCarAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主车辆属性信息
+        ownerCarAttrServiceDaoImpl.saveBusinessOwnerCarAttrInfo(businessOwnerCarAttr);
+
+    }
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+}

+ 188 - 0
docs/document/services/ownerCarAttr/UpdateOwnerCarAttrInfo.md

@@ -0,0 +1,188 @@
+package com.java110.user.listener.ownerCarAttr;
+
+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.user.dao.IOwnerCarAttrServiceDao;
+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、businessOwnerCarAttr:{} 业主车辆属性基本信息节点
+ * 2、businessOwnerCarAttrAttr:[{}] 业主车辆属性属性信息节点
+ * 3、businessOwnerCarAttrPhoto:[{}] 业主车辆属性照片信息节点
+ * 4、businessOwnerCarAttrCerdentials:[{}] 业主车辆属性证件信息节点
+ * 协议地址 :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("updateOwnerCarAttrInfoListener")
+@Transactional
+public class UpdateOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateOwnerCarAttrInfoListener.class);
+    @Autowired
+    private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessOwnerCarAttr 节点
+            if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+                Object _obj = data.get(OwnerCarAttrPo.class.getSimpleName());
+                JSONArray businessOwnerCarAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessOwnerCarAttrs = new JSONArray();
+                    businessOwnerCarAttrs.add(_obj);
+                }else {
+                    businessOwnerCarAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+                for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrs.size();_ownerCarAttrIndex++) {
+                    JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(_ownerCarAttrIndex);
+                    doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfos != null && businessOwnerCarAttrInfos.size() >0) {
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+                if(businessOwnerCarAttrInfo.size() == 1) {
+                    dataFlowContext.addParamOut("attrId", businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+
+            //业主车辆属性信息
+            List<Map> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessOwnerCarAttrInfos == null || businessOwnerCarAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(ownerCarAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessOwnerCarAttr);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessOwnerCarAttr(business,businessOwnerCarAttr);
+
+        businessOwnerCarAttr.put("bId",business.getbId());
+        businessOwnerCarAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主车辆属性信息
+        ownerCarAttrServiceDaoImpl.saveBusinessOwnerCarAttrInfo(businessOwnerCarAttr);
+
+    }
+
+
+
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+
+
+
+}

+ 76 - 0
java110-bean/src/main/java/com/java110/dto/ownerCarAttr/OwnerCarAttrDto.java

@@ -0,0 +1,76 @@
+package com.java110.dto.ownerCarAttr;
+
+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 OwnerCarAttrDto extends PageDto implements Serializable {
+
+    private String attrId;
+private String specCd;
+private String communityId;
+private String value;
+private String carId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAttrId() {
+        return attrId;
+    }
+public void setAttrId(String attrId) {
+        this.attrId = attrId;
+    }
+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 String getCarId() {
+        return carId;
+    }
+public void setCarId(String carId) {
+        this.carId = carId;
+    }
+
+
+    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;
+    }
+}

+ 46 - 0
java110-bean/src/main/java/com/java110/po/ownerCarAttr/OwnerCarAttrPo.java

@@ -0,0 +1,46 @@
+package com.java110.po.ownerCarAttr;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class OwnerCarAttrPo implements Serializable {
+
+    private String attrId;
+private String specCd;
+private String communityId;
+private String value;
+private String carId;
+public String getAttrId() {
+        return attrId;
+    }
+public void setAttrId(String attrId) {
+        this.attrId = attrId;
+    }
+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 String getCarId() {
+        return carId;
+    }
+public void setCarId(String carId) {
+        this.carId = carId;
+    }
+
+
+
+}

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/user/IOwnerCarAttrInnerServiceSMO.java

@@ -0,0 +1,42 @@
+package com.java110.core.smo.user;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.ownerCarAttr.OwnerCarAttrDto;
+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 IOwnerCarAttrInnerServiceSMO
+ * @Description 业主车辆属性接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/ownerCarAttrApi")
+public interface IOwnerCarAttrInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param ownerCarAttrDto 数据对象分享
+     * @return OwnerCarAttrDto 对象数据
+     */
+    @RequestMapping(value = "/queryOwnerCarAttrs", method = RequestMethod.POST)
+    List<OwnerCarAttrDto> queryOwnerCarAttrs(@RequestBody OwnerCarAttrDto ownerCarAttrDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param ownerCarAttrDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryOwnerCarAttrsCount", method = RequestMethod.POST)
+    int queryOwnerCarAttrsCount(@RequestBody OwnerCarAttrDto ownerCarAttrDto);
+}

+ 187 - 0
java110-db/src/main/resources/mapper/user/OwnerCarAttrServiceDaoImplMapper.xml

@@ -0,0 +1,187 @@
+<?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="ownerCarAttrServiceDaoImpl">
+
+    <!-- 保存业主车辆属性信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessOwnerCarAttrInfo" parameterType="Map">
+           insert into business_owner_car_attr(
+attr_id,operate,create_time,spec_cd,community_id,b_id,value,car_id
+) values (
+#{attrId},#{operate},#{createTime},#{specCd},#{communityId},#{bId},#{value},#{carId}
+)
+       </insert>
+
+
+       <!-- 查询业主车辆属性信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessOwnerCarAttrInfo" parameterType="Map" resultType="Map">
+           select  t.attr_id,t.attr_id attrId,t.operate,t.create_time,t.create_time createTime,t.spec_cd,t.spec_cd specCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.value,t.car_id,t.car_id carId 
+from business_owner_car_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="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> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存业主车辆属性信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveOwnerCarAttrInfoInstance" parameterType="Map">
+        insert into owner_car_attr(
+attr_id,create_time,spec_cd,status_cd,community_id,b_id,value,car_id
+) select t.attr_id,t.create_time,t.spec_cd,'0',t.community_id,t.b_id,t.value,t.car_id from business_owner_car_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="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> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询业主车辆属性信息 add by wuxw 2018-07-03 -->
+    <select id="getOwnerCarAttrInfo" parameterType="Map" resultType="Map">
+        select  t.attr_id,t.attr_id attrId,t.create_time,t.create_time createTime,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,t.car_id,t.car_id carId 
+from owner_car_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="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> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</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="updateOwnerCarAttrInfoInstance" parameterType="Map">
+        update  owner_car_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="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> 
+<if test="carId !=null and carId != ''">
+, t.car_id= #{carId}
+</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="queryOwnerCarAttrsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from owner_car_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="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> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 1 - 1
java110-generator/src/main/java/com/java110/code/back/BackCoderGeneratorStart.java

@@ -10,7 +10,7 @@ import java.util.*;
 /**
  * Hello world!
  */
-public class   BackCoderGeneratorStart extends BaseGenerator {
+public class BackCoderGeneratorStart extends BaseGenerator {
 
 
     protected BackCoderGeneratorStart() {

+ 19 - 38
java110-generator/src/main/resources/back/template_1.json

@@ -1,53 +1,34 @@
 {
   "autoMove": true,
-  "id": "authId",
-  "name": "machineAuth",
-  "desc": "设备权限",
+  "id": "attrId",
+  "name": "ownerCarAttr",
+  "desc": "业主车辆属性",
   "shareParam": "communityId",
   "shareColumn": "community_id",
-  "shareName": "common",
-  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_MACHINE_AUTH",
-  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_MACHINE_AUTH",
-  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_MACHINE_AUTH",
-  "newBusinessTypeCdValue": "661100030004",
-  "updateBusinessTypeCdValue": "661100040004",
-  "deleteBusinessTypeCdValue": "661100050004",
-  "businessTableName": "business_machine_auth",
-  "tableName": "machine_auth",
+  "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",
   "param": {
-    "authId": "auth_id",
     "communityId": "community_id",
+    "carId": "car_id",
     "bId": "b_id",
-    "machineId": "machine_id",
-    "personId": "person_id",
-    "personName": "person_name",
-    "personType": "person_type",
-    "state": "state",
-    "startTime": "start_time",
-    "endTime": "end_time",
+    "attrId": "attr_id",
+    "specCd": "spec_cd",
+    "value": "value",
+    "createTime": "create_time",
     "statusCd": "status_cd",
     "operate": "operate"
   },
   "required": [
     {
-      "code": "machineId",
-      "msg": "设备不能为空"
-    },
-    {
-      "code": "personId",
-      "msg": "人员不能为空"
-    },
-    {
-      "code": "personName",
-      "msg": "人员名称不能为空"
-    },
-    {
-      "code": "startTime",
-      "msg": "开始时间不能为空"
-    },
-    {
-      "code": "endTime",
-      "msg": "结束时间不能为空"
+      "code": "specCd",
+      "msg": "属性不能为空"
     }
   ]
 }

+ 16 - 0
java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

@@ -140,6 +140,22 @@ public class BusinessTypeConstant {
     public static final String BUSINESS_TYPE_DELETE_OWNER_CAR = "111200050001";
 
 
+    /**
+     * 保存业主车辆
+     */
+    public static final String BUSINESS_TYPE_SAVE_OWNER_CAR_ATTR = "111200030002";
+
+    /**
+     * 修改业主车辆
+     */
+    public static final String BUSINESS_TYPE_UPDATE_OWNER_CAR_ATTR = "111200040002";
+
+
+    /**
+     * 删除业主车辆
+     */
+    public static final String BUSINESS_TYPE_DELETE_OWNER_CAR_ATTR = "111200050002";
+
     /**
      * 保存车辆黑白名单
      */

+ 31 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeOwnerCarAttrConstant.java

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 业主车辆属性常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeOwnerCarAttrConstant {
+
+    /**
+     * 添加 业主车辆属性
+     */
+    public static final String ADD_OWNERCARATTR = "ownerCarAttr.saveOwnerCarAttr";
+
+
+    /**
+     * 修改 业主车辆属性
+     */
+    public static final String UPDATE_OWNERCARATTR = "ownerCarAttr.updateOwnerCarAttr";
+    /**
+     * 删除 业主车辆属性
+     */
+    public static final String DELETE_OWNERCARATTR = "ownerCarAttr.deleteOwnerCarAttr";
+
+
+    /**
+     * 查询 业主车辆属性
+     */
+    public static final String LIST_OWNERCARATTRS = "ownerCarAttr.listOwnerCarAttrs";
+
+
+}

+ 38 - 0
service-api/src/main/java/com/java110/api/bmo/ownerCarAttr/IOwnerCarAttrBMO.java

@@ -0,0 +1,38 @@
+package com.java110.api.bmo.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.IApiBaseBMO;
+import com.java110.core.context.DataFlowContext;
+
+public interface IOwnerCarAttrBMO extends IApiBaseBMO {
+
+
+    /**
+     * 添加业主车辆属性
+     * @param paramInJson
+     * @param dataFlowContext
+     * @return
+     */
+     void addOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 添加业主车辆属性信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     void updateOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 删除业主车辆属性
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     void deleteOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+
+
+}

+ 61 - 0
service-api/src/main/java/com/java110/api/bmo/ownerCarAttr/impl/OwnerCarAttrBMOImpl.java

@@ -0,0 +1,61 @@
+package com.java110.api.bmo.ownerCarAttr.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.ownerCarAttr.IOwnerCarAttrBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.user.IOwnerCarAttrInnerServiceSMO;
+import com.java110.po.ownerCarAttr.OwnerCarAttrPo;
+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("ownerCarAttrBMOImpl")
+public class OwnerCarAttrBMOImpl extends ApiBaseBMO implements IOwnerCarAttrBMO {
+
+    @Autowired
+    private IOwnerCarAttrInnerServiceSMO ownerCarAttrInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void addOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        paramInJson.put("attrId", "-1");
+        OwnerCarAttrPo ownerCarAttrPo = BeanConvertUtil.covertBean(paramInJson, OwnerCarAttrPo.class);
+        super.insert(dataFlowContext, ownerCarAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR_ATTR);
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void updateOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        OwnerCarAttrPo ownerCarAttrPo = BeanConvertUtil.covertBean(paramInJson, OwnerCarAttrPo.class);
+        super.update(dataFlowContext, ownerCarAttrPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_CAR_ATTR);
+    }
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void deleteOwnerCarAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        OwnerCarAttrPo ownerCarAttrPo = BeanConvertUtil.covertBean(paramInJson, OwnerCarAttrPo.class);
+        super.update(dataFlowContext, ownerCarAttrPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_CAR_ATTR);
+    }
+
+}

+ 49 - 0
service-api/src/main/java/com/java110/api/listener/ownerCarAttr/DeleteOwnerCarAttrListener.java

@@ -0,0 +1,49 @@
+package com.java110.api.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ownerCarAttr.IOwnerCarAttrBMO;
+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.ServiceCodeOwnerCarAttrConstant;
+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("deleteOwnerCarAttrListener")
+public class DeleteOwnerCarAttrListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IOwnerCarAttrBMO ownerCarAttrBMOImpl;
+
+    @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) {
+
+        ownerCarAttrBMOImpl.deleteOwnerCarAttr(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeOwnerCarAttrConstant.DELETE_OWNERCARATTR;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 82 - 0
service-api/src/main/java/com/java110/api/listener/ownerCarAttr/ListOwnerCarAttrsListener.java

@@ -0,0 +1,82 @@
+package com.java110.api.listener.ownerCarAttr;
+
+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.user.IOwnerCarAttrInnerServiceSMO;
+import com.java110.dto.ownerCarAttr.OwnerCarAttrDto;
+import com.java110.utils.constant.ServiceCodeOwnerCarAttrConstant;
+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("listOwnerCarAttrsListener")
+public class ListOwnerCarAttrsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IOwnerCarAttrInnerServiceSMO ownerCarAttrInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeOwnerCarAttrConstant.LIST_OWNERCARATTRS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IOwnerCarAttrInnerServiceSMO getOwnerCarAttrInnerServiceSMOImpl() {
+        return ownerCarAttrInnerServiceSMOImpl;
+    }
+
+    public void setOwnerCarAttrInnerServiceSMOImpl(IOwnerCarAttrInnerServiceSMO ownerCarAttrInnerServiceSMOImpl) {
+        this.ownerCarAttrInnerServiceSMOImpl = ownerCarAttrInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        OwnerCarAttrDto ownerCarAttrDto = BeanConvertUtil.covertBean(reqJson, OwnerCarAttrDto.class);
+
+        int count = ownerCarAttrInnerServiceSMOImpl.queryOwnerCarAttrsCount(ownerCarAttrDto);
+
+        List<OwnerCarAttrDto> ownerCarAttrDtos = null;
+
+        if (count > 0) {
+            ownerCarAttrDtos = ownerCarAttrInnerServiceSMOImpl.queryOwnerCarAttrs(ownerCarAttrDto);
+        } else {
+            ownerCarAttrDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerCarAttrDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 47 - 0
service-api/src/main/java/com/java110/api/listener/ownerCarAttr/SaveOwnerCarAttrListener.java

@@ -0,0 +1,47 @@
+package com.java110.api.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ownerCarAttr.IOwnerCarAttrBMO;
+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.ServiceCodeOwnerCarAttrConstant;
+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("saveOwnerCarAttrListener")
+public class SaveOwnerCarAttrListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IOwnerCarAttrBMO ownerCarAttrBMOImpl;
+
+    @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) {
+        ownerCarAttrBMOImpl.addOwnerCarAttr(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeOwnerCarAttrConstant.ADD_OWNERCARATTR;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+}

+ 47 - 0
service-api/src/main/java/com/java110/api/listener/ownerCarAttr/UpdateOwnerCarAttrListener.java

@@ -0,0 +1,47 @@
+package com.java110.api.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ownerCarAttr.IOwnerCarAttrBMO;
+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.ServiceCodeOwnerCarAttrConstant;
+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("updateOwnerCarAttrListener")
+public class UpdateOwnerCarAttrListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private IOwnerCarAttrBMO ownerCarAttrBMOImpl;
+
+    @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) {
+
+        ownerCarAttrBMOImpl.updateOwnerCarAttr(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeOwnerCarAttrConstant.UPDATE_OWNERCARATTR;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+}

+ 81 - 0
service-user/src/main/java/com/java110/user/dao/IOwnerCarAttrServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.user.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 IOwnerCarAttrServiceDao {
+
+    /**
+     * 保存 业主车辆属性信息
+     * @param businessOwnerCarAttrInfo 业主车辆属性信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessOwnerCarAttrInfo(Map businessOwnerCarAttrInfo) throws DAOException;
+
+
+
+    /**
+     * 查询业主车辆属性信息(business过程)
+     * 根据bId 查询业主车辆属性信息
+     * @param info bId 信息
+     * @return 业主车辆属性信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessOwnerCarAttrInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 业主车辆属性信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveOwnerCarAttrInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询业主车辆属性信息(instance过程)
+     * 根据bId 查询业主车辆属性信息
+     * @param info bId 信息
+     * @return 业主车辆属性信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getOwnerCarAttrInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改业主车辆属性信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateOwnerCarAttrInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询业主车辆属性总数
+     *
+     * @param info 业主车辆属性信息
+     * @return 业主车辆属性数量
+     */
+    int queryOwnerCarAttrsCount(Map info);
+
+}

+ 130 - 0
service-user/src/main/java/com/java110/user/dao/impl/OwnerCarAttrServiceDaoImpl.java

@@ -0,0 +1,130 @@
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IOwnerCarAttrServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 业主车辆属性服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("ownerCarAttrServiceDaoImpl")
+//@Transactional
+public class OwnerCarAttrServiceDaoImpl extends BaseServiceDao implements IOwnerCarAttrServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(OwnerCarAttrServiceDaoImpl.class);
+
+    /**
+     * 业主车辆属性信息封装
+     * @param businessOwnerCarAttrInfo 业主车辆属性信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessOwnerCarAttrInfo(Map businessOwnerCarAttrInfo) throws DAOException {
+        businessOwnerCarAttrInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存业主车辆属性信息 入参 businessOwnerCarAttrInfo : {}",businessOwnerCarAttrInfo);
+        int saveFlag = sqlSessionTemplate.insert("ownerCarAttrServiceDaoImpl.saveBusinessOwnerCarAttrInfo",businessOwnerCarAttrInfo);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存业主车辆属性数据失败:"+ JSONObject.toJSONString(businessOwnerCarAttrInfo));
+        }
+    }
+
+
+    /**
+     * 查询业主车辆属性信息
+     * @param info bId 信息
+     * @return 业主车辆属性信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessOwnerCarAttrInfo(Map info) throws DAOException {
+
+        logger.debug("查询业主车辆属性信息 入参 info : {}",info);
+
+        List<Map> businessOwnerCarAttrInfos = sqlSessionTemplate.selectList("ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo",info);
+
+        return businessOwnerCarAttrInfos;
+    }
+
+
+
+    /**
+     * 保存业主车辆属性信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveOwnerCarAttrInfoInstance(Map info) throws DAOException {
+        logger.debug("保存业主车辆属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("ownerCarAttrServiceDaoImpl.saveOwnerCarAttrInfoInstance",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> getOwnerCarAttrInfo(Map info) throws DAOException {
+        logger.debug("查询业主车辆属性信息 入参 info : {}",info);
+
+        List<Map> businessOwnerCarAttrInfos = sqlSessionTemplate.selectList("ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo",info);
+
+        return businessOwnerCarAttrInfos;
+    }
+
+
+    /**
+     * 修改业主车辆属性信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateOwnerCarAttrInfoInstance(Map info) throws DAOException {
+        logger.debug("修改业主车辆属性信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改业主车辆属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询业主车辆属性数量
+     * @param info 业主车辆属性信息
+     * @return 业主车辆属性数量
+     */
+    @Override
+    public int queryOwnerCarAttrsCount(Map info) {
+        logger.debug("查询业主车辆属性数据 入参 info : {}",info);
+
+        List<Map> businessOwnerCarAttrInfos = sqlSessionTemplate.selectList("ownerCarAttrServiceDaoImpl.queryOwnerCarAttrsCount", info);
+        if (businessOwnerCarAttrInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerCarAttrInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 90 - 0
service-user/src/main/java/com/java110/user/listener/ownerCarAttr/AbstractOwnerCarAttrBusinessServiceDataFlowListener.java

@@ -0,0 +1,90 @@
+package com.java110.user.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.entity.center.Business;
+import com.java110.user.dao.IOwnerCarAttrServiceDao;
+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 AbstractOwnerCarAttrBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractOwnerCarAttrBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl();
+
+    /**
+     * 刷新 businessOwnerCarAttrInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessOwnerCarAttrInfo
+     */
+    protected void flushBusinessOwnerCarAttrInfo(Map businessOwnerCarAttrInfo, String statusCd) {
+        businessOwnerCarAttrInfo.put("newBId", businessOwnerCarAttrInfo.get("b_id"));
+        businessOwnerCarAttrInfo.put("attrId", businessOwnerCarAttrInfo.get("attr_id"));
+        businessOwnerCarAttrInfo.put("operate", businessOwnerCarAttrInfo.get("operate"));
+        businessOwnerCarAttrInfo.put("createTime", businessOwnerCarAttrInfo.get("create_time"));
+        businessOwnerCarAttrInfo.put("specCd", businessOwnerCarAttrInfo.get("spec_cd"));
+        businessOwnerCarAttrInfo.put("communityId", businessOwnerCarAttrInfo.get("community_id"));
+        businessOwnerCarAttrInfo.put("value", businessOwnerCarAttrInfo.get("value"));
+        businessOwnerCarAttrInfo.put("carId", businessOwnerCarAttrInfo.get("car_id"));
+        businessOwnerCarAttrInfo.remove("bId");
+        businessOwnerCarAttrInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessOwnerCarAttr 业主车辆属性信息
+     */
+    protected void autoSaveDelBusinessOwnerCarAttr(Business business, JSONObject businessOwnerCarAttr) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("attrId", businessOwnerCarAttr.getString("attrId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentOwnerCarAttrInfos = getOwnerCarAttrServiceDaoImpl().getOwnerCarAttrInfo(info);
+        if (currentOwnerCarAttrInfos == null || currentOwnerCarAttrInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentOwnerCarAttrInfo = currentOwnerCarAttrInfos.get(0);
+
+        currentOwnerCarAttrInfo.put("bId", business.getbId());
+
+        currentOwnerCarAttrInfo.put("attrId", currentOwnerCarAttrInfo.get("attr_id"));
+        currentOwnerCarAttrInfo.put("operate", currentOwnerCarAttrInfo.get("operate"));
+        currentOwnerCarAttrInfo.put("createTime", currentOwnerCarAttrInfo.get("create_time"));
+        currentOwnerCarAttrInfo.put("specCd", currentOwnerCarAttrInfo.get("spec_cd"));
+        currentOwnerCarAttrInfo.put("communityId", currentOwnerCarAttrInfo.get("community_id"));
+        currentOwnerCarAttrInfo.put("value", currentOwnerCarAttrInfo.get("value"));
+        currentOwnerCarAttrInfo.put("carId", currentOwnerCarAttrInfo.get("car_id"));
+
+
+        currentOwnerCarAttrInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getOwnerCarAttrServiceDaoImpl().saveBusinessOwnerCarAttrInfo(currentOwnerCarAttrInfo);
+        for (Object key : currentOwnerCarAttrInfo.keySet()) {
+            if (businessOwnerCarAttr.get(key) == null) {
+                businessOwnerCarAttr.put(key.toString(), currentOwnerCarAttrInfo.get(key));
+            }
+        }
+    }
+
+
+}

+ 176 - 0
service-user/src/main/java/com/java110/user/listener/ownerCarAttr/DeleteOwnerCarAttrInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.user.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.ownerCarAttr.OwnerCarAttrPo;
+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.user.dao.IOwnerCarAttrServiceDao;
+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、businessOwnerCarAttr:{} 业主车辆属性基本信息节点
+ * 2、businessOwnerCarAttrAttr:[{}] 业主车辆属性属性信息节点
+ * 3、businessOwnerCarAttrPhoto:[{}] 业主车辆属性照片信息节点
+ * 4、businessOwnerCarAttrCerdentials:[{}] 业主车辆属性证件信息节点
+ * 协议地址 :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("deleteOwnerCarAttrInfoListener")
+@Transactional
+public class DeleteOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteOwnerCarAttrInfoListener.class);
+    @Autowired
+    IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessOwnerCarAttr 节点
+            if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+                Object _obj = data.get(OwnerCarAttrPo.class.getSimpleName());
+                JSONArray businessOwnerCarAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessOwnerCarAttrs = new JSONArray();
+                    businessOwnerCarAttrs.add(_obj);
+                }else {
+                    businessOwnerCarAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+                for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrs.size();_ownerCarAttrIndex++) {
+                    JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(_ownerCarAttrIndex);
+                    doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfos != null && businessOwnerCarAttrInfos.size() >0) {
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_INVALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+                dataFlowContext.addParamOut("attrId",businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+
+            //业主车辆属性信息
+            List<Map> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessOwnerCarAttrInfos == null ||  businessOwnerCarAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(ownerCarAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessOwnerCarAttr);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessOwnerCarAttr(business,businessOwnerCarAttr);
+    }
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+}

+ 176 - 0
service-user/src/main/java/com/java110/user/listener/ownerCarAttr/SaveOwnerCarAttrInfoListener.java

@@ -0,0 +1,176 @@
+package com.java110.user.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.ownerCarAttr.OwnerCarAttrPo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import com.java110.user.dao.IOwnerCarAttrServiceDao;
+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("saveOwnerCarAttrInfoListener")
+@Transactional
+public class SaveOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveOwnerCarAttrInfoListener.class);
+
+    @Autowired
+    private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * 保存业主车辆属性信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwnerCarAttr 节点
+        if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+            Object bObj = data.get(OwnerCarAttrPo.class.getSimpleName());
+            JSONArray businessOwnerCarAttrs = null;
+            if(bObj instanceof JSONObject){
+                businessOwnerCarAttrs = new JSONArray();
+                businessOwnerCarAttrs.add(bObj);
+            }else {
+                businessOwnerCarAttrs = (JSONArray)bObj;
+            }
+            //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+            for (int bOwnerCarAttrIndex = 0; bOwnerCarAttrIndex < businessOwnerCarAttrs.size();bOwnerCarAttrIndex++) {
+                JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(bOwnerCarAttrIndex);
+                doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfo = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfo != null && businessOwnerCarAttrInfo.size() >0) {
+            reFreshShareColumn(info, businessOwnerCarAttrInfo.get(0));
+            ownerCarAttrServiceDaoImpl.saveOwnerCarAttrInfoInstance(info);
+            if(businessOwnerCarAttrInfo.size() == 1) {
+                dataFlowContext.addParamOut("attrId", businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+            reFreshShareColumn(paramIn, ownerCarAttrInfo.get(0));
+            ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            //刷新缓存
+            //flushOwnerCarAttrId(business.getDatas());
+
+            businessOwnerCarAttr.put("attrId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+
+        }
+
+        businessOwnerCarAttr.put("bId",business.getbId());
+        businessOwnerCarAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主车辆属性信息
+        ownerCarAttrServiceDaoImpl.saveBusinessOwnerCarAttrInfo(businessOwnerCarAttr);
+
+    }
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+}

+ 189 - 0
service-user/src/main/java/com/java110/user/listener/ownerCarAttr/UpdateOwnerCarAttrInfoListener.java

@@ -0,0 +1,189 @@
+package com.java110.user.listener.ownerCarAttr;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.po.ownerCarAttr.OwnerCarAttrPo;
+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.user.dao.IOwnerCarAttrServiceDao;
+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、businessOwnerCarAttr:{} 业主车辆属性基本信息节点
+ * 2、businessOwnerCarAttrAttr:[{}] 业主车辆属性属性信息节点
+ * 3、businessOwnerCarAttrPhoto:[{}] 业主车辆属性照片信息节点
+ * 4、businessOwnerCarAttrCerdentials:[{}] 业主车辆属性证件信息节点
+ * 协议地址 :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("updateOwnerCarAttrInfoListener")
+@Transactional
+public class UpdateOwnerCarAttrInfoListener extends AbstractOwnerCarAttrBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateOwnerCarAttrInfoListener.class);
+    @Autowired
+    private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_CAR_ATTR;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessOwnerCarAttr 节点
+            if(data.containsKey(OwnerCarAttrPo.class.getSimpleName())){
+                Object _obj = data.get(OwnerCarAttrPo.class.getSimpleName());
+                JSONArray businessOwnerCarAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessOwnerCarAttrs = new JSONArray();
+                    businessOwnerCarAttrs.add(_obj);
+                }else {
+                    businessOwnerCarAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessOwnerCarAttr = data.getJSONObject(OwnerCarAttrPo.class.getSimpleName());
+                for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrs.size();_ownerCarAttrIndex++) {
+                    JSONObject businessOwnerCarAttr = businessOwnerCarAttrs.getJSONObject(_ownerCarAttrIndex);
+                    doBusinessOwnerCarAttr(business, businessOwnerCarAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessOwnerCarAttr.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> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(info);
+        if( businessOwnerCarAttrInfos != null && businessOwnerCarAttrInfos.size() >0) {
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+                if(businessOwnerCarAttrInfo.size() == 1) {
+                    dataFlowContext.addParamOut("attrId", businessOwnerCarAttrInfo.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> ownerCarAttrInfo = ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(info);
+        if(ownerCarAttrInfo != null && ownerCarAttrInfo.size() > 0){
+
+            //业主车辆属性信息
+            List<Map> businessOwnerCarAttrInfos = ownerCarAttrServiceDaoImpl.getBusinessOwnerCarAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessOwnerCarAttrInfos == null || businessOwnerCarAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(ownerCarAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _ownerCarAttrIndex = 0; _ownerCarAttrIndex < businessOwnerCarAttrInfos.size();_ownerCarAttrIndex++) {
+                Map businessOwnerCarAttrInfo = businessOwnerCarAttrInfos.get(_ownerCarAttrIndex);
+                flushBusinessOwnerCarAttrInfo(businessOwnerCarAttrInfo,StatusConstant.STATUS_CD_VALID);
+                ownerCarAttrServiceDaoImpl.updateOwnerCarAttrInfoInstance(businessOwnerCarAttrInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessOwnerCarAttr 节点
+     * @param business 总的数据节点
+     * @param businessOwnerCarAttr 业主车辆属性节点
+     */
+    private void doBusinessOwnerCarAttr(Business business,JSONObject businessOwnerCarAttr){
+
+        Assert.jsonObjectHaveKey(businessOwnerCarAttr,"attrId","businessOwnerCarAttr 节点下没有包含 attrId 节点");
+
+        if(businessOwnerCarAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessOwnerCarAttr);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessOwnerCarAttr(business,businessOwnerCarAttr);
+
+        businessOwnerCarAttr.put("bId",business.getbId());
+        businessOwnerCarAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存业主车辆属性信息
+        ownerCarAttrServiceDaoImpl.saveBusinessOwnerCarAttrInfo(businessOwnerCarAttr);
+
+    }
+
+
+
+    @Override
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+
+
+
+}

+ 91 - 0
service-user/src/main/java/com/java110/user/smo/impl/OwnerCarAttrInnerServiceSMOImpl.java

@@ -0,0 +1,91 @@
+package com.java110.user.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.user.IOwnerCarAttrInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.ownerCarAttr.OwnerCarAttrDto;
+import com.java110.dto.user.UserDto;
+import com.java110.user.dao.IOwnerCarAttrServiceDao;
+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 OwnerCarAttrInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerCarAttrInnerServiceSMO {
+
+    @Autowired
+    private IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl;
+
+
+    @Override
+    public List<OwnerCarAttrDto> queryOwnerCarAttrs(@RequestBody OwnerCarAttrDto ownerCarAttrDto) {
+
+        //校验是否传了 分页信息
+
+        int page = ownerCarAttrDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerCarAttrDto.setPage((page - 1) * ownerCarAttrDto.getRow());
+        }
+
+        List<OwnerCarAttrDto> ownerCarAttrs = BeanConvertUtil.covertBeanList(ownerCarAttrServiceDaoImpl.getOwnerCarAttrInfo(BeanConvertUtil.beanCovertMap(ownerCarAttrDto)), OwnerCarAttrDto.class);
+
+        return ownerCarAttrs;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param ownerCarAttr 小区业主车辆属性信息
+     * @param users        用户列表
+     */
+    private void refreshOwnerCarAttr(OwnerCarAttrDto ownerCarAttr, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (ownerCarAttr.getAttrId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, ownerCarAttr);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param ownerCarAttrs 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<OwnerCarAttrDto> ownerCarAttrs) {
+        List<String> userIds = new ArrayList<String>();
+        for (OwnerCarAttrDto ownerCarAttr : ownerCarAttrs) {
+            userIds.add(ownerCarAttr.getAttrId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryOwnerCarAttrsCount(@RequestBody OwnerCarAttrDto ownerCarAttrDto) {
+        return ownerCarAttrServiceDaoImpl.queryOwnerCarAttrsCount(BeanConvertUtil.beanCovertMap(ownerCarAttrDto));
+    }
+
+    public IOwnerCarAttrServiceDao getOwnerCarAttrServiceDaoImpl() {
+        return ownerCarAttrServiceDaoImpl;
+    }
+
+    public void setOwnerCarAttrServiceDaoImpl(IOwnerCarAttrServiceDao ownerCarAttrServiceDaoImpl) {
+        this.ownerCarAttrServiceDaoImpl = ownerCarAttrServiceDaoImpl;
+    }
+
+}