Browse Source

加入物联网上报功能

java110 5 years ago
parent
commit
5e0d835fcf

+ 45 - 0
docs/api/machine.md

@@ -0,0 +1,45 @@
+# 设备接口类
+
+## 说明
+
+文档说明设备相关接口协议
+
+## 远程开门
+
+## 设备重启
+
+## 人脸开门记录上报
+
+## 物联网指令执行结果反馈(当和物联网系统异步交互时有效)
+
+说明:当和物联网系统异步交互时 或者物联网系统采用mqtt 协议时,执行结果 需要异步方式上报,需要物联网系统配置地址
+
+请求方式: POST
+
+请求地址:/api/machine/cmdResult
+
+请求参数:
+
+| 名称 | 类型 | 是否必填 | 示例值 | 描述 |
+| :----:| :----: | :----: | :----: | :----: |
+| taskId | String | 是 | 702020042194860037 | 任务ID,第三方系统调用结果时传递 |
+| code | Integer | 是 | 0 | 指令执行状态码 0 成功 其他失败 |
+| msg | String | 是 | 成功 | 指令执行说明 |
+
+请求示例:
+```json
+{
+    "taskId": "702020042194860037",
+    "code": 0,
+    "msg": "成功"
+}
+```
+
+返回示例:
+```json
+{
+    "code":0,
+    "msg":"成功",
+    "data":""
+}
+```

+ 0 - 175
docs/document/services/payFeeDetailDiscount/DeletePayFeeDetailDiscountInfo.md

