15178832520 лет назад: 5
Родитель
Сommit
42adfdfb18
24 измененных файлов с 2013 добавлено и 130 удалено
  1. 38 0
      Api/src/main/java/com/java110/api/bmo/smallWeChat/ISmallWeChatBMO.java
  2. 91 0
      Api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWeChatBMOImpl.java
  3. 58 0
      Api/src/main/java/com/java110/api/listener/smallWeChat/DeleteSmallWeChatListener.java
  4. 79 0
      Api/src/main/java/com/java110/api/listener/smallWeChat/ListSmallWeChatsListener.java
  5. 60 0
      Api/src/main/java/com/java110/api/listener/smallWeChat/SaveSmallWeChatListener.java
  6. 61 0
      Api/src/main/java/com/java110/api/listener/smallWeChat/UpdateSmallWeChatListener.java
  7. 81 0
      StoreService/src/main/java/com/java110/store/dao/ISmallWeChatServiceDao.java
  8. 129 0
      StoreService/src/main/java/com/java110/store/dao/impl/SmallWeChatServiceDaoImpl.java
  9. 83 0
      StoreService/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWeChatBusinessServiceDataFlowListener.java
  10. 158 0
      StoreService/src/main/java/com/java110/store/listener/smallWeChat/DeleteSmallWeChatInfoListener.java
  11. 177 0
      StoreService/src/main/java/com/java110/store/listener/smallWeChat/SaveSmallWeChatInfoListener.java
  12. 187 0
      StoreService/src/main/java/com/java110/store/listener/smallWeChat/UpdateSmallWeChatInfoListener.java
  13. 75 0
      StoreService/src/main/java/com/java110/store/smo/impl/SmallWeChatInnerServiceSMOImpl.java
  14. 128 0
      docs/document/services/smallWeChat/SaveSmallWeChatInfo.md
  15. 100 0
      java110-bean/src/main/java/com/java110/dto/smallWeChat/SmallWeChatDto.java
  16. 109 0
      java110-bean/src/main/java/com/java110/vo/api/smallWeChat/ApiSmallWeChatDataVo.java
  17. 19 0
      java110-bean/src/main/java/com/java110/vo/api/smallWeChat/ApiSmallWeChatVo.java
  18. 30 40
      java110-code-generator/src/main/resources/back/template_1.json
  19. 33 89
      java110-code-generator/src/main/resources/web/template_1.json
  20. 1 1
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  21. 41 0
      java110-core/src/main/java/com/java110/core/smo/smallWeChat/ISmallWeChatInnerServiceSMO.java
  22. 236 0
      java110-db/src/main/resources/mapper/store/SmallWeChatServiceDaoImplMapper.xml
  23. 8 0
      java110-utils/src/main/java/com/java110/utils/constant/BusinessTypeConstant.java
  24. 31 0
      java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeSmallWeChatConstant.java

+ 38 - 0
Api/src/main/java/com/java110/api/bmo/smallWeChat/ISmallWeChatBMO.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 ISmallWeChatBMO extends IApiBaseBMO {
+
+
+    /**
+     * 添加小程序管理
+     * @param paramInJson
+     * @param dataFlowContext
+     * @return
+     */
+     JSONObject addSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 添加小程序管理信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject updateSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+    /**
+     * 删除小程序管理
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+     JSONObject deleteSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext);
+
+
+
+}

+ 91 - 0
Api/src/main/java/com/java110/api/bmo/smallWeChat/impl/SmallWeChatBMOImpl.java

@@ -0,0 +1,91 @@
+package com.java110.api.bmo.smallWeChat.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.ApiBaseBMO;
+import com.java110.api.bmo.smallWeChat.ISmallWeChatBMO;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.smo.file.IFileInnerServiceSMO;
+import com.java110.core.smo.file.IFileRelInnerServiceSMO;
+import com.java110.core.smo.smallWeChat.ISmallWeChatInnerServiceSMO;
+import com.java110.dto.file.FileRelDto;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("smallWeChatBMOImpl")
+public class SmallWeChatBMOImpl extends ApiBaseBMO implements ISmallWeChatBMO {
+
+    @Autowired
+    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject addSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WE_CHAT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessSmallWeChat = new JSONObject();
+        businessSmallWeChat.putAll(paramInJson);
+        businessSmallWeChat.put("weChatId", "-1");
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessSmallWeChat", businessSmallWeChat);
+        return business;
+    }
+
+
+    /**
+     * 添加活动信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject updateSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setWeChatId(paramInJson.getString("weChatId"));
+        smallWeChatDto.setStoreId(paramInJson.getString("soreId"));
+        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
+        Assert.listOnlyOne(smallWeChatDtos, "未找到需要修改的小程序信息 或多条数据");
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_SMALL_WE_CHAT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessSmallWeChat = new JSONObject();
+        businessSmallWeChat.putAll(BeanConvertUtil.beanCovertMap(smallWeChatDtos.get(0)));
+        businessSmallWeChat.putAll(paramInJson);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessSmallWeChat", businessSmallWeChat);
+        return business;
+    }
+
+
+    /**
+     * 添加小区信息
+     *
+     * @param paramInJson     接口调用放传入入参
+     * @param dataFlowContext 数据上下文
+     * @return 订单服务能够接受的报文
+     */
+    public JSONObject deleteSmallWeChat(JSONObject paramInJson, DataFlowContext dataFlowContext) {
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_SMALL_WE_CHAT);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessSmallWeChat = new JSONObject();
+        businessSmallWeChat.putAll(paramInJson);
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessSmallWeChat", businessSmallWeChat);
+        return business;
+    }
+
+}

+ 58 - 0
Api/src/main/java/com/java110/api/listener/smallWeChat/DeleteSmallWeChatListener.java

@@ -0,0 +1,58 @@
+package com.java110.api.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.smallWeChat.ISmallWeChatBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodeSmallWeChatConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+
+/**
+ * 删除小程序配置
+ */
+@Java110Listener("deleteSmallWeChatListener")
+public class DeleteSmallWeChatListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private ISmallWeChatBMO smallWeChatBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "weChatId", "weChatId不能为空");
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        AppService service = event.getAppService();
+        businesses.add(smallWeChatBMOImpl.deleteSmallWeChat(reqJson, context));
+        ResponseEntity<String> responseEntity = smallWeChatBMOImpl.callService(context, service.getServiceCode(), businesses);
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWeChatConstant.DELETE_SMALL_WE_CHAT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 79 - 0
Api/src/main/java/com/java110/api/listener/smallWeChat/ListSmallWeChatsListener.java

