|
@@ -4,6 +4,9 @@ import com.iamberry.rst.core.cm.CompanyInfo;
|
|
|
import com.iamberry.rst.core.cm.SalesOrder;
|
|
|
import com.iamberry.rst.core.cm.SalesOrderItem;
|
|
|
import com.iamberry.rst.core.cm.StoreInfo;
|
|
|
+import com.iamberry.rst.core.dm.DealerChannel;
|
|
|
+import com.iamberry.rst.core.dm.DealerProduct;
|
|
|
+import com.iamberry.rst.core.dm.DealerProductStore;
|
|
|
import com.iamberry.rst.core.order.*;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.core.sys.Admin;
|
|
@@ -12,6 +15,7 @@ import com.iamberry.rst.faces.cm.CompanyInfoService;
|
|
|
import com.iamberry.rst.faces.cm.SalesOrderService;
|
|
|
import com.iamberry.rst.faces.cm.StoreInfoService;
|
|
|
import com.iamberry.rst.faces.dm.DealerChannelService;
|
|
|
+import com.iamberry.rst.faces.dm.DealerProductService;
|
|
|
import com.iamberry.rst.faces.order.EfastOrderService;
|
|
|
import com.iamberry.rst.faces.order.LogisticsInfoService;
|
|
|
import com.iamberry.rst.faces.order.OrderBatchService;
|
|
@@ -76,6 +80,8 @@ public class AdminSalesOrderController {
|
|
|
private OrderWarehouseService orderWarehouseService;
|
|
|
@Autowired
|
|
|
private DealerChannelService dealerChannelService;
|
|
|
+ @Autowired
|
|
|
+ private DealerProductService dealerProductService;
|
|
|
/**
|
|
|
* 分页查询订单列表信息
|
|
|
* @param request
|
|
@@ -1941,87 +1947,74 @@ public class AdminSalesOrderController {
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/get_product")
|
|
|
- public ResponseJson getProduct(HttpServletRequest request, ProductColor productColor,Integer storeId) throws Exception {
|
|
|
+ public ResponseJson getProduct(HttpServletRequest request, ProductColor productColor,Integer storeId,Integer salesOrderStatus) throws Exception {
|
|
|
ResponseJson rj = new ResponseJson(200, "SUCCESS", 200);
|
|
|
+
|
|
|
+ if(productColor.getColorIds()!=null && !"".equals(productColor.getColorIds())){
|
|
|
+ String[] colorIdStr = productColor.getColorIds().split("_");
|
|
|
+ productColor.setColorIdStr(colorIdStr);
|
|
|
+ }
|
|
|
productColor.setColorStatus(1);
|
|
|
List<ProductColor> productColorList = productService.listproductAndColor(productColor);
|
|
|
|
|
|
-// DealerChannel dealerChannel = new DealerChannel();
|
|
|
-// boolean flag = true;
|
|
|
-// if(storeId != null){
|
|
|
-// dealerChannel.setStoreId(storeId);
|
|
|
-// List<DealerChannel> dealerChannelList = dealerChannelService.getDealerChannelList(dealerChannel);
|
|
|
-// if(dealerChannelList!= null && dealerChannelList.size() > 0){
|
|
|
-// dealerChannel = dealerChannelList.get(0);
|
|
|
-// }else{
|
|
|
-// order.setReturnStatus("error");
|
|
|
-// order.setReturnMsg("订单导入失败-查询店铺对应客户信息失败,店铺ID:"+order.getStoreId()+"。");
|
|
|
-// order.setPlatformOrderId("1");
|
|
|
-// flag = false;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(flag){
|
|
|
-// if(1 == dealerChannel.getDealerSelfOperated()){
|
|
|
-// //是否自营 1:自营 2:非自营
|
|
|
-// String colorDiscount = "-1";
|
|
|
-// colorDiscount = getValue(temp.getCell(discountColumnIndex)).trim();
|
|
|
-// if(colorDiscount != null && !"".equals(colorDiscount)){
|
|
|
-// colorDiscount = colorDiscount.replaceAll("\\r|\\r|\\n","");
|
|
|
-// }
|
|
|
-// if(colorDiscount == null || "".equals(colorDiscount)){
|
|
|
-// order.setReturnStatus("error");
|
|
|
-// order.setReturnMsg("价格不正确"+"。");
|
|
|
-// order.setPlatformOrderId("1");
|
|
|
-// }else{
|
|
|
-// // 计算单个价格
|
|
|
-// Double colorDiscountDou = Double.valueOf(colorDiscount);
|
|
|
-// colorDiscountDou = colorDiscountDou*100/orderNumByInt;
|
|
|
-// order.setOrderProductDiscount(colorDiscountDou.intValue());
|
|
|
-// order.setOrderProductPrice(colorDiscountDou.intValue());
|
|
|
-// //赋值小结
|
|
|
-// Double orderTotal = Double.valueOf(colorDiscount);
|
|
|
-// orderTotal = orderTotal*100;
|
|
|
-// order.setOrderTotal(orderTotal.intValue());
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// //2:非自营
|
|
|
-// DealerProduct dealerProduct = new DealerProduct();
|
|
|
-// dealerProduct.setDealerId(dealerChannel.getDealerId());
|
|
|
-// dealerProduct.setColorBar(OrderProductBarCodeValue);
|
|
|
-// List<DealerProduct> dealerProductList = dealerProductService.getDealerProductAndStoreList(dealerProduct);
|
|
|
-// if(dealerProductList != null && dealerProductList.size() > 0){
|
|
|
-// for (DealerProduct dp:dealerProductList) {
|
|
|
-// if(1 == dp.getDealProdStoreArea()){
|
|
|
-// // 1:全部店铺
|
|
|
-// order.setOrderProductDiscount(dp.getDealProdPrice());
|
|
|
-// order.setOrderProductPrice(dp.getDealProdPrice());
|
|
|
-// order.setOrderTotal(dp.getDealProdPrice()*orderNumByInt);
|
|
|
-// }else{
|
|
|
-// // 2:部分店铺
|
|
|
-// for (DealerProductStore dps:dp.getDealerProductStoreList()) {
|
|
|
-// if(order.getStoreId().equals(dps.getStoreId())){
|
|
|
-// order.setOrderProductDiscount(dp.getDealProdPrice());
|
|
|
-// order.setOrderProductPrice(dp.getDealProdPrice());
|
|
|
-// order.setOrderTotal(dp.getDealProdPrice()*orderNumByInt);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// order.setReturnStatus("error");
|
|
|
-// order.setReturnMsg("订单导入-未能从该客户中获取到对应产品的信息,客户名称:"+dealerChannel.getDealerName()+",产品SKU:"+ OrderProductBarCodeValue+"。");
|
|
|
-// order.setPlatformOrderId("1");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// for (:
|
|
|
-// ) {
|
|
|
-//
|
|
|
-// }
|
|
|
+ //是否自营 1:自营 2:非自营
|
|
|
+ Integer dealerSelfOperated=0;
|
|
|
+ if(salesOrderStatus == 1){
|
|
|
+ DealerChannel dealerChannel = new DealerChannel();
|
|
|
+ boolean flag = true;
|
|
|
+ if(storeId != null){
|
|
|
+
|
|
|
+ StoreInfo storeInfo = storeInfoService.getStoreInfoById(storeId);
|
|
|
+
|
|
|
+ dealerChannel.setStoreId(storeId);
|
|
|
+ List<DealerChannel> dealerChannelList = dealerChannelService.getDealerChannelList(dealerChannel);
|
|
|
+ if(dealerChannelList!= null && dealerChannelList.size() > 0){
|
|
|
+ dealerChannel = dealerChannelList.get(0);
|
|
|
+ }else{
|
|
|
+ rj = ResponseJson.getFAILURE();
|
|
|
+ rj.setResultMsg("查询店铺对应客户信息失败,店铺名称:"+storeInfo.getStoreName());
|
|
|
+ return rj;
|
|
|
+ }
|
|
|
+
|
|
|
+ dealerSelfOperated = dealerChannel.getDealerSelfOperated();
|
|
|
+
|
|
|
+ if(2 == dealerChannel.getDealerSelfOperated()){
|
|
|
+ //2:非自营
|
|
|
+ for (ProductColor pc:productColorList) {
|
|
|
+ DealerProduct dealerProduct = new DealerProduct();
|
|
|
+ dealerProduct.setDealerId(dealerChannel.getDealerId());
|
|
|
+ dealerProduct.setColorBar(pc.getColorBar());
|
|
|
+ List<DealerProduct> dealerProductList = dealerProductService.getDealerProductAndStoreList(dealerProduct);
|
|
|
+ if(dealerProductList != null && dealerProductList.size() > 0){
|
|
|
+ for (DealerProduct dp:dealerProductList) {
|
|
|
+ if(1 == dp.getDealProdStoreArea()){
|
|
|
+ // 1:全部店铺
|
|
|
+ pc.setColorDiscount(dp.getDealProdPrice());
|
|
|
+ pc.setColorPrice(dp.getDealProdPrice());
|
|
|
+ }else{
|
|
|
+ // 2:部分店铺
|
|
|
+ for (DealerProductStore dps:dp.getDealerProductStoreList()) {
|
|
|
+ if(storeId.equals(dps.getStoreId())){
|
|
|
+ pc.setColorDiscount(dp.getDealProdPrice());
|
|
|
+ pc.setColorPrice(dp.getDealProdPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ rj = ResponseJson.getFAILURE();
|
|
|
+ rj.setResultMsg("未能从该客户中获取到对应产品的信息,客户名称:"+dealerChannel.getDealerName()+";产品名称:"+ pc.getProductName() +"("+ pc.getColorName() +")。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ rj = ResponseJson.getFAILURE();
|
|
|
+ rj.setResultMsg("查询店铺对应客户信息失败,店铺ID为空。");
|
|
|
+ return rj;
|
|
|
+ }
|
|
|
+ }
|
|
|
rj.addResponseKeyValue("productColorList",productColorList);
|
|
|
+ rj.addResponseKeyValue("dealerSelfOperated",dealerSelfOperated);
|
|
|
return rj;
|
|
|
}
|
|
|
}
|