wuxw 3 anni fa
parent
commit
892c7d93f8

+ 26 - 0
java110-core/src/main/java/com/java110/core/context/Environment.java

@@ -33,6 +33,11 @@ public class Environment {
     public final static String DEFAULT_ACTIVE = "dev";
     public final static String DEFAULT_PHONE = "cc_phone";
 
+    private final static String SPRING_CLOUD = "CLOUD"; // 环境是spring boot cloud
+    private final static String SPRING_BOOT = "BOOT"; // 环境是spring boot cloud
+
+    private static String systemStartWay = "CLOUD"; // 环境是spring boot cloud
+
     /**
      * 环境变量
      *
@@ -85,4 +90,25 @@ public class Environment {
             throw new IllegalArgumentException("为了保证体验 此功能演示环境不开放");
         }
     }
+
+
+    /**
+     * boot 方式启动
+     * @return
+     */
+    public static boolean isStartBootWay(){
+        if(Environment.SPRING_BOOT.equals(systemStartWay)){
+            return true;
+        }
+
+        return false;
+    }
+
+    public static String getSystemStartWay() {
+        return systemStartWay;
+    }
+
+    public static void setSystemStartWay(String systemStartWay) {
+        Environment.systemStartWay = systemStartWay;
+    }
 }

+ 167 - 0
java110-core/src/main/java/com/java110/core/factory/Java110TransactionalFactory.java

@@ -1,6 +1,7 @@
 package com.java110.core.factory;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.core.context.Environment;
 import com.java110.dto.order.OrderDto;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.factory.ApplicationContextFactory;