@@ -1,175 +0,0 @@
-package com.java110.fee.listener.payFeeDetailDiscount;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.BusinessTypeConstant;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.constant.StatusConstant;
-import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.fee.dao.IPayFeeDetailDiscountServiceDao;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 删除缴费优惠信息 侦听
- *
- * 处理节点
- * 1、businessPayFeeDetailDiscount:{} 缴费优惠基本信息节点
- * 2、businessPayFeeDetailDiscountAttr:[{}] 缴费优惠属性信息节点
- * 3、businessPayFeeDetailDiscountPhoto:[{}] 缴费优惠照片信息节点
- * 4、businessPayFeeDetailDiscountCerdentials:[{}] 缴费优惠证件信息节点
- * 协议地址 :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("deletePayFeeDetailDiscountInfoListener")
-@Transactional
-public class DeletePayFeeDetailDiscountInfoListener extends AbstractPayFeeDetailDiscountBusinessServiceDataFlowListener {
-
-    private final static Logger logger = LoggerFactory.getLogger(DeletePayFeeDetailDiscountInfoListener.class);
-    @Autowired
-    IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl;
-
-    @Override
-    public int getOrder() {
-        return 3;
-    }
-
-    @Override
-    public String getBusinessTypeCd() {
-        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_DETAIL_DISCOUNT_INFO;
-    }
-
-    /**
-     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
-     * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
-     */
-    @Override
-    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
-        JSONObject data = business.getDatas();
-
-        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
-
-            //处理 businessPayFeeDetailDiscount 节点
-            if(data.containsKey(PayFeeDetailDiscountPo.class.getSimpleName())){
-                Object _obj = data.get(PayFeeDetailDiscountPo.class.getSimpleName());
-                JSONArray businessPayFeeDetailDiscounts = null;
-                if(_obj instanceof JSONObject){
-                    businessPayFeeDetailDiscounts = new JSONArray();
-                    businessPayFeeDetailDiscounts.add(_obj);
-                }else {
-                    businessPayFeeDetailDiscounts = (JSONArray)_obj;
-                }
-                //JSONObject businessPayFeeDetailDiscount = data.getJSONObject(PayFeeDetailDiscountPo.class.getSimpleName());
-                for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscounts.size();_payFeeDetailDiscountIndex++) {
-                    JSONObject businessPayFeeDetailDiscount = businessPayFeeDetailDiscounts.getJSONObject(_payFeeDetailDiscountIndex);
-                    doBusinessPayFeeDetailDiscount(business, businessPayFeeDetailDiscount);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("detailDiscountId", businessPayFeeDetailDiscount.getString("detailDiscountId"));
-                    }
-                }
-
-        }
-
-
-    }
-
-    /**
-     * 删除 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> businessPayFeeDetailDiscountInfos = payFeeDetailDiscountServiceDaoImpl.getBusinessPayFeeDetailDiscountInfo(info);
-        if( businessPayFeeDetailDiscountInfos != null && businessPayFeeDetailDiscountInfos.size() >0) {
-            for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscountInfos.size();_payFeeDetailDiscountIndex++) {
-                Map businessPayFeeDetailDiscountInfo = businessPayFeeDetailDiscountInfos.get(_payFeeDetailDiscountIndex);
-                flushBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscountInfo,StatusConstant.STATUS_CD_INVALID);
-                payFeeDetailDiscountServiceDaoImpl.updatePayFeeDetailDiscountInfoInstance(businessPayFeeDetailDiscountInfo);
-                dataFlowContext.addParamOut("detailDiscountId",businessPayFeeDetailDiscountInfo.get("detail_discount_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> payFeeDetailDiscountInfo = payFeeDetailDiscountServiceDaoImpl.getPayFeeDetailDiscountInfo(info);
-        if(payFeeDetailDiscountInfo != null && payFeeDetailDiscountInfo.size() > 0){
-
-            //缴费优惠信息
-            List<Map> businessPayFeeDetailDiscountInfos = payFeeDetailDiscountServiceDaoImpl.getBusinessPayFeeDetailDiscountInfo(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPayFeeDetailDiscountInfos == null ||  businessPayFeeDetailDiscountInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(payFeeDetailDiscount),程序内部异常,请检查! "+delInfo);
-            }
-            for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscountInfos.size();_payFeeDetailDiscountIndex++) {
-                Map businessPayFeeDetailDiscountInfo = businessPayFeeDetailDiscountInfos.get(_payFeeDetailDiscountIndex);
-                flushBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscountInfo,StatusConstant.STATUS_CD_VALID);
-                payFeeDetailDiscountServiceDaoImpl.updatePayFeeDetailDiscountInfoInstance(businessPayFeeDetailDiscountInfo);
-            }
-        }
-    }
-
-
-
-    /**
-     * 处理 businessPayFeeDetailDiscount 节点
-     * @param business 总的数据节点
-     * @param businessPayFeeDetailDiscount 缴费优惠节点
-     */
-    private void doBusinessPayFeeDetailDiscount(Business business,JSONObject businessPayFeeDetailDiscount){
-
-        Assert.jsonObjectHaveKey(businessPayFeeDetailDiscount,"detailDiscountId","businessPayFeeDetailDiscount 节点下没有包含 detailDiscountId 节点");
-
-        if(businessPayFeeDetailDiscount.getString("detailDiscountId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"detailDiscountId 错误,不能自动生成(必须已经存在的detailDiscountId)"+businessPayFeeDetailDiscount);
-        }
-        //自动插入DEL
-        autoSaveDelBusinessPayFeeDetailDiscount(business,businessPayFeeDetailDiscount);
-    }
-    @Override
-    public IPayFeeDetailDiscountServiceDao getPayFeeDetailDiscountServiceDaoImpl() {
-        return payFeeDetailDiscountServiceDaoImpl;
-    }
-
-    public void setPayFeeDetailDiscountServiceDaoImpl(IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl) {
-        this.payFeeDetailDiscountServiceDaoImpl = payFeeDetailDiscountServiceDaoImpl;
-    }
-}

+ 0 - 175
docs/document/services/payFeeDetailDiscount/SavePayFeeDetailDiscountInfo.md

