Pārlūkot izejas kodu

加入 微信属性表

java110 5 gadi atpakaļ
vecāks
revīzija
38f306a6b0
26 mainītis faili ar 2192 papildinājumiem un 34 dzēšanām
  1. 175 0
      docs/document/services/smallWechatAttr/DeleteSmallWechatAttrInfo.md
  2. 175 0
      docs/document/services/smallWechatAttr/SaveSmallWechatAttrInfo.md
  3. 188 0
      docs/document/services/smallWechatAttr/UpdateSmallWechatAttrInfo.md
  4. 2 0
      java110-bean/src/main/java/com/java110/dto/smallWeChat/SmallWeChatDto.java
  5. 98 0
      java110-bean/src/main/java/com/java110/dto/smallWechatAttr/SmallWechatAttrDto.java
  6. 46 0
      java110-bean/src/main/java/com/java110/po/smallWechatAttr/SmallWechatAttrPo.java
  7. 42 0
      java110-core/src/main/java/com/java110/core/smo/smallWechatAttr/ISmallWechatAttrInnerServiceSMO.java
  8. 10 10
      java110-db/src/main/resources/mapper/store/SmallWeChatServiceDaoImplMapper.xml
  9. 173 0
      java110-db/src/main/resources/mapper/store/SmallWechatAttrServiceDaoImplMapper.xml
  10. 20 20
      java110-generator/src/main/resources/back/template_1.json
  11. 6 1
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  12. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeSmallWechatAttrConstant.java
  13. 38 0
      service-api/src/main/java/com/java110/api/bmo/smallWeChat/ISmallWechatAttrBMO.java
  14. 1 1
      service-api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWeChatBMOImpl.java
  15. 62 0
      service-api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWechatAttrBMOImpl.java
  16. 82 0
      service-api/src/main/java/com/java110/api/listener/smallWeChat/ListSmallWechatAttrsListener.java
  17. 31 0
      service-api/src/main/java/com/java110/api/listener/smallWeChat/SaveSmallWeChatListener.java
  18. 49 0
      service-api/src/main/java/com/java110/api/listener/smallWeChat/UpdateSmallWechatAttrListener.java
  19. 81 0
      service-store/src/main/java/com/java110/store/dao/ISmallWechatAttrServiceDao.java
  20. 130 0
      service-store/src/main/java/com/java110/store/dao/impl/SmallWechatAttrServiceDaoImpl.java
  21. 2 2
      service-store/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWeChatBusinessServiceDataFlowListener.java
  22. 88 0
      service-store/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWechatAttrBusinessServiceDataFlowListener.java
  23. 180 0
      service-store/src/main/java/com/java110/store/listener/smallWeChat/DeleteSmallWechatAttrInfoListener.java
  24. 181 0
      service-store/src/main/java/com/java110/store/listener/smallWeChat/SaveSmallWechatAttrInfoListener.java
  25. 190 0
      service-store/src/main/java/com/java110/store/listener/smallWeChat/UpdateSmallWechatAttrInfoListener.java
  26. 111 0
      service-store/src/main/java/com/java110/store/smo/impl/SmallWechatAttrInnerServiceSMOImpl.java

+ 175 - 0
docs/document/services/smallWechatAttr/DeleteSmallWechatAttrInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.smallWechatAttr;
+
+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.store.dao.ISmallWechatAttrServiceDao;
+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、businessSmallWechatAttr:{} 微信属性基本信息节点
+ * 2、businessSmallWechatAttrAttr:[{}] 微信属性属性信息节点
+ * 3、businessSmallWechatAttrPhoto:[{}] 微信属性照片信息节点
+ * 4、businessSmallWechatAttrCerdentials:[{}] 微信属性证件信息节点
+ * 协议地址 :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("deleteSmallWechatAttrInfoListener")
+@Transactional
+public class DeleteSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteSmallWechatAttrInfoListener.class);
+    @Autowired
+    ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+            //处理 businessSmallWechatAttr 节点
+            if(data.containsKey(SmallWechatAttrPo.class.getSimpleName())){
+                Object _obj = data.get(SmallWechatAttrPo.class.getSimpleName());
+                JSONArray businessSmallWechatAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessSmallWechatAttrs = new JSONArray();
+                    businessSmallWechatAttrs.add(_obj);
+                }else {
+                    businessSmallWechatAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+                for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrs.size();_smallWechatAttrIndex++) {
+                    JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(_smallWechatAttrIndex);
+                    doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                    }
+                }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 instance数据
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+
+        //微信属性信息
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_DEL);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if( businessSmallWechatAttrInfos != null && businessSmallWechatAttrInfos.size() >0) {
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size();_smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo,StatusConstant.STATUS_CD_INVALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+                dataFlowContext.addParamOut("attrId",businessSmallWechatAttrInfo.get("attr_id"));
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+
+        Map delInfo = new HashMap();
+        delInfo.put("bId",business.getbId());
+        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if(smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0){
+
+            //微信属性信息
+            List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessSmallWechatAttrInfos == null ||  businessSmallWechatAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(smallWechatAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size();_smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo,StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+            }
+        }
+    }
+
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     * @param business 总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business,JSONObject businessSmallWechatAttr){
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr,"attrId","businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if(businessSmallWechatAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessSmallWechatAttr);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessSmallWechatAttr(business,businessSmallWechatAttr);
+    }
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+}

+ 175 - 0
docs/document/services/smallWechatAttr/SaveSmallWechatAttrInfo.md

