wuxw
2019-04-23 b933bf8cfb7e0b3d231e7bc721b749fae54e911a
删除feign工程
25个文件已删除
21个文件已修改
2个文件已添加
3982 ■■■■ 已修改文件
CodeService/src/main/java/com/java110/code/api/CodeApi.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CodeService/src/main/java/com/java110/code/rest/CommonServiceRest.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CodeService/src/main/java/com/java110/code/rest/PrimaryKeyServiceRest.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CodeService/src/main/java/com/java110/code/rest/ServiceConfigServiceRest.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LogService/src/main/java/com/java110/log/smo/impl/LogServiceSMOImpl.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LogService/src/test/java/com/java110/log/AppTest.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StoreService/src/main/java/com/java110/store/smo/impl/StoreServiceSMOImpl.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserService/src/main/java/com/java110/user/api/UserApi.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserService/src/main/java/com/java110/user/rest/UserServiceRest.java 373 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserService/src/main/java/com/java110/user/smo/IUserServiceSMO.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserService/src/main/java/com/java110/user/smo/impl/UserServiceSMOImpl.java 771 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebService/src/main/java/com/java110/web/components/floor/ListFloorComponent.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebService/src/main/java/com/java110/web/smo/IFloorServiceSMO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebService/src/main/java/com/java110/web/smo/impl/FloorServiceSMOImpl.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-code-generator/src/main/java/com/java110/code/GeneratorAbstractBussiness.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/ActionTypeConstant.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/AttrCdConstant.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/PrivilegeCodeConstant.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-common/src/main/java/com/java110/common/constant/ResponseConstant.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/pom.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/base/smo/BaseServiceSMO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/context/IPageData.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java 426 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/smo/code/ICodeApi.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/smo/code/IPrimaryKeyInnerServiceSMO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-event/src/main/java/com/java110/event/listener/cust/CustDispatchListener.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-event/src/main/java/com/java110/event/listener/cust/DeleteCustDispatchListener.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/pom.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/App.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/base/CommonServiceFallback.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/base/ICommonService.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/base/IPrimaryKeyService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/base/PrimaryKeyServiceFallback.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/code/CodeApiFallback.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/code/ICodeApi.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/merchant/IMerchantMemberService.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/merchant/IMerchantService.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/merchant/MerchantMemberServiceFallBack.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/merchant/MerchantServiceFallback.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/product/IProductService.java 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/product/ProductServiceFallback.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/test/HystrixClientFallback.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/test/TestFeignHystrixClient.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/user/IUserService.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/main/java/com/java110/feign/user/UserServiceFallback.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-feign/src/test/java/com/java110/feign/AppTest.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-service/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CodeService/src/main/java/com/java110/code/api/CodeApi.java
@@ -10,11 +10,15 @@
import com.java110.core.context.CodeDataFlow;
import com.java110.core.factory.DataFlowFactory;
import com.java110.core.factory.DataTransactionFactory;
import com.java110.feign.code.ICodeApi;
import com.java110.core.smo.code.ICodeApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
@@ -28,25 +32,37 @@
@RestController
public class CodeApi extends BaseController implements ICodeApi {
    protected final static Logger logger = LoggerFactory.getLogger(CodeApi.class);
    protected static Logger logger = LoggerFactory.getLogger(CodeApi.class);
    @Autowired
    IPrimaryKeyServiceSMO primaryKeyServiceSMOImpl;
    /**
     * 生成编码服务器 不支持Get方法请求
     * @param request http 请求对象
     * @return 不支持Get方法请求
     */
    @Deprecated
    @RequestMapping(path = "/codeApi/generate", method = RequestMethod.GET)
    public String generateGet(HttpServletRequest request) {
        return DataTransactionFactory.createCodeResponseJson(ResponseConstant.NO_TRANSACTION_ID, "-1",
                ResponseConstant.RESULT_CODE_ERROR, "不支持Get方法请求").toJSONString();
    }
    /**
     * 生成编码服务器 不支持Get方法请求
     * @param orderInfo 请求信息
     * @param request http 请求对象
     * @return 不支持Get方法请求
     */
    @RequestMapping(path = "/codeApi/generate", method = RequestMethod.POST)
    public String generatePost(@RequestBody String orderInfo, HttpServletRequest request) {
        Map<String, String> headers = new HashMap<String, String>();
        try {
            getRequestInfo(request, headers);
            //预校验
            preValiateOrderInfo(orderInfo, headers);
            preValidateOrderInfo(orderInfo, headers);
            CodeDataFlow dataFlow = DataFlowFactory.newInstance(CodeDataFlow.class).builder(orderInfo, null);
            primaryKeyServiceSMOImpl.generateCode(dataFlow);
            return dataFlow.getResJson().toJSONString();
@@ -59,9 +75,9 @@
    /**
     * 获取请求信息
     *
     * @param request
     * @param headers
     * @throws RuntimeException
     * @param request 请求信息封装
     * @param headers 请求头信息
     * @throws Exception 处理数据失败会返回Exception异常
     */
    private void getRequestInfo(HttpServletRequest request, Map headers) throws Exception {
        try {
@@ -76,9 +92,10 @@
    /**
     * 这里预校验,请求报文中不能有 dataFlowId
     *
     * @param orderInfo
     * @param orderInfo 请求信息封装
     * @param headers  请求头信息
     */
    private void preValiateOrderInfo(String orderInfo, Map<String, String> headers) {
    private void preValidateOrderInfo(String orderInfo, Map<String, String> headers) {
        Assert.jsonObjectHaveKey(orderInfo, "prefix", "没有包含prefix");
@@ -102,7 +119,7 @@
     * @return
     */
    @Override
    @RequestMapping(value = "/codeApi/generateCode",method = RequestMethod.POST)
    @RequestMapping(value = "/codeApi/generateCode", method = RequestMethod.POST)
    public String generateCode(@RequestParam("prefix") String prefix) {
        try {
CodeService/src/main/java/com/java110/code/rest/CommonServiceRest.java
File was deleted
CodeService/src/main/java/com/java110/code/rest/PrimaryKeyServiceRest.java
File was deleted
CodeService/src/main/java/com/java110/code/rest/ServiceConfigServiceRest.java
File was deleted
LogService/src/main/java/com/java110/log/smo/impl/LogServiceSMOImpl.java
@@ -1,13 +1,11 @@
package com.java110.log.smo.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.exception.GenerateCodeException;
import com.java110.common.log.LoggerEngine;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.feign.code.ICodeApi;
import com.java110.core.smo.code.ICodeApi;
import com.java110.log.dao.LogServiceDao;
import com.java110.log.smo.ILogServiceSMO;
import org.slf4j.Logger;
@@ -16,9 +14,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.rmi.NoSuchObjectException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +25,7 @@
@Transactional
public class LogServiceSMOImpl extends BaseServiceSMO implements ILogServiceSMO {
    private final static Logger logger = LoggerFactory.getLogger(LogServiceSMOImpl.class);
    private static Logger logger = LoggerFactory.getLogger(LogServiceSMOImpl.class);
    @Autowired
    private ICodeApi codeApi;
@@ -40,23 +35,24 @@
    /**
     * 保存日志信息
     *
     * @param logMessage 需要保存的日志信息
     */
    @Override
    public void saveLogMessage(String logMessage) {
        logger.debug("received log message : {}" ,logMessage);
        logger.debug("received log message : {}", logMessage);
        try{
        try {
            doSaveLogMessage(logMessage);
        }catch (Exception e){
            logger.error("save log message error :",e);
        } catch (Exception e) {
            logger.error("save log message error :", e);
        }
    }
    /**
     *
     * @param logMessage 需要保存的日志信息
     * @throws Exception 异常信息
     */
    private void doSaveLogMessage(String logMessage) throws Exception {
@@ -65,13 +61,13 @@
        validateLogMessage(logMessageObj);
        // 调用服务生成log_id
        String log_id = GenerateCodeFactory.getInnerTransactionId();
        String logId = GenerateCodeFactory.getInnerTransactionId();
        //String log_id = codeApi.generateCode("1000001");
        // 封装日志保存参数
        Map logMessageParams= new HashMap();
        logMessageParams.put("logId",log_id);
        builderLogMessageParams(logMessageParams,logMessageObj);
        Map logMessageParams = new HashMap();
        logMessageParams.put("logId", logId);
        builderLogMessageParams(logMessageParams, logMessageObj);
        //保存日志
        logServiceDaoImpl.saveTransactionLog(logMessageParams);
@@ -82,9 +78,12 @@
    /**
     * 封装日志保存参数
     *
     * @param logMessageParams 日志保存参数
     * @param logMessageObj 日志消息对象
     * @throws Exception 异常信息
     */
    private void builderLogMessageParams(Map logMessageParams,JSONObject logMessageObj) throws Exception{
    private void builderLogMessageParams(Map logMessageParams, JSONObject logMessageObj) throws Exception {
        logMessageParams.putAll(logMessageObj);
        //#{requestHeader},#{responseHeader},#{requestMessage},#{responseMessage},#{remark}
@@ -94,39 +93,40 @@
        JSONObject requestMessageObj = JSONObject.parseObject(requestMessage);
        JSONObject responseMessageObj = JSONObject.parseObject(responseMessage);
        logMessageParams.put("requestHeader",requestMessageObj.getString("headers"));
        logMessageParams.put("requestMessage",requestMessageObj.getString("body"));
        logMessageParams.put("responseHeader",responseMessageObj.getString("headers"));
        logMessageParams.put("responseMessage",responseMessageObj.getString("body"));
        logMessageParams.put("requestHeader", requestMessageObj.getString("headers"));
        logMessageParams.put("requestMessage", requestMessageObj.getString("body"));
        logMessageParams.put("responseHeader", responseMessageObj.getString("headers"));
        logMessageParams.put("responseMessage", responseMessageObj.getString("body"));
        logMessageParams.put("timestamp", DateUtil.getDefaultDateFromString(logMessageObj.getString("timestamp")));
        logMessageParams.put("month",DateUtil.getCurrentMonth());
        logMessageParams.put("month", DateUtil.getCurrentMonth());
    }
    /**
     * 校验 日志报文 必填节点是否存在
     *
     * @param logMessageObj JSON 化的日志信息
     */
    private void validateLogMessage(JSONObject logMessageObj){
    private void validateLogMessage(JSONObject logMessageObj) {
        Assert.hasKeyAndValue(logMessageObj,"transactionId","can not find transactionId node or transactionId is null");
        Assert.hasKeyAndValue(logMessageObj, "transactionId", "can not find transactionId node or transactionId is null");
        Assert.hasKeyAndValue(logMessageObj,"dataFlowId","can not find dataFlowId node or dataFlowId is null");
        Assert.hasKeyAndValue(logMessageObj, "dataFlowId", "can not find dataFlowId node or dataFlowId is null");
        Assert.hasKeyAndValue(logMessageObj,"ip","can not find ip node or ip is null");
        Assert.hasKeyAndValue(logMessageObj, "ip", "can not find ip node or ip is null");
        Assert.hasKeyAndValue(logMessageObj,"port","can not find port node or port is null");
        Assert.hasKeyAndValue(logMessageObj, "port", "can not find port node or port is null");
        Assert.hasKeyAndValue(logMessageObj,"appId","can not find appId node or appId is null");
        Assert.hasKeyAndValue(logMessageObj, "appId", "can not find appId node or appId is null");
        Assert.hasKeyAndValue(logMessageObj,"timestamp","can not find timestamp node or timestamp is null");
        Assert.hasKeyAndValue(logMessageObj, "timestamp", "can not find timestamp node or timestamp is null");
        Assert.hasKeyAndValue(logMessageObj,"logStatus","can not find logStatus node or logStatus is null");
        Assert.hasKeyAndValue(logMessageObj, "logStatus", "can not find logStatus node or logStatus is null");
        Assert.hasKey(logMessageObj,"requestMessage","can not find requestMessage node ");
        Assert.hasKey(logMessageObj, "requestMessage", "can not find requestMessage node ");
        Assert.hasKey(logMessageObj,"responseMessage","can not find responseMessage node ");
        Assert.hasKey(logMessageObj, "responseMessage", "can not find responseMessage node ");
    }
    public ICodeApi getCodeApi() {
LogService/src/test/java/com/java110/log/AppTest.java
@@ -1,6 +1,5 @@
package com.java110.log;
import com.java110.feign.code.ICodeApi;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
StoreService/src/main/java/com/java110/store/smo/impl/StoreServiceSMOImpl.java
@@ -2,41 +2,28 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.java110.common.cache.MappingCache;
import com.java110.common.constant.KafkaConstant;
import com.java110.common.constant.MappingConstant;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.constant.StateConstant;
import com.java110.common.exception.SMOException;
import com.java110.common.kafka.KafkaFactory;
import com.java110.common.log.LoggerEngine;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
import com.java110.common.util.ProtocolUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.core.context.BusinessServiceDataFlow;
import com.java110.core.factory.DataFlowFactory;
import com.java110.entity.center.DataFlowLinksCost;
import com.java110.entity.center.DataFlowLog;
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 com.java110.entity.order.BusiOrder;
import com.java110.event.service.BusinessServiceDataFlowEventPublishing;
import com.java110.feign.base.IPrimaryKeyService;
import com.java110.store.dao.IStoreServiceDao;
import com.java110.store.smo.IStoreServiceSMO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.Date;
import java.util.List;
/**
 * 用户服务信息管理业务信息实现
@@ -46,78 +33,80 @@
@Transactional
public class StoreServiceSMOImpl extends BaseServiceSMO implements IStoreServiceSMO {
    private final static Logger logger = LoggerFactory.getLogger(StoreServiceSMOImpl.class);
    private static Logger logger = LoggerFactory.getLogger(StoreServiceSMOImpl.class);
        @Override
        public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
            try {
                Assert.hasLength(businessServiceDataFlow.getbId(),"bId 不能为空");
    @Override
    public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
        try {
            Assert.hasLength(businessServiceDataFlow.getbId(), "bId 不能为空");
                BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
                Assert.notEmpty(businessServiceDataFlow.getResJson(),"用户服务["+businessServiceDataFlow.getBusinessType()+"]没有返回内容");
            } catch (Exception e) {
                logger.error("用户信息处理异常",e);
                throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR,"用户信息处理异常"+e.getMessage());
            }finally {
                if(businessServiceDataFlow == null){
                    return null;
                }
                //这里记录日志
                Date endDate = DateUtil.getCurrentDate();
                businessServiceDataFlow.setEndDate(endDate);
                //添加耗时
                DataFlowFactory.addCostTime(businessServiceDataFlow, "service", "业务处理总耗时",
                        businessServiceDataFlow.getStartDate(), businessServiceDataFlow.getEndDate());
                //保存耗时
                saveCostTimeLogMessage(businessServiceDataFlow);
                //保存日志
                saveLogMessage(businessServiceDataFlow);
            BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
            Assert.notEmpty(businessServiceDataFlow.getResJson(), "用户服务[" + businessServiceDataFlow.getBusinessType() + "]没有返回内容");
        } catch (Exception e) {
            logger.error("用户信息处理异常", e);
            throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR, "用户信息处理异常" + e.getMessage());
        } finally {
            if (businessServiceDataFlow == null) {
                return null;
            }
            return businessServiceDataFlow.getResJson();
            //这里记录日志
            Date endDate = DateUtil.getCurrentDate();
            businessServiceDataFlow.setEndDate(endDate);
            //添加耗时
            DataFlowFactory.addCostTime(businessServiceDataFlow, "service", "业务处理总耗时",
                    businessServiceDataFlow.getStartDate(), businessServiceDataFlow.getEndDate());
            //保存耗时
            saveCostTimeLogMessage(businessServiceDataFlow);
            //保存日志
            saveLogMessage(businessServiceDataFlow);
        }
        return businessServiceDataFlow.getResJson();
    }
    /**
     * 保存日志信息
     * @param businessServiceDataFlow
     *
     * @param businessServiceDataFlow 保存日志对象
     */
    private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
    private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
        try{
            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))){
                for(DataFlowLog dataFlowLog :businessServiceDataFlow.getLogDatas()) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))) {
                for (DataFlowLog dataFlowLog : businessServiceDataFlow.getLogDatas()) {
                    KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME, "", JSONObject.toJSONString(dataFlowLog));
                }
            }
        }catch (Exception e){
            logger.error("报错日志出错了,",e);
        } catch (Exception e) {
            logger.error("报错日志出错了,", e);
        }
    }
    /**
     * 保存耗时信息
     * @param businessServiceDataFlow
     *
     * @param businessServiceDataFlow 保存耗时对象
     */
    private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
        try{
            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))){
    private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
                List<DataFlowLinksCost> dataFlowLinksCosts = businessServiceDataFlow.getLinksCostDates();
                JSONObject costDate = new JSONObject();
                JSONArray costDates = new JSONArray();
                JSONObject newObj = null;
                for(DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts){
                for (DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts) {
                    newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
                    newObj.put("dataFlowId",businessServiceDataFlow.getDataFlowId());
                    newObj.put("transactionId",businessServiceDataFlow.getTransactionId());
                    newObj.put("dataFlowId", businessServiceDataFlow.getDataFlowId());
                    newObj.put("transactionId", businessServiceDataFlow.getTransactionId());
                    costDates.add(newObj);
                }
                costDate.put("costDates",costDates);
                costDate.put("costDates", costDates);
                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME,"",costDate.toJSONString());
                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME, "", costDate.toJSONString());
            }
        }catch (Exception e){
            logger.error("报错日志出错了,",e);
        } catch (Exception e) {
            logger.error("报错日志出错了,", e);
        }
    }
}
UserService/src/main/java/com/java110/user/api/UserApi.java
@@ -2,12 +2,11 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.exception.BusinessException;
import com.java110.common.exception.InitConfigDataException;
import com.java110.common.exception.InitDataFlowContextException;
import com.java110.core.base.controller.BaseController;
import com.java110.core.context.BusinessServiceDataFlow;
import com.java110.core.factory.DataTransactionFactory;
import com.java110.core.base.controller.BaseController;
import com.java110.user.smo.IUserServiceSMO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,23 +27,29 @@
@RestController
public class UserApi extends BaseController {
    private final static Logger logger = LoggerFactory.getLogger(UserApi.class);
    private static Logger logger = LoggerFactory.getLogger(UserApi.class);
    @Autowired
    IUserServiceSMO userServiceSMOImpl;
    @RequestMapping(path = "/userApi/service",method= RequestMethod.GET)
    /**
     *
     * @param request 页面信息封装
     * @return
     */
    @RequestMapping(path = "/userApi/service", method = RequestMethod.GET)
    public String serviceGet(HttpServletRequest request) {
        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"不支持Get方法请求").toJSONString();
        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR, "不支持Get方法请求").toJSONString();
    }
    /**
     * 用户服务统一处理接口
     *
     * @param orderInfo
     * @param request
     * @return
     */
    @RequestMapping(path = "/userApi/service",method= RequestMethod.POST)
    @RequestMapping(path = "/userApi/service", method = RequestMethod.POST)
    public String servicePost(@RequestBody String orderInfo, HttpServletRequest request) {
        BusinessServiceDataFlow businessServiceDataFlow = null;
        JSONObject responseJson = null;
@@ -55,17 +60,17 @@
            preValiateOrderInfo(orderInfo);
            businessServiceDataFlow = this.writeDataToDataFlowContext(orderInfo, headers);
            responseJson = userServiceSMOImpl.service(businessServiceDataFlow);
        }catch (InitDataFlowContextException e){
            logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败"+orderInfo,e);
            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
        }catch (InitConfigDataException e){
            logger.error("请求报文错误,加载配置信息失败"+orderInfo,e);
            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow,ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e,
        } catch (InitDataFlowContextException e) {
            logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败" + orderInfo, e);
            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
        } catch (InitConfigDataException e) {
            logger.error("请求报文错误,加载配置信息失败" + orderInfo, e);
            responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
        } catch (Exception e) {
            logger.error("请求订单异常", e);
            responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow, ResponseConstant.RESULT_CODE_ERROR, e.getMessage() + e,
                    null);
        }finally {
        } finally {
            return responseJson.toJSONString();
        }
    }