@@ -1,175 +0,0 @@
-package com.java110.fee.listener.payFeeDetailDiscount;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.BusinessTypeConstant;
-import com.java110.utils.constant.StatusConstant;
-import com.java110.utils.util.Assert;
-import com.java110.fee.dao.IPayFeeDetailDiscountServiceDao;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.entity.center.Business;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 保存 缴费优惠信息 侦听
- * Created by wuxw on 2018/5/18.
- */
-@Java110Listener("savePayFeeDetailDiscountInfoListener")
-@Transactional
-public class SavePayFeeDetailDiscountInfoListener extends AbstractPayFeeDetailDiscountBusinessServiceDataFlowListener{
-
-    private static Logger logger = LoggerFactory.getLogger(SavePayFeeDetailDiscountInfoListener.class);
-
-    @Autowired
-    private IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl;
-
-    @Override
-    public int getOrder() {
-        return 0;
-    }
-
-    @Override
-    public String getBusinessTypeCd() {
-        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_DETAIL_DISCOUNT_INFO;
-    }
-
-    /**
-     * 保存缴费优惠信息 business 表中
-     * @param dataFlowContext 数据对象
-     * @param business 当前业务对象
-     */
-    @Override
-    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
-        JSONObject data = business.getDatas();
-        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
-
-        //处理 businessPayFeeDetailDiscount 节点
-        if(data.containsKey(PayFeeDetailDiscountPo.class.getSimpleName())){
-            Object bObj = data.get(PayFeeDetailDiscountPo.class.getSimpleName());
-            JSONArray businessPayFeeDetailDiscounts = null;
-            if(bObj instanceof JSONObject){
-                businessPayFeeDetailDiscounts = new JSONArray();
-                businessPayFeeDetailDiscounts.add(bObj);
-            }else {
-                businessPayFeeDetailDiscounts = (JSONArray)bObj;
-            }
-            //JSONObject businessPayFeeDetailDiscount = data.getJSONObject(PayFeeDetailDiscountPo.class.getSimpleName());
-            for (int bPayFeeDetailDiscountIndex = 0; bPayFeeDetailDiscountIndex < businessPayFeeDetailDiscounts.size();bPayFeeDetailDiscountIndex++) {
-                JSONObject businessPayFeeDetailDiscount = businessPayFeeDetailDiscounts.getJSONObject(bPayFeeDetailDiscountIndex);
-                doBusinessPayFeeDetailDiscount(business, businessPayFeeDetailDiscount);
-                if(bObj instanceof JSONObject) {
-                    dataFlowContext.addParamOut("detailDiscountId", businessPayFeeDetailDiscount.getString("detailDiscountId"));
-                }
-            }
-        }
-    }
-
-    /**
-     * 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> businessPayFeeDetailDiscountInfo = payFeeDetailDiscountServiceDaoImpl.getBusinessPayFeeDetailDiscountInfo(info);
-        if( businessPayFeeDetailDiscountInfo != null && businessPayFeeDetailDiscountInfo.size() >0) {
-            reFreshShareColumn(info, businessPayFeeDetailDiscountInfo.get(0));
-            payFeeDetailDiscountServiceDaoImpl.savePayFeeDetailDiscountInfoInstance(info);
-            if(businessPayFeeDetailDiscountInfo.size() == 1) {
-                dataFlowContext.addParamOut("detailDiscountId", businessPayFeeDetailDiscountInfo.get(0).get("detail_discount_id"));
-            }
-        }
-    }
-
-
-    /**
-     * 刷 分片字段
-     *
-     * @param info         查询对象
-     * @param businessInfo 小区ID
-     */
-    private void reFreshShareColumn(Map info, Map businessInfo) {
-
-        if (info.containsKey("community_id")) {
-            return;
-        }
-
-        if (!businessInfo.containsKey("communityId")) {
-            return;
-        }
-
-        info.put("community_id", businessInfo.get("communityId"));
-    }
-    /**
-     * 撤单
-     * @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> payFeeDetailDiscountInfo = payFeeDetailDiscountServiceDaoImpl.getPayFeeDetailDiscountInfo(info);
-        if(payFeeDetailDiscountInfo != null && payFeeDetailDiscountInfo.size() > 0){
-            reFreshShareColumn(paramIn, payFeeDetailDiscountInfo.get(0));
-            payFeeDetailDiscountServiceDaoImpl.updatePayFeeDetailDiscountInfoInstance(paramIn);
-        }
-    }
-
-
-
-    /**
-     * 处理 businessPayFeeDetailDiscount 节点
-     * @param business 总的数据节点
-     * @param businessPayFeeDetailDiscount 缴费优惠节点
-     */
-    private void doBusinessPayFeeDetailDiscount(Business business,JSONObject businessPayFeeDetailDiscount){
-
-        Assert.jsonObjectHaveKey(businessPayFeeDetailDiscount,"detailDiscountId","businessPayFeeDetailDiscount 节点下没有包含 detailDiscountId 节点");
-
-        if(businessPayFeeDetailDiscount.getString("detailDiscountId").startsWith("-")){
-            //刷新缓存
-            //flushPayFeeDetailDiscountId(business.getDatas());
-
-            businessPayFeeDetailDiscount.put("detailDiscountId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailDiscountId));
-
-        }
-
-        businessPayFeeDetailDiscount.put("bId",business.getbId());
-        businessPayFeeDetailDiscount.put("operate", StatusConstant.OPERATE_ADD);
-        //保存缴费优惠信息
-        payFeeDetailDiscountServiceDaoImpl.saveBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscount);
-
-    }
-    @Override
-    public IPayFeeDetailDiscountServiceDao getPayFeeDetailDiscountServiceDaoImpl() {
-        return payFeeDetailDiscountServiceDaoImpl;
-    }
-
-    public void setPayFeeDetailDiscountServiceDaoImpl(IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl) {
-        this.payFeeDetailDiscountServiceDaoImpl = payFeeDetailDiscountServiceDaoImpl;
-    }
-}

