|
@@ -6,9 +6,11 @@ import com.iamberry.app.tool.des.MD5;
|
|
import com.iamberry.wechat.core.entity.order.Order;
|
|
import com.iamberry.wechat.core.entity.order.Order;
|
|
import com.iamberry.wechat.core.entity.order.OrderItem;
|
|
import com.iamberry.wechat.core.entity.order.OrderItem;
|
|
import com.iamberry.wechat.core.entity.product.Product;
|
|
import com.iamberry.wechat.core.entity.product.Product;
|
|
|
|
+import com.iamberry.wechat.core.entity.product.ProductColor;
|
|
import com.iamberry.wechat.face.order.AdminOrderService;
|
|
import com.iamberry.wechat.face.order.AdminOrderService;
|
|
import com.iamberry.wechat.face.porduct.ProductService;
|
|
import com.iamberry.wechat.face.porduct.ProductService;
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
|
|
+import com.iamberry.wechat.tools.ResultInfo;
|
|
import com.iamberry.wechat.tools.SendMessageUtil;
|
|
import com.iamberry.wechat.tools.SendMessageUtil;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.awt.*;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -39,6 +42,10 @@ public class ExternalDockPolyApiHandler {
|
|
@Autowired
|
|
@Autowired
|
|
private ProductService productService;
|
|
private ProductService productService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private SendMessageUtil sendMessageUtil;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* DES对称加密
|
|
* DES对称加密
|
|
*/
|
|
*/
|
|
@@ -93,7 +100,7 @@ public class ExternalDockPolyApiHandler {
|
|
map = updateOrderRemark(requstMap);
|
|
map = updateOrderRemark(requstMap);
|
|
break;
|
|
break;
|
|
case "Differ.JH.Business.DownloadProduct" : //商品下载
|
|
case "Differ.JH.Business.DownloadProduct" : //商品下载
|
|
- // map = downProduct(requstMap);
|
|
|
|
|
|
+ map = downProduct(requstMap);
|
|
break;
|
|
break;
|
|
case "Differ.JH.Business.SyncStock" : //商品库存同步
|
|
case "Differ.JH.Business.SyncStock" : //商品库存同步
|
|
break;
|
|
break;
|
|
@@ -154,9 +161,10 @@ public class ExternalDockPolyApiHandler {
|
|
order.setBeginDate(sdf.parse(startTime));
|
|
order.setBeginDate(sdf.parse(startTime));
|
|
order.setEndDate(sdf.parse(endTime));
|
|
order.setEndDate(sdf.parse(endTime));
|
|
}catch (ParseException e){
|
|
}catch (ParseException e){
|
|
|
|
+ logger.info("=========日期转换失败=========");
|
|
map.put("code","40000");
|
|
map.put("code","40000");
|
|
- map.put("message","时间格式不对");
|
|
|
|
- map.put("submessage","时间格式不对");
|
|
|
|
|
|
+ map.put("message","日期转换失败");
|
|
|
|
+ map.put("submessage","日期转换失败");
|
|
map.put("numtotalorder",0);
|
|
map.put("numtotalorder",0);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
@@ -189,14 +197,10 @@ public class ExternalDockPolyApiHandler {
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
String orderId = (String) requstMap.get("OrderID"); //平台订单号
|
|
String orderId = (String) requstMap.get("OrderID"); //平台订单号
|
|
|
|
|
|
- Order order = new Order();
|
|
|
|
- List<Order> orderList;
|
|
|
|
|
|
+ Order order;
|
|
if(orderId != null && !"".equals(orderId)){
|
|
if(orderId != null && !"".equals(orderId)){
|
|
- order.setSalesOrderid(orderId);
|
|
|
|
- orderList = adminOrderService.selectShopOrderByPola(order);
|
|
|
|
- if(orderList != null && orderList.size() > 0){
|
|
|
|
- order = orderList.get(0);
|
|
|
|
- }else{
|
|
|
|
|
|
+ order = adminOrderService.selectShopOrderByPolaById(orderId);
|
|
|
|
+ if(order == null){
|
|
map.put("code","40000");
|
|
map.put("code","40000");
|
|
map.put("message","未查询到该订单");
|
|
map.put("message","未查询到该订单");
|
|
map.put("submessage","未查询到该订单");
|
|
map.put("submessage","未查询到该订单");
|
|
@@ -208,13 +212,12 @@ public class ExternalDockPolyApiHandler {
|
|
map.put("submessage","订单号不能为空");
|
|
map.put("submessage","订单号不能为空");
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
- map.put("refundStatus ",this.getOrderRefundStatus(order.getSalesStatus())); //退款状态 必填
|
|
|
|
-
|
|
|
|
|
|
+ map.put("refundStatus",this.getOrderRefundStatus(order.getSalesStatus())); //退款状态 必填
|
|
String refundStatusdescription = "";
|
|
String refundStatusdescription = "";
|
|
if(order.getSalesReturnDes() != null){
|
|
if(order.getSalesReturnDes() != null){
|
|
refundStatusdescription = order.getSalesReturnDes();
|
|
refundStatusdescription = order.getSalesReturnDes();
|
|
}
|
|
}
|
|
- map.put("refundStatusdescription ",refundStatusdescription); //选填 退款说明
|
|
|
|
|
|
+ map.put("refundStatusdescription",refundStatusdescription); //选填 退款说明
|
|
List<Map<String,Object>> childrenrefundStatus = new ArrayList<>();
|
|
List<Map<String,Object>> childrenrefundStatus = new ArrayList<>();
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderIdToPola(order.getSalesOrderid());
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderIdToPola(order.getSalesOrderid());
|
|
for(OrderItem orderItem : orderItemList){
|
|
for(OrderItem orderItem : orderItemList){
|
|
@@ -225,10 +228,10 @@ public class ExternalDockPolyApiHandler {
|
|
childrenrefund.put("refundStatusdescription",refundStatusdescription); //选填 退款说明
|
|
childrenrefund.put("refundStatusdescription",refundStatusdescription); //选填 退款说明
|
|
childrenrefundStatus.add(childrenrefund);
|
|
childrenrefundStatus.add(childrenrefund);
|
|
}
|
|
}
|
|
- map.put("childrenrefundStatus ",childrenrefundStatus); //子订单退款说明
|
|
|
|
|
|
+ map.put("childrenrefundStatus",childrenrefundStatus); //子订单退款说明
|
|
map.put("code","10000");
|
|
map.put("code","10000");
|
|
- map.put("message","返回订单退款状态");
|
|
|
|
- map.put("submessage","返回订单退款状态,订单状态为:"+ this.getDescription(order.getSalesStatus()));
|
|
|
|
|
|
+ map.put("message","返回订单退款状态成功,订单id:"+ order.getSalesOrderid() +"订单状态为:"+ this.getDescription(order.getSalesStatus()));
|
|
|
|
+ map.put("submessage","返回订单退款状态成功");
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -279,6 +282,24 @@ public class ExternalDockPolyApiHandler {
|
|
or.setSalesPostNum(LogisticNo); //设置快递单号
|
|
or.setSalesPostNum(LogisticNo); //设置快递单号
|
|
or.setSalesStatus(5); //发货
|
|
or.setSalesStatus(5); //发货
|
|
flag = adminOrderService.deliverOrderByOrderId(or);
|
|
flag = adminOrderService.deliverOrderByOrderId(or);
|
|
|
|
+ //给用户发送消息-已发货的通知
|
|
|
|
+ String firm = this.selectFirm(LogisticType); //快递公司
|
|
|
|
+ String num = LogisticNo; //快递单号
|
|
|
|
+ try {
|
|
|
|
+ sendMessageUtil.orderSendSuccess(
|
|
|
|
+ "尊敬的朵粉,您的订单已发货,物流信息:",
|
|
|
|
+ order.getSalesOrderid(),
|
|
|
|
+ SendMessageUtil.hashmap.get(firm),
|
|
|
|
+ num,
|
|
|
|
+ order.getSalesAddressInfo(),
|
|
|
|
+ "如有问题请致电400-678-1860或直接在微信留言,soodo上朵将第一时间为您服务!(点击查看订单详情)",
|
|
|
|
+ order.getSalesOpenid(),
|
|
|
|
+ ResultInfo.ORDER_DETAIL+order.getSalesOrderid()
|
|
|
|
+ );
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.info("订单号:"+ order.getSalesOrderid() +"的订单已发货,发送微信消息失败!");
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
if(flag){
|
|
if(flag){
|
|
map.put("code","10000");
|
|
map.put("code","10000");
|
|
@@ -353,13 +374,12 @@ public class ExternalDockPolyApiHandler {
|
|
String pageSize = (String) requstMap.get("PageSize"); //每页条数(默认值:10)
|
|
String pageSize = (String) requstMap.get("PageSize"); //每页条数(默认值:10)
|
|
|
|
|
|
// map.put("code","10000");
|
|
// map.put("code","10000");
|
|
-// map.put("message","修改订单备注成功");
|
|
|
|
-// map.put("submessage","修改订单备注成功");
|
|
|
|
|
|
+// map.put("message","退货退款单下载");
|
|
|
|
+// map.put("submessage","退货退款单下载");
|
|
|
|
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取商品
|
|
* 获取商品
|
|
* @param requstMap
|
|
* @param requstMap
|
|
@@ -368,26 +388,74 @@ public class ExternalDockPolyApiHandler {
|
|
private Map<String,Object> downProduct(Map<String,Object> requstMap){
|
|
private Map<String,Object> downProduct(Map<String,Object> requstMap){
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
|
|
- Integer productId = Integer.valueOf(requstMap.get("ProductId").toString()); //可选,商品外部商家编码(注,网店管家目前尚未支持此参数的查询)
|
|
|
|
|
|
+ Integer productId = null;
|
|
|
|
+ String ProductId = requstMap.get("ProductId").toString();
|
|
|
|
+ if(ProductId != null && !"".equals(ProductId) ){
|
|
|
|
+ productId = Integer.valueOf(ProductId); //可选,商品外部商家编码(注,网店管家目前尚未支持此参数的查询)
|
|
|
|
+ }
|
|
String productName = (String) requstMap.get("ProductName"); //商品名称
|
|
String productName = (String) requstMap.get("ProductName"); //商品名称
|
|
String status = (String) requstMap.get("Status"); //商品状态(已上架商品=JH_01,已下架商品=JH_02,所有商品=JH_99)
|
|
String status = (String) requstMap.get("Status"); //商品状态(已上架商品=JH_01,已下架商品=JH_02,所有商品=JH_99)
|
|
Integer pageIndex = Integer.valueOf(requstMap.get("PageIndex").toString()) ; //开始时间
|
|
Integer pageIndex = Integer.valueOf(requstMap.get("PageIndex").toString()) ; //开始时间
|
|
Integer pageSize = Integer.valueOf(requstMap.get("PageSize").toString()); //开始时间
|
|
Integer pageSize = Integer.valueOf(requstMap.get("PageSize").toString()); //开始时间
|
|
|
|
|
|
Product product = new Product();
|
|
Product product = new Product();
|
|
- if(productId != null && !"".equals(productId)){
|
|
|
|
- product.setProductId(productId);
|
|
|
|
|
|
+
|
|
|
|
+ if(status == null || "".equals(status) || "JH_99".equals(status)){
|
|
|
|
+ product.setProductStatus(1);
|
|
|
|
+ }else if("JH_02".equals(status)){
|
|
|
|
+ List<Map<String,Object>> goodslist = new ArrayList<>();
|
|
|
|
+ map.put("code","40000");
|
|
|
|
+ map.put("totalcount",0);
|
|
|
|
+ map.put("goodslist",goodslist);
|
|
|
|
+ map.put("message","获取商品集合成功");
|
|
|
|
+ map.put("submessage","获取商品集合成功");
|
|
|
|
+ return map;
|
|
}
|
|
}
|
|
|
|
+ product.setProductId(productId);
|
|
product.getPage().setPageSize(pageSize);
|
|
product.getPage().setPageSize(pageSize);
|
|
product.getPage().setPageNumber(pageIndex);
|
|
product.getPage().setPageNumber(pageIndex);
|
|
List<Product> productList = productService.selectAllProductInfo(product);
|
|
List<Product> productList = productService.selectAllProductInfo(product);
|
|
|
|
|
|
- // TODO: 2018/2/8 商品下载
|
|
|
|
-
|
|
|
|
-// map.put("code","10000");
|
|
|
|
-// map.put("message","修改订单备注成功");
|
|
|
|
-// map.put("submessage","修改订单备注成功");
|
|
|
|
-
|
|
|
|
|
|
+ Integer num = productService.selectAllProductNum(product);
|
|
|
|
+ if(num < 1){
|
|
|
|
+ num = 1;
|
|
|
|
+ }
|
|
|
|
+ map.put("totalcount",num); //商品总数量(默认值:1)
|
|
|
|
+ List<Map<String,Object>> goodslist = new ArrayList<>();
|
|
|
|
+ for (Product pt : productList){
|
|
|
|
+ Map<String,Object> goods = new HashMap<String,Object>();
|
|
|
|
+ goods.put("PlatProductID",String.valueOf(pt.getProductId())); //平台商品ID 必填
|
|
|
|
+ goods.put("name",pt.getProductName()); //商品名称 必填
|
|
|
|
+ //外部商家编码(注:若与管家对接,这里需要返回与管家商品相匹配的编号,方便管家商品与平台商品的匹配)
|
|
|
|
+ goods.put("OuterID",String.valueOf(pt.getProductId())); //
|
|
|
|
+ double discount = pt.getProductDiscount().intValue() / 100;
|
|
|
|
+ goods.put("price",discount); //商品价格
|
|
|
|
+ // TODO: 2018/2/8 商品库存待确定
|
|
|
|
+ goods.put("num",10000); //商品数量
|
|
|
|
+ goods.put("pictureurl",""); //图片URL 可选
|
|
|
|
+ goods.put("whsecode",""); //商品所在仓库编号 可选
|
|
|
|
+ List<ProductColor> colors = pt.getColorList(); //获取颜色集合
|
|
|
|
+ List<Map<String,Object>> colorList = new ArrayList<>();
|
|
|
|
+ for(ProductColor productColor : colors){
|
|
|
|
+ Map<String,Object> colorMap = new HashMap<String,Object>();
|
|
|
|
+ colorMap.put("SkuID",String.valueOf(productColor.getColorId())); //平台规格ID
|
|
|
|
+ //规格外部商家编码(注:若与管家对接,这里需要返回与管家商品相匹配的编号,方便管家商品与平台商品的匹配)
|
|
|
|
+ colorMap.put("skuOuterID",String.valueOf(productColor.getColorId()));
|
|
|
|
+ double colorDiscount = productColor.getColorDiscount().intValue() / 100;
|
|
|
|
+ colorMap.put("skuprice",colorDiscount); //规格价格
|
|
|
|
+ colorMap.put("skuQuantity",10000); //规格数量
|
|
|
|
+ colorMap.put("skuname",productColor.getColorName()); //规格名称
|
|
|
|
+ colorMap.put("colors",""); //规格属性 可选
|
|
|
|
+ colorMap.put("skupictureurl",""); //规格图片URL 可选
|
|
|
|
+ colorList.add(colorMap);
|
|
|
|
+ }
|
|
|
|
+ goods.put("skus",colorList); //规格集合
|
|
|
|
+ goodslist.add(goods);
|
|
|
|
+ }
|
|
|
|
+ map.put("goodslist",goodslist);
|
|
|
|
+ map.put("code","10000");
|
|
|
|
+ map.put("message","获取商品集合成功");
|
|
|
|
+ map.put("submessage","获取商品集合成功");
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -832,7 +900,7 @@ public class ExternalDockPolyApiHandler {
|
|
logger.info("-----------签名验证失败---------------,sign:"+sign);
|
|
logger.info("-----------签名验证失败---------------,sign:"+sign);
|
|
throw new Exception("签名验证失败");
|
|
throw new Exception("签名验证失败");
|
|
}
|
|
}
|
|
- logger.info("-----------验证签名通过---------------");
|
|
|
|
|
|
+ logger.info("-----------菠萝派调用接口,签名验证通过。接口调用方法名:"+method);
|
|
}
|
|
}
|
|
Map requstMap = (Map) JSON.parse(bizcontent);
|
|
Map requstMap = (Map) JSON.parse(bizcontent);
|
|
return requstMap;
|
|
return requstMap;
|