|
@@ -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.OrderItem;
|
|
|
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.porduct.ProductService;
|
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
|
+import com.iamberry.wechat.tools.ResultInfo;
|
|
|
import com.iamberry.wechat.tools.SendMessageUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.awt.*;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
@@ -39,6 +42,10 @@ public class ExternalDockPolyApiHandler {
|
|
|
@Autowired
|
|
|
private ProductService productService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SendMessageUtil sendMessageUtil;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
* DES对称加密
|
|
|
*/
|
|
@@ -93,7 +100,7 @@ public class ExternalDockPolyApiHandler {
|
|
|
map = updateOrderRemark(requstMap);
|
|
|
break;
|
|
|
case "Differ.JH.Business.DownloadProduct" :
|
|
|
-
|
|
|
+ map = downProduct(requstMap);
|
|
|
break;
|
|
|
case "Differ.JH.Business.SyncStock" :
|
|
|
break;
|
|
@@ -154,9 +161,10 @@ public class ExternalDockPolyApiHandler {
|
|
|
order.setBeginDate(sdf.parse(startTime));
|
|
|
order.setEndDate(sdf.parse(endTime));
|
|
|
}catch (ParseException e){
|
|
|
+ logger.info("=========日期转换失败=========");
|
|
|
map.put("code","40000");
|
|
|
- map.put("message","时间格式不对");
|
|
|
- map.put("submessage","时间格式不对");
|
|
|
+ map.put("message","日期转换失败");
|
|
|
+ map.put("submessage","日期转换失败");
|
|
|
map.put("numtotalorder",0);
|
|
|
return map;
|
|
|
}
|
|
@@ -189,14 +197,10 @@ public class ExternalDockPolyApiHandler {
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
String orderId = (String) requstMap.get("OrderID");
|
|
|
|
|
|
- Order order = new Order();
|
|
|
- List<Order> orderList;
|
|
|
+ Order order;
|
|
|
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("message","未查询到该订单");
|
|
|
map.put("submessage","未查询到该订单");
|
|
@@ -208,13 +212,12 @@ public class ExternalDockPolyApiHandler {
|
|
|
map.put("submessage","订单号不能为空");
|
|
|
return map;
|
|
|
}
|
|
|
- map.put("refundStatus ",this.getOrderRefundStatus(order.getSalesStatus()));
|
|
|
-
|
|
|
+ map.put("refundStatus",this.getOrderRefundStatus(order.getSalesStatus()));
|
|
|
String refundStatusdescription = "";
|
|
|
if(order.getSalesReturnDes() != null){
|
|
|
refundStatusdescription = order.getSalesReturnDes();
|
|
|
}
|
|
|
- map.put("refundStatusdescription ",refundStatusdescription);
|
|
|
+ map.put("refundStatusdescription",refundStatusdescription);
|
|
|
List<Map<String,Object>> childrenrefundStatus = new ArrayList<>();
|
|
|
List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderIdToPola(order.getSalesOrderid());
|
|
|
for(OrderItem orderItem : orderItemList){
|
|
@@ -225,10 +228,10 @@ public class ExternalDockPolyApiHandler {
|
|
|
childrenrefund.put("refundStatusdescription",refundStatusdescription);
|
|
|
childrenrefundStatus.add(childrenrefund);
|
|
|
}
|
|
|
- map.put("childrenrefundStatus ",childrenrefundStatus);
|
|
|
+ map.put("childrenrefundStatus",childrenrefundStatus);
|
|
|
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;
|
|
|
}
|
|
|
|
|
@@ -279,6 +282,24 @@ public class ExternalDockPolyApiHandler {
|
|
|
or.setSalesPostNum(LogisticNo);
|
|
|
or.setSalesStatus(5);
|
|
|
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){
|
|
|
map.put("code","10000");
|
|
@@ -353,13 +374,12 @@ public class ExternalDockPolyApiHandler {
|
|
|
String pageSize = (String) requstMap.get("PageSize");
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
* 获取商品
|
|
|
* @param requstMap
|
|
@@ -368,26 +388,74 @@ public class ExternalDockPolyApiHandler {
|
|
|
private Map<String,Object> downProduct(Map<String,Object> requstMap){
|
|
|
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 status = (String) requstMap.get("Status");
|
|
|
Integer pageIndex = Integer.valueOf(requstMap.get("PageIndex").toString()) ;
|
|
|
Integer pageSize = Integer.valueOf(requstMap.get("PageSize").toString());
|
|
|
|
|
|
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().setPageNumber(pageIndex);
|
|
|
List<Product> productList = productService.selectAllProductInfo(product);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ Integer num = productService.selectAllProductNum(product);
|
|
|
+ if(num < 1){
|
|
|
+ num = 1;
|
|
|
+ }
|
|
|
+ map.put("totalcount",num);
|
|
|
+ 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()));
|
|
|
+ goods.put("name",pt.getProductName());
|
|
|
+
|
|
|
+ goods.put("OuterID",String.valueOf(pt.getProductId()));
|
|
|
+ double discount = pt.getProductDiscount().intValue() / 100;
|
|
|
+ goods.put("price",discount);
|
|
|
+
|
|
|
+ goods.put("num",10000);
|
|
|
+ goods.put("pictureurl","");
|
|
|
+ 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()));
|
|
|
+
|
|
|
+ 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","");
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
@@ -832,7 +900,7 @@ public class ExternalDockPolyApiHandler {
|
|
|
logger.info("-----------签名验证失败---------------,sign:"+sign);
|
|
|
throw new Exception("签名验证失败");
|
|
|
}
|
|
|
- logger.info("-----------验证签名通过---------------");
|
|
|
+ logger.info("-----------菠萝派调用接口,签名验证通过。接口调用方法名:"+method);
|
|
|
}
|
|
|
Map requstMap = (Map) JSON.parse(bizcontent);
|
|
|
return requstMap;
|