@@ -0,0 +1,79 @@
+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.smo.smallWeChat.ISmallWeChatInnerServiceSMO;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.ServiceCodeSmallWeChatConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.api.smallWeChat.ApiSmallWeChatDataVo;
+import com.java110.vo.api.smallWeChat.ApiSmallWeChatVo;
+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("listSmallWeChatsListener")
+public class ListSmallWeChatsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWeChatConstant.LIST_SMALL_WE_CHATS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public ISmallWeChatInnerServiceSMO getSmallWeChatInnerServiceSMOImpl() {
+        return smallWeChatInnerServiceSMOImpl;
+    }
+
+    public void setSmallWeChatInnerServiceSMOImpl(ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl) {
+        this.smallWeChatInnerServiceSMOImpl = smallWeChatInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        SmallWeChatDto smallWeChatDto = BeanConvertUtil.covertBean(reqJson, SmallWeChatDto.class);
+        int count = smallWeChatInnerServiceSMOImpl.querySmallWeChatsCount(smallWeChatDto);
+        List<ApiSmallWeChatDataVo> smallWeChats = null;
+        if (count > 0) {
+            smallWeChats = BeanConvertUtil.covertBeanList(smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto), ApiSmallWeChatDataVo.class);
+        } else {
+            smallWeChats = new ArrayList<>();
+        }
+        ApiSmallWeChatVo apiSmallWeChatVo = new ApiSmallWeChatVo();
+        apiSmallWeChatVo.setTotal(count);
+        apiSmallWeChatVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
+        apiSmallWeChatVo.setSmallWeChats(smallWeChats);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiSmallWeChatVo), HttpStatus.OK);
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 60 - 0
Api/src/main/java/com/java110/api/listener/smallWeChat/SaveSmallWeChatListener.java

@@ -0,0 +1,60 @@
+package com.java110.api.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.smallWeChat.ISmallWeChatBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodeSmallWeChatConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 保存小程序配置
+ */
+@Java110Listener("saveSmallWeChatListener")
+public class SaveSmallWeChatListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private ISmallWeChatBMO smallWeChatBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "appId", "请求报文中未包含appId");
+        Assert.hasKeyAndValue(reqJson, "appSecret", "请求报文中未包含appSecret");
+        Assert.hasKeyAndValue(reqJson, "payPassword", "请求报文中未包含payPassword");
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        AppService service = event.getAppService();
+        businesses.add(smallWeChatBMOImpl.addSmallWeChat(reqJson, context));
+        ResponseEntity<String> responseEntity = smallWeChatBMOImpl.callService(context, service.getServiceCode(), businesses);
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWeChatConstant.ADD_SMALL_WE_CHAT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+}

+ 61 - 0
Api/src/main/java/com/java110/api/listener/smallWeChat/UpdateSmallWeChatListener.java

@@ -0,0 +1,61 @@
+package com.java110.api.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.smallWeChat.ISmallWeChatBMO;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.entity.center.AppService;
+import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ServiceCodeSmallWeChatConstant;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+
+/**
+ * 修改小程序配置
+ */
+@Java110Listener("updateSmallWeChatListener")
+public class UpdateSmallWeChatListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private ISmallWeChatBMO smallWeChatBMOImpl;
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "weChatId", "weChatId不能为空");
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "appId", "请求报文中未包含appId");
+        Assert.hasKeyAndValue(reqJson, "appSecret", "请求报文中未包含appSecret");
+        Assert.hasKeyAndValue(reqJson, "payPassword", "请求报文中未包含payPassword");
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+        context.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        AppService service = event.getAppService();
+        businesses.add(smallWeChatBMOImpl.updateSmallWeChat(reqJson, context));
+        ResponseEntity<String> responseEntity = smallWeChatBMOImpl.callService(context, service.getServiceCode(), businesses);
+        context.setResponseEntity(responseEntity);
+    }
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeSmallWeChatConstant.UPDATE_SMALL_WE_CHAT;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.POST;
+    }
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+}

+ 81 - 0
StoreService/src/main/java/com/java110/store/dao/ISmallWeChatServiceDao.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 ISmallWeChatServiceDao {
+
+    /**
+     * 保存 小程序管理信息
+     * @param businessSmallWeChatInfo 小程序管理信息 封装
+     * @throws DAOException 操作数据库异常
+     */
+    void saveBusinessSmallWeChatInfo(Map businessSmallWeChatInfo) throws DAOException;
+
+
+
+    /**
+     * 查询小程序管理信息(business过程)
+     * 根据bId 查询小程序管理信息
+     * @param info bId 信息
+     * @return 小程序管理信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getBusinessSmallWeChatInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 保存 小程序管理信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveSmallWeChatInfoInstance(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询小程序管理信息(instance过程)
+     * 根据bId 查询小程序管理信息
+     * @param info bId 信息
+     * @return 小程序管理信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getSmallWeChatInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改小程序管理信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateSmallWeChatInfoInstance(Map info) throws DAOException;
+
+
+    /**
+     * 查询小程序管理总数
+     *
+     * @param info 小程序管理信息
+     * @return 小程序管理数量
+     */
+    int querySmallWeChatsCount(Map info);
+
+}

+ 129 - 0
StoreService/src/main/java/com/java110/store/dao/impl/SmallWeChatServiceDaoImpl.java

