Bläddra i källkod

Merge branch 'master' of hj/kmall-pt-general into master

杨波 4 år sedan
förälder
incheckning
5eccf14efe

+ 24 - 0
kmall-admin/src/main/java/com/kmall/admin/annotation/NoRepeatSubmit.java

@@ -0,0 +1,24 @@
+package com.kmall.admin.annotation;
+
+import org.springframework.stereotype.Component;
+
+import java.lang.annotation.*;
+
+/**
+ * 自定义防重复提交注解
+ * @author  hj
+ * @createDate 2021-04-29
+ */
+@Inherited
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@Component
+public @interface NoRepeatSubmit {
+
+    /**
+     * 默认时间  默认5秒钟
+     * @return
+     */
+    int lockTime() default 5000;
+}

+ 74 - 0
kmall-admin/src/main/java/com/kmall/admin/aop/RepeatSubmitAspect.java

@@ -0,0 +1,74 @@
+package com.kmall.admin.aop;
+
+import com.kmall.admin.annotation.NoRepeatSubmit;
+import com.kmall.common.utils.RRException;
+import com.kmall.manager.manager.redis.JedisUtil;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Objects;
+
+/**
+ * @author  hj
+ * @createDate 2021-04-29
+ */
+@Aspect
+@Component
+@SuppressWarnings("all")
+public class RepeatSubmitAspect {
+    private final static Logger logger = LoggerFactory.getLogger(RepeatSubmitAspect.class);
+    public static final String KEYPREX = "noRpeat:user:";
+
+    /**
+     * 进行接口防重复操作处理
+     *
+     * @param pjp
+     * @param noRepeatSubmit
+     * @return
+     */
+    @Around("execution(* com.kmall.admin.controller.*.*(..)) && @annotation(noRepeatSubmit) ")
+    public Object around(ProceedingJoinPoint pjp, NoRepeatSubmit noRepeatSubmit) throws Throwable {
+        try {
+            //获取request
+            HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
+            //拿到token和请求路径
+            StringBuilder sb = new StringBuilder();
+//            sb.append(KEYPREX).append(request.getHeader("token").toString()).append(request.getRequestURI().toString());
+            sb.append(KEYPREX).append(request.getRequestURI().toString());
+            //获取现在时间
+            long now = System.currentTimeMillis();
+            if (JedisUtil.exists(sb.toString())) {
+                //上次请求时间
+//                long lastTime = Long.valueOf(redisTemplate.opsForValue().get(sb.toString()).toString());
+                long lastTime = Long.valueOf(JedisUtil.get(sb.toString()).toString());
+                // 如果现在距离上次提交时间小于设置的默认时间 则 判断为重复提交  否则 正常提交 -> 进入业务处理
+                if ((now - lastTime) > noRepeatSubmit.lockTime()) {
+                    //重新记录时间 10分钟过期时间
+//                    redisTemplate.opsForValue().set(sb.toString(), String.valueOf(now), 10, TimeUnit.MINUTES);
+                    JedisUtil.set(sb.toString(), String.valueOf(now), 10);
+                    //处理业务
+                    Object result = pjp.proceed();
+                    return result;
+                } else {
+                    throw new RRException("点击的太快了,请慢一点!");
+                }
+            } else {
+                //第一次操作
+                JedisUtil.set(sb.toString(), String.valueOf(now), 10);
+//                redisTemplate.opsForValue().set(sb.toString(),String.valueOf(now),10, TimeUnit.MINUTES);
+                Object result = pjp.proceed();
+                return result;
+            }
+        } catch (Throwable e) {
+            logger.error("校验表单重复提交时异常: {}", e.getMessage());
+            throw new RRException("校验重复提交时异常");
+        }
+    }
+}

+ 3 - 33
kmall-admin/src/main/java/com/kmall/admin/controller/MallPaymentOrderDataController.java

@@ -1,15 +1,12 @@
 package com.kmall.admin.controller;
 
+import com.kmall.admin.annotation.NoRepeatSubmit;
 import com.kmall.admin.entity.MallPaymentOrderDataEntity;
 import com.kmall.admin.service.MallPaymentOrderDataService;
 import com.kmall.admin.utils.ParamUtils;