@@ -73,6 +78,7 @@
    /**
     * 这里预校验,请求报文中不能有 dataFlowId
     *
     * @param orderInfo
     */
    private void preValiateOrderInfo(String orderInfo) {
@@ -83,17 +89,18 @@
    /**
     * 获取请求信息
     *
     * @param request
     * @param headers
     * @throws RuntimeException
     */
    private void getRequestInfo(HttpServletRequest request,Map headers) throws Exception{
        try{
            super.initHeadParam(request,headers);
            super.initUrlParam(request,headers);
        }catch (Exception e){
            logger.error("加载头信息失败",e);
            throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR,"加载头信息失败");
    private void getRequestInfo(HttpServletRequest request, Map headers) throws Exception {
        try {
            super.initHeadParam(request, headers);
            super.initUrlParam(request, headers);
        } catch (Exception e) {
            logger.error("加载头信息失败", e);
            throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR, "加载头信息失败");
        }
    }
UserService/src/main/java/com/java110/user/rest/UserServiceRest.java
File was deleted
UserService/src/main/java/com/java110/user/smo/IUserServiceSMO.java
@@ -16,86 +16,6 @@
 */
public interface IUserServiceSMO {
    /**
     * 新建用户
     * @param userInfoJson
     * @return
     */
    public String saveUser(String userInfoJson) throws Exception;
    /**
     * 所有服务类(增删改查用户)
     * @param userInfoJson
     * @return
     */
    public String soUserService(JSONObject userInfoJson) throws Exception;
    /**
     * 所有服务类(增删改查用户)
     * @param userInfoJson
     * @return
     */
    public String soUserServiceForOrderService(JSONObject userInfoJson) throws Exception;
    /**
     * 客户信息处理
     * 协议:
     *{
     *     boCust:[{},{}]
     * }
     * @param boCusts
     * @return
     * @throws Exception
     */
    public String soBoCust(String boCusts) throws Exception;
    /**
     * 客户信息属性处理
     * 协议:
     *{
     *     boCustAttr:[{},{}]
     * }
     * @param boCustAttrs
     * @return
     * @throws Exception
     */
    public String soBoCustAttr(String boCustAttrs) throws Exception;
    /**
     * 作废客户信息
     * [{},{},{}]
     * @param datas
     * @return
     * @throws Exception
     */
    public String soDeleteCustInfo(JSONArray datas) throws Exception;
    /**
     * 查询客户信息
     * 包括 基本信息cust 和 属性信息 custAttr
     * @param cust
     * @return
     * @throws Exception
     */
    public String queryCust(Cust cust) throws Exception;
    /**
     * 根据olID查询用户信息
     * @param busiOrder
     * @return
     * @throws Exception
     */
    public String queryCustInfoByOlId(String busiOrder) throws Exception;
    /**
     * 根据购物车信息查询 需要作废的发起的报文
     * @param busiOrder
     * @return
     * @throws Exception
     */
    public String queryNeedDeleteCustInfoByOlId(String busiOrder) throws Exception;
    public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException;
UserService/src/main/java/com/java110/user/smo/impl/UserServiceSMOImpl.java
@@ -16,9 +16,7 @@
import com.java110.common.util.ProtocolUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.core.context.BusinessServiceDataFlow;
import com.java110.core.context.DataFlow;
import com.java110.core.factory.DataFlowFactory;
import com.java110.core.factory.DataTransactionFactory;
import com.java110.entity.center.DataFlowLinksCost;
import com.java110.entity.center.DataFlowLog;
import com.java110.entity.order.BusiOrder;
@@ -27,7 +25,6 @@
import com.java110.entity.user.Cust;
import com.java110.entity.user.CustAttr;
import com.java110.event.service.BusinessServiceDataFlowEventPublishing;
import com.java110.feign.base.IPrimaryKeyService;
import com.java110.user.dao.IUserServiceDao;
import com.java110.user.smo.IUserServiceSMO;
import org.apache.commons.lang3.StringUtils;
@@ -38,7 +35,11 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 用户服务信息管理业务信息实现
@@ -48,733 +49,34 @@
@Transactional
public class UserServiceSMOImpl extends BaseServiceSMO implements IUserServiceSMO {
    private final static Logger logger = LoggerFactory.getLogger(UserServiceSMOImpl.class);
    private  static Logger logger = LoggerFactory.getLogger(UserServiceSMOImpl.class);
    //@Autowired
    IPrimaryKeyService iPrimaryKeyService;
    @Autowired
    IUserServiceDao iUserServiceDao;
    //新增用户
    private final static String USER_ACTION_ADD = "ADD";
    private static final String USER_ACTION_ADD = "ADD";
    //新增用户
    private final static String USER_ACTION_KIP = "KIP";
    private static final String USER_ACTION_KIP = "KIP";
    //新增用户
    private final static String USER_ACTION_DEL = "DEL";
    /**
     * 保存用户信息
     *
     * @param userInfoJson 入参为用户信息json传
     * @return
     */
    public String saveUser(String userInfoJson) throws Exception{
        JSONObject reqUserJSON = null;
        try {
            reqUserJSON = this.simpleValidateJSON(userInfoJson);
            //boCust增加Action (动作)
            if (reqUserJSON.containsKey("boCust")) {
                JSONObject boCust = reqUserJSON.getJSONObject("boCust");
                boCust.put("state", USER_ACTION_ADD);
            }
            //boCustAttr增加Action(动作)
            if (reqUserJSON.containsKey("boCustAttr")) {
                JSONArray boCustAttrs = reqUserJSON.getJSONArray("boCustAttr");
                for (int attrIndex = 0; attrIndex < boCustAttrs.size(); attrIndex++) {
                    JSONObject boCustAttr = boCustAttrs.getJSONObject(attrIndex);
                    boCustAttr.put("state", USER_ACTION_ADD);
                }
            }
        } catch (RuntimeException e) {
            //返回异常信息
            return e.getMessage();
        }
        return soUserService(reqUserJSON);
    }
    /**
     * 所有服务处理类
     * {
     *
     *     'boCust':[{}],
     *     'boCustAttr':[{}]
     * }
     *
     * 返回报文:
     *
     * {'RESULT_CODE':'0000','RESULT_MSG':'成功','RESULT_INFO':{'custId':'7000123,718881991'}}
     * @param userInfoJson
     * @return
     */
    public String soUserService(JSONObject userInfoJson) throws Exception{
        LoggerEngine.debug("用户服务操作客户入参:" + userInfoJson);
        JSONObject paramJson = new JSONObject();
        JSONObject resultInfo = null;
        //存放生成的custId 主键为 custId-1 71000010100
        Map custIdKey = new HashMap();
        if (userInfoJson == null){
            throw new IllegalArgumentException("soUserService 入参 为空"+userInfoJson);
        }
            // 客户信息处理 处理boCust节点
            doProcessBoCust(userInfoJson, paramJson, custIdKey, resultInfo);
            //客户属性信息处理 处理boCustAttr节点
            doProcessBoCustAttr(userInfoJson, paramJson, custIdKey, resultInfo);
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",resultInfo);
    }
    /**
     *
     * 请求报文为:
     *
     * {
     "data": [
     {
     "actionTypeCd": "C1",
     "boCust": [{},{}],
     "boCustAttr": [{ }, {}]
     },
     {
     "actionTypeCd": "C1",
     "boCust": [{},{}],
     "boCustAttr": [{ }, {}]
     }
     ]
     }
     返回报文 :
     { 'RESULT_CODE': '0000', 'RESULT_MSG': '成功', 'RESULT_INFO': {'cust':[{'oldCustId':'-1','custId':'12345678'},{'oldCustId':'-2','custId':'12345678'}]} }
     * @param userInfoJson
     * @return
     * @throws Exception
     */
    @Override
    public String soUserServiceForOrderService(JSONObject userInfoJson) throws Exception {
        Assert.isNotNull(userInfoJson,"data","请求报文缺少 data 节点,请检查");
        JSONArray custInfos = userInfoJson.getJSONArray("data");
        Assert.isNull(custInfos,"请求报文中data节点,没有子节点,data子节点应该为JSONArray,custInfos="+custInfos);
        JSONObject custInfoJ = new JSONObject();
        JSONArray resultCustIdArray = new JSONArray();
        for(int custInfoIndex = 0 ;custInfoIndex < custInfos.size();custInfoIndex ++){
            JSONObject custInfoJson = custInfos.getJSONObject(custInfoIndex);
            String soUserServiceResult = this.soUserService(custInfoJson);
            JSONObject resultInfo = new JSONObject();
            if(!ProtocolUtil.validateReturnJson(soUserServiceResult,resultInfo)){
                throw new RuntimeException("客户信息受理失败,原因为:"+resultInfo.getString(ProtocolUtil.RESULT_MSG));
            }
            if(resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO) != null
                    && resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO).containsKey("custId")) {
                String custIds = custInfoJ.getString("custId");
//                custIds += "," + resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO).getString("custId");
//                custIds = custIds.startsWith(",") && custIds.length()>1 ? custIds.substring(1,custIds.length()):custIds;
                //custInfoJ.put("custId", custIds);
                JSONArray boCusts = custInfoJson.getJSONArray("boCust");
                Object custIdObj = JSONPath.eval(custInfoJson,"$.boCust[custId < '0'][0].custId");
                if(StringUtils.isNotBlank(custIds) && !ObjectUtils.isEmpty(custIdObj)) {
                    String[] allNewCustIds = custIds.split(",");
                    JSONObject newCustIdJson = null;
                    for (String custId : allNewCustIds) {
                        newCustIdJson = new JSONObject();
                        newCustIdJson.put("oldCustId",custIdObj);
                        newCustIdJson.put("custId",custId);
                        resultCustIdArray.add(newCustIdJson);
                    }
                }
            }
        }
        custInfoJ.put("cust",resultCustIdArray);
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",custInfoJ);
    }
    /**
     * {
     *     boCust:[{},{}]
     * }
     * 客户信心处理
     *
     *
     * @param boCusts
     * @return 成功 会带上处理客户的客户ID
     * {'RESULT_CODE':'0000','RESULT_MSG':'成功','RESULT_INFO':{'custId':'7000123,718881991'}}
     * @throws Exception
     */
    public String soBoCust(String boCusts) throws Exception{
        return soBoCust(boCusts,null);
    }
    /**
     * 将生成的custId 封装在map中返回
     * ...
     * custIdKey.put("custId-1","710020404040");
     *
     * ...
     *
     * key 为 custId 加原前的值
     *
     * custIdKey 如果为空不做处理
     * @param boCusts 客户信息
     * @param custIdKey custIdKeymap
     * @return
     * @throws Exception
     */
    public String soBoCust(String boCusts,Map custIdKey) throws Exception{
        // 将 jsonArray 转为list<BoCust> 对象
        JSONObject jsonObject = JSONObject.parseObject(boCusts);
        JSONObject resultInfo = new JSONObject();
        String custIds = "";
        List<BoCust> boCustList = JSONObject.parseArray(jsonObject.getJSONArray("boCust").toJSONString(), BoCust.class);
        Collections.sort(boCustList);
        //保存数据
        for(BoCust boCust : boCustList){
//        for(int boCustIndex = 0 ; boCustIndex < boCustList.size();boCustIndex++){
//            BoCust boCust = boCustList.get(boCustIndex);
            String custId = boCust.getBoId();
            //如果客户ID小于0 ,则自己生成客户ID,这个只有在有 主键生成服务时使用,否则为了防止出错,需要前段调用时需要生成custId
            if(StringUtils.isBlank(custId) || custId.startsWith("-") ){
                /*JSONObject data = new JSONObject();
                data.put("type","CUST_ID");
                //要求接口返回 {"RESULT_CODE":"0000","RESULT_INFO":{"user_id":"7020170411000041"},"RESULT_MSG":"成功"}
                String custIdJSONStr = iPrimaryKeyService.queryPrimaryKey(data.toJSONString());
                JSONObject custIdJSONTmp = JSONObject.parseObject(custIdJSONStr);
                if(custIdJSONTmp.containsKey("RESULT_CODE")
                        && ProtocolUtil.RETURN_MSG_SUCCESS.equals(custIdJSONTmp.getString("RESULT_CODE"))
                        && custIdJSONTmp.containsKey("RESULT_INFO")){
                    //从接口生成custId
                    custId = NumberUtils.toInt(custIdJSONTmp.getJSONObject("RESULT_INFO").getString("CUST_ID"),-1);
                }*/
                custId = this.queryPrimaryKey(iPrimaryKeyService,"CUST_ID");
                //将 新生成的custId保存至 map中 custId-1 custId-2 主键方式存入
                if(custIdKey != null){
                    custIdKey.put("custId"+boCust.getCustId(),custId);
                }
            }
            boCust.setCustId(custId);
            //保存数据至 bo_cust 表中
            int saveBoCustFlag = iUserServiceDao.saveDataToBoCust(boCust);
            if(saveBoCustFlag < 1){ // 如果没有保存成功,抛出异常,有事物 回退事物
                throw new RuntimeException("保存过程[bo_cust]数据失败,印象记录数为"+saveBoCustFlag+",boCust : "+boCust);
            }
            //建档 处理 实例数据
            int saveCustFlag = 0;
            if("ADD".equals(boCust.getState())){
               /* List<BoCust> boCustsTmp = boCustList;
                //在增加之间首先要判断是否有相应删的动作
//                for(BoCust boCustTmp : boCustsTmp){
                for(int boCustTmpIndex = boCustIndex+1;boCustTmpIndex < boCustsTmp.size();boCustTmpIndex++){
                    BoCust boCustTmp = boCustsTmp.get(boCustTmpIndex);
                    if(StringUtils.isNotBlank(boCust.getCustId())
                            && boCust.getCustId().equals(boCustTmp.getCustId())
                            &&"DEL".equals(boCustTmp.getState())){
                        //先调用删除客户信息
                        saveCustFlag = iUserServiceDao.deleteDataToCust(boCust.convert());
                        if(saveCustFlag < 1){
                            throw new RuntimeException("删除实例[cust]数据失败,影响记录数为"+saveCustFlag+", cust : "+boCust.convert());
                        }
                        //则把已经删除过的从list中删除,以防重复删除
                        boCustList.remove(boCustTmp);
                    }
                }*/
                saveCustFlag  = iUserServiceDao.saveDataToCust(boCust.convert());
            }else if("DEL".equals(boCust.getState())){
                saveCustFlag = iUserServiceDao.deleteDataToCust(boCust.convert());
            }else if("KIP".equals(boCust.getState())){
                //按理这里到不了,KIP表示实例数据不变,所以这里默认写成1 认为是成功
                saveCustFlag = 1;
            }else{
                //这里单独抛出异常,不走下面统一异常抛出,是为了说明更具体点
                throw new RuntimeException("入参错误boCust 的 state 目前只支持 [ADD,DEL,KIP] , boCust : " +boCust);
            }
            if(saveCustFlag < 1){
                throw new RuntimeException("保存实例[cust]数据失败,影响记录数为"+saveCustFlag+", cust : "+boCust.convert());
            }
            custIds +=","+custId;
        }
        //去除第一个逗号
        if (custIds.length()>0){
            custIds = custIds.substring(1);
        }
        resultInfo.put("custId",custIds);
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",resultInfo);
    }
    /**
     * 注意在调用这个接口时,相应的客户信息必须存在
     *
     *
     * 客户信息属性处理
     * 协议:
     *{
     *     boCustAttr:[{},{}]
     * }
     * @param boCustAttrs
     * @return
     * @throws Exception
     */
    @Override
    public String soBoCustAttr(String boCustAttrs) throws Exception {
        //这里可以加入基本客户信息是否存在的校验,暂时没有必要实现
        // 将 jsonArray 转为list<BoCust> 对象
        JSONObject jsonObject = JSONObject.parseObject(boCustAttrs);
        List<BoCustAttr> boCustAttrList = JSONObject.parseArray(jsonObject.getJSONArray("boCustAttr").toJSONString(), BoCustAttr.class);
        //先拍个序 先处理DEL 再处理ADD
        Collections.sort(boCustAttrList);
        //保存数据
        for(BoCustAttr boCustAttr : boCustAttrList) {
            //保存数据至 bo_cust_attr 表中
            int saveBoCustAttrFlag = iUserServiceDao.saveDataToBoCustAttr(boCustAttr);
            if(saveBoCustAttrFlag < 1){ // 如果没有保存成功,抛出异常,有事物 回退事物
                throw new RuntimeException("保存过程[bo_cust_attr]数据失败,印象记录数为"+saveBoCustAttrFlag+",boCustAttr : "+boCustAttr);
            }
            //建档 处理 实例数据
            int saveCustAttrFlag = 0;
            if("ADD".equals(boCustAttr.getState())){
                saveCustAttrFlag  = iUserServiceDao.saveDataToCustAttr(boCustAttr.convert());
            }else if("DEL".equals(boCustAttr.getState())){
                saveCustAttrFlag = iUserServiceDao.deleteDataToCustAttr(boCustAttr.convert());
            }else if("KIP".equals(boCustAttr.getState())){
                //按理这里到不了,KIP表示实例数据不变,所以这里默认写成1 认为是成功
                saveCustAttrFlag = 1;
            }else{
                //这里单独抛出异常,不走下面统一异常抛出,是为了说明更具体点
                throw new RuntimeException("入参错误boCustAttr 的 state 目前只支持 [ADD,DEL,KIP] , boCust : " +boCustAttr);
            }
            if(saveCustAttrFlag < 1){
                throw new RuntimeException("保存实例[cust_attr]数据失败,影响记录数为"+saveCustAttrFlag+", cust : "+boCustAttr.convert());
            }
        }
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",null);
    }
    /**
     * 作废客户信息
     * [{},{},{}]
     *
     * @param datas
     * @return
     * @throws Exception
     */
    @Override
    public String soDeleteCustInfo(JSONArray datas) throws Exception {
        Assert.isNull(datas,"传入的data节点下没有任何内容");
        for(int boIdIndex = 0 ; boIdIndex < datas.size(); boIdIndex++){
            JSONObject data = datas.getJSONObject(boIdIndex);
            Assert.isNotNull(data,"boId","当前节点中没有包含boId节点格式错误"+data);
            // 复原Cust
            doDeleteBoCust(data);
            // 复原CustAttr
            doDeleteBoCustAttr(data);
        }
        return null;
    }
    /**
     * 查询客户信息
     * 包括 基本信息cust 和 属性信息 custAttr
     * @param cust
     * @return
     * @throws Exception
     */
    public String queryCust(Cust cust) throws Exception{
        LoggerEngine.debug("客户信息查询入参:" + cust);
        if(cust == null || StringUtils.isBlank(cust.getCustId()) ){
            throw new IllegalArgumentException("客户信息查询入参为空,custId 为空 "+cust);
        }
        Cust newCust = iUserServiceDao.queryDataToCust(cust);
        if(newCust == null){
            return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_ERROR,"未找到用户信息",null);
        }
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",JSONObject.parseObject(JSONObject.toJSONString(newCust)));
    }
    /**
     * 根据olID查询客户信息
     * @param busiOrderStr
     * @return
     * @throws Exception
     */
    public String queryCustInfoByOlId(String busiOrderStr) throws Exception{
        return doQueryCustInfoByOlId(busiOrderStr,false);
    }
    /**
     * 根据olID查询客户信息 需要作废的发起的报文
     * @param busiOrderStr
     * @return
     * @throws Exception
     */
    public String queryNeedDeleteCustInfoByOlId(String busiOrderStr) throws Exception{
        return doQueryCustInfoByOlId(busiOrderStr,true);
    }
    /**
     * 查询客户订单信息
     * @param busiOrderStr 订单项信息
     * @param isNeedDelete 是否是撤单报文 true 查询撤单报文 false
     * @return
     * @throws Exception
     */
    private String doQueryCustInfoByOlId(String busiOrderStr,Boolean isNeedDelete) throws Exception{
        BusiOrder busiOrder = JSONObject.parseObject(busiOrderStr, BusiOrder.class);
        if(busiOrder == null || "".equals(busiOrder.getOlId())){
            throw new IllegalArgumentException("客户信息查询入参为空,olId 为空 "+busiOrderStr);
        }
        Cust cust = new Cust();
        cust.setVersionId(busiOrder.getOlId());
        //根据版本ID查询实例数据
        Cust newCust = iUserServiceDao.queryDataToCust(cust);
        JSONObject returnJson = JSONObject.parseObject("{'data':{}}");
        if(newCust == null){
            return returnJson.toJSONString();
        }
        BoCust boCust = new BoCust();
        boCust.setBoId(busiOrder.getBoId());
        boCust.setCustId(newCust.getCustId());
        boCust.setVersionId(busiOrder.getOlId());
        List<BoCust> boCusts =  iUserServiceDao.queryBoCust(boCust);
        //一般情况下没有这种情况存在,除非 人工 改了数据,或没按流程完成数据处理
        if(boCusts == null || boCusts.size() == 0){
            return returnJson.toJSONString();
        }
        JSONArray boCustArray = new JSONArray();
        //单纯的删除 和单纯 增加
        for(int boCustIndex = 0 ; boCustIndex < boCusts.size();boCustIndex++) {
            BoCust newBoCust = boCusts.get(boCustIndex);
            if(isNeedDelete) {
                if (StateConstant.STATE_DEL.equals(newBoCust.getState())) {
                    newBoCust.setBoId("");
                    newBoCust.setState(StateConstant.STATE_ADD);
                } else if (StateConstant.STATE_ADD.equals(newBoCust.getState())) {
                    newBoCust.setState(StateConstant.STATE_DEL);
                } else {
                    newBoCust.setState(StateConstant.STATE_KIP);
                }
            }
            boCustArray.add(newBoCust);
        }
        returnJson.getJSONObject("data").put("boCust",JSONObject.toJSONString(boCustArray));
        //属性处理
        CustAttr oldCustAttr = new CustAttr();
        oldCustAttr.setCustId(newCust.getCustId());
        oldCustAttr.setVersionId(busiOrder.getOlId());
        List<CustAttr> custAttrs = iUserServiceDao.queryDataToCustAttr(oldCustAttr);
        if(custAttrs == null || custAttrs.size() == 0){
            return returnJson.toJSONString();
        }
        /**
         * 查询客户查询的过程数据
         */
        BoCustAttr boCustAttr = new BoCustAttr();
        boCustAttr.setCustId(newCust.getCustId());
        boCustAttr.setVersionId(busiOrder.getOlId());
        List<BoCustAttr> boCustAttrs = iUserServiceDao.queryBoCustAttr(boCustAttr);
        //一般情况下没有这种情况存在,除非 人工 改了数据,或没按流程完成数据处理
        if(boCustAttrs == null || boCustAttrs.size() == 0){
            return returnJson.toJSONString();
        }
        JSONArray boCustAttrArray = new JSONArray();
        //单纯的删除 和单纯 增加
        for(BoCustAttr newBoCustAttr : boCustAttrs) {
            if(isNeedDelete) {
                if (StateConstant.STATE_DEL.equals(newBoCustAttr.getState())) {
                    newBoCustAttr.setBoId("");
                    newBoCustAttr.setState(StateConstant.STATE_ADD);
                } else if (StateConstant.STATE_ADD.equals(newBoCustAttr.getState())) {
                    newBoCustAttr.setState(StateConstant.STATE_DEL);
                } else {
                    newBoCustAttr.setState(StateConstant.STATE_KIP);
                }
            }
            boCustAttrArray.add(newBoCustAttr);
        }
        returnJson.getJSONObject("data").put("boCustAttr",JSONObject.toJSONString(boCustAttrArray));
        return returnJson.toJSONString();
    }
    /**
     * 处理boCust 节点
     * @throws Exception
     */
    public void doProcessBoCust(JSONObject userInfoJson,JSONObject paramJson,Map custIdKey, JSONObject resultInfo) throws Exception{
        if(userInfoJson.containsKey("boCust")){
            JSONArray boCusts = userInfoJson.getJSONArray("boCust");
            JSONObject boCustObj = new JSONObject();
            boCustObj.put("boCust",boCusts);
            String returnSaveBoCust = this.soBoCust(boCustObj.toJSONString(),custIdKey);
            if(!ProtocolUtil.validateReturnJson(returnSaveBoCust,paramJson)){
                throw new RuntimeException("保存 bo_cust 失败:"+boCustObj+(paramJson != null
                        && paramJson.containsKey("RESULT_MSG")?paramJson.getString("RESULT_MSG"):"未知异常"));
            }
            resultInfo = paramJson.getJSONObject("RESULT_INFO");
        }
    }
    /**
     * 处理boCustAttr 节点
     * @param userInfoJson
     * @param paramJson
     * @param custIdKey
     * @param resultInfo
     */
    public void doProcessBoCustAttr(JSONObject userInfoJson,JSONObject paramJson,Map custIdKey, JSONObject resultInfo) throws Exception{
        if(userInfoJson.containsKey("boCustAttr")){
            JSONArray boCustAttrs = userInfoJson.getJSONArray("boCustAttr");
            //首先对custId 进行处理
            if(custIdKey != null && custIdKey.size() > 0 ){
                for(int boCustAttrIndex = 0 ; boCustAttrIndex < boCustAttrs.size();boCustAttrIndex++){
                    JSONObject boCustAttr = boCustAttrs.getJSONObject(boCustAttrIndex);
                    boCustAttr.put("custId",custIdKey.get("custId"+boCustAttr.getString("custId")));
                }
            }
            JSONObject boCustAttrObj = new JSONObject();
            boCustAttrObj.put("boCustAttr",boCustAttrs);
            String returnSaveBoCustAttr = soBoCustAttr(boCustAttrObj.toJSONString());
            if(!ProtocolUtil.validateReturnJson(returnSaveBoCustAttr,paramJson)){
                throw new RuntimeException("保存 bo_cust 失败:"+boCustAttrObj+(paramJson != null
                        && paramJson.containsKey("RESULT_MSG")?paramJson.getString("RESULT_MSG"):"未知异常"));
            }
        }
    }
    /**
     * 作废 boCust 信息
     * @param data
     * @throws Exception
     */
    public void doDeleteBoCust(JSONObject data) throws Exception{
        Cust deleteCust = null;
        //根据boId 查询bo_cust 表,是否有数据,没数据直接返回
        BoCust boCust = new BoCust();
        boCust.setBoId(data.getString("boId"));
       List<BoCust> boCusts =  iUserServiceDao.queryBoCust(boCust);
       //Assert.isOne(boCusts,"在表bo_cust中未找到boId 为["+data.getString("boId")+"]的数据 或有多条数据,请检查");
        if(boCusts == null || boCusts.size() < 1){
            LoggerEngine.error("当前没有查到数为 "+data+"请检查数据");
            return;
        }
       //在过程表中补一条作废的数据,然后根据boId的动作对实例数据进行处理
        boCust.setCustId(boCusts.get(0).getCustId());
        boCust.setBoId("");
        //查询出所有custId 一样的数据
        List<BoCust> boCustAll =  iUserServiceDao.queryBoCust(boCust);
        Assert.isNull(boCustAll,"当前没有查到custId 为 "+boCusts.get(0).getCustId()+"请检查数据");
        boCust = boCusts.get(0);
        BoCust newBoCust = new BoCust();
        newBoCust.setBoId(data.getString("newBoId"));
        newBoCust.setCustId(boCust.getCustId());
        newBoCust.setState("DEL");
        int saveBoCustFlag = iUserServiceDao.saveDataToBoCust(newBoCust);
        if(saveBoCustFlag < 1){
            throw new RuntimeException("向bo_cust表中保存数据失败,boCust="+JSONObject.toJSONString(newBoCust));
        }
        //首先删除实例数据
        deleteCust = new Cust();
        deleteCust.setCustId(boCust.getCustId());
        if(iUserServiceDao.deleteDataToCust(deleteCust) < 1){
            throw new RuntimeException("删除cust实例数据失败"+JSONObject.toJSONString(deleteCust));
        }
        //如果有多条数据,则恢复 前一条数据信息,这边存在bug 如果上一条的数据没有分装以前数据的情况下会有问题,
        // 所以我们的原则是再更新或删除数据时一定要在过程表中保存完整是实例数据信息
        if(boCustAll.size() > 1){
            Cust oldCust = boCustAll.get(1).convert();
            if(iUserServiceDao.saveDataToCust(oldCust)<1 ){
                throw new RuntimeException("cust 表恢复老数据信息失败,cust 为:"+JSONObject.toJSONString(oldCust));
            }
        }
    }
    /**
     * 删除 bo_cust_attr
     * @param data
     * @throws Exception
     */
    public void doDeleteBoCustAttr(JSONObject data) throws Exception{
        BoCustAttr boCustAttrTmp = new BoCustAttr();
        boCustAttrTmp.setBoId(data.getString("boId"));
        List<BoCustAttr> boCustAttrs = iUserServiceDao.queryBoCustAttr(boCustAttrTmp);
        if(boCustAttrs == null || boCustAttrs.size() < 1){
            LoggerEngine.error("当前没有查到数为 "+data+"请检查数据");
            return;
        }
        boCustAttrTmp.setBoId("");
        boCustAttrTmp.setCustId(boCustAttrs.get(0).getCustId());
        List<BoCustAttr> boCustAttrsTmps = iUserServiceDao.queryBoCustAttr(boCustAttrTmp);
        Assert.isNull(boCustAttrsTmps,"当前没有查到custId 为 "+boCustAttrs.get(0).getCustId()+"请检查数据");
        //获取上一次所有的属性
        List<BoCustAttr> preBoCustAttrTmps = getPreBoCustAttrs(boCustAttrsTmps);
        //保存过程表
        for(BoCustAttr boCustAttr : boCustAttrs){
            boCustAttr.setBoId("newBoId");
            boCustAttr.setState("DEL");
            if(iUserServiceDao.saveDataToBoCustAttr(boCustAttr) < 1){
                throw new RuntimeException("保存数据失败,保存数据为boCustAttr = "+ JSONObject.toJSONString(boCustAttr));
            }
        }
        //删除实例数据 这里思路是,删除实例数据中数据,将上一次ADD数据重新写一遍
        CustAttr custAttrTmp = new CustAttr();
        custAttrTmp.setCustId(boCustAttrs.get(0).getCustId());
        if(iUserServiceDao.deleteDataToCustAttr(custAttrTmp) < 1){
            throw new RuntimeException("删除CustAttr 实例数据失败,数据为:"+JSONObject.toJSONString(custAttrTmp));
        }
        for(BoCustAttr boCustAttr : preBoCustAttrTmps){
            if("ADD".equals(boCustAttr.getState())){
                if(iUserServiceDao.deleteDataToCustAttr(boCustAttr.convert()) < 1){
                    throw new  RuntimeException("复原原始数据失败,数据为:" + JSONObject.toJSONString(boCustAttr));
                }
            }
        }
    }
    /**
     * 获取上上一次的操作
     * @param boCustAttrs
     * @return
     */
    private List<BoCustAttr> getPreBoCustAttrs(List<BoCustAttr> boCustAttrs){
        String firstBoId = boCustAttrs.get(0).getBoId();
        String preBoId = "";
        List<BoCustAttr> preBoCustAttrs = new ArrayList<BoCustAttr>();
        for(BoCustAttr boCustAttr : boCustAttrs){
            if(!firstBoId.equals(boCustAttr.getBoId())){
                if(!preBoId.equals(boCustAttr.getBoId()) && !"".equals(preBoId)){
                    break;
                }
                preBoId = boCustAttr.getBoId();
                preBoCustAttrs.add(boCustAttr);
            }
        }
        return preBoCustAttrs;
    }
    private static final String USER_ACTION_DEL = "DEL";
    @Override
    public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
        try {
            Assert.hasLength(businessServiceDataFlow.getbId(),"bId 不能为空");
            Assert.hasLength(businessServiceDataFlow.getbId(), "bId 不能为空");
            BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
            Assert.notEmpty(businessServiceDataFlow.getResJson(),"用户服务["+businessServiceDataFlow.getCurrentBusiness().getServiceCode()+"]没有返回内容");
            Assert.notEmpty(businessServiceDataFlow.getResJson(), "用户服务[" + businessServiceDataFlow.getCurrentBusiness().getServiceCode() + "]没有返回内容");
        } catch (Exception e) {
            logger.error("用户信息处理异常",e);
            throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR,"用户信息处理异常"+e.getMessage());
        }finally {
            if(businessServiceDataFlow == null){
            logger.error("用户信息处理异常", e);
            throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR, "用户信息处理异常" + e.getMessage());
        } finally {
            if (businessServiceDataFlow == null) {
                return null;
            }
@@ -796,54 +98,49 @@
    /**
     * 保存日志信息
     * @param businessServiceDataFlow
     *
     * @param businessServiceDataFlow 业务日志对象
     */
    private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
    private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
        try{
            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))){
                for(DataFlowLog dataFlowLog :businessServiceDataFlow.getLogDatas()) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))) {
                for (DataFlowLog dataFlowLog : businessServiceDataFlow.getLogDatas()) {
                    KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME, "", JSONObject.toJSONString(dataFlowLog));
                }
            }
        }catch (Exception e){
            logger.error("报错日志出错了,",e);
        } catch (Exception e) {
            logger.error("报错日志出错了,", e);
        }
    }
    /**
     * 保存耗时信息
     *
     * @param businessServiceDataFlow
     */
    private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
        try{
            if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))){
    private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
        try {
            if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
                List<DataFlowLinksCost> dataFlowLinksCosts = businessServiceDataFlow.getLinksCostDates();
                JSONObject costDate = new JSONObject();
                JSONArray costDates = new JSONArray();
                JSONObject newObj = null;
                for(DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts){
                for (DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts) {
                    newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
                    newObj.put("dataFlowId",businessServiceDataFlow.getDataFlowId());
                    newObj.put("transactionId",businessServiceDataFlow.getTransactionId());
                    newObj.put("dataFlowId", businessServiceDataFlow.getDataFlowId());
                    newObj.put("transactionId", businessServiceDataFlow.getTransactionId());
                    costDates.add(newObj);
                }
                costDate.put("costDates",costDates);
                costDate.put("costDates", costDates);
                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME,"",costDate.toJSONString());
                KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME, "", costDate.toJSONString());
            }
        }catch (Exception e){
            logger.error("报错日志出错了,",e);
        } catch (Exception e) {
            logger.error("报错日志出错了,", e);
        }
    }
    public IPrimaryKeyService getiPrimaryKeyService() {
        return iPrimaryKeyService;
    }
    public void setiPrimaryKeyService(IPrimaryKeyService iPrimaryKeyService) {
        this.iPrimaryKeyService = iPrimaryKeyService;
    }
    public IUserServiceDao getiUserServiceDao() {
        return iUserServiceDao;
WebService/src/main/java/com/java110/web/components/floor/ListFloorComponent.java
@@ -15,7 +15,12 @@
    @Autowired
    private IFloorServiceSMO floorServiceSMOImpl;
    public ResponseEntity<String> list(IPageData pd){
    /**
     * 查询小区楼信息
     * @param pd 页面封装对象 包含页面请求数据
     * @return ResponseEntity对象返回给页面
     */
    public ResponseEntity<String> list(IPageData pd) {
        return floorServiceSMOImpl.listFloor(pd);
    }
WebService/src/main/java/com/java110/web/smo/IFloorServiceSMO.java
@@ -10,8 +10,9 @@
    /**
     * 查询小区楼信息
     *
     * @param pd 页面数据封装对象
     * @return
     * @return 返回 ResponseEntity对象包含 http状态 信息 body信息
     */
    ResponseEntity<String> listFloor(IPageData pd);
}
WebService/src/main/java/com/java110/web/smo/impl/FloorServiceSMOImpl.java
@@ -19,21 +19,23 @@
/**
 * 小区楼实现类
 *
 * <p>
 * add by wuxw 2019-04-22
 */
@Service("floorServiceSMOImpl")
public class FloorServiceSMOImpl extends BaseComponentSMO implements IFloorServiceSMO {
    private final static Logger logger = LoggerFactory.getLogger(FloorServiceSMOImpl.class);
    private  static Logger logger = LoggerFactory.getLogger(FloorServiceSMOImpl.class);
    @Autowired
    private RestTemplate restTemplate;
    /**
     * 查询小区楼
     *
     * @param pd 页面数据封装对象
     * @return
     * @return 返回 ResponseEntity对象包含 http状态 信息 body信息
     */
    @Override
    public ResponseEntity<String> listFloor(IPageData pd) {
@@ -43,46 +45,47 @@
        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
        int page = Integer.parseInt(paramIn.getString("page"));
        int rows = Integer.parseInt(paramIn.getString("rows"));
        String  floorName = paramIn.getString("floorName");
        page = (page-1)*rows;
        ResponseEntity responseEntity = super.getStoreInfo(pd,restTemplate);
        if(responseEntity.getStatusCode() != HttpStatus.OK){
        String floorName = paramIn.getString("floorName");
        page = (page - 1) * rows;
        ResponseEntity responseEntity = super.getStoreInfo(pd, restTemplate);
        if (responseEntity.getStatusCode() != HttpStatus.OK) {
            return responseEntity;
        }
        Assert.jsonObjectHaveKey(responseEntity.getBody().toString(),"storeId","根据用户ID查询商户ID失败,未包含storeId节点");
        Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点");
        String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId");
        if(StringUtil.isEmpty(floorName)) {
        if (StringUtil.isEmpty(floorName)) {
            responseEntity = this.callCenterService(restTemplate, pd, "",
                    ServiceConstant.SERVICE_API_URL + "/api/query.staff.infos?rows=" + rows + "&page=" + page + "&storeId=" + storeId, HttpMethod.GET);
        }else {
        } else {
            responseEntity = this.callCenterService(restTemplate, pd, "",
                    ServiceConstant.SERVICE_API_URL + "/api/query.staff.byName?rows=" + rows + "&page=" + page + "&storeId=" + storeId+"&name="+floorName, HttpMethod.GET);
                    ServiceConstant.SERVICE_API_URL + "/api/query.staff.byName?rows=" + rows + "&page=" + page + "&storeId=" + storeId + "&name=" + floorName, HttpMethod.GET);
        }
        if(responseEntity.getStatusCode() != HttpStatus.OK){
        if (responseEntity.getStatusCode() != HttpStatus.OK) {
            return responseEntity;
        }
        JSONObject resultObjs = JSONObject.parseObject(responseEntity.getBody().toString());
        resultObjs.put("row",rows);
        resultObjs.put("page",page);
        resultObjs.put("row", rows);
        resultObjs.put("page", page);
        return responseEntity;
    }
    /**
     * 校验查询小区楼信息
     * @param pd
     *
     * @param pd 页面封装对象
     */
    private void validateListFloor(IPageData pd){
        Assert.jsonObjectHaveKey(pd.getReqData(),"page","请求报文中未包含page节点");
        Assert.jsonObjectHaveKey(pd.getReqData(),"rows","请求报文中未包含rows节点");
    private void validateListFloor(IPageData pd) {
        Assert.jsonObjectHaveKey(pd.getReqData(), "page", "请求报文中未包含page节点");
        Assert.jsonObjectHaveKey(pd.getReqData(), "rows", "请求报文中未包含rows节点");
        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
        Assert.isInteger(paramIn.getString("page"),"page不是数字");
        Assert.isInteger(paramIn.getString("rows"),"rows不是数字");
        Assert.isInteger(paramIn.getString("page"), "page不是数字");
        Assert.isInteger(paramIn.getString("rows"), "rows不是数字");
        int rows = Integer.parseInt(paramIn.getString("rows"));
        if(rows>50){
            throw new SMOException(1999,"rows 数量不能大于50");
        if (rows > 50) {
            throw new SMOException(1999, "rows 数量不能大于50");
        }
    }
java110-code-generator/src/main/java/com/java110/code/GeneratorAbstractBussiness.java
@@ -6,31 +6,31 @@
    /**
     * 生成代码
     *
     * @param data
     */
    public void generator(Data data){
    public void generator(Data data) {
        StringBuffer sb = readFile(this.getClass().getResource("/template/AbstractBusinessServiceDataFlowListener.txt").getFile());
        String fileContext = sb.toString();
        fileContext = fileContext.replace("store",toLowerCaseFirstOne(data.getName()))
                .replace("Store",toUpperCaseFirstOne(data.getName()))
                .replace("商户",data.getDesc())
                ;
        Map<String,String> param = data.getParams();
        String mappingContext="";
        String autoMappingContext ="";
        for(String key : param.keySet()){
            if("statusCd".equals(key) || "bId".equals(key)){
        fileContext = fileContext.replace("store", toLowerCaseFirstOne(data.getName()))
                .replace("Store", toUpperCaseFirstOne(data.getName()))
                .replace("商户", data.getDesc());
        Map<String, String> param = data.getParams();
        String mappingContext = "";
        String autoMappingContext = "";
        for (String key : param.keySet()) {
            if ("statusCd".equals(key) || "bId".equals(key)) {
                continue;
            }
            mappingContext += "business"+toUpperCaseFirstOne(data.getName())+"Info.put(\""+key+"\",business"+toUpperCaseFirstOne(data.getName())+"Info.get(\""+param.get(key)+"\"));\n";
            autoMappingContext += "current"+toUpperCaseFirstOne(data.getName())+"Info.put(\""+key+"\",current"+toUpperCaseFirstOne(data.getName())+"Info.get(\""+param.get(key)+"\"));\n";
            mappingContext += "business" + toUpperCaseFirstOne(data.getName()) + "Info.put(\"" + key + "\",business" + toUpperCaseFirstOne(data.getName()) + "Info.get(\"" + param.get(key) + "\"));\n";
            autoMappingContext += "current" + toUpperCaseFirstOne(data.getName()) + "Info.put(\"" + key + "\",current" + toUpperCaseFirstOne(data.getName()) + "Info.get(\"" + param.get(key) + "\"));\n";
        }
        fileContext = fileContext.replace("$flushBusinessInfo$",mappingContext);
        fileContext = fileContext.replace("$autoSaveDelBusiness$",autoMappingContext);
        fileContext = fileContext.replace("$flushBusinessInfo$", mappingContext);
        fileContext = fileContext.replace("$autoSaveDelBusiness$", autoMappingContext);
        System.out.println(this.getClass().getResource("/listener").getPath());
        String writePath = this.getClass().getResource("/listener").getPath()+"/Abstract"+toUpperCaseFirstOne(data.getName())+"BusinessServiceDataFlowListener.java";
        String writePath = this.getClass().getResource("/listener").getPath() + "/Abstract" + toUpperCaseFirstOne(data.getName()) + "BusinessServiceDataFlowListener.java";
        writeFile(writePath,
                fileContext);
    }
java110-common/src/main/java/com/java110/common/constant/ActionTypeConstant.java
@@ -4,56 +4,59 @@
 * 订单动作定义类
 * Created by wuxw on 2017/4/24.
 */
public class ActionTypeConstant {
public final class ActionTypeConstant {
    private ActionTypeConstant() {
    }
    /**
     * 添加客户信息
     */
    public final static String ACTION_TYPE_ADD_CUST = "C1";
    public static final String ACTION_TYPE_ADD_CUST = "C1";
    /**
     * 修改客户信息
     */
    public final static String ACTION_TYPE_EDIT_CUST = "C2";
    public static final String ACTION_TYPE_EDIT_CUST = "C2";
    /**
     * 删除客户信息
     */
    public final static String ACTION_TYPE_DEL_CUST = "C3";
    public static final String ACTION_TYPE_DEL_CUST = "C3";
    /**
     * 添加账户信息
     */
    public final static String ACTION_TYPE_ADD_ACCOUNT = "A1";
    public static final String ACTION_TYPE_ADD_ACCOUNT = "A1";
    /**
     * 修改账户信息
     */
    public final static String ACTION_TYPE_EDIT_ACCOUNT = "A2";
    public static final String ACTION_TYPE_EDIT_ACCOUNT = "A2";
    /**
     * 删除账户信息
     */
    public final static String ACTION_TYPE_DEL_ACCOUNT = "A3";
    public static final String ACTION_TYPE_DEL_ACCOUNT = "A3";
    /**
     * 增加商户信息
     */
    public final static String ACTION_TYPE_ADD_MERCHANT = "M1";
    public static final String ACTION_TYPE_ADD_MERCHANT = "M1";
    /**
     * 编辑商户信息
     */
    public final static String ACTION_TYPE_EDIT_MERCHANT = "M2";
    public static final String ACTION_TYPE_EDIT_MERCHANT = "M2";
    /**
     * 删除商户信息
     */
    public final static String ACTION_TYPE_DEL_MERCHANT = "M3";
    public static final String ACTION_TYPE_DEL_MERCHANT = "M3";
    /**
     * 撤单
     */
    public final static String ACTION_TYPE_CANCEL_ORDER = "D";
    public static final String ACTION_TYPE_CANCEL_ORDER = "D";
}
java110-common/src/main/java/com/java110/common/constant/AttrCdConstant.java
@@ -1,46 +1,33 @@
package com.java110.common.constant;
/**
 *
 * Item_spec_cd 取值代表含义
 * Created by wuxw on 2016/12/27.
 */
public class AttrCdConstant {
public final class AttrCdConstant {
    private AttrCdConstant() {
    }
    /**
     * 用于busi_order_attr 中 Attr_cd 表示为要作废订单项 boId
     */
    public final static String BUSI_ORDER_ATTR_10000001 = "10000001";//用于busi_order_attr 中 Attr_cd 表示为要作废订单项 boId
    public static final String BUSI_ORDER_ATTR_10000001 = "10000001"; //用于busi_order_attr 中 Attr_cd 表示为要作废订单项 boId
    /**
     * 用于order_list_attr 中的Attr_cd 表示为要作废购物车olId
     */
    public final static String ORDER_LIST_ATTR_10000002 = "10000002";//用于order_list_attr 中的Attr_cd 表示为要作废购物车olId
    public static final String ORDER_LIST_ATTR_10000002 = "10000002"; //用于order_list_attr 中的Attr_cd 表示为要作废购物车olId
    public final static String SPEC_CD_STORE_CORPORATION = "100201903001";// 法人
    public final static String SPEC_CD_STORE_REGISTEREDCAPITAL = "100201903002";// 注册资本
    public final static String SPEC_CD_STORE_FOUNDINGTIME = "100201903003";// 成立日期
    public final static String SPEC_CD_STORE_REGISTRATIONAUTHORITY = "100201903004";// 登记机关
    public final static String SPEC_CD_STORE_SCOPE = "100201903005";// 经营范围
    public static final String SPEC_CD_STORE_CORPORATION = "100201903001"; // 法人
    public static final String SPEC_CD_STORE_REGISTEREDCAPITAL = "100201903002"; // 注册资本
    public static final String SPEC_CD_STORE_FOUNDINGTIME = "100201903003"; // 成立日期
    public static final String SPEC_CD_STORE_REGISTRATIONAUTHORITY = "100201903004"; // 登记机关
    public static final String SPEC_CD_STORE_SCOPE = "100201903005"; // 经营范围
    public final static String SPEC_CD_COMMUNITY_TEL = "100201904006";// 小区联系电话
    public static final String SPEC_CD_COMMUNITY_TEL = "100201904006"; // 小区联系电话
}
java110-common/src/main/java/com/java110/common/constant/PrivilegeCodeConstant.java
@@ -7,5 +7,5 @@
public class PrivilegeCodeConstant {
    //入驻小区
    public final static String PRIVILEGE_ENTER_COMMUNITY = "500201904008";
    public static final  String PRIVILEGE_ENTER_COMMUNITY = "500201904008";
}
java110-common/src/main/java/com/java110/common/constant/ResponseConstant.java
@@ -3,48 +3,52 @@
/**
 * Created by wuxw on 2016/12/28.
 */
public class ResponseConstant {
public final class ResponseConstant {
    private ResponseConstant() {
    }
    /**
     * 结果返回成功
     */
    public final static String RESULT_CODE_SUCCESS = "0000";
    public static final String RESULT_CODE_SUCCESS = "0000";
    /**
     * 失败,通用失败编码
     */
    public final static String RESULT_CODE_ERROR = "1999";
    public static final String RESULT_CODE_ERROR = "1999";
    /**
     * 失败,通用失败编码
     */
    public final static String RESULT_CODE_INNER_ERROR = "1998";
    public static final String RESULT_CODE_INNER_ERROR = "1998";
    /**
     * 失败,通用失败编码
     */
    public final static String RESULT_CODE_TIME_OUT_ERROR = "1997";
    public static final String RESULT_CODE_TIME_OUT_ERROR = "1997";
    /**
     * 失败,入参错误,为空或格式错误
     */
    public final static String RESULT_CODE_NO_AUTHORITY_ERROR = "1996";
    public static final String RESULT_CODE_NO_AUTHORITY_ERROR = "1996";
    public final static String RESULT_CODE_RULE_ERROR = "1995";
    public static final String RESULT_CODE_RULE_ERROR = "1995";
    /**
     * 系统配置错误
     */
    public final static String RESULT_CODE_CONFIG_ERROR = "1993";
    public static final String RESULT_CODE_CONFIG_ERROR = "1993";
    /**
     * 参数不正确
     */
    public final static String RESULT_PARAM_ERROR = "1994";
    public static final String RESULT_PARAM_ERROR = "1994";
    /**
     * 没有从报文中获取到 请求流水
     */
    public final static String NO_TRANSACTION_ID = "-1";
    public final static String NO_NEED_SIGN = "";
    public static final String NO_TRANSACTION_ID = "-1";
    public static final String NO_NEED_SIGN = "";
}
java110-core/pom.xml
@@ -18,10 +18,6 @@
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.java110</groupId>
            <artifactId>java110-feign</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
@@ -55,5 +51,16 @@
            <artifactId>spring-session-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-feign</artifactId>
        </dependency>
        <!-- 整合ribbon -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-ribbon</artifactId>
        </dependency>
    </dependencies>
</project>
java110-core/src/main/java/com/java110/core/base/smo/BaseServiceSMO.java
@@ -1,30 +1,22 @@
package com.java110.core.base.smo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.CommonConstant;
import com.java110.common.constant.ServiceConstant;
import com.java110.common.log.LoggerEngine;
import com.java110.common.util.Assert;
import com.java110.common.util.ProtocolUtil;
import com.java110.core.base.AppBase;
import com.java110.core.context.AppContext;
import com.java110.core.context.BusinessServiceDataFlow;
import com.java110.core.context.DataFlowContext;
import com.java110.core.context.IPageData;
import com.java110.core.factory.AuthenticationFactory;
import com.java110.core.factory.DataFlowFactory;
import com.java110.feign.base.IPrimaryKeyService;
import org.apache.commons.lang3.math.NumberUtils;
import com.java110.core.smo.code.IPrimaryKeyInnerServiceSMO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.*;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.Map;
/**
 * 所有服务端的基类
@@ -34,7 +26,7 @@
 */
public class BaseServiceSMO extends AppBase {
    private final static Logger logger = LoggerFactory.getLogger(BaseServiceSMO.class);
    private static final Logger logger = LoggerFactory.getLogger(BaseServiceSMO.class);
    /**
     * 主键生成
@@ -43,9 +35,9 @@
     * @return
     * @throws Exception
     */
    protected String queryPrimaryKey(IPrimaryKeyService iPrimaryKeyService,String type) throws Exception{
    protected String queryPrimaryKey(IPrimaryKeyInnerServiceSMO iPrimaryKeyService, String type) throws Exception {
        JSONObject data = new JSONObject();
        data.put("type",type);
        data.put("type", type);
        //生成的ID
        String targetId = "-1";
        //要求接口返回 {"RESULT_CODE":"0000","RESULT_INFO":{"user_id":"7020170411000041"},"RESULT_MSG":"成功"}
java110-core/src/main/java/com/java110/core/context/IPageData.java
@@ -4,38 +4,98 @@
/**
 * 页面数据封装对象
 *
 * <p>
 * add by wuxw 2019-03-19
 */
public interface IPageData {
 public interface IPageData {
    public String getUserId();
    /**
     * 获取用户ID
     * @return 用户ID
     */
     String getUserId();
    public String getTransactionId();
    /**
     * 获取交易流水
     * @return 交易流水
     */
     String getTransactionId();
    public String getComponentCode();
    /**
     * 获取组件编码
     * @return 组件编码
     */
     String getComponentCode();
    public String getComponentMethod();
    /**
     * 获取调用的组件方法
     * @return 组件方法
     */
     String getComponentMethod();
    public String getToken();
    /**
     * 获取token
     * @return token
     */
     String getToken();
    public void setToken(String token);
    /**
     * 设置token
     * @param token 登录成功时需要设置token
     */
     void setToken(String token);
    public String getSessionId();
    /**
     * 获取sessionID
     * @return sessionID
     */
     String getSessionId();
    public String getReqData();
    /**
     * 获取前台请求的数据
     * @return 前台请求的数据
     */
     String getReqData();
    public String getResponseTime();
    /**
     * 获取返回时间
     * @return 返回时间
     */
     String getResponseTime();
    public String getRequestTime();
    /**
     * 获取请求时间
     * @return 请求时间
     */
     String getRequestTime();
    public ResponseEntity getResponseEntity();
    /**
     * 获取 ResponseEntity
     * @return ResponseEntity
     */
     ResponseEntity getResponseEntity();
    public void setResponseEntity(ResponseEntity responseEntity);
    /**
     * 设置 ResponseEntity
     * @param responseEntity 返回界面时的对象
     */
     void setResponseEntity(ResponseEntity responseEntity);
    public IPageData builder(String userId,String token,String reqData,String componentCode,String componentMethod,String url,String sessionId)
    /**
     * 构建 pd 对象
     * @param userId 用户ID
     * @param token token
     * @param reqData 请求数据
     * @param componentCode 组件编码
     * @param componentMethod 组件方法
     * @param url 请求url
     * @param sessionId 回话ID
     * @return IPageData对象
     * @throws IllegalArgumentException 参数错误异常
     */
     IPageData builder(String userId, String token, String reqData, String componentCode, String componentMethod, String url, String sessionId)
            throws IllegalArgumentException;
}
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -9,13 +9,14 @@
import com.java110.common.factory.ApplicationContextFactory;
import com.java110.common.util.Assert;
import com.java110.common.util.DateUtil;
import com.java110.feign.code.ICodeApi;
import com.java110.core.smo.code.ICodeApi;
import org.springframework.web.client.RestTemplate;
import java.rmi.NoSuchObjectException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -76,56 +77,56 @@
    public static final String CODE_PREFIX_floorId = "73";
    /**
     *
     * 只有在不调用服务生成ID时有用
     */
    private static Map<String,String> prefixMap = null;
    private static Map<String, String> prefixMap = null;
    static {
        prefixMap = new HashMap<String,String>();
        prefixMap = new HashMap<String, String>();
        //10+yyyymmdd+八位序列
        prefixMap.put("oId","10");
        prefixMap.put("oId", "10");
        //(20+yyyymmdd+八位序列)
        prefixMap.put("bId","20");
        prefixMap.put("bId", "20");
        //(11+yyyymmdd+八位序列)
        prefixMap.put("attrId","11");
        prefixMap.put("transactionId","1000001");
        prefixMap.put("pageTransactionId","1000002");
        prefixMap.put("dataFlowId","2000");
        prefixMap.put("userId","30");
        prefixMap.put("storeId","40");
        prefixMap.put("storePhotoId","41");
        prefixMap.put("storeCerdentialsId","42");
        prefixMap.put("memberStoreId","43");
        prefixMap.put("propertyStoreId","44");
        prefixMap.put("storeUserId","45");
        prefixMap.put("shopId","50");
        prefixMap.put("shopAttrId","51");
        prefixMap.put("shopPhotoId","52");
        prefixMap.put("shopAttrParamId","53");
        prefixMap.put("shopPreferentialId","54");
        prefixMap.put("shopDescId","55");
        prefixMap.put("shopCatalogId","56");
        prefixMap.put("buyId","57");
        prefixMap.put("buyAttrId","58");
        prefixMap.put("commentId","60");
        prefixMap.put("subCommentId","61");
        prefixMap.put("subCommentAttrId","62");
        prefixMap.put("commentPhotoId","63");
        prefixMap.put("commentScoreId","64");
        prefixMap.put("communityId","70");
        prefixMap.put("communityPhotoId","71");
        prefixMap.put("communityMemberId","72");
        prefixMap.put("agentId","80");
        prefixMap.put("agentPhotoId","81");
        prefixMap.put("agentCerdentialsId","82");
        prefixMap.put("agentUserId","83");
        prefixMap.put("propertyId","90");
        prefixMap.put("propertyPhotoId","91");
        prefixMap.put("propertyCerdentialsId","92");
        prefixMap.put("propertyUserId","93");
        prefixMap.put("propertyFeeId","94");
        prefixMap.put("houseId","95");
        prefixMap.put("pgId","600");
        prefixMap.put("attrId", "11");
        prefixMap.put("transactionId", "1000001");
        prefixMap.put("pageTransactionId", "1000002");
        prefixMap.put("dataFlowId", "2000");
        prefixMap.put("userId", "30");
        prefixMap.put("storeId", "40");
        prefixMap.put("storePhotoId", "41");
        prefixMap.put("storeCerdentialsId", "42");
        prefixMap.put("memberStoreId", "43");
        prefixMap.put("propertyStoreId", "44");
        prefixMap.put("storeUserId", "45");
        prefixMap.put("shopId", "50");
        prefixMap.put("shopAttrId", "51");
        prefixMap.put("shopPhotoId", "52");
        prefixMap.put("shopAttrParamId", "53");
        prefixMap.put("shopPreferentialId", "54");
        prefixMap.put("shopDescId", "55");
        prefixMap.put("shopCatalogId", "56");
        prefixMap.put("buyId", "57");
        prefixMap.put("buyAttrId", "58");
        prefixMap.put("commentId", "60");
        prefixMap.put("subCommentId", "61");
        prefixMap.put("subCommentAttrId", "62");
        prefixMap.put("commentPhotoId", "63");
        prefixMap.put("commentScoreId", "64");
        prefixMap.put("communityId", "70");
        prefixMap.put("communityPhotoId", "71");
        prefixMap.put("communityMemberId", "72");
        prefixMap.put("agentId", "80");
        prefixMap.put("agentPhotoId", "81");
        prefixMap.put("agentCerdentialsId", "82");
        prefixMap.put("agentUserId", "83");
        prefixMap.put("propertyId", "90");
        prefixMap.put("propertyPhotoId", "91");
        prefixMap.put("propertyCerdentialsId", "92");
        prefixMap.put("propertyUserId", "93");
        prefixMap.put("propertyFeeId", "94");
        prefixMap.put("houseId", "95");
        prefixMap.put("pgId", "600");
    }
    private static String PLATFORM_CODE = "0001";
@@ -140,11 +141,11 @@
            count = lastCount++;
        } finally {
            LOCK.unlock();
            return getRandom()+String.format(idLength, count);
            return getRandom() + String.format(idLength, count);
        }
    }
    public static String nextId(){
    public static String nextId() {
        return nextId("%04d");
    }
@@ -162,10 +163,11 @@
    /**
     * 获取内部平台 交易流水
     *
     * @return
     * @throws NoSuchObjectException
     */
    public static String getInnerTransactionId() throws Exception{
    public static String getInnerTransactionId() throws Exception {
        return codeApi().generateCode(prefixMap.get("transactionId"));
    }
@@ -183,19 +185,20 @@
    /**
     * pgId生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getGeneratorId(String prefix)  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefix +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getGeneratorId(String prefix) throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefix);
    }
    public static String getOId() throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
    public static String getOId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("oId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        return getCode(prefixMap.get("oId"));
@@ -204,18 +207,19 @@
    /**
     * 查询Code
     *
     * @param prefix
     * @return
     * @throws GenerateCodeException
     */
    private static String getCode(String prefix) throws GenerateCodeException{
    private static String getCode(String prefix) throws GenerateCodeException {
        //调用服务
        String code = "-1";
        try {
            String responseMessage = restTemplate().postForObject(MappingCache.getValue(MappingConstant.KEY_CODE_PATH),
                    createCodeRequestJson(getTransactionId(),prefix,prefix).toJSONString(), String.class);
                    createCodeRequestJson(getTransactionId(), prefix, prefix).toJSONString(), String.class);
            if(ResponseConstant.RESULT_CODE_ERROR.equals(responseMessage)){
            if (ResponseConstant.RESULT_CODE_ERROR.equals(responseMessage)) {
                throw new ResponseErrorException(ResponseConstant.RESULT_CODE_ERROR, "生成oId编码失败");
            }
            Assert.jsonObjectHaveKey(responseMessage, "code", "编码生成系统 返回报文错误" + responseMessage);
@@ -227,25 +231,24 @@
                        + resJson.getString("message"));
            }
            code = resJson.getString("id");
        }catch (Exception e){
            throw new GenerateCodeException(ResponseConstant.RESULT_CODE_ERROR,e.getMessage());
        }
        finally {
        } catch (Exception e) {
            throw new GenerateCodeException(ResponseConstant.RESULT_CODE_ERROR, e.getMessage());
        } finally {
            return code;
        }
    }
    public static String getBId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
    public static String getBId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("bId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("bId"));
    }
    public static String getAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
    public static String getAttrId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("attrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
@@ -254,57 +257,57 @@
    /**
     * 生成dataFlowId
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getDataFlowId()  throws GenerateCodeException{
    public static String getDataFlowId() throws GenerateCodeException {
        return UUID.randomUUID().toString().replace("-","").toLowerCase();
        return UUID.randomUUID().toString().replace("-", "").toLowerCase();
    }
    public static String getUserId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("userId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getUserId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("userId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("userId"));
    }
    public static String getStoreId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("storeId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getStoreId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("storeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("storeId"));
    }
    public static String getMemberStoreId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("memberStoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getMemberStoreId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("memberStoreId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("memberStoreId"));
    }
    public static String getStorePhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("storePhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getStorePhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("storePhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("storePhotoId"));
    }
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getStoreCerdentialsId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("storeCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getStoreCerdentialsId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("storeCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("storeCerdentialsId"));
@@ -312,13 +315,12 @@
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getStoreUserId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("storeUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getStoreUserId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("storeUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("storeUserId"));
@@ -327,12 +329,13 @@
    /**
     * 获取小区ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommunityId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("communityId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommunityId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("communityId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("communityId"));
@@ -341,12 +344,13 @@
    /**
     * 获取小区照片ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommunityPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("communityPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommunityPhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("communityPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("communityPhotoId"));
@@ -354,24 +358,27 @@
    /**
     * 生成小区成员ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommunityMemberId() throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("communityMemberId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommunityMemberId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("communityMemberId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("communityMemberId"));
    }
    /**
     * 获取小区ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getAgentId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("agentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getAgentId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("agentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("agentId"));
@@ -380,40 +387,38 @@
    /**
     * 获取小区照片ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getAgentPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("agentPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getAgentPhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("agentPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("agentPhotoId"));
    }
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getAgentCerdentialsId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("agentCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getAgentCerdentialsId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("agentCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("agentCerdentialsId"));
    }
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getAgentUserId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("agentUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getAgentUserId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("agentUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("agentUserId"));
@@ -422,12 +427,13 @@
    /**
     * 获取小区ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPropertyId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("propertyId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getPropertyId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("propertyId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("propertyId"));
@@ -436,25 +442,25 @@
    /**
     * 获取小区照片ID
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPropertyPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("propertyPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getPropertyPhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("propertyPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("propertyPhotoId"));
    }
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPropertyCerdentialsId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("propertyCerdentialsId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getPropertyCerdentialsId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("propertyCerdentialsId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("propertyCerdentialsId"));
@@ -462,13 +468,12 @@
    /**
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPropertyUserId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("propertyUserId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getPropertyUserId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("propertyUserId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("propertyUserId"));
@@ -476,12 +481,13 @@
    /**
     * 物业费用ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPropertyFeeId() throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("propertyFeeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H+nextId("%04d"));
    public static String getPropertyFeeId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("propertyFeeId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H + nextId("%04d"));
        }
        return getCode(prefixMap.get("propertyFeeId"));
@@ -489,27 +495,28 @@
    /**
     * 住户ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getHouseId() throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("houseId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H+nextId("%04d"));
    public static String getHouseId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("houseId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H + nextId("%04d"));
        }
        return getCode(prefixMap.get("houseId"));
    }
    /**
     * 商品ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopId"));
@@ -517,12 +524,13 @@
    /**
     * 商品属性ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopAttrId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopAttrId"));
@@ -530,55 +538,57 @@
    /**
     * 商品优惠ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopPreferentialId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopPreferentialId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopPreferentialId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopPreferentialId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopPreferentialId"));
    }
    /**
     * 商品属性参数ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopAttrParamId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopAttrParamId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopAttrParamId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopAttrParamId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopAttrParamId"));
    }
    /**
     * 商品属性参数ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommentPhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("commentPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("commentPhotoId"));
    }
    /**
     * 商品属性ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopPhotoId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopPhotoId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopPhotoId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopPhotoId"));
@@ -586,12 +596,13 @@
    /**
     * 商品描述ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopDescId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopDescId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopDescId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopDescId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopDescId"));
@@ -599,12 +610,13 @@
    /**
     * 商品目录ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopCatalogId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("shopCatalogId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopCatalogId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("shopCatalogId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("shopCatalogId"));
@@ -612,12 +624,13 @@
    /**
     * 商品buyID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopBuyId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("buyId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopBuyId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("buyId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("buyId"));
@@ -625,12 +638,13 @@
    /**
     * 商品buyAttrID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getShopBuyAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("buyAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getShopBuyAttrId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("buyAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("buyAttrId"));
@@ -638,12 +652,13 @@
    /**
     * 评论ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommentId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("commentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("commentId"));
@@ -651,12 +666,13 @@
    /**
     * 评论ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getSubCommentId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("subCommentId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getSubCommentId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("subCommentId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("subCommentId"));
@@ -664,24 +680,27 @@
    /**
     * 评论ID生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getSubCommentAttrId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("subCommentAttrId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getSubCommentAttrId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("subCommentAttrId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("subCommentAttrId"));
    }
    /**
     * commentScoreId生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getCommentScoreId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("commentScoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getCommentScoreId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("commentScoreId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("commentScoreId"));
@@ -689,45 +708,47 @@
    /**
     * pgId生成
     *
     * @return
     * @throws GenerateCodeException
     */
    public static String getPgId()  throws GenerateCodeException{
        if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){
            return prefixMap.get("pgId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%04d");
    public static String getPgId() throws GenerateCodeException {
        if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) {
            return prefixMap.get("pgId") + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d");
        }
        //调用服务
        return getCode(prefixMap.get("pgId"));
    }
    /**
     * 获取restTemplate
     *
     * @return
     * @throws NoSuchObjectException
     */
    private static RestTemplate restTemplate() throws NoSuchObjectException{
    private static RestTemplate restTemplate() throws NoSuchObjectException {
       Object bean = ApplicationContextFactory.getBean("restTemplate");
        Object bean = ApplicationContextFactory.getBean("restTemplate");
       if(bean == null){
           throw new NoSuchObjectException("没有找到restTemplate对象,请核实");
       }
        if (bean == null) {
            throw new NoSuchObjectException("没有找到restTemplate对象,请核实");
        }
       return (RestTemplate) bean;
        return (RestTemplate) bean;
    }
    /**
     * 获取codeApi
     *
     * @return
     * @throws NoSuchObjectException
     */
    private static ICodeApi codeApi() throws NoSuchObjectException{
    private static ICodeApi codeApi() throws NoSuchObjectException {
        Object bean = ApplicationContextFactory.getBean(ICodeApi.class.getName());
        if(bean == null){
        if (bean == null) {
            throw new NoSuchObjectException("codeApi,请核实");
        }
@@ -735,32 +756,31 @@
    }
    /**
     * ID生成请求报文
     *
     * @param transactionId
     * @return
     */
    private static JSONObject createCodeRequestJson(String transactionId, String prefix, String name){
    private static JSONObject createCodeRequestJson(String transactionId, String prefix, String name) {
        JSONObject paramOut = JSONObject.parseObject("{}");
        paramOut.put("transactionId",transactionId);
        paramOut.put("prefix",prefix);
        paramOut.put("name",name);
        paramOut.put("requestTime",DateUtil.getNowDefault());
        paramOut.put("transactionId", transactionId);
        paramOut.put("prefix", prefix);
        paramOut.put("name", name);
        paramOut.put("requestTime", DateUtil.getNowDefault());
        return paramOut;
    }
    /**
     * 获取随机数
     *
     * @return
     */
    private static  String getRandom(){
    private static String getRandom() {
        Random random = new Random();
        String result="";
        for (int i=0;i<4;i++)
        {
            result+=random.nextInt(10);
        String result = "";
        for (int i = 0; i < 4; i++) {
            result += random.nextInt(10);
        }
        return result;
    }
java110-core/src/main/java/com/java110/core/smo/code/ICodeApi.java
New file
@@ -0,0 +1,39 @@
package com.java110.core.smo.code;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
/**
 * @ClassName ICodeApi
 * @Description 编码生成服务
 * @Author wuxw
 * @Date 2019/4/23 9:09
 * @Version 1.0
 * add by wuxw 2019/4/23
 **/
@FeignClient("code-service")
public interface ICodeApi {
    /**
     * 生成编码
     * @param orderInfo 订单信息
     * @param request request对象
     * @return 编码对象
     */
    @RequestMapping(path = "/codeApi/generate", method = RequestMethod.POST)
    String generatePost(@RequestBody String orderInfo, HttpServletRequest request);
    /**
     * 生成 编码
     *
     * @param prefix 前缀
     * @return 编码
     */
    @RequestMapping(value = "/codeApi/generateCode", method = RequestMethod.POST)
    String generateCode(@RequestParam("prefix") String prefix);
}
java110-core/src/main/java/com/java110/core/smo/code/IPrimaryKeyInnerServiceSMO.java
New file
@@ -0,0 +1,22 @@
package com.java110.core.smo.code;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
 * @ClassName IPrimaryKeyInnerServiceSMO
 * @Description TODO
 * @Author wuxw
 * @Date 2019/4/23 8:57
 * @Version 1.0
 * add by wuxw 2019/4/23
 **/
@FeignClient("code-service")
public interface IPrimaryKeyInnerServiceSMO {
    /**
     * 查询 主见信息
     * @param data 入参信息
     * @return {"RESULT_CODE":"0000","RESULT_INFO":{"user_id":"7020170411000041"},"RESULT_MSG":"成功"}
     */
    String queryPrimaryKey(String data);
}
java110-event/src/main/java/com/java110/event/listener/cust/CustDispatchListener.java
File was deleted
java110-event/src/main/java/com/java110/event/listener/cust/DeleteCustDispatchListener.java
File was deleted
java110-feign/pom.xml
File was deleted
java110-feign/src/main/java/com/java110/feign/App.java
File was deleted
java110-feign/src/main/java/com/java110/feign/base/CommonServiceFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/base/ICommonService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/base/IPrimaryKeyService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/base/PrimaryKeyServiceFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/code/CodeApiFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/code/ICodeApi.java
File was deleted
java110-feign/src/main/java/com/java110/feign/merchant/IMerchantMemberService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/merchant/IMerchantService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/merchant/MerchantMemberServiceFallBack.java
File was deleted
java110-feign/src/main/java/com/java110/feign/merchant/MerchantServiceFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/product/IProductService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/product/ProductServiceFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/test/HystrixClientFallback.java
File was deleted
java110-feign/src/main/java/com/java110/feign/test/TestFeignHystrixClient.java
File was deleted
java110-feign/src/main/java/com/java110/feign/user/IUserService.java
File was deleted
java110-feign/src/main/java/com/java110/feign/user/UserServiceFallback.java
File was deleted
java110-feign/src/test/java/com/java110/feign/AppTest.java
File was deleted
java110-service/pom.xml
@@ -68,11 +68,6 @@
        <dependency>
            <groupId>com.java110</groupId>
            <artifactId>java110-feign</artifactId>
        </dependency>
        <dependency>
            <groupId>com.java110</groupId>
            <artifactId>java110-config</artifactId>
            <scope>provided</scope>
        </dependency>
pom.xml
@@ -16,7 +16,6 @@
        <module>LogService</module>
        <module>FeeService</module>
        <module>eureka</module>
        <module>java110-feign</module>
        <module>java110-core</module>
        <module>java110-service</module>
        <module>CodeService</module>
@@ -150,11 +149,6 @@
            <dependency>
                <groupId>com.java110</groupId>
                <artifactId>java110-core</artifactId>
                <version>${microcommunity.version}</version>
            </dependency>
            <dependency>
                <groupId>com.java110</groupId>
                <artifactId>java110-feign</artifactId>
                <version>${microcommunity.version}</version>
            </dependency>