Quellcode durchsuchen

接收kmall推送数据和向外部提供接口查询

qng vor 3 Jahren
Ursprung
Commit
44180aeab8

+ 49 - 0
eccs-biz/src/main/java/com/emato/biz/controller/mall/SalesDetailController.java

@@ -0,0 +1,49 @@
+package com.emato.biz.controller.mall;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.emato.biz.domain.mall.NewSystemFormatEntiy;
+import com.emato.biz.service.mall.ISalesDetaiServicel;
+import com.emato.common.annotation.AnonymousAccess;
+import com.emato.common.core.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/salesdetail")
+public class SalesDetailController {
+
+
+    @Autowired
+    private ISalesDetaiServicel salesDetaiServicel;
+
+
+    /**
+     * kmall向eccs系统推送数据
+     * @param newSystemFormatEntiy
+     * @return
+     */
+    @AnonymousAccess
+    @PostMapping("/eccspushsales")
+    public Result pushSalesDetailServicel(@RequestBody NewSystemFormatEntiy newSystemFormatEntiy)
+    {
+        return Result.success(salesDetaiServicel.pushSalesDetaiServicel(newSystemFormatEntiy));
+    }
+
+    /**
+     * 外部系统查询订单销售数据
+     * @param msg
+     * @return
+     */
+    @AnonymousAccess
+    @PostMapping("/getsalesdet")
+    public Result getSalesDetaiData(@RequestBody JSONObject msg)
+    {
+        return salesDetaiServicel.getSalesDetaiData(msg);
+    }
+
+
+}

+ 373 - 0
eccs-biz/src/main/java/com/emato/biz/domain/mall/NewSystemFormatEntiy.java