@@ -0,0 +1,129 @@
+package com.java110.store.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 小程序管理服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("smallWeChatServiceDaoImpl")
+//@Transactional
+public class SmallWeChatServiceDaoImpl extends BaseServiceDao implements ISmallWeChatServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(SmallWeChatServiceDaoImpl.class);
+
+    /**
+     * 小程序管理信息封装
+     * @param businessSmallWeChatInfo 小程序管理信息 封装
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveBusinessSmallWeChatInfo(Map businessSmallWeChatInfo) throws DAOException {
+        businessSmallWeChatInfo.put("month", DateUtil.getCurrentMonth());
+        // 查询business_user 数据是否已经存在
+        logger.debug("保存小程序管理信息 入参 businessSmallWeChatInfo : {}",businessSmallWeChatInfo);
+        int saveFlag = sqlSessionTemplate.insert("smallWeChatServiceDaoImpl.saveBusinessSmallWeChatInfo",businessSmallWeChatInfo);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存小程序管理数据失败:"+ JSONObject.toJSONString(businessSmallWeChatInfo));
+        }
+    }
+
+
+    /**
+     * 查询小程序管理信息
+     * @param info bId 信息
+     * @return 小程序管理信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getBusinessSmallWeChatInfo(Map info) throws DAOException {
+
+        logger.debug("查询小程序管理信息 入参 info : {}",info);
+
+        List<Map> businessSmallWeChatInfos = sqlSessionTemplate.selectList("smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo",info);
+
+        return businessSmallWeChatInfos;
+    }
+
+
+
+    /**
+     * 保存小程序管理信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveSmallWeChatInfoInstance(Map info) throws DAOException {
+        logger.debug("保存小程序管理信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("smallWeChatServiceDaoImpl.saveSmallWeChatInfoInstance",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> getSmallWeChatInfo(Map info) throws DAOException {
+        logger.debug("查询小程序管理信息 入参 info : {}",info);
+
+        List<Map> businessSmallWeChatInfos = sqlSessionTemplate.selectList("smallWeChatServiceDaoImpl.getSmallWeChatInfo",info);
+
+        return businessSmallWeChatInfos;
+    }
+
+
+    /**
+     * 修改小程序管理信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateSmallWeChatInfoInstance(Map info) throws DAOException {
+        logger.debug("修改小程序管理信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改小程序管理信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询小程序管理数量
+     * @param info 小程序管理信息
+     * @return 小程序管理数量
+     */
+    @Override
+    public int querySmallWeChatsCount(Map info) {
+        logger.debug("查询小程序管理数据 入参 info : {}",info);
+
+        List<Map> businessSmallWeChatInfos = sqlSessionTemplate.selectList("smallWeChatServiceDaoImpl.querySmallWeChatsCount", info);
+        if (businessSmallWeChatInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessSmallWeChatInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 83 - 0
StoreService/src/main/java/com/java110/store/listener/smallWeChat/AbstractSmallWeChatBusinessServiceDataFlowListener.java

@@ -0,0 +1,83 @@
+package com.java110.store.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.entity.center.Business;
+import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+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 AbstractSmallWeChatBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener {
+    private static Logger logger = LoggerFactory.getLogger(AbstractSmallWeChatBusinessServiceDataFlowListener.class);
+
+
+    /**
+     * 获取 DAO工具类
+     *
+     * @return
+     */
+    public abstract ISmallWeChatServiceDao getSmallWeChatServiceDaoImpl();
+
+    /**
+     * 刷新 businessSmallWeChatInfo 数据
+     * 主要将 数据库 中字段和 接口传递字段建立关系
+     *
+     * @param businessSmallWeChatInfo
+     */
+    protected void flushBusinessSmallWeChatInfo(Map businessSmallWeChatInfo, String statusCd) {
+        businessSmallWeChatInfo.put("newBId", businessSmallWeChatInfo.get("b_id"));
+        businessSmallWeChatInfo.put("operate", businessSmallWeChatInfo.get("operate"));
+        businessSmallWeChatInfo.put("createTime", businessSmallWeChatInfo.get("create_time"));
+        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("storeId", businessSmallWeChatInfo.get("store_Id"));
+        businessSmallWeChatInfo.put("payPassword", businessSmallWeChatInfo.get("pay_password"));
+        businessSmallWeChatInfo.put("remarks", businessSmallWeChatInfo.get("remarks"));
+        businessSmallWeChatInfo.remove("bId");
+        businessSmallWeChatInfo.put("statusCd", statusCd);
+    }
+
+
+    /**
+     * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
+     *
+     * @param businessSmallWeChat 小程序管理信息
+     */
+    protected void autoSaveDelBusinessSmallWeChat(Business business, JSONObject businessSmallWeChat) {
+        Map info = new HashMap();
+        info.put("weChatId", businessSmallWeChat.getString("weChatId"));
+        info.put("statusCd", StatusConstant.STATUS_CD_VALID);
+        List<Map> currentSmallWeChatInfos = getSmallWeChatServiceDaoImpl().getSmallWeChatInfo(info);
+        if (currentSmallWeChatInfos == null || currentSmallWeChatInfos.size() != 1) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "未找到需要修改数据信息,入参错误或数据有问题,请检查" + info);
+        }
+        Map currentSmallWeChatInfo = currentSmallWeChatInfos.get(0);
+        currentSmallWeChatInfo.put("bId", business.getbId());
+        currentSmallWeChatInfo.put("operate", currentSmallWeChatInfo.get("operate"));
+        currentSmallWeChatInfo.put("createTime", currentSmallWeChatInfo.get("create_time"));
+        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("storeId", currentSmallWeChatInfo.get("store_Id"));
+        currentSmallWeChatInfo.put("payPassword", currentSmallWeChatInfo.get("pay_password"));
+        currentSmallWeChatInfo.put("remarks", currentSmallWeChatInfo.get("remarks"));
+        currentSmallWeChatInfo.put("operate", StatusConstant.OPERATE_DEL);
+        getSmallWeChatServiceDaoImpl().saveBusinessSmallWeChatInfo(currentSmallWeChatInfo);
+    }
+
+
+}

+ 158 - 0
StoreService/src/main/java/com/java110/store/listener/smallWeChat/DeleteSmallWeChatInfoListener.java

