ct hace 3 días
padre
commit
5ca81268fd

+ 46 - 4
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -21,6 +21,7 @@ import com.fs.erp.dto.ErpOrderQueryRequert;
 import com.fs.erp.dto.ErpOrderQueryResponse;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.framework.web.service.TokenService;
+import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.dto.StoreOrderExpressExportDTO;
@@ -31,8 +32,10 @@ import com.fs.his.param.FsStoreOrderSalesParam;
 import com.fs.his.service.IFsExportTaskService;
 import com.fs.his.service.IFsExpressService;
 import com.fs.his.service.IFsStoreService;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.*;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -72,6 +75,15 @@ public class FsStoreOrderController extends BaseController
     private IFsStoreService fsStoreService;
     @Autowired
     private IFsExportTaskService exportTaskService;
+    @Autowired
+    private ConfigUtil configUtil;
+    @Autowired
+    @Qualifier("erpOrderServiceImpl")
+    private IErpOrderService gyOrderService;
+
+    @Autowired
+    @Qualifier("wdtErpOrderServiceImpl")
+    private IErpOrderService wdtOrderService;
     /**
      * 查询订单列表
      */
@@ -194,8 +206,6 @@ public class FsStoreOrderController extends BaseController
     /**
      * 获取订单详细信息
      */
