wuxw лет назад: 6
Родитель
Сommit
52b8f268f2
20 измененных файлов с 2032 добавлено и 6 удалено
  1. 81 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/dao/IApplicationKeyServiceDao.java
  2. 134 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/dao/impl/ApplicationKeyServiceDaoImpl.java
  3. 95 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/AbstractApplicationKeyBusinessServiceDataFlowListener.java
  4. 180 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/DeleteApplicationKeyInfoListener.java
  5. 179 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/SaveApplicationKeyInfoListener.java
  6. 190 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/UpdateApplicationKeyInfoListener.java
  7. 71 0
      HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/smo/impl/ApplicationKeyInnerServiceSMOImpl.java
  8. 11 4
      WebService/src/main/resources/components/ownerPackage/audit-applicationKey-manage/auditApplicationKeyManage.html
  9. 114 0
      docs/document/services/machine/DeleteApplicationKeyInfo.md
  10. 134 0
      docs/document/services/machine/SaveApplicationKeyInfo.md
  11. 134 0
      docs/document/services/machine/UpdateApplicationKeyInfo.md
  12. 140 0
      java110-bean/src/main/java/com/java110/dto/hardwareAdapation/ApplicationKeyDto.java
  13. 87 0
      java110-code-generator/src/main/java/com/java110/ApplicationKeyGeneratorApplication.java
  14. 2 2
      java110-code-generator/src/main/resources/web/template_1.json
  15. 125 0
      java110-code-generator/src/main/resources/web/template_machineRecord.json
  16. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  17. 41 0
      java110-core/src/main/java/com/java110/core/smo/hardwareAdapation/IApplicationKeyInnerServiceSMO.java
  18. 37 0
      java110-db/db/HardwareAdapationService/create_machine_app_key.sql
  19. 261 0
      java110-db/src/main/resources/mapper/hardwareAdapation/ApplicationKeyServiceDaoImplMapper.xml
  20. 15 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

+ 81 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/dao/IApplicationKeyServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.hardwareAdapation.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 IApplicationKeyServiceDao {
+
+    /**
+     * 保存 钥匙申请信息
+     * @param businessApplicationKeyInfo 钥匙申请信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessApplicationKeyInfo(Map businessApplicationKeyInfo) throws DAOException;
+
+
+
+    /**
+     * 查询钥匙申请信息(business过程)
+     * 根据bId 查询钥匙申请信息
+     * @param info bId 信息
+     * @return 钥匙申请信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessApplicationKeyInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 钥匙申请信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveApplicationKeyInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询钥匙申请信息(instance过程)
+     * 根据bId 查询钥匙申请信息
+     * @param info bId 信息
+     * @return 钥匙申请信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getApplicationKeyInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改钥匙申请信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateApplicationKeyInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询钥匙申请总数
+     *
+     * @param info 钥匙申请信息
+     * @return 钥匙申请数量
+     */
+    int queryApplicationKeysCount(Map info);
+
+}

+ 134 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/dao/impl/ApplicationKeyServiceDaoImpl.java