+ 0 - 188
docs/document/services/payFeeDetailDiscount/UpdatePayFeeDetailDiscountInfo.md

@@ -1,188 +0,0 @@
-package com.java110.fee.listener.payFeeDetailDiscount;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.BusinessTypeConstant;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.constant.StatusConstant;
-import com.java110.utils.exception.ListenerExecuteException;
-import com.java110.utils.util.Assert;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.entity.center.Business;
-import com.java110.fee.dao.IPayFeeDetailDiscountServiceDao;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 修改缴费优惠信息 侦听
- *
- * 处理节点
- * 1、businessPayFeeDetailDiscount:{} 缴费优惠基本信息节点
- * 2、businessPayFeeDetailDiscountAttr:[{}] 缴费优惠属性信息节点
- * 3、businessPayFeeDetailDiscountPhoto:[{}] 缴费优惠照片信息节点
- * 4、businessPayFeeDetailDiscountCerdentials:[{}] 缴费优惠证件信息节点
- * 协议地址 :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("updatePayFeeDetailDiscountInfoListener")
-@Transactional
-public class UpdatePayFeeDetailDiscountInfoListener extends AbstractPayFeeDetailDiscountBusinessServiceDataFlowListener {
-
-    private static Logger logger = LoggerFactory.getLogger(UpdatePayFeeDetailDiscountInfoListener.class);
-    @Autowired
-    private IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl;
-
-    @Override
-    public int getOrder() {
-        return 2;
-    }
-
-    @Override
-    public String getBusinessTypeCd() {
-        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_DETAIL_DISCOUNT_INFO;
-    }
-
-    /**
-     * business过程
-     * @param dataFlowContext 上下文对象
-     * @param business 业务对象
-     */
-    @Override
-    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
-
-        JSONObject data = business.getDatas();
-
-        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
-
-
-            //处理 businessPayFeeDetailDiscount 节点
-            if(data.containsKey(PayFeeDetailDiscountPo.class.getSimpleName())){
-                Object _obj = data.get(PayFeeDetailDiscountPo.class.getSimpleName());
-                JSONArray businessPayFeeDetailDiscounts = null;
-                if(_obj instanceof JSONObject){
-                    businessPayFeeDetailDiscounts = new JSONArray();
-                    businessPayFeeDetailDiscounts.add(_obj);
-                }else {
-                    businessPayFeeDetailDiscounts = (JSONArray)_obj;
-                }
-                //JSONObject businessPayFeeDetailDiscount = data.getJSONObject(PayFeeDetailDiscountPo.class.getSimpleName());
-                for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscounts.size();_payFeeDetailDiscountIndex++) {
-                    JSONObject businessPayFeeDetailDiscount = businessPayFeeDetailDiscounts.getJSONObject(_payFeeDetailDiscountIndex);
-                    doBusinessPayFeeDetailDiscount(business, businessPayFeeDetailDiscount);
-                    if(_obj instanceof JSONObject) {
-                        dataFlowContext.addParamOut("detailDiscountId", businessPayFeeDetailDiscount.getString("detailDiscountId"));
-                    }
-                }
-            }
-    }
-
-
-    /**
-     * 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> businessPayFeeDetailDiscountInfos = payFeeDetailDiscountServiceDaoImpl.getBusinessPayFeeDetailDiscountInfo(info);
-        if( businessPayFeeDetailDiscountInfos != null && businessPayFeeDetailDiscountInfos.size() >0) {
-            for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscountInfos.size();_payFeeDetailDiscountIndex++) {
-                Map businessPayFeeDetailDiscountInfo = businessPayFeeDetailDiscountInfos.get(_payFeeDetailDiscountIndex);
-                flushBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscountInfo,StatusConstant.STATUS_CD_VALID);
-                payFeeDetailDiscountServiceDaoImpl.updatePayFeeDetailDiscountInfoInstance(businessPayFeeDetailDiscountInfo);
-                if(businessPayFeeDetailDiscountInfo.size() == 1) {
-                    dataFlowContext.addParamOut("detailDiscountId", businessPayFeeDetailDiscountInfo.get("detail_discount_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> payFeeDetailDiscountInfo = payFeeDetailDiscountServiceDaoImpl.getPayFeeDetailDiscountInfo(info);
-        if(payFeeDetailDiscountInfo != null && payFeeDetailDiscountInfo.size() > 0){
-
-            //缴费优惠信息
-            List<Map> businessPayFeeDetailDiscountInfos = payFeeDetailDiscountServiceDaoImpl.getBusinessPayFeeDetailDiscountInfo(delInfo);
-            //除非程序出错了,这里不会为空
-            if(businessPayFeeDetailDiscountInfos == null || businessPayFeeDetailDiscountInfos.size() == 0){
-                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(payFeeDetailDiscount),程序内部异常,请检查! "+delInfo);
-            }
-            for (int _payFeeDetailDiscountIndex = 0; _payFeeDetailDiscountIndex < businessPayFeeDetailDiscountInfos.size();_payFeeDetailDiscountIndex++) {
-                Map businessPayFeeDetailDiscountInfo = businessPayFeeDetailDiscountInfos.get(_payFeeDetailDiscountIndex);
-                flushBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscountInfo,StatusConstant.STATUS_CD_VALID);
-                payFeeDetailDiscountServiceDaoImpl.updatePayFeeDetailDiscountInfoInstance(businessPayFeeDetailDiscountInfo);
-            }
-        }
-
-    }
-
-
-
-    /**
-     * 处理 businessPayFeeDetailDiscount 节点
-     * @param business 总的数据节点
-     * @param businessPayFeeDetailDiscount 缴费优惠节点
-     */
-    private void doBusinessPayFeeDetailDiscount(Business business,JSONObject businessPayFeeDetailDiscount){
-
-        Assert.jsonObjectHaveKey(businessPayFeeDetailDiscount,"detailDiscountId","businessPayFeeDetailDiscount 节点下没有包含 detailDiscountId 节点");
-
-        if(businessPayFeeDetailDiscount.getString("detailDiscountId").startsWith("-")){
-            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"detailDiscountId 错误,不能自动生成(必须已经存在的detailDiscountId)"+businessPayFeeDetailDiscount);
-        }
-        //自动保存DEL
-        autoSaveDelBusinessPayFeeDetailDiscount(business,businessPayFeeDetailDiscount);
-
-        businessPayFeeDetailDiscount.put("bId",business.getbId());
-        businessPayFeeDetailDiscount.put("operate", StatusConstant.OPERATE_ADD);
-        //保存缴费优惠信息
-        payFeeDetailDiscountServiceDaoImpl.saveBusinessPayFeeDetailDiscountInfo(businessPayFeeDetailDiscount);
-
-    }
-
-
-
-    @Override
-    public IPayFeeDetailDiscountServiceDao getPayFeeDetailDiscountServiceDaoImpl() {
-        return payFeeDetailDiscountServiceDaoImpl;
-    }
-
-    public void setPayFeeDetailDiscountServiceDaoImpl(IPayFeeDetailDiscountServiceDao payFeeDetailDiscountServiceDaoImpl) {
-        this.payFeeDetailDiscountServiceDaoImpl = payFeeDetailDiscountServiceDaoImpl;
-    }
-
-
-
-}

