Explorar o código

加入文件关系表及处理逻辑,为硬件查询做好铺垫

wuxw %!s(int64=6) %!d(string=hai) anos
pai
achega
ed74823603
Modificáronse 17 ficheiros con 1735 adicións e 0 borrados
  1. 81 0
      CommonService/src/main/java/com/java110/common/dao/IFileRelServiceDao.java
  2. 134 0
      CommonService/src/main/java/com/java110/common/dao/impl/FileRelServiceDaoImpl.java
  3. 85 0
      CommonService/src/main/java/com/java110/common/listener/file/AbstractFileRelBusinessServiceDataFlowListener.java
  4. 180 0
      CommonService/src/main/java/com/java110/common/listener/file/DeleteFileRelInfoListener.java
  5. 179 0
      CommonService/src/main/java/com/java110/common/listener/file/SaveFileRelInfoListener.java
  6. 190 0
      CommonService/src/main/java/com/java110/common/listener/file/UpdateFileRelInfoListener.java
  7. 72 0
      CommonService/src/main/java/com/java110/common/smo/impl/FileRelInnerServiceSMOImpl.java
  8. 114 0
      docs/document/services/file/DeleteFileRelInfo.md
  9. 124 0
      docs/document/services/file/SaveFileRelInfo.md
  10. 124 0
      docs/document/services/file/UpdateFileRelInfo.md
  11. 95 0
      java110-bean/src/main/java/com/java110/dto/file/FileRelDto.java
  12. 89 0
      java110-code-generator/src/main/java/com/java110/FileRelGeneratorApplication.java
  13. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  14. 41 0
      java110-core/src/main/java/com/java110/core/smo/file/IFileRelInnerServiceSMO.java
  15. 24 0
      java110-db/db/CommonService/create_file_rel.sql
  16. 186 0
      java110-db/src/main/resources/mapper/common/FileRelServiceDaoImplMapper.xml
  17. 16 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

+ 81 - 0
CommonService/src/main/java/com/java110/common/dao/IFileRelServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.common.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 IFileRelServiceDao {
+
+    /**
+     * 保存 文件存放信息
+     * @param businessFileRelInfo 文件存放信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessFileRelInfo(Map businessFileRelInfo) throws DAOException;
+
+
+
+    /**
+     * 查询文件存放信息(business过程)
+     * 根据bId 查询文件存放信息
+     * @param info bId 信息
+     * @return 文件存放信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessFileRelInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 文件存放信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveFileRelInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询文件存放信息(instance过程)
+     * 根据bId 查询文件存放信息
+     * @param info bId 信息
+     * @return 文件存放信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getFileRelInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改文件存放信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateFileRelInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询文件存放总数
+     *
+     * @param info 文件存放信息
+     * @return 文件存放数量
+     */
+    int queryFileRelsCount(Map info);
+
+}

+ 134 - 0
CommonService/src/main/java/com/java110/common/dao/impl/FileRelServiceDaoImpl.java