@@ -0,0 +1,158 @@
+package com.java110.store.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+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 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、businessSmallWeChat:{} 小程序管理基本信息节点
+ * 2、businessSmallWeChatAttr:[{}] 小程序管理属性信息节点
+ * 3、businessSmallWeChatPhoto:[{}] 小程序管理照片信息节点
+ * 4、businessSmallWeChatCerdentials:[{}] 小程序管理证件信息节点
+ * 协议地址 :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("deleteSmallWeChatInfoListener")
+@Transactional
+public class DeleteSmallWeChatInfoListener extends AbstractSmallWeChatBusinessServiceDataFlowListener {
+
+    private final static Logger logger = LoggerFactory.getLogger(DeleteSmallWeChatInfoListener.class);
+    @Autowired
+    ISmallWeChatServiceDao smallWeChatServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 3;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_DELETE_SMALL_WE_CHAT;
+    }
+
+    /**
+     * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+        if (data.containsKey("businessSmallWeChat")) {
+            Object _obj = data.get("businessSmallWeChat");
+            JSONArray businessSmallWeChats = null;
+            if (_obj instanceof JSONObject) {
+                businessSmallWeChats = new JSONArray();
+                businessSmallWeChats.add(_obj);
+            } else {
+                businessSmallWeChats = (JSONArray) _obj;
+            }
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChats.size(); _smallWeChatIndex++) {
+                JSONObject businessSmallWeChat = businessSmallWeChats.getJSONObject(_smallWeChatIndex);
+                doBusinessSmallWeChat(business, businessSmallWeChat);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("weChatId", businessSmallWeChat.getString("weChatId"));
+                }
+            }
+        }
+
+
+    }
+
+    /**
+     * 删除 instance数据
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        Map info = new HashMap();
+        info.put("bId", business.getbId());
+        info.put("operate", StatusConstant.OPERATE_DEL);
+        List<Map> businessSmallWeChatInfos = smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo(info);
+        if (businessSmallWeChatInfos != null && businessSmallWeChatInfos.size() > 0) {
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChatInfos.size(); _smallWeChatIndex++) {
+                Map businessSmallWeChatInfo = businessSmallWeChatInfos.get(_smallWeChatIndex);
+                flushBusinessSmallWeChatInfo(businessSmallWeChatInfo, StatusConstant.STATUS_CD_INVALID);
+                smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance(businessSmallWeChatInfo);
+                dataFlowContext.addParamOut("weChatId", businessSmallWeChatInfo.get("weChat_id"));
+            }
+        }
+    }
+
+    /**
+     * 撤单
+     * 从business表中查询到DEL的数据 将instance中的数据更新回来
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doRecover(DataFlowContext dataFlowContext, Business business) {
+        String bId = business.getbId();
+        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> smallWeChatInfo = smallWeChatServiceDaoImpl.getSmallWeChatInfo(info);
+        if (smallWeChatInfo != null && smallWeChatInfo.size() > 0) {
+            List<Map> businessSmallWeChatInfos = smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo(delInfo);
+            if (businessSmallWeChatInfos == null || businessSmallWeChatInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(smallWeChat),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChatInfos.size(); _smallWeChatIndex++) {
+                Map businessSmallWeChatInfo = businessSmallWeChatInfos.get(_smallWeChatIndex);
+                flushBusinessSmallWeChatInfo(businessSmallWeChatInfo, StatusConstant.STATUS_CD_VALID);
+                smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance(businessSmallWeChatInfo);
+            }
+        }
+    }
+
+
+    /**
+     * 处理 businessSmallWeChat 节点
+     *
+     * @param business            总的数据节点
+     * @param businessSmallWeChat 小程序管理节点
+     */
+    private void doBusinessSmallWeChat(Business business, JSONObject businessSmallWeChat) {
+        Assert.jsonObjectHaveKey(businessSmallWeChat, "weChatId", "businessSmallWeChat 节点下没有包含 weChatId 节点");
+        if (businessSmallWeChat.getString("weChatId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "weChatId 错误,不能自动生成(必须已经存在的weChatId)" + businessSmallWeChat);
+        }
+        autoSaveDelBusinessSmallWeChat(business, businessSmallWeChat);
+    }
+
+    public ISmallWeChatServiceDao getSmallWeChatServiceDaoImpl() {
+        return smallWeChatServiceDaoImpl;
+    }
+
+    public void setSmallWeChatServiceDaoImpl(ISmallWeChatServiceDao smallWeChatServiceDaoImpl) {
+        this.smallWeChatServiceDaoImpl = smallWeChatServiceDaoImpl;
+    }
+}

+ 177 - 0
StoreService/src/main/java/com/java110/store/listener/smallWeChat/SaveSmallWeChatInfoListener.java

@@ -0,0 +1,177 @@
+package com.java110.store.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.util.Assert;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.entity.center.Business;
+import 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("saveSmallWeChatInfoListener")
+@Transactional
+public class SaveSmallWeChatInfoListener extends AbstractSmallWeChatBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveSmallWeChatInfoListener.class);
+
+    @Autowired
+    private ISmallWeChatServiceDao smallWeChatServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 0;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WE_CHAT;
+    }
+
+    /**
+     * 保存小程序管理信息 business 表中
+     *
+     * @param dataFlowContext 数据对象
+     * @param business        当前业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+        JSONObject data = business.getDatas();
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+        if (data.containsKey("businessSmallWeChat")) {
+            Object bObj = data.get("businessSmallWeChat");
+            JSONArray businessSmallWeChats = null;
+            if (bObj instanceof JSONObject) {
+                businessSmallWeChats = new JSONArray();
+                businessSmallWeChats.add(bObj);
+            } else {
+                businessSmallWeChats = (JSONArray) bObj;
+            }
+            //JSONObject businessSmallWeChat = data.getJSONObject("businessSmallWeChat");
+            for (int bSmallWeChatIndex = 0; bSmallWeChatIndex < businessSmallWeChats.size(); bSmallWeChatIndex++) {
+                JSONObject businessSmallWeChat = businessSmallWeChats.getJSONObject(bSmallWeChatIndex);
+                doBusinessSmallWeChat(business, businessSmallWeChat);
+                if (bObj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("weChatId", businessSmallWeChat.getString("weChatId"));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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> businessSmallWeChatInfo = smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo(info);
+        if (businessSmallWeChatInfo != null && businessSmallWeChatInfo.size() > 0) {
+            reFreshShareColumn(info, businessSmallWeChatInfo.get(0));
+            smallWeChatServiceDaoImpl.saveSmallWeChatInfoInstance(info);
+            if (businessSmallWeChatInfo.size() == 1) {
+                dataFlowContext.addParamOut("weChatId", businessSmallWeChatInfo.get(0).get("weChat_id"));
+            }
+        }
+    }
+
+
+    /**
+     * 刷 分片字段
+     *
+     * @param info         查询对象
+     * @param businessInfo 小区ID
+     */
+    private void reFreshShareColumn(Map info, Map businessInfo) {
+
+        if (info.containsKey("store_Id")) {
+            return;
+        }
+
+        if (!businessInfo.containsKey("storeId")) {
+            return;
+        }
+
+        info.put("store_Id", businessInfo.get("storeId"));
+    }
+
+    /**
+     * 撤单
+     *
+     * @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> smallWeChatInfo = smallWeChatServiceDaoImpl.getSmallWeChatInfo(info);
+        if (smallWeChatInfo != null && smallWeChatInfo.size() > 0) {
+            reFreshShareColumn(paramIn, smallWeChatInfo.get(0));
+            smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance(paramIn);
+        }
+    }
+
+
+    /**
+     * 处理 businessSmallWeChat 节点
+     *
+     * @param business            总的数据节点
+     * @param businessSmallWeChat 小程序管理节点
+     */
+    private void doBusinessSmallWeChat(Business business, JSONObject businessSmallWeChat) {
+
+        Assert.jsonObjectHaveKey(businessSmallWeChat, "weChatId", "businessSmallWeChat 节点下没有包含 weChatId 节点");
+
+        if (businessSmallWeChat.getString("weChatId").startsWith("-")) {
+            //刷新缓存
+            //flushSmallWeChatId(business.getDatas());
+
+            businessSmallWeChat.put("weChatId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_weChatId));
+
+        }
+
+        businessSmallWeChat.put("bId", business.getbId());
+        businessSmallWeChat.put("operate", StatusConstant.OPERATE_ADD);
+        //保存小程序管理信息
+        smallWeChatServiceDaoImpl.saveBusinessSmallWeChatInfo(businessSmallWeChat);
+
+    }
+
+    public ISmallWeChatServiceDao getSmallWeChatServiceDaoImpl() {
+        return smallWeChatServiceDaoImpl;
+    }
+
+    public void setSmallWeChatServiceDaoImpl(ISmallWeChatServiceDao smallWeChatServiceDaoImpl) {
+        this.smallWeChatServiceDaoImpl = smallWeChatServiceDaoImpl;
+    }
+}