-    @Autowired
-    IErpOrderService erpOrderService;
     @GetMapping(value = "/{orderId}")
     public R getInfo(@PathVariable("orderId") Long orderId) throws ParseException {
         FsStoreOrderVO order = fsStoreOrderService.selectFsStoreOrderByOrderIdVO(orderId);
@@ -317,7 +327,11 @@ public class FsStoreOrderController extends BaseController
     public R updateErpOrder( @RequestBody FsStoreOrder param) {
         FsStoreOrder order = fsStoreOrderService.selectFsStoreOrderByOrderId(param.getOrderId());
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
-        request.setCode(order.getExtendOrderId());
+        IErpOrderService erpOrderService = getErpService();
+        if (erpOrderService!=null){
+            request.setCode(order.getExtendOrderId());
+            request.setPlatform_code(order.getOrderCode());
+        }
         ErpOrderQueryResponse response = erpOrderService.getOrder(request);
         if(response.getOrders()!=null&&response.getOrders().size()>0){
             for(ErpOrderQuery orderQuery : response.getOrders()){
@@ -336,6 +350,29 @@ public class FsStoreOrderController extends BaseController
         return R.error("未查询到快递信息");
     }
 
+    private IErpOrderService getErpService() {
+        FsSysConfig sysConfig = configUtil.getSysConfig();
+        Integer erpOpen = sysConfig.getErpOpen();
+        if (erpOpen != null && erpOpen == 1){
+            //判断erp类型
+            Integer erpType = sysConfig.getErpType();
+            if (erpType != null){
+                IErpOrderService erpOrderService = null;
+                if (erpType == 1){
+                    //管易
+                    erpOrderService =  gyOrderService;
+                } else if (erpType == 2){
+                    //旺店通
+                    erpOrderService =  wdtOrderService;
+                }
+                return erpOrderService;
+
+
+            }
+        }
+        return null;
+    }
+
     /**
      * 删除订单
      */
@@ -459,7 +496,12 @@ public class FsStoreOrderController extends BaseController
     public R getEroOrder(@PathVariable("extendOrderId") String extendOrderId) {
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
         request.setCode(extendOrderId);
-        ErpOrderQueryResponse response = erpOrderService.getOrder(request);
+        IErpOrderService erpOrderService = getErpService();
+        ErpOrderQueryResponse response = new ErpOrderQueryResponse();
+        if (erpOrderService!=null){
+            response = erpOrderService.getOrder(request);
+        }
+
         return R.ok().put("data",response);
     }
 

+ 59 - 13
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -21,6 +21,7 @@ import com.fs.erp.dto.ErpOrderQueryRequert;
 import com.fs.erp.dto.ErpOrderQueryResponse;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.fastGpt.mapper.FastGptChatSessionMapper;
+import com.fs.his.config.FsSysConfig;
 import com.fs.his.config.StoreConfig;
 import com.fs.his.domain.FsInquiryOrder;
 import com.fs.his.domain.FsStoreAfterSales;
@@ -33,6 +34,7 @@ import com.fs.his.mapper.*;
 import com.fs.his.param.FsInquiryOrderFinishParam;
 import com.fs.his.service.*;
 import com.fs.his.service.impl.FsPackageOrderServiceImpl;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.FsSubOrderResultVO;
 import com.fs.im.dto.*;
 import com.fs.im.service.IImService;
@@ -45,6 +47,7 @@ import com.google.gson.Gson;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -72,8 +75,8 @@ public class Task {
     private IFsFollowService fsFollowService;
     @Autowired
     private IFsStoreAfterSalesService fsStoreAfterSalesService;
-    @Autowired
-    IErpOrderService erpOrderService;
+//    @Autowired
+//    IErpOrderService erpOrderService;
     @Autowired
     FsIntegralOrderMapper integralOrderMapper;
     @Autowired
@@ -139,6 +142,8 @@ public class Task {
 
     @Autowired
     ITencentCloudCosService tencentCloudCosService;
+    @Autowired
+    private ConfigUtil configUtil;
     public void videoTranscode() throws Exception
     {
 
@@ -232,27 +237,39 @@ public class Task {
 
     public void deliveryOp()
     {
-        List<FsStoreOrder> orders = fsStoreOrderMapper.selectOmsOrderdeliveryOp();
+        IErpOrderService erpOrderService = getErpService();
+        List<FsStoreOrder> orders = null;
+        if (erpOrderService == gyOrderService){
+            orders = fsStoreOrderMapper.selectOmsOrderdeliveryOp();
+        } else if (erpOrderService == wdtOrderService){
+            orders = fsStoreOrderMapper.selectWdtOmsOrderdeliveryOp();
+        }
+
         for(FsStoreOrder order:orders){
 
             ErpOrderQueryRequert request=new ErpOrderQueryRequert();
 
             request.setCode(order.getExtendOrderId());
-            ErpOrderQueryResponse response=erpOrderService.getOrder(request);
-            if(response.getOrders()!=null&&response.getOrders().size()>0){
-                for(ErpOrderQuery orderQuery : response.getOrders()){
-                    if(orderQuery.getDeliverys()!=null&&orderQuery.getDeliverys().size()>0){
-                        for(ErpDeliverys delivery:orderQuery.getDeliverys()){
-                            if(delivery.getDelivery()&& StringUtils.isNotEmpty(delivery.getMail_no())){
-                                //更新商订单状态 删除REDIS
-                                fsStoreOrderService.deliveryOrder(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name());
-                                redisCache.deleteObject("delivery"+":"+order.getExtendOrderId());
+            request.setPlatform_code(order.getOrderCode());
+
+            if (erpOrderService != null){
+                ErpOrderQueryResponse response=erpOrderService.getOrder(request);
+                if(response.getOrders()!=null&&response.getOrders().size()>0){
+                    for(ErpOrderQuery orderQuery : response.getOrders()){
+                        if(orderQuery.getDeliverys()!=null&&orderQuery.getDeliverys().size()>0){
+                            for(ErpDeliverys delivery:orderQuery.getDeliverys()){
+                                if(delivery.getDelivery()&& StringUtils.isNotEmpty(delivery.getMail_no())){
+                                    //更新商订单状态 删除REDIS
+                                    fsStoreOrderService.deliveryOrder(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name());
+                                    redisCache.deleteObject("delivery"+":"+order.getExtendOrderId());
+                                }
                             }
-                        }
 
+                        }
                     }
                 }
             }
+
         }
 
 
@@ -958,4 +975,33 @@ public class Task {
 //    }
 //
 //}
+    @Autowired
+    @Qualifier("erpOrderServiceImpl")
+    private IErpOrderService gyOrderService;
+
+    @Autowired
+    @Qualifier("wdtErpOrderServiceImpl")
+    private IErpOrderService wdtOrderService;
+    private IErpOrderService getErpService() {
+        FsSysConfig sysConfig = configUtil.getSysConfig();
+        Integer erpOpen = sysConfig.getErpOpen();
+        if (erpOpen != null && erpOpen == 1){
+            //判断erp类型
+            Integer erpType = sysConfig.getErpType();
+            if (erpType != null){
+                IErpOrderService erpOrderService = null;
+                if (erpType == 1){
+                    //管易
+                    erpOrderService =  gyOrderService;
+                } else if (erpType == 2){
+                    //旺店通
+                    erpOrderService =  wdtOrderService;
+                }
+                return erpOrderService;
+
+
+            }
+        }
+        return null;
+    }
 }

+ 41 - 1
fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java

@@ -17,6 +17,7 @@ import com.fs.erp.dto.ErpOrderQueryResponse;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
+import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.enums.ShipperCodeEnum;
@@ -27,12 +28,14 @@ import com.fs.his.param.FsStoreOrderSalesParam;
 import com.fs.his.service.IFsExportTaskService;
 import com.fs.his.service.IFsExpressService;
 import com.fs.his.service.IFsStoreOrderService;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsStoreOrderListVO;
 import com.fs.his.vo.FsStoreOrderVO;
 import com.fs.his.vo.FsStoreProductDeliverExcelVO;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -460,7 +463,12 @@ public class FsStoreOrderController extends BaseController
     public R getEroOrder(@PathVariable("extendOrderId") String extendOrderId) {
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
         request.setCode(extendOrderId);
-        ErpOrderQueryResponse response = erpOrderService.getOrder(request);
+        request.setPlatform_code(extendOrderId);
+        IErpOrderService erpOrderService = getErpService();
+        ErpOrderQueryResponse response = new ErpOrderQueryResponse();
+        if (erpOrderService != null){
+            response = erpOrderService.getOrder(request);
+        }
         return R.ok().put("data",response);
     }
     @Log(title = "同步物流", businessType = BusinessType.UPDATE)
@@ -511,4 +519,36 @@ public class FsStoreOrderController extends BaseController
         return AjaxResult.success(fsStoreOrderService.selectFsFollowVOByFollowId(followId));
     }
 
+    @Autowired
+    private ConfigUtil configUtil;
+    @Autowired
+    @Qualifier("erpOrderServiceImpl")
+    private IErpOrderService gyOrderService;
+
+    @Autowired
+    @Qualifier("wdtErpOrderServiceImpl")
+    private IErpOrderService wdtOrderService;
+    private IErpOrderService getErpService() {
+        FsSysConfig sysConfig = configUtil.getSysConfig();
+        Integer erpOpen = sysConfig.getErpOpen();
+        if (erpOpen != null && erpOpen == 1){
+            //判断erp类型
+            Integer erpType = sysConfig.getErpType();
+            if (erpType != null){
+                IErpOrderService erpOrderService = null;
+                if (erpType == 1){
+                    //管易
+                    erpOrderService =  gyOrderService;
+                } else if (erpType == 2){
+                    //旺店通
+                    erpOrderService =  wdtOrderService;
+                }
+                return erpOrderService;
+
+
+            }
+        }
+        return null;
+    }
+
 }

+ 1 - 1
fs-service/src/main/java/com/fs/erp/service/impl/WdtErpOrderServiceImpl.java

@@ -598,7 +598,7 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
     @Override
     public ErpOrderQueryResponse getOrder(ErpOrderQueryRequert param) {
         Map<String,String> map = new HashMap<>();
-        map.put("src_tid",param.getCode());
+        map.put("src_tid",param.getPlatform_code());
         try {
             String execute = client.execute("sales_trade_query.php", map);
             ParserConfig config = new ParserConfig();

+ 4 - 0
fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderMapper.java

@@ -1081,4 +1081,8 @@ public interface FsStoreOrderMapper
             "</if>" +
             "</script>"})
     Integer selectFsStoreOrderCountByType(@Param("companyId") Long companyId,@Param("userId") long userId, @Param("type")int type);
+
+    @Select("select * from fs_store_order where  `status`=2 ")
+    List<FsStoreOrder> selectWdtOmsOrderdeliveryOp();
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPackageServiceImpl.java

@@ -121,6 +121,11 @@ public class FsPackageServiceImpl implements IFsPackageService {
                 fsPackage.setTotalCostPrice(toal.add(in));
             }
 //        }
+        //如果公域改私域 需要去掉disease_type值
+        Integer isShow = fsPackage.getIsShow();
+        if (isShow != null && isShow == 0) {
+            fsPackage.setDiseaseType(-1);
+        }
         return fsPackageMapper.updateFsPackage(fsPackage);
     }
 

+ 2 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -1980,7 +1980,6 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
             return R.error("未生成管易云订单");
         }
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
-        request.setCode(order.getExtendOrderId());
 
         //判断是否开启erp
         FsSysConfig sysConfig = configUtil.getSysConfig();
@@ -1994,9 +1993,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
                 if (erpType == 1){
                     //管易
                     erpOrderService =  gyOrderService;
+                    request.setCode(order.getExtendOrderId());
                 } else if (erpType == 2){
                     //旺店通
                     erpOrderService =  wdtOrderService;
+                    request.setCode(order.getOrderCode());
                 }
                 ErpOrderQueryResponse response = erpOrderService.getOrder(request);
                 if(response.getOrders()!=null&&response.getOrders().size()>0){

+ 41 - 1
fs-store/src/main/java/com/fs/store/controller/store/FsStoreOrderController.java

@@ -9,6 +9,7 @@ import com.fs.common.utils.StringUtils;
 import com.fs.erp.dto.ErpOrderQueryRequert;
 import com.fs.erp.dto.ErpOrderQueryResponse;
 import com.fs.erp.service.IErpOrderService;
+import com.fs.his.config.FsSysConfig;
 import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.dto.FsProdItemDTO;
 import com.fs.his.enums.ShipperCodeEnum;
@@ -17,6 +18,7 @@ import com.fs.his.param.FsStoreOrderListSParam;
 import com.fs.his.param.FsStoreOrderParam;
 import com.fs.his.param.FsStoreOrderSalesParam;
 import com.fs.his.service.IFsExpressService;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.his.vo.*;
 import com.fs.store.utils.UserUtil;
 import com.fs.common.annotation.Log;
@@ -31,6 +33,7 @@ import com.fs.his.domain.FsStoreOrderLogs;
 import com.fs.his.service.IFsStoreOrderService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -56,6 +59,15 @@ public class FsStoreOrderController extends BaseController
     IErpOrderService erpOrderService;
     @Autowired
     FsStoreOrderItemMapper fsStoreOrderItemMapper;
+    @Autowired
+    private ConfigUtil configUtil;
+    @Autowired
+    @Qualifier("erpOrderServiceImpl")
+    private IErpOrderService gyOrderService;
+
+    @Autowired
+    @Qualifier("wdtErpOrderServiceImpl")
+    private IErpOrderService wdtOrderService;
     /**
      * 查询订单列表
      */
@@ -279,7 +291,12 @@ public class FsStoreOrderController extends BaseController
     public R getEroOrder(@PathVariable("extendOrderId") String extendOrderId) {
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
         request.setCode(extendOrderId);
-        ErpOrderQueryResponse response = erpOrderService.getOrder(request);
+        request.setPlatform_code(extendOrderId);
+        IErpOrderService erpOrderService = getErpService();
+        ErpOrderQueryResponse response = new ErpOrderQueryResponse();
+        if (erpOrderService != null){
+            response = erpOrderService.getOrder(request);
+        }
         return R.ok().put("data",response);
     }
     @Log(title = "同步物流", businessType = BusinessType.UPDATE)
@@ -312,4 +329,27 @@ public class FsStoreOrderController extends BaseController
         }
         return R.ok().put("data",expressInfoDTO);
     }
+
+    private IErpOrderService getErpService() {
+        FsSysConfig sysConfig = configUtil.getSysConfig();
+        Integer erpOpen = sysConfig.getErpOpen();
+        if (erpOpen != null && erpOpen == 1){
+            //判断erp类型
+            Integer erpType = sysConfig.getErpType();
+            if (erpType != null){
+                IErpOrderService erpOrderService = null;
+                if (erpType == 1){
+                    //管易
+                    erpOrderService =  gyOrderService;
+                } else if (erpType == 2){
+                    //旺店通
+                    erpOrderService =  wdtOrderService;
+                }
+                return erpOrderService;
+
+
+            }
+        }
+        return null;
+    }
 }