@@ -0,0 +1,175 @@
+package com.java110.store.listener.smallWechatAttr;
+
+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.store.dao.ISmallWechatAttrServiceDao;
+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("saveSmallWechatAttrInfoListener")
+@Transactional
+public class SaveSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener{
+
+    private static Logger logger = LoggerFactory.getLogger(SaveSmallWechatAttrInfoListener.class);
+
+    @Autowired
+    private ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * 保存微信属性信息 business 表中
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessSmallWechatAttr 节点
+        if(data.containsKey(SmallWechatAttrPo.class.getSimpleName())){
+            Object bObj = data.get(SmallWechatAttrPo.class.getSimpleName());
+            JSONArray businessSmallWechatAttrs = null;
+            if(bObj instanceof JSONObject){
+                businessSmallWechatAttrs = new JSONArray();
+                businessSmallWechatAttrs.add(bObj);
+            }else {
+                businessSmallWechatAttrs = (JSONArray)bObj;
+            }
+            //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+            for (int bSmallWechatAttrIndex = 0; bSmallWechatAttrIndex < businessSmallWechatAttrs.size();bSmallWechatAttrIndex++) {
+                JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(bSmallWechatAttrIndex);
+                doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                if(bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if( businessSmallWechatAttrInfo != null && businessSmallWechatAttrInfo.size() >0) {
+            reFreshShareColumn(info, businessSmallWechatAttrInfo.get(0));
+            smallWechatAttrServiceDaoImpl.saveSmallWechatAttrInfoInstance(info);
+            if(businessSmallWechatAttrInfo.size() == 1) {
+                dataFlowContext.addParamOut("attrId", businessSmallWechatAttrInfo.get(0).get("attr_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("communityId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("community_id")) {
+            return;
+        }
+
+        info.put("communityId", businessInfo.get("community_id"));
+    }
+    /**
+     * 撤单
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId",bId);
+        paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if(smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0){
+            reFreshShareColumn(paramIn, smallWechatAttrInfo.get(0));
+            smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(paramIn);
+        }
+    }
+
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     * @param business 总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business,JSONObject businessSmallWechatAttr){
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr,"attrId","businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if(businessSmallWechatAttr.getString("attrId").startsWith("-")){
+            //刷新缓存
+            //flushSmallWechatAttrId(business.getDatas());
+
+            businessSmallWechatAttr.put("attrId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+
+        }
+
+        businessSmallWechatAttr.put("bId",business.getbId());
+        businessSmallWechatAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存微信属性信息
+        smallWechatAttrServiceDaoImpl.saveBusinessSmallWechatAttrInfo(businessSmallWechatAttr);
+
+    }
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+}

+ 188 - 0
docs/document/services/smallWechatAttr/UpdateSmallWechatAttrInfo.md

@@ -0,0 +1,188 @@
+package com.java110.store.listener.smallWechatAttr;
+
+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.store.dao.ISmallWechatAttrServiceDao;
+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、businessSmallWechatAttr:{} 微信属性基本信息节点
+ * 2、businessSmallWechatAttrAttr:[{}] 微信属性属性信息节点
+ * 3、businessSmallWechatAttrPhoto:[{}] 微信属性照片信息节点
+ * 4、businessSmallWechatAttrCerdentials:[{}] 微信属性证件信息节点
+ * 协议地址 :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("updateSmallWechatAttrInfoListener")
+@Transactional
+public class UpdateSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateSmallWechatAttrInfoListener.class);
+    @Autowired
+    private ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * business过程
+     * @param dataFlowContext 上下文对象
+     * @param business 业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理");
+
+
+            //处理 businessSmallWechatAttr 节点
+            if(data.containsKey(SmallWechatAttrPo.class.getSimpleName())){
+                Object _obj = data.get(SmallWechatAttrPo.class.getSimpleName());
+                JSONArray businessSmallWechatAttrs = null;
+                if(_obj instanceof JSONObject){
+                    businessSmallWechatAttrs = new JSONArray();
+                    businessSmallWechatAttrs.add(_obj);
+                }else {
+                    businessSmallWechatAttrs = (JSONArray)_obj;
+                }
+                //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+                for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrs.size();_smallWechatAttrIndex++) {
+                    JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(_smallWechatAttrIndex);
+                    doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                    if(_obj instanceof JSONObject) {
+                        dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                    }
+                }
+            }
+    }
+
+
+    /**
+     * business to instance 过程
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId",business.getbId());
+        info.put("operate",StatusConstant.OPERATE_ADD);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if( businessSmallWechatAttrInfos != null && businessSmallWechatAttrInfos.size() >0) {
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size();_smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo,StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+                if(businessSmallWechatAttrInfo.size() == 1) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttrInfo.get("attr_id"));
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * @param dataFlowContext 数据对象
+     * @param business 当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId",bId);
+        info.put("statusCd",StatusConstant.STATUS_CD_VALID);
+        Map delInfo = new HashMap();
+        delInfo.put("bId",business.getbId());
+        delInfo.put("operate",StatusConstant.OPERATE_DEL);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if(smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0){
+
+            //微信属性信息
+            List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if(businessSmallWechatAttrInfos == null || businessSmallWechatAttrInfos.size() == 0){
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(smallWechatAttr),程序内部异常,请检查! "+delInfo);
+            }
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size();_smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo,StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+            }
+        }
+
+    }
+
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     * @param business 总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business,JSONObject businessSmallWechatAttr){
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr,"attrId","businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if(businessSmallWechatAttr.getString("attrId").startsWith("-")){
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"attrId 错误,不能自动生成(必须已经存在的attrId)"+businessSmallWechatAttr);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessSmallWechatAttr(business,businessSmallWechatAttr);
+
+        businessSmallWechatAttr.put("bId",business.getbId());
+        businessSmallWechatAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存微信属性信息
+        smallWechatAttrServiceDaoImpl.saveBusinessSmallWechatAttrInfo(businessSmallWechatAttr);
+
+    }
+
+
+
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+
+
+
+}

+ 2 - 0
java110-bean/src/main/java/com/java110/dto/smallWeChat/SmallWeChatDto.java

@@ -15,6 +15,8 @@ import java.util.Date;
  **/
 public class SmallWeChatDto extends PageDto implements Serializable {
 
+    public static final String WECHAT_TYPE_PUBLIC = "1100"; // 公众号
+
     private Date createTime;
     private String appId;
     private String name;

+ 98 - 0
java110-bean/src/main/java/com/java110/dto/smallWechatAttr/SmallWechatAttrDto.java

@@ -0,0 +1,98 @@
+package com.java110.dto.smallWechatAttr;
+
+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 SmallWechatAttrDto extends PageDto implements Serializable {
+
+    public static final String SPEC_CD_TOKEN = "33001";//token
+    public static final String SPEC_CD_OWE_FEE_TEMPLATE = "33002";//欠费推送模板
+
+    private String attrId;
+    private String wechatId;
+    private String specCd;
+    private String specCdName;
+    private String communityId;
+    private String value;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAttrId() {
+        return attrId;
+    }
+
+    public void setAttrId(String attrId) {
+        this.attrId = attrId;
+    }
+
+    public String getWechatId() {
+        return wechatId;
+    }
+
+    public void setWechatId(String wechatId) {
+        this.wechatId = wechatId;
+    }
+
+    public String getSpecCd() {
+        return specCd;
+    }
+
+    public void setSpecCd(String specCd) {
+        this.specCd = specCd;
+    }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+
+    public 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;
+    }
+
+    public String getSpecCdName() {
+        return specCdName;
+    }
+
+    public void setSpecCdName(String specCdName) {
+        this.specCdName = specCdName;
+    }
+}

+ 46 - 0
java110-bean/src/main/java/com/java110/po/smallWechatAttr/SmallWechatAttrPo.java

@@ -0,0 +1,46 @@
+package com.java110.po.smallWechatAttr;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class SmallWechatAttrPo implements Serializable {
+
+    private String attrId;
+private String wechatId;
+private String specCd;
+private String communityId;
+private String value;
+public String getAttrId() {
+        return attrId;
+    }
+public void setAttrId(String attrId) {
+        this.attrId = attrId;
+    }
+public String getWechatId() {
+        return wechatId;
+    }
+public void setWechatId(String wechatId) {
+        this.wechatId = wechatId;
+    }
+public String getSpecCd() {
+        return specCd;
+    }
+public void setSpecCd(String specCd) {
+        this.specCd = specCd;
+    }
+public String getCommunityId() {
+        return communityId;
+    }
+public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+public String getValue() {
+        return value;
+    }
+public void setValue(String value) {
+        this.value = value;
+    }
+
+
+
+}

+ 42 - 0
java110-core/src/main/java/com/java110/core/smo/smallWechatAttr/ISmallWechatAttrInnerServiceSMO.java

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

+ 10 - 10
java110-db/src/main/resources/mapper/store/SmallWeChatServiceDaoImplMapper.xml

@@ -8,7 +8,7 @@
     <insert id="saveBusinessSmallWeChatInfo" parameterType="Map">
         insert into
             buiness_small_wechat
-            (operate,appId,name,appSecret,weChat_id,b_id,store_Id,pay_password,remarks,obj_id,obj_type,mch_id,wechat_type)
+            (operate,appId,name,appSecret,wechat_id,b_id,store_Id,pay_password,remarks,obj_id,obj_type,mch_id,wechat_type)
         values
             (#{operate},#{appId},#{name},#{appSecret},#{weChatId},#{bId},#{storeId},#{payPassword},#{remarks},#{objId},#{objType},#{mchId},#{weChatType})
        </insert>
@@ -22,7 +22,7 @@
             t.appId,
             t.name,
             t.appSecret,
-            t.weChat_id,t.weChat_id weChatId,
+            t.wechat_id,t.wechat_id weChatId,
             t.b_id,t.b_id bId,
             t.store_Id,t.store_Id storeId,
             t.pay_password,t.pay_password payPassword,
@@ -53,7 +53,7 @@
             and t.appSecret= #{appSecret}
         </if>
         <if test="weChatId !=null and weChatId != ''">
-            and t.weChat_id= #{weChatId}
+            and t.wechat_id= #{weChatId}
         </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -75,10 +75,10 @@
     <insert id="saveSmallWeChatInfoInstance" parameterType="Map">
         insert into
             small_wechat
-                (create_time,appId,name,appSecret,status_cd,weChat_id,b_id,store_Id,pay_password,remarks,obj_id,obj_type,mch_id,wechat_type)
+                (create_time,appId,name,appSecret,status_cd,wechat_id,b_id,store_Id,pay_password,remarks,obj_id,obj_type,mch_id,wechat_type)
                 select
                     t.create_time,t.appId,t.name,t.appSecret,'0',
-                    t.weChat_id,t.b_id,t.store_Id,t.pay_password,t.remarks,t.obj_id,t.obj_type,t.mch_id,t.wechat_type
+                    t.wechat_id,t.b_id,t.store_Id,t.pay_password,t.remarks,t.obj_id,t.obj_type,t.mch_id,t.wechat_type
                 from buiness_small_wechat t where 1=1 and t.operate= 'ADD'
         <if test="createTime !=null and createTime != ''">
             and t.create_time= #{createTime}
@@ -93,7 +93,7 @@
             and t.appSecret= #{appSecret}
         </if>
         <if test="weChatId !=null and weChatId != ''">
-            and t.weChat_id= #{weChatId}
+            and t.wechat_id= #{weChatId}
         </if>
         <if test="weChatType !=null and weChatType != ''">
             and t.wechat_type= #{weChatType}
@@ -122,7 +122,7 @@
             t.name,
             t.appSecret,
             t.status_cd,t.status_cd statusCd,
-            t.weChat_id,t.weChat_id weChatId,
+            t.wechat_id,t.wechat_id weChatId,
             t.b_id,t.b_id bId,
             t.store_Id,t.store_Id storeId,
             t.pay_password,t.pay_password payPassword,
@@ -153,7 +153,7 @@
             and t.wechat_type= #{weChatType}
         </if>
         <if test="weChatId !=null and weChatId != ''">
-            and t.weChat_id= #{weChatId}
+            and t.wechat_id= #{weChatId}
         </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -213,7 +213,7 @@
         </if>
         where 1=1
         <if test="weChatId !=null and weChatId != ''">
-            and t.weChat_id= #{weChatId}
+            and t.wechat_id= #{weChatId}
         </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
@@ -245,7 +245,7 @@
             and t.status_cd= #{statusCd}
         </if>
         <if test="weChatId !=null and weChatId != ''">
-            and t.weChat_id= #{weChatId}
+            and t.wechat_id= #{weChatId}
         </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}

+ 173 - 0
java110-db/src/main/resources/mapper/store/SmallWechatAttrServiceDaoImplMapper.xml

@@ -0,0 +1,173 @@
+<?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="smallWechatAttrServiceDaoImpl">
+
+    <!-- 保存微信属性信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessSmallWechatAttrInfo" parameterType="Map">
+        insert into business_small_wechat_attr(
+        attr_id,operate,wechat_id,spec_cd,b_id,community_id,value
+        ) values (
+        #{attrId},#{operate},#{wechatId},#{specCd},#{bId},#{communityId},#{value}
+        )
+    </insert>
+
+
+    <!-- 查询微信属性信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessSmallWechatAttrInfo" parameterType="Map" resultType="Map">
+        select t.attr_id,t.attr_id attrId,t.operate,t.wechat_id,t.wechat_id wechatId,t.spec_cd,t.spec_cd
+        specCd,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.value
+        from business_small_wechat_attr t
+        where 1 =1
+        <if test="attrId !=null and attrId != ''">
+            and t.attr_id= #{attrId}
+        </if>
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="wechatId !=null and wechatId != ''">
+            and t.wechat_id= #{wechatId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            and t.spec_cd= #{specCd}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="value !=null and value != ''">
+            and t.value= #{value}
+        </if>
+
+    </select>
+
+
+    <!-- 保存微信属性信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveSmallWechatAttrInfoInstance" parameterType="Map">
+        insert into small_wechat_attr(
+        attr_id,wechat_id,spec_cd,status_cd,b_id,community_id,value
+        ) select t.attr_id,t.wechat_id,t.spec_cd,'0',t.b_id,t.community_id,t.value from business_small_wechat_attr t
+        where 1=1
+        <if test="attrId !=null and attrId != ''">
+            and t.attr_id= #{attrId}
+        </if>
+        and t.operate= 'ADD'
+        <if test="wechatId !=null and wechatId != ''">
+            and t.wechat_id= #{wechatId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            and t.spec_cd= #{specCd}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="value !=null and value != ''">
+            and t.value= #{value}
+        </if>
+
+    </insert>
+
+
+    <!-- 查询微信属性信息 add by wuxw 2018-07-03 -->
+    <select id="getSmallWechatAttrInfo" parameterType="Map" resultType="Map">
+        select t.attr_id,t.attr_id attrId,t.wechat_id,t.wechat_id wechatId,t.spec_cd,t.spec_cd
+        specCd,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.value,
+        d.name specCdName
+        from small_wechat_attr t
+        left join t_dict d on t.spec_cd = d.status_cd and d.table_name = 'small_wechat_attr' and d.table_columns = 'spec_cd'
+        where 1 =1
+        <if test="attrId !=null and attrId != ''">
+            and t.attr_id= #{attrId}
+        </if>
+        <if test="wechatId !=null and wechatId != ''">
+            and t.wechat_id= #{wechatId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            and t.spec_cd= #{specCd}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="value !=null and value != ''">
+            and t.value= #{value}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改微信属性信息 add by wuxw 2018-07-03 -->
+    <update id="updateSmallWechatAttrInfoInstance" parameterType="Map">
+        update small_wechat_attr t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="wechatId !=null and wechatId != ''">
+            , t.wechat_id= #{wechatId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            , t.spec_cd= #{specCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="value !=null and value != ''">
+            , t.value= #{value}
+        </if>
+        where 1=1
+        <if test="attrId !=null and attrId != ''">
+            and t.attr_id= #{attrId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+
+    </update>
+
+    <!-- 查询微信属性数量 add by wuxw 2018-07-03 -->
+    <select id="querySmallWechatAttrsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from small_wechat_attr t
+        left join t_dict d on t.spec_cd = d.status_cd and d.table_name = 'small_wechat_attr' and d.table_columns = 'spec_cd'
+        where 1 =1
+        <if test="attrId !=null and attrId != ''">
+            and t.attr_id= #{attrId}
+        </if>
+        <if test="wechatId !=null and wechatId != ''">
+            and t.wechat_id= #{wechatId}
+        </if>
+        <if test="specCd !=null and specCd != ''">
+            and t.spec_cd= #{specCd}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="value !=null and value != ''">
+            and t.value= #{value}
+        </if>
+
+
+    </select>
+
+</mapper>

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

@@ -1,41 +1,41 @@
 {
   "autoMove": true,
-  "id": "wssId",
-  "name": "workflowStepStaff",
-  "desc": "工作流节点",
+  "id": "attrId",
+  "name": "smallWechatAttr",
+  "desc": "微信属性",
   "shareParam": "communityId",
   "shareColumn": "community_id",
-  "shareName": "common",
-  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_WORKFLOW_STEP_STAFF",
-  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_WORKFLOW_STEP_STAFF",
-  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_WORKFLOW_STEP_STAFF",
-  "newBusinessTypeCdValue": "580300030001",
-  "updateBusinessTypeCdValue": "580300040001",
-  "deleteBusinessTypeCdValue": "580300050001",
-  "businessTableName": "business_workflow_step_staff",
-  "tableName": "workflow_step_staff",
+  "shareName": "store",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_SMALL_WECHAT_ATTR",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_SMALL_WECHAT_ATTR",
+  "newBusinessTypeCdValue": "221200030001",
+  "updateBusinessTypeCdValue": "221200040001",
+  "deleteBusinessTypeCdValue": "221200050001",
+  "businessTableName": "business_small_wechat_attr",
+  "tableName": "small_wechat_attr",
   "param": {
-    "wssId": "wss_id",
-    "stepId": "step_id",
+    "attrId": "attr_id",
+    "wechatId": "wechat_id",
     "bId": "b_id",
-    "staffId": "staff_id",
-    "staffName": "staff_name",
+    "specCd": "spec_cd",
+    "value": "value",
     "communityId": "community_id",
     "statusCd": "status_cd",
     "operate": "operate"
   },
   "required": [
     {
-      "code": "staffId",
-      "msg": "员工不能为空"
+      "code": "specCd",
+      "msg": "规格不能为空"
     },
     {
       "code": "communityId",
       "msg": "小区不能为空"
     },
     {
-      "code": "staffName",
-      "msg": "员工名称不能为空"
+      "code": "value",
+      "msg": "不能为空"
     }
   ]
 }

+ 6 - 1
java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java

@@ -224,7 +224,12 @@ public class BusinessTypeConstant {
     //删除小程序信息
     public static final String BUSINESS_TYPE_DELETE_SMALL_WE_CHAT = "210200080001";
 
-
+    //保存小程序信息
+    public static final String BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR = "221200030001";
+    //修改小程序信息
+    public static final String BUSINESS_TYPE_UPDATE_SMALL_WECHAT_ATTR = "221200040001";
+    //删除小程序信息
+    public static final String BUSINESS_TYPE_DELETE_SMALL_WECHAT_ATTR = "221200050001";
 
 
 

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

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 微信属性常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeSmallWechatAttrConstant {
+
+    /**
+     * 添加 微信属性
+     */
+    public static final String ADD_SMALLWECHATATTR = "smallWechat.saveSmallWechatAttr";
+
+
+    /**
+     * 修改 微信属性
+     */
+    public static final String UPDATE_SMALLWECHATATTR = "smallWechat.updateSmallWechatAttr";
+    /**
+     * 删除 微信属性
+     */
+    public static final String DELETE_SMALLWECHATATTR = "smallWechat.deleteSmallWechatAttr";
+
+
+    /**
+     * 查询 微信属性
+     */
+    public static final String LIST_SMALLWECHATATTRS = "smallWechat.listSmallWechatAttrs";
+
+
+}

+ 38 - 0
service-api/src/main/java/com/java110/api/bmo/smallWeChat/ISmallWechatAttrBMO.java

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

+ 1 - 1
service-api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWeChatBMOImpl.java

@@ -32,7 +32,7 @@ public class SmallWeChatBMOImpl extends ApiBaseBMO implements ISmallWeChatBMO {
 
         JSONObject businessSmallWeChat = new JSONObject();
         businessSmallWeChat.putAll(paramInJson);
-        businessSmallWeChat.put("weChatId", "-1");
+        //businessSmallWeChat.put("weChatId", "-1");
         SmallWechatPo smallWechatPo = BeanConvertUtil.covertBean(businessSmallWeChat, SmallWechatPo.class);
         super.insert(dataFlowContext, smallWechatPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WE_CHAT);
     }

+ 62 - 0
service-api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWechatAttrBMOImpl.java

@@ -0,0 +1,62 @@
+package com.java110.api.bmo.smallWeChat.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.smallWeChat.ISmallWechatAttrBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.smallWechatAttr.ISmallWechatAttrInnerServiceSMO;
+import com.java110.po.smallWechatAttr.SmallWechatAttrPo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service("smallWechatAttrBMOImpl")
+public class SmallWechatAttrBMOImpl extends ApiBaseBMO implements ISmallWechatAttrBMO {
+
+    @Autowired
+    private ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void addSmallWechatAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        paramInJson.put("attrId", "-1");
+        SmallWechatAttrPo smallWechatAttrPo = BeanConvertUtil.covertBean(paramInJson, SmallWechatAttrPo.class);
+        super.insert(dataFlowContext, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR);
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void updateSmallWechatAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        SmallWechatAttrPo smallWechatAttrPo = BeanConvertUtil.covertBean(paramInJson, SmallWechatAttrPo.class);
+        super.update(dataFlowContext, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_SMALL_WECHAT_ATTR);
+    }
+
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public void deleteSmallWechatAttr(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        SmallWechatAttrPo smallWechatAttrPo = BeanConvertUtil.covertBean(paramInJson, SmallWechatAttrPo.class);
+        super.update(dataFlowContext, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_SMALL_WECHAT_ATTR);
+    }
+
+}

+ 82 - 0
service-api/src/main/java/com/java110/api/listener/smallWeChat/ListSmallWechatAttrsListener.java

@@ -0,0 +1,82 @@
+package com.java110.api.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.core.smo.smallWechatAttr.ISmallWechatAttrInnerServiceSMO;
+import com.java110.dto.smallWechatAttr.SmallWechatAttrDto;
+import com.java110.utils.constant.ServiceCodeSmallWechatAttrConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 查询小区侦听类
+ */
+@Java110Listener("listSmallWechatAttrsListener")
+public class ListSmallWechatAttrsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWechatAttrConstant.LIST_SMALLWECHATATTRS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public ISmallWechatAttrInnerServiceSMO getSmallWechatAttrInnerServiceSMOImpl() {
+        return smallWechatAttrInnerServiceSMOImpl;
+    }
+
+    public void setSmallWechatAttrInnerServiceSMOImpl(ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl) {
+        this.smallWechatAttrInnerServiceSMOImpl = smallWechatAttrInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        SmallWechatAttrDto smallWechatAttrDto = BeanConvertUtil.covertBean(reqJson, SmallWechatAttrDto.class);
+
+        int count = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrsCount(smallWechatAttrDto);
+
+        List<SmallWechatAttrDto> smallWechatAttrDtos = null;
+
+        if (count > 0) {
+            smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto);
+        } else {
+            smallWechatAttrDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, smallWechatAttrDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 31 - 0
service-api/src/main/java/com/java110/api/listener/smallWeChat/SaveSmallWeChatListener.java

@@ -6,6 +6,11 @@ import com.java110.api.listener.AbstractServiceApiPlusListener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+import com.java110.dto.smallWechatAttr.SmallWechatAttrDto;
+import com.java110.po.smallWechatAttr.SmallWechatAttrPo;
+import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.ServiceCodeSmallWeChatConstant;
 import com.java110.utils.util.Assert;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,11 +33,37 @@ public class SaveSmallWeChatListener extends AbstractServiceApiPlusListener {
         Assert.hasKeyAndValue(reqJson, "payPassword", "请求报文中未包含payPassword");
         Assert.hasKeyAndValue(reqJson, "weChatType", "请求报文中未包含weChatType");
         Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId(小区id)");
+        Assert.hasKeyAndValue(reqJson, "weChatType", "请求报文中未包含类型");
     }
 
     @Override
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        String wechatId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_weChatId);
+        reqJson.put("weChatId",wechatId);
         smallWeChatBMOImpl.addSmallWeChat(reqJson, context);
+
+        //判断是否为公众号
+
+        if(SmallWeChatDto.WECHAT_TYPE_PUBLIC.equals(reqJson.getString("weChatType"))){
+            //添加 微信对接token
+            SmallWechatAttrPo smallWechatAttrPo = new SmallWechatAttrPo();
+            smallWechatAttrPo.setAttrId("-1");
+            smallWechatAttrPo.setCommunityId(reqJson.getString("objId"));
+            smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_TOKEN);
+            smallWechatAttrPo.setValue("java110");
+            smallWechatAttrPo.setWechatId(wechatId);
+            super.insert(context,smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR);
+
+            //模板ID
+            smallWechatAttrPo = new SmallWechatAttrPo();
+            smallWechatAttrPo.setAttrId("-2");
+            smallWechatAttrPo.setCommunityId(reqJson.getString("objId"));
+            smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_OWE_FEE_TEMPLATE);
+            smallWechatAttrPo.setValue("test");
+            smallWechatAttrPo.setWechatId(wechatId);
+            super.insert(context,smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR);
+
+        }
     }
 
     @Override

+ 49 - 0
service-api/src/main/java/com/java110/api/listener/smallWeChat/UpdateSmallWechatAttrListener.java

@@ -0,0 +1,49 @@
+package com.java110.api.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.smallWeChat.ISmallWechatAttrBMO;
+import com.java110.api.listener.AbstractServiceApiPlusListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeSmallWechatAttrConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+
+
+/**
+ * 保存微信属性侦听
+ * add by wuxw 2019-06-30
+ */
+@Java110Listener("updateSmallWechatAttrListener")
+public class UpdateSmallWechatAttrListener extends AbstractServiceApiPlusListener {
+
+    @Autowired
+    private ISmallWechatAttrBMO smallWechatAttrBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "attrId", "attrId不能为空");
+        Assert.hasKeyAndValue(reqJson, "specCd", "请求报文中未包含specCd");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "value", "请求报文中未包含value");
+
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        smallWechatAttrBMOImpl.updateSmallWechatAttr(reqJson, context);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWechatAttrConstant.UPDATE_SMALLWECHATATTR;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+}