+ 187 - 0
StoreService/src/main/java/com/java110/store/listener/smallWeChat/UpdateSmallWeChatInfoListener.java

@@ -0,0 +1,187 @@
+package com.java110.store.listener.smallWeChat;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+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 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、businessSmallWeChat:{} 小程序管理基本信息节点
+ * 2、businessSmallWeChatAttr:[{}] 小程序管理属性信息节点
+ * 3、businessSmallWeChatPhoto:[{}] 小程序管理照片信息节点
+ * 4、businessSmallWeChatCerdentials:[{}] 小程序管理证件信息节点
+ * 协议地址 :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("updateSmallWeChatInfoListener")
+@Transactional
+public class UpdateSmallWeChatInfoListener extends AbstractSmallWeChatBusinessServiceDataFlowListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateSmallWeChatInfoListener.class);
+    @Autowired
+    private ISmallWeChatServiceDao smallWeChatServiceDaoImpl;
+
+    @Override
+    public int getOrder() {
+        return 2;
+    }
+
+    @Override
+    public String getBusinessTypeCd() {
+        return BusinessTypeConstant.BUSINESS_TYPE_UPDATE_SMALL_WE_CHAT;
+    }
+
+    /**
+     * business过程
+     *
+     * @param dataFlowContext 上下文对象
+     * @param business        业务对象
+     */
+    @Override
+    protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) {
+
+        JSONObject data = business.getDatas();
+
+        Assert.notEmpty(data, "没有datas 节点,或没有子节点需要处理");
+        //处理 businessSmallWeChat 节点
+        if (data.containsKey("businessSmallWeChat")) {
+            Object _obj = data.get("businessSmallWeChat");
+            JSONArray businessSmallWeChats = null;
+            if (_obj instanceof JSONObject) {
+                businessSmallWeChats = new JSONArray();
+                businessSmallWeChats.add(_obj);
+            } else {
+                businessSmallWeChats = (JSONArray) _obj;
+            }
+            //JSONObject businessSmallWeChat = data.getJSONObject("businessSmallWeChat");
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChats.size(); _smallWeChatIndex++) {
+                JSONObject businessSmallWeChat = businessSmallWeChats.getJSONObject(_smallWeChatIndex);
+                doBusinessSmallWeChat(business, businessSmallWeChat);
+                if (_obj instanceof JSONObject) {
+                    dataFlowContext.addParamOut("weChatId", businessSmallWeChat.getString("weChatId"));
+                }
+            }
+        }
+
+    }
+
+
+    /**
+     * 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> businessSmallWeChatInfos = smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo(info);
+        if (businessSmallWeChatInfos != null && businessSmallWeChatInfos.size() > 0) {
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChatInfos.size(); _smallWeChatIndex++) {
+                Map businessSmallWeChatInfo = businessSmallWeChatInfos.get(_smallWeChatIndex);
+                flushBusinessSmallWeChatInfo(businessSmallWeChatInfo, StatusConstant.STATUS_CD_VALID);
+                smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance(businessSmallWeChatInfo);
+                if (businessSmallWeChatInfo.size() == 1) {
+                    dataFlowContext.addParamOut("weChatId", businessSmallWeChatInfo.get("weChat_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> smallWeChatInfo = smallWeChatServiceDaoImpl.getSmallWeChatInfo(info);
+        if (smallWeChatInfo != null && smallWeChatInfo.size() > 0) {
+
+            //小程序管理信息
+            List<Map> businessSmallWeChatInfos = smallWeChatServiceDaoImpl.getBusinessSmallWeChatInfo(delInfo);
+            //除非程序出错了,这里不会为空
+            if (businessSmallWeChatInfos == null || businessSmallWeChatInfos.size() == 0) {
+                throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR, "撤单失败(smallWeChat),程序内部异常,请检查! " + delInfo);
+            }
+            for (int _smallWeChatIndex = 0; _smallWeChatIndex < businessSmallWeChatInfos.size(); _smallWeChatIndex++) {
+                Map businessSmallWeChatInfo = businessSmallWeChatInfos.get(_smallWeChatIndex);
+                flushBusinessSmallWeChatInfo(businessSmallWeChatInfo, StatusConstant.STATUS_CD_VALID);
+                smallWeChatServiceDaoImpl.updateSmallWeChatInfoInstance(businessSmallWeChatInfo);
+            }
+        }
+
+    }
+
+
+    /**
+     * 处理 businessSmallWeChat 节点
+     *
+     * @param business            总的数据节点
+     * @param businessSmallWeChat 小程序管理节点
+     */
+    private void doBusinessSmallWeChat(Business business, JSONObject businessSmallWeChat) {
+
+        Assert.jsonObjectHaveKey(businessSmallWeChat, "weChatId", "businessSmallWeChat 节点下没有包含 weChatId 节点");
+
+        if (businessSmallWeChat.getString("weChatId").startsWith("-")) {
+            throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR, "weChatId 错误,不能自动生成(必须已经存在的weChatId)" + businessSmallWeChat);
+        }
+        //自动保存DEL
+        autoSaveDelBusinessSmallWeChat(business, businessSmallWeChat);
+
+        businessSmallWeChat.put("bId", business.getbId());
+        businessSmallWeChat.put("operate", StatusConstant.OPERATE_ADD);
+        //保存小程序管理信息
+        smallWeChatServiceDaoImpl.saveBusinessSmallWeChatInfo(businessSmallWeChat);
+
+    }
+
+
+    public ISmallWeChatServiceDao getSmallWeChatServiceDaoImpl() {
+        return smallWeChatServiceDaoImpl;
+    }
+
+    public void setSmallWeChatServiceDaoImpl(ISmallWeChatServiceDao smallWeChatServiceDaoImpl) {
+        this.smallWeChatServiceDaoImpl = smallWeChatServiceDaoImpl;
+    }
+
+
+}

+ 75 - 0
StoreService/src/main/java/com/java110/store/smo/impl/SmallWeChatInnerServiceSMOImpl.java

