浏览代码

加入业主车辆管理

吴学文 6 年之前
父节点
当前提交
442c715dca

+ 75 - 0
UserService/src/main/java/com/java110/user/dao/IOwnerCarServiceDao.java

@@ -0,0 +1,75 @@
+package com.java110.user.dao;
+
+
+import com.java110.common.exception.DAOException;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 车辆管理组件内部之间使用,没有给外围系统提供服务能力
+ * 车辆管理服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ * <p>
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IOwnerCarServiceDao {
+
+    /**
+     * 保存 车辆管理信息
+     *
+     * @param businessOwnerCarInfo 车辆管理信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessOwnerCarInfo(Map businessOwnerCarInfo) throws DAOException;
+
+
+    /**
+     * 查询车辆管理信息(business过程)
+     * 根据bId 查询车辆管理信息
+     *
+     * @param info bId 信息
+     * @return 车辆管理信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessOwnerCarInfo(Map info) throws DAOException;
+
+
+    /**
+     * 保存 车辆管理信息 Business数据到 Instance中
+     *
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveOwnerCarInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询车辆管理信息(instance过程)
+     * 根据bId 查询车辆管理信息
+     *
+     * @param info bId 信息
+     * @return 车辆管理信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getOwnerCarInfo(Map info) throws DAOException;
+
+
+    /**
+     * 修改车辆管理信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateOwnerCarInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询车辆管理总数
+     *
+     * @param info 车辆管理信息
+     * @return 车辆管理数量
+     */
+    int queryOwnerCarsCount(Map info);
+
+}

+ 134 - 0
UserService/src/main/java/com/java110/user/dao/impl/OwnerCarServiceDaoImpl.java