@@ -34,21 +35,40 @@ public class Java110TransactionalFactory {
     //订单服务
     private static final String URL_API = ServiceConstant.SERVICE_ORDER_URL + "/order/oIdApi";
 
+    private static final String BOOT_URL_API = "http://127.0.0.1:8008/order/oIdApi";
+
     /**
      * 创建事务ID
      */
     private static final String CREATE_O_ID = URL_API + "/createOId";
 
+
+    /**
+     * 创建事务ID
+     */
+    private static final String BOOT_CREATE_O_ID = BOOT_URL_API + "/createOId";
+
+
     /**
      * 回退事务ID
      */
     private static final String FALLBACK_O_ID = URL_API + "/fallBackOId";
 
+    /**
+     * 回退事务ID
+     */
+    private static final String BOOT_FALLBACK_O_ID = BOOT_URL_API + "/fallBackOId";
+
     /**
      * 回退事务ID
      */
     private static final String FINISH_O_ID = URL_API + "/finishOId";
 
+    /**
+     * 回退事务ID
+     */
+    private static final String BOOT_FINISH_O_ID = BOOT_URL_API + "/finishOId";
+
 
     //全局事务ID
     public static final String O_ID = "O-ID";
@@ -143,6 +163,51 @@ public class Java110TransactionalFactory {
      * @param orderDto
      */
     private static void createOId(OrderDto orderDto) {
+        if(Environment.isStartBootWay()){
+            createOIdByBoot(orderDto);
+        }else{
+            createOIdByCloud(orderDto);
+        }
+    }
+
+    /**
+     * 创建事务
+     *
+     * @param orderDto
+     */
+    private static void createOIdByBoot(OrderDto orderDto) {
+        RestTemplate restTemplate = ApplicationContextFactory.getBean("outRestTemplate", RestTemplate.class);
+        HttpHeaders header = new HttpHeaders();
+        HttpEntity<String> httpEntity = new HttpEntity<String>(JSONObject.toJSONString(orderDto), header);
+        ResponseEntity<String> responseEntity = null;
+        try {
+            responseEntity = restTemplate.exchange(BOOT_CREATE_O_ID, HttpMethod.POST, httpEntity, String.class);
+        } catch (HttpStatusCodeException e) { //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下
+            responseEntity = new ResponseEntity<String>(e.getResponseBodyAsString(), e.getStatusCode());
+        } catch (Exception e) {
+            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        } finally {
+            logger.debug("请求地址为,{} 请求订单服务信息,{},订单服务返回信息,{}", BOOT_CREATE_O_ID, httpEntity, responseEntity);
+        }
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            throw new IllegalArgumentException("创建事务失败" + responseEntity.getBody());
+        }
+        JSONObject order = JSONObject.parseObject(responseEntity.getBody());
+
+        if (!order.containsKey("oId") || StringUtils.isEmpty(order.getString("oId"))) {
+            throw new IllegalArgumentException("创建事务失败" + responseEntity.getBody());
+        }
+        orderDto.setoId(order.getString("oId"));
+        //将事务ID 存放起来
+        put(O_ID, orderDto.getoId());
+    }
+
+    /**
+     * 创建事务
+     *
+     * @param orderDto
+     */
+    private static void createOIdByCloud(OrderDto orderDto) {
         RestTemplate restTemplate = ApplicationContextFactory.getBean("restTemplate", RestTemplate.class);
         HttpHeaders header = new HttpHeaders();
         HttpEntity<String> httpEntity = new HttpEntity<String>(JSONObject.toJSONString(orderDto), header);
@@ -174,6 +239,58 @@ public class Java110TransactionalFactory {
      */
     public static void fallbackOId() {
 
+        if(Environment.isStartBootWay()){
+            fallbackOIdByBoot();
+        }else{
+            fallbackOIdByCloud();
+        }
+
+    }
+
+    /**
+     * 处理失败,回退事务
+     */
+    public static void fallbackOIdByBoot() {
+
+        String oId = getOId();
+        if (StringUtil.isEmpty(oId) || ROLE_OBSERVER.equals(getServiceRole())) {
+            //当前没有开启事务无需回退
+            logger.debug("当前没有开启事务无需回退");
+            return;
+        }
+        OrderDto orderDto = new OrderDto();
+        orderDto.setoId(oId);
+        RestTemplate restTemplate = ApplicationContextFactory.getBean("outRestTemplate", RestTemplate.class);
+        HttpHeaders header = new HttpHeaders();
+        HttpEntity<String> httpEntity = new HttpEntity<String>(JSONObject.toJSONString(orderDto), header);
+        ResponseEntity<String> responseEntity = null;
+        try {
+            responseEntity = restTemplate.exchange(BOOT_FALLBACK_O_ID, HttpMethod.POST, httpEntity, String.class);
+        } catch (HttpStatusCodeException e) { //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下
+            responseEntity = new ResponseEntity<String>(e.getResponseBodyAsString(), e.getStatusCode());
+        } catch (Exception e) {
+            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        } finally {
+            logger.debug("回退事务 请求地址为,{} 请求订单服务信息,{},订单服务返回信息,{}", FALLBACK_O_ID, httpEntity, responseEntity);
+        }
+
+        if (responseEntity.getStatusCode() == HttpStatus.NOT_FOUND) {
+            //当前没有开启事务无需回退
+            logger.debug("当前没有开启事务无需回退");
+            return;
+        }
+
+        if (responseEntity.getStatusCode() == HttpStatus.BAD_REQUEST) {
+            throw new IllegalArgumentException("回退事务失败" + responseEntity.getBody());
+        }
+
+    }
+
+    /**
+     * 处理失败,回退事务
+     */
+    public static void fallbackOIdByCloud() {
+
         String oId = getOId();
         if (StringUtil.isEmpty(oId) || ROLE_OBSERVER.equals(getServiceRole())) {
             //当前没有开启事务无需回退
@@ -212,6 +329,56 @@ public class Java110TransactionalFactory {
      * 处理失败,回退事务
      */
     public static void finishOId() {
+        if(Environment.isStartBootWay()){
+            finishOIdByBoot();
+        }else{
+            finishOIdByCloud();
+        }
+
+    }
+
+    /**
+     * 处理失败,回退事务
+     */
+    public static void finishOIdByBoot() {
+        String oId = getOId();
+        if (StringUtil.isEmpty(oId) || ROLE_OBSERVER.equals(getServiceRole())) {
+            //当前没有开启事务无需回退
+            logger.debug("当前没有开启事务无需回退");
+            return;
+        }
+        OrderDto orderDto = new OrderDto();
+        orderDto.setoId(oId);
+        RestTemplate restTemplate = ApplicationContextFactory.getBean("outRestTemplate", RestTemplate.class);
+        HttpHeaders header = new HttpHeaders();
+        HttpEntity<String> httpEntity = new HttpEntity<String>(JSONObject.toJSONString(orderDto), header);
+        ResponseEntity<String> responseEntity = null;
+        try {
+            responseEntity = restTemplate.exchange(BOOT_FINISH_O_ID, HttpMethod.POST, httpEntity, String.class);
+        } catch (HttpStatusCodeException e) { //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下
+            responseEntity = new ResponseEntity<String>(e.getResponseBodyAsString(), e.getStatusCode());
+        } catch (Exception e) {
+            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        } finally {
+            logger.debug("完成事务 请求地址为,{} 请求订单服务信息,{},订单服务返回信息,{}", BOOT_FINISH_O_ID, httpEntity, responseEntity);
+        }
+
+        if (responseEntity.getStatusCode() == HttpStatus.NOT_FOUND) {
+            //当前没有开启事务无需回退
+            logger.debug("当前没有开启事务无需处理");
+            return;
+        }
+
+        if (responseEntity.getStatusCode() == HttpStatus.BAD_REQUEST) {
+            throw new IllegalArgumentException("完成事务失败" + responseEntity.getBody());
+        }
+
+    }
+
+    /**
+     * 处理失败,回退事务
+     */
+    public static void finishOIdByCloud() {
         String oId = getOId();
         if (StringUtil.isEmpty(oId) || ROLE_OBSERVER.equals(getServiceRole())) {
             //当前没有开启事务无需回退

+ 0 - 178
java110-db/src/main/resources/mapper/fee/RepairUserNewV1ServiceDaoImplMapper.xml

@@ -1,178 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="repairUserNewV1ServiceDaoImpl">
-
-
-
-
-
-    <!-- 保存费用明细信息 add by wuxw 2018-07-03 -->
-    <insert id="saveRepairUserNewInfo" parameterType="Map">
-        insert into r_repair_user(
-repair_event,pre_staff_name,repair_id,ru_id,pre_staff_id,context,staff_name,pre_ru_id,start_time,state,end_time,community_id,staff_id
-) values (
-#{repairEvent},#{preStaffName},#{repairId},#{ruId},#{preStaffId},#{context},#{staffName},#{preRuId},#{startTime},#{state},#{endTime},#{communityId},#{staffId}
-)
-    </insert>
-
-
-
-    <!-- 查询费用明细信息 add by wuxw 2018-07-03 -->
-    <select id="getRepairUserNewInfo" parameterType="Map" resultType="Map">
-        select  t.repair_event,t.repair_event repairEvent,t.pre_staff_name,t.pre_staff_name preStaffName,t.repair_id,t.repair_id repairId,t.status_cd,t.status_cd statusCd,t.ru_id,t.ru_id ruId,t.pre_staff_id,t.pre_staff_id preStaffId,t.context,t.staff_name,t.staff_name staffName,t.pre_ru_id,t.pre_ru_id preRuId,t.start_time,t.start_time startTime,t.state,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.staff_id,t.staff_id staffId 
-from r_repair_user t 
-where 1 =1 
-<if test="repairEvent !=null and repairEvent != ''">
-   and t.repair_event= #{repairEvent}
-</if> 
-<if test="preStaffName !=null and preStaffName != ''">
-   and t.pre_staff_name= #{preStaffName}
-</if> 
-<if test="repairId !=null and repairId != ''">
-   and t.repair_id= #{repairId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="ruId !=null and ruId != ''">
-   and t.ru_id= #{ruId}
-</if> 
-<if test="preStaffId !=null and preStaffId != ''">
-   and t.pre_staff_id= #{preStaffId}
-</if> 
-<if test="context !=null and context != ''">
-   and t.context= #{context}
-</if> 
-<if test="staffName !=null and staffName != ''">
-   and t.staff_name= #{staffName}
-</if> 
-<if test="preRuId !=null and preRuId != ''">
-   and t.pre_ru_id= #{preRuId}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="staffId !=null and staffId != ''">
-   and t.staff_id= #{staffId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
-
-    </select>
-
-
-
-
-    <!-- 修改费用明细信息 add by wuxw 2018-07-03 -->
-    <update id="updateRepairUserNewInfo" parameterType="Map">
-        update  r_repair_user t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="repairEvent !=null and repairEvent != ''">
-, t.repair_event= #{repairEvent}
-</if> 
-<if test="preStaffName !=null and preStaffName != ''">
-, t.pre_staff_name= #{preStaffName}
-</if> 
-<if test="repairId !=null and repairId != ''">
-, t.repair_id= #{repairId}
-</if> 
-<if test="preStaffId !=null and preStaffId != ''">
-, t.pre_staff_id= #{preStaffId}
-</if> 
-<if test="context !=null and context != ''">
-, t.context= #{context}
-</if> 
-<if test="staffName !=null and staffName != ''">
-, t.staff_name= #{staffName}
-</if> 
-<if test="preRuId !=null and preRuId != ''">
-, t.pre_ru_id= #{preRuId}
-</if> 
-<if test="startTime !=null and startTime != ''">
-, t.start_time= #{startTime}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="endTime !=null and endTime != ''">
-, t.end_time= #{endTime}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="staffId !=null and staffId != ''">
-, t.staff_id= #{staffId}
-</if> 
- where 1=1 <if test="ruId !=null and ruId != ''">
-and t.ru_id= #{ruId}
-</if> 
-
-    </update>
-
-    <!-- 查询费用明细数量 add by wuxw 2018-07-03 -->
-     <select id="queryRepairUserNewsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from r_repair_user t 
-where 1 =1 
-<if test="repairEvent !=null and repairEvent != ''">
-   and t.repair_event= #{repairEvent}
-</if> 
-<if test="preStaffName !=null and preStaffName != ''">
-   and t.pre_staff_name= #{preStaffName}
-</if> 
-<if test="repairId !=null and repairId != ''">
-   and t.repair_id= #{repairId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="ruId !=null and ruId != ''">
-   and t.ru_id= #{ruId}
-</if> 
-<if test="preStaffId !=null and preStaffId != ''">
-   and t.pre_staff_id= #{preStaffId}
-</if> 
-<if test="context !=null and context != ''">
-   and t.context= #{context}
-</if> 
-<if test="staffName !=null and staffName != ''">
-   and t.staff_name= #{staffName}
-</if> 
-<if test="preRuId !=null and preRuId != ''">
-   and t.pre_ru_id= #{preRuId}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="staffId !=null and staffId != ''">
-   and t.staff_id= #{staffId}
-</if> 
-
-
-     </select>
-
-</mapper>

+ 0 - 77
service-fee/src/main/java/com/java110/fee/dao/IRepairUserNewV1ServiceDao.java

@@ -1,77 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.fee.dao;
-
-
-import com.java110.utils.exception.DAOException;
-import com.java110.entity.merchant.BoMerchant;
-import com.java110.entity.merchant.BoMerchantAttr;
-import com.java110.entity.merchant.Merchant;
-import com.java110.entity.merchant.MerchantAttr;
-
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 类表述:
- * add by 吴学文 at 2021-12-06 22:33:06 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-public interface IRepairUserNewV1ServiceDao {
-
-
-    /**
-     * 保存 费用明细信息
-     * @param info
-     * @throws DAOException DAO异常
-     */
-    int saveRepairUserNewInfo(Map info) throws DAOException;
-
-
-
-
-    /**
-     * 查询费用明细信息(instance过程)
-     * 根据bId 查询费用明细信息
-     * @param info bId 信息
-     * @return 费用明细信息
-     * @throws DAOException DAO异常
-     */
-    List<Map> getRepairUserNewInfo(Map info) throws DAOException;
-
-
-
-    /**
-     * 修改费用明细信息
-     * @param info 修改信息
-     * @throws DAOException DAO异常
-     */
-    int updateRepairUserNewInfo(Map info) throws DAOException;
-
-
-    /**
-     * 查询费用明细总数
-     *
-     * @param info 费用明细信息
-     * @return 费用明细数量
-     */
-    int queryRepairUserNewsCount(Map info);
-
-}

+ 0 - 112
service-fee/src/main/java/com/java110/fee/dao/impl/RepairUserNewV1ServiceDaoImpl.java

@@ -1,112 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.fee.dao.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.exception.DAOException;
-import com.java110.utils.util.DateUtil;
-import com.java110.core.base.dao.BaseServiceDao;
-import com.java110.fee.dao.IRepairUserNewV1ServiceDao;
-import org.slf4j.Logger;
-import com.java110.core.log.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 类表述:
- * add by 吴学文 at 2021-12-06 22:33:06 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Service("repairUserNewV1ServiceDaoImpl")
-public class RepairUserNewV1ServiceDaoImpl extends BaseServiceDao implements IRepairUserNewV1ServiceDao {
-
-    private static Logger logger = LoggerFactory.getLogger(RepairUserNewV1ServiceDaoImpl.class);
-
-
-
-
-
-    /**
-     * 保存费用明细信息 到 instance
-     * @param info   bId 信息
-     * @throws DAOException DAO异常
-     */
-    @Override
-    public int saveRepairUserNewInfo(Map info) throws DAOException {
-        logger.debug("保存 saveRepairUserNewInfo 入参 info : {}",info);
-
-        int saveFlag = sqlSessionTemplate.insert("repairUserNewV1ServiceDaoImpl.saveRepairUserNewInfo",info);
-
-        return saveFlag;
-    }
-
-
-    /**
-     * 查询费用明细信息(instance)
-     * @param info bId 信息
-     * @return List<Map>
-     * @throws DAOException DAO异常
-     */
-    @Override
-    public List<Map> getRepairUserNewInfo(Map info) throws DAOException {
-        logger.debug("查询 getRepairUserNewInfo 入参 info : {}",info);
-
-        List<Map> businessRepairUserNewInfos = sqlSessionTemplate.selectList("repairUserNewV1ServiceDaoImpl.getRepairUserNewInfo",info);
-
-        return businessRepairUserNewInfos;
-    }
-
-
-    /**
-     * 修改费用明细信息
-     * @param info 修改信息
-     * @throws DAOException DAO异常
-     */
-    @Override
-    public int updateRepairUserNewInfo(Map info) throws DAOException {
-        logger.debug("修改 updateRepairUserNewInfo 入参 info : {}",info);
-
-        int saveFlag = sqlSessionTemplate.update("repairUserNewV1ServiceDaoImpl.updateRepairUserNewInfo",info);
-
-        return saveFlag;
-    }
-
-     /**
-     * 查询费用明细数量
-     * @param info 费用明细信息
-     * @return 费用明细数量
-     */
-    @Override
-    public int queryRepairUserNewsCount(Map info) {
-        logger.debug("查询 queryRepairUserNewsCount 入参 info : {}",info);
-
-        List<Map> businessRepairUserNewInfos = sqlSessionTemplate.selectList("repairUserNewV1ServiceDaoImpl.queryRepairUserNewsCount", info);
-        if (businessRepairUserNewInfos.size() < 1) {
-            return 0;
-        }
-
-        return Integer.parseInt(businessRepairUserNewInfos.get(0).get("count").toString());
-    }
-
-
-}

+ 12 - 1
service-order/src/main/java/com/java110/order/smo/impl/AsynNotifySubServiceImpl.java

@@ -3,6 +3,7 @@ package com.java110.order.smo.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
+import com.java110.core.context.Environment;
 import com.java110.core.context.SecureInvocation;
 import com.java110.dto.businessDatabus.BusinessDatabusDto;
 import com.java110.dto.businessTableHis.BusinessTableHisDto;
@@ -40,6 +41,8 @@ public class AsynNotifySubServiceImpl implements IAsynNotifySubService {
     @Autowired
     private RestTemplate restTemplate;
 
+    @Autowired
+    private RestTemplate outRestTemplate;
 
     @Autowired
     private ICenterServiceDAO centerServiceDAOImpl;
@@ -49,6 +52,9 @@ public class AsynNotifySubServiceImpl implements IAsynNotifySubService {
 
     public static final String FALLBACK_URL = "http://SERVICE_NAME/businessApi/fallBack";
 
+    public static final String BOOT_FALLBACK_URL = "http://127.0.0.1:8008/businessApi/fallBack";
+
+
     public static final String SERVICE_NAME = "SERVICE_NAME";
 
     @Override
@@ -60,7 +66,12 @@ public class AsynNotifySubServiceImpl implements IAsynNotifySubService {
             JSONArray params = generateBusinessParam(orderItemDto, businessTableHisDto);
             httpEntity = new HttpEntity<String>(params.toJSONString(), header);
             //通过fallBack 的方式生成Business
-            restTemplate.exchange(FALLBACK_URL.replace(SERVICE_NAME, orderItemDto.getServiceName()), HttpMethod.POST, httpEntity, String.class);
+
+            if(Environment.isStartBootWay()){
+                outRestTemplate.exchange(BOOT_FALLBACK_URL, HttpMethod.POST, httpEntity, String.class);
+            }else {
+                restTemplate.exchange(FALLBACK_URL.replace(SERVICE_NAME, orderItemDto.getServiceName()), HttpMethod.POST, httpEntity, String.class);
+            }
         } catch (Exception e) {
             logger.error("生成business失败", e);
 

+ 12 - 1
service-order/src/main/java/com/java110/order/smo/impl/OIdServiceSMOImpl.java

@@ -3,6 +3,7 @@ package com.java110.order.smo.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
+import com.java110.core.context.Environment;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.log.LoggerFactory;
 import com.java110.dto.app.AppDto;
@@ -41,12 +42,17 @@ public class OIdServiceSMOImpl implements IOIdServiceSMO {
 
     public static final String FALLBACK_URL = "http://SERVICE_NAME/businessApi/fallBack";
 
+    public static final String BOOT_FALLBACK_URL = "http://127.0.0.1:8008/businessApi/fallBack";
+
     public static final String SERVICE_NAME = "SERVICE_NAME";
 
 
     @Autowired
     private ICenterServiceDAO centerServiceDAOImpl;
 
+    @Autowired
+    private RestTemplate outRestTemplate;
+
     @Autowired
     private RestTemplate restTemplate;
 
@@ -109,7 +115,12 @@ public class OIdServiceSMOImpl implements IOIdServiceSMO {
             try {
                 JSONArray params = generateParam(orderItemDto);
                 httpEntity = new HttpEntity<String>(params.toJSONString(), header);
-                restTemplate.exchange(FALLBACK_URL.replace(SERVICE_NAME, orderItemDto.getServiceName()), HttpMethod.POST, httpEntity, String.class);
+
+                if(Environment.isStartBootWay()){
+                    outRestTemplate.exchange(BOOT_FALLBACK_URL, HttpMethod.POST, httpEntity, String.class);
+                }else {
+                    restTemplate.exchange(FALLBACK_URL.replace(SERVICE_NAME, orderItemDto.getServiceName()), HttpMethod.POST, httpEntity, String.class);
+                }
 
                 //标记为订单项失败
                 Map info = new HashMap();

+ 1 - 1
service-user/src/main/java/com/java110/user/cmd/carInout/SaveCarInoutCmd.java

@@ -13,7 +13,7 @@ import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 
-@Java110Cmd(serviceCode = "carInout.saveCarInout")
+//@Java110Cmd(serviceCode = "carInout.saveCarInout")
 public class SaveCarInoutCmd extends Cmd {
 
     @Autowired

+ 1 - 1
service-user/src/main/java/com/java110/user/cmd/carInout/UpdateCarInoutCmd.java

@@ -12,7 +12,7 @@ import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 
-@Java110Cmd(serviceCode = "carInout.updateCarInout")
+//@Java110Cmd(serviceCode = "carInout.updateCarInout")
 public class UpdateCarInoutCmd extends Cmd{