@@ -0,0 +1,75 @@
+package com.java110.store.smo.impl;
+
+
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+import com.java110.store.dao.ISmallWeChatServiceDao;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.smallWeChat.ISmallWeChatInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.user.UserDto;
+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 SmallWeChatInnerServiceSMOImpl extends BaseServiceSMO implements ISmallWeChatInnerServiceSMO {
+
+    @Autowired
+    private ISmallWeChatServiceDao smallWeChatServiceDaoImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Override
+    public List<SmallWeChatDto> querySmallWeChats(@RequestBody SmallWeChatDto smallWeChatDto) {
+
+        //校验是否传了 分页信息
+
+        int page = smallWeChatDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            smallWeChatDto.setPage((page - 1) * smallWeChatDto.getRow());
+        }
+
+        List<SmallWeChatDto> smallWeChats = BeanConvertUtil.covertBeanList(smallWeChatServiceDaoImpl.getSmallWeChatInfo(BeanConvertUtil.beanCovertMap(smallWeChatDto)), SmallWeChatDto.class);
+
+        return smallWeChats;
+    }
+
+
+
+
+    @Override
+    public int querySmallWeChatsCount(@RequestBody SmallWeChatDto smallWeChatDto) {
+        return smallWeChatServiceDaoImpl.querySmallWeChatsCount(BeanConvertUtil.beanCovertMap(smallWeChatDto));
+    }
+
+    public ISmallWeChatServiceDao getSmallWeChatServiceDaoImpl() {
+        return smallWeChatServiceDaoImpl;
+    }
+
+    public void setSmallWeChatServiceDaoImpl(ISmallWeChatServiceDao smallWeChatServiceDaoImpl) {
+        this.smallWeChatServiceDaoImpl = smallWeChatServiceDaoImpl;
+    }
+
+    public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
+        return userInnerServiceSMOImpl;
+    }
+
+    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
+        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
+    }
+}

+ 128 - 0
docs/document/services/smallWeChat/SaveSmallWeChatInfo.md

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

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