@@ -0,0 +1,134 @@
+package com.java110.common.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.dao.IFileRelServiceDao;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文件存放服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("fileRelServiceDaoImpl")
+//@Transactional
+public class FileRelServiceDaoImpl extends BaseServiceDao implements IFileRelServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(FileRelServiceDaoImpl.class);
+
+    /**
+     * 文件存放信息封装
+     *
+     * @param businessFileRelInfo 文件存放信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessFileRelInfo(Map businessFileRelInfo) throws DAOException {
+        businessFileRelInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存文件存放信息 入参 businessFileRelInfo : {}", businessFileRelInfo);
+        int saveFlag = sqlSessionTemplate.insert("fileRelServiceDaoImpl.saveBusinessFileRelInfo", businessFileRelInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存文件存放数据失败:" + JSONObject.toJSONString(businessFileRelInfo));
+        }
+    }
+
+
+    /**
+     * 查询文件存放信息
+     *
+     * @param info bId 信息
+     * @return 文件存放信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessFileRelInfo(Map info) throws DAOException {
+
+        logger.debug("查询文件存放信息 入参 info : {}", info);
+
+        List<Map> businessFileRelInfos = sqlSessionTemplate.selectList("fileRelServiceDaoImpl.getBusinessFileRelInfo", info);
+
+        return businessFileRelInfos;
+    }
+
+
+    /**
+     * 保存文件存放信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveFileRelInfoInstance(Map info) throws DAOException {
+        logger.debug("保存文件存放信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("fileRelServiceDaoImpl.saveFileRelInfoInstance", 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> getFileRelInfo(Map info) throws DAOException {
+        logger.debug("查询文件存放信息 入参 info : {}", info);
+
+        List<Map> businessFileRelInfos = sqlSessionTemplate.selectList("fileRelServiceDaoImpl.getFileRelInfo", info);
+
+        return businessFileRelInfos;
+    }
+
+
+    /**
+     * 修改文件存放信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateFileRelInfoInstance(Map info) throws DAOException {
+        logger.debug("修改文件存放信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("fileRelServiceDaoImpl.updateFileRelInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改文件存放信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询文件存放数量
+     *
+     * @param info 文件存放信息
+     * @return 文件存放数量
+     */
+    @Override
+    public int queryFileRelsCount(Map info) {
+        logger.debug("查询文件存放数据 入参 info : {}", info);
+
+        List<Map> businessFileRelInfos = sqlSessionTemplate.selectList("fileRelServiceDaoImpl.queryFileRelsCount", info);
+        if (businessFileRelInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessFileRelInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 85 - 0
CommonService/src/main/java/com/java110/common/listener/file/AbstractFileRelBusinessServiceDataFlowListener.java

@@ -0,0 +1,85 @@
+package com.java110.common.listener.file;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.dao.IFileRelServiceDao;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+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 AbstractFileRelBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractFileRelBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IFileRelServiceDao getFileRelServiceDaoImpl();
+
+    /**
+     * 刷新 businessFileRelInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessFileRelInfo
+     */
+    protected void flushBusinessFileRelInfo(Map businessFileRelInfo, String statusCd) {
+        businessFileRelInfo.put("newBId", businessFileRelInfo.get("b_id"));
+        businessFileRelInfo.put("relTypeCd", businessFileRelInfo.get("rel_type_cd"));
+        businessFileRelInfo.put("saveWay", businessFileRelInfo.get("save_way"));
+        businessFileRelInfo.put("operate", businessFileRelInfo.get("operate"));
+        businessFileRelInfo.put("fileRelId", businessFileRelInfo.get("file_rel_id"));
+        businessFileRelInfo.put("fileRealName", businessFileRelInfo.get("file_real_name"));
+        businessFileRelInfo.put("objId", businessFileRelInfo.get("obj_id"));
+        businessFileRelInfo.put("fileSaveName", businessFileRelInfo.get("file_save_name"));
+        businessFileRelInfo.remove("bId");
+        businessFileRelInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessFileRel 文件存放信息
+     */
+    protected void autoSaveDelBusinessFileRel(Business business, JSONObject businessFileRel) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("fileRelId", businessFileRel.getString("fileRelId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentFileRelInfos = getFileRelServiceDaoImpl().getFileRelInfo(info);
+        if (currentFileRelInfos == null || currentFileRelInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentFileRelInfo = currentFileRelInfos.get(0);
+
+        currentFileRelInfo.put("bId", business.getbId());
+
+        currentFileRelInfo.put("relTypeCd", currentFileRelInfo.get("rel_type_cd"));
+        currentFileRelInfo.put("saveWay", currentFileRelInfo.get("save_way"));
+        currentFileRelInfo.put("operate", currentFileRelInfo.get("operate"));
+        currentFileRelInfo.put("fileRelId", currentFileRelInfo.get("file_rel_id"));
+        currentFileRelInfo.put("fileRealName", currentFileRelInfo.get("file_real_name"));
+        currentFileRelInfo.put("objId", currentFileRelInfo.get("obj_id"));
+        currentFileRelInfo.put("fileSaveName", currentFileRelInfo.get("file_save_name"));
+
+
+        currentFileRelInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getFileRelServiceDaoImpl().saveBusinessFileRelInfo(currentFileRelInfo);
+    }
+
+
+}

+ 180 - 0
CommonService/src/main/java/com/java110/common/listener/file/DeleteFileRelInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.common.listener.file;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.dao.IFileRelServiceDao;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 删除文件存放信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessFileRel:{} 文件存放基本信息节点
+ * 2、businessFileRelAttr:[{}] 文件存放属性信息节点
+ * 3、businessFileRelPhoto:[{}] 文件存放照片信息节点
+ * 4、businessFileRelCerdentials:[{}] 文件存放证件信息节点
+ * 协议地址 :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("deleteFileRelInfoListener")
+@Transactional
+public class DeleteFileRelInfoListener extends AbstractFileRelBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteFileRelInfoListener.class);
+    @Autowired
+    IFileRelServiceDao fileRelServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_FILE_REL;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessFileRel 节点
+        if (data.containsKey("businessFileRel")) {
+            //处理 businessFileRel 节点
+            if (data.containsKey("businessFileRel")) {
+                Object _obj = data.get("businessFileRel");
+                JSONArray businessFileRels = null;
+                if (_obj instanceof JSONObject) {
+                    businessFileRels = new JSONArray();
+                    businessFileRels.add(_obj);
+                } else {
+                    businessFileRels = (JSONArray) _obj;
+                }
+                //JSONObject businessFileRel = data.getJSONObject("businessFileRel");
+                for (int _fileRelIndex = 0; _fileRelIndex < businessFileRels.size(); _fileRelIndex++) {
+                    JSONObject businessFileRel = businessFileRels.getJSONObject(_fileRelIndex);
+                    doBusinessFileRel(business, businessFileRel);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("fileRelId", businessFileRel.getString("fileRelId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessFileRelInfos = fileRelServiceDaoImpl.getBusinessFileRelInfo(info);
+        if (businessFileRelInfos != null && businessFileRelInfos.size() > 0) {
+            for (int _fileRelIndex = 0; _fileRelIndex < businessFileRelInfos.size(); _fileRelIndex++) {
+                Map businessFileRelInfo = businessFileRelInfos.get(_fileRelIndex);
+                flushBusinessFileRelInfo(businessFileRelInfo, StatusConstant.STATUS_CD_INVALID);
+                fileRelServiceDaoImpl.updateFileRelInfoInstance(businessFileRelInfo);
+                dataFlowContext.addParamOut("fileRelId", businessFileRelInfo.get("file_rel_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> fileRelInfo = fileRelServiceDaoImpl.getFileRelInfo(info);
+        if (fileRelInfo != null && fileRelInfo.size() > 0) {
+
+            //文件存放信息
+            List<Map> businessFileRelInfos = fileRelServiceDaoImpl.getBusinessFileRelInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessFileRelInfos == null || businessFileRelInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(fileRel),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _fileRelIndex = 0; _fileRelIndex < businessFileRelInfos.size(); _fileRelIndex++) {
+                Map businessFileRelInfo = businessFileRelInfos.get(_fileRelIndex);
+                flushBusinessFileRelInfo(businessFileRelInfo, StatusConstant.STATUS_CD_VALID);
+                fileRelServiceDaoImpl.updateFileRelInfoInstance(businessFileRelInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessFileRel 节点
+     *
+     * @param business        总的数据节点
+     * @param businessFileRel 文件存放节点
+     */
+    private void doBusinessFileRel(Business business, JSONObject businessFileRel) {
+
+        Assert.jsonObjectHaveKey(businessFileRel, "fileRelId", "businessFileRel 节点下没有包含 fileRelId 节点");
+
+        if (businessFileRel.getString("fileRelId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "fileRelId 错误,不能自动生成(必须已经存在的fileRelId)" + businessFileRel);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessFileRel(business, businessFileRel);
+    }
+
+    public IFileRelServiceDao getFileRelServiceDaoImpl() {
+        return fileRelServiceDaoImpl;
+    }
+
+    public void setFileRelServiceDaoImpl(IFileRelServiceDao fileRelServiceDaoImpl) {
+        this.fileRelServiceDaoImpl = fileRelServiceDaoImpl;
+    }
+}

+ 179 - 0
CommonService/src/main/java/com/java110/common/listener/file/SaveFileRelInfoListener.java

@@ -0,0 +1,179 @@
+package com.java110.common.listener.file;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.dao.IFileRelServiceDao;
+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.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保存 文件存放信息 侦听
+ * Created by wuxw on 2018/5/18.
+ */
+@Java110Listener("saveFileRelInfoListener")
+@Transactional
+public class SaveFileRelInfoListener extends AbstractFileRelBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveFileRelInfoListener.class);
+
+    @Autowired
+    private IFileRelServiceDao fileRelServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL;
+    }
+
+    /**
+     * 保存文件存放信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessFileRel 节点
+        if (data.containsKey("businessFileRel")) {
+            Object bObj = data.get("businessFileRel");
+            JSONArray businessFileRels = null;
+            if (bObj instanceof JSONObject) {
+                businessFileRels = new JSONArray();
+                businessFileRels.add(bObj);
+            } else {
+                businessFileRels = (JSONArray) bObj;
+            }
+            //JSONObject businessFileRel = data.getJSONObject("businessFileRel");
+            for (int bFileRelIndex = 0; bFileRelIndex < businessFileRels.size(); bFileRelIndex++) {
+                JSONObject businessFileRel = businessFileRels.getJSONObject(bFileRelIndex);
+                doBusinessFileRel(business, businessFileRel);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("fileRelId", businessFileRel.getString("fileRelId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessFileRelInfo = fileRelServiceDaoImpl.getBusinessFileRelInfo(info);
+        if (businessFileRelInfo != null && businessFileRelInfo.size() > 0) {
+            reFreshShareColumn(info, businessFileRelInfo.get(0));
+            fileRelServiceDaoImpl.saveFileRelInfoInstance(info);
+            if (businessFileRelInfo.size() == 1) {
+                dataFlowContext.addParamOut("fileRelId", businessFileRelInfo.get(0).get("file_rel_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("relTypeCd")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("rel_type_cd")) {
+            return;
+        }
+
+        info.put("relTypeCd", businessInfo.get("rel_type_cd"));
+    }
+
+    /**
+     * 撤单
+     *
+     * @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> fileRelInfo = fileRelServiceDaoImpl.getFileRelInfo(info);
+        if (fileRelInfo != null && fileRelInfo.size() > 0) {
+            reFreshShareColumn(paramIn, fileRelInfo.get(0));
+            fileRelServiceDaoImpl.updateFileRelInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessFileRel 节点
+     *
+     * @param business        总的数据节点
+     * @param businessFileRel 文件存放节点
+     */
+    private void doBusinessFileRel(Business business, JSONObject businessFileRel) {
+
+        Assert.jsonObjectHaveKey(businessFileRel, "fileRelId", "businessFileRel 节点下没有包含 fileRelId 节点");
+
+        if (businessFileRel.getString("fileRelId").startsWith("-")) {
+            //刷新缓存
+            //flushFileRelId(business.getDatas());
+
+            businessFileRel.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId));
+
+        }
+
+        businessFileRel.put("bId", business.getbId());
+        businessFileRel.put("operate", StatusConstant.OPERATE_ADD);
+        //保存文件存放信息
+        fileRelServiceDaoImpl.saveBusinessFileRelInfo(businessFileRel);
+
+    }
+
+    public IFileRelServiceDao getFileRelServiceDaoImpl() {
+        return fileRelServiceDaoImpl;
+    }
+
+    public void setFileRelServiceDaoImpl(IFileRelServiceDao fileRelServiceDaoImpl) {
+        this.fileRelServiceDaoImpl = fileRelServiceDaoImpl;
+    }
+}

+ 190 - 0
CommonService/src/main/java/com/java110/common/listener/file/UpdateFileRelInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.common.listener.file;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.dao.IFileRelServiceDao;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.exception.ListenerExecuteException;
+import com.java110.utils.util.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 修改文件存放信息 侦听
+ * <p>
+ * 处理节点
+ * 1、businessFileRel:{} 文件存放基本信息节点
+ * 2、businessFileRelAttr:[{}] 文件存放属性信息节点
+ * 3、businessFileRelPhoto:[{}] 文件存放照片信息节点
+ * 4、businessFileRelCerdentials:[{}] 文件存放证件信息节点
+ * 协议地址 :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("updateFileRelInfoListener")
+@Transactional
+public class UpdateFileRelInfoListener extends AbstractFileRelBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateFileRelInfoListener.class);
+    @Autowired
+    private IFileRelServiceDao fileRelServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_FILE_REL;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessFileRel 节点
+        if (data.containsKey("businessFileRel")) {
+            //处理 businessFileRel 节点
+            if (data.containsKey("businessFileRel")) {
+                Object _obj = data.get("businessFileRel");
+                JSONArray businessFileRels = null;
+                if (_obj instanceof JSONObject) {
+                    businessFileRels = new JSONArray();
+                    businessFileRels.add(_obj);
+                } else {
+                    businessFileRels = (JSONArray) _obj;
+                }
+                //JSONObject businessFileRel = data.getJSONObject("businessFileRel");
+                for (int _fileRelIndex = 0; _fileRelIndex < businessFileRels.size(); _fileRelIndex++) {
+                    JSONObject businessFileRel = businessFileRels.getJSONObject(_fileRelIndex);
+                    doBusinessFileRel(business, businessFileRel);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("fileRelId", businessFileRel.getString("fileRelId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessFileRelInfos = fileRelServiceDaoImpl.getBusinessFileRelInfo(info);
+        if (businessFileRelInfos != null && businessFileRelInfos.size() > 0) {
+            for (int _fileRelIndex = 0; _fileRelIndex < businessFileRelInfos.size(); _fileRelIndex++) {
+                Map businessFileRelInfo = businessFileRelInfos.get(_fileRelIndex);
+                flushBusinessFileRelInfo(businessFileRelInfo, StatusConstant.STATUS_CD_VALID);
+                fileRelServiceDaoImpl.updateFileRelInfoInstance(businessFileRelInfo);
+                if (businessFileRelInfo.size() == 1) {
+                    dataFlowContext.addParamOut("fileRelId", businessFileRelInfo.get("file_rel_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> fileRelInfo = fileRelServiceDaoImpl.getFileRelInfo(info);
+        if (fileRelInfo != null && fileRelInfo.size() > 0) {
+
+            //文件存放信息
+            List<Map> businessFileRelInfos = fileRelServiceDaoImpl.getBusinessFileRelInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessFileRelInfos == null || businessFileRelInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(fileRel),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _fileRelIndex = 0; _fileRelIndex < businessFileRelInfos.size(); _fileRelIndex++) {
+                Map businessFileRelInfo = businessFileRelInfos.get(_fileRelIndex);
+                flushBusinessFileRelInfo(businessFileRelInfo, StatusConstant.STATUS_CD_VALID);
+                fileRelServiceDaoImpl.updateFileRelInfoInstance(businessFileRelInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessFileRel 节点
+     *
+     * @param business        总的数据节点
+     * @param businessFileRel 文件存放节点
+     */
+    private void doBusinessFileRel(Business business, JSONObject businessFileRel) {
+
+        Assert.jsonObjectHaveKey(businessFileRel, "fileRelId", "businessFileRel 节点下没有包含 fileRelId 节点");
+
+        if (businessFileRel.getString("fileRelId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "fileRelId 错误,不能自动生成(必须已经存在的fileRelId)" + businessFileRel);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessFileRel(business, businessFileRel);
+
+        businessFileRel.put("bId", business.getbId());
+        businessFileRel.put("operate", StatusConstant.OPERATE_ADD);
+        //保存文件存放信息
+        fileRelServiceDaoImpl.saveBusinessFileRelInfo(businessFileRel);
+
+    }
+
+
+    public IFileRelServiceDao getFileRelServiceDaoImpl() {
+        return fileRelServiceDaoImpl;
+    }
+
+    public void setFileRelServiceDaoImpl(IFileRelServiceDao fileRelServiceDaoImpl) {
+        this.fileRelServiceDaoImpl = fileRelServiceDaoImpl;
+    }
+
+
+}

+ 72 - 0
CommonService/src/main/java/com/java110/common/smo/impl/FileRelInnerServiceSMOImpl.java

@@ -0,0 +1,72 @@
+package com.java110.common.smo.impl;
+
+
+import com.java110.common.dao.IFileRelServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.file.IFileRelInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.file.FileRelDto;
+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.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 文件存放内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class FileRelInnerServiceSMOImpl extends BaseServiceSMO implements IFileRelInnerServiceSMO {
+
+    @Autowired
+    private IFileRelServiceDao fileRelServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<FileRelDto> queryFileRels(@RequestBody FileRelDto fileRelDto) {
+
+        //校验是否传了 分页信息
+
+        int page = fileRelDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            fileRelDto.setPage((page - 1) * fileRelDto.getRow());
+        }
+
+        List<FileRelDto> fileRels = BeanConvertUtil.covertBeanList(fileRelServiceDaoImpl.getFileRelInfo(BeanConvertUtil.beanCovertMap(fileRelDto)), FileRelDto.class);
+
+
+        return fileRels;
+    }
+
+
+    @Override
+    public int queryFileRelsCount(@RequestBody FileRelDto fileRelDto) {
+        return fileRelServiceDaoImpl.queryFileRelsCount(BeanConvertUtil.beanCovertMap(fileRelDto));
+    }
+
+    public IFileRelServiceDao getFileRelServiceDaoImpl() {
+        return fileRelServiceDaoImpl;
+    }
+
+    public void setFileRelServiceDaoImpl(IFileRelServiceDao fileRelServiceDaoImpl) {
+        this.fileRelServiceDaoImpl = fileRelServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 114 - 0
docs/document/services/file/DeleteFileRelInfo.md

@@ -0,0 +1,114 @@
+
+
+**1\. 删除文件存放**
+###### 接口功能
+> API服务做删除文件存放时调用该接口
+
+###### URL
+> [http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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|businessFileRelInfo|1|Object|-|小区成员|小区成员|
+|businessFileRelInfo|fileRelId|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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": "220200050001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessFileRelInfo": {
+                "fileRelId":"填写存在的值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 124 - 0
docs/document/services/file/SaveFileRelInfo.md

@@ -0,0 +1,124 @@
+
+
+**1\. 保存文件存放**
+###### 接口功能
+> API服务做保存文件存放时调用该接口
+
+###### URL
+> [http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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|businessFileRelInfo|1|Object|-|小区成员|小区成员|
+|businessFileRelInfo|relTypeCd|1|String|30|-|-|
+|businessFileRelInfo|saveWay|1|String|30|-|-|
+|businessFileRelInfo|fileRelId|1|String|30|-|-|
+|businessFileRelInfo|fileRealName|1|String|30|-|-|
+|businessFileRelInfo|objId|1|String|30|-|-|
+|businessFileRelInfo|fileSaveName|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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": "220200030001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessFileRelInfo": {
+                "relTypeCd":"填写具体值",
+        "saveWay":"填写具体值",
+        "fileRelId":"填写具体值",
+        "fileRealName":"填写具体值",
+        "objId":"填写具体值",
+        "fileSaveName":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 124 - 0
docs/document/services/file/UpdateFileRelInfo.md

@@ -0,0 +1,124 @@
+
+
+**1\. 修改文件存放**
+###### 接口功能
+> API服务做修改文件存放时调用该接口
+
+###### URL
+> [http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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|businessFileRelInfo|1|Object|-|小区成员|小区成员|
+|businessFileRelInfo|relTypeCd|1|String|30|-|-|
+|businessFileRelInfo|saveWay|1|String|30|-|-|
+|businessFileRelInfo|fileRelId|1|String|30|-|-|
+|businessFileRelInfo|fileRealName|1|String|30|-|-|
+|businessFileRelInfo|objId|1|String|30|-|-|
+|businessFileRelInfo|fileSaveName|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://fileRel-service/fileRelApi/service](http://fileRel-service/fileRelApi/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": "220200040001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessFileRelInfo": {
+                "relTypeCd":"填写具体值",
+        "saveWay":"填写具体值",
+        "fileRelId":"填写具体值",
+        "fileRealName":"填写具体值",
+        "objId":"填写具体值",
+        "fileSaveName":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 95 - 0
java110-bean/src/main/java/com/java110/dto/file/FileRelDto.java

@@ -0,0 +1,95 @@
+package com.java110.dto.file;
+
+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 FileRelDto extends PageDto implements Serializable {
+
+    private String relTypeCd;
+    private String saveWay;
+    private String fileRelId;
+    private String fileRealName;
+    private String objId;
+    private String fileSaveName;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getRelTypeCd() {
+        return relTypeCd;
+    }
+
+    public void setRelTypeCd(String relTypeCd) {
+        this.relTypeCd = relTypeCd;
+    }
+
+    public String getSaveWay() {
+        return saveWay;
+    }
+
+    public void setSaveWay(String saveWay) {
+        this.saveWay = saveWay;
+    }
+
+    public String getFileRelId() {
+        return fileRelId;
+    }
+
+    public void setFileRelId(String fileRelId) {
+        this.fileRelId = fileRelId;
+    }
+
+    public String getFileRealName() {
+        return fileRealName;
+    }
+
+    public void setFileRealName(String fileRealName) {
+        this.fileRealName = fileRealName;
+    }
+
+    public String getObjId() {
+        return objId;
+    }
+
+    public void setObjId(String objId) {
+        this.objId = objId;
+    }
+
+    public String getFileSaveName() {
+        return fileSaveName;
+    }
+
+    public void setFileSaveName(String fileSaveName) {
+        this.fileSaveName = fileSaveName;
+    }
+
+
+    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;
+    }
+}

+ 89 - 0
java110-code-generator/src/main/java/com/java110/FileRelGeneratorApplication.java

@@ -0,0 +1,89 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ */
+public class FileRelGeneratorApplication {
+
+    protected FileRelGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * 代码生成器 入口方法
+     *  此处生成的mapper文件包含过程表和实例表的sql,所以要求两张表的特殊字段也要写上
+     *   BusinessTypeCd
+     *   `file_rel_id` varchar(30) NOT NULL COMMENT '文件关系ID,主键',
+     *   `b_id` varchar(30) NOT NULL COMMENT '业务Id',
+     *   `rel_type_cd` varchar(30) NOT NULL COMMENT '文件类型,用来做分区,业主照片,商户照片,具体查看t_dict表',
+     *   `save_way` varchar(12) NOT NULL COMMENT '存放方式,ftp table,fastdfs 具体查看t_dict表',
+     *   `obj_id` varchar(30) NOT NULL COMMENT '对象ID,及说明这个文件归宿于谁,业主则填写业主ID',
+     *   `file_real_name` varchar(200) NOT NULL COMMENT '文件真实名称',
+     *   `file_save_name` varchar(200) NOT NULL COMMENT '文件存储名称',
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("fileRelId");
+        data.setName("fileRel");
+        data.setDesc("文件存放");
+        data.setShareParam("relTypeCd");
+        data.setShareColumn("rel_type_cd");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_FILE_REL");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_FILE_REL");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_FILE_REL");
+        data.setNewBusinessTypeCdValue("220200030001");
+        data.setUpdateBusinessTypeCdValue("220200040001");
+        data.setDeleteBusinessTypeCdValue("220200050001");
+        data.setBusinessTableName("business_file_rel");
+        data.setTableName("file_rel");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("fileRelId", "file_rel_id");       //map的key为你自定义的字段名就是驼峰命名法的那个,value为数据库表的字段名
+        param.put("relTypeCd", "rel_type_cd");
+        param.put("saveWay", "save_way");
+        param.put("objId", "obj_id");
+        param.put("fileRealName", "file_real_name");
+        param.put("fileSaveName", "file_save_name");
+        param.put("statusCd", "status_cd");
+        param.put("operate", "operate");
+        param.put("bId", "b_id");
+        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);
+    }
+}

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

@@ -102,6 +102,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_complaintId = "88";
     public static final String CODE_PREFIX_machineId = "89";
     public static final String CODE_PREFIX_machineTranslateId = "90";
+    public static final String CODE_PREFIX_fileRelId = "91";
 
 
     /**

+ 41 - 0
java110-core/src/main/java/com/java110/core/smo/file/IFileRelInnerServiceSMO.java

@@ -0,0 +1,41 @@
+package com.java110.core.smo.file;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.file.FileRelDto;
+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 IFileRelInnerServiceSMO
+ * @Description 文件存放接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "common-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/fileRelApi")
+public interface IFileRelInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param fileRelDto 数据对象分享
+     * @return FileRelDto 对象数据
+     */
+    @RequestMapping(value = "/queryFileRels", method = RequestMethod.POST)
+    List<FileRelDto> queryFileRels(@RequestBody FileRelDto fileRelDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param fileRelDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryFileRelsCount", method = RequestMethod.POST)
+    int queryFileRelsCount(@RequestBody FileRelDto fileRelDto);
+}

+ 24 - 0
java110-db/db/CommonService/create_file_rel.sql

@@ -0,0 +1,24 @@
+create table file_rel(
+  `file_rel_id` varchar(30) NOT NULL COMMENT '文件关系ID,主键',
+  `b_id` varchar(30) NOT NULL COMMENT '业务Id',
+  `rel_type_cd` varchar(30) NOT NULL COMMENT '文件类型,用来做分区,业主照片,商户照片,具体查看t_dict表',
+  `save_way` varchar(12) NOT NULL COMMENT '存放方式,ftp table,fastdfs 具体查看t_dict表',
+  `obj_id` varchar(30) NOT NULL COMMENT '对象ID,及说明这个文件归宿于谁,业主则填写业主ID',
+  `file_real_name` varchar(200) NOT NULL COMMENT '文件真实名称',
+  `file_save_name` varchar(200) NOT NULL COMMENT '文件存储名称',
+  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考t_dict表,0, 在用 1失效',
+  KEY `idx_file_rel_id` (`file_rel_id`)
+);
+
+CREATE TABLE `business_file_rel` (
+   `file_rel_id` varchar(30) NOT NULL COMMENT '文件关系ID,主键',
+  `b_id` varchar(30) NOT NULL COMMENT '业务Id',
+  `rel_type_cd` varchar(30) NOT NULL COMMENT '文件类型,用来做分区,业主照片,商户照片,具体查看t_dict表',
+  `save_way` varchar(12) NOT NULL COMMENT '存放方式,ftp table,fastdfs 具体查看t_dict表',
+  `obj_id` varchar(30) NOT NULL COMMENT '对象ID,及说明这个文件归宿于谁,业主则填写业主ID',
+  `file_real_name` varchar(200) NOT NULL COMMENT '文件真实名称',
+  `file_save_name` varchar(200) NOT NULL COMMENT '文件存储名称',
+  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `operate` varchar(4) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);

+ 186 - 0
java110-db/src/main/resources/mapper/common/FileRelServiceDaoImplMapper.xml

@@ -0,0 +1,186 @@
+<?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="fileRelServiceDaoImpl">
+
+    <!-- 保存文件存放信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessFileRelInfo" parameterType="Map">
+           insert into business_file_rel(
+rel_type_cd,save_way,operate,file_rel_id,file_real_name,obj_id,file_save_name,b_id
+) values (
+#{relTypeCd},#{saveWay},#{operate},#{fileRelId},#{fileRealName},#{objId},#{fileSaveName},#{bId}
+)
+       </insert>
+
+
+       <!-- 查询文件存放信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessFileRelInfo" parameterType="Map" resultType="Map">
+           select  t.rel_type_cd,t.rel_type_cd relTypeCd,t.save_way,t.save_way saveWay,t.operate,t.file_rel_id,t.file_rel_id fileRelId,t.file_real_name,t.file_real_name fileRealName,t.obj_id,t.obj_id objId,t.file_save_name,t.file_save_name fileSaveName,t.b_id,t.b_id bId 
+from business_file_rel t 
+where 1 =1 
+<if test="relTypeCd !=null and relTypeCd != ''">
+   and t.rel_type_cd= #{relTypeCd}
+</if> 
+<if test="saveWay !=null and saveWay != ''">
+   and t.save_way= #{saveWay}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="fileRelId !=null and fileRelId != ''">
+   and t.file_rel_id= #{fileRelId}
+</if> 
+<if test="fileRealName !=null and fileRealName != ''">
+   and t.file_real_name= #{fileRealName}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="fileSaveName !=null and fileSaveName != ''">
+   and t.file_save_name= #{fileSaveName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存文件存放信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveFileRelInfoInstance" parameterType="Map">
+        insert into file_rel(
+rel_type_cd,save_way,file_rel_id,file_real_name,obj_id,file_save_name,status_cd,b_id
+) select t.rel_type_cd,t.save_way,t.file_rel_id,t.file_real_name,t.obj_id,t.file_save_name,'0',t.b_id from business_file_rel t where 1=1
+<if test="relTypeCd !=null and relTypeCd != ''">
+   and t.rel_type_cd= #{relTypeCd}
+</if> 
+<if test="saveWay !=null and saveWay != ''">
+   and t.save_way= #{saveWay}
+</if> 
+   and t.operate= 'ADD'
+<if test="fileRelId !=null and fileRelId != ''">
+   and t.file_rel_id= #{fileRelId}
+</if> 
+<if test="fileRealName !=null and fileRealName != ''">
+   and t.file_real_name= #{fileRealName}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="fileSaveName !=null and fileSaveName != ''">
+   and t.file_save_name= #{fileSaveName}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询文件存放信息 add by wuxw 2018-07-03 -->
+    <select id="getFileRelInfo" parameterType="Map" resultType="Map">
+        select  t.rel_type_cd,t.rel_type_cd relTypeCd,t.save_way,t.save_way saveWay,t.file_rel_id,t.file_rel_id fileRelId,t.file_real_name,t.file_real_name fileRealName,t.obj_id,t.obj_id objId,t.file_save_name,t.file_save_name fileSaveName,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id bId 
+from file_rel t 
+where 1 =1 
+<if test="relTypeCd !=null and relTypeCd != ''">
+   and t.rel_type_cd= #{relTypeCd}
+</if> 
+<if test="saveWay !=null and saveWay != ''">
+   and t.save_way= #{saveWay}
+</if> 
+<if test="fileRelId !=null and fileRelId != ''">
+   and t.file_rel_id= #{fileRelId}
+</if> 
+<if test="fileRealName !=null and fileRealName != ''">
+   and t.file_real_name= #{fileRealName}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="fileSaveName !=null and fileSaveName != ''">
+   and t.file_save_name= #{fileSaveName}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改文件存放信息 add by wuxw 2018-07-03 -->
+    <update id="updateFileRelInfoInstance" parameterType="Map">
+        update  file_rel t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="relTypeCd !=null and relTypeCd != ''">
+, t.rel_type_cd= #{relTypeCd}
+</if> 
+<if test="saveWay !=null and saveWay != ''">
+, t.save_way= #{saveWay}
+</if> 
+<if test="fileRealName !=null and fileRealName != ''">
+, t.file_real_name= #{fileRealName}
+</if> 
+<if test="objId !=null and objId != ''">
+, t.obj_id= #{objId}
+</if> 
+<if test="fileSaveName !=null and fileSaveName != ''">
+, t.file_save_name= #{fileSaveName}
+</if> 
+ where 1=1 <if test="fileRelId !=null and fileRelId != ''">
+and t.file_rel_id= #{fileRelId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询文件存放数量 add by wuxw 2018-07-03 -->
+     <select id="queryFileRelsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from file_rel t 
+where 1 =1 
+<if test="relTypeCd !=null and relTypeCd != ''">
+   and t.rel_type_cd= #{relTypeCd}
+</if> 
+<if test="saveWay !=null and saveWay != ''">
+   and t.save_way= #{saveWay}
+</if> 
+<if test="fileRelId !=null and fileRelId != ''">
+   and t.file_rel_id= #{fileRelId}
+</if> 
+<if test="fileRealName !=null and fileRealName != ''">
+   and t.file_real_name= #{fileRealName}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="fileSaveName !=null and fileSaveName != ''">
+   and t.file_save_name= #{fileSaveName}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+
+
+     </select>
+
+</mapper>

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

@@ -609,4 +609,20 @@ public class BusinessTypeConstant {
      *  删除 设备
      */
     public static final String BUSINESS_TYPE_DELETE_MACHINE_TRANSLATE ="210200050001";
+
+
+    /**
+     *  保存 文件保存关系
+     * 14开头  3保存
+     */
+    public static final String BUSINESS_TYPE_SAVE_FILE_REL="220200030001";
+
+    /**
+     * 修改 文件保存关系
+     */
+    public static final String BUSINESS_TYPE_UPDATE_FILE_REL="220200040001";
+    /**
+     *  删除 文件保存关系
+     */
+    public static final String BUSINESS_TYPE_DELETE_FILE_REL ="220200050001";
 }