+ 9 - 0
java110-bean/src/main/java/com/java110/po/machine/MachineTranslatePo.java

@@ -20,6 +20,7 @@ public class MachineTranslatePo implements Serializable {
     private String objName;
     private String state;
     private String updateTime;
+    private String remark;
 
 
     public String getMachineTranslateId() {
@@ -93,4 +94,12 @@ public class MachineTranslatePo implements Serializable {
     public void setUpdateTime(String updateTime) {
         this.updateTime = updateTime;
     }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 }

+ 32 - 2
service-common/src/main/java/com/java110/common/api/MachineApi.java

@@ -2,9 +2,11 @@ package com.java110.common.api;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.common.bmo.machine.IMachineOpenDoorBMO;
-import com.java110.common.bmo.machineRecord.ISaveMachineRecordBMO;
+import com.java110.common.bmo.machine.ISaveMachineRecordBMO;
+import com.java110.common.bmo.machine.IUpdateMachineTransactionStateBMO;
 import com.java110.common.bmo.machineTranslateError.IGetMachineTranslateErrorBMO;
 import com.java110.dto.machine.MachineRecordDto;
+import com.java110.dto.machine.MachineTranslateDto;
 import com.java110.dto.machineTranslateError.MachineTranslateErrorDto;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -17,7 +19,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-
+/**
+ * 设备相关接口类
+ * <p>
+ * add by 吴学文 2020-12-28
+ */
 @RestController
 @RequestMapping(value = "/machine")
 public class MachineApi {
@@ -32,6 +38,9 @@ public class MachineApi {
     @Autowired
     private ISaveMachineRecordBMO saveMachineRecordBMOImpl;
 
+    @Autowired
+    private IUpdateMachineTransactionStateBMO updateMachineTransactionStateBMOImpl;
+
     /**
      * 设备开门功能
      *
@@ -128,4 +137,25 @@ public class MachineApi {
         return saveMachineRecordBMOImpl.saveRecord(machineRecordDto);
     }
 
+    /**
+     * 物联网系统指令执行情况
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /machine/cmdResult
+     * @path /app/machine/cmdResult
+     */
+    @RequestMapping(value = "/cmdResult", method = RequestMethod.POST)
+    public ResponseEntity<String> cmdResult(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "taskId", "未包含任务信息");
+        Assert.hasKeyAndValue(reqJson, "code", "未包含结果编码");
+        Assert.hasKeyAndValue(reqJson, "msg", "未包含结果说明");
+        MachineTranslateDto machineRecordDto = new MachineTranslateDto();
+        machineRecordDto.setMachineTranslateId(reqJson.getString("taskId"));
+        machineRecordDto.setState(reqJson.getIntValue("code") == 0
+                ? MachineTranslateDto.STATE_SUCCESS : MachineTranslateDto.STATE_ERROR);
+        machineRecordDto.setRemark(reqJson.getString("msg"));
+        return updateMachineTransactionStateBMOImpl.update(machineRecordDto);
+    }
+
 }

+ 1 - 1
service-common/src/main/java/com/java110/common/bmo/machineRecord/ISaveMachineRecordBMO.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.java110.common.bmo.machineRecord;
+package com.java110.common.bmo.machine;
 
 import com.java110.dto.machine.MachineRecordDto;
 import com.java110.po.machine.MachineRecordPo;

+ 37 - 0
service-common/src/main/java/com/java110/common/bmo/machine/IUpdateMachineTransactionStateBMO.java

@@ -0,0 +1,37 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.bmo.machine;
+
+import com.java110.dto.machine.MachineTranslateDto;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 修改状态
+ * <p>
+ * add by wuxw 2020-12-27
+ * <p>
+ * 协议:https://gitee.com/java110/MicroCommunityThings/blob/master/back/docs/api.md
+ */
+public interface IUpdateMachineTransactionStateBMO {
+
+    /**
+     * 修改指令执行情况
+     *
+     * @param machineTranslateDto
+     * @return
+     */
+    ResponseEntity<String> update(MachineTranslateDto machineTranslateDto);
+}

+ 2 - 2
service-common/src/main/java/com/java110/common/bmo/machineRecord/impl/SaveMachineRecordBMOImpl.java

@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.java110.common.bmo.machineRecord.impl;
+package com.java110.common.bmo.machine.impl;
 
-import com.java110.common.bmo.machineRecord.ISaveMachineRecordBMO;
+import com.java110.common.bmo.machine.ISaveMachineRecordBMO;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.file.FileDto;
 import com.java110.dto.machine.MachineRecordDto;

+ 61 - 0
service-common/src/main/java/com/java110/common/bmo/machine/impl/UpdateMachineTransactionStateBMOImpl.java

@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.common.bmo.machine.impl;
+
+import com.java110.common.bmo.machine.ISaveMachineRecordBMO;
+import com.java110.common.bmo.machine.IUpdateMachineTransactionStateBMO;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.file.FileDto;
+import com.java110.dto.machine.MachineRecordDto;
+import com.java110.dto.machine.MachineTranslateDto;
+import com.java110.intf.common.IFileInnerServiceSMO;
+import com.java110.intf.common.IFileRelInnerServiceSMO;
+import com.java110.intf.common.IMachineRecordInnerServiceSMO;
+import com.java110.intf.common.IMachineTranslateInnerServiceSMO;
+import com.java110.po.file.FileRelPo;
+import com.java110.po.machine.MachineRecordPo;
+import com.java110.po.machine.MachineTranslatePo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 保存 开门记录
+ *
+ * @desc add by 吴学文 17:37
+ */
+@Service
+public class UpdateMachineTransactionStateBMOImpl implements IUpdateMachineTransactionStateBMO {
+
+
+    @Autowired
+    private IMachineTranslateInnerServiceSMO machineTranslateInnerServiceSMOImpl;
+
+    @Override
+    public ResponseEntity<String> update(MachineTranslateDto machineTranslateDto) {
+        int count = machineTranslateInnerServiceSMOImpl.updateMachineTranslateState(machineTranslateDto);
+        if (count > 0) {
+            return ResultVo.success();
+        }
+        return ResultVo.error("上传记录失败");
+    }
+}