@@ -0,0 +1,134 @@
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.exception.DAOException;
+import com.java110.common.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IOwnerCarServiceDao;
+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("ownerCarServiceDaoImpl")
+//@Transactional
+public class OwnerCarServiceDaoImpl extends BaseServiceDao implements IOwnerCarServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(OwnerCarServiceDaoImpl.class);
+
+    /**
+     * 车辆管理信息封装
+     *
+     * @param businessOwnerCarInfo 车辆管理信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessOwnerCarInfo(Map businessOwnerCarInfo) throws DAOException {
+        businessOwnerCarInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存车辆管理信息 入参 businessOwnerCarInfo : {}", businessOwnerCarInfo);
+        int saveFlag = sqlSessionTemplate.insert("ownerCarServiceDaoImpl.saveBusinessOwnerCarInfo", businessOwnerCarInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存车辆管理数据失败:" + JSONObject.toJSONString(businessOwnerCarInfo));
+        }
+    }
+
+
+    /**
+     * 查询车辆管理信息
+     *
+     * @param info bId 信息
+     * @return 车辆管理信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessOwnerCarInfo(Map info) throws DAOException {
+
+        logger.debug("查询车辆管理信息 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("ownerCarServiceDaoImpl.getBusinessOwnerCarInfo", info);
+
+        return businessOwnerCarInfos;
+    }
+
+
+    /**
+     * 保存车辆管理信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveOwnerCarInfoInstance(Map info) throws DAOException {
+        logger.debug("保存车辆管理信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("ownerCarServiceDaoImpl.saveOwnerCarInfoInstance", 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> getOwnerCarInfo(Map info) throws DAOException {
+        logger.debug("查询车辆管理信息 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("ownerCarServiceDaoImpl.getOwnerCarInfo", info);
+
+        return businessOwnerCarInfos;
+    }
+
+
+    /**
+     * 修改车辆管理信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateOwnerCarInfoInstance(Map info) throws DAOException {
+        logger.debug("修改车辆管理信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("ownerCarServiceDaoImpl.updateOwnerCarInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改车辆管理信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询车辆管理数量
+     *
+     * @param info 车辆管理信息
+     * @return 车辆管理数量
+     */
+    @Override
+    public int queryOwnerCarsCount(Map info) {
+        logger.debug("查询车辆管理数据 入参 info : {}", info);
+
+        List<Map> businessOwnerCarInfos = sqlSessionTemplate.selectList("ownerCarServiceDaoImpl.queryOwnerCarsCount", info);
+        if (businessOwnerCarInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessOwnerCarInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 91 - 0
UserService/src/main/java/com/java110/user/listener/car/AbstractOwnerCarBusinessServiceDataFlowListener.java

@@ -0,0 +1,91 @@
+package com.java110.user.listener.car;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.user.dao.IOwnerCarServiceDao;
+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 AbstractOwnerCarBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractOwnerCarBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IOwnerCarServiceDao getOwnerCarServiceDaoImpl();
+
+    /**
+     * 刷新 businessOwnerCarInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessOwnerCarInfo
+     */
+    protected void flushBusinessOwnerCarInfo(Map businessOwnerCarInfo, String statusCd) {
+        businessOwnerCarInfo.put("newBId", businessOwnerCarInfo.get("b_id"));
+        businessOwnerCarInfo.put("carColor", businessOwnerCarInfo.get("car_color"));
+        businessOwnerCarInfo.put("carBrand", businessOwnerCarInfo.get("car_brand"));
+        businessOwnerCarInfo.put("carType", businessOwnerCarInfo.get("car_type"));
+        businessOwnerCarInfo.put("operate", businessOwnerCarInfo.get("operate"));
+        businessOwnerCarInfo.put("carNum", businessOwnerCarInfo.get("car_num"));
+        businessOwnerCarInfo.put("psId", businessOwnerCarInfo.get("ps_id"));
+        businessOwnerCarInfo.put("remark", businessOwnerCarInfo.get("remark"));
+        businessOwnerCarInfo.put("ownerId", businessOwnerCarInfo.get("owner_id"));
+        businessOwnerCarInfo.put("userId", businessOwnerCarInfo.get("user_id"));
+        businessOwnerCarInfo.put("carId", businessOwnerCarInfo.get("car_id"));
+        businessOwnerCarInfo.remove("bId");
+        businessOwnerCarInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessOwnerCar 车辆管理信息
+     */
+    protected void autoSaveDelBusinessOwnerCar(Business business, JSONObject businessOwnerCar) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("carId", businessOwnerCar.getString("carId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentOwnerCarInfos = getOwnerCarServiceDaoImpl().getOwnerCarInfo(info);
+        if (currentOwnerCarInfos == null || currentOwnerCarInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentOwnerCarInfo = currentOwnerCarInfos.get(0);
+
+        currentOwnerCarInfo.put("bId", business.getbId());
+
+        currentOwnerCarInfo.put("carColor", currentOwnerCarInfo.get("car_color"));
+        currentOwnerCarInfo.put("carBrand", currentOwnerCarInfo.get("car_brand"));
+        currentOwnerCarInfo.put("carType", currentOwnerCarInfo.get("car_type"));
+        currentOwnerCarInfo.put("operate", currentOwnerCarInfo.get("operate"));
+        currentOwnerCarInfo.put("carNum", currentOwnerCarInfo.get("car_num"));
+        currentOwnerCarInfo.put("psId", currentOwnerCarInfo.get("ps_id"));
+        currentOwnerCarInfo.put("remark", currentOwnerCarInfo.get("remark"));
+        currentOwnerCarInfo.put("ownerId", currentOwnerCarInfo.get("owner_id"));
+        currentOwnerCarInfo.put("userId", currentOwnerCarInfo.get("user_id"));
+        currentOwnerCarInfo.put("carId", currentOwnerCarInfo.get("car_id"));
+
+
+        currentOwnerCarInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getOwnerCarServiceDaoImpl().saveBusinessOwnerCarInfo(currentOwnerCarInfo);
+    }
+
+
+}

+ 180 - 0
UserService/src/main/java/com/java110/user/listener/car/DeleteOwnerCarInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.user.listener.car;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.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.IOwnerCarServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 删除车辆管理信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessOwnerCar:{} 车辆管理基本信息节点
+ * 2、businessOwnerCarAttr:[{}] 车辆管理属性信息节点
+ * 3、businessOwnerCarPhoto:[{}] 车辆管理照片信息节点
+ * 4、businessOwnerCarCerdentials:[{}] 车辆管理证件信息节点
+ * 协议地址 :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("deleteOwnerCarInfoListener")
+@Transactional
+public class DeleteOwnerCarInfoListener extends AbstractOwnerCarBusinessServiceDataFlowListener {
+
+    private  static Logger logger = LoggerFactory.getLogger(DeleteOwnerCarInfoListener.class);
+    @Autowired
+    IOwnerCarServiceDao ownerCarServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_CAR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwnerCar 节点
+        if (data.containsKey("businessOwnerCar")) {
+            //处理 businessOwnerCar 节点
+            if (data.containsKey("businessOwnerCar")) {
+                Object _obj = data.get("businessOwnerCar");
+                JSONArray businessOwnerCars = null;
+                if (_obj instanceof JSONObject) {
+                    businessOwnerCars = new JSONArray();
+                    businessOwnerCars.add(_obj);
+                } else {
+                    businessOwnerCars = (JSONArray) _obj;
+                }
+                //JSONObject businessOwnerCar = data.getJSONObject("businessOwnerCar");
+                for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCars.size(); _ownerCarIndex++) {
+                    JSONObject businessOwnerCar = businessOwnerCars.getJSONObject(_ownerCarIndex);
+                    doBusinessOwnerCar(business, businessOwnerCar);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("carId", businessOwnerCar.getString("carId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessOwnerCarInfos = ownerCarServiceDaoImpl.getBusinessOwnerCarInfo(info);
+        if (businessOwnerCarInfos != null && businessOwnerCarInfos.size() > 0) {
+            for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCarInfos.size(); _ownerCarIndex++) {
+                Map businessOwnerCarInfo = businessOwnerCarInfos.get(_ownerCarIndex);
+                flushBusinessOwnerCarInfo(businessOwnerCarInfo, StatusConstant.STATUS_CD_INVALID);
+                ownerCarServiceDaoImpl.updateOwnerCarInfoInstance(businessOwnerCarInfo);
+                dataFlowContext.addParamOut("carId", businessOwnerCarInfo.get("car_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> ownerCarInfo = ownerCarServiceDaoImpl.getOwnerCarInfo(info);
+        if (ownerCarInfo != null && ownerCarInfo.size() > 0) {
+
+            //车辆管理信息
+            List<Map> businessOwnerCarInfos = ownerCarServiceDaoImpl.getBusinessOwnerCarInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessOwnerCarInfos == null || businessOwnerCarInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(ownerCar),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCarInfos.size(); _ownerCarIndex++) {
+                Map businessOwnerCarInfo = businessOwnerCarInfos.get(_ownerCarIndex);
+                flushBusinessOwnerCarInfo(businessOwnerCarInfo, StatusConstant.STATUS_CD_VALID);
+                ownerCarServiceDaoImpl.updateOwnerCarInfoInstance(businessOwnerCarInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessOwnerCar 节点
+     *
+     * @param business         总的数据节点
+     * @param businessOwnerCar 车辆管理节点
+     */
+    private void doBusinessOwnerCar(Business business, JSONObject businessOwnerCar) {
+
+        Assert.jsonObjectHaveKey(businessOwnerCar, "carId", "businessOwnerCar 节点下没有包含 carId 节点");
+
+        if (businessOwnerCar.getString("carId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "carId 错误,不能自动生成(必须已经存在的carId)" + businessOwnerCar);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessOwnerCar(business, businessOwnerCar);
+    }
+
+    public IOwnerCarServiceDao getOwnerCarServiceDaoImpl() {
+        return ownerCarServiceDaoImpl;
+    }
+
+    public void setOwnerCarServiceDaoImpl(IOwnerCarServiceDao ownerCarServiceDaoImpl) {
+        this.ownerCarServiceDaoImpl = ownerCarServiceDaoImpl;
+    }
+}

+ 179 - 0
UserService/src/main/java/com/java110/user/listener/car/SaveOwnerCarInfoListener.java

@@ -0,0 +1,179 @@
+package com.java110.user.listener.car;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.entity.center.Business;
+import com.java110.user.dao.IOwnerCarServiceDao;
+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("saveOwnerCarInfoListener")
+@Transactional
+public class SaveOwnerCarInfoListener extends AbstractOwnerCarBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveOwnerCarInfoListener.class);
+
+    @Autowired
+    private IOwnerCarServiceDao ownerCarServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR;
+    }
+
+    /**
+     * 保存车辆管理信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwnerCar 节点
+        if (data.containsKey("businessOwnerCar")) {
+            Object bObj = data.get("businessOwnerCar");
+            JSONArray businessOwnerCars = null;
+            if (bObj instanceof JSONObject) {
+                businessOwnerCars = new JSONArray();
+                businessOwnerCars.add(bObj);
+            } else {
+                businessOwnerCars = (JSONArray) bObj;
+            }
+            //JSONObject businessOwnerCar = data.getJSONObject("businessOwnerCar");
+            for (int bOwnerCarIndex = 0; bOwnerCarIndex < businessOwnerCars.size(); bOwnerCarIndex++) {
+                JSONObject businessOwnerCar = businessOwnerCars.getJSONObject(bOwnerCarIndex);
+                doBusinessOwnerCar(business, businessOwnerCar);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("carId", businessOwnerCar.getString("carId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessOwnerCarInfo = ownerCarServiceDaoImpl.getBusinessOwnerCarInfo(info);
+        if (businessOwnerCarInfo != null && businessOwnerCarInfo.size() > 0) {
+            reFreshShareColumn(info, businessOwnerCarInfo.get(0));
+            ownerCarServiceDaoImpl.saveOwnerCarInfoInstance(info);
+            if (businessOwnerCarInfo.size() == 1) {
+                dataFlowContext.addParamOut("carId", businessOwnerCarInfo.get(0).get("car_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("ownerId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("owner_id")) {
+            return;
+        }
+
+        info.put("ownerId", businessInfo.get("owner_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> ownerCarInfo = ownerCarServiceDaoImpl.getOwnerCarInfo(info);
+        if (ownerCarInfo != null && ownerCarInfo.size() > 0) {
+            reFreshShareColumn(paramIn, ownerCarInfo.get(0));
+            ownerCarServiceDaoImpl.updateOwnerCarInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessOwnerCar 节点
+     *
+     * @param business         总的数据节点
+     * @param businessOwnerCar 车辆管理节点
+     */
+    private void doBusinessOwnerCar(Business business, JSONObject businessOwnerCar) {
+
+        Assert.jsonObjectHaveKey(businessOwnerCar, "carId", "businessOwnerCar 节点下没有包含 carId 节点");
+
+        if (businessOwnerCar.getString("carId").startsWith("-")) {
+            //刷新缓存
+            //flushOwnerCarId(business.getDatas());
+
+            businessOwnerCar.put("carId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_carId));
+
+        }
+
+        businessOwnerCar.put("bId", business.getbId());
+        businessOwnerCar.put("operate", StatusConstant.OPERATE_ADD);
+        //保存车辆管理信息
+        ownerCarServiceDaoImpl.saveBusinessOwnerCarInfo(businessOwnerCar);
+
+    }
+
+    public IOwnerCarServiceDao getOwnerCarServiceDaoImpl() {
+        return ownerCarServiceDaoImpl;
+    }
+
+    public void setOwnerCarServiceDaoImpl(IOwnerCarServiceDao ownerCarServiceDaoImpl) {
+        this.ownerCarServiceDaoImpl = ownerCarServiceDaoImpl;
+    }
+}

+ 190 - 0
UserService/src/main/java/com/java110/user/listener/car/UpdateOwnerCarInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.user.listener.car;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.BusinessTypeConstant;
+import com.java110.common.constant.ResponseConstant;
+import com.java110.common.constant.StatusConstant;
+import com.java110.common.exception.ListenerExecuteException;
+import com.java110.common.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.IOwnerCarServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 修改车辆管理信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessOwnerCar:{} 车辆管理基本信息节点
+ * 2、businessOwnerCarAttr:[{}] 车辆管理属性信息节点
+ * 3、businessOwnerCarPhoto:[{}] 车辆管理照片信息节点
+ * 4、businessOwnerCarCerdentials:[{}] 车辆管理证件信息节点
+ * 协议地址 :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("updateOwnerCarInfoListener")
+@Transactional
+public class UpdateOwnerCarInfoListener extends AbstractOwnerCarBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateOwnerCarInfoListener.class);
+    @Autowired
+    private IOwnerCarServiceDao ownerCarServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_OWNER_CAR;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessOwnerCar 节点
+        if (data.containsKey("businessOwnerCar")) {
+            //处理 businessOwnerCar 节点
+            if (data.containsKey("businessOwnerCar")) {
+                Object _obj = data.get("businessOwnerCar");
+                JSONArray businessOwnerCars = null;
+                if (_obj instanceof JSONObject) {
+                    businessOwnerCars = new JSONArray();
+                    businessOwnerCars.add(_obj);
+                } else {
+                    businessOwnerCars = (JSONArray) _obj;
+                }
+                //JSONObject businessOwnerCar = data.getJSONObject("businessOwnerCar");
+                for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCars.size(); _ownerCarIndex++) {
+                    JSONObject businessOwnerCar = businessOwnerCars.getJSONObject(_ownerCarIndex);
+                    doBusinessOwnerCar(business, businessOwnerCar);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("carId", businessOwnerCar.getString("carId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessOwnerCarInfos = ownerCarServiceDaoImpl.getBusinessOwnerCarInfo(info);
+        if (businessOwnerCarInfos != null && businessOwnerCarInfos.size() > 0) {
+            for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCarInfos.size(); _ownerCarIndex++) {
+                Map businessOwnerCarInfo = businessOwnerCarInfos.get(_ownerCarIndex);
+                flushBusinessOwnerCarInfo(businessOwnerCarInfo, StatusConstant.STATUS_CD_VALID);
+                ownerCarServiceDaoImpl.updateOwnerCarInfoInstance(businessOwnerCarInfo);
+                if (businessOwnerCarInfo.size() == 1) {
+                    dataFlowContext.addParamOut("carId", businessOwnerCarInfo.get("car_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> ownerCarInfo = ownerCarServiceDaoImpl.getOwnerCarInfo(info);
+        if (ownerCarInfo != null && ownerCarInfo.size() > 0) {
+
+            //车辆管理信息
+            List<Map> businessOwnerCarInfos = ownerCarServiceDaoImpl.getBusinessOwnerCarInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessOwnerCarInfos == null || businessOwnerCarInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(ownerCar),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _ownerCarIndex = 0; _ownerCarIndex < businessOwnerCarInfos.size(); _ownerCarIndex++) {
+                Map businessOwnerCarInfo = businessOwnerCarInfos.get(_ownerCarIndex);
+                flushBusinessOwnerCarInfo(businessOwnerCarInfo, StatusConstant.STATUS_CD_VALID);
+                ownerCarServiceDaoImpl.updateOwnerCarInfoInstance(businessOwnerCarInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessOwnerCar 节点
+     *
+     * @param business         总的数据节点
+     * @param businessOwnerCar 车辆管理节点
+     */
+    private void doBusinessOwnerCar(Business business, JSONObject businessOwnerCar) {
+
+        Assert.jsonObjectHaveKey(businessOwnerCar, "carId", "businessOwnerCar 节点下没有包含 carId 节点");
+
+        if (businessOwnerCar.getString("carId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "carId 错误,不能自动生成(必须已经存在的carId)" + businessOwnerCar);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessOwnerCar(business, businessOwnerCar);
+
+        businessOwnerCar.put("bId", business.getbId());
+        businessOwnerCar.put("operate", StatusConstant.OPERATE_ADD);
+        //保存车辆管理信息
+        ownerCarServiceDaoImpl.saveBusinessOwnerCarInfo(businessOwnerCar);
+
+    }
+
+
+    public IOwnerCarServiceDao getOwnerCarServiceDaoImpl() {
+        return ownerCarServiceDaoImpl;
+    }
+
+    public void setOwnerCarServiceDaoImpl(IOwnerCarServiceDao ownerCarServiceDaoImpl) {
+        this.ownerCarServiceDaoImpl = ownerCarServiceDaoImpl;
+    }
+
+
+}

+ 113 - 0
UserService/src/main/java/com/java110/user/smo/impl/OwnerCarInnerServiceSMOImpl.java

@@ -0,0 +1,113 @@
+package com.java110.user.smo.impl;
+
+
+import com.java110.common.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.owner.IOwnerCarInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.OwnerCarDto;
+import com.java110.dto.PageDto;
+import com.java110.dto.UserDto;
+import com.java110.user.dao.IOwnerCarServiceDao;
+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 OwnerCarInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerCarInnerServiceSMO {
+
+    @Autowired
+    private IOwnerCarServiceDao ownerCarServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<OwnerCarDto> queryOwnerCars(@RequestBody OwnerCarDto ownerCarDto) {
+
+        //校验是否传了 分页信息
+
+        int page = ownerCarDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            ownerCarDto.setPage((page - 1) * ownerCarDto.getRow());
+            ownerCarDto.setRow(page * ownerCarDto.getRow());
+        }
+
+        List<OwnerCarDto> ownerCars = BeanConvertUtil.covertBeanList(ownerCarServiceDaoImpl.getOwnerCarInfo(BeanConvertUtil.beanCovertMap(ownerCarDto)), OwnerCarDto.class);
+
+        if (ownerCars == null || ownerCars.size() == 0) {
+            return ownerCars;
+        }
+
+        String[] userIds = getUserIds(ownerCars);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (OwnerCarDto ownerCar : ownerCars) {
+            refreshOwnerCar(ownerCar, users);
+        }
+        return ownerCars;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param ownerCar 小区车辆管理信息
+     * @param users    用户列表
+     */
+    private void refreshOwnerCar(OwnerCarDto ownerCar, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (ownerCar.getUserId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, ownerCar);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param ownerCars 小区楼信息
+     * @return 批量userIds 信息
+     */
+    private String[] getUserIds(List<OwnerCarDto> ownerCars) {
+        List<String> userIds = new ArrayList<String>();
+        for (OwnerCarDto ownerCar : ownerCars) {
+            userIds.add(ownerCar.getUserId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int queryOwnerCarsCount(@RequestBody OwnerCarDto ownerCarDto) {
+        return ownerCarServiceDaoImpl.queryOwnerCarsCount(BeanConvertUtil.beanCovertMap(ownerCarDto));
+    }
+
+    public IOwnerCarServiceDao getOwnerCarServiceDaoImpl() {
+        return ownerCarServiceDaoImpl;
+    }
+
+    public void setOwnerCarServiceDaoImpl(IOwnerCarServiceDao ownerCarServiceDaoImpl) {
+        this.ownerCarServiceDaoImpl = ownerCarServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 114 - 0
docs/services/owner/DeleteOwnerCarInfo.md

@@ -0,0 +1,114 @@
+
+
+**1\. 删除车辆管理**
+###### 接口功能
+> API服务做删除车辆管理时调用该接口
+
+###### URL
+> [http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerCarInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerCarInfo|carId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "111200040001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerCarInfo": {
+                "carId":"填写存在的值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 130 - 0
docs/services/owner/SaveOwnerCarInfo.md

@@ -0,0 +1,130 @@
+
+
+**1\. 保存车辆管理**
+###### 接口功能
+> API服务做保存车辆管理时调用该接口
+
+###### URL
+> [http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerCarInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerCarInfo|carColor|1|String|30|-|-|
+|businessOwnerCarInfo|carBrand|1|String|30|-|-|
+|businessOwnerCarInfo|carType|1|String|30|-|-|
+|businessOwnerCarInfo|carNum|1|String|30|-|-|
+|businessOwnerCarInfo|psId|1|String|30|-|-|
+|businessOwnerCarInfo|remark|1|String|30|-|-|
+|businessOwnerCarInfo|ownerId|1|String|30|-|-|
+|businessOwnerCarInfo|userId|1|String|30|-|-|
+|businessOwnerCarInfo|carId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "111200030001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerCarInfo": {
+                "carColor":"填写具体值",
+        "carBrand":"填写具体值",
+        "carType":"填写具体值",
+        "carNum":"填写具体值",
+        "psId":"填写具体值",
+        "remark":"填写具体值",
+        "ownerId":"填写具体值",
+        "userId":"填写具体值",
+        "carId":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 130 - 0
docs/services/owner/UpdateOwnerCarInfo.md

@@ -0,0 +1,130 @@
+
+
+**1\. 修改车辆管理**
+###### 接口功能
+> API服务做修改车辆管理时调用该接口
+
+###### URL
+> [http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+###### 支持格式
+> JSON
+
+###### HTTP请求方式
+> POST
+
+###### 协议接口
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-:|
+|-|orders|1|Object|-|订单节点|-|
+|-|business|1|Array|-|业务节点|-|
+
+###### orders
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|orders|1|Object|-|订单节点|-|
+|orders|appId|1|String|10|系统ID|由中心服务提供|
+|orders|transactionId|1|String|30|交互流水|appId+'00'+YYYYMMDD+10位序列|
+|orders|userId|1|String|30|用户ID|已有用户ID|
+|orders|orderTypeCd|1|String|4|订单类型|查看订单类型说明|
+|orders|requestTime|1|String|14|请求时间|YYYYMMDDhhmmss|
+|orders|remark|1|String|200|备注|备注|
+|orders|sign|?|String|64|签名|查看加密说明|
+|orders|attrs|?|Array|-|订单属性|-|
+|attrs|specCd|1|String|12|规格编码|由中心服务提供|
+|attrs|value|1|String|50|属性值|-|
+|orders|response|1|Object|-|返回结果节点|-|
+|response|code|1|String|4|返回状态|查看状态说明|
+|response|message|1|String|200|返回状态描述|-|
+
+###### business
+|父元素名称|参数名称|约束|类型|长度|描述|取值说明|
+| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
+|-|business|?|Array|-|业务节点|-|
+|business|businessTypeCd|1|String|12|业务类型编码|500100030002|
+|business|datas|1|Object|-|数据节点|不同的服务下的节点不一样|
+|datas|businessOwnerCarInfo|1|Object|-|小区成员|小区成员|
+|businessOwnerCarInfo|carColor|1|String|30|-|-|
+|businessOwnerCarInfo|carBrand|1|String|30|-|-|
+|businessOwnerCarInfo|carType|1|String|30|-|-|
+|businessOwnerCarInfo|carNum|1|String|30|-|-|
+|businessOwnerCarInfo|psId|1|String|30|-|-|
+|businessOwnerCarInfo|remark|1|String|30|-|-|
+|businessOwnerCarInfo|ownerId|1|String|30|-|-|
+|businessOwnerCarInfo|userId|1|String|30|-|-|
+|businessOwnerCarInfo|carId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://ownerCar-service/ownerCarApi/service](http://ownerCar-service/ownerCarApi/service)
+
+``` javascript
+请求头信息:
+Content-Type:application/json
+
+请求报文:
+
+{
+  "orders": {
+    "appId": "外系统ID,分配得到",
+    "transactionId": "100000000020180409224736000001",
+    "userId": "用户ID",
+    "orderTypeCd": "订单类型,查询,受理",
+    "requestTime": "20180409224736",
+    "remark": "备注",
+    "sign": "这个服务是否要求MD5签名",
+    "businessType":"I",
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  },
+  "business": {
+    "businessTypeCd": "111200050001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessOwnerCarInfo": {
+                "carColor":"填写具体值",
+        "carBrand":"填写具体值",
+        "carType":"填写具体值",
+        "carNum":"填写具体值",
+        "psId":"填写具体值",
+        "remark":"填写具体值",
+        "ownerId":"填写具体值",
+        "userId":"填写具体值",
+        "carId":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 103 - 0
java110-bean/src/main/java/com/java110/dto/OwnerCarDto.java

@@ -0,0 +1,103 @@
+package com.java110.dto;
+
+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 OwnerCarDto extends PageDto implements Serializable {
+
+    private String carColor;
+private String carBrand;
+private String carType;
+private String carNum;
+private String psId;
+private String remark;
+private String ownerId;
+private String userId;
+private String carId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getCarColor() {
+        return carColor;
+    }
+public void setCarColor(String carColor) {
+        this.carColor = carColor;
+    }
+public String getCarBrand() {
+        return carBrand;
+    }
+public void setCarBrand(String carBrand) {
+        this.carBrand = carBrand;
+    }
+public String getCarType() {
+        return carType;
+    }
+public void setCarType(String carType) {
+        this.carType = carType;
+    }
+public String getCarNum() {
+        return carNum;
+    }
+public void setCarNum(String carNum) {
+        this.carNum = carNum;
+    }
+public String getPsId() {
+        return psId;
+    }
+public void setPsId(String psId) {
+        this.psId = psId;
+    }
+public String getRemark() {
+        return remark;
+    }
+public void setRemark(String remark) {
+        this.remark = remark;
+    }
+public String getOwnerId() {
+        return ownerId;
+    }
+public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+public String getUserId() {
+        return userId;
+    }
+public void setUserId(String userId) {
+        this.userId = userId;
+    }
+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;
+    }
+}

+ 84 - 0
java110-code-generator/src/main/java/com/java110/OwnerCarGeneratorApplication.java

@@ -0,0 +1,84 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ */
+public class OwnerCarGeneratorApplication {
+
+    protected OwnerCarGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * 代码生成器 入口方法
+     *
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("carId");
+        data.setName("ownerCar");
+        data.setDesc("车辆管理");
+        data.setShareParam("ownerId");
+        data.setShareColumn("owner_id");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_OWNER_CAR");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_OWNER_CAR");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_OWNER_CAR");
+        data.setNewBusinessTypeCdValue("111200030001");
+        data.setUpdateBusinessTypeCdValue("111200050001");
+        data.setDeleteBusinessTypeCdValue("111200040001");
+        data.setBusinessTableName("business_owner_car");
+        data.setTableName("owner_car");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("carId", "car_id");
+        param.put("ownerId", "owner_id");
+        param.put("bId", "b_id");
+        param.put("carNum", "car_num");
+        param.put("carBrand", "car_brand");
+        param.put("carType", "car_type");
+        param.put("carColor", "car_color");
+        param.put("psId", "ps_id");
+        param.put("userId", "user_id");
+        param.put("remark", "remark");
+        param.put("statusCd", "status_cd");
+        param.put("operate", "operate");
+        data.setParams(param);
+        GeneratorSaveInfoListener generatorSaveInfoListener = new GeneratorSaveInfoListener();
+        generatorSaveInfoListener.generator(data);
+
+        GeneratorAbstractBussiness generatorAbstractBussiness = new GeneratorAbstractBussiness();
+        generatorAbstractBussiness.generator(data);
+
+        GeneratorIServiceDaoListener generatorIServiceDaoListener = new GeneratorIServiceDaoListener();
+        generatorIServiceDaoListener.generator(data);
+
+        GeneratorServiceDaoImplListener generatorServiceDaoImplListener = new GeneratorServiceDaoImplListener();
+        generatorServiceDaoImplListener.generator(data);
+
+        GeneratorServiceDaoImplMapperListener generatorServiceDaoImplMapperListener = null;
+        generatorServiceDaoImplMapperListener = new GeneratorServiceDaoImplMapperListener();
+        generatorServiceDaoImplMapperListener.generator(data);
+
+        GeneratorUpdateInfoListener generatorUpdateInfoListener = new GeneratorUpdateInfoListener();
+        generatorUpdateInfoListener.generator(data);
+
+        GeneratorDeleteInfoListener generatorDeleteInfoListener = new GeneratorDeleteInfoListener();
+        generatorDeleteInfoListener.generator(data);
+
+        GeneratorInnerServiceSMOImpl generatorInnerServiceSMOImpl = new GeneratorInnerServiceSMOImpl();
+        generatorInnerServiceSMOImpl.generator(data);
+
+        GeneratorDtoBean generatorDtoBean = new GeneratorDtoBean();
+        generatorDtoBean.generator(data);
+
+        GeneratorIInnerServiceSMO generatorIInnerServiceSMO = new GeneratorIInnerServiceSMO();
+        generatorIInnerServiceSMO.generator(data);
+    }
+}

+ 17 - 0
java110-common/src/main/java/com/java110/common/constant/BusinessTypeConstant.java

@@ -91,6 +91,23 @@ public class BusinessTypeConstant {
     public static final String BUSINESS_TYPE_DELETE_OWNER_ROOM_REL = "111100050001";
 
 
+    /**
+     * 保存业主车辆
+     */
+    public static final String BUSINESS_TYPE_SAVE_OWNER_CAR = "111200030001";
+
+    /**
+     * 修改业主车辆
+     */
+    public static final String BUSINESS_TYPE_UPDATE_OWNER_CAR = "111200040001";
+
+
+    /**
+     * 删除业主车辆
+     */
+    public static final String BUSINESS_TYPE_DELETE_OWNER_CAR = "111200050001";
+
+
 
 
 

+ 1 - 4
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -62,10 +62,6 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_communityId = "70";
     public static final String CODE_PREFIX_communityPhotoId = "71";
     public static final String CODE_PREFIX_communityMemberId = "72";
-    public static final String CODE_PREFIX_agentId = "80";
-    public static final String CODE_PREFIX_agentPhotoId = "81";
-    public static final String CODE_PREFIX_agentCerdentialsId = "82";
-    public static final String CODE_PREFIX_agentUserId = "83";
     public static final String CODE_PREFIX_feeId = "90";
     public static final String CODE_PREFIX_detailId = "91";
     public static final String CODE_PREFIX_configId = "92";
@@ -81,6 +77,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_ownerId = "77";
     public static final String CODE_PREFIX_ownerRoomRelId = "78";
     public static final String CODE_PREFIX_psId = "79";
+    public static final String CODE_PREFIX_carId = "80";
 
     /**
      * 只有在不调用服务生成ID时有用

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/owner/IOwnerCarInnerServiceSMO.java

@@ -0,0 +1,42 @@
+package com.java110.core.smo.owner;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.OwnerCarDto;
+import org.springframework.cloud.netflix.feign.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 IOwnerCarInnerServiceSMO
+ * @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("/ownerCarApi")
+public interface IOwnerCarInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param ownerCarDto 数据对象分享
+     * @return OwnerCarDto 对象数据
+     */
+    @RequestMapping(value = "/queryOwnerCars", method = RequestMethod.POST)
+    List<OwnerCarDto> queryOwnerCars(@RequestBody OwnerCarDto ownerCarDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param ownerCarDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryOwnerCarsCount", method = RequestMethod.POST)
+    int queryOwnerCarsCount(@RequestBody OwnerCarDto ownerCarDto);
+}

+ 231 - 0
java110-db/src/main/resources/mapper/owner/OwnerCarServiceDaoImplMapper.xml

@@ -0,0 +1,231 @@
+<?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="ownerCarServiceDaoImpl">
+
+    <!-- 保存车辆管理信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessOwnerCarInfo" parameterType="Map">
+           insert into business_owner_car(
+car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id
+) values (
+#{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId}
+)
+       </insert>
+
+
+       <!-- 查询车辆管理信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessOwnerCarInfo" parameterType="Map" resultType="Map">
+           select  t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type carType,t.operate,t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId 
+from business_owner_car t 
+where 1 =1 
+<if test="carColor !=null and carColor != ''">
+   and t.car_color= #{carColor}
+</if> 
+<if test="carBrand !=null and carBrand != ''">
+   and t.car_brand= #{carBrand}
+</if> 
+<if test="carType !=null and carType != ''">
+   and t.car_type= #{carType}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存车辆管理信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveOwnerCarInfoInstance" parameterType="Map">
+        insert into owner_car(
+car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id
+) select t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id from business_owner_car t where 1=1
+<if test="carColor !=null and carColor != ''">
+   and t.car_color= #{carColor}
+</if> 
+<if test="carBrand !=null and carBrand != ''">
+   and t.car_brand= #{carBrand}
+</if> 
+<if test="carType !=null and carType != ''">
+   and t.car_type= #{carType}
+</if> 
+   and t.operate= 'ADD'
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询车辆管理信息 add by wuxw 2018-07-03 -->
+    <select id="getOwnerCarInfo" parameterType="Map" resultType="Map">
+        select  t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type carType,t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId 
+from owner_car t 
+where 1 =1 
+<if test="carColor !=null and carColor != ''">
+   and t.car_color= #{carColor}
+</if> 
+<if test="carBrand !=null and carBrand != ''">
+   and t.car_brand= #{carBrand}
+</if> 
+<if test="carType !=null and carType != ''">
+   and t.car_type= #{carType}
+</if> 
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改车辆管理信息 add by wuxw 2018-07-03 -->
+    <update id="updateOwnerCarInfoInstance" parameterType="Map">
+        update  owner_car t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="carColor !=null and carColor != ''">
+, t.car_color= #{carColor}
+</if> 
+<if test="carBrand !=null and carBrand != ''">
+, t.car_brand= #{carBrand}
+</if> 
+<if test="carType !=null and carType != ''">
+, t.car_type= #{carType}
+</if> 
+<if test="carNum !=null and carNum != ''">
+, t.car_num= #{carNum}
+</if> 
+<if test="psId !=null and psId != ''">
+, t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+, t.owner_id= #{ownerId}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+ where 1=1 <if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+<if test="carId !=null and carId != ''">
+and t.car_id= #{carId}
+</if> 
+
+    </update>
+
+    <!-- 查询车辆管理数量 add by wuxw 2018-07-03 -->
+     <select id="queryOwnerCarsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from owner_car t 
+where 1 =1 
+<if test="carColor !=null and carColor != ''">
+   and t.car_color= #{carColor}
+</if> 
+<if test="carBrand !=null and carBrand != ''">
+   and t.car_brand= #{carBrand}
+</if> 
+<if test="carType !=null and carType != ''">
+   and t.car_type= #{carType}
+</if> 
+<if test="carNum !=null and carNum != ''">
+   and t.car_num= #{carNum}
+</if> 
+<if test="psId !=null and psId != ''">
+   and t.ps_id= #{psId}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="ownerId !=null and ownerId != ''">
+   and t.owner_id= #{ownerId}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="carId !=null and carId != ''">
+   and t.car_id= #{carId}
+</if> 
+
+
+     </select>
+
+</mapper>