-import com.kmall.common.constant.Dict;
-import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
-import com.kmall.common.utils.RRException;
-import com.kmall.common.utils.excel.ExcelUtil;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -19,8 +16,6 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -36,8 +31,6 @@ import java.util.Map;
 public class MallPaymentOrderDataController {
     @Autowired
     private MallPaymentOrderDataService mall2PaymentOrderDataService;
-    @Autowired
-    private ExcelUtil excelUtil;
 
     /**
      * 查看列表
@@ -124,38 +117,15 @@ public class MallPaymentOrderDataController {
     @RequiresPermissions("mallpaymentorderdata:upload")
     @ResponseBody
     public R upload(@RequestParam("file") MultipartFile file,@RequestParam Map<String, Object> params) throws Exception {
-
-        List<MallPaymentOrderDataEntity> list = new ArrayList<>();
         String payFlag = params.get("payFlag").toString();
-        try {
-            if (file.isEmpty()) {
-                throw new RRException("上传文件不能为空");
-            }
-            MallPaymentOrderDataEntity mallPaymentOrderDataEntity = new MallPaymentOrderDataEntity();
-            Map<String, Object> beans = new HashMap<String, Object>();
-            beans.put("MallPaymentOrderDataEntity", mallPaymentOrderDataEntity);
-            beans.put("MallPaymentOrderDataEntityList", list);
-            if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
-                excelUtil.readExcel(JxlsXmlTemplateName.WX_PAYMENT_ORDER_DTO_List, beans, file.getInputStream());
-            }else if (Dict.payFlag.item_alipay.getItem().equals(payFlag)){
-                excelUtil.readExcel(JxlsXmlTemplateName.ALI_PAYMENT_ORDER_DTO_List, beans, file.getInputStream());
-            }
-        }catch (Exception e) {
-            e.printStackTrace();
-            return R.error("导入失败!");
-        }
-        try {
-            mall2PaymentOrderDataService.saveUploadExcel(list, payFlag);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return R.error(e.getMessage());
-        }
+        mall2PaymentOrderDataService.saveUploadExcel(file, payFlag);
         return R.ok("导入成功!");
     }
 
     /**
      * System Format 导出请求
      */
+    @NoRepeatSubmit
     @RequestMapping(value = "exportDataFormat")
     @RequiresPermissions("mallpaymentorderdata:exportDataFormat")
     @ResponseBody

+ 234 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/AliPaymentOrderDto.java

@@ -0,0 +1,234 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+
+public class AliPaymentOrderDto implements Serializable {
+    private static final long serialVersionUID = 1731952263436733954L;
+
+    private  String aliid;
+    /**
+     * 商户名称
+     */
+    private String merchantName;
+    /**
+     * 商户订单号
+     */
+    private String outTradeNo;
+    /**
+     * 支付金额(wx订单金额 zfb收入)
+     */
+    private String payMoney;
+    /**
+     * 退款金额(wx退款金额  zfb支出)
+     */
+    private String refundMoney;
+    /**
+     * 支付类型(wx交易类型 zfb账务类型)
+     */
+    private String payType;
+    /**
+     * 付款类型(wx付款银行 zfb支付渠道)
+     */
+    private String paymentType;
+    /**
+     * 交易订单号(wx订单号,zfb交易号)
+     */
+    private String transactionOrder;
+
+    /**
+     * 时间
+     */
+    private String timeStr;
+    /**
+     * 流水号
+     */
+    private String serialNumber;
+    /**
+     * 对方账户
+     */
+    private String oppositeAccount;
+    /**
+     * 对方名称
+     */
+    private String otherName;
+    /**
+     * 银行订单号
+     */
+    private String bankOrder;
+    /**
+     * 业务基础订单号
+     */
+    private String businessBasicOrder;
+    /**
+     * 业务账单来源
+     */
+    private String businessBillingSource;
+    /**
+     * 业务订单号
+     */
+    private String businessOrder;
+    /**
+     * 业务描述
+     */
+    private String businessDescription;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 付款备注
+     */
+    private String paymentNotes;
+
+    public String getAliid() {
+        return aliid;
+    }
+
+    public void setAliid(String aliid) {
+        this.aliid = aliid;
+    }
+
+    public String getMerchantName() {
+        return merchantName;
+    }
+
+    public void setMerchantName(String merchantName) {
+        this.merchantName = merchantName;
+    }
+
+    public String getOutTradeNo() {
+        return outTradeNo;
+    }
+
+    public void setOutTradeNo(String outTradeNo) {
+        this.outTradeNo = outTradeNo;
+    }
+
+    public String getPayMoney() {
+        return payMoney;
+    }
+
+    public void setPayMoney(String payMoney) {
+        this.payMoney = payMoney;
+    }
+
+    public String getRefundMoney() {
+        return refundMoney;
+    }
+
+    public void setRefundMoney(String refundMoney) {
+        this.refundMoney = refundMoney;
+    }
+
+    public String getPayType() {
+        return payType;
+    }
+
+    public void setPayType(String payType) {
+        this.payType = payType;
+    }
+
+    public String getPaymentType() {
+        return paymentType;
+    }
+
+    public void setPaymentType(String paymentType) {
+        this.paymentType = paymentType;
+    }
+
+    public String getTransactionOrder() {
+        return transactionOrder;
+    }
+
+    public void setTransactionOrder(String transactionOrder) {
+        this.transactionOrder = transactionOrder;
+    }
+
+    public String getTimeStr() {
+        return timeStr;
+    }
+
+    public void setTimeStr(String timeStr) {
+        this.timeStr = timeStr;
+    }
+
+    public String getSerialNumber() {
+        return serialNumber;
+    }
+
+    public void setSerialNumber(String serialNumber) {
+        this.serialNumber = serialNumber;
+    }
+
+    public String getOppositeAccount() {
+        return oppositeAccount;
+    }
+
+    public void setOppositeAccount(String oppositeAccount) {
+        this.oppositeAccount = oppositeAccount;
+    }
+
+    public String getOtherName() {
+        return otherName;
+    }
+
+    public void setOtherName(String otherName) {
+        this.otherName = otherName;
+    }
+
+    public String getBankOrder() {
+        return bankOrder;
+    }
+
+    public void setBankOrder(String bankOrder) {
+        this.bankOrder = bankOrder;
+    }
+
+    public String getBusinessBasicOrder() {
+        return businessBasicOrder;
+    }
+
+    public void setBusinessBasicOrder(String businessBasicOrder) {
+        this.businessBasicOrder = businessBasicOrder;
+    }
+
+    public String getBusinessBillingSource() {
+        return businessBillingSource;
+    }
+
+    public void setBusinessBillingSource(String businessBillingSource) {
+        this.businessBillingSource = businessBillingSource;
+    }
+
+    public String getBusinessOrder() {
+        return businessOrder;
+    }
+
+    public void setBusinessOrder(String businessOrder) {
+        this.businessOrder = businessOrder;
+    }
+
+    public String getBusinessDescription() {
+        return businessDescription;
+    }
+
+    public void setBusinessDescription(String businessDescription) {
+        this.businessDescription = businessDescription;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getPaymentNotes() {
+        return paymentNotes;
+    }
+
+    public void setPaymentNotes(String paymentNotes) {
+        this.paymentNotes = paymentNotes;
+    }
+}

+ 271 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/WxPaymentOrderDto.java

@@ -0,0 +1,271 @@
+package com.kmall.admin.dto;
+
+import java.io.Serializable;
+
+public class WxPaymentOrderDto implements Serializable {
+    private static final long serialVersionUID = 4563229331408755581L;
+    /**
+     * 商户名称
+     */
+    private String merchantName;
+    /**
+     * 商户订单号
+     */
+    private String outTradeNo;
+    /**
+     * 支付金额(wx订单金额 zfb收入)
+     */
+    private String payMoney;
+    /**
+     * 退款金额(wx退款金额  zfb支出)
+     */
+    private String refundMoney;
+    /**
+     * 支付类型(wx交易类型 zfb账务类型)
+     */
+    private String payType;
+    /**
+     * 付款类型(wx付款银行 zfb支付渠道)
+     */
+    private String paymentType;
+    /**
+     * 交易订单号(wx订单号,zfb交易号)
+     */
+    private String transactionOrder;
+    /**
+     * 时间
+     */
+    private String timeStr;
+    /**
+     * 商家数据包,原样返回
+     */
+    private String attach;
+    /**
+     * 交易状态
+     */
+    private String transactionStatus;
+    /**
+     * 货币种类
+     */
+    private String currencyType;
+    /**
+     * 应结订单金额
+     */
+    private String amountOrder;
+    /**
+     * 微信退款单号
+     */
+    private String refundId;
+    /**
+     * 商户退款单号
+     */
+    private String merRefundNumber;
+    /**
+     * 退款状态
+     */
+    private String refundStatus;
+    /**
+     * 代金券
+     */
+    private String cashCoupon;
+    /**
+     * 充值券退款金额
+     */
+    private String refundRechargpCoupon;
+    /**
+     * 手续费
+     */
+    private String feeCharge;
+    /**
+     * 费率
+     */
+    private String rate;
+    /**
+     * 退款类型
+     */
+    private String refundType;
+    /**
+     * 申请退款金额
+     */
+    private String applyRefundAmount;
+    /**
+     * 费率备注
+     */
+    private String rateRemark;
+
+    public String getMerchantName() {
+        return merchantName;
+    }
+
+    public void setMerchantName(String merchantName) {
+        this.merchantName = merchantName;
+    }
+
+    public String getOutTradeNo() {
+        return outTradeNo;
+    }
+
+    public void setOutTradeNo(String outTradeNo) {
+        this.outTradeNo = outTradeNo;
+    }
+
+    public String getPayMoney() {
+        return payMoney;
+    }
+
+    public void setPayMoney(String payMoney) {
+        this.payMoney = payMoney;
+    }
+
+    public String getRefundMoney() {
+        return refundMoney;
+    }
+
+    public void setRefundMoney(String refundMoney) {
+        this.refundMoney = refundMoney;
+    }
+
+    public String getPayType() {
+        return payType;
+    }
+
+    public void setPayType(String payType) {
+        this.payType = payType;
+    }
+
+    public String getPaymentType() {
+        return paymentType;
+    }
+
+    public void setPaymentType(String paymentType) {
+        this.paymentType = paymentType;
+    }
+
+    public String getTransactionOrder() {
+        return transactionOrder;
+    }
+
+    public void setTransactionOrder(String transactionOrder) {
+        this.transactionOrder = transactionOrder;
+    }
+
+    public String getTimeStr() {
+        return timeStr;
+    }
+
+    public void setTimeStr(String timeStr) {
+        this.timeStr = timeStr;
+    }
+
+    public String getAttach() {
+        return attach;
+    }
+
+    public void setAttach(String attach) {
+        this.attach = attach;
+    }
+
+    public String getTransactionStatus() {
+        return transactionStatus;
+    }
+
+    public void setTransactionStatus(String transactionStatus) {
+        this.transactionStatus = transactionStatus;
+    }
+
+    public String getCurrencyType() {
+        return currencyType;
+    }
+
+    public void setCurrencyType(String currencyType) {
+        this.currencyType = currencyType;
+    }
+
+    public String getAmountOrder() {
+        return amountOrder;
+    }
+
+    public void setAmountOrder(String amountOrder) {
+        this.amountOrder = amountOrder;
+    }
+
+    public String getRefundId() {
+        return refundId;
+    }
+
+    public void setRefundId(String refundId) {
+        this.refundId = refundId;
+    }
+
+    public String getMerRefundNumber() {
+        return merRefundNumber;
+    }
+
+    public void setMerRefundNumber(String merRefundNumber) {
+        this.merRefundNumber = merRefundNumber;
+    }
+
+    public String getRefundStatus() {
+        return refundStatus;
+    }
+
+    public void setRefundStatus(String refundStatus) {
+        this.refundStatus = refundStatus;
+    }
+
+    public String getCashCoupon() {
+        return cashCoupon;
+    }
+
+    public void setCashCoupon(String cashCoupon) {
+        this.cashCoupon = cashCoupon;
+    }
+
+    public String getRefundRechargpCoupon() {
+        return refundRechargpCoupon;
+    }
+
+    public void setRefundRechargpCoupon(String refundRechargpCoupon) {
+        this.refundRechargpCoupon = refundRechargpCoupon;
+    }
+
+    public String getFeeCharge() {
+        return feeCharge;
+    }
+
+    public void setFeeCharge(String feeCharge) {
+        this.feeCharge = feeCharge;
+    }
+
+    public String getRate() {
+        return rate;
+    }
+
+    public void setRate(String rate) {
+        this.rate = rate;
+    }
+
+    public String getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(String refundType) {
+        this.refundType = refundType;
+    }
+
+    public String getRateRemark() {
+        return rateRemark;
+    }
+
+    public void setRateRemark(String rateRemark) {
+        this.rateRemark = rateRemark;
+    }
+
+    public String getApplyRefundAmount() {
+        return applyRefundAmount;
+    }
+
+    public void setApplyRefundAmount(String applyRefundAmount) {
+        this.applyRefundAmount = applyRefundAmount;
+    }
+}

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/service/MallPaymentOrderDataService.java

@@ -2,6 +2,7 @@ package com.kmall.admin.service;
 
 
 import com.kmall.admin.entity.MallPaymentOrderDataEntity;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
@@ -80,6 +81,8 @@ public interface MallPaymentOrderDataService {
      */
     int saveUploadExcel(List<MallPaymentOrderDataEntity> list,String payFlag);
 
+    void saveUploadExcel(MultipartFile file, String payFlag);
+
     /**
      * 导出支付宝、微信流水账单
      * @param map

+ 126 - 3
kmall-admin/src/main/java/com/kmall/admin/service/impl/MallPaymentOrderDataServiceImpl.java

@@ -1,18 +1,21 @@
 package com.kmall.admin.service.impl;
 
 import com.kmall.admin.dao.MallPaymentOrderDataDao;
+import com.kmall.admin.dto.AliPaymentOrderDto;
+import com.kmall.admin.dto.WxPaymentOrderDto;
 import com.kmall.admin.entity.MallPaymentOrderDataEntity;
-import com.kmall.admin.entity.compared.PayOrderInfoEntity;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
 import com.kmall.admin.service.MallPaymentOrderDataService;
-import com.kmall.admin.service.SaleRecordService;
 import com.kmall.admin.utils.ShiroUtils;
 import com.kmall.common.constant.Dict;
+import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.RRException;
 import com.kmall.common.utils.excel.ExcelExport;
+import com.kmall.common.utils.excel.ExcelUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
@@ -30,6 +33,9 @@ public class MallPaymentOrderDataServiceImpl implements MallPaymentOrderDataServ
     @Autowired
     private MallPaymentOrderDataDao mall2PaymentOrderDataDao;
 
+    @Autowired
+    private ExcelUtil excelUtil;
+
     @Override
     public MallPaymentOrderDataEntity queryObject(Integer payOrderId) {
         return mall2PaymentOrderDataDao.queryObject(payOrderId);
@@ -72,7 +78,6 @@ public class MallPaymentOrderDataServiceImpl implements MallPaymentOrderDataServ
         if (list!=null && list.size()>0) {
             for (MallPaymentOrderDataEntity  paymentOrderDataEntity : list) {
 
-
                 //判断wx要进行截取
                 if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
                     try {
@@ -118,6 +123,124 @@ public class MallPaymentOrderDataServiceImpl implements MallPaymentOrderDataServ
     }
 
     @Override
+    public void saveUploadExcel(MultipartFile file, String payFlag) {
+        List<WxPaymentOrderDto> wxPaymentOrderDtoList = new ArrayList<>();
+        List<AliPaymentOrderDto> aliPaymentOrderDtoList = new ArrayList<>();
+        try {
+            if (file.isEmpty()) {
+                throw new RRException("上传文件不能为空");
+            }
+            if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
+
+                WxPaymentOrderDto wxPaymentOrderDto = new WxPaymentOrderDto();
+                Map<String, Object> beans = new HashMap<String, Object>();
+                beans.put("WxPaymentOrderDto", wxPaymentOrderDto);
+                beans.put("WxPaymentOrderDtoList", wxPaymentOrderDtoList);
+                excelUtil.readExcel(JxlsXmlTemplateName.WX_PAYMENT_ORDER_DTO_List, beans, file.getInputStream());
+            }else if (Dict.payFlag.item_alipay.getItem().equals(payFlag)){
+
+                AliPaymentOrderDto aliPaymentOrderDto = new AliPaymentOrderDto();
+                Map<String, Object> beans = new HashMap<String, Object>();
+                beans.put("AliPaymentOrderDto", aliPaymentOrderDto);
+                beans.put("AliPaymentOrderDtoList", aliPaymentOrderDtoList);
+                excelUtil.readExcel(JxlsXmlTemplateName.ALI_PAYMENT_ORDER_DTO_List, beans, file.getInputStream());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+            throw new RRException("导入失败!");
+        }
+
+        try {
+            if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
+                saveWxData(wxPaymentOrderDtoList,payFlag);
+            }else if (Dict.payFlag.item_alipay.getItem().equals(payFlag)){
+                saveAliData(aliPaymentOrderDtoList,payFlag);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RRException(e.getMessage());
+        }
+    }
+
+    private void saveWxData(List<WxPaymentOrderDto> list,String payFlag){
+        List<MallPaymentOrderDataEntity> insertList = new ArrayList<>();
+        SysUserEntity sysUserEntity = ShiroUtils.getUserEntity();
+        if (list!=null && list.size()>0) {
+            for (WxPaymentOrderDto wxPaymentOrderDto : list) {
+
+                try {
+                    wxPaymentOrderDto.setTimeStr(wxPaymentOrderDto.getTimeStr().split("`")[1].toString());
+                    wxPaymentOrderDto.setTransactionOrder(wxPaymentOrderDto.getTransactionOrder().split("`")[1].toString());
+                    wxPaymentOrderDto.setOutTradeNo(wxPaymentOrderDto.getOutTradeNo().split("`")[1].toString());
+                    wxPaymentOrderDto.setAmountOrder(wxPaymentOrderDto.getAmountOrder().split("`")[1].toString());
+                    wxPaymentOrderDto.setMerchantName(wxPaymentOrderDto.getMerchantName().split("`")[1].toString());
+                    wxPaymentOrderDto.setPayMoney(wxPaymentOrderDto.getPayMoney().split("`")[1].toString());
+                    wxPaymentOrderDto.setRefundMoney(wxPaymentOrderDto.getRefundMoney().split("`")[1].toString());
+                    wxPaymentOrderDto.setRefundId(wxPaymentOrderDto.getRefundId().split("`")[1].toString());
+                    wxPaymentOrderDto.setCashCoupon(wxPaymentOrderDto.getCashCoupon().split("`")[1].toString());
+                    wxPaymentOrderDto.setMerRefundNumber(wxPaymentOrderDto.getMerRefundNumber().split("`")[1].toString());
+                    wxPaymentOrderDto.setRefundRechargpCoupon(wxPaymentOrderDto.getRefundRechargpCoupon().split("`")[1].toString());
+                    wxPaymentOrderDto.setFeeCharge(wxPaymentOrderDto.getFeeCharge().split("`")[1].toString());
+                    wxPaymentOrderDto.setRate(wxPaymentOrderDto.getRate().split("`")[1].toString());
+                    wxPaymentOrderDto.setApplyRefundAmount(wxPaymentOrderDto.getApplyRefundAmount().split("`")[1].toString());
+                } catch (Exception e) {
+                    throw new RRException("导入的数据不是微信账单!");
+                }
+                String outTradeNo = wxPaymentOrderDto.getOutTradeNo();
+                String timeStr = wxPaymentOrderDto.getTimeStr();
+                Map<String, Object> map = new HashMap<>();
+                map.put("timeStr",timeStr);
+                map.put("outTradeNo",outTradeNo);
+
+                //根据时间和商户订单号来判断当前数据是否有重复录入
+                List<MallPaymentOrderDataEntity> timeAndTnoData = mall2PaymentOrderDataDao.queryListTimeAndTnoData(map);
+                if (timeAndTnoData.size()>0) {
+                    throw new RRException("数据有重复,请检查导入数据的正确性!");
+                }
+
+                MallPaymentOrderDataEntity mallPaymentOrderDataEntity = new MallPaymentOrderDataEntity();
+                BeanUtils.copyProperties(wxPaymentOrderDto,mallPaymentOrderDataEntity);
+                mallPaymentOrderDataEntity.setCreaterSn(sysUserEntity.getUsername());
+                mallPaymentOrderDataEntity.setCreateTime(new Date());
+                mallPaymentOrderDataEntity.setPayFlag(payFlag);
+                insertList.add(mallPaymentOrderDataEntity);
+            }
+            mall2PaymentOrderDataDao.saveBatch(insertList);
+        }else {
+            throw new RRException("导入数据信息为空,请看模版再重新导入!");
+        }
+    }
+    private void saveAliData(List<AliPaymentOrderDto> list,String payFlag){
+        List<MallPaymentOrderDataEntity> insertList = new ArrayList<>();
+        SysUserEntity sysUserEntity = ShiroUtils.getUserEntity();
+        if (list!=null && list.size()>0) {
+            for (AliPaymentOrderDto aliPaymentOrderDto : list) {
+
+                String outTradeNo = aliPaymentOrderDto.getOutTradeNo();
+                String timeStr = aliPaymentOrderDto.getTimeStr();
+                Map<String, Object> map = new HashMap<>();
+                map.put("timeStr",timeStr);
+                map.put("outTradeNo",outTradeNo);
+
+                //根据时间和商户订单号来判断当前数据是否有重复录入
+                List<MallPaymentOrderDataEntity> timeAndTnoData = mall2PaymentOrderDataDao.queryListTimeAndTnoData(map);
+                if (timeAndTnoData.size()>0) {
+                    throw new RRException("数据有重复,请检查导入数据的正确性!");
+                }
+                MallPaymentOrderDataEntity mallPaymentOrderDataEntity = new MallPaymentOrderDataEntity();
+                BeanUtils.copyProperties(aliPaymentOrderDto,mallPaymentOrderDataEntity);
+                mallPaymentOrderDataEntity.setCreaterSn(sysUserEntity.getUsername());
+                mallPaymentOrderDataEntity.setCreateTime(new Date());
+                mallPaymentOrderDataEntity.setPayFlag(payFlag);
+                insertList.add(mallPaymentOrderDataEntity);
+            }
+            mall2PaymentOrderDataDao.saveBatch(insertList);
+        }else {
+            throw new RRException("导入数据信息为空,请看模版再重新导入!");
+        }
+    }
+    @Override
     public void exportDataFormatList(Map<String, Object> map, HttpServletResponse response) {
         List<MallPaymentOrderDataEntity> mallList = mall2PaymentOrderDataDao.queryListData(map);
         String payFlag = map.get("payFlag").toString();

+ 22 - 22
kmall-admin/src/main/resources/XmlTemplate/AliPaymentOrderDtoList.xml

@@ -1,29 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <workbook>
-    <worksheet name="Sheet1">
+    <worksheet name="zfb">
         <section startRow="0" endRow="0"/>
-        <loop startRow="1" endRow="1" items="MallPaymentOrderDataEntityList" var="MallPaymentOrderDataEntity"
-              varType="com.kmall.admin.entity.MallPaymentOrderDataEntity">
+        <loop startRow="1" endRow="1" items="AliPaymentOrderDtoList" var="AliPaymentOrderDto"
+              varType="com.kmall.admin.dto.AliPaymentOrderDto">
             <section startRow="1" endRow="1">
-                <mapping row="1" col="0">MallPaymentOrderDataEntity.aliid</mapping>
-                <mapping row="1" col="1">MallPaymentOrderDataEntity.timeStr</mapping>
-                <mapping row="1" col="2">MallPaymentOrderDataEntity.transactionOrder</mapping>
-                <mapping row="1" col="3">MallPaymentOrderDataEntity.serialNumber</mapping>
-                <mapping row="1" col="4">MallPaymentOrderDataEntity.outTradeNo</mapping>
-                <mapping row="1" col="5">MallPaymentOrderDataEntity.payType</mapping>
-                <mapping row="1" col="6">MallPaymentOrderDataEntity.payMoney</mapping>
-                <mapping row="1" col="7">MallPaymentOrderDataEntity.refundMoney</mapping>
-                <mapping row="1" col="8">MallPaymentOrderDataEntity.paymentType</mapping>
-                <mapping row="1" col="9">MallPaymentOrderDataEntity.oppositeAccount</mapping>
-                <mapping row="1" col="10">MallPaymentOrderDataEntity.otherName</mapping>
-                <mapping row="1" col="11">MallPaymentOrderDataEntity.bankOrder</mapping>
-                <mapping row="1" col="12">MallPaymentOrderDataEntity.merchantName</mapping>
-                <mapping row="1" col="13">MallPaymentOrderDataEntity.remark</mapping>
-                <mapping row="1" col="14">MallPaymentOrderDataEntity.businessBasicOrder</mapping>
-                <mapping row="1" col="15">MallPaymentOrderDataEntity.businessOrder</mapping>
-                <mapping row="1" col="16">MallPaymentOrderDataEntity.businessBillingSource</mapping>
-                <mapping row="1" col="17">MallPaymentOrderDataEntity.businessDescription</mapping>
-                <mapping row="1" col="18">MallPaymentOrderDataEntity.paymentNotes</mapping>
+                <mapping row="1" col="0">AliPaymentOrderDto.aliid</mapping>
+                <mapping row="1" col="1">AliPaymentOrderDto.timeStr</mapping>
+                <mapping row="1" col="2">AliPaymentOrderDto.transactionOrder</mapping>
+                <mapping row="1" col="3">AliPaymentOrderDto.serialNumber</mapping>
+                <mapping row="1" col="4">AliPaymentOrderDto.outTradeNo</mapping>
+                <mapping row="1" col="5">AliPaymentOrderDto.payType</mapping>
+                <mapping row="1" col="6">AliPaymentOrderDto.payMoney</mapping>
+                <mapping row="1" col="7">AliPaymentOrderDto.refundMoney</mapping>
+                <mapping row="1" col="8">AliPaymentOrderDto.paymentType</mapping>
+                <mapping row="1" col="9">AliPaymentOrderDto.oppositeAccount</mapping>
+                <mapping row="1" col="10">AliPaymentOrderDto.otherName</mapping>
+                <mapping row="1" col="11">AliPaymentOrderDto.bankOrder</mapping>
+                <mapping row="1" col="12">AliPaymentOrderDto.merchantName</mapping>
+                <mapping row="1" col="13">AliPaymentOrderDto.remark</mapping>
+                <mapping row="1" col="14">AliPaymentOrderDto.businessBasicOrder</mapping>
+                <mapping row="1" col="15">AliPaymentOrderDto.businessOrder</mapping>
+                <mapping row="1" col="16">AliPaymentOrderDto.businessBillingSource</mapping>
+                <mapping row="1" col="17">AliPaymentOrderDto.businessDescription</mapping>
+                <mapping row="1" col="18">AliPaymentOrderDto.paymentNotes</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 25 - 25
kmall-admin/src/main/resources/XmlTemplate/WxPaymentOrderDtoList.xml

@@ -1,32 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <workbook>
-    <worksheet name="Sheet1">
+    <worksheet name="wx">
         <section startRow="0" endRow="0"/>
-        <loop startRow="1" endRow="1" items="MallPaymentOrderDataEntityList" var="MallPaymentOrderDataEntity"
-              varType="com.kmall.admin.entity.MallPaymentOrderDataEntity">
+        <loop startRow="1" endRow="1" items="WxPaymentOrderDtoList" var="WxPaymentOrderDto"
+              varType="com.kmall.admin.dto.WxPaymentOrderDto">
             <section startRow="1" endRow="1">
-                <mapping row="1" col="0">MallPaymentOrderDataEntity.timeStr</mapping>
-                <mapping row="1" col="1">MallPaymentOrderDataEntity.transactionOrder</mapping>
-                <mapping row="1" col="2">MallPaymentOrderDataEntity.outTradeNo</mapping>
-                <mapping row="1" col="3">MallPaymentOrderDataEntity.payType</mapping>
-                <mapping row="1" col="4">MallPaymentOrderDataEntity.transactionStatus</mapping>
-                <mapping row="1" col="5">MallPaymentOrderDataEntity.paymentType</mapping>
-                <mapping row="1" col="6">MallPaymentOrderDataEntity.currencyType</mapping>
-                <mapping row="1" col="7">MallPaymentOrderDataEntity.amountOrder</mapping>
-                <mapping row="1" col="8">MallPaymentOrderDataEntity.cashCoupon</mapping>
-                <mapping row="1" col="9">MallPaymentOrderDataEntity.refundId</mapping>
-                <mapping row="1" col="10">MallPaymentOrderDataEntity.merRefundNumber</mapping>
-                <mapping row="1" col="11">MallPaymentOrderDataEntity.refundMoney</mapping>
-                <mapping row="1" col="12">MallPaymentOrderDataEntity.refundRechargpCoupon</mapping>
-                <mapping row="1" col="13">MallPaymentOrderDataEntity.refundType</mapping>
-                <mapping row="1" col="14">MallPaymentOrderDataEntity.refundStatus</mapping>
-                <mapping row="1" col="15">MallPaymentOrderDataEntity.merchantName</mapping>
-                <mapping row="1" col="16">MallPaymentOrderDataEntity.attach</mapping>
-                <mapping row="1" col="17">MallPaymentOrderDataEntity.feeCharge</mapping>
-                <mapping row="1" col="18">MallPaymentOrderDataEntity.rate</mapping>
-                <mapping row="1" col="19">MallPaymentOrderDataEntity.payMoney</mapping>
-                <mapping row="1" col="20">MallPaymentOrderDataEntity.applyRefundAmount</mapping>
-                <mapping row="1" col="21">MallPaymentOrderDataEntity.rateRemark</mapping>
+                <mapping row="1" col="0">WxPaymentOrderDto.timeStr</mapping>
+                <mapping row="1" col="1">WxPaymentOrderDto.transactionOrder</mapping>
+                <mapping row="1" col="2">WxPaymentOrderDto.outTradeNo</mapping>
+                <mapping row="1" col="3">WxPaymentOrderDto.payType</mapping>
+                <mapping row="1" col="4">WxPaymentOrderDto.transactionStatus</mapping>
+                <mapping row="1" col="5">WxPaymentOrderDto.paymentType</mapping>
+                <mapping row="1" col="6">WxPaymentOrderDto.currencyType</mapping>
+                <mapping row="1" col="7">WxPaymentOrderDto.amountOrder</mapping>
+                <mapping row="1" col="8">WxPaymentOrderDto.cashCoupon</mapping>
+                <mapping row="1" col="9">WxPaymentOrderDto.refundId</mapping>
+                <mapping row="1" col="10">WxPaymentOrderDto.merRefundNumber</mapping>
+                <mapping row="1" col="11">WxPaymentOrderDto.refundMoney</mapping>
+                <mapping row="1" col="12">WxPaymentOrderDto.refundRechargpCoupon</mapping>
+                <mapping row="1" col="13">WxPaymentOrderDto.refundType</mapping>
+                <mapping row="1" col="14">WxPaymentOrderDto.refundStatus</mapping>
+                <mapping row="1" col="15">WxPaymentOrderDto.merchantName</mapping>
+                <mapping row="1" col="16">WxPaymentOrderDto.attach</mapping>
+                <mapping row="1" col="17">WxPaymentOrderDto.feeCharge</mapping>
+                <mapping row="1" col="18">WxPaymentOrderDto.rate</mapping>
+                <mapping row="1" col="19">WxPaymentOrderDto.payMoney</mapping>
+                <mapping row="1" col="20">WxPaymentOrderDto.applyRefundAmount</mapping>
+                <mapping row="1" col="21">WxPaymentOrderDto.rateRemark</mapping>
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 39 - 33
kmall-admin/src/main/webapp/js/shop/mallpaymentorderdata.js

@@ -1,3 +1,4 @@
+var flag = true;
 $(function () {
     $("#jqGrid").jqGrid({
         url: '../mallpaymentorderdata/list',
@@ -6,11 +7,11 @@ $(function () {
 			{label: '编号', name: 'payOrderId', index: 'pay_order_id', key: true, hidden: true},
 			{label: '商品名称', name: 'merchantName', index: 'merchant_name', width: 80},
 			{label: '商户订单号', name: 'outTradeNo', index: 'out_trade_no', width: 80},
-			{label: '微信订单/支付宝交易号', name: 'transactionOrder', index: 'transaction_order', width: 80},
-			{label: '支付金额', name: 'payMoney', index: 'pay_money', width: 80},
-			{label: '退款金额', name: 'refundMoney', index: 'refund_money', width: 80},
+			{label: '微信订单/支付宝交易号', name: 'transactionOrder', index: 'transaction_order', width: 80},
+			{label: '订单/收入金额', name: 'payMoney', index: 'pay_money', width: 80},
+			{label: '退款/支出金额', name: 'refundMoney', index: 'refund_money', width: 80},
 			{label: '支付方式', name: 'payFlag', index: 'pay_flag', width: 80},
-			{label: '入账/交易时间', name: 'timeStr', index: 'time_str', width: 80},
+			{label: '交易/入账时间', name: 'timeStr', index: 'time_str', width: 80},
 			{label: '添加人', name: 'createrSn', index: 'creater_sn', width: 80},
 			{label: '上传时间', name: 'createTime', index: 'create_time', width: 80, formatter: function (value) {
 					return transDate(value,'yyyy-MM-dd hh:mm:ss');
@@ -281,37 +282,42 @@ let vm = new Vue({
 			});
 		},
 		exportDataFormat : function () {
+			if (flag){
+				flag = false;
+				var params = {};
+				params.payFlag=vm.q.payFlag;
+				params.startTime=vm.q.startTime;
+				params.endTime=vm.q.endTime;
+				if(!params.payFlag){
+					alert("请选择支付类型");
+					return ;
+				}
+				if(!params.startTime || !params.endTime){
+					alert("请选择创建订单时间");
+					return ;
+				}
+				let startDateTime = Date.parse(new Date(params.startTime));
+				let endDateTime = Date.parse(new Date(params.endTime));
+				if(startDateTime > endDateTime){
+					alert("创建订单开始时间不能大于创建订单结束时间");
+					return ;
+				}
 
-			var params = {};
-			params.payFlag=vm.q.payFlag;
-			params.startTime=vm.q.startTime;
-			params.endTime=vm.q.endTime;
-			if(!params.payFlag){
-				alert("请选择支付类型");
-				return ;
-			}
-			if(!params.startTime || !params.endTime){
-				alert("请选择创建订单时间");
-				return ;
-			}
-			let startDateTime = Date.parse(new Date(params.startTime));
-			let endDateTime = Date.parse(new Date(params.endTime));
-			if(startDateTime > endDateTime){
-				alert("创建订单开始时间不能大于创建订单结束时间");
-				return ;
-			}
-
-			let day = Math.abs(parseInt((endDateTime - startDateTime)/1000/3600/24));
-			if(day > 30 || Object.is(day,NaN)){
-				alert("导出时间不能相差大于30天");
-				return ;
+				let day = Math.abs(parseInt((endDateTime - startDateTime)/1000/3600/24));
+				if(day > 30 || Object.is(day,NaN)){
+					alert("导出时间不能相差大于30天");
+					return ;
+				}
+				// const msg = this.$Message.loading({
+				// 	content: 'Loading...',
+				// 	duration: 0
+				// });
+				// setTimeout(msg, 1000);
+				dialogLoading(true);
+				exportFile('#rrapp', '../mallpaymentorderdata/exportDataFormat', params);
+				setTimeout(dialogLoading(false),5000);
+				setTimeout(flag = true,5000);
 			}
-			const msg = this.$Message.loading({
-				content: 'Loading...',
-				duration: 0
-			});
-			exportFile('#rrapp', '../mallpaymentorderdata/exportDataFormat', params);
-			setTimeout(msg, 1000);
 		},
 	},
 	mounted() {

BIN
kmall-admin/src/main/webapp/statics/file/ali_yyyy_mm_dd_v1.0.0.xls


BIN
kmall-admin/src/main/webapp/statics/file/wx_yyyy_mm_dd_v1.0.0.xls