@@ -0,0 +1,134 @@
+package com.java110.hardwareAdapation.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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("applicationKeyServiceDaoImpl")
+//@Transactional
+public class ApplicationKeyServiceDaoImpl extends BaseServiceDao implements IApplicationKeyServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(ApplicationKeyServiceDaoImpl.class);
+
+    /**
+     * 钥匙申请信息封装
+     *
+     * @param businessApplicationKeyInfo 钥匙申请信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessApplicationKeyInfo(Map businessApplicationKeyInfo) throws DAOException {
+        businessApplicationKeyInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存钥匙申请信息 入参 businessApplicationKeyInfo : {}", businessApplicationKeyInfo);
+        int saveFlag = sqlSessionTemplate.insert("applicationKeyServiceDaoImpl.saveBusinessApplicationKeyInfo", businessApplicationKeyInfo);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存钥匙申请数据失败:" + JSONObject.toJSONString(businessApplicationKeyInfo));
+        }
+    }
+
+
+    /**
+     * 查询钥匙申请信息
+     *
+     * @param info bId 信息
+     * @return 钥匙申请信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessApplicationKeyInfo(Map info) throws DAOException {
+
+        logger.debug("查询钥匙申请信息 入参 info : {}", info);
+
+        List<Map> businessApplicationKeyInfos = sqlSessionTemplate.selectList("applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo", info);
+
+        return businessApplicationKeyInfos;
+    }
+
+
+    /**
+     * 保存钥匙申请信息 到 instance
+     *
+     * @param info bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveApplicationKeyInfoInstance(Map info) throws DAOException {
+        logger.debug("保存钥匙申请信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("applicationKeyServiceDaoImpl.saveApplicationKeyInfoInstance", 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> getApplicationKeyInfo(Map info) throws DAOException {
+        logger.debug("查询钥匙申请信息 入参 info : {}", info);
+
+        List<Map> businessApplicationKeyInfos = sqlSessionTemplate.selectList("applicationKeyServiceDaoImpl.getApplicationKeyInfo", info);
+
+        return businessApplicationKeyInfos;
+    }
+
+
+    /**
+     * 修改钥匙申请信息
+     *
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateApplicationKeyInfoInstance(Map info) throws DAOException {
+        logger.debug("修改钥匙申请信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance", info);
+
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改钥匙申请信息Instance数据失败:" + JSONObject.toJSONString(info));
+        }
+    }
+
+    /**
+     * 查询钥匙申请数量
+     *
+     * @param info 钥匙申请信息
+     * @return 钥匙申请数量
+     */
+    @Override
+    public int queryApplicationKeysCount(Map info) {
+        logger.debug("查询钥匙申请数据 入参 info : {}", info);
+
+        List<Map> businessApplicationKeyInfos = sqlSessionTemplate.selectList("applicationKeyServiceDaoImpl.queryApplicationKeysCount", info);
+        if (businessApplicationKeyInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessApplicationKeyInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 95 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/AbstractApplicationKeyBusinessServiceDataFlowListener.java

@@ -0,0 +1,95 @@
+package com.java110.hardwareAdapation.listener.applicationKey;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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 AbstractApplicationKeyBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractApplicationKeyBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract IApplicationKeyServiceDao getApplicationKeyServiceDaoImpl();
+
+    /**
+     * 刷新 businessApplicationKeyInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessApplicationKeyInfo
+     */
+    protected void flushBusinessApplicationKeyInfo(Map businessApplicationKeyInfo, String statusCd) {
+        businessApplicationKeyInfo.put("newBId", businessApplicationKeyInfo.get("b_id"));
+        businessApplicationKeyInfo.put("applicationKeyId", businessApplicationKeyInfo.get("application_key_id"));
+        businessApplicationKeyInfo.put("idCard", businessApplicationKeyInfo.get("id_card"));
+        businessApplicationKeyInfo.put("sex", businessApplicationKeyInfo.get("sex"));
+        businessApplicationKeyInfo.put("entTime", businessApplicationKeyInfo.get("end_time"));
+        businessApplicationKeyInfo.put("machineId", businessApplicationKeyInfo.get("machine_id"));
+        businessApplicationKeyInfo.put("operate", businessApplicationKeyInfo.get("operate"));
+        businessApplicationKeyInfo.put("typeCd", businessApplicationKeyInfo.get("type_cd"));
+        businessApplicationKeyInfo.put("name", businessApplicationKeyInfo.get("name"));
+        businessApplicationKeyInfo.put("tel", businessApplicationKeyInfo.get("tel"));
+        businessApplicationKeyInfo.put("startTime", businessApplicationKeyInfo.get("start_time"));
+        businessApplicationKeyInfo.put("state", businessApplicationKeyInfo.get("state"));
+        businessApplicationKeyInfo.put("age", businessApplicationKeyInfo.get("age"));
+        businessApplicationKeyInfo.remove("bId");
+        businessApplicationKeyInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessApplicationKey 钥匙申请信息
+     */
+    protected void autoSaveDelBusinessApplicationKey(Business business, JSONObject businessApplicationKey) {
+//自动插入DEL
+        Map info = new HashMap();
+        info.put("applicationKeyId", businessApplicationKey.getString("applicationKeyId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentApplicationKeyInfos = getApplicationKeyServiceDaoImpl().getApplicationKeyInfo(info);
+        if (currentApplicationKeyInfos == null || currentApplicationKeyInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+
+        Map currentApplicationKeyInfo = currentApplicationKeyInfos.get(0);
+
+        currentApplicationKeyInfo.put("bId", business.getbId());
+
+        currentApplicationKeyInfo.put("applicationKeyId", currentApplicationKeyInfo.get("application_key_id"));
+        currentApplicationKeyInfo.put("idCard", currentApplicationKeyInfo.get("id_card"));
+        currentApplicationKeyInfo.put("sex", currentApplicationKeyInfo.get("sex"));
+        currentApplicationKeyInfo.put("entTime", currentApplicationKeyInfo.get("end_time"));
+        currentApplicationKeyInfo.put("machineId", currentApplicationKeyInfo.get("machine_id"));
+        currentApplicationKeyInfo.put("operate", currentApplicationKeyInfo.get("operate"));
+        currentApplicationKeyInfo.put("typeCd", currentApplicationKeyInfo.get("type_cd"));
+        currentApplicationKeyInfo.put("name", currentApplicationKeyInfo.get("name"));
+        currentApplicationKeyInfo.put("tel", currentApplicationKeyInfo.get("tel"));
+        currentApplicationKeyInfo.put("startTime", currentApplicationKeyInfo.get("start_time"));
+        currentApplicationKeyInfo.put("state", currentApplicationKeyInfo.get("state"));
+        currentApplicationKeyInfo.put("age", currentApplicationKeyInfo.get("age"));
+
+
+        currentApplicationKeyInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getApplicationKeyServiceDaoImpl().saveBusinessApplicationKeyInfo(currentApplicationKeyInfo);
+    }
+
+
+}

+ 180 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/DeleteApplicationKeyInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.hardwareAdapation.listener.applicationKey;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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、businessApplicationKey:{} 钥匙申请基本信息节点
+ * 2、businessApplicationKeyAttr:[{}] 钥匙申请属性信息节点
+ * 3、businessApplicationKeyPhoto:[{}] 钥匙申请照片信息节点
+ * 4、businessApplicationKeyCerdentials:[{}] 钥匙申请证件信息节点
+ * 协议地址 :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("deleteApplicationKeyInfoListener")
+@Transactional
+public class DeleteApplicationKeyInfoListener extends AbstractApplicationKeyBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteApplicationKeyInfoListener.class);
+    @Autowired
+    IApplicationKeyServiceDao applicationKeyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_APPLICATION_KEY;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessApplicationKey 节点
+        if (data.containsKey("businessApplicationKey")) {
+            //处理 businessApplicationKey 节点
+            if (data.containsKey("businessApplicationKey")) {
+                Object _obj = data.get("businessApplicationKey");
+                JSONArray businessApplicationKeys = null;
+                if (_obj instanceof JSONObject) {
+                    businessApplicationKeys = new JSONArray();
+                    businessApplicationKeys.add(_obj);
+                } else {
+                    businessApplicationKeys = (JSONArray) _obj;
+                }
+                //JSONObject businessApplicationKey = data.getJSONObject("businessApplicationKey");
+                for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeys.size(); _applicationKeyIndex++) {
+                    JSONObject businessApplicationKey = businessApplicationKeys.getJSONObject(_applicationKeyIndex);
+                    doBusinessApplicationKey(business, businessApplicationKey);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("applicationKeyId", businessApplicationKey.getString("applicationKeyId"));
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 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> businessApplicationKeyInfos = applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo(info);
+        if (businessApplicationKeyInfos != null && businessApplicationKeyInfos.size() > 0) {
+            for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeyInfos.size(); _applicationKeyIndex++) {
+                Map businessApplicationKeyInfo = businessApplicationKeyInfos.get(_applicationKeyIndex);
+                flushBusinessApplicationKeyInfo(businessApplicationKeyInfo, StatusConstant.STATUS_CD_INVALID);
+                applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance(businessApplicationKeyInfo);
+                dataFlowContext.addParamOut("applicationKeyId", businessApplicationKeyInfo.get("application_key_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> applicationKeyInfo = applicationKeyServiceDaoImpl.getApplicationKeyInfo(info);
+        if (applicationKeyInfo != null && applicationKeyInfo.size() > 0) {
+
+            //钥匙申请信息
+            List<Map> businessApplicationKeyInfos = applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessApplicationKeyInfos == null || businessApplicationKeyInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(applicationKey),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeyInfos.size(); _applicationKeyIndex++) {
+                Map businessApplicationKeyInfo = businessApplicationKeyInfos.get(_applicationKeyIndex);
+                flushBusinessApplicationKeyInfo(businessApplicationKeyInfo, StatusConstant.STATUS_CD_VALID);
+                applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance(businessApplicationKeyInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessApplicationKey 节点
+     *
+     * @param business               总的数据节点
+     * @param businessApplicationKey 钥匙申请节点
+     */
+    private void doBusinessApplicationKey(Business business, JSONObject businessApplicationKey) {
+
+        Assert.jsonObjectHaveKey(businessApplicationKey, "applicationKeyId", "businessApplicationKey 节点下没有包含 applicationKeyId 节点");
+
+        if (businessApplicationKey.getString("applicationKeyId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "applicationKeyId 错误,不能自动生成(必须已经存在的applicationKeyId)" + businessApplicationKey);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessApplicationKey(business, businessApplicationKey);
+    }
+
+    public IApplicationKeyServiceDao getApplicationKeyServiceDaoImpl() {
+        return applicationKeyServiceDaoImpl;
+    }
+
+    public void setApplicationKeyServiceDaoImpl(IApplicationKeyServiceDao applicationKeyServiceDaoImpl) {
+        this.applicationKeyServiceDaoImpl = applicationKeyServiceDaoImpl;
+    }
+}

+ 179 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/SaveApplicationKeyInfoListener.java

@@ -0,0 +1,179 @@
+package com.java110.hardwareAdapation.listener.applicationKey;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.entity.center.Business;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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("saveApplicationKeyInfoListener")
+@Transactional
+public class SaveApplicationKeyInfoListener extends AbstractApplicationKeyBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveApplicationKeyInfoListener.class);
+
+    @Autowired
+    private IApplicationKeyServiceDao applicationKeyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_APPLICATION_KEY;
+    }
+
+    /**
+     * 保存钥匙申请信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessApplicationKey 节点
+        if (data.containsKey("businessApplicationKey")) {
+            Object bObj = data.get("businessApplicationKey");
+            JSONArray businessApplicationKeys = null;
+            if (bObj instanceof JSONObject) {
+                businessApplicationKeys = new JSONArray();
+                businessApplicationKeys.add(bObj);
+            } else {
+                businessApplicationKeys = (JSONArray) bObj;
+            }
+            //JSONObject businessApplicationKey = data.getJSONObject("businessApplicationKey");
+            for (int bApplicationKeyIndex = 0; bApplicationKeyIndex < businessApplicationKeys.size(); bApplicationKeyIndex++) {
+                JSONObject businessApplicationKey = businessApplicationKeys.getJSONObject(bApplicationKeyIndex);
+                doBusinessApplicationKey(business, businessApplicationKey);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("applicationKeyId", businessApplicationKey.getString("applicationKeyId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessApplicationKeyInfo = applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo(info);
+        if (businessApplicationKeyInfo != null && businessApplicationKeyInfo.size() > 0) {
+            reFreshShareColumn(info, businessApplicationKeyInfo.get(0));
+            applicationKeyServiceDaoImpl.saveApplicationKeyInfoInstance(info);
+            if (businessApplicationKeyInfo.size() == 1) {
+                dataFlowContext.addParamOut("applicationKeyId", businessApplicationKeyInfo.get(0).get("application_key_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("communityId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("community_id")) {
+            return;
+        }
+
+        info.put("communityId", businessInfo.get("community_id"));
+    }
+
+    /**
+     * 撤单
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId", bId);
+        paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID);
+        //钥匙申请信息
+        List<Map> applicationKeyInfo = applicationKeyServiceDaoImpl.getApplicationKeyInfo(info);
+        if (applicationKeyInfo != null && applicationKeyInfo.size() > 0) {
+            reFreshShareColumn(paramIn, applicationKeyInfo.get(0));
+            applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessApplicationKey 节点
+     *
+     * @param business               总的数据节点
+     * @param businessApplicationKey 钥匙申请节点
+     */
+    private void doBusinessApplicationKey(Business business, JSONObject businessApplicationKey) {
+
+        Assert.jsonObjectHaveKey(businessApplicationKey, "applicationKeyId", "businessApplicationKey 节点下没有包含 applicationKeyId 节点");
+
+        if (businessApplicationKey.getString("applicationKeyId").startsWith("-")) {
+            //刷新缓存
+            //flushApplicationKeyId(business.getDatas());
+
+            businessApplicationKey.put("applicationKeyId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_applicationKeyId));
+
+        }
+
+        businessApplicationKey.put("bId", business.getbId());
+        businessApplicationKey.put("operate", StatusConstant.OPERATE_ADD);
+        //保存钥匙申请信息
+        applicationKeyServiceDaoImpl.saveBusinessApplicationKeyInfo(businessApplicationKey);
+
+    }
+
+    public IApplicationKeyServiceDao getApplicationKeyServiceDaoImpl() {
+        return applicationKeyServiceDaoImpl;
+    }
+
+    public void setApplicationKeyServiceDaoImpl(IApplicationKeyServiceDao applicationKeyServiceDaoImpl) {
+        this.applicationKeyServiceDaoImpl = applicationKeyServiceDaoImpl;
+    }
+}

+ 190 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/listener/applicationKey/UpdateApplicationKeyInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.hardwareAdapation.listener.applicationKey;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.Business;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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、businessApplicationKey:{} 钥匙申请基本信息节点
+ * 2、businessApplicationKeyAttr:[{}] 钥匙申请属性信息节点
+ * 3、businessApplicationKeyPhoto:[{}] 钥匙申请照片信息节点
+ * 4、businessApplicationKeyCerdentials:[{}] 钥匙申请证件信息节点
+ * 协议地址 :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("updateApplicationKeyInfoListener")
+@Transactional
+public class UpdateApplicationKeyInfoListener extends AbstractApplicationKeyBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateApplicationKeyInfoListener.class);
+    @Autowired
+    private IApplicationKeyServiceDao applicationKeyServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_APPLICATION_KEY;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessApplicationKey 节点
+        if (data.containsKey("businessApplicationKey")) {
+            //处理 businessApplicationKey 节点
+            if (data.containsKey("businessApplicationKey")) {
+                Object _obj = data.get("businessApplicationKey");
+                JSONArray businessApplicationKeys = null;
+                if (_obj instanceof JSONObject) {
+                    businessApplicationKeys = new JSONArray();
+                    businessApplicationKeys.add(_obj);
+                } else {
+                    businessApplicationKeys = (JSONArray) _obj;
+                }
+                //JSONObject businessApplicationKey = data.getJSONObject("businessApplicationKey");
+                for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeys.size(); _applicationKeyIndex++) {
+                    JSONObject businessApplicationKey = businessApplicationKeys.getJSONObject(_applicationKeyIndex);
+                    doBusinessApplicationKey(business, businessApplicationKey);
+                    if (_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("applicationKeyId", businessApplicationKey.getString("applicationKeyId"));
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 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> businessApplicationKeyInfos = applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo(info);
+        if (businessApplicationKeyInfos != null && businessApplicationKeyInfos.size() > 0) {
+            for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeyInfos.size(); _applicationKeyIndex++) {
+                Map businessApplicationKeyInfo = businessApplicationKeyInfos.get(_applicationKeyIndex);
+                flushBusinessApplicationKeyInfo(businessApplicationKeyInfo, StatusConstant.STATUS_CD_VALID);
+                applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance(businessApplicationKeyInfo);
+                if (businessApplicationKeyInfo.size() == 1) {
+                    dataFlowContext.addParamOut("applicationKeyId", businessApplicationKeyInfo.get("application_key_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> applicationKeyInfo = applicationKeyServiceDaoImpl.getApplicationKeyInfo(info);
+        if (applicationKeyInfo != null && applicationKeyInfo.size() > 0) {
+
+            //钥匙申请信息
+            List<Map> businessApplicationKeyInfos = applicationKeyServiceDaoImpl.getBusinessApplicationKeyInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessApplicationKeyInfos == null || businessApplicationKeyInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(applicationKey),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _applicationKeyIndex = 0; _applicationKeyIndex < businessApplicationKeyInfos.size(); _applicationKeyIndex++) {
+                Map businessApplicationKeyInfo = businessApplicationKeyInfos.get(_applicationKeyIndex);
+                flushBusinessApplicationKeyInfo(businessApplicationKeyInfo, StatusConstant.STATUS_CD_VALID);
+                applicationKeyServiceDaoImpl.updateApplicationKeyInfoInstance(businessApplicationKeyInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessApplicationKey 节点
+     *
+     * @param business               总的数据节点
+     * @param businessApplicationKey 钥匙申请节点
+     */
+    private void doBusinessApplicationKey(Business business, JSONObject businessApplicationKey) {
+
+        Assert.jsonObjectHaveKey(businessApplicationKey, "applicationKeyId", "businessApplicationKey 节点下没有包含 applicationKeyId 节点");
+
+        if (businessApplicationKey.getString("applicationKeyId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "applicationKeyId 错误,不能自动生成(必须已经存在的applicationKeyId)" + businessApplicationKey);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessApplicationKey(business, businessApplicationKey);
+
+        businessApplicationKey.put("bId", business.getbId());
+        businessApplicationKey.put("operate", StatusConstant.OPERATE_ADD);
+        //保存钥匙申请信息
+        applicationKeyServiceDaoImpl.saveBusinessApplicationKeyInfo(businessApplicationKey);
+
+    }
+
+
+    public IApplicationKeyServiceDao getApplicationKeyServiceDaoImpl() {
+        return applicationKeyServiceDaoImpl;
+    }
+
+    public void setApplicationKeyServiceDaoImpl(IApplicationKeyServiceDao applicationKeyServiceDaoImpl) {
+        this.applicationKeyServiceDaoImpl = applicationKeyServiceDaoImpl;
+    }
+
+
+}

+ 71 - 0
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/smo/impl/ApplicationKeyInnerServiceSMOImpl.java

@@ -0,0 +1,71 @@
+package com.java110.hardwareAdapation.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.hardwareAdapation.IApplicationKeyInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.hardwareAdapation.ApplicationKeyDto;
+import com.java110.hardwareAdapation.dao.IApplicationKeyServiceDao;
+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 ApplicationKeyInnerServiceSMOImpl extends BaseServiceSMO implements IApplicationKeyInnerServiceSMO {
+
+    @Autowired
+    private IApplicationKeyServiceDao applicationKeyServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<ApplicationKeyDto> queryApplicationKeys(@RequestBody ApplicationKeyDto applicationKeyDto) {
+
+        //校验是否传了 分页信息
+
+        int page = applicationKeyDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            applicationKeyDto.setPage((page - 1) * applicationKeyDto.getRow());
+        }
+
+        List<ApplicationKeyDto> applicationKeys = BeanConvertUtil.covertBeanList(applicationKeyServiceDaoImpl.getApplicationKeyInfo(BeanConvertUtil.beanCovertMap(applicationKeyDto)), ApplicationKeyDto.class);
+
+        return applicationKeys;
+    }
+
+
+    @Override
+    public int queryApplicationKeysCount(@RequestBody ApplicationKeyDto applicationKeyDto) {
+        return applicationKeyServiceDaoImpl.queryApplicationKeysCount(BeanConvertUtil.beanCovertMap(applicationKeyDto));
+    }
+
+    public IApplicationKeyServiceDao getApplicationKeyServiceDaoImpl() {
+        return applicationKeyServiceDaoImpl;
+    }
+
+    public void setApplicationKeyServiceDaoImpl(IApplicationKeyServiceDao applicationKeyServiceDaoImpl) {
+        this.applicationKeyServiceDaoImpl = applicationKeyServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 11 - 4
WebService/src/main/resources/components/ownerPackage/audit-applicationKey-manage/auditApplicationKeyManage.html

@@ -27,8 +27,12 @@
                         </div>
                         <div class="col-sm-4">
                             <div class="form-group">
-                                <input type="number" placeholder="请输入用户类型"
-                                       v-model="auditApplicationKeyManageInfo.conditions.typeCd" class=" form-control">
+                                <select class="custom-select" v-model="auditApplicationKeyManageInfo.conditions.typeCd">
+                                    <option selected value="">请选择审核状态</option>
+                                    <option value="10001">审核完成</option>
+                                    <option value="10002">未审核</option>
+                                    <option value="10003">审核拒绝</option>
+                                </select>
                             </div>
                         </div>
 
@@ -42,8 +46,11 @@
                     <div class="row" v-if="auditApplicationKeyManageInfo.moreCondition == true">
                         <div class="col-sm-4">
                             <div class="form-group">
-                                <input type="number" placeholder="请输入用户类型"
-                                       v-model="auditApplicationKeyManageInfo.conditions.typeCd" class=" form-control">
+                                <select class="custom-select" v-model="auditApplicationKeyManageInfo.conditions.typeCd">
+                                    <option selected value="">请选择报修类型</option>
+                                    <option value="10001">保洁</option>
+                                    <option value="10002">保安</option>
+                                </select>
                             </div>
                         </div>
                         <div class="col-sm-4">

+ 114 - 0
docs/document/services/machine/DeleteApplicationKeyInfo.md

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

+ 134 - 0
docs/document/services/machine/SaveApplicationKeyInfo.md

@@ -0,0 +1,134 @@
+
+
+**1\. 保存钥匙申请**
+###### 接口功能
+> API服务做保存钥匙申请时调用该接口
+
+###### URL
+> [http://applicationKey-service/applicationKeyApi/service](http://applicationKey-service/applicationKeyApi/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|businessApplicationKeyInfo|1|Object|-|小区成员|小区成员|
+|businessApplicationKeyInfo|applicationKeyId|1|String|30|-|-|
+|businessApplicationKeyInfo|idCard|1|String|30|-|-|
+|businessApplicationKeyInfo|sex|1|String|30|-|-|
+|businessApplicationKeyInfo|entTime|1|String|30|-|-|
+|businessApplicationKeyInfo|machineId|1|String|30|-|-|
+|businessApplicationKeyInfo|typeCd|1|String|30|-|-|
+|businessApplicationKeyInfo|name|1|String|30|-|-|
+|businessApplicationKeyInfo|tel|1|String|30|-|-|
+|businessApplicationKeyInfo|startTime|1|String|30|-|-|
+|businessApplicationKeyInfo|state|1|String|30|-|-|
+|businessApplicationKeyInfo|age|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://applicationKey-service/applicationKeyApi/service](http://applicationKey-service/applicationKeyApi/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": "240200030001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessApplicationKeyInfo": {
+                "applicationKeyId":"填写具体值",
+        "idCard":"填写具体值",
+        "sex":"填写具体值",
+        "entTime":"填写具体值",
+        "machineId":"填写具体值",
+        "typeCd":"填写具体值",
+        "name":"填写具体值",
+        "tel":"填写具体值",
+        "startTime":"填写具体值",
+        "state":"填写具体值",
+        "age":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 134 - 0
docs/document/services/machine/UpdateApplicationKeyInfo.md

@@ -0,0 +1,134 @@
+
+
+**1\. 修改钥匙申请**
+###### 接口功能
+> API服务做修改钥匙申请时调用该接口
+
+###### URL
+> [http://applicationKey-service/applicationKeyApi/service](http://applicationKey-service/applicationKeyApi/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|businessApplicationKeyInfo|1|Object|-|小区成员|小区成员|
+|businessApplicationKeyInfo|applicationKeyId|1|String|30|-|-|
+|businessApplicationKeyInfo|idCard|1|String|30|-|-|
+|businessApplicationKeyInfo|sex|1|String|30|-|-|
+|businessApplicationKeyInfo|entTime|1|String|30|-|-|
+|businessApplicationKeyInfo|machineId|1|String|30|-|-|
+|businessApplicationKeyInfo|typeCd|1|String|30|-|-|
+|businessApplicationKeyInfo|name|1|String|30|-|-|
+|businessApplicationKeyInfo|tel|1|String|30|-|-|
+|businessApplicationKeyInfo|startTime|1|String|30|-|-|
+|businessApplicationKeyInfo|state|1|String|30|-|-|
+|businessApplicationKeyInfo|age|1|String|30|-|-|
+
+
+###### 返回协议
+
+当http返回状态不为200 时请求处理失败 body内容为失败的原因
+
+当http返回状态为200时请求处理成功,body内容为返回内容,
+
+
+
+
+
+###### 举例
+> 地址:[http://applicationKey-service/applicationKeyApi/service](http://applicationKey-service/applicationKeyApi/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": "240200040001",
+    "bId":"1234567892",
+    "remark": "备注",
+    "datas": {
+      "businessApplicationKeyInfo": {
+                "applicationKeyId":"填写具体值",
+        "idCard":"填写具体值",
+        "sex":"填写具体值",
+        "entTime":"填写具体值",
+        "machineId":"填写具体值",
+        "typeCd":"填写具体值",
+        "name":"填写具体值",
+        "tel":"填写具体值",
+        "startTime":"填写具体值",
+        "state":"填写具体值",
+        "age":"填写具体值"
+      }
+    },
+    "attrs": [{
+      "specCd": "配置的字段ID",
+      "value": "具体值"
+    }]
+  }
+}
+
+返回报文:
+ {
+	"orderTypeCd": "D",
+	"response": {
+		"code": "0000",
+		"message": "成功"
+	},
+	"responseTime": "20190418102004",
+	"bId": "202019041810750003",
+	"businessType": "B",
+	"transactionId": "3a5a411ec65a4c3f895935638aa1d2bc",
+	"dataFlowId": "44fde86d39ce46f4b4aab5f6b14f3947"
+}
+
+```

+ 140 - 0
java110-bean/src/main/java/com/java110/dto/hardwareAdapation/ApplicationKeyDto.java

@@ -0,0 +1,140 @@
+package com.java110.dto.hardwareAdapation;
+
+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 ApplicationKeyDto extends PageDto implements Serializable {
+
+    private String applicationKeyId;
+    private String idCard;
+    private String sex;
+    private String entTime;
+    private String machineId;
+    private String typeCd;
+    private String name;
+    private String tel;
+    private String startTime;
+    private String state;
+    private String age;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getApplicationKeyId() {
+        return applicationKeyId;
+    }
+
+    public void setApplicationKeyId(String applicationKeyId) {
+        this.applicationKeyId = applicationKeyId;
+    }
+
+    public String getIdCard() {
+        return idCard;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public String getEntTime() {
+        return entTime;
+    }
+
+    public void setEntTime(String entTime) {
+        this.entTime = entTime;
+    }
+
+    public String getMachineId() {
+        return machineId;
+    }
+
+    public void setMachineId(String machineId) {
+        this.machineId = machineId;
+    }
+
+    public String getTypeCd() {
+        return typeCd;
+    }
+
+    public void setTypeCd(String typeCd) {
+        this.typeCd = typeCd;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTel() {
+        return tel;
+    }
+
+    public void setTel(String tel) {
+        this.tel = tel;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getAge() {
+        return age;
+    }
+
+    public void setAge(String age) {
+        this.age = age;
+    }
+
+
+    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;
+    }
+}

+ 87 - 0
java110-code-generator/src/main/java/com/java110/ApplicationKeyGeneratorApplication.java

@@ -0,0 +1,87 @@
+package com.java110;
+
+
+import com.java110.code.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hello world!
+ */
+public class ApplicationKeyGeneratorApplication {
+
+    protected ApplicationKeyGeneratorApplication() {
+        // prevents calls from subclass
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * 代码生成器 入口方法
+     *  此处生成的mapper文件包含过程表和实例表的sql,所以要求两张表的特殊字段也要写上
+     *   BusinessTypeCd
+     * @param args 参数
+     */
+    public static void main(String[] args) {
+        Data data = new Data();
+        data.setId("applicationKeyId");
+        data.setName("applicationKey");
+        data.setDesc("钥匙申请");
+        data.setShareParam("communityId");
+        data.setShareColumn("community_id");
+        data.setNewBusinessTypeCd("BUSINESS_TYPE_SAVE_APPLICATION_KEY");
+        data.setUpdateBusinessTypeCd("BUSINESS_TYPE_UPDATE_APPLICATION_KEY");
+        data.setDeleteBusinessTypeCd("BUSINESS_TYPE_DELETE_APPLICATION_KEY");
+        data.setNewBusinessTypeCdValue("240200030001");
+        data.setUpdateBusinessTypeCdValue("240200040001");
+        data.setDeleteBusinessTypeCdValue("240200050001");
+        data.setBusinessTableName("business_application_key");
+        data.setTableName("application_key");
+        Map<String, String> param = new HashMap<String, String>();
+        param.put("applicationKeyId", "application_key_id");       //map的key为你自定义的字段名就是驼峰命名法的那个,value为数据库表的字段名
+        param.put("machineId", "machine_id");
+        param.put("typeCd", "type_cd");
+        param.put("name", "name");
+        param.put("tel", "tel");
+        param.put("sex", "sex");
+        param.put("age", "age");
+        param.put("idCard", "id_card");
+        param.put("state", "state");
+        param.put("startTime", "start_time");
+        param.put("entTime", "end_time");
+        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);
+    }
+}

+ 2 - 2
java110-code-generator/src/main/resources/web/template_1.json

@@ -1,7 +1,7 @@
 {
   "templateName":"开门记录",
-  "templateCode":"machineRecord",
-  "templateKey":"machineRecordId",
+  "templateCode":"applicationKey",
+  "templateKey":"applicationKeyId",
   "templateKeyName":"开门记录ID",
   "searchCode": "name",
   "searchName": "名称",

+ 125 - 0
java110-code-generator/src/main/resources/web/template_machineRecord.json

@@ -0,0 +1,125 @@
+{
+  "templateName":"开门记录",
+  "templateCode":"machineRecord",
+  "templateKey":"machineRecordId",
+  "templateKeyName":"开门记录ID",
+  "searchCode": "name",
+  "searchName": "名称",
+  "conditions": [
+    {
+      "name": "用户名称",
+      "inputType": "input",
+      "code": "name",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "开门方式",
+      "inputType": "select",
+      "code": "openTypeCd",
+      "selectValue":"1000,2000",
+      "selectValueName":"人脸开门,钥匙开门",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "用户手机",
+      "inputType": "input",
+      "code": "tel",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "用户类型",
+      "inputType": "select",
+      "code": "ownerTypeCd",
+      "selectValue":"1001,1002",
+      "selectValueName":"业主,业主成员",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "设备名称",
+      "inputType": "input",
+      "code": "machineName",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "设备编码",
+      "inputType": "input",
+      "code": "machineCode",
+      "whereCondition": "equal"
+    }
+  ],
+  "columns":[
+    {
+      "code":"machineCode",
+      "cnCode":"设备编码",
+      "desc":"必填,请填写设备编码",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType":"input",
+      "limit":"maxin",
+      "limitParam":"1,30",
+      "limitErrInfo":"设备编码不能超过30位",
+      "show": true
+    },
+    {
+      "code": "machineId",
+      "cnCode":"设备ID",
+      "desc":"必填,请填写设备版本号",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"num",
+      "limitParam":"1,30",
+      "limitErrInfo":"设备ID不能超过30位",
+      "show": true
+    },
+    {
+      "code": "name",
+      "cnCode":"用户名称",
+      "desc":"必填,请选择用户名称",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"对象类型格式错误",
+      "show": true
+    },
+    {
+      "code": "openTypeCd",
+      "cnCode":"开门方式",
+      "desc":"必填,请选择开门方式",
+      "required":true,
+      "hasDefaultValue":false,
+      "selectValue":"1000,2000",
+      "selectValueName":"人脸开门,钥匙开门",
+      "limit":"1,200",
+      "limitParam":"",
+      "limitErrInfo":"开门方式不能超过200位",
+      "show": true
+    },
+    {
+      "code":"tel",
+      "cnCode":"用户手机号",
+      "desc":"必填,请填写用户手机号",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType":"input",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"用户手机号必须为数字",
+      "show": true
+    },
+    {
+      "code": "idCard",
+      "cnCode":"身份证",
+      "desc":"必填,请填写身份证",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"idCard",
+      "limitParam":"",
+      "limitErrInfo":"身份证格式错误",
+      "show": true
+    }
+  ]
+}

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

@@ -104,6 +104,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_machineTranslateId = "90";
     public static final String CODE_PREFIX_fileRelId = "91";
     public static final String CODE_PREFIX_machineRecordId = "92";
+    public static final String CODE_PREFIX_applicationKeyId = "93";
 
 
     /**

+ 41 - 0
java110-core/src/main/java/com/java110/core/smo/hardwareAdapation/IApplicationKeyInnerServiceSMO.java

@@ -0,0 +1,41 @@
+package com.java110.core.smo.hardwareAdapation;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.hardwareAdapation.ApplicationKeyDto;
+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 IApplicationKeyInnerServiceSMO
+ * @Description 钥匙申请接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "hardwareAdapation-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/applicationKeyApi")
+public interface IApplicationKeyInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param applicationKeyDto 数据对象分享
+     * @return ApplicationKeyDto 对象数据
+     */
+    @RequestMapping(value = "/queryApplicationKeys", method = RequestMethod.POST)
+    List<ApplicationKeyDto> queryApplicationKeys(@RequestBody ApplicationKeyDto applicationKeyDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param applicationKeyDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryApplicationKeysCount", method = RequestMethod.POST)
+    int queryApplicationKeysCount(@RequestBody ApplicationKeyDto applicationKeyDto);
+}

+ 37 - 0
java110-db/db/HardwareAdapationService/create_machine_app_key.sql

@@ -0,0 +1,37 @@
+-- 硬件数据同步
+create table business_application_key(
+  application_key_id varchar(30) not null comment '申请ID',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  machine_id varchar(30) not null comment '设备ID',
+  type_cd varchar(12) not null comment '类型,10001 保洁 10002 保安 10003 其他人员,详情查看t_dict表',
+  name varchar(64) not null comment '申请人名称',
+  tel varchar(12) not null comment '申请人手机号码',
+  sex varchar(12) not null comment '申请人男女  0男 1女',
+  age int not null comment '申请人年龄',
+  id_card varchar(12) not null comment '申请人身份证号',
+  community_id varchar(30) not null comment '小区ID',
+  state varchar(8) not null comment '状态,10002 未审核,10001 完成审核 10003 审核拒绝',
+  start_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始时间',
+  end_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  operate VARCHAR(4) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL'
+);
+-- 数据同步
+create table application_key(
+  application_key_id varchar(30) not null comment '申请ID',
+  b_id VARCHAR(30) NOT NULL COMMENT '业务Id',
+  machine_id varchar(30) not null comment '设备ID',
+  type_cd varchar(12) not null comment '类型,10001 保洁 10002 保安 10003 其他人员,详情查看t_dict表',
+  name varchar(64) not null comment '申请人名称',
+  tel varchar(12) not null comment '申请人手机号码',
+  sex varchar(2) not null comment '申请人男女 0男 1女',
+  age int not null comment '申请人年龄',
+  id_card varchar(12) not null comment '申请人身份证号',
+  community_id varchar(30) not null comment '小区ID',
+  state varchar(8) not null comment '状态,10002 未审核,10001 完成审核 10003 审核拒绝',
+  start_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始时间',
+  end_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  status_cd VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',
+  UNIQUE KEY (application_key_id)
+);

+ 261 - 0
java110-db/src/main/resources/mapper/hardwareAdapation/ApplicationKeyServiceDaoImplMapper.xml

@@ -0,0 +1,261 @@
+<?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="applicationKeyServiceDaoImpl">
+
+    <!-- 保存钥匙申请信息 add by wuxw 2018-07-03 -->
+       <insert id="saveBusinessApplicationKeyInfo" parameterType="Map">
+           insert into business_application_key(
+application_key_id,id_card,sex,end_time,machine_id,operate,type_cd,name,tel,start_time,state,b_id,age
+) values (
+#{applicationKeyId},#{idCard},#{sex},#{entTime},#{machineId},#{operate},#{typeCd},#{name},#{tel},#{startTime},#{state},#{bId},#{age}
+)
+       </insert>
+
+
+       <!-- 查询钥匙申请信息(Business) add by wuxw 2018-07-03 -->
+       <select id="getBusinessApplicationKeyInfo" parameterType="Map" resultType="Map">
+           select  t.application_key_id,t.application_key_id applicationKeyId,t.id_card,t.id_card idCard,t.sex,t.end_time,t.end_time entTime,t.machine_id,t.machine_id machineId,t.operate,t.type_cd,t.type_cd typeCd,t.name,t.tel,t.start_time,t.start_time startTime,t.state,t.b_id,t.b_id bId,t.age 
+from business_application_key t 
+where 1 =1 
+<if test="applicationKeyId !=null and applicationKeyId != ''">
+   and t.application_key_id= #{applicationKeyId}
+</if> 
+<if test="idCard !=null and idCard != ''">
+   and t.id_card= #{idCard}
+</if> 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="entTime !=null and entTime != ''">
+   and t.end_time= #{entTime}
+</if> 
+<if test="machineId !=null and machineId != ''">
+   and t.machine_id= #{machineId}
+</if> 
+<if test="operate !=null and operate != ''">
+   and t.operate= #{operate}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="tel !=null and tel != ''">
+   and t.tel= #{tel}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+       </select>
+
+
+
+
+
+    <!-- 保存钥匙申请信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveApplicationKeyInfoInstance" parameterType="Map">
+        insert into application_key(
+application_key_id,id_card,sex,status_cd,end_time,machine_id,type_cd,name,tel,start_time,state,b_id,age
+) select t.application_key_id,t.id_card,t.sex,'0',t.end_time,t.machine_id,t.type_cd,t.name,t.tel,t.start_time,t.state,t.b_id,t.age from business_application_key t where 1=1
+<if test="applicationKeyId !=null and applicationKeyId != ''">
+   and t.application_key_id= #{applicationKeyId}
+</if> 
+<if test="idCard !=null and idCard != ''">
+   and t.id_card= #{idCard}
+</if> 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="entTime !=null and entTime != ''">
+   and t.end_time= #{entTime}
+</if> 
+<if test="machineId !=null and machineId != ''">
+   and t.machine_id= #{machineId}
+</if> 
+   and t.operate= 'ADD'
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="tel !=null and tel != ''">
+   and t.tel= #{tel}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+    </insert>
+
+
+
+    <!-- 查询钥匙申请信息 add by wuxw 2018-07-03 -->
+    <select id="getApplicationKeyInfo" parameterType="Map" resultType="Map">
+        select  t.application_key_id,t.application_key_id applicationKeyId,t.id_card,t.id_card idCard,t.sex,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time entTime,t.machine_id,t.machine_id machineId,t.type_cd,t.type_cd typeCd,t.name,t.tel,t.start_time,t.start_time startTime,t.state,t.b_id,t.b_id bId,t.age 
+from application_key t 
+where 1 =1 
+<if test="applicationKeyId !=null and applicationKeyId != ''">
+   and t.application_key_id= #{applicationKeyId}
+</if> 
+<if test="idCard !=null and idCard != ''">
+   and t.id_card= #{idCard}
+</if> 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="entTime !=null and entTime != ''">
+   and t.end_time= #{entTime}
+</if> 
+<if test="machineId !=null and machineId != ''">
+   and t.machine_id= #{machineId}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="tel !=null and tel != ''">
+   and t.tel= #{tel}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改钥匙申请信息 add by wuxw 2018-07-03 -->
+    <update id="updateApplicationKeyInfoInstance" parameterType="Map">
+        update  application_key t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="idCard !=null and idCard != ''">
+, t.id_card= #{idCard}
+</if> 
+<if test="sex !=null and sex != ''">
+, t.sex= #{sex}
+</if> 
+<if test="entTime !=null and entTime != ''">
+, t.end_time= #{entTime}
+</if> 
+<if test="machineId !=null and machineId != ''">
+, t.machine_id= #{machineId}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+, t.type_cd= #{typeCd}
+</if> 
+<if test="name !=null and name != ''">
+, t.name= #{name}
+</if> 
+<if test="tel !=null and tel != ''">
+, t.tel= #{tel}
+</if> 
+<if test="startTime !=null and startTime != ''">
+, t.start_time= #{startTime}
+</if> 
+<if test="state !=null and state != ''">
+, t.state= #{state}
+</if> 
+<if test="age !=null and age != ''">
+, t.age= #{age}
+</if> 
+ where 1=1 <if test="applicationKeyId !=null and applicationKeyId != ''">
+and t.application_key_id= #{applicationKeyId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询钥匙申请数量 add by wuxw 2018-07-03 -->
+     <select id="queryApplicationKeysCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from application_key t 
+where 1 =1 
+<if test="applicationKeyId !=null and applicationKeyId != ''">
+   and t.application_key_id= #{applicationKeyId}
+</if> 
+<if test="idCard !=null and idCard != ''">
+   and t.id_card= #{idCard}
+</if> 
+<if test="sex !=null and sex != ''">
+   and t.sex= #{sex}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="entTime !=null and entTime != ''">
+   and t.end_time= #{entTime}
+</if> 
+<if test="machineId !=null and machineId != ''">
+   and t.machine_id= #{machineId}
+</if> 
+<if test="typeCd !=null and typeCd != ''">
+   and t.type_cd= #{typeCd}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="tel !=null and tel != ''">
+   and t.tel= #{tel}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="age !=null and age != ''">
+   and t.age= #{age}
+</if> 
+
+
+     </select>
+
+</mapper>

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

@@ -641,4 +641,19 @@ public class BusinessTypeConstant {
      */
     public static final String BUSINESS_TYPE_DELETE_MACHINE_RECORD ="230200050001";
 
+    /**
+     *  保存 文件保存关系
+     * 14开头  3保存
+     */
+    public static final String BUSINESS_TYPE_SAVE_APPLICATION_KEY="240200030001";
+
+    /**
+     * 修改 文件保存关系
+     */
+    public static final String BUSINESS_TYPE_UPDATE_APPLICATION_KEY="240200040001";
+    /**
+     *  删除 文件保存关系
+     */
+    public static final String BUSINESS_TYPE_DELETE_APPLICATION_KEY ="240200050001";
+
 }