+ 81 - 0
service-store/src/main/java/com/java110/store/dao/ISmallWechatAttrServiceDao.java

@@ -0,0 +1,81 @@
+package com.java110.store.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 ISmallWechatAttrServiceDao {
+
+    /**
+     * 保存 微信属性信息
+     * @param businessSmallWechatAttrInfo 微信属性信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessSmallWechatAttrInfo(Map businessSmallWechatAttrInfo) throws DAOException;
+
+
+
+    /**
+     * 查询微信属性信息(business过程)
+     * 根据bId 查询微信属性信息
+     * @param info bId 信息
+     * @return 微信属性信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessSmallWechatAttrInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 微信属性信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveSmallWechatAttrInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询微信属性信息(instance过程)
+     * 根据bId 查询微信属性信息
+     * @param info bId 信息
+     * @return 微信属性信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getSmallWechatAttrInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改微信属性信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateSmallWechatAttrInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询微信属性总数
+     *
+     * @param info 微信属性信息
+     * @return 微信属性数量
+     */
+    int querySmallWechatAttrsCount(Map info);
+
+}

+ 130 - 0
service-store/src/main/java/com/java110/store/dao/impl/SmallWechatAttrServiceDaoImpl.java

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

+ 2 - 2
service-store/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWeChatBusinessServiceDataFlowListener.java