@@ -0,0 +1,373 @@
+package com.emato.biz.domain.mall;
+
+import java.io.Serializable;
+
+/**
+ * 线下订单实体类(新)
+ * 用于接收数据
+ */
+public class NewSystemFormatEntiy implements Serializable {
+
+    private String storeNameSn;//门店名称
+    private String merchSn;//商户编号
+    private String merchSnName;//商户名称
+    private String thirdMerchSn;//第三方商户编号
+    private String thirdMerchSnName;//第三方商户名称
+    private String receiptNo;// 销售单号
+    private String cashRegisterNo;// 收银台
+    private String timeStampDetails;// 销售时间
+    private String staffID;// 收银员
+    private String staffName;// 收银员姓名
+    private String hsCode;// 品类编码
+    private String hsCodeName;// 品类名称
+    private String ematouCode;// 商品编码
+    private String plu;// PLU
+    private String mychemID;// MychemID
+    private String productNameEN;// 商品名称(英文)
+    private String productNameCN;// 商品名称(中文)
+    private String barcode;// 商品主条码
+    private String packSize;// 规格
+    private String productSpecification;// 单位
+    private String brand;// 品牌
+    private String edlp;// 日常价
+    private String currentPrice;// 实际销售价
+    private String costPrice;// 进货价
+    private String taxRate;// 综合税率
+    private String productCategory;// 商品类型
+    private String supplierName;// 主供应商名称
+    private String transactionType;// 销售类型
+    private String saleReturnType;// 退货类型
+    private String remark;// 备注
+    private Integer goodsId; // 商品id
+    private String orderStatus;//订单状态
+    private String taxPrice; // 税费
+    //private String outRefundNo;//退款订单号
+    //private String refundTime;//退款时间
+    //private String primeCost;//成本价=备案单价*货物数量(门店现有库存)
+    //private String goodsNumber;//可用库存数
+    private String storeName;//门店名称
+    private String payFlag;//支付方式
+    private String orderSnWx;//微信流水号
+    private String orderSnAli;//支付宝流水号
+
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    public String getMerchSnName() {
+        return merchSnName;
+    }
+
+    public void setMerchSnName(String merchSnName) {
+        this.merchSnName = merchSnName;
+    }
+
+    public String getThirdMerchSn() {
+        return thirdMerchSn;
+    }
+
+    public void setThirdMerchSn(String thirdMerchSn) {
+        this.thirdMerchSn = thirdMerchSn;
+    }
+
+    public String getThirdMerchSnName() {
+        return thirdMerchSnName;
+    }
+
+    public void setThirdMerchSnName(String thirdMerchSnName) {
+        this.thirdMerchSnName = thirdMerchSnName;
+    }
+
+    public String getReceiptNo() {
+        return receiptNo;
+    }
+
+    public void setReceiptNo(String receiptNo) {
+        this.receiptNo = receiptNo;
+    }
+
+    public String getCashRegisterNo() {
+        return cashRegisterNo;
+    }
+
+    public void setCashRegisterNo(String cashRegisterNo) {
+        this.cashRegisterNo = cashRegisterNo;
+    }
+
+    public String getTimeStampDetails() {
+        return timeStampDetails;
+    }
+
+    public void setTimeStampDetails(String timeStampDetails) {
+        this.timeStampDetails = timeStampDetails;
+    }
+
+    public String getStaffID() {
+        return staffID;
+    }
+
+    public void setStaffID(String staffID) {
+        this.staffID = staffID;
+    }
+
+    public String getStaffName() {
+        return staffName;
+    }
+
+    public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+
+    public String getHsCode() {
+        return hsCode;
+    }
+
+    public void setHsCode(String hsCode) {
+        this.hsCode = hsCode;
+    }
+
+    public String getHsCodeName() {
+        return hsCodeName;
+    }
+
+    public void setHsCodeName(String hsCodeName) {
+        this.hsCodeName = hsCodeName;
+    }
+
+    public String getEmatouCode() {
+        return ematouCode;
+    }
+
+    public void setEmatouCode(String ematouCode) {
+        this.ematouCode = ematouCode;
+    }
+
+    public String getPlu() {
+        return plu;
+    }
+
+    public void setPlu(String plu) {
+        this.plu = plu;
+    }
+
+    public String getMychemID() {
+        return mychemID;
+    }
+
+    public void setMychemID(String mychemID) {
+        this.mychemID = mychemID;
+    }
+
+    public String getProductNameEN() {
+        return productNameEN;
+    }
+
+    public void setProductNameEN(String productNameEN) {
+        this.productNameEN = productNameEN;
+    }
+
+    public String getProductNameCN() {
+        return productNameCN;
+    }
+
+    public void setProductNameCN(String productNameCN) {
+        this.productNameCN = productNameCN;
+    }
+
+    public String getBarcode() {
+        return barcode;
+    }
+
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    public String getPackSize() {
+        return packSize;
+    }
+
+    public void setPackSize(String packSize) {
+        this.packSize = packSize;
+    }
+
+    public String getProductSpecification() {
+        return productSpecification;
+    }
+
+    public void setProductSpecification(String productSpecification) {
+        this.productSpecification = productSpecification;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getEdlp() {
+        return edlp;
+    }
+
+    public void setEdlp(String edlp) {
+        this.edlp = edlp;
+    }
+
+    public String getCurrentPrice() {
+        return currentPrice;
+    }
+
+    public void setCurrentPrice(String currentPrice) {
+        this.currentPrice = currentPrice;
+    }
+
+    public String getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(String costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public String getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(String taxRate) {
+        this.taxRate = taxRate;
+    }
+
+    public String getProductCategory() {
+        return productCategory;
+    }
+
+    public void setProductCategory(String productCategory) {
+        this.productCategory = productCategory;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    public String getTransactionType() {
+        return transactionType;
+    }
+
+    public void setTransactionType(String transactionType) {
+        this.transactionType = transactionType;
+    }
+
+    public String getSaleReturnType() {
+        return saleReturnType;
+    }
+
+    public void setSaleReturnType(String saleReturnType) {
+        this.saleReturnType = saleReturnType;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Integer getGoodsId() {
+        return goodsId;
+    }
+
+    public void setGoodsId(Integer goodsId) {
+        this.goodsId = goodsId;
+    }
+
+    public String getOrderStatus() {
+        return orderStatus;
+    }
+
+    public void setOrderStatus(String orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+
+    public String getTaxPrice() {
+        return taxPrice;
+    }
+
+    public void setTaxPrice(String taxPrice) {
+        this.taxPrice = taxPrice;
+    }
+
+//    public String getOutRefundNo() {
+//        return outRefundNo;
+//    }
+//
+//    public void setOutRefundNo(String outRefundNo) {
+//        this.outRefundNo = outRefundNo;
+//    }
+
+//    public String getRefundTime() {
+//        return refundTime;
+//    }
+//
+//    public void setRefundTime(String refundTime) {
+//        this.refundTime = refundTime;
+//    }
+
+//    public String getGoodsNumber() {
+//        return goodsNumber;
+//    }
+//
+//    public void setGoodsNumber(String goodsNumber) {
+//        this.goodsNumber = goodsNumber;
+//    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
+    public String getPayFlag() {
+        return payFlag;
+    }
+
+    public void setPayFlag(String payFlag) {
+        this.payFlag = payFlag;
+    }
+
+    public String getOrderSnWx() {
+        return orderSnWx;
+    }
+
+    public void setOrderSnWx(String orderSnWx) {
+        this.orderSnWx = orderSnWx;
+    }
+
+    public String getOrderSnAli() {
+        return orderSnAli;
+    }
+
+    public void setOrderSnAli(String orderSnAli) {
+        this.orderSnAli = orderSnAli;
+    }
+
+    public String getStoreNameSn() {
+        return storeNameSn;
+    }
+
+    public void setStoreNameSn(String storeNameSn) {
+        this.storeNameSn = storeNameSn;
+    }
+}

+ 336 - 0
eccs-biz/src/main/java/com/emato/biz/domain/mall/PushSystemOdOderVo.java

@@ -0,0 +1,336 @@
+package com.emato.biz.domain.mall;
+
+import java.io.Serializable;
+
+public class PushSystemOdOderVo implements Serializable {
+
+    private String storeNameSn;//门店名称
+    //private String merchSn;//商户编号
+    //private String merchSnName;//商户名称
+    //private String thirdMerchSn;//第三方商户编号
+    //private String thirdMerchSnName;//第三方商户名称
+    private String receiptNo;// 销售单号
+    private String cashRegisterNo;// 收银台
+    private String timeStampDetails;// 销售时间
+    private String staffID;// 收银员
+    private String staffName;// 收银员姓名
+    //private String hsCode;// 品类编码
+    private String hsCodeName;// 品类名称
+    private String ematouCode;// 商品编码
+    private String plu;// PLU
+    private String mychemID;// MychemID
+    private String productNameEN;// 商品名称(英文)
+    private String productNameCN;// 商品名称(中文)
+    private String barcode;// 商品主条码
+    private String packSize;// 规格
+    private String productSpecification;// 单位
+    private String brand;// 品牌
+    private String edlp;// 日常价
+    private String currentPrice;// 实际销售价
+    private String costPrice;// 进货价
+    //private String taxRate;// 综合税率
+    //private String productCategory;// 商品类型
+    private String supplierName;// 主供应商名称
+    private String transactionType;// 销售类型
+    private String saleReturnType;// 退货类型
+    private String remark;// 备注
+    //private Integer goodsId; // 商品id
+    private String orderStatus;//订单状态
+    private String taxPrice; // 税费
+//    private String outRefundNo;//退款订单号
+//    private String refundTime;//退款时间
+    //private String primeCost;//成本价=备案单价*货物数量(门店现有库存)
+    //private String goodsNumber;//可用库存数
+    private String storeName;//门店名称
+    private String payFlag;//支付方式
+    private String orderSnWx;//微信流水号
+    private String orderSnAli;//支付宝流水号
+
+//    public String getMerchSnName() {
+//        return merchSnName;
+//    }
+//
+//    public void setMerchSnName(String merchSnName) {
+//        this.merchSnName = merchSnName;
+//    }
+
+//    public String getThirdMerchSnName() {
+//        return thirdMerchSnName;
+//    }
+//
+//    public void setThirdMerchSnName(String thirdMerchSnName) {
+//        this.thirdMerchSnName = thirdMerchSnName;
+//    }
+
+    public String getReceiptNo() {
+        return receiptNo;
+    }
+
+    public void setReceiptNo(String receiptNo) {
+        this.receiptNo = receiptNo;
+    }
+
+    public String getCashRegisterNo() {
+        return cashRegisterNo;
+    }
+
+    public void setCashRegisterNo(String cashRegisterNo) {
+        this.cashRegisterNo = cashRegisterNo;
+    }
+
+    public String getTimeStampDetails() {
+        return timeStampDetails;
+    }
+
+    public void setTimeStampDetails(String timeStampDetails) {
+        this.timeStampDetails = timeStampDetails;
+    }
+
+    public String getStaffID() {
+        return staffID;
+    }
+
+    public void setStaffID(String staffID) {
+        this.staffID = staffID;
+    }
+
+    public String getStaffName() {
+        return staffName;
+    }
+
+    public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+
+    public String getHsCodeName() {
+        return hsCodeName;
+    }
+
+    public void setHsCodeName(String hsCodeName) {
+        this.hsCodeName = hsCodeName;
+    }
+
+    public String getEmatouCode() {
+        return ematouCode;
+    }
+
+    public void setEmatouCode(String ematouCode) {
+        this.ematouCode = ematouCode;
+    }
+
+    public String getPlu() {
+        return plu;
+    }
+
+    public void setPlu(String plu) {
+        this.plu = plu;
+    }
+
+    public String getMychemID() {
+        return mychemID;
+    }
+
+    public void setMychemID(String mychemID) {
+        this.mychemID = mychemID;
+    }
+
+    public String getProductNameEN() {
+        return productNameEN;
+    }
+
+    public void setProductNameEN(String productNameEN) {
+        this.productNameEN = productNameEN;
+    }
+
+    public String getProductNameCN() {
+        return productNameCN;
+    }
+
+    public void setProductNameCN(String productNameCN) {
+        this.productNameCN = productNameCN;
+    }
+
+    public String getBarcode() {
+        return barcode;
+    }
+
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    public String getPackSize() {
+        return packSize;
+    }
+
+    public void setPackSize(String packSize) {
+        this.packSize = packSize;
+    }
+
+    public String getProductSpecification() {
+        return productSpecification;
+    }
+
+    public void setProductSpecification(String productSpecification) {
+        this.productSpecification = productSpecification;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getEdlp() {
+        return edlp;
+    }
+
+    public void setEdlp(String edlp) {
+        this.edlp = edlp;
+    }
+
+    public String getCurrentPrice() {
+        return currentPrice;
+    }
+
+    public void setCurrentPrice(String currentPrice) {
+        this.currentPrice = currentPrice;
+    }
+
+    public String getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(String costPrice) {
+        this.costPrice = costPrice;
+    }
+
+//    public String getTaxRate() {
+//        return taxRate;
+//    }
+//
+//    public void setTaxRate(String taxRate) {
+//        this.taxRate = taxRate;
+//    }
+
+//    public String getProductCategory() {
+//        return productCategory;
+//    }
+//
+//    public void setProductCategory(String productCategory) {
+//        this.productCategory = productCategory;
+//    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    public String getTransactionType() {
+        return transactionType;
+    }
+
+    public void setTransactionType(String transactionType) {
+        this.transactionType = transactionType;
+    }
+
+    public String getSaleReturnType() {
+        return saleReturnType;
+    }
+
+    public void setSaleReturnType(String saleReturnType) {
+        this.saleReturnType = saleReturnType;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getOrderStatus() {
+        return orderStatus;
+    }
+
+    public void setOrderStatus(String orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+
+    public String getTaxPrice() {
+        return taxPrice;
+    }
+
+    public void setTaxPrice(String taxPrice) {
+        this.taxPrice = taxPrice;
+    }
+
+//    public String getOutRefundNo() {
+//        return outRefundNo;
+//    }
+//
+//    public void setOutRefundNo(String outRefundNo) {
+//        this.outRefundNo = outRefundNo;
+//    }
+//
+//    public String getRefundTime() {
+//        return refundTime;
+//    }
+//
+//    public void setRefundTime(String refundTime) {
+//        this.refundTime = refundTime;
+//    }
+
+//    public String getGoodsNumber() {
+//        return goodsNumber;
+//    }
+//
+//    public void setGoodsNumber(String goodsNumber) {
+//        this.goodsNumber = goodsNumber;
+//    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
+    public String getPayFlag() {
+        return payFlag;
+    }
+
+    public void setPayFlag(String payFlag) {
+        this.payFlag = payFlag;
+    }
+
+    public String getOrderSnWx() {
+        return orderSnWx;
+    }
+
+    public void setOrderSnWx(String orderSnWx) {
+        this.orderSnWx = orderSnWx;
+    }
+
+    public String getOrderSnAli() {
+        return orderSnAli;
+    }
+
+    public void setOrderSnAli(String orderSnAli) {
+        this.orderSnAli = orderSnAli;
+    }
+
+    public String getStoreNameSn() {
+        return storeNameSn;
+    }
+
+    public void setStoreNameSn(String storeNameSn) {
+        this.storeNameSn = storeNameSn;
+    }
+}

+ 13 - 0
eccs-biz/src/main/java/com/emato/biz/mapper/mall/MallMngChangeMapper.java

@@ -1,7 +1,11 @@
 package com.emato.biz.mapper.mall;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
+
 import com.emato.biz.domain.mall.MallMngChange;
+import com.emato.biz.domain.mall.NewSystemFormatEntiy;
 
 /**
  * 电商库存变化记录表Mapper接口
@@ -58,4 +62,13 @@ public interface MallMngChangeMapper
      * @return 结果
      */
     public int deleteMallMngChangeByIds(Long[] ids);
+
+
+    List<NewSystemFormatEntiy> getSalesDetaiData(Map<String, Object> weChatMapMsg);
+
+    void pullQueryData(Map map);
+
+    int pushSalesDetaiDate(NewSystemFormatEntiy newSystemFormatEntiy);
+
+    Date getPullDataTime(String tranDirection);
 }

+ 17 - 0
eccs-biz/src/main/java/com/emato/biz/mapper/mall/SalesDetailMapper.java

@@ -0,0 +1,17 @@
+package com.emato.biz.mapper.mall;
+
+import com.emato.biz.domain.mall.NewSystemFormatEntiy;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+@Component
+public interface SalesDetailMapper {
+
+    public List<NewSystemFormatEntiy> getSalesDetaiData(Map<String, Object> weChatMapMsg);
+
+    public void pullQueryData(Map map);
+
+    public int pushSalesDetaiDate(NewSystemFormatEntiy newSystemFormatEntiy);
+}

+ 91 - 0
eccs-biz/src/main/java/com/emato/biz/service/impl/SalesDetaiServicelImpl.java

@@ -0,0 +1,91 @@
+package com.emato.biz.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.emato.biz.domain.mall.NewSystemFormatEntiy;
+import com.emato.biz.mapper.mall.MallMngChangeMapper;
+import com.emato.biz.mapper.mall.SalesDetailMapper;
+import com.emato.biz.service.mall.ISalesDetaiServicel;
+import com.emato.common.core.Result;
+import com.emato.common.utils.DateUtils;
+import com.emato.common.utils.sign.Md5Utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class SalesDetaiServicelImpl implements ISalesDetaiServicel {
+
+
+    private final Logger logger = LoggerFactory.getLogger(SalesDetaiServicelImpl.class);
+
+    @Autowired
+    private SalesDetailMapper salesDetailMapper;
+
+    @Autowired
+    private MallMngChangeMapper mallMngChangeMapper;
+
+    /**
+     * kmall向eccs系统推送数据
+     * @param newSystemFormatEntiy
+     * @return
+     */
+    @Override
+    public int pushSalesDetaiServicel(NewSystemFormatEntiy newSystemFormatEntiy) {
+        return mallMngChangeMapper.pushSalesDetaiDate(newSystemFormatEntiy);
+    }
+
+    /**
+     * 外部系统查询订单销售数据
+     * @param msg
+     * @return
+     */
+    @Override
+    public Result getSalesDetaiData(JSONObject msg) {
+        try {
+
+            Map<String, Object> weChatMapMsg = JSONObject.toJavaObject(msg, Map.class);
+            logger.error("外部系统查询订单销售数据查询条件:"+JSON.toJSONString(weChatMapMsg));
+            weChatMapMsg.put("starTime", DateUtils.getStrDate((String) weChatMapMsg.get("starTime")));
+            weChatMapMsg.put("endTime",DateUtils.getStrDate((String)weChatMapMsg.get("endTime")));
+            weChatMapMsg.put("offset",Integer.parseInt(weChatMapMsg.get("pageIndex")+""));
+            weChatMapMsg.put("limit",Integer.parseInt(weChatMapMsg.get("pageSize")+""));
+            //调用接口限制间隔时间
+            Date msgDate = mallMngChangeMapper.getPullDataTime((String)weChatMapMsg.put("tranDirection",msg.get("tranDirection")));
+            long diff=(new Date().getTime()-msgDate.getTime())/1000/60;
+            if(diff>2){
+                //if(true){
+                //记录调用参数接口日志
+                pullQueryData(weChatMapMsg);
+                List<NewSystemFormatEntiy> list = mallMngChangeMapper.getSalesDetaiData(weChatMapMsg);
+                String md5List = Md5Utils.encryption(JSON.toJSONString(list));
+                return Result.success(md5List);
+            }else{
+                return Result.error("1003","请求过于频繁,请稍后再试");
+            }
+        }catch (Exception e){
+            logger.error("外部系统查询订单销售数据错误"+ JSON.toJSONString(msg),e);
+            return Result.error("1002","参数错误");
+        }
+
+    }
+
+    /**
+     * 记录外部调用接口参数,时间和调用方
+     * @param msg
+     */
+    private void pullQueryData(Map msg) {
+        Map<String,Object> map = new HashMap<>();
+        map.put("tranDirection",msg.get("tranDirection"));
+        map.put("msg",msg.toString());
+        mallMngChangeMapper.pullQueryData(map);
+
+    }
+
+}

+ 13 - 0
eccs-biz/src/main/java/com/emato/biz/service/mall/ISalesDetaiServicel.java

@@ -0,0 +1,13 @@
+package com.emato.biz.service.mall;
+
+import com.alibaba.fastjson.JSONObject;
+import com.emato.biz.domain.mall.NewSystemFormatEntiy;
+import com.emato.common.core.Result;
+
+import java.util.List;
+
+public interface ISalesDetaiServicel {
+    int pushSalesDetaiServicel(NewSystemFormatEntiy newSystemFormatEntiy);
+
+    Result getSalesDetaiData(JSONObject msg);
+}

+ 161 - 0
eccs-biz/src/main/resources/mapper/biz/mall/MallMngChangeMapper.xml

@@ -113,4 +113,165 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+
+
+    <!--    接收kmall数据-->
+    <insert id="pushSalesDetaiDate" parameterType="NewSystemFormatEntiy">
+        insert into mall_sales_detail_data
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="merchSn != null">merch_sn,</if>
+            <if test="merchSnName != null">merch_sn_name,</if>
+            <if test="thirdMerchSn != null">third_merch_sn,</if>
+            <if test="thirdMerchSnName != null">third_merch_sn_name,</if>
+            <if test="receiptNo != null">receipt_no,</if>
+            <if test="storeName != null">store_name,</if>
+            <if test="storeNameSn != null">store_name_sn,</if>
+            <if test="cashRegisterNo != null">cash_register_no,</if>
+            <if test="timeStampDetails != null">time_stamp,</if>
+            <if test="staffID != null">staff_id,</if>
+            <if test="staffName != null">staff_name,</if>
+            <if test="payFlag != null">pay_flag,</if>
+            <if test="orderStatus != null">order_status,</if>
+            <if test="orderSnWx != null">order_sn_wx,</if>
+
+            <if test="orderSnAli != null">order_sn_ali,</if>
+            <if test="hsCode != null">hs_code,</if>
+            <if test="hsCodeName != null">hs_code_name,</if>
+            <if test="ematouCode != null">ematou_code,</if>
+            <if test="plu != null">plu,</if>
+            <if test="mychemID != null">mychem_id,</if>
+            <if test="productNameEN != null">product_name_en,</if>
+            <if test="productNameCN != null">product_name_cn,</if>
+            <if test="barcode != null">barcode,</if>
+            <if test="packSize != null">pack_size,</if>
+            <if test="productSpecification != null">product_spec,</if>
+            <if test="brand != null">brand,</if>
+            <if test="edlp != null">edlp,</if>
+            <if test="currentPrice != null">current_price,</if>
+            <if test="costPrice != null">cost_price,</if>
+            <if test="taxRate != null">tax_rate,</if>
+            <if test="taxPrice != null">tax_price,</if>
+            <if test="productCategory != null">product_category,</if>
+            <if test="supplierName != null">supplier_name,</if>
+            <if test="transactionType != null">transaction_type,</if>
+            <if test="saleReturnType != null">sale_return_type,</if>
+            <if test="remark != null">remark,</if>
+
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="merchSn != null">#{merchSn},</if>
+            <if test="merchSnName != null">#{merchSnName},</if>
+            <if test="thirdMerchSn != null">#{thirdMerchSn},</if>
+            <if test="thirdMerchSnName != null">#{thirdMerchSnName},</if>
+            <if test="receiptNo != null">#{receiptNo},</if>
+            <if test="storeName != null">#{storeName},</if>
+            <if test="storeNameSn != null">#{storeNameSn},</if>
+            <if test="cashRegisterNo != null">#{cashRegisterNo},</if>
+            <if test="timeStampDetails != null">#{timeStampDetails},</if>
+            <if test="staffID != null">#{staffID},</if>
+            <if test="staffName != null">#{staffName},</if>
+            <if test="payFlag != null">#{payFlag},</if>
+            <if test="orderStatus != null">#{orderStatus},</if>
+            <if test="orderSnWx != null">#{orderSnWx},</if>
+
+            <if test="orderSnAli != null">#{orderSnAli},</if>
+            <if test="hsCode != null">#{hsCode},</if>
+            <if test="hsCodeName != null">#{hsCodeName},</if>
+            <if test="ematouCode != null">#{ematouCode},</if>
+            <if test="plu != null">#{plu},</if>
+            <if test="mychemID != null">#{mychemID},</if>
+            <if test="productNameEN != null">#{productNameEN},</if>
+            <if test="productNameCN != null">#{productNameCN},</if>
+            <if test="barcode != null">#{barcode},</if>
+            <if test="packSize != null">#{packSize},</if>
+            <if test="productSpecification != null">#{productSpecification},</if>
+            <if test="brand != null">#{brand},</if>
+            <if test="edlp != null">#{edlp},</if>
+            <if test="currentPrice != null">#{currentPrice},</if>
+            <if test="costPrice != null">#{costPrice},</if>
+            <if test="taxRate != null">#{taxRate},</if>
+            <if test="taxPrice != null">#{taxPrice},</if>
+            <if test="productCategory != null">#{productCategory},</if>
+            <if test="supplierName != null">#{supplierName},</if>
+            <if test="transactionType != null">#{transactionType},</if>
+            <if test="saleReturnType != null">#{saleReturnType},</if>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
+
+    <!--    外部接口查询订单信息-->
+    <select id="getSalesDetaiData"  parameterType="java.util.Map" resultType="com.emato.biz.domain.mall.PushSystemOdOderVo">
+        SELECT
+--         merch_sn as merchSn,
+        merch_sn_name as merchSnName,
+--         third_merch_sn as thirdMerchSn,
+        third_merch_sn_name as thirdMerchSnName,
+        receipt_no as receiptNo,
+        store_name as storeName,
+        store_name_sn as storeNameSn,
+        cash_register_no as cashRegisterNo,
+        time_stamp as timeStampDetails,
+        staff_id as staffID,
+        staff_name as staffName,
+        pay_flag as payFlag,
+        order_status as orderStatus,
+        order_sn_wx as orderSnWx,
+        order_sn_ali as orderSnAli,
+        hs_code as hsCode,
+        hs_code_name as hsCodeName,
+        ematou_code as ematouCode,
+        plu as plu,
+        mychem_id as mychemID,
+        product_name_en as productNameEN,
+        product_name_cn as productNameCN,
+        barcode as barcode,
+        pack_size as packSize,
+        product_spec as productSpecification,
+        brand as brand,
+        edlp as edlp,
+        current_price as currentPrice,
+        cost_price as costPrice,
+        tax_rate as taxRate,
+        tax_price as taxPrice,
+        product_category as productCategory,
+        supplier_name as supplierName,
+        transaction_type as transactionType,
+        sale_return_type as saleReturnType,
+        remark
+        FROM
+        mall_sales_detail_data
+<!--        WHERE-->
+<!--        <if test="starTime != null and starTime != ''">-->
+<!--             time_stamp &gt; STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')-->
+<!--        </if>-->
+<!--        <if test="endTime != null and endTime != ''">-->
+<!--            AND time_stamp &lt;= STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')-->
+<!--        </if>-->
+<!--        <if test="orderStatus !=null and orderStatus !=''">-->
+<!--            AND order_status = #{orderStatus}-->
+<!--        </if>-->
+<!--        <if test="offset != null and limit != null">-->
+<!--            limit #{offset}, #{limit}-->
+<!--        </if>-->
+    </select>
+
+    <!--    记录外部调用接口入参-->
+    <insert id="pullQueryData" parameterType="java.lang.String">
+        insert into mall_sales_detail_log(
+        <if test="msg != null and msg != '' ">msg,</if>
+        <if test="tranDirection != null and tranDirection != '' ">tran_direction,</if>
+        msg_date
+        )values(
+        <if test="msg != null and msg != ''">#{msg},</if>
+        <if test="tranDirection != null and tranDirection != ''">#{tranDirection},</if>
+        sysdate()
+        )
+    </insert>
+
+    <select  id="getPullDataTime" parameterType="java.lang.String" resultType="java.util.Date">
+        select msg_date from mall_sales_detail_log where tran_direction = #{tranDirection} order by msg_date desc limit 1
+    </select>
+
+
 </mapper>

+ 163 - 0
eccs-biz/src/main/resources/mapper/biz/mall/SalesDetailMapper.xml.xml

@@ -0,0 +1,163 @@
+<?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="com.emato.biz.mapper.mall.SalesDetailMapper">
+
+
+<!--    接收kmall数据-->
+    <insert id="pushSalesDetaiDate" parameterType="NewSystemFormatEntiy">
+        insert into mall_sales_detail_data(
+            <if test="merchSn != null">merch_sn,</if>
+            <if test="merchSnName != null">merch_sn_name,</if>
+            <if test="thirdMerchSn != null">third_merch_sn,</if>
+            <if test="thirdMerchSnName != null">third_merch_sn_name,</if>
+            <if test="receiptNo != null">receipt_no,</if>
+            <if test="storeName != null">store_name,</if>
+            <if test="storeNameSn != null">store_name_sn,</if>
+            <if test="cashRegisterNo != null">ash_register_no,</if>
+             /*销售时间*/
+            <if test="timeStampDetails != null">time_stamp,</if>
+            <if test="staffID != null">staff_id,</if>
+            <if test="staffName != null">staff_name,</if>
+            <if test="payFlag != null">pay_flag,</if>
+            <if test="orderStatus != null">order_status,</if>
+            <if test="orderSnWx != null">order_sn_wx,</if>
+
+            <if test="orderSnAli != null">order_sn_ali,</if>
+            <if test="hsCode != null">hs_code,</if>
+            <if test="hsCodeName != null">hs_code_name,</if>
+            <if test="ematouCode != null">ematou_code,</if>
+            <if test="plu != null">plu,</if>
+            <if test="mychemID != null">mychem_id,</if>
+            <if test="productNameEN != null">product_name_en,</if>
+            <if test="productNameCN != null">product_name_cn,</if>
+            <if test="barcode != null">barcode,</if>
+            <if test="packSize != null">pack_size,</if>
+            <if test="productSpecification != null">product_spec,</if>
+            <if test="brand != null">brand,</if>
+            <if test="edlp != null">edlp,</if>
+            <if test="currentPrice != null">current_price,</if>
+            <if test="costPrice != null">cost_price,</if>
+            <if test="taxRate != null">tax_rate,</if>
+            <if test="productCategory != null">product_category,</if>
+            <if test="supplierName != null">supplier_name,</if>
+            <if test="transactionType != null">transaction_type,</if>
+            <if test="saleReturnType != null">sale_return_type,</if>
+            <if test="remark != null">remark</if>
+        )values(
+        <if test="merchSn != null">#{merchSn},</if>
+        <if test="merchSnName != null">#{merchSnName},</if>
+        <if test="thirdMerchSn != null">#{thirdMerchSn},</if>
+        <if test="thirdMerchSnName != null">#{thirdMerchSnName},</if>
+        <if test="receiptNo != null">#{receiptNo},</if>
+        <if test="storeName != null">#{storeName},</if>
+        <if test="storeNameSn != null">#{storeNameSn},</if>
+        <if test="cashRegisterNo != null">#{cashRegisterNo},</if>
+        /*销售时间*/
+        <if test="timeStampDetails != null">#{timeStampDetails},</if>
+        <if test="staffID != null">#{staffID},</if>
+        <if test="staffName != null">#{staffName},</if>
+        <if test="payFlag != null">#{payFlag},</if>
+        <if test="orderStatus != null">#{orderStatus},</if>
+        <if test="orderSnWx != null">#{orderSnWx},</if>
+
+        <if test="orderSnAli != null">#{orderSnAli},</if>
+        <if test="hsCode != null">#{hsCode},</if>
+        <if test="hsCodeName != null">#{hsCodeName},</if>
+        <if test="ematouCode != null">#{ematouCode},</if>
+        <if test="plu != null">#{plu},</if>
+        <if test="mychemID != null">#{mychemID},</if>
+        <if test="productNameEN != null">#{productNameEN},</if>
+        <if test="productNameCN != null">#{productNameCN},</if>
+        <if test="barcode != null">#{barcode},</if>
+        <if test="packSize != null">#{packSize},</if>
+        <if test="productSpecification != null">#{productSpecification},</if>
+        <if test="brand != null">#{brand},</if>
+        <if test="edlp != null">#{edlp},</if>
+        <if test="currentPrice != null">#{currentPrice},</if>
+        <if test="costPrice != null">#{costPrice},</if>
+        <if test="taxRate != null">#{taxRate},</if>
+        <if test="productCategory != null">#{productCategory},</if>
+        <if test="supplierName != null">#{supplierName},</if>
+        <if test="transactionType != null">#{transactionType},</if>
+        <if test="saleReturnType != null">#{saleReturnType},</if>
+        <if test="remark != null">#{remark}</if>
+        )
+    </insert>
+
+
+<!--    外部接口查询订单信息-->
+    <select id="getSalesDetaiData"  parameterType="java.util.Map" resultType="com.emato.biz.domain.mall.NewSystemFormatEntiy">
+        SELECT
+        merch_sn,
+        merch_sn_name,
+        third_merch_sn,
+        third_merch_sn_name,
+        receipt_no,
+        store_name,
+        store_name_sn,
+        ash_register_no,
+        time_stamp,
+        staff_id,
+        staff_name,
+        pay_flag,
+        order_status,
+        order_sn_wx,
+        order_sn_ali,
+        hs_code,
+        hs_code_name,
+        ematou_code,
+        plu,
+        mychem_id,
+        product_name_en,
+        product_name_cn,
+        barcode,
+        pack_size,
+        product_spec,
+        brand,
+        edlp,
+        current_price,
+        cost_price,
+        tax_rate,
+        product_category,
+        supplier_name,
+        transaction_type,
+        sale_return_type,
+        remark,
+        create_time
+        FROM
+        mall_sales_detail_data
+        WHERE
+        STR_TO_DATE(create_time, '%Y-%m-%d %H:%i:%s')
+        BETWEEN
+        <if test="starTime !=null and starTime !=''">
+            STR_TO_DATE(#{starTime}, '%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="endTime !=null and endTime !=''">
+            AND STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="orderStatus !=null and orderStatus !=''">
+            AND order_status = #{orderStatus}
+        </if>
+        <if test="pageIndex != null and pageSize != null">
+            limit #{pageIndex}, #{pageSize}
+        </if>
+    </select>
+
+<!--    记录外部调用接口入参-->
+    <insert id="pullQueryData" parameterType="java.util.Map">
+        insert into mall_sales_detail_log
+        <if test="msg != null and msg != '' ">msg,</if>
+        <if test="tranDirection != null and tranDirection != '' ">tran_direction,</if>
+        datasyn_time
+        )values(
+        <if test="msg != null and msg != ''">#{msg},</if>
+        <if test="tranDirection != null and tranDirection != ''">#{tranDirection},</if>
+        sysdate()
+        )
+    </insert>
+
+
+
+</mapper>

+ 12 - 0
eccs-common/src/main/java/com/emato/common/annotation/AnonymousAccess.java

@@ -0,0 +1,12 @@
+package com.emato.common.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 匿名认证
+ */
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface AnonymousAccess {
+}

+ 76 - 0
eccs-common/src/main/java/com/emato/common/core/Result.java

@@ -0,0 +1,76 @@
+package com.emato.common.core;
+
+import java.io.Serializable;
+
+public class Result implements Serializable {
+
+    private String code;
+
+    private String msg;
+
+    private String status;
+
+    private Object data;
+
+
+
+    public static Result success() {
+        Result result = new Result();
+        result.code = "200";
+        result.msg = "请求成功";
+        result.status = "true";
+        result.data = null;
+        return result;
+    }
+
+    public static Result success(Object data) {
+        Result result = new Result();
+        result.code = "200";
+        result.msg = "请求成功";
+        result.status = "true";
+        result.data = data;
+        return result;
+    }
+
+    public static Result error(String code, String msg) {
+        Result result = new Result();
+        result.code = code;
+        result.status = "false";
+        result.msg = msg;
+        result.data = "";
+        return result;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+}
+

+ 25 - 0
eccs-common/src/main/java/com/emato/common/utils/DateUtils.java

@@ -152,4 +152,29 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         // long sec = diff % nd % nh % nm / ns;
         return day + "天" + hour + "小时" + min + "分钟";
     }
+
+
+    public static String getStrDate(String mlDate){
+        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置格式
+        String timeText=format.format(Long.parseLong(mlDate));
+        return timeText;
+    }
+
+    /**
+     * @param strDate
+     * @param
+     * @return 若失败则返回当前时间
+     */
+    public static Date parseToDate(String strDate) {
+        try {
+            if (strDate == null || strDate.trim().length() == 0) {
+                return new Date();
+            }
+            SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
+            return sdf.parse(strDate);
+        } catch (ParseException e) {
+            return new Date();
+        }
+    }
+
 }

+ 33 - 0
eccs-common/src/main/java/com/emato/common/utils/sign/Md5Utils.java

@@ -1,5 +1,6 @@
 package com.emato.common.utils.sign;
 
+import java.io.UnsupportedEncodingException;
 import java.security.MessageDigest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,4 +64,36 @@ public class Md5Utils
             return s;
         }
     }
+
+
+    /**
+     * MD5加密,返回32位密文
+     * @param plainText
+     * @return String
+     * @throws UnsupportedEncodingException
+     */
+    public static String encryption(String plainText){
+        String re_md5 = new String();
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(plainText.getBytes("UTF-8"));
+            byte b[] = md.digest();
+            int i;
+            StringBuffer buf = new StringBuffer("");
+            for (int offset = 0; offset < b.length; offset++) {
+                i = b[offset];
+                if (i < 0)
+                    i += 256;
+                if (i < 16)
+                    buf.append("0");
+                buf.append(Integer.toHexString(i));
+            }
+            re_md5 = buf.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return re_md5;
+    }
+
+
 }

+ 22 - 0
eccs-framework/src/main/java/com/emato/framework/config/SecurityConfig.java

@@ -1,5 +1,7 @@
 package com.emato.framework.config;
 
+import com.emato.common.annotation.AnonymousAccess;
+import com.emato.common.utils.spring.SpringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpMethod;
@@ -17,6 +19,13 @@ import org.springframework.web.filter.CorsFilter;
 import com.emato.framework.security.filter.JwtAuthenticationTokenFilter;
 import com.emato.framework.security.handle.AuthenticationEntryPointImpl;
 import com.emato.framework.security.handle.LogoutSuccessHandlerImpl;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * spring security配置
@@ -113,6 +122,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/webjars/**").anonymous()
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
+                .antMatchers(getAnonymousAccess()).anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()
@@ -125,6 +135,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
         httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
     }
 
+    private String[] getAnonymousAccess() {
+        Map<RequestMappingInfo, HandlerMethod> handlerMethods = SpringUtils.getBean(RequestMappingHandlerMapping.class).getHandlerMethods();
+        Set<String> anonymousAccess = new HashSet<>();
+        for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethods.entrySet()) {
+            HandlerMethod value = entry.getValue();
+            AnonymousAccess methodAnnotation = value.getMethodAnnotation(AnonymousAccess.class);
+            if (methodAnnotation != null) {
+                anonymousAccess.addAll(entry.getKey().getPatternsCondition().getPatterns());
+            }
+        }
+        return anonymousAccess.toArray(new String[0]);
+    }
     
     /**
      * 强散列哈希加密实现