@@ -0,0 +1,100 @@
+package com.java110.dto.smallWeChat;
+
+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 SmallWeChatDto extends PageDto implements Serializable {
+
+    private Date createTime;
+    private String appId;
+    private String name;
+    private String appSecret;
+    private String weChatId;
+    private String storeId;
+    private String payPassword;
+    private String remarks;
+    private String statusCd = "0";
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public String getWeChatId() {
+        return weChatId;
+    }
+
+    public void setWeChatId(String weChatId) {
+        this.weChatId = weChatId;
+    }
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getPayPassword() {
+        return payPassword;
+    }
+
+    public void setPayPassword(String payPassword) {
+        this.payPassword = payPassword;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 109 - 0
java110-bean/src/main/java/com/java110/vo/api/smallWeChat/ApiSmallWeChatDataVo.java

@@ -0,0 +1,109 @@
+package com.java110.vo.api.smallWeChat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ApiSmallWeChatDataVo implements Serializable {
+
+    private String operate;
+    private String createTime;
+    private String appId;
+    private String name;
+    private String appSecret;
+    private String statusCd;
+    private String weChatId;
+    private String bId;
+    private String storeId;
+    private String payPassword;
+    private String remarks;
+
+    public String getOperate() {
+        return operate;
+    }
+
+    public void setOperate(String operate) {
+        this.operate = operate;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+
+    public String getWeChatId() {
+        return weChatId;
+    }
+
+    public void setWeChatId(String weChatId) {
+        this.weChatId = weChatId;
+    }
+
+    public String getBId() {
+        return bId;
+    }
+
+    public void setBId(String bId) {
+        this.bId = bId;
+    }
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getPayPassword() {
+        return payPassword;
+    }
+
+    public void setPayPassword(String payPassword) {
+        this.payPassword = payPassword;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+
+}

+ 19 - 0
java110-bean/src/main/java/com/java110/vo/api/smallWeChat/ApiSmallWeChatVo.java

@@ -0,0 +1,19 @@
+package com.java110.vo.api.smallWeChat;
+
+import com.java110.vo.MorePageVo;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class ApiSmallWeChatVo extends MorePageVo implements Serializable {
+    List<ApiSmallWeChatDataVo> smallWeChats;
+
+
+    public List<ApiSmallWeChatDataVo> getSmallWeChats() {
+        return smallWeChats;
+    }
+
+    public void setSmallWeChats(List<ApiSmallWeChatDataVo> smallWeChats) {
+        this.smallWeChats = smallWeChats;
+    }
+}

+ 30 - 40
java110-code-generator/src/main/resources/back/template_1.json

@@ -1,56 +1,46 @@
 {
-  "id": "returnFeeId",
-  "name": "returnPayFee",
-  "desc": "退费表",
-  "shareParam": "communityId",
-  "shareColumn": "community_id",
-  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_RETURN_PAY_FEE",
-  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_RETURN_PAY_FEE",
-  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_RETURN_PAY_FEE",
-  "newBusinessTypeCdValue": "621100030001",
-  "updateBusinessTypeCdValue": "621100040001",
-  "deleteBusinessTypeCdValue": "621100050001",
-  "businessTableName": "business_return_pay_fee",
-  "tableName": "return_pay_fee",
+  "id": "weChatId",
+  "name": "smallWeChat",
+  "desc": "小程序管理",
+  "shareParam": "store_Id",
+  "shareColumn": "storeId",
+  "newBusinessTypeCd": "BUSINESS_TYPE_SAVE_SMALL_WE_CHAT",
+  "updateBusinessTypeCd": "BUSINESS_TYPE_UPDATE_SMALL_WE_CHAT",
+  "deleteBusinessTypeCd": "BUSINESS_TYPE_DELETE_SMALL_WE_CHAT",
+  "newBusinessTypeCdValue": "210200060001",
+  "updateBusinessTypeCdValue": "210200070001",
+  "deleteBusinessTypeCdValue": "210200080001",
+  "businessTableName": "buiness_small_wechat",
+  "tableName": "small_wechat",
   "param": {
-    "returnFeeId": "return_fee_id",
+    "weChatId": "weChat_id",
     "bId": "bId",
-    "configId": "config_id",
-    "communityId": "community_id",
-    "feeId": "fee_id",
-    "feeTypeCd": "fee_type_cd",
-    "detailId": "detail_id",
-    "cycles": "cycles",
-    "receivableAmount": "receivable_amount",
-    "receivedAmount": "received_amount",
-    "primeRate": "prime_rate",
-    "remark": "remark",
-    "state": "state",
+    "storeId": "store_Id",
+    "name": "name",
+    "appId": "appId",
+    "appSecret": "appSecret",
+    "payPassword": "pay_password",
+    "remarks": "remarks",
     "statusCd": "status_cd",
-    "payTime": "pay_time",
-    "operate": "operate",
-    "reason": "reason"
+    "createTime": "create_time",
+    "operate": "operate"
   },
   "required": [
     {
-      "code": "configId",
-      "msg": "费用项ID不能为空"
+      "code": "name",
+      "msg": "小程序名称不能为空"
     },
     {
-      "code": "feeId",
-      "msg": "feeId不能为空"
+      "code": "appId",
+      "msg": "小程序appId不能为空"
     },
     {
-      "code": "communityId",
-      "msg": "小不能为空"
+      "code": "appSecret",
+      "msg": "小程序appSecret不能为空"
     },
     {
-      "code": "detailId",
-      "msg": "缴费id不能为空"
-    },
-    {
-      "code": "reason",
-      "msg": "退费原因不能为空"
+      "code": "payPassword",
+      "msg": "支付密码不能为空"
     }
   ]
 }

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

@@ -1,127 +1,71 @@
 {
-  "templateName":"旧货",
-  "templateCode":"junkRequirement",
-  "templateKey":"junkRequirementId",
-  "templateKeyName":"旧货编码",
-  "searchCode": "junkRequirementId",
-  "searchName": "旧货编码",
+  "templateName":"小程序管理",
+  "templateCode":"smallWeChat",
+  "templateKey":"weChatId",
+  "templateKeyName":"编码",
+  "searchCode": "name",
+  "searchName": "小程序名称",
   "conditions": [
     {
-      "name": "类别",
-      "inputType": "select",
-      "selectValue":"10001,10002",
-      "selectValueName":"家具,电器",
-      "code": "classification",
-      "whereCondition": "equal"
-    },
-    {
-      "name": "发布人",
+      "name": "小程序名称",
       "inputType": "input",
-      "code": "publishUserName",
+      "code": "name",
       "whereCondition": "equal"
     },
     {
-      "name": "状态",
-      "inputType": "select",
-      "selectValue":"12001,13001,14001,15001",
-      "selectValueName":"未审核,审核通过,审核失败,处理完成",
-      "code": "publishUserLink",
-      "whereCondition": "equal"
-    },
-    {
-      "name": "发布电话",
+      "name": "appId",
       "inputType": "input",
-      "code": "publishUserLink",
+      "code": "appId",
       "whereCondition": "equal"
     }
   ],
   "columns":[
     {
-      "code":"classification",
-      "cnCode":"类别",
-      "desc":"必填,请选择类别",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType": "select",
-      "selectValue":"10001,10002",
-      "selectValueName":"家具,电器",
-      "limit":"num",
-      "limitParam":"",
-      "limitErrInfo":"任务编码格式错误",
-      "show": true
-    },
-    {
-      "code": "inspectionPlanId",
-      "cnCode":"巡检计划",
-      "desc":"必填,请填写收费项目",
+      "code":"name",
+      "cnCode":"小程序名称",
+      "desc":"必填,请填写小程序名称",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
-      "limit":"maxin",
+      "limit":"max",
       "limitParam":"1,100",
-      "limitErrInfo":"收费项目不能超过100位",
+      "limitErrInfo":"小程序名称不能超过100位",
       "show": true
     },
     {
-      "code":"context",
-      "cnCode":"内容",
-      "desc":"必填,请选择内容",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType": "input",
-      "limit":"maxLength",
-      "limitParam":"200",
-      "limitErrInfo":"内容不能超过200个字符",
-      "show": false
-    },
-    {
-      "code": "referencePrice",
-      "cnCode":"参考价格",
-      "desc":"必填,请填写参考价格",
+      "code": "appId",
+      "cnCode":"appId",
+      "desc":"必填,请填写appId",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
-      "limit":"money",
-      "limitParam":"",
-      "limitErrInfo":"参考价格格式错误",
+      "limit":"maxin",
+      "limitParam":"1,100",
+      "limitErrInfo":"appId不能超过100位",
       "show": true
     },
     {
-      "code": "publishUserName",
-      "cnCode":"发布人",
-      "desc":"必填,发布人不能为空",
+      "code":"appSecret",
+      "cnCode":"应用密钥",
+      "desc":"必填,请填写应用密钥",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
-      "limit":"maxLength",
-      "limitParam":"50",
-      "limitErrInfo":"发布人不能超过50",
+      "limit":"maxin",
+      "limitParam":"1,200",
+      "limitErrInfo":"应用密钥不能超过200个字符",
       "show": true
     },
     {
-      "code":"publishUserLink",
-      "cnCode":"联系方式",
-      "desc":"必填,请填写联系方式",
+      "code": "payPassword",
+      "cnCode":"支付密码",
+      "desc":"必填,请填写支付密码",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
-      "limit":"phone",
-      "limitParam":"",
-      "limitErrInfo":"联系方式不是有效的电话格式",
-      "show": true
-    },
-    {
-      "code":"state",
-      "cnCode":"状态",
-      "desc":"必填,请填写状态",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType": "select",
-      "selectValue":"12001,13001,14001,15001",
-      "selectValueName":"未审核,审核通过,审核失败,处理完成",
-      "limit":"num",
-      "limitParam":"",
-      "limitErrInfo":"状态格式错误",
+      "limit":"maxin",
+      "limitParam":"1,200",
+      "limitErrInfo":"支付密码不能超过200个字符",
       "show": true
     }
   ]

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

@@ -126,7 +126,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_fastuserId = "68";
     public static final String CODE_PREFIX_junkRequirementId = "69";
     public static final String CODE_PREFIX_returnFeeId = "70";
-
+    public static final String CODE_PREFIX_weChatId = "71";
 
 
     /**

+ 41 - 0
java110-core/src/main/java/com/java110/core/smo/smallWeChat/ISmallWeChatInnerServiceSMO.java

@@ -0,0 +1,41 @@
+package com.java110.core.smo.smallWeChat;
+
+import com.java110.core.feign.FeignConfiguration;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+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 ISmallWeChatInnerServiceSMO
+ * @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("/smallWeChatApi")
+public interface ISmallWeChatInnerServiceSMO {
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param smallWeChatDto 数据对象分享
+     * @return SmallWeChatDto 对象数据
+     */
+    @RequestMapping(value = "/querySmallWeChats", method = RequestMethod.POST)
+    List<SmallWeChatDto> querySmallWeChats(@RequestBody SmallWeChatDto smallWeChatDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param smallWeChatDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/querySmallWeChatsCount", method = RequestMethod.POST)
+    int querySmallWeChatsCount(@RequestBody SmallWeChatDto smallWeChatDto);
+}

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

@@ -0,0 +1,236 @@
+<?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="smallWeChatServiceDaoImpl">
+
+    <!-- 保存小程序管理信息 add by wuxw 2018-07-03 -->
+    <insert id="saveBusinessSmallWeChatInfo" parameterType="Map">
+        insert into
+            buiness_small_wechat
+            (operate,appId,name,appSecret,weChat_id,b_id,store_Id,pay_password,remarks)
+        values
+            (#{operate},#{appId},#{name},#{appSecret},#{weChatId},#{bId},#{storeId},#{payPassword},#{remarks})
+       </insert>
+
+
+    <!-- 查询小程序管理信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessSmallWeChatInfo" parameterType="Map" resultType="Map">
+        select
+            t.operate,
+            t.create_time,t.create_time createTime,
+            t.appId,
+            t.name,
+            t.appSecret,
+            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,
+            t.remarks
+        from
+            buiness_small_wechat t
+        where 1 =1
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="appId !=null and appId != ''">
+            and t.appId= #{appId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name= #{name}
+        </if>
+        <if test="appSecret !=null and appSecret != ''">
+            and t.appSecret= #{appSecret}
+        </if>
+        <if test="weChatId !=null and weChatId != ''">
+            and t.weChat_id= #{weChatId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_Id= #{storeId}
+        </if>
+        <if test="payPassword !=null and payPassword != ''">
+            and t.pay_password= #{payPassword}
+        </if>
+        <if test="remarks !=null and remarks != ''">
+            and t.remarks= #{remarks}
+        </if>
+
+    </select>
+
+
+    <!-- 保存小程序管理信息至 instance表中 add by wuxw 2018-07-03 -->
+    <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)
+                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
+                from buiness_small_wechat t where 1=1 and t.operate= 'ADD'
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="appId !=null and appId != ''">
+            and t.appId= #{appId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name= #{name}
+        </if>
+        <if test="appSecret !=null and appSecret != ''">
+            and t.appSecret= #{appSecret}
+        </if>
+        <if test="weChatId !=null and weChatId != ''">
+            and t.weChat_id= #{weChatId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_Id= #{storeId}
+        </if>
+        <if test="payPassword !=null and payPassword != ''">
+            and t.pay_password= #{payPassword}
+        </if>
+        <if test="remarks !=null and remarks != ''">
+            and t.remarks= #{remarks}
+        </if>
+
+    </insert>
+
+
+    <!-- 查询小程序管理信息 add by wuxw 2018-07-03 -->
+    <select id="getSmallWeChatInfo" parameterType="Map" resultType="Map">
+        select
+            t.create_time,t.create_time createTime,
+            t.appId,
+            t.name,
+            t.appSecret,
+            t.status_cd,t.status_cd statusCd,
+            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,
+            t.remarks
+        from small_wechat t
+        where 1 =1
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="appId !=null and appId != ''">
+            and t.appId= #{appId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name= #{name}
+        </if>
+        <if test="appSecret !=null and appSecret != ''">
+            and t.appSecret= #{appSecret}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="weChatId !=null and weChatId != ''">
+            and t.weChat_id= #{weChatId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_Id= #{storeId}
+        </if>
+        <if test="payPassword !=null and payPassword != ''">
+            and t.pay_password= #{payPassword}
+        </if>
+        <if test="remarks !=null and remarks != ''">
+            and t.remarks= #{remarks}
+        </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="updateSmallWeChatInfoInstance" parameterType="Map">
+        update small_wechat t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="createTime !=null">
+            , t.create_time= #{createTime}
+        </if>
+        <if test="appId !=null and appId != ''">
+            , t.appId= #{appId}
+        </if>
+        <if test="name !=null and name != ''">
+            , t.name= #{name}
+        </if>
+        <if test="appSecret !=null and appSecret != ''">
+            , t.appSecret= #{appSecret}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_Id= #{storeId}
+        </if>
+        <if test="payPassword !=null and payPassword != ''">
+            , t.pay_password= #{payPassword}
+        </if>
+        <if test="remarks !=null and remarks != ''">
+            , t.remarks= #{remarks}
+        </if>
+        where 1=1
+        <if test="weChatId !=null and weChatId != ''">
+            and t.weChat_id= #{weChatId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+
+    </update>
+
+    <!-- 查询小程序管理数量 add by wuxw 2018-07-03 -->
+    <select id="querySmallWeChatsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from small_wechat t
+        where 1 =1
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="appId !=null and appId != ''">
+            and t.appId= #{appId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name= #{name}
+        </if>
+        <if test="appSecret !=null and appSecret != ''">
+            and t.appSecret= #{appSecret}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="weChatId !=null and weChatId != ''">
+            and t.weChat_id= #{weChatId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_Id= #{storeId}
+        </if>
+        <if test="payPassword !=null and payPassword != ''">
+            and t.pay_password= #{payPassword}
+        </if>
+        <if test="remarks !=null and remarks != ''">
+            and t.remarks= #{remarks}
+        </if>
+
+
+    </select>
+
+</mapper>

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

@@ -197,6 +197,14 @@ public class BusinessTypeConstant {
     public static final String BUSINESS_TYPE_DELETE_PURCHASE_APPLY_DETAIL = "210100080001";
 
 
+    //保存小程序信息
+    public static final String BUSINESS_TYPE_SAVE_SMALL_WE_CHAT = "210200060001";
+    //修改小程序信息
+    public static final String BUSINESS_TYPE_UPDATE_SMALL_WE_CHAT = "210200070001";
+    //删除小程序信息
+    public static final String BUSINESS_TYPE_DELETE_SMALL_WE_CHAT = "210200080001";
+
+
 
 
 

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

@@ -0,0 +1,31 @@
+package com.java110.utils.constant;
+
+/**
+ * 小程序管理常量类
+ * Created by wuxw on 2017/5/20.
+ */
+public class ServiceCodeSmallWeChatConstant {
+
+    /**
+     * 添加 小程序管理
+     */
+    public static final String ADD_SMALL_WE_CHAT = "smallWeChat.saveSmallWeChat";
+
+
+    /**
+     * 修改 小程序管理
+     */
+    public static final String UPDATE_SMALL_WE_CHAT = "smallWeChat.updateSmallWeChat";
+    /**
+     * 删除 小程序管理
+     */
+    public static final String DELETE_SMALL_WE_CHAT = "smallWeChat.deleteSmallWeChat";
+
+
+    /**
+     * 查询 小程序管理
+     */
+    public static final String LIST_SMALL_WE_CHATS = "smallWeChat.listSmallWeChats";
+
+
+}