@@ -42,7 +42,7 @@ public abstract class AbstractSmallWeChatBusinessServiceDataFlowListener extends
         businessSmallWeChatInfo.put("appId", businessSmallWeChatInfo.get("appId"));
         businessSmallWeChatInfo.put("name", businessSmallWeChatInfo.get("name"));
         businessSmallWeChatInfo.put("appSecret", businessSmallWeChatInfo.get("appSecret"));
-        businessSmallWeChatInfo.put("weChatId", businessSmallWeChatInfo.get("weChat_id"));
+        businessSmallWeChatInfo.put("weChatId", businessSmallWeChatInfo.get("wechat_id"));
         businessSmallWeChatInfo.put("storeId", businessSmallWeChatInfo.get("store_Id"));
         businessSmallWeChatInfo.put("payPassword", businessSmallWeChatInfo.get("pay_password"));
         businessSmallWeChatInfo.put("remarks", businessSmallWeChatInfo.get("remarks"));
@@ -74,7 +74,7 @@ public abstract class AbstractSmallWeChatBusinessServiceDataFlowListener extends
         currentSmallWeChatInfo.put("appId", currentSmallWeChatInfo.get("appId"));
         currentSmallWeChatInfo.put("name", currentSmallWeChatInfo.get("name"));
         currentSmallWeChatInfo.put("appSecret", currentSmallWeChatInfo.get("appSecret"));
-        currentSmallWeChatInfo.put("weChatId", currentSmallWeChatInfo.get("weChat_id"));
+        currentSmallWeChatInfo.put("weChatId", currentSmallWeChatInfo.get("wechat_id"));
         currentSmallWeChatInfo.put("storeId", currentSmallWeChatInfo.get("store_Id"));
         currentSmallWeChatInfo.put("payPassword", currentSmallWeChatInfo.get("pay_password"));
         currentSmallWeChatInfo.put("remarks", currentSmallWeChatInfo.get("remarks"));

+ 88 - 0
service-store/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWechatAttrBusinessServiceDataFlowListener.java

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

+ 180 - 0
service-store/src/main/java/com/java110/store/listener/smallWeChat/DeleteSmallWechatAttrInfoListener.java

@@ -0,0 +1,180 @@
+package com.java110.store.listener.smallWeChat;
+
+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.po.smallWechatAttr.SmallWechatAttrPo;
+import com.java110.store.dao.ISmallWechatAttrServiceDao;
+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、businessSmallWechatAttr:{} 微信属性基本信息节点
+ * 2、businessSmallWechatAttrAttr:[{}] 微信属性属性信息节点
+ * 3、businessSmallWechatAttrPhoto:[{}] 微信属性照片信息节点
+ * 4、businessSmallWechatAttrCerdentials:[{}] 微信属性证件信息节点
+ * 协议地址 :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("deleteSmallWechatAttrInfoListener")
+@Transactional
+public class DeleteSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteSmallWechatAttrInfoListener.class);
+    @Autowired
+    ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessSmallWechatAttr 节点
+        if (data.containsKey(SmallWechatAttrPo.class.getSimpleName())) {
+            Object _obj = data.get(SmallWechatAttrPo.class.getSimpleName());
+            JSONArray businessSmallWechatAttrs = null;
+            if (_obj instanceof JSONObject) {
+                businessSmallWechatAttrs = new JSONArray();
+                businessSmallWechatAttrs.add(_obj);
+            } else {
+                businessSmallWechatAttrs = (JSONArray) _obj;
+            }
+            //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrs.size(); _smallWechatAttrIndex++) {
+                JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(_smallWechatAttrIndex);
+                doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                }
+            }
+
+        }
+
+
+    }
+
+    /**
+     * 删除 instance数据
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+
+        //微信属性信息
+        Map info = new HashMap();
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_DEL);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if (businessSmallWechatAttrInfos != null && businessSmallWechatAttrInfos.size() > 0) {
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size(); _smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo, StatusConstant.STATUS_CD_INVALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+                dataFlowContext.addParamOut("attrId", businessSmallWechatAttrInfo.get("attr_id"));
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_INVALID);
+
+        Map delInfo = new HashMap();
+        delInfo.put("bId", business.getbId());
+        delInfo.put("operate", StatusConstant.OPERATE_DEL);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if (smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0) {
+
+            //微信属性信息
+            List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessSmallWechatAttrInfos == null || businessSmallWechatAttrInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(smallWechatAttr),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size(); _smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo, StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     *
+     * @param business                总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business, JSONObject businessSmallWechatAttr) {
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr, "attrId", "businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if (businessSmallWechatAttr.getString("attrId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "attrId 错误,不能自动生成(必须已经存在的attrId)" + businessSmallWechatAttr);
+        }
+        //自动插入DEL
+        autoSaveDelBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+    }
+
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+}

+ 181 - 0
service-store/src/main/java/com/java110/store/listener/smallWeChat/SaveSmallWechatAttrInfoListener.java

@@ -0,0 +1,181 @@
+package com.java110.store.listener.smallWeChat;
+
+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.po.smallWechatAttr.SmallWechatAttrPo;
+import com.java110.store.dao.ISmallWechatAttrServiceDao;
+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("saveSmallWechatAttrInfoListener")
+@Transactional
+public class SaveSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveSmallWechatAttrInfoListener.class);
+
+    @Autowired
+    private ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * 保存微信属性信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+        //处理 businessSmallWechatAttr 节点
+        if (data.containsKey(SmallWechatAttrPo.class.getSimpleName())) {
+            Object bObj = data.get(SmallWechatAttrPo.class.getSimpleName());
+            JSONArray businessSmallWechatAttrs = null;
+            if (bObj instanceof JSONObject) {
+                businessSmallWechatAttrs = new JSONArray();
+                businessSmallWechatAttrs.add(bObj);
+            } else {
+                businessSmallWechatAttrs = (JSONArray) bObj;
+            }
+            //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+            for (int bSmallWechatAttrIndex = 0; bSmallWechatAttrIndex < businessSmallWechatAttrs.size(); bSmallWechatAttrIndex++) {
+                JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(bSmallWechatAttrIndex);
+                doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * business 数据转移到 instance
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_ADD);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if (businessSmallWechatAttrInfo != null && businessSmallWechatAttrInfo.size() > 0) {
+            reFreshShareColumn(info, businessSmallWechatAttrInfo.get(0));
+            smallWechatAttrServiceDaoImpl.saveSmallWechatAttrInfoInstance(info);
+            if (businessSmallWechatAttrInfo.size() == 1) {
+                dataFlowContext.addParamOut("attrId", businessSmallWechatAttrInfo.get(0).get("attr_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("communityId")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("community_id")) {
+            return;
+        }
+
+        info.put("communityId", businessInfo.get("community_id"));
+    }
+
+    /**
+     * 撤单
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        Map paramIn = new HashMap();
+        paramIn.put("bId", bId);
+        paramIn.put("statusCd", StatusConstant.STATUS_CD_INVALID);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if (smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0) {
+            reFreshShareColumn(paramIn, smallWechatAttrInfo.get(0));
+            smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     *
+     * @param business                总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business, JSONObject businessSmallWechatAttr) {
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr, "attrId", "businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if (businessSmallWechatAttr.getString("attrId").startsWith("-")) {
+            //刷新缓存
+            //flushSmallWechatAttrId(business.getDatas());
+
+            businessSmallWechatAttr.put("attrId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+
+        }
+
+        businessSmallWechatAttr.put("bId", business.getbId());
+        businessSmallWechatAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存微信属性信息
+        smallWechatAttrServiceDaoImpl.saveBusinessSmallWechatAttrInfo(businessSmallWechatAttr);
+
+    }
+
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+}

+ 190 - 0
service-store/src/main/java/com/java110/store/listener/smallWeChat/UpdateSmallWechatAttrInfoListener.java

@@ -0,0 +1,190 @@
+package com.java110.store.listener.smallWeChat;
+
+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.po.smallWechatAttr.SmallWechatAttrPo;
+import com.java110.store.dao.ISmallWechatAttrServiceDao;
+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、businessSmallWechatAttr:{} 微信属性基本信息节点
+ * 2、businessSmallWechatAttrAttr:[{}] 微信属性属性信息节点
+ * 3、businessSmallWechatAttrPhoto:[{}] 微信属性照片信息节点
+ * 4、businessSmallWechatAttrCerdentials:[{}] 微信属性证件信息节点
+ * 协议地址 :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("updateSmallWechatAttrInfoListener")
+@Transactional
+public class UpdateSmallWechatAttrInfoListener extends AbstractSmallWechatAttrBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateSmallWechatAttrInfoListener.class);
+    @Autowired
+    private ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_SMALL_WECHAT_ATTR;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+
+
+        //处理 businessSmallWechatAttr 节点
+        if (data.containsKey(SmallWechatAttrPo.class.getSimpleName())) {
+            Object _obj = data.get(SmallWechatAttrPo.class.getSimpleName());
+            JSONArray businessSmallWechatAttrs = null;
+            if (_obj instanceof JSONObject) {
+                businessSmallWechatAttrs = new JSONArray();
+                businessSmallWechatAttrs.add(_obj);
+            } else {
+                businessSmallWechatAttrs = (JSONArray) _obj;
+            }
+            //JSONObject businessSmallWechatAttr = data.getJSONObject(SmallWechatAttrPo.class.getSimpleName());
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrs.size(); _smallWechatAttrIndex++) {
+                JSONObject businessSmallWechatAttr = businessSmallWechatAttrs.getJSONObject(_smallWechatAttrIndex);
+                doBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttr.getString("attrId"));
+                }
+            }
+        }
+    }
+
+
+    /**
+     * business to instance 过程
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Map info = new HashMap();
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_ADD);
+
+        //微信属性信息
+        List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(info);
+        if (businessSmallWechatAttrInfos != null && businessSmallWechatAttrInfos.size() > 0) {
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size(); _smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo, StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+                if (businessSmallWechatAttrInfo.size() == 1) {
+                    dataFlowContext.addParamOut("attrId", businessSmallWechatAttrInfo.get("attr_id"));
+                }
+            }
+        }
+
+    }
+
+    /**
+     * 撤单
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+
+        String bId = business.getbId();
+        //Assert.hasLength(bId,"请求报文中没有包含 bId");
+        Map info = new HashMap();
+        info.put("bId", bId);
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        Map delInfo = new HashMap();
+        delInfo.put("bId", business.getbId());
+        delInfo.put("operate", StatusConstant.OPERATE_DEL);
+        //微信属性信息
+        List<Map> smallWechatAttrInfo = smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(info);
+        if (smallWechatAttrInfo != null && smallWechatAttrInfo.size() > 0) {
+
+            //微信属性信息
+            List<Map> businessSmallWechatAttrInfos = smallWechatAttrServiceDaoImpl.getBusinessSmallWechatAttrInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessSmallWechatAttrInfos == null || businessSmallWechatAttrInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(smallWechatAttr),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _smallWechatAttrIndex = 0; _smallWechatAttrIndex < businessSmallWechatAttrInfos.size(); _smallWechatAttrIndex++) {
+                Map businessSmallWechatAttrInfo = businessSmallWechatAttrInfos.get(_smallWechatAttrIndex);
+                flushBusinessSmallWechatAttrInfo(businessSmallWechatAttrInfo, StatusConstant.STATUS_CD_VALID);
+                smallWechatAttrServiceDaoImpl.updateSmallWechatAttrInfoInstance(businessSmallWechatAttrInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessSmallWechatAttr 节点
+     *
+     * @param business                总的数据节点
+     * @param businessSmallWechatAttr 微信属性节点
+     */
+    private void doBusinessSmallWechatAttr(Business business, JSONObject businessSmallWechatAttr) {
+
+        Assert.jsonObjectHaveKey(businessSmallWechatAttr, "attrId", "businessSmallWechatAttr 节点下没有包含 attrId 节点");
+
+        if (businessSmallWechatAttr.getString("attrId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "attrId 错误,不能自动生成(必须已经存在的attrId)" + businessSmallWechatAttr);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessSmallWechatAttr(business, businessSmallWechatAttr);
+
+        businessSmallWechatAttr.put("bId", business.getbId());
+        businessSmallWechatAttr.put("operate", StatusConstant.OPERATE_ADD);
+        //保存微信属性信息
+        smallWechatAttrServiceDaoImpl.saveBusinessSmallWechatAttrInfo(businessSmallWechatAttr);
+
+    }
+
+
+    @Override
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+
+
+}

+ 111 - 0
service-store/src/main/java/com/java110/store/smo/impl/SmallWechatAttrInnerServiceSMOImpl.java

@@ -0,0 +1,111 @@
+package com.java110.store.smo.impl;
+
+
+import com.java110.store.dao.ISmallWechatAttrServiceDao;
+import com.java110.core.smo.smallWechatAttr.ISmallWechatAttrInnerServiceSMO;
+import com.java110.dto.smallWechatAttr.SmallWechatAttrDto;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 微信属性内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class SmallWechatAttrInnerServiceSMOImpl extends BaseServiceSMO implements ISmallWechatAttrInnerServiceSMO {
+
+    @Autowired
+    private ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<SmallWechatAttrDto> querySmallWechatAttrs(@RequestBody  SmallWechatAttrDto smallWechatAttrDto) {
+
+        //校验是否传了 分页信息
+
+        int page = smallWechatAttrDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            smallWechatAttrDto.setPage((page - 1) * smallWechatAttrDto.getRow());
+        }
+
+        List<SmallWechatAttrDto> smallWechatAttrs = BeanConvertUtil.covertBeanList(smallWechatAttrServiceDaoImpl.getSmallWechatAttrInfo(BeanConvertUtil.beanCovertMap(smallWechatAttrDto)), SmallWechatAttrDto.class);
+
+        if (smallWechatAttrs == null || smallWechatAttrs.size() == 0) {
+            return smallWechatAttrs;
+        }
+
+        String[] userIds = getUserIds(smallWechatAttrs);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (SmallWechatAttrDto smallWechatAttr : smallWechatAttrs) {
+            refreshSmallWechatAttr(smallWechatAttr, users);
+        }
+        return smallWechatAttrs;
+    }
+
+    /**
+     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
+     *
+     * @param smallWechatAttr 小区微信属性信息
+     * @param users 用户列表
+     */
+    private void refreshSmallWechatAttr(SmallWechatAttrDto smallWechatAttr, List<UserDto> users) {
+        for (UserDto user : users) {
+            if (smallWechatAttr.getAttrId().equals(user.getUserId())) {
+                BeanConvertUtil.covertBean(user, smallWechatAttr);
+            }
+        }
+    }
+
+    /**
+     * 获取批量userId
+     *
+     * @param smallWechatAttrs 小区楼信息
+     * @return 批量userIds 信息
+     */
+     private String[] getUserIds(List<SmallWechatAttrDto> smallWechatAttrs) {
+        List<String> userIds = new ArrayList<String>();
+        for (SmallWechatAttrDto smallWechatAttr : smallWechatAttrs) {
+            userIds.add(smallWechatAttr.getAttrId());
+        }
+
+        return userIds.toArray(new String[userIds.size()]);
+    }
+
+    @Override
+    public int querySmallWechatAttrsCount(@RequestBody SmallWechatAttrDto smallWechatAttrDto) {
+        return smallWechatAttrServiceDaoImpl.querySmallWechatAttrsCount(BeanConvertUtil.beanCovertMap(smallWechatAttrDto));    }
+
+    public ISmallWechatAttrServiceDao getSmallWechatAttrServiceDaoImpl() {
+        return smallWechatAttrServiceDaoImpl;
+    }
+
+    public void setSmallWechatAttrServiceDaoImpl(ISmallWechatAttrServiceDao smallWechatAttrServiceDaoImpl) {
+        this.smallWechatAttrServiceDaoImpl = smallWechatAttrServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}